agent-embassy 3.1.0 → 4.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.
Files changed (112) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/CONTRIBUTING.md +92 -202
  3. package/README.md +157 -155
  4. package/SECURITY.md +191 -348
  5. package/dist/src/gateway/broker-check.d.ts +26 -0
  6. package/dist/src/gateway/broker-check.js +89 -0
  7. package/dist/src/gateway/broker-check.js.map +1 -0
  8. package/dist/src/gateway/broker-control.d.ts +72 -0
  9. package/dist/src/gateway/broker-control.js +164 -0
  10. package/dist/src/gateway/broker-control.js.map +1 -0
  11. package/dist/src/gateway/broker.d.ts +117 -0
  12. package/dist/src/gateway/broker.js +186 -0
  13. package/dist/src/gateway/broker.js.map +1 -0
  14. package/dist/src/gateway/claude-peer.d.ts +1 -124
  15. package/dist/src/gateway/claude-peer.js +61 -1052
  16. package/dist/src/gateway/claude-peer.js.map +1 -1
  17. package/dist/src/gateway/codex-stateless-transport.d.ts +0 -12
  18. package/dist/src/gateway/codex-stateless-transport.js +8 -142
  19. package/dist/src/gateway/codex-stateless-transport.js.map +1 -1
  20. package/dist/src/gateway/config.d.ts +2 -6
  21. package/dist/src/gateway/config.js +17 -27
  22. package/dist/src/gateway/config.js.map +1 -1
  23. package/dist/src/gateway/coordinator.d.ts +57 -0
  24. package/dist/src/gateway/coordinator.js +217 -0
  25. package/dist/src/gateway/coordinator.js.map +1 -0
  26. package/dist/src/gateway/core-cli.d.ts +15 -0
  27. package/dist/src/gateway/core-cli.js +282 -0
  28. package/dist/src/gateway/core-cli.js.map +1 -0
  29. package/dist/src/gateway/core-service-command.d.ts +16 -0
  30. package/dist/src/gateway/core-service-command.js +71 -0
  31. package/dist/src/gateway/core-service-command.js.map +1 -0
  32. package/dist/src/gateway/endpoint-directory.d.ts +33 -0
  33. package/dist/src/gateway/endpoint-directory.js +223 -0
  34. package/dist/src/gateway/endpoint-directory.js.map +1 -0
  35. package/dist/src/gateway/federation.d.ts +89 -0
  36. package/dist/src/gateway/federation.js +632 -0
  37. package/dist/src/gateway/federation.js.map +1 -0
  38. package/dist/src/gateway/ledger-codec.d.ts +3 -0
  39. package/dist/src/gateway/ledger-codec.js +159 -0
  40. package/dist/src/gateway/ledger-codec.js.map +1 -0
  41. package/dist/src/gateway/ledger.d.ts +138 -0
  42. package/dist/src/gateway/ledger.js +319 -0
  43. package/dist/src/gateway/ledger.js.map +1 -0
  44. package/dist/src/gateway/local-control.d.ts +23 -0
  45. package/dist/src/gateway/local-control.js +489 -0
  46. package/dist/src/gateway/local-control.js.map +1 -0
  47. package/dist/src/gateway/native-destinations.d.ts +34 -0
  48. package/dist/src/gateway/native-destinations.js +272 -0
  49. package/dist/src/gateway/native-destinations.js.map +1 -0
  50. package/dist/src/gateway/owned-state.d.ts +57 -0
  51. package/dist/src/gateway/owned-state.js +398 -0
  52. package/dist/src/gateway/owned-state.js.map +1 -0
  53. package/dist/src/gateway/provenance-envelope.d.ts +3 -3
  54. package/dist/src/gateway/provenance-envelope.js +3 -23
  55. package/dist/src/gateway/provenance-envelope.js.map +1 -1
  56. package/dist/src/gateway/runtime.d.ts +41 -0
  57. package/dist/src/gateway/runtime.js +175 -0
  58. package/dist/src/gateway/runtime.js.map +1 -0
  59. package/docs/CONFIGURATION.md +178 -266
  60. package/docs/DELIVERY.md +133 -82
  61. package/docs/GATEWAY-ARCHITECTURE.md +276 -949
  62. package/package.json +5 -5
  63. package/skills/embassy-peer/SKILL.md +38 -196
  64. package/skills/embassy-peer/agents/openai.yaml +2 -2
  65. package/dist/src/gateway/claude-helper-protocol.d.ts +0 -117
  66. package/dist/src/gateway/claude-helper-protocol.js +0 -122
  67. package/dist/src/gateway/claude-helper-protocol.js.map +0 -1
  68. package/dist/src/gateway/claude-helper-supervisor.d.ts +0 -87
  69. package/dist/src/gateway/claude-helper-supervisor.js +0 -374
  70. package/dist/src/gateway/claude-helper-supervisor.js.map +0 -1
  71. package/dist/src/gateway/claude-helper.d.ts +0 -1
  72. package/dist/src/gateway/claude-helper.js +0 -252
  73. package/dist/src/gateway/claude-helper.js.map +0 -1
  74. package/dist/src/gateway/cli.d.ts +0 -56
  75. package/dist/src/gateway/cli.js +0 -1532
  76. package/dist/src/gateway/cli.js.map +0 -1
  77. package/dist/src/gateway/codex-socket-holder.d.ts +0 -26
  78. package/dist/src/gateway/codex-socket-holder.js +0 -76
  79. package/dist/src/gateway/codex-socket-holder.js.map +0 -1
  80. package/dist/src/gateway/control.d.ts +0 -279
  81. package/dist/src/gateway/control.js +0 -933
  82. package/dist/src/gateway/control.js.map +0 -1
  83. package/dist/src/gateway/peer-client.d.ts +0 -58
  84. package/dist/src/gateway/peer-client.js +0 -217
  85. package/dist/src/gateway/peer-client.js.map +0 -1
  86. package/dist/src/gateway/peer-mailbox.d.ts +0 -78
  87. package/dist/src/gateway/peer-mailbox.js +0 -168
  88. package/dist/src/gateway/peer-mailbox.js.map +0 -1
  89. package/dist/src/gateway/peer-protocol.d.ts +0 -110
  90. package/dist/src/gateway/peer-protocol.js +0 -79
  91. package/dist/src/gateway/peer-protocol.js.map +0 -1
  92. package/dist/src/gateway/peer-stdio.d.ts +0 -23
  93. package/dist/src/gateway/peer-stdio.js +0 -100
  94. package/dist/src/gateway/peer-stdio.js.map +0 -1
  95. package/dist/src/gateway/providers.d.ts +0 -164
  96. package/dist/src/gateway/providers.js +0 -975
  97. package/dist/src/gateway/providers.js.map +0 -1
  98. package/dist/src/gateway/server.d.ts +0 -46
  99. package/dist/src/gateway/server.js +0 -216
  100. package/dist/src/gateway/server.js.map +0 -1
  101. package/dist/src/gateway/service.d.ts +0 -371
  102. package/dist/src/gateway/service.js +0 -2335
  103. package/dist/src/gateway/service.js.map +0 -1
  104. package/dist/src/gateway/status-view.d.ts +0 -119
  105. package/dist/src/gateway/status-view.js +0 -484
  106. package/dist/src/gateway/status-view.js.map +0 -1
  107. package/dist/src/gateway/store.d.ts +0 -188
  108. package/dist/src/gateway/store.js +0 -2360
  109. package/dist/src/gateway/store.js.map +0 -1
  110. package/dist/src/gateway/types.d.ts +0 -541
  111. package/dist/src/gateway/types.js +0 -332
  112. package/dist/src/gateway/types.js.map +0 -1
@@ -1,164 +0,0 @@
1
- import { type GatewayNodeInventory } from "./federation-nodes.js";
2
- import { ClaudePeerAdapter, type ClaudePeerInboundProgress } from "./claude-peer.js";
3
- import type { AttestedClaudePeerRuntime } from "./claude-runtime.js";
4
- import type { StatelessCodexOperationTransport } from "./codex-stateless-transport.js";
5
- import type { GatewayDeliveryNoticeMode } from "./config.js";
6
- import type { ClaudeNativeHelperFactory } from "./claude-helper-supervisor.js";
7
- import type { GatewayAdapterCallbacks, GatewayAdapterDiscoverySnapshot, GatewayAdapterDispatchResult, GatewayAdapterDispatchInput, GatewayAdapterRouteState, GatewayAdapterRegistryObservation, GatewayAdapterStart, GatewayProviderAdapter } from "./service.js";
8
- import type { GatewayProvider } from "./types.js";
9
- export declare const CLAUDE_CLEAN_PREWRITE_RETRY_CODES: Set<string>;
10
- type ClaudePeerFactory = (runtime: AttestedClaudePeerRuntime, deliveryNotices: GatewayDeliveryNoticeMode) => ClaudePeerAdapter;
11
- export type LocalClaudeGatewayProviderOptions = {
12
- /** Exact result of attestClaudePeerRuntime; paths are never rediscovered. */
13
- runtime: AttestedClaudePeerRuntime;
14
- /** Fixed controller-owned root re-attested by each selected-route dispatch. */
15
- stateRoot: string;
16
- hostId: string;
17
- nodeInventory: GatewayNodeInventory;
18
- /** Gateway-authored user-frame policy; native receipt status is unchanged. */
19
- deliveryNotices?: GatewayDeliveryNoticeMode;
20
- discoveryPollMs?: number;
21
- maxPendingMessages?: number;
22
- now?: () => number;
23
- /** Production-only real-PID advertisement helpers. Omit in child/test hosts. */
24
- nativeHelpers?: Readonly<{
25
- maxHelpers: number;
26
- factory?: ClaudeNativeHelperFactory;
27
- }>;
28
- /** Deterministic test seam. Production callers must omit this. */
29
- peerFactory?: ClaudePeerFactory;
30
- };
31
- export declare class LocalClaudeGatewayProvider implements GatewayProviderAdapter {
32
- readonly identity: Readonly<{
33
- provider: "claude";
34
- hostId: string;
35
- }>;
36
- readonly protocol = "claude-peer";
37
- readonly protocolVersion: string;
38
- private readonly peer;
39
- private readonly stateRoot;
40
- private readonly maxPending;
41
- private readonly discoveryPollMs;
42
- private readonly now;
43
- private readonly nativeHelpers;
44
- private readonly discovered;
45
- /** Exact UUID selection plus its display-only observation bookkeeping. */
46
- private readonly selected;
47
- private discoveryInFlight;
48
- private registryObservation;
49
- private monitorTimer;
50
- private callbacks;
51
- private initialized;
52
- private closed;
53
- constructor(options: LocalClaudeGatewayProviderOptions);
54
- latestRegistryObservation(): GatewayAdapterRegistryObservation | undefined;
55
- initialize(callbacks: GatewayAdapterCallbacks): Promise<GatewayAdapterStart>;
56
- discoverClaudePeers(): Promise<GatewayAdapterDiscoverySnapshot>;
57
- assertWorkspaceDisjoint(routeHandle: string, stateRoot: string): Promise<void>;
58
- selectRoute(input: {
59
- alias: string;
60
- routeHandle: string;
61
- }): Promise<{
62
- routeHandle: string;
63
- state: GatewayAdapterRouteState;
64
- }>;
65
- observeLogicalRoute(input: {
66
- alias: string;
67
- routeHandle: string;
68
- registrationId: string;
69
- }): void;
70
- forgetLogicalRoute(registrationId: string): void;
71
- /**
72
- * Converts an inherited messaging-socket capability into the owning
73
- * session's UUID. The session need not hold a route yet: its route installs
74
- * on its first send, and the service compares the claimed alias against
75
- * discovery for that UUID.
76
- */
77
- resolveReplyAddress(address: string): Promise<{
78
- routeHandle: string;
79
- }>;
80
- advertiseNativeSourcePeer(input: {
81
- alias: string;
82
- sourceProvider: GatewayProvider;
83
- cwd: string;
84
- }): Promise<void>;
85
- unadvertiseNativeSourcePeer(alias: string): Promise<void>;
86
- updateNativeSourcePeerStatus(alias: string, status: "idle" | "busy" | "waiting"): Promise<void>;
87
- updateNativeInboundStatus(receiptHandle: string, status: "held" | "delivered" | "denied" | "expired", diagnosticCode?: string): Promise<void>;
88
- notifyNativeInboundProgress(receiptHandle: string, progress: ClaudePeerInboundProgress): Promise<void>;
89
- releaseNativeInboundReceipt(receiptHandle: string): Promise<boolean>;
90
- dispatch(input: GatewayAdapterDispatchInput): Promise<GatewayAdapterDispatchResult>;
91
- releaseRoute(routeHandle: string): Promise<void>;
92
- close(): Promise<void>;
93
- private assertReady;
94
- private helpers;
95
- private refreshClaudeDiscovery;
96
- private refreshClaudeDiscoveryOnce;
97
- private emitClaudeRouteObservation;
98
- private scheduleClaudeMonitor;
99
- }
100
- export declare function createLocalClaudeGatewayProvider(options: LocalClaudeGatewayProviderOptions): LocalClaudeGatewayProvider;
101
- export type LocalCodexGatewayProviderOptions = {
102
- hostId: string;
103
- nodeInventory: GatewayNodeInventory;
104
- operation: StatelessCodexOperationTransport;
105
- observationPollMs?: number;
106
- observationTimeoutMs?: number;
107
- observationBackoffMaxMs?: number;
108
- maxObservedRoutes?: number;
109
- now?: () => Date;
110
- timers?: Readonly<{
111
- setTimeout: (callback: () => void, delayMs: number) => NodeJS.Timeout;
112
- clearTimeout: (timer: NodeJS.Timeout) => void;
113
- }>;
114
- };
115
- /**
116
- * Thin logical Codex adapter. Registration and construction perform no App
117
- * Server I/O. Each semantic operation owns a fresh attested transport, while
118
- * the independent observer publishes only best-effort in-memory freshness.
119
- */
120
- export declare class LocalCodexGatewayProvider implements GatewayProviderAdapter {
121
- private readonly hostId;
122
- private readonly operation;
123
- private readonly observationPollMs;
124
- private readonly observationTimeoutMs;
125
- private readonly observationBackoffMaxMs;
126
- private readonly maxObservedRoutes;
127
- private readonly now;
128
- private readonly timers;
129
- private readonly observedRoutes;
130
- private readonly activeTurns;
131
- private readonly inFlightOperations;
132
- private readonly operationControllers;
133
- private callbacks;
134
- private observationTimer;
135
- private observationInFlight;
136
- private observationController;
137
- private initialized;
138
- private closing;
139
- private closed;
140
- constructor(options: LocalCodexGatewayProviderOptions);
141
- get identity(): Readonly<{
142
- provider: "codex";
143
- hostId: string;
144
- }>;
145
- get protocol(): string;
146
- get protocolVersion(): string;
147
- initialize(callbacks: GatewayAdapterCallbacks): Promise<GatewayAdapterStart>;
148
- observeLogicalRoute(input: {
149
- alias: string;
150
- routeHandle: string;
151
- registrationId: string;
152
- }): void;
153
- forgetLogicalRoute(registrationId: string): void;
154
- dispatch(input: GatewayAdapterDispatchInput): Promise<GatewayAdapterDispatchResult>;
155
- private dispatchSteer;
156
- private dispatchStart;
157
- close(): Promise<void>;
158
- private publishOperationObservation;
159
- private scheduleObservation;
160
- private runObservation;
161
- private emitObservation;
162
- }
163
- export declare function createLocalCodexGatewayProvider(options: LocalCodexGatewayProviderOptions): LocalCodexGatewayProvider;
164
- export {};