delegation
Import
Section titled “Import”import * as api from "@fungi.computer/shiitake/delegation";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| class | AgentDelegation | Host-owned identity and admission around BirdDog’s ordinary envelope. |
| class | AgentDisclosureRefused | A current correspondent no longer has disclosure authority. |
| class | AgentMail | Recipient-owned replies and receipt-bearing submissions over the host’s one Post lane. |
| type alias | DelegationIdentity | Shiitake host-pack identity; core consumes OysterAgents, never this engine. |
| type alias | AgentReplySettlement | Undefined is an explicit disclosure refusal; missing facts and read errors must fail. |
| type alias | AgentMailPost | The host’s one Post lane, as Agent mail borrows it. |
| constant | machineAgentCodecs | The Agent wire decoders a host lends Oyster’s machine-link client, so the device link routes Agent work without owning Shiitake’s grammar. |
| function | agentMailRoute() | Current disclosure admission runs at every transport attempt, including frozen retries. |
| function | machineAgentReservations() | Machine-homed Agent identities in the ordinary directory over the enrollment’s own store: one Team identity per enrollment receipt, reserved without opening a hosted Agent. The enrolling member is the grant actor. |
AgentDelegationclass
Section titled “AgentDelegation”Host-owned identity and admission around BirdDog’s ordinary envelope.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AgentDelegation(deps): AgentDelegation;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
deps |
Readonly<{ storage: WatchdogSqliteOwner; expiresAt: () => number; identity: () => | DelegationIdentity | null | Promise<DelegationIdentity | null>; directory: () => AgentControlDirectory; deliver: (mail) => Promise<DelegationReceipt>; prepare: (mail) => Promise<void>; stageAcceptedNotice: (mail, scopeId) => void; accept: (mail, reply, stageAcceptedNotice) => Promise<Accepted>; }> |
Returns
Section titled “Returns”Methods
Section titled “Methods”settlement()
Section titled “settlement()”settlement( sender, sessionId, commandId, host): Promise< | Readonly<{ acceptedSender: string | null; terminal: SessionTerminal; content: string; usage: readonly Pick<AssistantMessage, "model" | "provider" | "usage">[]; toolCalls: number;}>| undefined>;Recipient-local disclosure through the public host, never another Agent’s RPC.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
sender |
DelegationIdentity |
sessionId |
string |
commandId |
string |
host |
Pick<ShiitakeHost, "readSettlement"> |
Returns
Section titled “Returns”Promise< | Readonly<{ acceptedSender: string | null; terminal:
SessionTerminal; content: string; usage:
readonly Pick<AssistantMessage, "model" | "provider" | "usage">[];
toolCalls: number; }> | undefined>
send()
Section titled “send()”send( input, sourceSessionId, signal, invocation?): Promise<DelegationReceipt>;Delegate work to an in-scope Agent: steer its Session, or start fleet correspondence.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
AgentDelegationInput |
sourceSessionId |
string |
signal |
AbortSignal |
invocation? |
Readonly<{ toolCallId: string; sendIndex: number; commandId?: string; meta?: Json; toolCallCode?: string; }> |
Returns
Section titled “Returns”Promise<DelegationReceipt>
recall()
Section titled “recall()”recall( input, sourceSessionId, signal): Promise<CancelResult>;Resolve this sender’s exact request, then let the recipient guard pending work.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
AgentRecallInput |
sourceSessionId |
string |
signal |
AbortSignal |
Returns
Section titled “Returns”Promise<CancelResult>
receive()
Section titled “receive()”receive(raw): Promise<PostDeliveryResult>;Admit one addressed Agent mail for this Agent, or refuse it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
raw |
{ key: string; kind: string; address: unknown; event: unknown; } |
raw.key |
string |
raw.kind |
string |
raw.address |
unknown |
raw.event |
unknown |
Returns
Section titled “Returns”Promise<PostDeliveryResult>
localUndeliverable()
Section titled “localUndeliverable()”localUndeliverable(original): Promise<PostDeliveryResult>;Admit local outbox exhaustion through the same Fleet/system reply gate.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
original |
BirdDogMail |
Returns
Section titled “Returns”Promise<PostDeliveryResult>
AgentDisclosureRefusedclass
Section titled “AgentDisclosureRefused”A current correspondent no longer has disclosure authority.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AgentDisclosureRefused(): AgentDisclosureRefused;Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor;AgentMailclass
Section titled “AgentMail”Recipient-owned replies and receipt-bearing submissions over the host’s one Post lane.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AgentMail(deps): AgentMail;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
deps |
Readonly<{ storage: WatchdogSqliteOwner; post: () => AgentMailPost; identity: () => | DelegationIdentity | null | Promise<DelegationIdentity | null>; replySettlement: AgentReplySettlement; onUndeliverable: (original, reply) => Promise<PostDeliveryResult>; drain: () => Promise<void>; wake: () => Promise<void>; }> |
Returns
Section titled “Returns”Methods
Section titled “Methods”send()
Section titled “send()”send(mail): Promise<DelegationReceipt>;Submit one mail and return recipient acceptance or relay-held custody.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
mail |
BirdDogMail |
Returns
Section titled “Returns”Promise<DelegationReceipt>
stageUndeliverableReplies()
Section titled “stageUndeliverableReplies()”stageUndeliverableReplies(): Promise<void>;Reconcile exhausted original outbox mail into one local system reply.
Returns
Section titled “Returns”Promise<void>
stageAcceptedNotice()
Section titled “stageAcceptedNotice()”stageAcceptedNotice(mail, scopeId): void;Stage the acceptance reply through this Post owner without leaving the transaction.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
mail |
BirdDogMail |
scopeId |
string |
Returns
Section titled “Returns”void
mailRoom()
Section titled “mailRoom()”mailRoom(): Readonly<{ fanOut: (settlement) => Effect<void, BirdDogError>; postMail?: (mail) => Effect<void, BirdDogError>; drainOutbox: () => Effect<void, BirdDogError>; nextWakeAt: () => Effect<number | undefined, BirdDogError>;}> & object;BirdDog’s mail room: disclosed settlement replies fan out over Post.
Returns
Section titled “Returns”DelegationIdentitytype alias
Section titled “DelegationIdentity”type DelegationIdentity = Readonly<{ scopeId: string; agentId: string;}>;Shiitake host-pack identity; core consumes OysterAgents, never this engine.
AgentReplySettlementtype alias
Section titled “AgentReplySettlement”type AgentReplySettlement = (mail) => Promise<CommandSettlement | undefined>;Undefined is an explicit disclosure refusal; missing facts and read errors must fail.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
mail |
BirdDogMail |
Returns
Section titled “Returns”Promise<CommandSettlement | undefined>
AgentMailPosttype alias
Section titled “AgentMailPost”type AgentMailPost = Pick< PostRuntime<{ agentMail: ReturnType<typeof agentMailRoute>; }>, "send" | "read" | "nextWake" | "deadLetters">;The host’s one Post lane, as Agent mail borrows it.
machineAgentCodecsconstant
Section titled “machineAgentCodecs”const machineAgentCodecs: object;The Agent wire decoders a host lends Oyster’s machine-link client, so the device link routes Agent work without owning Shiitake’s grammar.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
sessionCreation() |
(body) => | Readonly<{ requestId: string; }> | null |
The Session-creation intent, or null when the body is not one. |
settlement() |
(encoded) => CommandSettlement |
One serialized settlement from a hosted or machine-homed Agent. |
accepted() |
(receipt) => void |
Throws unless an acknowledgment carries a valid acceptance or Held result. |
agentMailRoute()function
Section titled “agentMailRoute()”function agentMailRoute(namespace, replySettlement): PostRoute<AgentMailAddress, | { from: { kind: "agent"; agentId: string; sessionId: string; }; reply?: | { commandId: string; outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown"; diagnostic?: string; } | { outcome: "accepted"; commandId: string; } | { outcome: "undeliverable"; reason: "recipient_left"; }; key: string; to: { kind: "agent"; agentId: string; sessionId?: string; }; replyTo: readonly object[]; content: string; createdAt: number; meta?: Json | undefined;} | { from: { kind: "system"; systemId: "hub"; }; reply: { outcome: "undeliverable"; reason: "recipient_offline"; }; key: string; to: { kind: "agent"; agentId: string; sessionId?: string; }; replyTo: readonly object[]; content: string; createdAt: number; meta?: Json | undefined;}, | { from: { kind: "agent"; agentId: string; sessionId: string; }; reply?: | { commandId: string; outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown"; diagnostic?: string; } | { outcome: "accepted"; commandId: string; } | { outcome: "undeliverable"; reason: "recipient_left"; }; key: string; to: { kind: "agent"; agentId: string; sessionId?: string; }; replyTo: readonly object[]; content: string; createdAt: number; meta?: Json | undefined;} | { from: { kind: "system"; systemId: "hub"; }; reply: { outcome: "undeliverable"; reason: "recipient_offline"; }; key: string; to: { kind: "agent"; agentId: string; sessionId?: string; }; replyTo: readonly object[]; content: string; createdAt: number; meta?: Json | undefined;}, AgentMailAddress, | { from: { kind: "agent"; agentId: string; sessionId: string; }; reply?: | { commandId: string; outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown"; diagnostic?: string; } | { outcome: "accepted"; commandId: string; } | { outcome: "undeliverable"; reason: "recipient_left"; }; key: string; to: { kind: "agent"; agentId: string; sessionId?: string; }; replyTo: readonly object[]; content: string; createdAt: number; meta?: Json | undefined;} | { from: { kind: "system"; systemId: "hub"; }; reply: { outcome: "undeliverable"; reason: "recipient_offline"; }; key: string; to: { kind: "agent"; agentId: string; sessionId?: string; }; replyTo: readonly object[]; content: string; createdAt: number; meta?: Json | undefined;}, | { from: { kind: "agent"; agentId: string; sessionId: string; }; reply?: | { commandId: string; outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown"; diagnostic?: string; } | { outcome: "accepted"; commandId: string; } | { outcome: "undeliverable"; reason: "recipient_left"; }; key: string; to: { kind: "agent"; agentId: string; sessionId?: string; }; replyTo: readonly object[]; content: string; createdAt: number; meta?: Json | undefined;} | { from: { kind: "system"; systemId: "hub"; }; reply: { outcome: "undeliverable"; reason: "recipient_offline"; }; key: string; to: { kind: "agent"; agentId: string; sessionId?: string; }; replyTo: readonly object[]; content: string; createdAt: number; meta?: Json | undefined;}> & Omit<Readonly<{ addressKind: string; deadlineMs?: number; address: Codec<unknown, unknown>; event: Codec<unknown, unknown>; encodeEnvelope: (envelope) => object; parseDelivery: (envelope) => object; prepareEnvelope?: (envelope, signal) => Promise<{ key: string; kind: string; address: unknown; event: unknown; }>; recordDelivered?: (envelope) => void; nameOf: (envelope) => string; namespace: Readonly<{ getByName: (name) => Readonly<{ deliver: (envelope) => Promise<...>; }>; }>; recordCursor?: (envelope, cursor) => void; recordRefused?: (envelope) => void;}>, "event" | "address">;Current disclosure admission runs at every transport attempt, including frozen retries.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
namespace |
Readonly<{ getByName: (name) => Readonly<{ deliver: (envelope) => Promise<PostDeliveryResult>; }>; }> |
replySettlement |
AgentReplySettlement |
Returns
Section titled “Returns”PostRoute<AgentMailAddress, | { from: { kind: "agent"; agentId:
string; sessionId: string; }; reply?: | { commandId: string;
outcome: "completed" | "failed" | "cancelled" | "interrupted" |
"outcome_unknown"; diagnostic?: string; } | { outcome: "accepted";
commandId: string; } | { outcome: "undeliverable"; reason:
"recipient_left"; }; key: string; to: { kind: "agent"; agentId:
string; sessionId?: string; }; replyTo: readonly object[]; content:
string; createdAt: number; meta?: Json | undefined; } | { from: {
kind: "system"; systemId: "hub"; }; reply: { outcome:
"undeliverable"; reason: "recipient_offline"; }; key: string; to:
{ kind: "agent"; agentId: string; sessionId?: string; };
replyTo: readonly object[]; content: string; createdAt: number;
meta?: Json | undefined; }, | { from: { kind: "agent"; agentId:
string; sessionId: string; }; reply?: | { commandId: string;
outcome: "completed" | "failed" | "cancelled" | "interrupted" |
"outcome_unknown"; diagnostic?: string; } | { outcome: "accepted";
commandId: string; } | { outcome: "undeliverable"; reason:
"recipient_left"; }; key: string; to: { kind: "agent"; agentId:
string; sessionId?: string; }; replyTo: readonly object[]; content:
string; createdAt: number; meta?: Json | undefined; } | { from: {
kind: "system"; systemId: "hub"; }; reply: { outcome:
"undeliverable"; reason: "recipient_offline"; }; key: string; to:
{ kind: "agent"; agentId: string; sessionId?: string; };
replyTo: readonly object[]; content: string; createdAt: number;
meta?: Json | undefined; }, AgentMailAddress, | { from: { kind:
"agent"; agentId: string; sessionId: string; }; reply?: | {
commandId: string; outcome: "completed" | "failed" | "cancelled"
| "interrupted" | "outcome_unknown"; diagnostic?: string; } | {
outcome: "accepted"; commandId: string; } | { outcome:
"undeliverable"; reason: "recipient_left"; }; key: string; to: {
kind: "agent"; agentId: string; sessionId?: string; }; replyTo:
readonly object[]; content: string; createdAt: number; meta?: Json
| undefined; } | { from: { kind: "system"; systemId: "hub"; };
reply: { outcome: "undeliverable"; reason: "recipient_offline"; };
key: string; to: { kind: "agent"; agentId: string; sessionId?:
string; }; replyTo: readonly object[]; content: string; createdAt:
number; meta?: Json | undefined; }, | { from: { kind: "agent";
agentId: string; sessionId: string; }; reply?: | { commandId:
string; outcome: "completed" | "failed" | "cancelled" |
"interrupted" | "outcome_unknown"; diagnostic?: string; } | {
outcome: "accepted"; commandId: string; } | { outcome:
"undeliverable"; reason: "recipient_left"; }; key: string; to: {
kind: "agent"; agentId: string; sessionId?: string; }; replyTo:
readonly object[]; content: string; createdAt: number; meta?: Json
| undefined; } | { from: { kind: "system"; systemId: "hub"; };
reply: { outcome: "undeliverable"; reason: "recipient_offline"; };
key: string; to: { kind: "agent"; agentId: string; sessionId?:
string; }; replyTo: readonly object[]; content: string; createdAt:
number; meta?: Json | undefined; }> & Omit<Readonly<{
addressKind: string; deadlineMs?: number; address: Codec<unknown,
unknown>; event: Codec<unknown, unknown>; encodeEnvelope:
(envelope) => object; parseDelivery: (envelope) => object;
prepareEnvelope?: (envelope, signal) => Promise<{ key: string;
kind: string; address: unknown; event: unknown; }>;
recordDelivered?: (envelope) => void; nameOf: (envelope) => string;
namespace: Readonly<{ getByName: (name) => Readonly<{ deliver:
(envelope) => Promise<…>; }>; }>; recordCursor?: (envelope,
cursor) => void; recordRefused?: (envelope) => void; }>, "event"
| "address">
machineAgentReservations()function
Section titled “machineAgentReservations()”function machineAgentReservations(sql): (reservation) => object;Machine-homed Agent identities in the ordinary directory over the enrollment’s own store: one Team identity per enrollment receipt, reserved without opening a hosted Agent. The enrolling member is the grant actor.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
sql |
Readonly<{ exec: (statement, …bindings) => WatchdogSqliteCursor; }> |
Returns
Section titled “Returns”(reservation) => object