For the complete documentation index, see llms.txt. This page is also available as Markdown.

Ames API Reference

In this document we describe the public interface for Ames. Namely, we describe each task that Ames can be %passed, and which gift(s) Ames can %give in return.

Some tasks appear to have more than one arm associated to them, e.g. there are four +on-hear arms. We denote this where it occurs, but always refer to the +on-hear:event-core arm.

Ames tasks can be naturally divided into three categories: messaging tasks, system/lifecycle tasks, and remote scry tasks.

Messaging Tasks

%hear

[%hear =lane =blob]

%hear handles raw packet receipt.

This task only ever originates from Unix. It does the initial processing of a packet, namely by passing the raw packet information to +decode-packet which deserializes the packet and giving that data and the origin of the packet to +on-hear-packet, which begins the transformation of the packet into a new event in the form of a +event-core.

There are multiple +on-hear arms in ames.hoon. Here we refer to +on-hear:event-core, as that is the one called by a %hear task. The other ones are used primarily for ack and nack processing, or receiving message fragments.

%hear takes in a $blob, which is essentially a large atom (around 1kB or less) that is the raw data of the message, and a $lane, which is the origin of the message (typically an IP address).

Returns

%hear can trigger a number of possible returns. It can trigger the release of zero or more additional packets via %send gifts. It may also trigger a %boon or %plea gift (collectively referred to as a %memo within Ames) to a local vane in the case of a completed message.


%halt

$>(%halt deep)

where the relevant case of $deep is:

%halt stops a flow after we hear a remote %flub — that is, after the peer's Gall has told us the destination agent will not currently accept the $plea. A halted flow stops re-sending; no new timers are started for it.

Ames also passes a %halt task to Gall in the other direction, which is how the remote %flub gets emitted: Gall's +mo-halt gives a %boon carrying %flub back to the $plea sender.

The flow's halt flag is set in either direction:

  • forward: Gall passes a %flub to Ames.

  • backward: a $plea gets %flubbed over the wire.

Returns

This task returns no gifts.


%goad

%goad restarts flows to .ship that were previously halted, once the remote agent is live again. Halted flows do not start new timers, so a %goad is what gets them moving.

The $ship field specifies the peer whose flows should be restarted.

Returns

This task returns no gifts.


%plea

%plea is the task used to instruct Ames to send a message. It extends the %pass/%give semantics across the network. As such, it is the most fundamental task in Ames and the primary reason for its existence.

Ames also +passes a %plea $note to another vane when it receives a message on a "forward flow" from a peer, originally passed from one of the peer's vanes to the peer's Ames.

Ultimately %plea causes %send gift(s) to be sent to Unix, which tells Unix to send packets. In terms of %pass/%give semantics, this is in response to the %born task, which came along the Unix $duct, rather than a response to the %plea.

A %plea task takes in the $ship the $plea is addressed to, and a $plea.

Returns

This task returns no gifts.


System Tasks

%born

Each time you start your Urbit, the Arvo kernel calls the %born task for Ames.

Returns

In response to a %born task, Ames %gives Jael a %turf gift.

The $duct along which %born comes is Ames' only duct to Unix, so %send gifts (which are instructions for Unix to send a packet) are also returned in response to %born.


%init

%init is called a single time during the very first boot process, immediately after the larval stage is completed. This initializes the vane. Jael is initialized first, followed by other vanes such as Ames.

In response to receiving the %init task, Ames subscribes to the information contained by Jael.

Returns

%init sends two moves that subscribe to %turf and %private-keys in Jael.


%sift

This task filters debug output by ship. This task is used internally when the |ames/sift hood generator is run from the Dojo.

The .ships field specifies the ships for which debug output is desired.

Returns

This task returns no gifts.


%snub

This task blacklists/whitelists ships in Ames.

The form field specifies whether the given ships should be blacklisted or whitelisted. The ships field are the ships to blacklist/whitelist.

The Ames snub settings can only have one form at a time: an %allow list or %deny list. If an %allow form is set, packets from all ships not on the list will be blocked. If a %deny form is set, packets from any ship on the list will be blocked, and all others allowed.

Note: a %snub task overrides the existing snub list and form entirely, it does not merely add/remove ships from the existing list.

If you just want to add/remove a ship from an existing blacklist/whitelist, you'll need to first scry out the existing snub settings, make your changes, and send the whole modified list and form in a new %snub task.

Returns

This task returns no gifts.


%spew

Sets verbosity toggles on debug output. This task is used internally when the |ames/verb hood generator is run from the dojo.

%spew takes in a +list of $verb, which are verbosity flags for Ames.

%spew flips each toggle given in veb.

Returns

This task returns no gifts.


%stir

A %stir task starts timers for any flows that lack them.

The arg field is unused.

Returns

This task returns no gifts.


%vega

%vega is called whenever the kernel is updated. Ames currently does not do anything in response to this.

Returns

This task returns no gifts.


Remote scry tasks

%keen

Perform an unencrypted or multi-party encrypted remote scry.

A %keen task asks Ames to perform a remote scry, retrieving the value of $path on the given $ship in the $spar. The .sec field provides optional encryption details for multi-party encrypted scries.

The $path has the general format of /[vane-letter]/[care]/[revision]/[rest-of-path]. For a regular read into Gall, it's /g/x/[revision]/[agent]//[rest-of-path]. Note the empty element in between the agent and the rest of the path.

Note that you would not use this task directly from userspace. For unencrypted or multi-party encrypted scries you'd use a Gall %keen note and for two-party encrypted scries you'd use a %chum task.

Returns

A %tune gift. A %tune gift looks like:

It represents a result. The $roar field is null if Ames doesn't have a response, but may have one in the future. The $roar contains a signature and the data. The data in the $roar will be null if there is no value at the path in question and will never be. These two cases are equivalent to ~ and [~ ~] of a local scry.


%chum

Perform a two-party encrypted remote scry.

A $spar is a pair of $ship and remote scry $path like /c/x/4/base/sys/hoon/hoon.

The $path has the general format of /[vane-letter]/[care]/[revision]/[rest-of-path]. For a regular read into Gall, it's /g/x/[revision]/[agent]//[rest-of-path]. Note the empty element in between the agent and the rest of the path.

Note this is for two-party encrypted remote scries only. For unencrypted or multi-party encrypted scries you'd use a Gall %keen note.

Returns

A %tune gift. A %tune gift looks like:

It represents a result. The $roar field is null if Ames doesn't have a response, but may have one in the future. The $roar contains a signature and the data. The data in the $roar will be null if there is no value at the path in question and will never be. These two cases are equivalent to ~ and [~ ~] of a local scry.


%yawn

Cancel a remote scry request.

A %yawn task asks Ames to cancel an existing remote scry request to the given $path on the given $ship.

Returns

This task returns no gifts.


%wham

A %wham task asks Ames to cancel all existing remote scry requests from all vanes on all ducts for the given $path on the given $ship.

Returns

A %tune gift with a null $data is given to all listeners. See the %keen entry for more details of the %tune gift.


Flow and peer management

These tasks manage message flows and per-peer routing state.

%cork

Request to delete a message flow. Ames negotiates the teardown with the peer; a flow is closed on the sender side first and only fully removed once both ends agree. The /corked and /closing scries report flows in each state.


%kroc

Request to delete specific message flows, identified by their $bones. This is the bulk, targeted form of %cork.


%tame

Request to delete the cached route for a ship, so that its lane is rediscovered.


%dear

A lane from Unix — manually associates a ship with a transport address. This is how a route can be supplied directly rather than discovered.


%deep

Deferred calls to Ames, from itself. Ames passes these to defer work into a later event rather than performing it inline. The $deep union covers nack handling, flow teardown (%cork, %kill), the %ahoy migration, and flow halting.


%stun

A STUN response, or failure, from Unix. Ames uses STUN to learn whether it is behind a NAT and what its externally visible address is, which feeds route discovery.


%prod

Re-send a packet per flow. If .ships is ~, this applies to all peers. Used to shake loose flows that have stalled.


%cong

Adjust congestion control parameters — the number of messages and the amount of memory Ames will allow to be outstanding before it considers a flow clogged. This backs the |ames/cong generator.


%trim

Release memory. This is the standard vane task.


Remote scry key reservation

%plug

Reserve a key for the %shut (encrypted remote scry) namespace at the given path, so that data published there can be read only by holders of the key.


%gulp

The same as %plug, but for the |mesa network core. Both are handled by the same arm; they differ only in how the key is derived.


Directed Messaging migration

Ames contains a second network core, |mesa, alongside the original |ames one. Peers are migrated between them individually, and Ames records which core each peer is on. These tasks drive that migration; in practice they are sent by the |ahoy/*, |mate, |rege and |ress generators rather than directly.

%mate

Migrate a peer, or all peers if the unit is null, to |mesa. A true .dry performs a test run without applying the migration.


%rege

Regress a peer, or all peers if null, back to |ames. The inverse of %mate.


%load

Set which network core is used for new peers. The default is %ames, so that communication with peers on older kernels is always possible.


Mesa protocol tasks

The following tasks belong to the |mesa core's own packet and message protocol. They are internal to Ames and the runtime, and are not intended to be sent from userspace or from other vanes:


Gifts

The complete $gift:ames union:

Messaging gifts:

  • %boon - A response message from a remote ship, given to the vane that is party to the flow.

  • %noon - A %boon carrying a duct, for clog tracking.

  • %done - Notifies a vane that the peer acked or nacked our message. A non-null .error means it was nacked.

  • %lost - Notifies a vane that we crashed while processing a %boon.

  • %send - A packet, given to Unix to transmit.

  • %nail - Lanes for a ship, given to Unix.

Remote scry gifts:

  • %tune - A peek result, as a (unit roar). A null value means the data does not and will never exist.

  • %near - A peek result for a %chum request.

  • %stub - A reserved key for the %shut namespace, given in response to %plug.

System gifts:

  • %turf - A domain report, relayed from Jael.

  • %saxo - Our sponsor list.

Mesa gifts, internal to the |mesa core:

  • %push - Send a request or response packet.

  • %sage - Give a deserialized payload.

  • %page - Give a serialized, sealed payload.

  • %rate - Report rate progress, mirroring the %rate task.

Last updated