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

Khan API Reference

These are the tasks Khan can be passed and the gifts it can give.

Tasks

Here are the tasks you can pass Khan. You'd either use %fard to run a thread from a file or %lard to run an in-line thread.

%fard

Run a thread from within Arvo.

[%fard p=(fyrd cage)]

.p contains the thread location, name, and start arguments. See the +fyrd data type reference entry for details.

Returns

When the thread finishes, either by succeeding or failing, Khan will return an %arow gift.


%fyrd

External thread.

[%fyrd p=(fyrd cast)]

This is passed to Khan by the runtime when a thread is run externally. You would not use this from userspace.


%lard

In-line thread.

The $bear is either a $desk or $beak. The $shed is the thread itself. Since Spider doesn't need to read out the thread from Clay, the $bear doesn't do much apart from be included in the thread name that Spider generates. Khan will have Spider run the given thread, and eventually give an %arow gift back with the result.

Returns

When the thread eventually finishes (or if it fails), Khan with give an %arow gift back with the result.


%done

Socket closed.

Tells Khan that the external control socket has closed. This comes from the runtime; you would not send it from userspace.

Gifts

These are the two gifts Khan can give. In userspace, you'd only receive an %arow.

%arow

In-arvo result.

This gift contains the result of a finished thread if successful, or an error and stack trace if it failed. It's given for threads run from within Arvo. See the +avow entry in the types reference for more details.


%avow

External result.

This gift contains the result of running a thread externally. You would not receive this in userspace.

A $page is a pair of $mark and $noun. See the +avow entry in the types reference for more details of that mold builder.


Last updated