Skip to content
API reference

bird-dog

Import
import * as api from "@fungi.computer/bird-dog";
Kind Export Description
type alias BirdDogAgentReference An ordinary agent Session address. Relationships between agents live elsewhere.
type alias BirdDogAgentRecipientReference An addressed Agent whose first Session may be created on acceptance.
type alias BirdDogSystemIdentity The Hub’s stable system identity for a terminal offline disposition.
type alias BirdDogReply What a reply reports about the settled work beside its content. The recipient’s host trusts these facts only after it authenticates the reply against the mail it sent.
type alias BirdDogAgentReply Facts an Agent may author; the Hub owns recipient-offline disposition.
type alias BirdDogMail Addressed correspondence. Agents author ordinary replies and recipient-left notices; only the Hub system authors recipient-offline dispositions.
type alias BirdDogMeta Opaque JSON a host attached to the work; BirdDog only carries it.
type alias BirdDogAgentWork The accepted Session work BirdDog points at from an opaque Watchdog job.
type alias BirdDogAgentJobPayload Typed payload whose meaning belongs to BirdDog, never Watchdog.
type alias BirdDogAgentJobInput Input for projecting accepted agent work into Watchdog’s generic grammar.
type alias BirdDogOutbox String-backed durable outbox owned by the BirdDog host.
type alias BirdDogOptions Host ports for BirdDog’s durable mail delivery.
type alias BirdDogDelegator Who sent a Session its work first: the mail that opened the relationship. agentId is the Session’s own Agent, the author of every report.
type alias BirdDogSettlement Completed generic work plus the content owed to its correspondents.
type alias BirdDogWaitingItem One open item named by a reply as waiting on its recipient.
type alias BirdDogRuntime Durable reply delivery behind the mail-room interface.
type alias BirdDogApi BirdDog’s small synchronous translation interface for owner transactions.
constant BirdDog Agent-aware mail translation over Watchdog’s payload-blind job grammar.
function undeliverableReply() Construct the one stable system reply correlated to the exact sent letter.

BirdDogAgentReferencetype alias

Section titled “BirdDogAgentReference”
Signature
type BirdDogAgentReference = Readonly<{
kind: "agent";
agentId: string;
sessionId: string;
}>;

An ordinary agent Session address. Relationships between agents live elsewhere.


BirdDogAgentRecipientReferencetype alias

Section titled “BirdDogAgentRecipientReference”
Signature
type BirdDogAgentRecipientReference = Readonly<{
kind: "agent";
agentId: string;
sessionId?: string;
}>;

An addressed Agent whose first Session may be created on acceptance.


BirdDogSystemIdentitytype alias

Section titled “BirdDogSystemIdentity”
Signature
type BirdDogSystemIdentity = Readonly<{
kind: "system";
systemId: "hub";
}>;

The Hub’s stable system identity for a terminal offline disposition.


BirdDogReplytype alias

Section titled “BirdDogReply”
Signature
type BirdDogReply =
| Readonly<{
commandId: string;
outcome: "accepted";
}>
| Readonly<{
commandId: string;
outcome:
| "completed"
| "failed"
| "interrupted"
| "cancelled"
| "outcome_unknown";
diagnostic?: string;
waitingOnYou?: readonly BirdDogWaitingItem[];
}>
| Readonly<{
outcome: "undeliverable";
reason: "recipient_offline" | "recipient_left";
}>;

What a reply reports about the settled work beside its content. The recipient’s host trusts these facts only after it authenticates the reply against the mail it sent.


BirdDogAgentReplytype alias

Section titled “BirdDogAgentReply”
Signature
type BirdDogAgentReply =
| Exclude<
BirdDogReply,
{
outcome: "undeliverable";
}
>
| Readonly<{
outcome: "undeliverable";
reason: "recipient_left";
}>;

Facts an Agent may author; the Hub owns recipient-offline disposition.


BirdDogMailtype alias

Section titled “BirdDogMail”
Signature
type BirdDogMail =
| Readonly<{
key: string;
to: BirdDogAgentRecipientReference;
replyTo: readonly BirdDogAgentReference[];
content: string;
createdAt: number;
meta?: BirdDogMeta;
from: BirdDogAgentReference;
reply?: BirdDogAgentReply;
}>
| Readonly<{
key: string;
to: BirdDogAgentRecipientReference;
replyTo: readonly BirdDogAgentReference[];
content: string;
createdAt: number;
meta?: BirdDogMeta;
from: BirdDogSystemIdentity;
reply: Readonly<{
outcome: "undeliverable";
reason: "recipient_offline";
}>;
}>;

Addressed correspondence. Agents author ordinary replies and recipient-left notices; only the Hub system authors recipient-offline dispositions.


BirdDogMetatype alias

Section titled “BirdDogMeta”
Signature
type BirdDogMeta = typeof Schema.Json.Type;

Opaque JSON a host attached to the work; BirdDog only carries it.


BirdDogAgentWorktype alias

Section titled “BirdDogAgentWork”
Signature
type BirdDogAgentWork = Readonly<{
jobId: string;
sessionId: string;
commandFactId: string;
recovery?: Readonly<{
maxRecoveries: number;
}>;
}>;

The accepted Session work BirdDog points at from an opaque Watchdog job.


BirdDogAgentJobPayloadtype alias

Section titled “BirdDogAgentJobPayload”
Signature
type BirdDogAgentJobPayload = Readonly<{
work: Readonly<{
sessionId: string;
commandFactId: string;
}>;
mail?: BirdDogMail;
}>;

Typed payload whose meaning belongs to BirdDog, never Watchdog.


BirdDogAgentJobInputtype alias

Section titled “BirdDogAgentJobInput”
Signature
type BirdDogAgentJobInput = Readonly<{
work: BirdDogAgentWork;
mail?: BirdDogMail;
}>;

Input for projecting accepted agent work into Watchdog’s generic grammar.


BirdDogOutboxtype alias

Section titled “BirdDogOutbox”
Signature
type BirdDogOutbox = Readonly<{
put: (key, value) => Promise<void>;
read: (key) => Promise<string | undefined>;
list: (
limit,
afterKey?,
) => Promise<
readonly Readonly<{
key: string;
value: string;
}>[]
>;
delete: (key) => Promise<void>;
}>;

String-backed durable outbox owned by the BirdDog host.


BirdDogOptionstype alias

Section titled “BirdDogOptions”
Signature
type BirdDogOptions = Readonly<{
outbox: BirdDogOutbox;
post: (mail) => Promise<boolean>;
scheduleWake: (at) => Promise<void>;
now: () => number;
}>;

Host ports for BirdDog’s durable mail delivery.


BirdDogDelegatortype alias

Section titled “BirdDogDelegator”
Signature
type BirdDogDelegator = Readonly<{
key: string;
agentId: string;
replyTo: readonly BirdDogAgentReference[];
}>;

Who sent a Session its work first: the mail that opened the relationship. agentId is the Session’s own Agent, the author of every report.


BirdDogSettlementtype alias

Section titled “BirdDogSettlement”
Signature
type BirdDogSettlement = Readonly<{
job: WatchdogSettledJob;
content: string;
delegator?: BirdDogDelegator;
diagnostic?: string;
meta?: BirdDogMeta;
waitingOnYou?: readonly BirdDogWaitingItem[];
}>;

Completed generic work plus the content owed to its correspondents.


BirdDogWaitingItemtype alias

Section titled “BirdDogWaitingItem”
Signature
type BirdDogWaitingItem = Readonly<{
itemId: string;
kind: string;
summary: string;
}>;

One open item named by a reply as waiting on its recipient.


BirdDogRuntimetype alias

Section titled “BirdDogRuntime”
Signature
type BirdDogRuntime = Readonly<{
fanOut: (settlement) => Promise<void>;
drainOutbox: () => Promise<void>;
}>;

Durable reply delivery behind the mail-room interface.


BirdDogApitype alias

Section titled “BirdDogApi”
Signature
type BirdDogApi = Readonly<{
agentJob: (input) => WatchdogQueuedJob;
decodeAgentJob: (job) => BirdDogAgentJobPayload;
make: (options) => Promise<BirdDogRuntime>;
}>;

BirdDog’s small synchronous translation interface for owner transactions.

BirdDogconstant

Section titled “BirdDog”
Signature
const BirdDog: BirdDogApi;

Agent-aware mail translation over Watchdog’s payload-blind job grammar.

undeliverableReply()function

Section titled “undeliverableReply()”
Signature
function undeliverableReply(original, createdAt): BirdDogMail;

Construct the one stable system reply correlated to the exact sent letter.

Parameter Type
original BirdDogMail
createdAt number

BirdDogMail