@haywoodmarx/agent-pager 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +63 -0
- package/dist/src/broker/address.d.ts +49 -0
- package/dist/src/broker/address.js +110 -0
- package/dist/src/broker/broker.d.ts +665 -0
- package/dist/src/broker/broker.js +2270 -0
- package/dist/src/broker/database.d.ts +81 -0
- package/dist/src/broker/database.js +69 -0
- package/dist/src/broker/operator-projection.d.ts +291 -0
- package/dist/src/broker/operator-projection.js +722 -0
- package/dist/src/broker/protocol.d.ts +237 -0
- package/dist/src/broker/protocol.js +311 -0
- package/dist/src/broker/schema.d.ts +94 -0
- package/dist/src/broker/schema.js +454 -0
- package/dist/src/broker/snapshot.d.ts +171 -0
- package/dist/src/broker/snapshot.js +78 -0
- package/dist/src/configuration-defaults.d.ts +64 -0
- package/dist/src/configuration-defaults.js +48 -0
- package/dist/src/configuration.d.ts +76 -0
- package/dist/src/configuration.js +156 -0
- package/dist/src/implementations/claude/environment.d.ts +8 -0
- package/dist/src/implementations/claude/environment.js +9 -0
- package/dist/src/implementations/claude/gateway-cli.d.ts +2 -0
- package/dist/src/implementations/claude/gateway-cli.js +136 -0
- package/dist/src/implementations/claude/gateway-identity.d.ts +134 -0
- package/dist/src/implementations/claude/gateway-identity.js +103 -0
- package/dist/src/implementations/claude/gateway.d.ts +148 -0
- package/dist/src/implementations/claude/gateway.js +236 -0
- package/dist/src/implementations/claude/instructions.d.ts +33 -0
- package/dist/src/implementations/claude/instructions.js +64 -0
- package/dist/src/implementations/claude/manifest.d.ts +33 -0
- package/dist/src/implementations/claude/manifest.js +108 -0
- package/dist/src/implementations/claude/plugin-directory.d.ts +80 -0
- package/dist/src/implementations/claude/plugin-directory.js +137 -0
- package/dist/src/implementations/claude/session-continuation.d.ts +25 -0
- package/dist/src/implementations/claude/session-continuation.js +125 -0
- package/dist/src/implementations/claude/session-identity.d.ts +25 -0
- package/dist/src/implementations/claude/session-identity.js +31 -0
- package/dist/src/implementations/claude/session-start-cli.d.ts +2 -0
- package/dist/src/implementations/claude/session-start-cli.js +16 -0
- package/dist/src/implementations/claude/socket-delivery.d.ts +52 -0
- package/dist/src/implementations/claude/socket-delivery.js +159 -0
- package/dist/src/implementations/model.d.ts +162 -0
- package/dist/src/implementations/model.js +1 -0
- package/dist/src/implementations/opencode/adapter.d.ts +71 -0
- package/dist/src/implementations/opencode/adapter.js +94 -0
- package/dist/src/implementations/opencode/environment.d.ts +8 -0
- package/dist/src/implementations/opencode/environment.js +9 -0
- package/dist/src/implementations/opencode/manifest.d.ts +30 -0
- package/dist/src/implementations/opencode/manifest.js +93 -0
- package/dist/src/implementations/opencode/plugin-api.d.ts +120 -0
- package/dist/src/implementations/opencode/plugin-api.js +1 -0
- package/dist/src/implementations/opencode/plugin.d.ts +38 -0
- package/dist/src/implementations/opencode/plugin.js +303 -0
- package/dist/src/implementations/opencode/self-close-tool.d.ts +9 -0
- package/dist/src/implementations/opencode/self-close-tool.js +31 -0
- package/dist/src/implementations/orca/terminal.d.ts +48 -0
- package/dist/src/implementations/orca/terminal.js +154 -0
- package/dist/src/implementations/pi/broker-client.d.ts +56 -0
- package/dist/src/implementations/pi/broker-client.js +156 -0
- package/dist/src/implementations/pi/environment.d.ts +8 -0
- package/dist/src/implementations/pi/environment.js +9 -0
- package/dist/src/implementations/pi/extension.d.ts +57 -0
- package/dist/src/implementations/pi/extension.js +253 -0
- package/dist/src/implementations/pi/host-slots.d.ts +18 -0
- package/dist/src/implementations/pi/host-slots.js +27 -0
- package/dist/src/implementations/pi/manifest.d.ts +11 -0
- package/dist/src/implementations/pi/manifest.js +61 -0
- package/dist/src/implementations/pi/self-close-tool.d.ts +7 -0
- package/dist/src/implementations/pi/self-close-tool.js +27 -0
- package/dist/src/implementations/registry.d.ts +47 -0
- package/dist/src/implementations/registry.js +157 -0
- package/dist/src/implementations/session-key.d.ts +13 -0
- package/dist/src/implementations/session-key.js +19 -0
- package/dist/src/index.d.ts +27 -0
- package/dist/src/index.js +26 -0
- package/dist/src/launch/broker-lock.d.ts +257 -0
- package/dist/src/launch/broker-lock.js +644 -0
- package/dist/src/launch/cli.d.ts +37 -0
- package/dist/src/launch/cli.js +317 -0
- package/dist/src/launch/environment.d.ts +45 -0
- package/dist/src/launch/environment.js +48 -0
- package/dist/src/launch/launch.d.ts +235 -0
- package/dist/src/launch/launch.js +223 -0
- package/dist/src/launch/on-demand.d.ts +202 -0
- package/dist/src/launch/on-demand.js +435 -0
- package/dist/src/launch/runtime-composition.d.ts +88 -0
- package/dist/src/launch/runtime-composition.js +253 -0
- package/dist/src/launch/runtime.d.ts +79 -0
- package/dist/src/launch/runtime.js +196 -0
- package/dist/src/launch/service-system.d.ts +11 -0
- package/dist/src/launch/service-system.js +39 -0
- package/dist/src/launch/service.d.ts +173 -0
- package/dist/src/launch/service.js +492 -0
- package/dist/src/launch/skill.d.ts +57 -0
- package/dist/src/launch/skill.js +81 -0
- package/dist/src/launch/terminal.d.ts +26 -0
- package/dist/src/launch/terminal.js +43 -0
- package/dist/src/launch/workspace-branch.d.ts +10 -0
- package/dist/src/launch/workspace-branch.js +29 -0
- package/dist/src/messaging/delivery-client.d.ts +144 -0
- package/dist/src/messaging/delivery-client.js +261 -0
- package/dist/src/messaging/delivery.d.ts +75 -0
- package/dist/src/messaging/delivery.js +22 -0
- package/dist/src/messaging/inbox-socket.d.ts +98 -0
- package/dist/src/messaging/inbox-socket.js +278 -0
- package/dist/src/messaging/mcp.d.ts +53 -0
- package/dist/src/messaging/mcp.js +501 -0
- package/dist/src/messaging/notifications.d.ts +231 -0
- package/dist/src/messaging/notifications.js +489 -0
- package/dist/src/messaging/push-delivery.d.ts +77 -0
- package/dist/src/messaging/push-delivery.js +187 -0
- package/dist/src/messaging/tools.d.ts +11 -0
- package/dist/src/messaging/tools.js +102 -0
- package/dist/src/messaging/wake.d.ts +23 -0
- package/dist/src/messaging/wake.js +39 -0
- package/dist/src/operator/agent-projection.d.ts +102 -0
- package/dist/src/operator/agent-projection.js +249 -0
- package/dist/src/operator/commands.d.ts +50 -0
- package/dist/src/operator/commands.js +199 -0
- package/dist/src/operator/diagnostics.d.ts +21 -0
- package/dist/src/operator/diagnostics.js +22 -0
- package/dist/src/operator/protocol.d.ts +511 -0
- package/dist/src/operator/protocol.js +49 -0
- package/dist/src/operator/repository-system.d.ts +14 -0
- package/dist/src/operator/repository-system.js +150 -0
- package/dist/src/operator/repository.d.ts +79 -0
- package/dist/src/operator/repository.js +72 -0
- package/dist/src/operator/traffic-projection.d.ts +19 -0
- package/dist/src/operator/traffic-projection.js +229 -0
- package/dist/src/operator/transport.d.ts +87 -0
- package/dist/src/operator/transport.js +549 -0
- package/dist/src/operator/update-store.d.ts +53 -0
- package/dist/src/operator/update-store.js +162 -0
- package/dist/src/operator/updates.d.ts +94 -0
- package/dist/src/operator/updates.js +280 -0
- package/dist/src/operator/validation.d.ts +114 -0
- package/dist/src/operator/validation.js +916 -0
- package/dist/src/shared/guards.d.ts +59 -0
- package/dist/src/shared/guards.js +119 -0
- package/dist/src/shared/http.d.ts +30 -0
- package/dist/src/shared/http.js +50 -0
- package/dist/src/shared/row.d.ts +2 -0
- package/dist/src/shared/row.js +1 -0
- package/dist/src/shared/shell.d.ts +6 -0
- package/dist/src/shared/shell.js +8 -0
- package/dist/src/tui/actions.d.ts +166 -0
- package/dist/src/tui/actions.js +253 -0
- package/dist/src/tui/agent-tree.d.ts +125 -0
- package/dist/src/tui/agent-tree.js +663 -0
- package/dist/src/tui/app.d.ts +38 -0
- package/dist/src/tui/app.js +378 -0
- package/dist/src/tui/chrome.d.ts +86 -0
- package/dist/src/tui/chrome.js +85 -0
- package/dist/src/tui/client.d.ts +41 -0
- package/dist/src/tui/client.js +279 -0
- package/dist/src/tui/composition.d.ts +41 -0
- package/dist/src/tui/composition.js +146 -0
- package/dist/src/tui/message-views.d.ts +94 -0
- package/dist/src/tui/message-views.js +515 -0
- package/dist/src/tui/model.d.ts +414 -0
- package/dist/src/tui/model.js +758 -0
- package/dist/src/tui/presentation.d.ts +350 -0
- package/dist/src/tui/presentation.js +541 -0
- package/dist/src/tui/production.d.ts +79 -0
- package/dist/src/tui/production.js +253 -0
- package/dist/src/tui/run-terminal.d.ts +32 -0
- package/dist/src/tui/run-terminal.js +54 -0
- package/dist/src/tui/runtime.d.ts +113 -0
- package/dist/src/tui/runtime.js +189 -0
- package/dist/src/tui/theme.d.ts +49 -0
- package/dist/src/tui/theme.js +55 -0
- package/dist/src/tui/transport.d.ts +31 -0
- package/dist/src/tui/transport.js +255 -0
- package/dist/src/version.d.ts +11 -0
- package/dist/src/version.js +52 -0
- package/package.json +142 -0
- package/skills/pager/SKILL.md +112 -0
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
import { type DatabaseDurability } from "./database.js";
|
|
2
|
+
import { type AgentId, type MessageState } from "./protocol.js";
|
|
3
|
+
import { type BrokerSnapshot, type SnapshotHealth } from "./snapshot.js";
|
|
4
|
+
import { ATTACHMENT_CHANNELS } from "./schema.js";
|
|
5
|
+
import { type BrokerOperationalEvent, type BrokerOperatorCommandAcceptance, type BrokerOperatorCommandRecord, type BrokerTrafficReadResult } from "./operator-projection.js";
|
|
6
|
+
export type { BrokerAgentSkippedEvent, BrokerLifecycleSkippedEvent, BrokerOperationalEvent, BrokerOperatorCommandAcceptance, BrokerOperatorCommandRecord, BrokerShedReason, BrokerTrafficLifecycleRecord, BrokerTrafficReadResult, BrokerPingSkippedEvent, BrokerStoredRowSkippedEvent, BrokerTrafficRecord, BrokerTrafficSkippedEvent, } from "./operator-projection.js";
|
|
7
|
+
/**
|
|
8
|
+
* Names what an attachment does, so re-attaching fences only the session it replaces. An agent
|
|
9
|
+
* exchanges messages and observes its inbox over separate attachments, and either may restart alone.
|
|
10
|
+
*/
|
|
11
|
+
export type AttachmentChannel = (typeof ATTACHMENT_CHANNELS)[number];
|
|
12
|
+
/** Identifies an agent implementation without constraining adapter-specific values. */
|
|
13
|
+
export type AgentImplementation = {
|
|
14
|
+
/** Supplies the opaque implementation identity chosen by the composition boundary. */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Supplies an implementation version when the boundary can determine one. */
|
|
17
|
+
version?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Records how far a wake got. `delivered` requires a recipient that confirms it accepted the wake;
|
|
21
|
+
* `shed` records a wake the broker's own budget policy discarded before it reached the transport.
|
|
22
|
+
*/
|
|
23
|
+
export type NotificationOutcome = "delivered" | "shed" | "failed" | "deferred";
|
|
24
|
+
/** Represents a durable message currently claimed by an agent. */
|
|
25
|
+
export type ClaimedMessage = {
|
|
26
|
+
/** Identifies the durable message. */
|
|
27
|
+
id: string;
|
|
28
|
+
/** Identifies the sending agent. */
|
|
29
|
+
from: AgentId;
|
|
30
|
+
/**
|
|
31
|
+
* Addresses the sending agent as `alias@workspace`, or by its agent id when it registered no
|
|
32
|
+
* alias. Always workspace-qualified, because a bare alias resolves against the sender's own
|
|
33
|
+
* workspace and a recipient elsewhere would reach a different agent with it.
|
|
34
|
+
*/
|
|
35
|
+
fromAddress: string;
|
|
36
|
+
/** Identifies the receiving agent. */
|
|
37
|
+
to: AgentId;
|
|
38
|
+
/**
|
|
39
|
+
* Names the broadcast this message is one copy of, as `*@workspace` with the recipient's workspace
|
|
40
|
+
* under its current name; absent on a message sent to one agent.
|
|
41
|
+
*/
|
|
42
|
+
broadcastAddress?: string;
|
|
43
|
+
/** Carries the one-line subject the sender supplied. */
|
|
44
|
+
subject: string;
|
|
45
|
+
/** Carries the sender-supplied message type. */
|
|
46
|
+
type: string;
|
|
47
|
+
/** Carries the claimed message body. */
|
|
48
|
+
body: unknown;
|
|
49
|
+
/** Authorizes acknowledgement of this specific claim. */
|
|
50
|
+
claimToken: string;
|
|
51
|
+
/** Records when the claim becomes eligible for redelivery. */
|
|
52
|
+
claimExpiresAt: number;
|
|
53
|
+
};
|
|
54
|
+
/** Records which path made a claim: the recipient fetching, or the broker delivering into its host. */
|
|
55
|
+
export type ClaimSource = "fetch" | "delivery";
|
|
56
|
+
/**
|
|
57
|
+
* Why an acknowledgement changed nothing. Every reason but `unknown_token` and `foreign_token` means
|
|
58
|
+
* the message is (or was) this agent's, and a `claim_expired` one is back in the queue for a fetch.
|
|
59
|
+
*/
|
|
60
|
+
export type AckRejectionReason = "unknown_token" | "foreign_token" | "claim_expired" | "already_acknowledged" | "message_settled";
|
|
61
|
+
/** Outcome of {@link Broker.ack}: every distinct submitted token appears in exactly one of the two lists. */
|
|
62
|
+
export type AckResult = {
|
|
63
|
+
/** Tokens whose claims this call acknowledged. */
|
|
64
|
+
acked: string[];
|
|
65
|
+
/** Tokens that acknowledged nothing, each with the reason, in submission order. */
|
|
66
|
+
rejected: {
|
|
67
|
+
claimToken: string;
|
|
68
|
+
reason: AckRejectionReason;
|
|
69
|
+
}[];
|
|
70
|
+
};
|
|
71
|
+
/** Outcome of {@link Broker.broadcast}: every recipient appears in exactly one of the two lists. */
|
|
72
|
+
export type BroadcastResult = {
|
|
73
|
+
/** Names the broadcast as `*@workspace`, as every copy carries it. */
|
|
74
|
+
address: string;
|
|
75
|
+
/** Messages sent, one per recipient that received the broadcast. */
|
|
76
|
+
sent: {
|
|
77
|
+
messageId: string;
|
|
78
|
+
to: AgentId;
|
|
79
|
+
}[];
|
|
80
|
+
/** Recipients a pair rate or inbox limit refused, each with the refusal as a send would raise it. */
|
|
81
|
+
refused: {
|
|
82
|
+
to: AgentId;
|
|
83
|
+
code: "conflict";
|
|
84
|
+
message: string;
|
|
85
|
+
}[];
|
|
86
|
+
};
|
|
87
|
+
/** Options for {@link Broker.fetch}. */
|
|
88
|
+
export type BrokerFetchRequest = {
|
|
89
|
+
/** Agent whose queue is fetched from. */
|
|
90
|
+
agentId: AgentId;
|
|
91
|
+
/** Maximum number of queued messages to claim. */
|
|
92
|
+
limit?: number;
|
|
93
|
+
/** Path making the claim; recorded on the message's lifecycle for the operator. */
|
|
94
|
+
claimedBy?: ClaimSource;
|
|
95
|
+
};
|
|
96
|
+
/** Configures broker timing, routing, and epoch ownership policies. */
|
|
97
|
+
export type BrokerOptions = {
|
|
98
|
+
/**
|
|
99
|
+
* Supplies the clock used for durable lease timestamps.
|
|
100
|
+
*
|
|
101
|
+
* Required rather than defaulted, so one process cannot end up running its broker on a different
|
|
102
|
+
* clock from the collaborators that read the rows it writes.
|
|
103
|
+
*/
|
|
104
|
+
now: () => number;
|
|
105
|
+
/**
|
|
106
|
+
* Reports the branch checked out at a workspace path, or null when it is not a repository.
|
|
107
|
+
*
|
|
108
|
+
* A port rather than a direct call because the real one is a `git` subprocess: it must run before
|
|
109
|
+
* the write transaction opens, and a test must be able to assert the persisted row without
|
|
110
|
+
* shelling out to whatever branch the developer's own checkout happens to be on.
|
|
111
|
+
*/
|
|
112
|
+
workspaceBranch: (path: string) => string | null;
|
|
113
|
+
/** Sets the lifetime of an unacknowledged message claim. */
|
|
114
|
+
visibilityTimeoutMs?: number;
|
|
115
|
+
/** Sets the delay before the first redelivery wake for an inbox whose messages went unclaimed. */
|
|
116
|
+
redeliveryBaseDelayMs?: number;
|
|
117
|
+
/** Sets how long one inbox is retried before its undelivered messages are dead-lettered. */
|
|
118
|
+
redeliveryGiveUpMs?: number;
|
|
119
|
+
/** Sets the lifetime of an unattached agent reservation. */
|
|
120
|
+
reservationTtlMs?: number;
|
|
121
|
+
/** Sets the lifetime of an attached agent lease. */
|
|
122
|
+
leaseTtlMs?: number;
|
|
123
|
+
/** Sets how long a detached, unnamed identity remains resumable by its harness session key. */
|
|
124
|
+
resumableRetentionMs?: number;
|
|
125
|
+
/** Sets how long a named identity stays detached before it is archived. */
|
|
126
|
+
namedArchiveAfterMs?: number;
|
|
127
|
+
/** Sets how long an archived identity of any kind is kept, measured from its archival. */
|
|
128
|
+
archivedRetentionMs?: number;
|
|
129
|
+
/**
|
|
130
|
+
* Sets how long a detached, unnamed, resumable identity is kept while it has sent no message and
|
|
131
|
+
* received none addressed to it alone.
|
|
132
|
+
*/
|
|
133
|
+
unusedResumableRetentionMs?: number;
|
|
134
|
+
/** Sets the maximum sends allowed for one sender-recipient pair. */
|
|
135
|
+
perPairRateLimit?: number;
|
|
136
|
+
/** Sets the measurement window for the pair rate limit. */
|
|
137
|
+
perPairRateWindowMs?: number;
|
|
138
|
+
/** Sets the maximum retained body size accepted by one send. */
|
|
139
|
+
maxBodyBytes?: number;
|
|
140
|
+
/** Sets the maximum queued or claimed messages retained for one recipient. */
|
|
141
|
+
maxInboxMessages?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Whether this handle owns the broker epoch. The long-running singleton mints a fresh epoch on
|
|
144
|
+
* start, which invalidates outstanding MCP sessions. Handles opened for local bookkeeping must
|
|
145
|
+
* set this false so they read the current epoch without rotating it and detaching live agents.
|
|
146
|
+
*/
|
|
147
|
+
epochOwner?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Receives operator-facing diagnostics the broker cannot raise to a caller.
|
|
150
|
+
*
|
|
151
|
+
* A notification the broker sends on an agent's behalf has no caller to throw to: the sweep that
|
|
152
|
+
* triggered it must keep draining. Required rather than optional so that discarding these
|
|
153
|
+
* observations is something a root says, not something it gets by leaving a field out — the
|
|
154
|
+
* broker cannot write to a stream the embedding process may be using for something else, and an
|
|
155
|
+
* embedder that genuinely wants them gone can pass a sink that drops them.
|
|
156
|
+
*/
|
|
157
|
+
report: (message: string) => void;
|
|
158
|
+
};
|
|
159
|
+
/** Reports which tables one committed transaction changed rows in. */
|
|
160
|
+
export type BrokerCommit = {
|
|
161
|
+
/**
|
|
162
|
+
* Names every table the transaction changed rows in, or is undefined when a write bypassed the
|
|
163
|
+
* broker's write handle and left the set incomplete. An undefined set means "assume everything
|
|
164
|
+
* changed": a consumer applying a delta must fall back to a full rebuild rather than trust it.
|
|
165
|
+
*/
|
|
166
|
+
tables: ReadonlySet<string> | undefined;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Observes that one broker mutation committed without participating in its transaction.
|
|
170
|
+
*
|
|
171
|
+
* A transaction that changed no rows never reaches a listener, so an idle sweep costs its observers
|
|
172
|
+
* nothing.
|
|
173
|
+
*/
|
|
174
|
+
export type BrokerCommitListener = (commit: BrokerCommit) => void;
|
|
175
|
+
/** Options for {@link Broker.resumeSession}. */
|
|
176
|
+
export type ResumeSessionRequest = {
|
|
177
|
+
/** Last broker session issued to this gateway launch. */
|
|
178
|
+
sessionId: string;
|
|
179
|
+
/** Generation proof; required on every path, whether renewing or rotating. */
|
|
180
|
+
fencingToken?: string | undefined;
|
|
181
|
+
/** Broker generation the caller last saw, when available. */
|
|
182
|
+
epoch?: string | undefined;
|
|
183
|
+
};
|
|
184
|
+
/** Durable single-writer SQLite broker for Pager. */
|
|
185
|
+
export declare class Broker {
|
|
186
|
+
#private;
|
|
187
|
+
/**
|
|
188
|
+
* Opens a durable broker database with the supplied timing and routing policies.
|
|
189
|
+
* @param path - SQLite database location, or memory sentinel, for durable state.
|
|
190
|
+
* @param options - Clock, workspace-branch lookup, and diagnostics sink are required; see {@link BrokerOptions} for its optional fields.
|
|
191
|
+
*/
|
|
192
|
+
constructor(path: string, options: BrokerOptions);
|
|
193
|
+
/** Close the broker database connection. */
|
|
194
|
+
close(): void;
|
|
195
|
+
/**
|
|
196
|
+
* Report the durability settings of the connection that owns broker writes.
|
|
197
|
+
*
|
|
198
|
+
* `synchronous` and `busy_timeout` are connection-local, so a second connection opened elsewhere
|
|
199
|
+
* cannot attest to them and must ask the running service instead.
|
|
200
|
+
* @returns - Journal mode, synchronous level, busy timeout, and foreign-key enforcement.
|
|
201
|
+
*/
|
|
202
|
+
durability(): DatabaseDurability;
|
|
203
|
+
/**
|
|
204
|
+
* Report broker generation and durability without projecting any traffic.
|
|
205
|
+
*
|
|
206
|
+
* Liveness callers poll this on a deadline, so it must not depend on how much history the
|
|
207
|
+
* database holds.
|
|
208
|
+
* @param generatedAt - Observation time to stamp, defaulting to now.
|
|
209
|
+
* @returns - Epoch, observation time, and live durability settings.
|
|
210
|
+
*/
|
|
211
|
+
snapshotHealth(generatedAt?: number): SnapshotHealth;
|
|
212
|
+
/**
|
|
213
|
+
* Return the current singleton epoch for local service ownership.
|
|
214
|
+
* @returns - Opaque generation identifier owned by this broker process.
|
|
215
|
+
*/
|
|
216
|
+
epoch(): string;
|
|
217
|
+
/**
|
|
218
|
+
* Observe successful broker commits after their SQLite transaction is durable.
|
|
219
|
+
* @param listener - Isolated observer that cannot change the committed caller outcome.
|
|
220
|
+
* @returns A callback that removes this observer.
|
|
221
|
+
*/
|
|
222
|
+
subscribeCommits(listener: BrokerCommitListener): () => void;
|
|
223
|
+
/**
|
|
224
|
+
* Register a concrete agent under one workspace-unique session name.
|
|
225
|
+
* @param args - Caller-supplied identity, topology, and implementation values.
|
|
226
|
+
* @returns - Stable agent identity registered in the requested team.
|
|
227
|
+
*/
|
|
228
|
+
registerAgent(args: {
|
|
229
|
+
teamId: string;
|
|
230
|
+
agentId?: AgentId;
|
|
231
|
+
parentId?: AgentId | null;
|
|
232
|
+
sessionName?: string;
|
|
233
|
+
ephemeral?: boolean;
|
|
234
|
+
workspacePath: string;
|
|
235
|
+
implementation?: AgentImplementation | null;
|
|
236
|
+
}): AgentId;
|
|
237
|
+
/**
|
|
238
|
+
* Register or rejoin an implementation identity without a prior launch reservation.
|
|
239
|
+
*
|
|
240
|
+
* A `sessionKey` makes the identity resumable: the same harness conversation returning after a
|
|
241
|
+
* restart resolves to the identity it already owns, keeping its alias, inbox, and traffic, whatever
|
|
242
|
+
* the caller passes as `sessionName`. Without one, rejoining still falls back to matching the alias.
|
|
243
|
+
*
|
|
244
|
+
* A `continuesSessionKey` is the key a conversation was known by before it continued under
|
|
245
|
+
* `sessionKey`. When `sessionKey` owns no identity yet, the identity the continued key owns moves
|
|
246
|
+
* to `sessionKey`, its holder displaced, so the alias, inbox, and traffic follow the conversation.
|
|
247
|
+
* @param args - Validated workspace, implementation, optional alias, optional resumable key, and
|
|
248
|
+
* the key of the conversation that one continues, which requires the resumable key.
|
|
249
|
+
* @returns - Stable agent identity, its current alias, and a fresh single-use attachment reservation.
|
|
250
|
+
*/
|
|
251
|
+
registerAgentWithoutReservation(args: {
|
|
252
|
+
workspacePath: string;
|
|
253
|
+
implementation: AgentImplementation;
|
|
254
|
+
sessionName?: string;
|
|
255
|
+
sessionKey?: string;
|
|
256
|
+
continuesSessionKey?: string;
|
|
257
|
+
}): {
|
|
258
|
+
agentId: AgentId;
|
|
259
|
+
reservation: string;
|
|
260
|
+
sessionName: string;
|
|
261
|
+
ephemeral: boolean;
|
|
262
|
+
resumed: boolean;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Replace an agent's routable alias and durable reconnection name.
|
|
266
|
+
* @param agentId - Authenticated identity whose name is changing.
|
|
267
|
+
* @param requestedAlias - Workspace-unique name, with an optional leading at-sign.
|
|
268
|
+
* @returns - Current identity and alias history after the replacement.
|
|
269
|
+
*/
|
|
270
|
+
updateAgentAlias(agentId: AgentId, requestedAlias: string): {
|
|
271
|
+
id: AgentId;
|
|
272
|
+
alias: string;
|
|
273
|
+
previousAliases: string[];
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Return the authenticated identity, current alias, and prior routable names.
|
|
277
|
+
* @param agentId - Stable identity to inspect.
|
|
278
|
+
* @returns - Identity details safe to return to the owning agent.
|
|
279
|
+
*/
|
|
280
|
+
agentIdentity(agentId: AgentId): {
|
|
281
|
+
id: AgentId;
|
|
282
|
+
alias: string;
|
|
283
|
+
previousAliases: string[];
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Reserve an identity and single-use attach reservation for a future process.
|
|
287
|
+
* @param args - Registration name, team, and workspace the reservation is created under.
|
|
288
|
+
* @returns - Reservation identity and one-time reservation for the future agent.
|
|
289
|
+
*/
|
|
290
|
+
reserveAgent(args: {
|
|
291
|
+
teamId: string;
|
|
292
|
+
parentId: AgentId;
|
|
293
|
+
sessionName?: string;
|
|
294
|
+
workspacePath: string;
|
|
295
|
+
implementation?: AgentImplementation | null;
|
|
296
|
+
}): {
|
|
297
|
+
agentId: AgentId;
|
|
298
|
+
reservation: string;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Issue an additional single-use attach reservation for an existing broker identity.
|
|
302
|
+
* @param agentId - Registered agent the new reservation attaches.
|
|
303
|
+
* @param channel - Attachment channel the reservation may occupy; a new session evicts only its own channel.
|
|
304
|
+
* @returns - One-time reservation that can attach the registered agent.
|
|
305
|
+
*/
|
|
306
|
+
reserveAttachment(agentId: AgentId, channel?: AttachmentChannel): string;
|
|
307
|
+
/**
|
|
308
|
+
* Consume a single-use reservation and bind it to an agent identity plus fenced session.
|
|
309
|
+
*
|
|
310
|
+
* A launch reserves an identity before the harness has started, so it cannot know which conversation
|
|
311
|
+
* will occupy it. Presenting `sessionKey` here closes that gap: an unclaimed key is bound to the
|
|
312
|
+
* reserved identity, and a key already held by another identity attaches to its owner instead, so
|
|
313
|
+
* relaunching a harness against an existing conversation rejoins rather than forking a duplicate.
|
|
314
|
+
*
|
|
315
|
+
* A durable session name outlives the conversation that first claimed it. When a new conversation
|
|
316
|
+
* rejoins that name, it takes the identity over: the prior session is deactivated and loses its
|
|
317
|
+
* fencing token, rather than the attach being refused and the caller left with no channel at all.
|
|
318
|
+
* @param reservationId - One-time secret used to attach a reserved agent.
|
|
319
|
+
* @param options - Optional resumable session key presented by the attaching conversation.
|
|
320
|
+
* @returns - Attached identity, which is the key's owner when adoption occurred, plus its session.
|
|
321
|
+
*/
|
|
322
|
+
attach(reservationId: string, options?: {
|
|
323
|
+
sessionKey?: string;
|
|
324
|
+
}): {
|
|
325
|
+
agentId: AgentId;
|
|
326
|
+
sessionId: string;
|
|
327
|
+
fencingToken: string;
|
|
328
|
+
epoch: string;
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Claim a conversation key for an already attached identity, or move to the identity that holds it.
|
|
332
|
+
*
|
|
333
|
+
* A harness whose channels are attached by the editor rather than by us cannot present its key at
|
|
334
|
+
* attach time, so it says who it is once it is connected. When the key belongs to another identity,
|
|
335
|
+
* that identity is the real one: this one is a launch artefact, and it is removed along with its
|
|
336
|
+
* connections after its outstanding reservations move across. An identity that has already sent or
|
|
337
|
+
* received a message is never removed: the call throws `conflict` and nothing is bound.
|
|
338
|
+
* @param agentId - Authenticated identity making the claim.
|
|
339
|
+
* @param sessionKey - Resumable key identifying the caller's conversation.
|
|
340
|
+
* @returns - Resolved identity, and fresh attachments for both channels when it moved.
|
|
341
|
+
*/
|
|
342
|
+
adoptSessionKey(agentId: AgentId, sessionKey: string): {
|
|
343
|
+
agentId: AgentId;
|
|
344
|
+
adopted: boolean;
|
|
345
|
+
reservation?: string;
|
|
346
|
+
deliveryReservation?: string;
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* Renew an active attachment when its complete broker-issued identity is presented.
|
|
350
|
+
* @param sessionId - Attached session identity being renewed.
|
|
351
|
+
* @param fencingToken - Token proving ownership of the active attachment generation.
|
|
352
|
+
* @param epoch - Broker generation that issued the attachment.
|
|
353
|
+
* @returns - Agent identity whose durable attachment lease was renewed.
|
|
354
|
+
*/
|
|
355
|
+
renewAttachment(sessionId: string, fencingToken: string, epoch: string): AgentId;
|
|
356
|
+
/**
|
|
357
|
+
* End every active attachment of an agent whose harness is shutting down, leaving the identity in place.
|
|
358
|
+
*
|
|
359
|
+
* The caller must have authenticated as this agent over one of those attachments. This is the graceful
|
|
360
|
+
* shutdown path for a harness whose messaging attachment is held by a client the connector cannot
|
|
361
|
+
* reach into, so an attachment the connector never opened still ends before its lease lapses.
|
|
362
|
+
* @param agentId - Identity whose harness is shutting down.
|
|
363
|
+
*/
|
|
364
|
+
releaseAttachments(agentId: AgentId): void;
|
|
365
|
+
/**
|
|
366
|
+
* Persist terminal disposition and detach every active connection for an agent.
|
|
367
|
+
* @param agentId - Stable identity whose process reached terminal disposition.
|
|
368
|
+
*/
|
|
369
|
+
markAgentTerminal(agentId: AgentId): void;
|
|
370
|
+
/** Enqueue terminal outcomes for parents and persist the completed disposition. */
|
|
371
|
+
reapTerminalAgents(): void;
|
|
372
|
+
/**
|
|
373
|
+
* Report how long until a sweep could next find work.
|
|
374
|
+
*
|
|
375
|
+
* A sweep scheduled from this value does nothing on an idle broker. Zero means work is already due.
|
|
376
|
+
* @returns - Delay in milliseconds, or null when nothing is pending.
|
|
377
|
+
*/
|
|
378
|
+
nextSweepDelayMs(): number | null;
|
|
379
|
+
/**
|
|
380
|
+
* Resume an MCP attachment while rotating a lapsed or prior-epoch session generation.
|
|
381
|
+
* @param request - Session, fencing proof, and last-seen generation the caller resumes with.
|
|
382
|
+
* @returns - Current attachment credentials and the stable owning agent identity.
|
|
383
|
+
*/
|
|
384
|
+
resumeSession({ sessionId, fencingToken, epoch }: ResumeSessionRequest): {
|
|
385
|
+
agentId: AgentId;
|
|
386
|
+
sessionId: string;
|
|
387
|
+
fencingToken: string;
|
|
388
|
+
epoch: string;
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Return the configured lifetime of an authenticated MCP attachment.
|
|
392
|
+
* @returns - Milliseconds from successful authentication until renewal is required.
|
|
393
|
+
*/
|
|
394
|
+
sessionLeaseTtlMs(): number;
|
|
395
|
+
/**
|
|
396
|
+
* Resolve a live session ID to an agent identity, expiring sessions on timeout or restart epoch mismatch.
|
|
397
|
+
*
|
|
398
|
+
* Resolving renews the session lease. The lease reaps sessions whose process is gone, and a caller
|
|
399
|
+
* presenting the session is evidence its process is not; an attach reservation is single-use, so a
|
|
400
|
+
* session allowed to lapse under continuous use could never be re-established.
|
|
401
|
+
* @param sessionId - Session id presented by the attached process.
|
|
402
|
+
* @param epoch - Broker generation used to fence stale sessions, when the client protocol carries one.
|
|
403
|
+
* @returns - Agent identity owned by the current fenced session.
|
|
404
|
+
*/
|
|
405
|
+
resolveSession(sessionId: string, epoch?: string): AgentId;
|
|
406
|
+
/**
|
|
407
|
+
* Send a message from an agent to a concrete recipient or alias address.
|
|
408
|
+
* `from` is taken as given: the broker looks the agent up and does not authenticate the caller, so
|
|
409
|
+
* the caller must have authenticated the identity itself and never pass one read from request
|
|
410
|
+
* content. An alias resolves to a concrete recipient here, at send time, and a
|
|
411
|
+
* queued message keeps that recipient rather than following a later rebinding. Only an explicit
|
|
412
|
+
* send creates a message; assistant output is never forwarded automatically.
|
|
413
|
+
* @param args - Sender identity, address, subject, type, and body of the message to send.
|
|
414
|
+
* @returns - Durable message identity, the resolved recipient, and whether that recipient is archived.
|
|
415
|
+
*/
|
|
416
|
+
send(args: {
|
|
417
|
+
from: AgentId;
|
|
418
|
+
to: string;
|
|
419
|
+
subject: string;
|
|
420
|
+
body: unknown;
|
|
421
|
+
type: string;
|
|
422
|
+
idempotencyKey?: string;
|
|
423
|
+
}): {
|
|
424
|
+
messageId: string;
|
|
425
|
+
to: AgentId;
|
|
426
|
+
recipientArchived: boolean;
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* Send one message from an agent to the other agents in a workspace.
|
|
430
|
+
*
|
|
431
|
+
* `from` is taken as given, as for {@link Broker.send}. The recipients are the workspace's active,
|
|
432
|
+
* unarchived agents other than the sender that are named, attached now, or still able to attach
|
|
433
|
+
* for the first time; an agent that joins later receives nothing. Each recipient gets its own
|
|
434
|
+
* message. A recipient refused by its pair rate or inbox limit is reported and the others still
|
|
435
|
+
* receive. A repeat carrying an earlier broadcast's key to the same workspace returns the message
|
|
436
|
+
* that broadcast queued for each recipient it reached, whatever has become of that recipient
|
|
437
|
+
* since, and sends to every other recipient. A key a direct send carried names a different send.
|
|
438
|
+
* @param args - Sender identity, subject, type, and body of the message, and the name of the
|
|
439
|
+
* workspace to broadcast to, the sender's own when absent.
|
|
440
|
+
* @returns - The broadcast address, the message sent to each recipient, and each recipient refused.
|
|
441
|
+
*/
|
|
442
|
+
broadcast(args: {
|
|
443
|
+
from: AgentId;
|
|
444
|
+
workspace?: string;
|
|
445
|
+
subject: string;
|
|
446
|
+
body: unknown;
|
|
447
|
+
type: string;
|
|
448
|
+
idempotencyKey?: string;
|
|
449
|
+
}): BroadcastResult;
|
|
450
|
+
/**
|
|
451
|
+
* Claim queued messages for an agent atomically, returning opaque acknowledgement metadata.
|
|
452
|
+
* @param request - Agent to claim for, the claim cap, and the path making the claim.
|
|
453
|
+
* @returns - Messages claimed for the agent with fresh claim tokens.
|
|
454
|
+
*/
|
|
455
|
+
fetch({ agentId, limit, claimedBy }: BrokerFetchRequest): ClaimedMessage[];
|
|
456
|
+
/**
|
|
457
|
+
* Acknowledge claims while preserving their bodies for later inspection or explicit expiry.
|
|
458
|
+
*
|
|
459
|
+
* A token identifies both its message and its claim generation, so a token superseded by a re-claim
|
|
460
|
+
* after expiry matches nothing and leaves the live claim outstanding.
|
|
461
|
+
* @param agentId - Agent acknowledging its own claimed messages.
|
|
462
|
+
* @param claimTokens - Claim tokens proving ownership of fetched messages; a token repeated in one call counts once.
|
|
463
|
+
* @returns - The tokens acknowledged and, for each token that was not, the reason.
|
|
464
|
+
*/
|
|
465
|
+
ack(agentId: AgentId, claimTokens: readonly string[]): AckResult;
|
|
466
|
+
/**
|
|
467
|
+
* Return claims the broker made on a recipient's behalf whose delivery never reached the host.
|
|
468
|
+
*
|
|
469
|
+
* Waiting out the visibility window would hold a message the recipient never saw for the whole
|
|
470
|
+
* window; the transport has already said nothing arrived, so the queue gets it back now. The
|
|
471
|
+
* redelivery schedule armed when the message was queued is still in place, because a claimed
|
|
472
|
+
* message keeps its inbox's schedule, and it decides when the message is offered again.
|
|
473
|
+
* @param agentId - Recipient the claims were made for.
|
|
474
|
+
* @param claimTokens - Claim tokens the failed delivery carried.
|
|
475
|
+
* @returns - Message identities returned to the queue; a claim already acknowledged or expired is skipped.
|
|
476
|
+
*/
|
|
477
|
+
releaseClaims(agentId: AgentId, claimTokens: readonly string[]): string[];
|
|
478
|
+
/**
|
|
479
|
+
* Return whether an agent has queued durable inbox messages without claiming them.
|
|
480
|
+
* @param agentId - Agent whose queue is checked.
|
|
481
|
+
* @returns - Whether the agent has at least one deliverable queued message.
|
|
482
|
+
*/
|
|
483
|
+
hasQueuedMessages(agentId: AgentId): boolean;
|
|
484
|
+
/**
|
|
485
|
+
* Expire active claims back to the durable queue for redelivery.
|
|
486
|
+
*
|
|
487
|
+
* The only thing that settles a lapsed claim, and so the only thing that makes {@link snapshot}'s
|
|
488
|
+
* claim states current: a reader that never runs it sees a dead claimant's claim as `claimed`.
|
|
489
|
+
*/
|
|
490
|
+
expireClaims(): void;
|
|
491
|
+
/**
|
|
492
|
+
* Advance the redelivery schedule and report the inboxes now owed another wake.
|
|
493
|
+
*
|
|
494
|
+
* Claims are expired first, so an inbox whose messages are merely in flight is distinguished from
|
|
495
|
+
* one whose recipient stopped answering: only the second spends an attempt. An inbox that has been
|
|
496
|
+
* retried past the give-up budget is dead-lettered here rather than retried again, because a
|
|
497
|
+
* sender waiting on a delivery outcome is owed a terminal state. An inbox whose stored recipient
|
|
498
|
+
* cannot be read is dead-lettered on its first due wake, claimed messages included, since none can
|
|
499
|
+
* be fetched or acknowledged.
|
|
500
|
+
* @returns - Recipients whose queued messages should be notified again, in no guaranteed order.
|
|
501
|
+
*/
|
|
502
|
+
dueRedeliveryWakes(): AgentId[];
|
|
503
|
+
/**
|
|
504
|
+
* Record that a redelivery wake reached one recipient, against each message it covered.
|
|
505
|
+
*
|
|
506
|
+
* Separate from scheduling because only the caller that published the wake knows whether it was
|
|
507
|
+
* admitted: a wake the budget shed still costs an attempt, but writing it to the lifecycle would
|
|
508
|
+
* tell an operator a message was delivered again when nothing left the broker.
|
|
509
|
+
* @param agentId - Recipient the wake was published for.
|
|
510
|
+
*/
|
|
511
|
+
recordRedeliveryAttempt(agentId: AgentId): void;
|
|
512
|
+
/**
|
|
513
|
+
* Mark expired unattached reservations and parent-visible dead-letter outcomes.
|
|
514
|
+
*
|
|
515
|
+
* Scoped to an agent with no active session at all: an agent already attached on one channel can
|
|
516
|
+
* hold an unconsumed reservation on another (its delivery channel, when its implementation has no
|
|
517
|
+
* host-push capability and so never attaches it) that outlives the reservation TTL forever. That
|
|
518
|
+
* reservation expiring is not the agent going unanswered — it is alive and reachable — so treating
|
|
519
|
+
* it as a never-attached identity would dead-letter its live mail out from under it.
|
|
520
|
+
*/
|
|
521
|
+
reapExpiredReservations(): void;
|
|
522
|
+
/**
|
|
523
|
+
* Mark a message expired, retaining the stored body and the sender-visible status of its row.
|
|
524
|
+
* @param messageId - Message being marked expired.
|
|
525
|
+
* @param actor - Identity performing the audited action.
|
|
526
|
+
*/
|
|
527
|
+
expireMessage(messageId: string, actor: "ttl" | "operator"): void;
|
|
528
|
+
/**
|
|
529
|
+
* Mark a message failed, retaining the stored body and the sender-visible status of its row.
|
|
530
|
+
* @param messageId - Message being marked failed.
|
|
531
|
+
*/
|
|
532
|
+
failMessage(messageId: string): void;
|
|
533
|
+
/**
|
|
534
|
+
* Return body-free status for a sender-visible message.
|
|
535
|
+
* @param messageId - Message whose status is read.
|
|
536
|
+
* @param requester - Agent identity authorized to inspect sender-visible status.
|
|
537
|
+
* @returns - Sender-visible delivery status without retained message content.
|
|
538
|
+
*/
|
|
539
|
+
status(messageId: string, requester?: AgentId): {
|
|
540
|
+
messageId: string;
|
|
541
|
+
state: MessageState;
|
|
542
|
+
to: AgentId;
|
|
543
|
+
};
|
|
544
|
+
/**
|
|
545
|
+
* Return the broker's observable operational events.
|
|
546
|
+
* @returns - Copy of accumulated operational events, safe for caller inspection.
|
|
547
|
+
*/
|
|
548
|
+
operationalEvents(): BrokerOperationalEvent[];
|
|
549
|
+
/**
|
|
550
|
+
* Append an operational event recording the outcome of a delivery notification attempt.
|
|
551
|
+
* @param messageId - Message the notification outcome is recorded against.
|
|
552
|
+
* @param outcome - Observed notification result recorded for diagnostics.
|
|
553
|
+
*/
|
|
554
|
+
recordNotification(messageId: string, outcome: NotificationOutcome): void;
|
|
555
|
+
/**
|
|
556
|
+
* Reads a message's retained body, available until the settled-message prune deletes its row.
|
|
557
|
+
* @param messageId - Message whose retained body is read.
|
|
558
|
+
* @returns - Retained body content and its stored representation metadata.
|
|
559
|
+
*/
|
|
560
|
+
readMessageBody(messageId: string): {
|
|
561
|
+
messageId: string;
|
|
562
|
+
body: unknown;
|
|
563
|
+
rawCopy: string;
|
|
564
|
+
sizeBytes: number;
|
|
565
|
+
contentType: string;
|
|
566
|
+
};
|
|
567
|
+
/**
|
|
568
|
+
* Read bounded durable traffic without claiming, acknowledging, or changing retained bodies.
|
|
569
|
+
* @returns Traffic source rows in their single broker-owned durable order.
|
|
570
|
+
*/
|
|
571
|
+
operatorTrafficRecords(): BrokerTrafficReadResult;
|
|
572
|
+
/**
|
|
573
|
+
* Return a prior operator command acceptance for idempotent request handling.
|
|
574
|
+
* @param commandId - Opaque command correlation supplied by the operator boundary.
|
|
575
|
+
* @returns Stored acceptance, or null when this command has not been accepted.
|
|
576
|
+
*/
|
|
577
|
+
operatorCommand(commandId: string): BrokerOperatorCommandRecord | null;
|
|
578
|
+
/**
|
|
579
|
+
* Persist ping request acceptance and its audit before the scheduler publishes a wake.
|
|
580
|
+
* @param commandId - Opaque idempotency correlation for the operator request.
|
|
581
|
+
* @param targetAgentId - Active broker agent requested by the operator.
|
|
582
|
+
* @param controlId - Opaque correlation carried by the body-free wake.
|
|
583
|
+
* @returns Newly persisted command acceptance.
|
|
584
|
+
*/
|
|
585
|
+
acceptOperatorPing(commandId: string, targetAgentId: AgentId, controlId: string): BrokerOperatorCommandAcceptance;
|
|
586
|
+
/**
|
|
587
|
+
* Atomically expire one retained message and persist command acceptance for idempotent retry.
|
|
588
|
+
* @param commandId - Opaque idempotency correlation for the operator request.
|
|
589
|
+
* @param messageId - Accepted message whose retained body stays readable until the settled-message prune.
|
|
590
|
+
* @returns Newly persisted command acceptance.
|
|
591
|
+
*/
|
|
592
|
+
acceptOperatorExpiry(commandId: string, messageId: string): BrokerOperatorCommandAcceptance;
|
|
593
|
+
/**
|
|
594
|
+
* Accept one operator archive request, putting the agent away without disturbing its mail.
|
|
595
|
+
*
|
|
596
|
+
* The same lifecycle holds for every identity, ephemeral or named: active, archived, then reaped.
|
|
597
|
+
* Until the reaper takes it, once `archivedRetentionMs` has passed since this acceptance, the
|
|
598
|
+
* identity keeps its name, its conversation key, its inbox and its addressability, so the ordinary
|
|
599
|
+
* reconnection path is what brings it back and everything queued for it, before or since, is
|
|
600
|
+
* waiting when it does. Attaching un-archives it and stops the clock. Archiving an identity that is
|
|
601
|
+
* already archived keeps the first `archived_at`, so a repeat request never extends the window.
|
|
602
|
+
* @param commandId - Correlates retries of the same operator request.
|
|
603
|
+
* @param agentId - Agent the operator asked to archive.
|
|
604
|
+
* @returns - Durable acceptance, reporting whether this call created it.
|
|
605
|
+
*/
|
|
606
|
+
acceptOperatorArchive(commandId: string, agentId: AgentId): BrokerOperatorCommandAcceptance;
|
|
607
|
+
/**
|
|
608
|
+
* Returns the broker snapshot, optionally scoped to one workspace.
|
|
609
|
+
*
|
|
610
|
+
* A read: it writes nothing and publishes no commit. Claim states are as current as the last
|
|
611
|
+
* {@link expireClaims}.
|
|
612
|
+
* @param workspaceId - Workspace whose agents, and the messages they sent or received, the
|
|
613
|
+
* snapshot is scoped to; every workspace when absent.
|
|
614
|
+
* @returns - Broker snapshot, optionally scoped to the requested workspace.
|
|
615
|
+
*/
|
|
616
|
+
snapshot(workspaceId?: string): BrokerSnapshot;
|
|
617
|
+
/**
|
|
618
|
+
* Return the agent-derived state an operator projection reads, without any delivery.
|
|
619
|
+
* @returns - The snapshot's workspace, agent, and connection sections; deliveries and diagnostics are omitted.
|
|
620
|
+
*/
|
|
621
|
+
operatorAgentSource(): Pick<BrokerSnapshot, "workspaces" | "agents" | "connections">;
|
|
622
|
+
/**
|
|
623
|
+
* Return the concrete team for a registered agent.
|
|
624
|
+
* @param agentId - Registered agent whose team is looked up.
|
|
625
|
+
* @returns - Team identity that owns the registered agent.
|
|
626
|
+
*/
|
|
627
|
+
teamForAgent(agentId: AgentId): string;
|
|
628
|
+
/**
|
|
629
|
+
* Return the implementation identity recorded for an agent when it was registered.
|
|
630
|
+
* @param agentId - Registered agent whose implementation is looked up.
|
|
631
|
+
* @returns - Implementation recorded by the composition boundary, or null when none was supplied.
|
|
632
|
+
*/
|
|
633
|
+
implementationForAgent(agentId: AgentId): AgentImplementation | null;
|
|
634
|
+
/**
|
|
635
|
+
* Return team directory entries visible to the attached agent.
|
|
636
|
+
*
|
|
637
|
+
* A reaped identity is omitted, since a send to it is refused.
|
|
638
|
+
* @param agentId - Attached agent whose team roster is listed.
|
|
639
|
+
* @returns - Registered identities and current aliases visible within the agent team.
|
|
640
|
+
*/
|
|
641
|
+
listTeamMembers(agentId: AgentId): Array<{
|
|
642
|
+
id: AgentId;
|
|
643
|
+
alias: string;
|
|
644
|
+
}>;
|
|
645
|
+
/**
|
|
646
|
+
* Return every agent a sender can currently reach, with the address that reaches it from any workspace.
|
|
647
|
+
*
|
|
648
|
+
* A reaped identity is omitted, since a send to it is refused. So is a detached ephemeral identity
|
|
649
|
+
* that is not archived: it is retained only so its own conversation can resume, and offering it
|
|
650
|
+
* here invites a sender to address an inbox nothing will ever claim. An archived identity is listed
|
|
651
|
+
* because a send to it is accepted and waits.
|
|
652
|
+
* @returns - Registered identities, aliases, workspace names, and routable addresses.
|
|
653
|
+
*/
|
|
654
|
+
listAgents(): Array<{
|
|
655
|
+
id: AgentId;
|
|
656
|
+
alias: string;
|
|
657
|
+
workspace: string;
|
|
658
|
+
address: string;
|
|
659
|
+
}>;
|
|
660
|
+
/**
|
|
661
|
+
* Name every registered workspace by the shortest trailing path segments unique across the broker.
|
|
662
|
+
* @returns - Addressable workspace name for each workspace identity.
|
|
663
|
+
*/
|
|
664
|
+
workspaceNames(): Map<string, string>;
|
|
665
|
+
}
|