agent-embassy 1.0.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 +61 -0
- package/CONTRIBUTING.md +122 -0
- package/LICENSE +21 -0
- package/README.md +185 -0
- package/README.zh-CN.md +185 -0
- package/SECURITY.md +224 -0
- package/assets/live-dashboard/app.css +1610 -0
- package/assets/mark-seal.svg +7 -0
- package/assets/mark.svg +7 -0
- package/assets/social-preview.png +0 -0
- package/assets/vendor/react/LICENSE +21 -0
- package/assets/vendor/react/react-dom.production.min.js +267 -0
- package/assets/vendor/react/react.production.min.js +31 -0
- package/dist/src/errors.d.ts +5 -0
- package/dist/src/errors.js +11 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/gateway/claude-compatibility-scratch.d.ts +18 -0
- package/dist/src/gateway/claude-compatibility-scratch.js +158 -0
- package/dist/src/gateway/claude-compatibility-scratch.js.map +1 -0
- package/dist/src/gateway/claude-helper-client.d.ts +43 -0
- package/dist/src/gateway/claude-helper-client.js +212 -0
- package/dist/src/gateway/claude-helper-client.js.map +1 -0
- package/dist/src/gateway/claude-helper-protocol.d.ts +172 -0
- package/dist/src/gateway/claude-helper-protocol.js +373 -0
- package/dist/src/gateway/claude-helper-protocol.js.map +1 -0
- package/dist/src/gateway/claude-helper-supervisor.d.ts +74 -0
- package/dist/src/gateway/claude-helper-supervisor.js +497 -0
- package/dist/src/gateway/claude-helper-supervisor.js.map +1 -0
- package/dist/src/gateway/claude-helper.d.ts +1 -0
- package/dist/src/gateway/claude-helper.js +269 -0
- package/dist/src/gateway/claude-helper.js.map +1 -0
- package/dist/src/gateway/claude-peer.d.ts +273 -0
- package/dist/src/gateway/claude-peer.js +2359 -0
- package/dist/src/gateway/claude-peer.js.map +1 -0
- package/dist/src/gateway/claude-runtime.d.ts +40 -0
- package/dist/src/gateway/claude-runtime.js +302 -0
- package/dist/src/gateway/claude-runtime.js.map +1 -0
- package/dist/src/gateway/cli-copy.d.ts +8 -0
- package/dist/src/gateway/cli-copy.en.d.ts +13 -0
- package/dist/src/gateway/cli-copy.en.js +43 -0
- package/dist/src/gateway/cli-copy.en.js.map +1 -0
- package/dist/src/gateway/cli-copy.js +19 -0
- package/dist/src/gateway/cli-copy.js.map +1 -0
- package/dist/src/gateway/cli-copy.zh-CN.d.ts +13 -0
- package/dist/src/gateway/cli-copy.zh-CN.js +43 -0
- package/dist/src/gateway/cli-copy.zh-CN.js.map +1 -0
- package/dist/src/gateway/cli.d.ts +44 -0
- package/dist/src/gateway/cli.js +969 -0
- package/dist/src/gateway/cli.js.map +1 -0
- package/dist/src/gateway/codex-app-server.d.ts +310 -0
- package/dist/src/gateway/codex-app-server.js +1746 -0
- package/dist/src/gateway/codex-app-server.js.map +1 -0
- package/dist/src/gateway/codex-local-transport.d.ts +81 -0
- package/dist/src/gateway/codex-local-transport.js +617 -0
- package/dist/src/gateway/codex-local-transport.js.map +1 -0
- package/dist/src/gateway/codex-registration-generation.d.ts +5 -0
- package/dist/src/gateway/codex-registration-generation.js +19 -0
- package/dist/src/gateway/codex-registration-generation.js.map +1 -0
- package/dist/src/gateway/codex-registration-succession.d.ts +209 -0
- package/dist/src/gateway/codex-registration-succession.js +588 -0
- package/dist/src/gateway/codex-registration-succession.js.map +1 -0
- package/dist/src/gateway/compatibility.d.ts +70 -0
- package/dist/src/gateway/compatibility.js +252 -0
- package/dist/src/gateway/compatibility.js.map +1 -0
- package/dist/src/gateway/config.d.ts +24 -0
- package/dist/src/gateway/config.js +130 -0
- package/dist/src/gateway/config.js.map +1 -0
- package/dist/src/gateway/control.d.ts +308 -0
- package/dist/src/gateway/control.js +1573 -0
- package/dist/src/gateway/control.js.map +1 -0
- package/dist/src/gateway/dashboard-copy.d.ts +7 -0
- package/dist/src/gateway/dashboard-copy.en.d.ts +506 -0
- package/dist/src/gateway/dashboard-copy.en.js +507 -0
- package/dist/src/gateway/dashboard-copy.en.js.map +1 -0
- package/dist/src/gateway/dashboard-copy.js +516 -0
- package/dist/src/gateway/dashboard-copy.js.map +1 -0
- package/dist/src/gateway/dashboard-copy.zh-CN.d.ts +506 -0
- package/dist/src/gateway/dashboard-copy.zh-CN.js +507 -0
- package/dist/src/gateway/dashboard-copy.zh-CN.js.map +1 -0
- package/dist/src/gateway/dashboard-model.d.ts +207 -0
- package/dist/src/gateway/dashboard-model.js +720 -0
- package/dist/src/gateway/dashboard-model.js.map +1 -0
- package/dist/src/gateway/dashboard.d.ts +26 -0
- package/dist/src/gateway/dashboard.js +941 -0
- package/dist/src/gateway/dashboard.js.map +1 -0
- package/dist/src/gateway/delivery-machine.d.ts +235 -0
- package/dist/src/gateway/delivery-machine.js +540 -0
- package/dist/src/gateway/delivery-machine.js.map +1 -0
- package/dist/src/gateway/instance-lease.d.ts +21 -0
- package/dist/src/gateway/instance-lease.js +549 -0
- package/dist/src/gateway/instance-lease.js.map +1 -0
- package/dist/src/gateway/live-dashboard-app/app.js +2914 -0
- package/dist/src/gateway/live-dashboard-assets.d.ts +10 -0
- package/dist/src/gateway/live-dashboard-assets.js +73 -0
- package/dist/src/gateway/live-dashboard-assets.js.map +1 -0
- package/dist/src/gateway/live-dashboard-bootstrap.d.ts +36 -0
- package/dist/src/gateway/live-dashboard-bootstrap.js +176 -0
- package/dist/src/gateway/live-dashboard-bootstrap.js.map +1 -0
- package/dist/src/gateway/live-dashboard-command.d.ts +54 -0
- package/dist/src/gateway/live-dashboard-command.js +324 -0
- package/dist/src/gateway/live-dashboard-command.js.map +1 -0
- package/dist/src/gateway/live-dashboard-http.d.ts +41 -0
- package/dist/src/gateway/live-dashboard-http.js +445 -0
- package/dist/src/gateway/live-dashboard-http.js.map +1 -0
- package/dist/src/gateway/live-dashboard-protocol.d.ts +38 -0
- package/dist/src/gateway/live-dashboard-protocol.js +156 -0
- package/dist/src/gateway/live-dashboard-protocol.js.map +1 -0
- package/dist/src/gateway/live-dashboard-server.d.ts +33 -0
- package/dist/src/gateway/live-dashboard-server.js +130 -0
- package/dist/src/gateway/live-dashboard-server.js.map +1 -0
- package/dist/src/gateway/live-dashboard-stream.d.ts +46 -0
- package/dist/src/gateway/live-dashboard-stream.js +233 -0
- package/dist/src/gateway/live-dashboard-stream.js.map +1 -0
- package/dist/src/gateway/live-dashboard.d.ts +31 -0
- package/dist/src/gateway/live-dashboard.js +190 -0
- package/dist/src/gateway/live-dashboard.js.map +1 -0
- package/dist/src/gateway/locale.d.ts +4 -0
- package/dist/src/gateway/locale.js +10 -0
- package/dist/src/gateway/locale.js.map +1 -0
- package/dist/src/gateway/progress-watch-machine.d.ts +97 -0
- package/dist/src/gateway/progress-watch-machine.js +172 -0
- package/dist/src/gateway/progress-watch-machine.js.map +1 -0
- package/dist/src/gateway/providers.d.ts +287 -0
- package/dist/src/gateway/providers.js +2451 -0
- package/dist/src/gateway/providers.js.map +1 -0
- package/dist/src/gateway/server.d.ts +57 -0
- package/dist/src/gateway/server.js +264 -0
- package/dist/src/gateway/server.js.map +1 -0
- package/dist/src/gateway/service.d.ts +449 -0
- package/dist/src/gateway/service.js +4831 -0
- package/dist/src/gateway/service.js.map +1 -0
- package/dist/src/gateway/store.d.ts +340 -0
- package/dist/src/gateway/store.js +4047 -0
- package/dist/src/gateway/store.js.map +1 -0
- package/dist/src/gateway/types.d.ts +514 -0
- package/dist/src/gateway/types.js +414 -0
- package/dist/src/gateway/types.js.map +1 -0
- package/dist/src/mutex.d.ts +4 -0
- package/dist/src/mutex.js +23 -0
- package/dist/src/mutex.js.map +1 -0
- package/docs/DESIGN.md +134 -0
- package/docs/GATEWAY-ARCHITECTURE.md +858 -0
- package/package.json +80 -0
- package/skills/embassy-peer/SKILL.md +198 -0
- package/skills/embassy-peer/agents/openai.yaml +4 -0
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import type { ProgressWatchJournalEvent, ProgressWatchMachine } from "./progress-watch-machine.js";
|
|
2
|
+
import type { CompatibilityAttestation } from "./compatibility.js";
|
|
3
|
+
export declare const gatewayProviders: readonly ["codex", "claude"];
|
|
4
|
+
export type GatewayProvider = (typeof gatewayProviders)[number];
|
|
5
|
+
export declare const gatewayInboundModes: readonly ["paired", "open"];
|
|
6
|
+
export type GatewayInboundMode = (typeof gatewayInboundModes)[number];
|
|
7
|
+
export declare const connectorHealthStates: readonly ["offline", "connecting", "healthy", "degraded", "incompatible"];
|
|
8
|
+
export type ConnectorHealth = (typeof connectorHealthStates)[number];
|
|
9
|
+
export declare const compatibilityStates: readonly ["unknown", "compatible", "incompatible", "expired"];
|
|
10
|
+
export type CompatibilityState = (typeof compatibilityStates)[number];
|
|
11
|
+
export declare const routeStates: readonly ["stale", "idle", "busy", "awaiting_approval", "offline", "incompatible", "disabled"];
|
|
12
|
+
export type RouteState = (typeof routeStates)[number];
|
|
13
|
+
export declare const routeRegistrationModes: readonly ["explicit_opt_in", "selected_live_peer"];
|
|
14
|
+
export type RouteRegistrationMode = (typeof routeRegistrationModes)[number];
|
|
15
|
+
export declare const messageDirections: readonly ["codex_to_claude", "claude_to_codex"];
|
|
16
|
+
export type MessageDirection = (typeof messageDirections)[number];
|
|
17
|
+
export declare const deliveryStates: readonly ["queued", "duplicate", "dispatching", "transport_written", "held", "delivered", "unconfirmed", "failed", "ambiguous", "expired", "cancelled", "abandoned", "rejected"];
|
|
18
|
+
export type DeliveryState = (typeof deliveryStates)[number];
|
|
19
|
+
export declare const terminalDeliveryStates: Set<"expired" | "queued" | "duplicate" | "dispatching" | "transport_written" | "held" | "delivered" | "unconfirmed" | "failed" | "ambiguous" | "cancelled" | "abandoned" | "rejected">;
|
|
20
|
+
export declare const alertSeverities: readonly ["info", "warning", "error"];
|
|
21
|
+
export type AlertSeverity = (typeof alertSeverities)[number];
|
|
22
|
+
export type BusyPolicy = "queue";
|
|
23
|
+
/** Canonical closed-array bounds shared by store projections and control/UI. */
|
|
24
|
+
export declare const gatewayPublicSnapshotLimits: Readonly<{
|
|
25
|
+
readonly connectors: 64;
|
|
26
|
+
readonly compatibilityChecks: 2;
|
|
27
|
+
readonly availablePeers: 256;
|
|
28
|
+
readonly routes: 256;
|
|
29
|
+
readonly pairs: 256;
|
|
30
|
+
readonly progressWatches: 64;
|
|
31
|
+
readonly progressWatchEvents: 256;
|
|
32
|
+
readonly activityEvents: 256;
|
|
33
|
+
readonly messages: 1024;
|
|
34
|
+
readonly alerts: 256;
|
|
35
|
+
}>;
|
|
36
|
+
/** Leaves headroom for the private control protocol response envelope. */
|
|
37
|
+
export declare const GATEWAY_PUBLIC_SNAPSHOT_BYTE_BUDGET: number;
|
|
38
|
+
/**
|
|
39
|
+
* Private connector identity. Values in this structure are permitted only in
|
|
40
|
+
* controller-owned state and connector calls. They must never be copied into
|
|
41
|
+
* public snapshots, normalized events, logs, or error messages.
|
|
42
|
+
*/
|
|
43
|
+
export type PrivateEndpointIdentity = {
|
|
44
|
+
provider: GatewayProvider;
|
|
45
|
+
hostId: string;
|
|
46
|
+
endpointGeneration: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Private, immutable target binding. routeHandle may be a native provider
|
|
50
|
+
* thread/session identifier; ownerLease proves which registration owns it.
|
|
51
|
+
*/
|
|
52
|
+
export type PrivateRouteBinding = PrivateEndpointIdentity & {
|
|
53
|
+
routeHandle: string;
|
|
54
|
+
ownerLease: string;
|
|
55
|
+
};
|
|
56
|
+
export type RouteCounters = {
|
|
57
|
+
accepted: number;
|
|
58
|
+
delivered: number;
|
|
59
|
+
unconfirmed: number;
|
|
60
|
+
failed: number;
|
|
61
|
+
ambiguous: number;
|
|
62
|
+
expired: number;
|
|
63
|
+
cancelled: number;
|
|
64
|
+
abandoned: number;
|
|
65
|
+
rejected: number;
|
|
66
|
+
bytesAccepted: number;
|
|
67
|
+
};
|
|
68
|
+
export type GatewayRouteRecord = {
|
|
69
|
+
alias: string;
|
|
70
|
+
binding: PrivateRouteBinding;
|
|
71
|
+
registrationMode: RouteRegistrationMode;
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
state: RouteState;
|
|
74
|
+
compatibility: CompatibilityState;
|
|
75
|
+
busyPolicy: BusyPolicy;
|
|
76
|
+
registeredAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
lastSeenAt?: string;
|
|
79
|
+
queueDepth: number;
|
|
80
|
+
counters: RouteCounters;
|
|
81
|
+
safeErrorCode?: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Durable bidirectional consent between two exact route owners. Aliases are
|
|
85
|
+
* display coordinates; the private leases prevent an alias from silently
|
|
86
|
+
* retargeting an existing permission edge.
|
|
87
|
+
*/
|
|
88
|
+
export type GatewayPairRecord = {
|
|
89
|
+
claudeAlias: string;
|
|
90
|
+
codexAlias: string;
|
|
91
|
+
claudeOwnerLease: string;
|
|
92
|
+
codexOwnerLease: string;
|
|
93
|
+
createdAt: string;
|
|
94
|
+
updatedAt: string;
|
|
95
|
+
counters: RouteCounters;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Controller-internal route view used to prove ownership across a restart.
|
|
99
|
+
* This type must never cross the control protocol or enter a public snapshot.
|
|
100
|
+
*/
|
|
101
|
+
export type GatewayPrivateRouteInspection = {
|
|
102
|
+
alias: string;
|
|
103
|
+
binding: PrivateRouteBinding;
|
|
104
|
+
registrationMode: RouteRegistrationMode;
|
|
105
|
+
enabled: boolean;
|
|
106
|
+
state: RouteState;
|
|
107
|
+
compatibility: CompatibilityState;
|
|
108
|
+
safeErrorCode?: string;
|
|
109
|
+
};
|
|
110
|
+
export type ConnectorRecord = {
|
|
111
|
+
provider: GatewayProvider;
|
|
112
|
+
hostId: string;
|
|
113
|
+
endpointGeneration: string;
|
|
114
|
+
health: ConnectorHealth;
|
|
115
|
+
compatibility: CompatibilityState;
|
|
116
|
+
protocol: string;
|
|
117
|
+
protocolVersion: string;
|
|
118
|
+
updatedAt: string;
|
|
119
|
+
lastSeenAt?: string;
|
|
120
|
+
safeErrorCode?: string;
|
|
121
|
+
};
|
|
122
|
+
/** Metadata persisted for a queued message. Message bodies are never here. */
|
|
123
|
+
export type QueuedMessageMetadata = {
|
|
124
|
+
messageId: string;
|
|
125
|
+
messageIdSuffix: string;
|
|
126
|
+
/** Bounded public correlation only; the full conversation capability stays private. */
|
|
127
|
+
conversationIdSuffix?: string;
|
|
128
|
+
direction: MessageDirection;
|
|
129
|
+
sourceAlias: string;
|
|
130
|
+
targetAlias: string;
|
|
131
|
+
enqueuedAt: string;
|
|
132
|
+
deadlineAt: string;
|
|
133
|
+
bytes: number;
|
|
134
|
+
hopCount: number;
|
|
135
|
+
/** This message was admitted by the exact durable consent edge. */
|
|
136
|
+
pair?: true;
|
|
137
|
+
/** Exact Claude-to-Codex `STEER:` classification; absence means ordinary. */
|
|
138
|
+
steer?: true;
|
|
139
|
+
};
|
|
140
|
+
/** A transient dispatch value. Its body must remain in process memory. */
|
|
141
|
+
export type TransientQueuedMessage = QueuedMessageMetadata & {
|
|
142
|
+
body: string;
|
|
143
|
+
};
|
|
144
|
+
export type InFlightMessageMetadata = QueuedMessageMetadata & {
|
|
145
|
+
dispatchedAt: string;
|
|
146
|
+
};
|
|
147
|
+
export type DedupeRecord = {
|
|
148
|
+
fingerprint: string;
|
|
149
|
+
messageIdSuffix: string;
|
|
150
|
+
conversationIdSuffix?: string;
|
|
151
|
+
sourceAlias: string;
|
|
152
|
+
targetAlias: string;
|
|
153
|
+
direction: MessageDirection;
|
|
154
|
+
pair?: true;
|
|
155
|
+
firstSeenAt: string;
|
|
156
|
+
expiresAt: string;
|
|
157
|
+
};
|
|
158
|
+
export type RateBucket = {
|
|
159
|
+
sourceAlias: string;
|
|
160
|
+
windowStartedAt: string;
|
|
161
|
+
count: number;
|
|
162
|
+
};
|
|
163
|
+
export type NormalizedMessageEvent = {
|
|
164
|
+
sequence: number;
|
|
165
|
+
timestamp: string;
|
|
166
|
+
messageIdSuffix: string;
|
|
167
|
+
conversationIdSuffix?: string;
|
|
168
|
+
direction: MessageDirection;
|
|
169
|
+
sourceAlias: string;
|
|
170
|
+
targetAlias: string;
|
|
171
|
+
state: DeliveryState;
|
|
172
|
+
bytes: number;
|
|
173
|
+
hopCount: number;
|
|
174
|
+
steer?: true;
|
|
175
|
+
latencyMs?: number;
|
|
176
|
+
safeErrorCode?: string;
|
|
177
|
+
};
|
|
178
|
+
export type GatewayAccounting = {
|
|
179
|
+
accepted: number;
|
|
180
|
+
duplicates: number;
|
|
181
|
+
delivered: number;
|
|
182
|
+
unconfirmed: number;
|
|
183
|
+
failed: number;
|
|
184
|
+
ambiguous: number;
|
|
185
|
+
expired: number;
|
|
186
|
+
cancelled: number;
|
|
187
|
+
abandoned: number;
|
|
188
|
+
rejected: number;
|
|
189
|
+
bytesAccepted: number;
|
|
190
|
+
queuedBytes: number;
|
|
191
|
+
};
|
|
192
|
+
export type GatewayPersistedState = {
|
|
193
|
+
schemaVersion: 1;
|
|
194
|
+
createdAt: string;
|
|
195
|
+
updatedAt: string;
|
|
196
|
+
eventSequence: number;
|
|
197
|
+
routes: GatewayRouteRecord[];
|
|
198
|
+
pairs: GatewayPairRecord[];
|
|
199
|
+
connectors: ConnectorRecord[];
|
|
200
|
+
queue: QueuedMessageMetadata[];
|
|
201
|
+
inFlight: InFlightMessageMetadata[];
|
|
202
|
+
events: NormalizedMessageEvent[];
|
|
203
|
+
dedupe: DedupeRecord[];
|
|
204
|
+
rateBuckets: RateBucket[];
|
|
205
|
+
accounting: GatewayAccounting;
|
|
206
|
+
watchSequence: number;
|
|
207
|
+
progressWatches: ProgressWatchMachine[];
|
|
208
|
+
progressWatchEvents: ProgressWatchJournalEvent[];
|
|
209
|
+
/** Bounded, body-free probe evidence keyed by provider surface and version. */
|
|
210
|
+
compatibilityAttestations: CompatibilityAttestation[];
|
|
211
|
+
/** Strictly validated internal restart journal; never publicly projected. */
|
|
212
|
+
codexSuccession?: unknown;
|
|
213
|
+
};
|
|
214
|
+
export type PublicRouteSnapshot = {
|
|
215
|
+
alias: string;
|
|
216
|
+
provider: GatewayProvider;
|
|
217
|
+
host: string;
|
|
218
|
+
enabled: boolean;
|
|
219
|
+
state: RouteState;
|
|
220
|
+
compatibility: CompatibilityState;
|
|
221
|
+
busyPolicy: BusyPolicy;
|
|
222
|
+
lastSeenAt?: string;
|
|
223
|
+
queueDepth: number;
|
|
224
|
+
/** Earliest enqueue time for this route's current queue, if non-empty. */
|
|
225
|
+
oldestQueuedAt?: string;
|
|
226
|
+
counters: RouteCounters;
|
|
227
|
+
safeErrorCode?: string;
|
|
228
|
+
};
|
|
229
|
+
/** Metadata-only public consent edge. Private route authority is omitted. */
|
|
230
|
+
export type PublicPairSnapshot = {
|
|
231
|
+
claudeAlias: string;
|
|
232
|
+
codexAlias: string;
|
|
233
|
+
host: string;
|
|
234
|
+
counters: RouteCounters;
|
|
235
|
+
};
|
|
236
|
+
export type PublicConnectorSnapshot = {
|
|
237
|
+
provider: GatewayProvider;
|
|
238
|
+
host: string;
|
|
239
|
+
health: ConnectorHealth;
|
|
240
|
+
compatibility: CompatibilityState;
|
|
241
|
+
protocol: string;
|
|
242
|
+
protocolVersion: string;
|
|
243
|
+
lastSeenAt?: string;
|
|
244
|
+
safeErrorCode?: string;
|
|
245
|
+
};
|
|
246
|
+
export declare const publicAvailablePeerStates: readonly ["idle", "busy", "awaiting_approval", "offline", "incompatible"];
|
|
247
|
+
export type PublicAvailablePeerState = (typeof publicAvailablePeerStates)[number];
|
|
248
|
+
/**
|
|
249
|
+
* A transient, metadata-only discovery row. Native provider IDs, process
|
|
250
|
+
* identifiers, registry/socket paths, and generations are deliberately absent.
|
|
251
|
+
* Version 1 uses this for genuine Claude peers; Codex inventory remains the
|
|
252
|
+
* explicit PublicRouteSnapshot list.
|
|
253
|
+
*/
|
|
254
|
+
export type PublicAvailablePeerSnapshot = {
|
|
255
|
+
alias: string;
|
|
256
|
+
provider: GatewayProvider;
|
|
257
|
+
host: string;
|
|
258
|
+
state: PublicAvailablePeerState;
|
|
259
|
+
compatibility: CompatibilityState;
|
|
260
|
+
/** True only when this row passed the provider's strict selectable-peer checks. */
|
|
261
|
+
validated: boolean;
|
|
262
|
+
selected: boolean;
|
|
263
|
+
lastSeenAt?: string;
|
|
264
|
+
safeErrorCode?: string;
|
|
265
|
+
};
|
|
266
|
+
export declare const gatewayActivityKinds: readonly ["discovery", "selection", "registration", "pairing", "watch"];
|
|
267
|
+
export type GatewayActivityKind = (typeof gatewayActivityKinds)[number];
|
|
268
|
+
export declare const gatewayActivityActions: readonly ["discovery_refreshed", "claude_selected", "claude_unselected", "codex_registered", "codex_succeeded", "codex_unregistered", "routes_paired", "routes_unpaired", "watch_ended"];
|
|
269
|
+
export type GatewayActivityAction = (typeof gatewayActivityActions)[number];
|
|
270
|
+
/** Bounded, body-free operator activity retained for this broker process. */
|
|
271
|
+
export type PublicGatewayActivityEvent = {
|
|
272
|
+
sequence: number;
|
|
273
|
+
timestamp: string;
|
|
274
|
+
kind: GatewayActivityKind;
|
|
275
|
+
action: GatewayActivityAction;
|
|
276
|
+
outcome: "accepted" | "rejected";
|
|
277
|
+
aliases: string[];
|
|
278
|
+
operatorAction: true;
|
|
279
|
+
safeErrorCode?: string;
|
|
280
|
+
};
|
|
281
|
+
export declare const deadlinePressureBucketNames: readonly ["under_1m", "1m_to_5m", "5m_to_15m", "15m_to_60m", "over_60m"];
|
|
282
|
+
export type DeadlinePressureBucketName = (typeof deadlinePressureBucketNames)[number];
|
|
283
|
+
export type DeadlinePressureBucket = {
|
|
284
|
+
bucket: DeadlinePressureBucketName;
|
|
285
|
+
settled: number;
|
|
286
|
+
expired: number;
|
|
287
|
+
};
|
|
288
|
+
/** Counts are computed only from the bounded retained delivery ledger. */
|
|
289
|
+
export type DeadlinePressureSnapshot = {
|
|
290
|
+
configuredDeadlineMs: number;
|
|
291
|
+
retainedSince?: string;
|
|
292
|
+
terminalEvents: number;
|
|
293
|
+
expiredEvents: number;
|
|
294
|
+
buckets: DeadlinePressureBucket[];
|
|
295
|
+
};
|
|
296
|
+
/** Strict closed-schema guard for runtime-supplied transient inventory rows. */
|
|
297
|
+
export declare function isPublicAvailablePeerSnapshot(value: unknown): value is PublicAvailablePeerSnapshot;
|
|
298
|
+
export declare function arePublicAvailablePeerSnapshots(value: unknown, maximumRows?: number): value is PublicAvailablePeerSnapshot[];
|
|
299
|
+
export type SafeGatewayAlert = {
|
|
300
|
+
code: string;
|
|
301
|
+
severity: AlertSeverity;
|
|
302
|
+
timestamp: string;
|
|
303
|
+
provider?: GatewayProvider;
|
|
304
|
+
host?: string;
|
|
305
|
+
alias?: string;
|
|
306
|
+
};
|
|
307
|
+
export type PublicProgressWatchSnapshot = {
|
|
308
|
+
conversationIdSuffix: string;
|
|
309
|
+
ownerAlias: string;
|
|
310
|
+
workerAlias: string;
|
|
311
|
+
phase: "quiet" | "episode";
|
|
312
|
+
capability: "conversation" | "route";
|
|
313
|
+
lastActivityAt: string;
|
|
314
|
+
nextActionAt: string;
|
|
315
|
+
idleMs: number;
|
|
316
|
+
nudgeCount: 0 | 1 | 2;
|
|
317
|
+
workerReportedComplete: boolean;
|
|
318
|
+
};
|
|
319
|
+
export type PublicProgressWatchEventSnapshot = {
|
|
320
|
+
sequence: number;
|
|
321
|
+
timestamp: string;
|
|
322
|
+
conversationIdSuffix: string;
|
|
323
|
+
ownerAlias: string;
|
|
324
|
+
workerAlias: string;
|
|
325
|
+
kind: "opened" | "nudge" | "worker_reported_complete" | "capability_degraded" | "done" | "unresponsive" | "endpoint_retired" | "disabled";
|
|
326
|
+
nudgeNumber?: 1 | 2;
|
|
327
|
+
};
|
|
328
|
+
export type GatewayPublicSnapshot = {
|
|
329
|
+
schemaVersion: 1;
|
|
330
|
+
generatedAt: string;
|
|
331
|
+
/** Launch-time Claude-to-Codex consent policy; paired is the safe default. */
|
|
332
|
+
inboundMode: GatewayInboundMode;
|
|
333
|
+
health: ConnectorHealth;
|
|
334
|
+
connectors: PublicConnectorSnapshot[];
|
|
335
|
+
compatibilityChecks?: CompatibilityAttestation[];
|
|
336
|
+
availablePeers: PublicAvailablePeerSnapshot[];
|
|
337
|
+
routes: PublicRouteSnapshot[];
|
|
338
|
+
pairs: PublicPairSnapshot[];
|
|
339
|
+
progressWatches?: PublicProgressWatchSnapshot[];
|
|
340
|
+
progressWatchEvents?: PublicProgressWatchEventSnapshot[];
|
|
341
|
+
activityEvents?: PublicGatewayActivityEvent[];
|
|
342
|
+
deadlinePressure?: DeadlinePressureSnapshot;
|
|
343
|
+
messages: NormalizedMessageEvent[];
|
|
344
|
+
accounting: GatewayAccounting;
|
|
345
|
+
alerts: SafeGatewayAlert[];
|
|
346
|
+
truncation: GatewaySnapshotTruncation;
|
|
347
|
+
};
|
|
348
|
+
export type GatewaySnapshotTruncation = {
|
|
349
|
+
connectors: number;
|
|
350
|
+
compatibilityChecks?: number;
|
|
351
|
+
availablePeers: number;
|
|
352
|
+
routes: number;
|
|
353
|
+
pairs: number;
|
|
354
|
+
progressWatches?: number;
|
|
355
|
+
progressWatchEvents?: number;
|
|
356
|
+
activityEvents?: number;
|
|
357
|
+
messages: number;
|
|
358
|
+
alerts: number;
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* Deterministically projects a canonical snapshot under the local control
|
|
362
|
+
* byte budget. Content is never shortened: complete metadata rows are either
|
|
363
|
+
* retained or counted as omitted. Connector/selected-route inventory is the
|
|
364
|
+
* last category removed.
|
|
365
|
+
*/
|
|
366
|
+
export declare function projectGatewayPublicSnapshot(snapshot: GatewayPublicSnapshot, maximumBytes?: number): GatewayPublicSnapshot;
|
|
367
|
+
export type RegisterRouteInput = {
|
|
368
|
+
alias: string;
|
|
369
|
+
binding: PrivateRouteBinding;
|
|
370
|
+
registrationMode: RouteRegistrationMode;
|
|
371
|
+
state?: "idle" | "busy" | "awaiting_approval";
|
|
372
|
+
compatibility?: "compatible";
|
|
373
|
+
};
|
|
374
|
+
export type ObserveConnectorInput = {
|
|
375
|
+
identity: PrivateEndpointIdentity;
|
|
376
|
+
health: Exclude<ConnectorHealth, "offline">;
|
|
377
|
+
compatibility: CompatibilityState;
|
|
378
|
+
protocol: string;
|
|
379
|
+
protocolVersion: string;
|
|
380
|
+
safeErrorCode?: string;
|
|
381
|
+
};
|
|
382
|
+
export type ObserveRouteInput = {
|
|
383
|
+
binding: PrivateRouteBinding;
|
|
384
|
+
state: "idle" | "busy" | "awaiting_approval";
|
|
385
|
+
compatibility: "compatible";
|
|
386
|
+
safeErrorCode?: string;
|
|
387
|
+
} | {
|
|
388
|
+
binding: PrivateRouteBinding;
|
|
389
|
+
state: "stale";
|
|
390
|
+
compatibility: "expired";
|
|
391
|
+
safeErrorCode: string;
|
|
392
|
+
};
|
|
393
|
+
export type RebindStaleRouteInput = {
|
|
394
|
+
/** The currently persisted alias. */
|
|
395
|
+
alias: string;
|
|
396
|
+
/** The provider's latest live display name for the same logical route. */
|
|
397
|
+
newAlias?: string;
|
|
398
|
+
currentOwnerLease: string;
|
|
399
|
+
newBinding: PrivateRouteBinding;
|
|
400
|
+
reason: "endpoint_reobserved" | "peer_explicitly_reselected" | "peer_identity_reobserved";
|
|
401
|
+
state?: "idle" | "busy" | "awaiting_approval";
|
|
402
|
+
};
|
|
403
|
+
export type EnqueueMessageInput = {
|
|
404
|
+
sourceAlias: string;
|
|
405
|
+
targetAlias: string;
|
|
406
|
+
body: string;
|
|
407
|
+
dedupeKey: string;
|
|
408
|
+
/** Last eight opaque characters of the controller-owned conversation ID. */
|
|
409
|
+
conversationIdSuffix?: string;
|
|
410
|
+
deadlineAt?: string;
|
|
411
|
+
hopCount?: number;
|
|
412
|
+
steer?: true;
|
|
413
|
+
/**
|
|
414
|
+
* Controller-derived watch intent committed in the same mutation as the
|
|
415
|
+
* accepted message. Bodies and command flags are never persisted here.
|
|
416
|
+
*/
|
|
417
|
+
progressWatch?: {
|
|
418
|
+
conversationId: string;
|
|
419
|
+
actorAlias: string;
|
|
420
|
+
openIdleMs?: number;
|
|
421
|
+
completionSignal?: true;
|
|
422
|
+
};
|
|
423
|
+
/** Controller-authored nudge committed atomically with its queued body. */
|
|
424
|
+
progressWatchNudge?: {
|
|
425
|
+
conversationId: string;
|
|
426
|
+
nudgeNumber: 1 | 2;
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
/**
|
|
430
|
+
* Controller-internal proof of one currently observed native Claude peer.
|
|
431
|
+
* The binding may contain a native session identifier and must remain an
|
|
432
|
+
* in-memory call argument. Store metadata retains only the public alias.
|
|
433
|
+
*/
|
|
434
|
+
export type TransientNativeClaudePeer = {
|
|
435
|
+
alias: string;
|
|
436
|
+
binding: PrivateRouteBinding;
|
|
437
|
+
};
|
|
438
|
+
export type EnqueueNativeIngressInput = Omit<EnqueueMessageInput, "sourceAlias" | "targetAlias"> & {
|
|
439
|
+
source: TransientNativeClaudePeer;
|
|
440
|
+
targetAlias: string;
|
|
441
|
+
/** Pre-deadline reply evidence retained across exact pair teardown. */
|
|
442
|
+
authorizedPairTeardownReply?: true;
|
|
443
|
+
};
|
|
444
|
+
export type EnqueueNativeReplyInput = Omit<EnqueueMessageInput, "sourceAlias" | "targetAlias"> & {
|
|
445
|
+
sourceAlias: string;
|
|
446
|
+
target: TransientNativeClaudePeer;
|
|
447
|
+
/** Retain the original paired admission authority, when one existed. */
|
|
448
|
+
pair?: true;
|
|
449
|
+
};
|
|
450
|
+
export type EnqueueMessageResult = {
|
|
451
|
+
accepted: boolean;
|
|
452
|
+
duplicate: boolean;
|
|
453
|
+
messageId?: string;
|
|
454
|
+
messageIdSuffix: string;
|
|
455
|
+
/** The accepted message is owned by one exact consent edge. */
|
|
456
|
+
pair?: true;
|
|
457
|
+
/** Exact older queued steer displaced by the per-edge cap, if any. */
|
|
458
|
+
supersededSettlement?: TerminalMessageSettlement;
|
|
459
|
+
};
|
|
460
|
+
export type InFlightMessageProgressState = Extract<DeliveryState, "transport_written" | "held">;
|
|
461
|
+
export type SettleMessageInput = {
|
|
462
|
+
messageId: string;
|
|
463
|
+
state: Extract<DeliveryState, "delivered" | "unconfirmed" | "failed" | "ambiguous" | "expired" | "cancelled">;
|
|
464
|
+
safeErrorCode?: string;
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* Controller-internal proof that one message won its terminal-state race.
|
|
468
|
+
* Full message IDs are required only for in-memory service correlation; this
|
|
469
|
+
* structure must never enter a public snapshot or persisted event.
|
|
470
|
+
*/
|
|
471
|
+
export type TerminalMessageSettlement = {
|
|
472
|
+
messageId: string;
|
|
473
|
+
state: Extract<DeliveryState, "delivered" | "unconfirmed" | "failed" | "ambiguous" | "expired" | "cancelled" | "abandoned">;
|
|
474
|
+
safeErrorCode?: string;
|
|
475
|
+
};
|
|
476
|
+
export type SettleMessageResult = {
|
|
477
|
+
status: "settled";
|
|
478
|
+
settlement: TerminalMessageSettlement;
|
|
479
|
+
} | {
|
|
480
|
+
status: "not_in_flight";
|
|
481
|
+
};
|
|
482
|
+
export type RequeueInFlightMessageResult = {
|
|
483
|
+
status: "requeued";
|
|
484
|
+
} | {
|
|
485
|
+
status: "settled";
|
|
486
|
+
settlement: TerminalMessageSettlement;
|
|
487
|
+
} | {
|
|
488
|
+
status: "not_in_flight";
|
|
489
|
+
};
|
|
490
|
+
export type GatewayStoreLimits = {
|
|
491
|
+
maxRoutes: number;
|
|
492
|
+
maxPairs: number;
|
|
493
|
+
/** Omitted injected-test configs use the production default of 32. */
|
|
494
|
+
maxWatches?: number;
|
|
495
|
+
eventCapacity: number;
|
|
496
|
+
eventTtlMs: number;
|
|
497
|
+
dedupeCapacity: number;
|
|
498
|
+
dedupeTtlMs: number;
|
|
499
|
+
maxQueueMessages: number;
|
|
500
|
+
maxQueueMessagesPerRoute: number;
|
|
501
|
+
maxInFlightMessages: number;
|
|
502
|
+
maxQueueBytes: number;
|
|
503
|
+
maxMessageBytes: number;
|
|
504
|
+
messageDeadlineMs: number;
|
|
505
|
+
maxHopCount: number;
|
|
506
|
+
rateLimitPerRoute: number;
|
|
507
|
+
rateWindowMs: number;
|
|
508
|
+
};
|
|
509
|
+
export type GatewayStoreDependencies = {
|
|
510
|
+
now?: () => Date;
|
|
511
|
+
randomId?: () => string;
|
|
512
|
+
/** Deterministic durability-fault seam; production callers leave this unset. */
|
|
513
|
+
afterStateFileRename?: () => void | Promise<void>;
|
|
514
|
+
};
|