agent-embassy 1.7.0 → 1.8.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/CHANGELOG.md +32 -0
- package/CONTRIBUTING.md +51 -47
- package/README.md +26 -9
- package/README.zh-CN.md +22 -9
- package/SECURITY.md +48 -35
- package/dist/src/gateway/acp-client.d.ts +12 -19
- package/dist/src/gateway/acp-client.js +90 -65
- package/dist/src/gateway/acp-client.js.map +1 -1
- package/dist/src/gateway/acp-provider.d.ts +11 -10
- package/dist/src/gateway/acp-provider.js +165 -53
- package/dist/src/gateway/acp-provider.js.map +1 -1
- package/dist/src/gateway/claude-helper-client.d.ts +2 -43
- package/dist/src/gateway/claude-helper-client.js +1 -211
- package/dist/src/gateway/claude-helper-client.js.map +1 -1
- package/dist/src/gateway/claude-helper-protocol.d.ts +16 -74
- package/dist/src/gateway/claude-helper-protocol.js +99 -378
- package/dist/src/gateway/claude-helper-protocol.js.map +1 -1
- package/dist/src/gateway/claude-helper-supervisor.d.ts +56 -44
- package/dist/src/gateway/claude-helper-supervisor.js +265 -456
- package/dist/src/gateway/claude-helper-supervisor.js.map +1 -1
- package/dist/src/gateway/claude-helper.js +184 -210
- package/dist/src/gateway/claude-helper.js.map +1 -1
- package/dist/src/gateway/claude-peer.d.ts +20 -87
- package/dist/src/gateway/claude-peer.js +310 -1009
- package/dist/src/gateway/claude-peer.js.map +1 -1
- package/dist/src/gateway/claude-runtime.d.ts +13 -15
- package/dist/src/gateway/claude-runtime.js +14 -168
- package/dist/src/gateway/claude-runtime.js.map +1 -1
- package/dist/src/gateway/cli-copy.en.d.ts +2 -2
- package/dist/src/gateway/cli-copy.en.js +4 -2
- package/dist/src/gateway/cli-copy.en.js.map +1 -1
- package/dist/src/gateway/cli-copy.zh-CN.d.ts +2 -2
- package/dist/src/gateway/cli-copy.zh-CN.js +4 -2
- package/dist/src/gateway/cli-copy.zh-CN.js.map +1 -1
- package/dist/src/gateway/cli.d.ts +7 -2
- package/dist/src/gateway/cli.js +277 -575
- package/dist/src/gateway/cli.js.map +1 -1
- package/dist/src/gateway/codex-app-server.d.ts +5 -227
- package/dist/src/gateway/codex-app-server.js +18 -1463
- package/dist/src/gateway/codex-app-server.js.map +1 -1
- package/dist/src/gateway/codex-doctor.d.ts +36 -0
- package/dist/src/gateway/codex-doctor.js +127 -0
- package/dist/src/gateway/codex-doctor.js.map +1 -0
- package/dist/src/gateway/codex-local-transport.d.ts +6 -6
- package/dist/src/gateway/codex-local-transport.js +13 -10
- package/dist/src/gateway/codex-local-transport.js.map +1 -1
- package/dist/src/gateway/codex-stateless-transport.d.ts +114 -0
- package/dist/src/gateway/codex-stateless-transport.js +1108 -0
- package/dist/src/gateway/codex-stateless-transport.js.map +1 -0
- package/dist/src/gateway/config.d.ts +2 -9
- package/dist/src/gateway/config.js +62 -100
- package/dist/src/gateway/config.js.map +1 -1
- package/dist/src/gateway/control.d.ts +36 -90
- package/dist/src/gateway/control.js +465 -1123
- package/dist/src/gateway/control.js.map +1 -1
- package/dist/src/gateway/dashboard-copy.d.ts +1 -1
- package/dist/src/gateway/dashboard-copy.en.d.ts +8 -26
- package/dist/src/gateway/dashboard-copy.en.js +19 -37
- package/dist/src/gateway/dashboard-copy.en.js.map +1 -1
- package/dist/src/gateway/dashboard-copy.js +8 -26
- package/dist/src/gateway/dashboard-copy.js.map +1 -1
- package/dist/src/gateway/dashboard-copy.zh-CN.d.ts +8 -26
- package/dist/src/gateway/dashboard-copy.zh-CN.js +19 -37
- package/dist/src/gateway/dashboard-copy.zh-CN.js.map +1 -1
- package/dist/src/gateway/dashboard-model.d.ts +8 -22
- package/dist/src/gateway/dashboard-model.js +44 -130
- package/dist/src/gateway/dashboard-model.js.map +1 -1
- package/dist/src/gateway/dashboard.d.ts +0 -6
- package/dist/src/gateway/dashboard.js +3 -7
- package/dist/src/gateway/dashboard.js.map +1 -1
- package/dist/src/gateway/live-dashboard-app/app.js +20 -34
- package/dist/src/gateway/live-dashboard-command.js +2 -2
- package/dist/src/gateway/live-dashboard-command.js.map +1 -1
- package/dist/src/gateway/live-dashboard-http.d.ts +1 -1
- package/dist/src/gateway/live-dashboard-http.js +2 -2
- package/dist/src/gateway/live-dashboard-http.js.map +1 -1
- package/dist/src/gateway/progress-watch-machine.d.ts +1 -37
- package/dist/src/gateway/progress-watch-machine.js +4 -15
- package/dist/src/gateway/progress-watch-machine.js.map +1 -1
- package/dist/src/gateway/providers.d.ts +58 -191
- package/dist/src/gateway/providers.js +637 -2434
- package/dist/src/gateway/providers.js.map +1 -1
- package/dist/src/gateway/server.d.ts +16 -25
- package/dist/src/gateway/server.js +165 -240
- package/dist/src/gateway/server.js.map +1 -1
- package/dist/src/gateway/service.d.ts +149 -427
- package/dist/src/gateway/service.js +1639 -5662
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/gateway/state-v2-to-v3.d.ts +23 -0
- package/dist/src/gateway/state-v2-to-v3.js +994 -0
- package/dist/src/gateway/state-v2-to-v3.js.map +1 -0
- package/dist/src/gateway/store.d.ts +54 -309
- package/dist/src/gateway/store.js +1560 -3510
- package/dist/src/gateway/store.js.map +1 -1
- package/dist/src/gateway/types.d.ts +181 -225
- package/dist/src/gateway/types.js +115 -251
- package/dist/src/gateway/types.js.map +1 -1
- package/docs/CONFIGURATION.md +22 -9
- package/docs/CONFIGURATION.zh-CN.md +21 -9
- package/docs/DASHBOARD.md +10 -10
- package/docs/DASHBOARD.zh-CN.md +3 -3
- package/docs/DELIVERY.md +4 -4
- package/docs/DELIVERY.zh-CN.md +4 -4
- package/docs/GATEWAY-ARCHITECTURE.md +158 -187
- package/package.json +1 -1
- package/skills/embassy-peer/SKILL.md +28 -22
- package/dist/src/gateway/codex-registration-generation.d.ts +0 -5
- package/dist/src/gateway/codex-registration-generation.js +0 -19
- package/dist/src/gateway/codex-registration-generation.js.map +0 -1
- package/dist/src/gateway/codex-registration-succession.d.ts +0 -209
- package/dist/src/gateway/codex-registration-succession.js +0 -588
- package/dist/src/gateway/codex-registration-succession.js.map +0 -1
- package/dist/src/gateway/compatibility.d.ts +0 -22
- package/dist/src/gateway/compatibility.js +0 -23
- package/dist/src/gateway/compatibility.js.map +0 -1
- package/dist/src/gateway/delivery-machine.d.ts +0 -235
- package/dist/src/gateway/delivery-machine.js +0 -540
- package/dist/src/gateway/delivery-machine.js.map +0 -1
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import type { ProgressWatch, ProgressWatchJournalEvent } from "./progress-watch-machine.js";
|
|
2
1
|
export declare const gatewayProviders: readonly ["claude", "codex", "deepseek", "grok"];
|
|
3
2
|
export type GatewayProvider = (typeof gatewayProviders)[number];
|
|
4
|
-
export declare const gatewayProviderDisplayNames: Readonly<{
|
|
5
|
-
claude: string;
|
|
6
|
-
codex: string;
|
|
7
|
-
deepseek: string;
|
|
8
|
-
grok: string;
|
|
9
|
-
}>;
|
|
10
|
-
/** Registration syntax only; route bindings, never prefixes, prove providers. */
|
|
11
3
|
export declare const gatewayRegistrationIngressPrefixes: Readonly<{
|
|
12
4
|
claude: undefined;
|
|
13
5
|
codex: string;
|
|
@@ -36,11 +28,10 @@ export declare function parseDirection(value: unknown): ParsedMessageDirection |
|
|
|
36
28
|
export declare const isMessageDirection: (value: unknown) => value is MessageDirection;
|
|
37
29
|
export declare const deliveryStates: readonly ["queued", "duplicate", "dispatching", "transport_written", "held", "delivered", "unconfirmed", "failed", "ambiguous", "expired", "cancelled", "abandoned", "rejected"];
|
|
38
30
|
export type DeliveryState = (typeof deliveryStates)[number];
|
|
39
|
-
export
|
|
31
|
+
export type TerminalDeliveryOutcome = Extract<DeliveryState, "delivered" | "unconfirmed" | "failed" | "ambiguous" | "expired" | "cancelled" | "abandoned">;
|
|
40
32
|
export declare const alertSeverities: readonly ["info", "warning", "error"];
|
|
41
33
|
export type AlertSeverity = (typeof alertSeverities)[number];
|
|
42
34
|
export type BusyPolicy = "queue";
|
|
43
|
-
/** Canonical closed-array bounds shared by store projections and control/UI. */
|
|
44
35
|
export declare const gatewayPublicSnapshotLimits: Readonly<{
|
|
45
36
|
readonly connectors: 64;
|
|
46
37
|
readonly registryRejectionCodes: 32;
|
|
@@ -53,25 +44,16 @@ export declare const gatewayPublicSnapshotLimits: Readonly<{
|
|
|
53
44
|
readonly messages: 1024;
|
|
54
45
|
readonly alerts: 256;
|
|
55
46
|
}>;
|
|
56
|
-
/** Leaves headroom for the private control protocol response envelope. */
|
|
57
47
|
export declare const GATEWAY_PUBLIC_SNAPSHOT_BYTE_BUDGET: number;
|
|
58
48
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* public snapshots, normalized events, logs, or error messages.
|
|
49
|
+
* Durable logical registration. Provider endpoint generations are deliberately
|
|
50
|
+
* absent: they are operation-local evidence and never routing authority.
|
|
62
51
|
*/
|
|
63
|
-
export type
|
|
52
|
+
export type LogicalRouteBinding = {
|
|
64
53
|
provider: GatewayProvider;
|
|
65
54
|
hostId: string;
|
|
66
|
-
endpointGeneration: string;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Private, immutable target binding. routeHandle may be a native provider
|
|
70
|
-
* thread/session identifier; ownerLease proves which registration owns it.
|
|
71
|
-
*/
|
|
72
|
-
export type PrivateRouteBinding = PrivateEndpointIdentity & {
|
|
73
55
|
routeHandle: string;
|
|
74
|
-
|
|
56
|
+
registrationId: string;
|
|
75
57
|
};
|
|
76
58
|
export type RouteCounters = {
|
|
77
59
|
accepted: number;
|
|
@@ -87,30 +69,25 @@ export type RouteCounters = {
|
|
|
87
69
|
};
|
|
88
70
|
export type GatewayRouteRecord = {
|
|
89
71
|
alias: string;
|
|
90
|
-
binding:
|
|
72
|
+
binding: LogicalRouteBinding;
|
|
91
73
|
registrationMode: RouteRegistrationMode;
|
|
92
74
|
enabled: boolean;
|
|
93
|
-
state: RouteState;
|
|
94
75
|
busyPolicy: BusyPolicy;
|
|
95
76
|
registeredAt: string;
|
|
96
77
|
updatedAt: string;
|
|
97
|
-
lastSeenAt?: string;
|
|
98
|
-
queueDepth: number;
|
|
99
78
|
counters: RouteCounters;
|
|
100
|
-
safeErrorCode?: string;
|
|
101
79
|
};
|
|
102
80
|
/**
|
|
103
81
|
* Durable bidirectional consent between two exact route owners. Aliases are
|
|
104
|
-
* display coordinates; the private
|
|
82
|
+
* display coordinates; the private registration identities prevent an alias from silently
|
|
105
83
|
* retargeting an existing permission edge.
|
|
106
84
|
*/
|
|
107
85
|
export type GatewayConsentEndpoint = Readonly<{
|
|
108
86
|
alias: string;
|
|
109
87
|
provider: GatewayProvider;
|
|
110
|
-
|
|
88
|
+
registrationId: string;
|
|
111
89
|
}>;
|
|
112
90
|
export type GatewayConsentEdgeRecord = {
|
|
113
|
-
/** Canonical order: provider order first, then alias. */
|
|
114
91
|
endpoints: readonly [GatewayConsentEndpoint, GatewayConsentEndpoint];
|
|
115
92
|
createdAt: string;
|
|
116
93
|
updatedAt: string;
|
|
@@ -122,28 +99,13 @@ export type GatewayConsentEdgeRecord = {
|
|
|
122
99
|
*/
|
|
123
100
|
export type GatewayPrivateRouteInspection = {
|
|
124
101
|
alias: string;
|
|
125
|
-
binding:
|
|
102
|
+
binding: LogicalRouteBinding;
|
|
126
103
|
registrationMode: RouteRegistrationMode;
|
|
127
104
|
enabled: boolean;
|
|
128
|
-
state: RouteState;
|
|
129
|
-
safeErrorCode?: string;
|
|
130
105
|
};
|
|
131
|
-
export type ConnectorRecord = {
|
|
132
|
-
provider: GatewayProvider;
|
|
133
|
-
hostId: string;
|
|
134
|
-
endpointGeneration: string;
|
|
135
|
-
health: ConnectorHealth;
|
|
136
|
-
protocol: string;
|
|
137
|
-
protocolVersion: string;
|
|
138
|
-
updatedAt: string;
|
|
139
|
-
lastSeenAt?: string;
|
|
140
|
-
safeErrorCode?: string;
|
|
141
|
-
};
|
|
142
|
-
/** Metadata persisted for a queued message. Legacy rows may be bodyless. */
|
|
143
106
|
export type QueuedMessageMetadata = {
|
|
144
107
|
messageId: string;
|
|
145
108
|
messageIdSuffix: string;
|
|
146
|
-
/** Bounded public correlation only; the full conversation capability stays private. */
|
|
147
109
|
conversationIdSuffix?: string;
|
|
148
110
|
direction: MessageDirection;
|
|
149
111
|
sourceAlias: string;
|
|
@@ -151,22 +113,11 @@ export type QueuedMessageMetadata = {
|
|
|
151
113
|
enqueuedAt: string;
|
|
152
114
|
deadlineAt: string;
|
|
153
115
|
bytes: number;
|
|
154
|
-
/** Bounded same-user durable payload; absent only on pre-v1.2 rows. */
|
|
155
116
|
body?: string;
|
|
156
|
-
/** This message was admitted by the exact durable consent edge. */
|
|
157
117
|
pair?: true;
|
|
158
|
-
/** Target authority was transient and must never be reconstructed after restart. */
|
|
159
118
|
transientTarget?: true;
|
|
160
|
-
/** Exact Claude-to-Codex `STEER:` classification; absence means ordinary. */
|
|
161
119
|
steer?: true;
|
|
162
120
|
};
|
|
163
|
-
/** A dispatch value with the exact persisted body promoted to required. */
|
|
164
|
-
export type TransientQueuedMessage = QueuedMessageMetadata & {
|
|
165
|
-
body: string;
|
|
166
|
-
};
|
|
167
|
-
export type InFlightMessageMetadata = QueuedMessageMetadata & {
|
|
168
|
-
dispatchedAt: string;
|
|
169
|
-
};
|
|
170
121
|
export type DedupeRecord = {
|
|
171
122
|
fingerprint: string;
|
|
172
123
|
messageIdSuffix: string;
|
|
@@ -193,7 +144,6 @@ export type NormalizedMessageEvent = {
|
|
|
193
144
|
targetAlias: string;
|
|
194
145
|
state: DeliveryState;
|
|
195
146
|
bytes: number;
|
|
196
|
-
/** Retained payload; oldest values are evicted without removing metadata. */
|
|
197
147
|
body?: string;
|
|
198
148
|
steer?: true;
|
|
199
149
|
latencyMs?: number;
|
|
@@ -213,61 +163,75 @@ export type GatewayAccounting = {
|
|
|
213
163
|
bytesAccepted: number;
|
|
214
164
|
queuedBytes: number;
|
|
215
165
|
};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
166
|
+
export type GatewayPreparedWriteEvidence = {
|
|
167
|
+
kind: "claude_mailbox" | "codex_turn_start" | "codex_turn_steer" | "acp_prompt";
|
|
168
|
+
bodyBytes: number;
|
|
169
|
+
bodySha256: string;
|
|
170
|
+
frameBytes: number;
|
|
171
|
+
sha256: string;
|
|
172
|
+
};
|
|
173
|
+
export type GatewayMessageAttemptAuthority = {
|
|
174
|
+
attemptId: string;
|
|
175
|
+
attemptCount: number;
|
|
176
|
+
targetRegistrationId: string;
|
|
177
|
+
sourceRegistrationId: string | null;
|
|
178
|
+
consentEdge: readonly [GatewayConsentEndpoint, GatewayConsentEndpoint] | null;
|
|
179
|
+
};
|
|
180
|
+
export type GatewayMessageState = {
|
|
181
|
+
phase: "queued";
|
|
182
|
+
attemptCount: number;
|
|
183
|
+
} | (GatewayMessageAttemptAuthority & {
|
|
184
|
+
phase: "reserved";
|
|
185
|
+
reservedAt: string;
|
|
186
|
+
}) | (GatewayMessageAttemptAuthority & {
|
|
187
|
+
phase: "armed";
|
|
188
|
+
armedAt: string;
|
|
189
|
+
prepared: GatewayPreparedWriteEvidence;
|
|
190
|
+
}) | (GatewayMessageAttemptAuthority & {
|
|
191
|
+
phase: "accepted";
|
|
192
|
+
acceptedAt: string;
|
|
193
|
+
prepared: GatewayPreparedWriteEvidence;
|
|
194
|
+
lossOutcome: "unconfirmed" | "ambiguous";
|
|
195
|
+
}) | {
|
|
196
|
+
phase: "terminal";
|
|
197
|
+
outcome: TerminalDeliveryOutcome;
|
|
198
|
+
terminalAt: string;
|
|
199
|
+
safeErrorCode?: string;
|
|
200
|
+
latencyMs: number;
|
|
231
201
|
};
|
|
232
|
-
export
|
|
233
|
-
/**
|
|
234
|
-
* Private durable evidence that an operator removed one safely proven stale
|
|
235
|
-
* Codex registration. No native task or endpoint identifiers are retained.
|
|
236
|
-
*/
|
|
237
|
-
export type CodexOrphanRemovalJournalEvent = {
|
|
202
|
+
export type GatewayMessageRecord = QueuedMessageMetadata & {
|
|
238
203
|
sequence: number;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
204
|
+
deliveryToken?: string;
|
|
205
|
+
sourceRegistrationId: string | null;
|
|
206
|
+
targetRegistrationId: string | null;
|
|
207
|
+
consentEdge: readonly [GatewayConsentEndpoint, GatewayConsentEndpoint] | null;
|
|
208
|
+
state: GatewayMessageState;
|
|
209
|
+
};
|
|
210
|
+
export type GatewayLegacyMessageActivity = {
|
|
211
|
+
type: "legacy_message";
|
|
212
|
+
event: NormalizedMessageEvent;
|
|
242
213
|
};
|
|
243
|
-
export
|
|
214
|
+
export type GatewayRuntimeActivity = {
|
|
215
|
+
type: "activity";
|
|
216
|
+
event: PublicGatewayActivityEvent;
|
|
217
|
+
};
|
|
218
|
+
export type GatewayStateActivity = GatewayLegacyMessageActivity | GatewayRuntimeActivity;
|
|
244
219
|
export type GatewayPersistedState = {
|
|
245
|
-
schemaVersion:
|
|
220
|
+
schemaVersion: 3;
|
|
221
|
+
commit: {
|
|
222
|
+
sequence: number;
|
|
223
|
+
id: string;
|
|
224
|
+
};
|
|
246
225
|
createdAt: string;
|
|
247
226
|
updatedAt: string;
|
|
248
227
|
eventSequence: number;
|
|
249
228
|
routes: GatewayRouteRecord[];
|
|
250
229
|
consentEdges: GatewayConsentEdgeRecord[];
|
|
251
|
-
|
|
252
|
-
queue: QueuedMessageMetadata[];
|
|
253
|
-
inFlight: InFlightMessageMetadata[];
|
|
254
|
-
events: NormalizedMessageEvent[];
|
|
230
|
+
messages: GatewayMessageRecord[];
|
|
255
231
|
dedupe: DedupeRecord[];
|
|
256
232
|
rateBuckets: RateBucket[];
|
|
233
|
+
activity: GatewayStateActivity[];
|
|
257
234
|
accounting: GatewayAccounting;
|
|
258
|
-
watchSequence: number;
|
|
259
|
-
progressWatches: ProgressWatch[];
|
|
260
|
-
progressWatchEvents: ProgressWatchJournalEvent[];
|
|
261
|
-
/** Monotonic sequence for the bounded private endpoint-refresh journal. */
|
|
262
|
-
codexEndpointRefreshSequence: number;
|
|
263
|
-
/** Strictly private route-lifecycle evidence; never publicly projected. */
|
|
264
|
-
codexEndpointRefreshEvents: CodexEndpointRefreshJournalEvent[];
|
|
265
|
-
/** Monotonic sequence for bounded private operator-recovery evidence. */
|
|
266
|
-
codexOrphanRemovalSequence: number;
|
|
267
|
-
/** Strictly private orphan-removal evidence; never publicly projected. */
|
|
268
|
-
codexOrphanRemovalEvents: CodexOrphanRemovalJournalEvent[];
|
|
269
|
-
/** Strictly validated internal restart journal; never publicly projected. */
|
|
270
|
-
codexSuccession?: unknown;
|
|
271
235
|
};
|
|
272
236
|
export type PublicRouteSnapshot = {
|
|
273
237
|
alias: string;
|
|
@@ -278,18 +242,15 @@ export type PublicRouteSnapshot = {
|
|
|
278
242
|
busyPolicy: BusyPolicy;
|
|
279
243
|
lastSeenAt?: string;
|
|
280
244
|
queueDepth: number;
|
|
281
|
-
/** Earliest enqueue time for this route's current queue, if non-empty. */
|
|
282
245
|
oldestQueuedAt?: string;
|
|
283
246
|
counters: RouteCounters;
|
|
284
247
|
safeErrorCode?: string;
|
|
285
248
|
};
|
|
286
|
-
/** Metadata-only public consent edge. Private route authority is omitted. */
|
|
287
249
|
export type PublicConsentEndpointSnapshot = Readonly<{
|
|
288
250
|
alias: string;
|
|
289
251
|
provider: GatewayProvider;
|
|
290
252
|
}>;
|
|
291
253
|
export type PublicConsentEdgeSnapshot = {
|
|
292
|
-
/** Canonical order matching the private consent edge. */
|
|
293
254
|
endpoints: readonly [PublicConsentEndpointSnapshot, PublicConsentEndpointSnapshot];
|
|
294
255
|
host: string;
|
|
295
256
|
counters: RouteCounters;
|
|
@@ -301,9 +262,16 @@ export type PublicConnectorSnapshot = {
|
|
|
301
262
|
protocol: string;
|
|
302
263
|
protocolVersion: string;
|
|
303
264
|
lastSeenAt?: string;
|
|
265
|
+
observationAgeMs?: number;
|
|
266
|
+
codexDoctor?: PublicCodexDoctorSnapshot;
|
|
304
267
|
safeErrorCode?: string;
|
|
305
268
|
registry?: PublicRegistryObservationSnapshot;
|
|
306
269
|
};
|
|
270
|
+
export type PublicCodexDoctorCondition = "split_brain" | "orphaned" | "attached" | "observation_stale" | "managed_layout_missing" | "unknown";
|
|
271
|
+
export type PublicCodexDoctorSnapshot = Readonly<{
|
|
272
|
+
conditions: readonly PublicCodexDoctorCondition[];
|
|
273
|
+
}>;
|
|
274
|
+
export declare const CONNECTOR_OBSERVATION_STALE_AFTER_MS = 35000;
|
|
307
275
|
/**
|
|
308
276
|
* Bounded, native-ID-free evidence attached to one Claude connector. Counts
|
|
309
277
|
* describe only the latest pass; the monotonic flag distinguishes an ordinary
|
|
@@ -333,17 +301,15 @@ export type PublicAvailablePeerSnapshot = {
|
|
|
333
301
|
provider: GatewayProvider;
|
|
334
302
|
host: string;
|
|
335
303
|
state: PublicAvailablePeerState;
|
|
336
|
-
/** True only when this row passed the provider's strict selectable-peer checks. */
|
|
337
304
|
validated: boolean;
|
|
338
305
|
selected: boolean;
|
|
339
306
|
lastSeenAt?: string;
|
|
340
307
|
safeErrorCode?: string;
|
|
341
308
|
};
|
|
342
|
-
export declare const gatewayActivityKinds: readonly ["discovery", "selection", "registration", "pairing", "watch"
|
|
309
|
+
export declare const gatewayActivityKinds: readonly ["discovery", "selection", "registration", "pairing", "watch"];
|
|
343
310
|
export type GatewayActivityKind = (typeof gatewayActivityKinds)[number];
|
|
344
|
-
export declare const gatewayActivityActions: readonly ["discovery_refreshed", "claude_selected", "claude_unselected", "codex_registered", "codex_succeeded", "codex_unregistered", "routes_paired", "routes_unpaired", "watch_ended"
|
|
311
|
+
export declare const gatewayActivityActions: readonly ["discovery_refreshed", "claude_selected", "claude_unselected", "codex_registered", "codex_succeeded", "codex_unregistered", "routes_paired", "routes_unpaired", "watch_ended"];
|
|
345
312
|
export type GatewayActivityAction = (typeof gatewayActivityActions)[number];
|
|
346
|
-
/** Bounded, body-free operator activity retained for this broker process. */
|
|
347
313
|
export type PublicGatewayActivityEvent = {
|
|
348
314
|
sequence: number;
|
|
349
315
|
timestamp: string;
|
|
@@ -361,7 +327,6 @@ export type DeadlinePressureBucket = {
|
|
|
361
327
|
settled: number;
|
|
362
328
|
expired: number;
|
|
363
329
|
};
|
|
364
|
-
/** Counts are computed only from the bounded retained delivery ledger. */
|
|
365
330
|
export type DeadlinePressureSnapshot = {
|
|
366
331
|
configuredDeadlineMs: number;
|
|
367
332
|
retainedSince?: string;
|
|
@@ -369,7 +334,6 @@ export type DeadlinePressureSnapshot = {
|
|
|
369
334
|
expiredEvents: number;
|
|
370
335
|
buckets: DeadlinePressureBucket[];
|
|
371
336
|
};
|
|
372
|
-
/** Strict closed-schema guard for runtime-supplied transient inventory rows. */
|
|
373
337
|
export declare function isPublicAvailablePeerSnapshot(value: unknown): value is PublicAvailablePeerSnapshot;
|
|
374
338
|
export declare function arePublicAvailablePeerSnapshots(value: unknown, maximumRows?: number): value is PublicAvailablePeerSnapshot[];
|
|
375
339
|
export declare function isPublicRegistryObservationSnapshot(value: unknown): value is PublicRegistryObservationSnapshot;
|
|
@@ -402,7 +366,6 @@ export type PublicProgressWatchEventSnapshot = {
|
|
|
402
366
|
export type GatewayPublicSnapshot = {
|
|
403
367
|
schemaVersion: 2;
|
|
404
368
|
generatedAt: string;
|
|
405
|
-
/** Launch-time Claude-to-Codex consent policy; paired is the safe default. */
|
|
406
369
|
inboundMode: GatewayInboundMode;
|
|
407
370
|
health: ConnectorHealth;
|
|
408
371
|
connectors: PublicConnectorSnapshot[];
|
|
@@ -438,100 +401,114 @@ export type GatewaySnapshotTruncation = {
|
|
|
438
401
|
export declare function projectGatewayPublicSnapshot(snapshot: GatewayPublicSnapshot, maximumBytes?: number): GatewayPublicSnapshot;
|
|
439
402
|
export type RegisterRouteInput = {
|
|
440
403
|
alias: string;
|
|
441
|
-
binding:
|
|
404
|
+
binding: LogicalRouteBinding;
|
|
442
405
|
registrationMode: RouteRegistrationMode;
|
|
443
|
-
state?: "idle" | "busy" | "awaiting_approval";
|
|
444
406
|
};
|
|
445
|
-
export type
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
407
|
+
export type GatewayReservedAttempt = Readonly<{
|
|
408
|
+
messageId: string;
|
|
409
|
+
attemptId: string;
|
|
410
|
+
attemptCount: number;
|
|
411
|
+
body: string;
|
|
412
|
+
deadlineAt: string;
|
|
413
|
+
direction: MessageDirection;
|
|
414
|
+
sourceAlias: string;
|
|
415
|
+
targetAlias: string;
|
|
416
|
+
conversationIdSuffix?: string;
|
|
417
|
+
sourceRegistrationId: string | null;
|
|
418
|
+
targetRegistrationId: string;
|
|
419
|
+
consentEdge: readonly [GatewayConsentEndpoint, GatewayConsentEndpoint] | null;
|
|
420
|
+
bytes: number;
|
|
421
|
+
steer?: true;
|
|
422
|
+
}>;
|
|
423
|
+
export type ReserveMessageResult = Readonly<{
|
|
424
|
+
status: "empty";
|
|
425
|
+
}> | Readonly<{
|
|
426
|
+
status: "terminal";
|
|
427
|
+
settlement: TerminalMessageSettlement;
|
|
428
|
+
}> | Readonly<{
|
|
429
|
+
status: "reserved";
|
|
430
|
+
attempt: GatewayReservedAttempt;
|
|
431
|
+
}>;
|
|
432
|
+
type AttemptInput = Readonly<{
|
|
433
|
+
messageId: string;
|
|
434
|
+
attemptId: string;
|
|
435
|
+
}>;
|
|
436
|
+
type StaleAttemptResult = Readonly<{
|
|
437
|
+
status: "stale";
|
|
438
|
+
}>;
|
|
439
|
+
type SettledAttemptResult = Readonly<{
|
|
440
|
+
status: "settled";
|
|
441
|
+
settlement: TerminalMessageSettlement;
|
|
442
|
+
}>;
|
|
443
|
+
export type AuthorizeMessageInput = AttemptInput & Readonly<{
|
|
444
|
+
sourceRegistrationId: string | null;
|
|
445
|
+
targetRegistrationId: string;
|
|
446
|
+
prepared: GatewayPreparedWriteEvidence;
|
|
447
|
+
}>;
|
|
448
|
+
export type AuthorizeMessageResult = Readonly<{
|
|
449
|
+
status: "authorized";
|
|
450
|
+
}> | Readonly<{
|
|
451
|
+
status: "stale";
|
|
452
|
+
reason: "not_reserved" | "attempt_mismatch" | "registration_changed" | "consent_removed";
|
|
453
|
+
}> | Readonly<{
|
|
454
|
+
status: "terminal";
|
|
455
|
+
reason: "expired" | "fenced";
|
|
456
|
+
settlement: TerminalMessageSettlement;
|
|
457
|
+
}>;
|
|
458
|
+
export type AcceptMessageInput = AttemptInput & Readonly<{
|
|
459
|
+
lossOutcome: "unconfirmed" | "ambiguous";
|
|
460
|
+
}>;
|
|
461
|
+
export type AcceptMessageResult = Readonly<{
|
|
462
|
+
status: "accepted";
|
|
463
|
+
}> | StaleAttemptResult;
|
|
464
|
+
export type ResolvePrewriteAttemptInput = AttemptInput & Readonly<{
|
|
465
|
+
outcome: "requeue" | "failed";
|
|
450
466
|
safeErrorCode?: string;
|
|
451
|
-
}
|
|
452
|
-
export type
|
|
453
|
-
|
|
454
|
-
|
|
467
|
+
}>;
|
|
468
|
+
export type ResolvePrewriteAttemptResult = Readonly<{
|
|
469
|
+
status: "requeued";
|
|
470
|
+
}> | SettledAttemptResult | StaleAttemptResult;
|
|
471
|
+
export type SettleAttemptInput = AttemptInput & Readonly<{
|
|
472
|
+
state: Exclude<TerminalDeliveryOutcome, "abandoned">;
|
|
455
473
|
safeErrorCode?: string;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
export type
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
/** Only the exact loaded/list-present subset is named here. */
|
|
485
|
-
routes: readonly ReanchorCodexRouteInput[];
|
|
486
|
-
};
|
|
487
|
-
export type ReanchorCodexRoutesResult = {
|
|
488
|
-
reboundAliases: string[];
|
|
489
|
-
};
|
|
490
|
-
export type RemoveStaleCodexOrphanInput = {
|
|
491
|
-
/** Dashboard-confirmed exact public alias; no native identifier is accepted. */
|
|
492
|
-
alias: string;
|
|
493
|
-
};
|
|
494
|
-
export type StaleCodexOrphanRemovalAuthority = {
|
|
495
|
-
binding: PrivateRouteBinding;
|
|
496
|
-
previousSequence: number;
|
|
497
|
-
};
|
|
498
|
-
export type StaleCodexOrphanRemovalCommitProofInput = {
|
|
499
|
-
alias: string;
|
|
500
|
-
binding: PrivateRouteBinding;
|
|
501
|
-
previousSequence: number;
|
|
502
|
-
};
|
|
503
|
-
export type RemoveStaleCodexOrphanResult = {
|
|
504
|
-
alias: string;
|
|
505
|
-
/** Private result used only to reconcile in-process service bindings. */
|
|
506
|
-
binding: PrivateRouteBinding;
|
|
507
|
-
removedEdges: Array<{
|
|
508
|
-
aliases: readonly [string, string];
|
|
509
|
-
}>;
|
|
510
|
-
};
|
|
474
|
+
}>;
|
|
475
|
+
export type SettleAttemptResult = SettledAttemptResult | StaleAttemptResult;
|
|
476
|
+
export type SettleAttemptForShutdownInput = AttemptInput;
|
|
477
|
+
export type SettleAttemptForShutdownResult = Readonly<{
|
|
478
|
+
status: "requeued";
|
|
479
|
+
}> | SettledAttemptResult | StaleAttemptResult;
|
|
480
|
+
export type SettleQueuedMessageForShutdownInput = Readonly<{
|
|
481
|
+
messageId: string;
|
|
482
|
+
}>;
|
|
483
|
+
export type SettleQueuedMessageForShutdownResult = SettledAttemptResult | StaleAttemptResult;
|
|
484
|
+
export type RemoveRouteAtomicResult = Readonly<{
|
|
485
|
+
removed: boolean;
|
|
486
|
+
settlements: readonly TerminalMessageSettlement[];
|
|
487
|
+
}>;
|
|
488
|
+
export type GatewayAtomicActivityInput = Readonly<{
|
|
489
|
+
operatorAction: boolean;
|
|
490
|
+
}>;
|
|
491
|
+
export type ReplaceCodexRegistrationAtomicInput = Readonly<{
|
|
492
|
+
oldAlias: string;
|
|
493
|
+
expectedOldRegistrationId: string;
|
|
494
|
+
replacement: RegisterRouteInput;
|
|
495
|
+
activity: GatewayAtomicActivityInput;
|
|
496
|
+
}>;
|
|
497
|
+
export type ReplaceCodexRegistrationAtomicResult = Readonly<{
|
|
498
|
+
replaced: boolean;
|
|
499
|
+
idempotent: boolean;
|
|
500
|
+
settlements: readonly TerminalMessageSettlement[];
|
|
501
|
+
}>;
|
|
511
502
|
export type EnqueueMessageInput = {
|
|
512
503
|
sourceAlias: string;
|
|
513
504
|
targetAlias: string;
|
|
505
|
+
expectedSourceRegistrationId?: string;
|
|
506
|
+
expectedTargetRegistrationId?: string;
|
|
514
507
|
body: string;
|
|
515
508
|
dedupeKey: string;
|
|
516
|
-
/** Last eight opaque characters of the controller-owned conversation ID. */
|
|
517
509
|
conversationIdSuffix?: string;
|
|
518
510
|
deadlineAt?: string;
|
|
519
511
|
steer?: true;
|
|
520
|
-
/**
|
|
521
|
-
* Controller-derived watch intent committed in the same mutation as the
|
|
522
|
-
* accepted message. Bodies and command flags are never persisted here.
|
|
523
|
-
*/
|
|
524
|
-
progressWatch?: {
|
|
525
|
-
conversationId: string;
|
|
526
|
-
actorAlias: string;
|
|
527
|
-
openIdleMs?: number;
|
|
528
|
-
completionSignal?: true;
|
|
529
|
-
};
|
|
530
|
-
/** Controller-authored nudge committed atomically with its queued body. */
|
|
531
|
-
progressWatchNudge?: {
|
|
532
|
-
conversationId: string;
|
|
533
|
-
nudgeNumber: 1 | 2;
|
|
534
|
-
};
|
|
535
512
|
};
|
|
536
513
|
/**
|
|
537
514
|
* Controller-internal proof of one currently observed native Claude peer.
|
|
@@ -540,36 +517,30 @@ export type EnqueueMessageInput = {
|
|
|
540
517
|
*/
|
|
541
518
|
export type TransientNativeClaudePeer = {
|
|
542
519
|
alias: string;
|
|
543
|
-
binding:
|
|
520
|
+
binding: LogicalRouteBinding;
|
|
544
521
|
};
|
|
545
|
-
export type EnqueueNativeIngressInput = Omit<EnqueueMessageInput, "sourceAlias" | "targetAlias"> & {
|
|
522
|
+
export type EnqueueNativeIngressInput = Omit<EnqueueMessageInput, "sourceAlias" | "targetAlias" | "expectedSourceRegistrationId" | "expectedTargetRegistrationId"> & {
|
|
546
523
|
source: TransientNativeClaudePeer;
|
|
547
524
|
targetAlias: string;
|
|
548
|
-
|
|
525
|
+
expectedTargetRegistrationId: string;
|
|
549
526
|
authorizedPairTeardownReply?: true;
|
|
550
527
|
};
|
|
551
|
-
export type EnqueueNativeReplyInput = Omit<EnqueueMessageInput, "sourceAlias" | "targetAlias"> & {
|
|
528
|
+
export type EnqueueNativeReplyInput = Omit<EnqueueMessageInput, "sourceAlias" | "targetAlias" | "expectedSourceRegistrationId" | "expectedTargetRegistrationId"> & {
|
|
552
529
|
sourceAlias: string;
|
|
530
|
+
expectedSourceRegistrationId: string;
|
|
553
531
|
target: TransientNativeClaudePeer;
|
|
554
|
-
/** Retain the original paired admission authority, when one existed. */
|
|
555
532
|
pair?: true;
|
|
533
|
+
exposeDeliveryToken?: true;
|
|
556
534
|
};
|
|
557
535
|
export type EnqueueMessageResult = {
|
|
558
536
|
accepted: boolean;
|
|
559
537
|
duplicate: boolean;
|
|
560
538
|
messageId?: string;
|
|
561
539
|
messageIdSuffix: string;
|
|
562
|
-
|
|
540
|
+
deliveryToken?: string;
|
|
563
541
|
pair?: true;
|
|
564
|
-
/** Exact older queued steer displaced by the per-edge cap, if any. */
|
|
565
542
|
supersededSettlement?: TerminalMessageSettlement;
|
|
566
543
|
};
|
|
567
|
-
export type InFlightMessageProgressState = Extract<DeliveryState, "transport_written" | "held">;
|
|
568
|
-
export type SettleMessageInput = {
|
|
569
|
-
messageId: string;
|
|
570
|
-
state: Extract<DeliveryState, "delivered" | "unconfirmed" | "failed" | "ambiguous" | "expired" | "cancelled">;
|
|
571
|
-
safeErrorCode?: string;
|
|
572
|
-
};
|
|
573
544
|
/**
|
|
574
545
|
* Controller-internal proof that one message won its terminal-state race.
|
|
575
546
|
* Full message IDs are required only for in-memory service correlation; this
|
|
@@ -577,27 +548,12 @@ export type SettleMessageInput = {
|
|
|
577
548
|
*/
|
|
578
549
|
export type TerminalMessageSettlement = {
|
|
579
550
|
messageId: string;
|
|
580
|
-
state:
|
|
551
|
+
state: TerminalDeliveryOutcome;
|
|
581
552
|
safeErrorCode?: string;
|
|
582
553
|
};
|
|
583
|
-
export type SettleMessageResult = {
|
|
584
|
-
status: "settled";
|
|
585
|
-
settlement: TerminalMessageSettlement;
|
|
586
|
-
} | {
|
|
587
|
-
status: "not_in_flight";
|
|
588
|
-
};
|
|
589
|
-
export type RequeueInFlightMessageResult = {
|
|
590
|
-
status: "requeued";
|
|
591
|
-
} | {
|
|
592
|
-
status: "settled";
|
|
593
|
-
settlement: TerminalMessageSettlement;
|
|
594
|
-
} | {
|
|
595
|
-
status: "not_in_flight";
|
|
596
|
-
};
|
|
597
554
|
export type GatewayStoreLimits = {
|
|
598
555
|
maxRoutes: number;
|
|
599
556
|
maxConsentEdges: number;
|
|
600
|
-
/** Omitted injected-test configs use the production default of 32. */
|
|
601
557
|
maxWatches?: number;
|
|
602
558
|
eventCapacity: number;
|
|
603
559
|
eventTtlMs: number;
|
|
@@ -608,7 +564,6 @@ export type GatewayStoreLimits = {
|
|
|
608
564
|
maxInFlightMessages: number;
|
|
609
565
|
maxQueueBytes: number;
|
|
610
566
|
maxMessageBytes: number;
|
|
611
|
-
/** Bounded historical event-body bytes; omitted configs use 1 MiB. */
|
|
612
567
|
maxRetainedBodyBytes?: number;
|
|
613
568
|
messageDeadlineMs: number;
|
|
614
569
|
rateLimitPerRoute: number;
|
|
@@ -617,6 +572,7 @@ export type GatewayStoreLimits = {
|
|
|
617
572
|
export type GatewayStoreDependencies = {
|
|
618
573
|
now?: () => Date;
|
|
619
574
|
randomId?: () => string;
|
|
620
|
-
|
|
575
|
+
renameStateFile?: (source: string, target: string) => Promise<void>;
|
|
621
576
|
afterStateFileRename?: () => void | Promise<void>;
|
|
622
577
|
};
|
|
578
|
+
export {};
|