is_airlock_api library
The airlock's contract: what a tool returns for a call, the programs its actions run, what each would do to the world (Reach), what the airlock decided (AirlockDecisionOnAction), and how proposals and their outcomes are written in the logbook.
Types and their JSON only. Proposing an action is the agent loop's,
through ProposesActions; deciding and carrying one out is the
airlock's (is_airlock), through CarriesOutEachProgram. Writing the
web requests that post a reply is a module's, through
WritesSlackReplyRequests and WritesWebAddressReplyRequests. What an action
takes and gives back, and the drivers that carry it out, are
is_effects's; joining an is_tools_api definition to what a tool does
is is_tool's.
Classes
-
Action<
A> - Run a program on an input, then continue with what became of it.
- ActionProposedByAgentLoop
- An action an agent loop proposes, not yet decided: its program and input, read from a kind entry and checked.
-
AirlockDecisionOnAction<
P> - What the airlock decided about an action that would do reach, on the trajectory named trajectoryId, at place in a step, before any driver is reached. With no result written after it, the logbook shows the action was cut short.
- Allow
- A driver may carry the action out.
- AskTheModel
- Asks the model, through the model driver, as the ModelCall's sign-in, with the system prompt and request its ModelRequestFromPieces entry holds.
- CallsTheModel
- Reaches the model: call goes out as its sign-in, to its model, with the texts its ModelRequestFromPieces entry holds. A rule grants it by the sign-in, one the trajectory's rules let a model call go out as.
- CarriesOutEachProgram
- Carries out each kind of Program: one method per program, each given that program's own input type. What the airlock implements over its drivers. A method returns null when this machine cannot run that program.
- Decision
- What the airlock decided about one action.
- Deny
-
No driver carries the action out, because why; its continuation is handed
NothingRanwith that reason. -
Done<
A> -
The tool's answer. value reaches the model as its definition's
Outputwrites it out. - EntryId
-
A recorded journal entry, of any kind: a turn, an event, an airlock
decision, a chunk of a reply. It is the sha256 of the entry, the same
digest as
is_journal'sEntryHash, so a reader asks the journal for the entry by it and checks that what comes back hashes to it. - Executable
-
A program started as a process, such as
git: its input is plain arguments, and it reaches whatever the process can. - Failed
-
The tool could not answer, because why. A Result of every tool, since
Neveris a subtype of every type; the model is told why as an error. - FetchesFromWeb
- Reaches the world with an address alone: a GET goes to origin, as signIn or under none when null, and its response's body is kept as fetch asks. Its own reach, so a grant to post somewhere is not a grant to fetch from it, or the other way round.
- FetchFromWeb
- Fetches from a site, through the sign-in it names, with a GET that sends no body and no headers, and keeps the response's body as WebFetch.keep asks: a document's bytes, or a listing's text.
- LoopUser
-
A user from the loop pool,
loop-<n>: a trajectory's agent loop runs as it, one per running loop. It holds no sign-in and owns no files: the airlock makes the loop's model calls. The logbook service takes the entries on a path's chain, its proposals among them, only from the path's loop user. - MakesWebRequests
- Reaches the world: makes requests, exactly these, in order, each to its origin as its sign-in.
- MakeWebRequests
-
Makes
ProposedRequests to the web, exactly these, in order, each to its origin as its sign-in: what the tool that proposed them built. - ModelCall
- A model call a loop proposes: as which of the person's model sign-ins, to which model, and the ModelRequestFromPieces entry, written on its trajectory's chain before this, that holds exactly what is sent.
- ModelRequestFromPieces
- What a step sends the model, written to the logbook before it is sent: its systemPrompt and its request, each as a TextFromPieces, and the messages they were drawn from.
- ModelRequestPiece
- One run of a text a model request sends, in the order TextFromPieces.pieces names it: an entry of its own in the logbook, and named by that entry, so the request shows the logbook accepted each piece, from a sender it allows, before it was sent. A piece repeated from an earlier request (the history so far) is a new entry with a new id, since an entry's id hashes its previous too, but its bytes are kept once: the logbook stores an entry's content as an object, by sha256, however many entries name it.
- ObjectId
- The name of some bytes: their sha256.
- PlaceInTrajectory
- Where in its trajectory a loop proposed an action. A trajectory is a run of steps, each one model call and what it caused; a place names the step, counted across the whole trajectory, and within it either the model call, an action of one of the intents the model's reply holds, or an action of the reply the loop makes from the model's final text. A turn, a user's message through to its final reply, may take several steps; a place never counts turns. Each is fixed by what the logbook already holds, never by the order things ran in, so a loop that restarts proposes the same actions at the same places, and a place the logbook already answers is one it need not propose again.
-
Program<
I, O> -
A program an action may run: what it takes,
I, and what it gives back,O. - ProposedForAnIntent
- The place of action of intent in step: the intent is a tool call the model's reply holds, by its place in that reply, and the action is one the tool's propose expressions propose, in the order they propose them.
- ProposedForTheModelCall
- The place of step's model call, which no intent draws: one action, the first of the step.
- ProposedForTheReply
- The place of action of step's reply, which the loop makes from the model's final text and no intent draws, such as running the program that builds the message and then sending what it built; the last of the step.
- ProposesActions
- Proposes an action and gives back what became of it: in the agent loop, through the logbook, for the airlock to decide and a driver to carry out.
- Reach
- What an action would do to the world, typed, so the airlock can decide and write it to the logbook without knowing the action's types: one per Program.
- ReadFile
- Reads the file at a path under the file driver's root.
- ReadFileBytes
- Reads the exact bytes of the file at a path under the file driver's root, such as a .docx's zip. Every byte returned goes into the logbook, so the driver refuses a file over its size limit.
- Reads
- Reads the file at path, as text or as its exact bytes. Either way it reveals the same file, so a rule granting path grants both.
- Received
- What an ActionProposedByAgentLoop.kind logbook entry came to, once read: an ActionProposedByAgentLoop to consider, or Rejected.
- Rejected
- An ActionProposedByAgentLoop.kind logbook entry that is not a proposal, because why. The airlock service keeps proposalRejectedToJson naming it, so the loop that wrote it is answered and no other path is stalled.
- RepliesToOwnConversation
- Reaches the world: posts content to the conversation the trajectory was started from, and only there. It names no conversation and no sign-in, since the airlock grants the trajectory's own endpoint and the sign-in to reply as, so a grant to reply is never a grant to post anywhere else. Holds the exact text and footer, so the decision is about what will be sent.
- ReplyToOwnConversation
-
Replies to the conversation the trajectory was started from: posts the
ReplyContentthere and nowhere else, as the sign-in the airlock chose. -
Result<
A> -
What a tool's code returns for a call: an action whose outcome it needs
before it can answer, its answer, or that it could not answer.
Ais the type of the answer, the tool's output type. - Starts
- Suit
-
A user from the suit pool,
suit-<n>: the identity one trajectory wears, contained or open (Nick, 16 Nov: "suit"; https://github.com/enspyrco/intersyntactic/pull/1158). The path's programs run as it, through the airlock's program driver. Nothing of loop_launcher's runs as it. - TextFromPieces
- One text a model request sends, as the logbook keeps it: the ModelRequestPiece entries it is made of, in order, and the sha256 of its UTF-8 bytes, which is what is sent.
- TrajectoryId
-
A trajectory: one line of turns in a mission, the person's and the
agent's alike, such as one thread of a Teams channel. It names the line,
not who is on it: who wrote a turn is its
ActorId. - WaitingToStart
- trajectory has started, and its work has not begun: it is waiting for room (Nick, 17 Nov: "waiting-to-start"; a traveller does not know what a loop is). The machine has no room for its loop, or no loop user or suit is free. Its kind's entry is written only by loop_launcher, as the logbook service's sender table allows, on a chain of its own, so the path is named here, not by a chain: a path waiting before any user was handed to it has no chain yet.
- WebFetch
- A GET a tool asks for: where to, as whom, and what of the response's body to keep. It has no body or headers to carry words.
- WriteFile
- Writes a file, creating its folder.
- Writes
- WritesSlackReplyRequests
- Writes the web requests that post a reply in a Slack conversation, and reads back what each one posted. Pure: it holds no secret and sends nothing, so the web requests driver knows nothing of Slack.
- WritesWebAddressReplyRequests
- Writes the web requests that post a reply under a conversation's web address, as Teams' Bot Connector takes it, and reads back what each one posted.
Enums
- DecidedBy
- Who made a decision a record entry holds: the rules, or the person. So the record tells "the rules let it through" from "the person said yes", wherever something is decided: the airlock deciding a run, the docking port deciding an arrival.
- ReadsAs
- How a Reads reads its file: ReadFile or ReadFileBytes.
Extension Types
- JsonObject
- A JSON object: string keys, JSON values, read through the readers below. Holding one means the shape was checked, so nothing downstream checks it again.
Constants
- outcomeOfProposedActionKind → const String
- The kind of the logbook entry that keeps the outcome of an action a loop proposed: what it ran to, or why it was refused. Only the airlock writes it. Its body is outcomeOfProposedActionToJson.
Functions
-
outcomeOfProposedActionToJson(
EntryId proposed, Object? resultAsJson) → Object? -
The body of an outcomeOfProposedActionKind logbook entry answering
the ActionProposedByAgentLoop logbook entry
proposed:resultAsJson, as is_effects'sencodeOutcomewrites it with that program's codec.proposedis the id the logbook gave that entry, the hash of the whole entry as the logbook keeps it, never a hash of its body. -
proposalRejectedToJson(
EntryId proposed, String why) → Object? -
The body answering
proposed, a logbook entry that was Rejected becausewhy: refused, with no action decided. -
readOutcomeOfProposedAction(
String body) → ({EntryId proposed, Object? result})? -
bodyread back as an outcomeOfProposedActionKind logbook entry's body: the proposal it answers and its result, which only the program that was proposed can read further. Null whenbodyis not exactly one, as when the airlock kept the result of an action no loop proposed.
Exceptions / Errors
- JsonFieldException
- A field that is absent, or present but not the shape its reader asked for.