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,588 +0,0 @@
|
|
|
1
|
-
import { assertCodexRegistrationGeneration } from "./codex-registration-generation.js";
|
|
2
|
-
/**
|
|
3
|
-
* Pure lifecycle for replacing one registered Codex task with another.
|
|
4
|
-
*
|
|
5
|
-
* The reducer owns no sockets, registry files, message bodies, conversations,
|
|
6
|
-
* timers, or provider clients. A controller executes the returned effects and
|
|
7
|
-
* feeds the resulting observations back as events. Listener generations are
|
|
8
|
-
* deliberately opaque; this module never derives a socket path or assumes a
|
|
9
|
-
* suffixed-socket naming scheme.
|
|
10
|
-
*
|
|
11
|
-
* Publication arming is the conservative irreversible boundary: the reducer
|
|
12
|
-
* enters it before emitting any durable-journal or registry-write effect.
|
|
13
|
-
* Cleanup may restore the old registration only before arming, or after a
|
|
14
|
-
* controller positively proves that neither the arm nor registry write was
|
|
15
|
-
* persisted. At or after any armed/published/unknown observation, the old
|
|
16
|
-
* registration can never be restored by this machine.
|
|
17
|
-
*/
|
|
18
|
-
export const codexRegistrationSuccessionPhases = [
|
|
19
|
-
"active_old",
|
|
20
|
-
"freezing",
|
|
21
|
-
"prepared_new",
|
|
22
|
-
"published_new",
|
|
23
|
-
"active_new",
|
|
24
|
-
"offline_poisoned",
|
|
25
|
-
"recovery_required",
|
|
26
|
-
"resuming_old",
|
|
27
|
-
];
|
|
28
|
-
export const codexSuccessionFailurePhases = [
|
|
29
|
-
"freeze",
|
|
30
|
-
"barrier",
|
|
31
|
-
"listener",
|
|
32
|
-
"store",
|
|
33
|
-
"publication_arm",
|
|
34
|
-
"registry",
|
|
35
|
-
"activation",
|
|
36
|
-
"retirement",
|
|
37
|
-
"cleanup",
|
|
38
|
-
"resume",
|
|
39
|
-
];
|
|
40
|
-
export function createCodexRegistrationSuccession(active) {
|
|
41
|
-
const registration = copyAndValidateIdentity(active, "active");
|
|
42
|
-
return { phase: "active_old", active: registration };
|
|
43
|
-
}
|
|
44
|
-
export function transitionCodexRegistrationSuccession(state, event) {
|
|
45
|
-
assertCodexRegistrationSuccessionInvariant(state);
|
|
46
|
-
if (event.type === "begin") {
|
|
47
|
-
return beginSuccession(state, event.registration);
|
|
48
|
-
}
|
|
49
|
-
const context = successionContext(state);
|
|
50
|
-
if (context === null || event.generation !== context.newRegistration.generation) {
|
|
51
|
-
return unchanged(state);
|
|
52
|
-
}
|
|
53
|
-
switch (event.type) {
|
|
54
|
-
case "barrier_clean":
|
|
55
|
-
if (state.phase !== "freezing" || state.stage !== "barrier_pending") {
|
|
56
|
-
return unchanged(state);
|
|
57
|
-
}
|
|
58
|
-
return checked({
|
|
59
|
-
state: { ...state, stage: "listener_pending" },
|
|
60
|
-
effects: [
|
|
61
|
-
{
|
|
62
|
-
type: "create_fresh_listener_generation",
|
|
63
|
-
registration: state.newRegistration,
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
});
|
|
67
|
-
case "barrier_busy":
|
|
68
|
-
if (state.phase !== "freezing" || state.stage !== "barrier_pending") {
|
|
69
|
-
return unchanged(state);
|
|
70
|
-
}
|
|
71
|
-
return prepublicationRecovery(state, "barrier_busy", event.safeErrorCode);
|
|
72
|
-
case "listener_prepared":
|
|
73
|
-
if (state.phase !== "freezing" || state.stage !== "listener_pending") {
|
|
74
|
-
return unchanged(state);
|
|
75
|
-
}
|
|
76
|
-
return checked({
|
|
77
|
-
state: { ...state, stage: "store_pending" },
|
|
78
|
-
effects: [
|
|
79
|
-
{
|
|
80
|
-
type: "purge_old_conversations",
|
|
81
|
-
registration: state.oldRegistration,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
type: "purge_old_reply_capabilities",
|
|
85
|
-
registration: state.oldRegistration,
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
type: "prepare_new_store",
|
|
89
|
-
registration: state.newRegistration,
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
});
|
|
93
|
-
case "store_prepared":
|
|
94
|
-
if (state.phase !== "freezing" || state.stage !== "store_pending") {
|
|
95
|
-
return unchanged(state);
|
|
96
|
-
}
|
|
97
|
-
return checked({
|
|
98
|
-
state: preparedState("publication_arming", state),
|
|
99
|
-
effects: [
|
|
100
|
-
{
|
|
101
|
-
type: "arm_publication_journal",
|
|
102
|
-
registration: state.newRegistration,
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
});
|
|
106
|
-
case "publication_armed":
|
|
107
|
-
if (state.phase !== "prepared_new" ||
|
|
108
|
-
state.stage !== "publication_arming") {
|
|
109
|
-
return unchanged(state);
|
|
110
|
-
}
|
|
111
|
-
return checked({
|
|
112
|
-
state: preparedState("registry_publishing", state),
|
|
113
|
-
effects: [
|
|
114
|
-
{
|
|
115
|
-
type: "publish_new_registry",
|
|
116
|
-
registration: state.newRegistration,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
});
|
|
120
|
-
case "publication_absence_confirmed":
|
|
121
|
-
return publicationAbsenceConfirmed(state);
|
|
122
|
-
case "registry_published":
|
|
123
|
-
if (state.phase !== "prepared_new" ||
|
|
124
|
-
state.stage !== "registry_publishing") {
|
|
125
|
-
return unchanged(state);
|
|
126
|
-
}
|
|
127
|
-
return checked({
|
|
128
|
-
state: contextState("published_new", state),
|
|
129
|
-
effects: [
|
|
130
|
-
{
|
|
131
|
-
type: "activate_new_registration",
|
|
132
|
-
registration: state.newRegistration,
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
});
|
|
136
|
-
case "activate":
|
|
137
|
-
if (state.phase !== "published_new")
|
|
138
|
-
return unchanged(state);
|
|
139
|
-
return checked({
|
|
140
|
-
state: {
|
|
141
|
-
phase: "active_new",
|
|
142
|
-
active: state.newRegistration,
|
|
143
|
-
retired: state.oldRegistration,
|
|
144
|
-
},
|
|
145
|
-
effects: [
|
|
146
|
-
{
|
|
147
|
-
type: "retire_old_generation",
|
|
148
|
-
registration: state.oldRegistration,
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
type: "close_old_listener",
|
|
152
|
-
registration: state.oldRegistration,
|
|
153
|
-
registryUnlink: {
|
|
154
|
-
onlyIfOwnedGeneration: state.oldRegistration.generation,
|
|
155
|
-
protectedActiveGeneration: state.newRegistration.generation,
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
});
|
|
160
|
-
case "cleanup_confirmed":
|
|
161
|
-
return cleanupConfirmed(state);
|
|
162
|
-
case "resume_confirmed":
|
|
163
|
-
return resumeConfirmed(state);
|
|
164
|
-
case "abort":
|
|
165
|
-
return abortSuccession(state, event.safeErrorCode);
|
|
166
|
-
case "phase_failed":
|
|
167
|
-
return phaseFailed(state, event);
|
|
168
|
-
case "restart_evidence":
|
|
169
|
-
return restartEvidence(state, event);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Runtime assertion for controller boundaries and exhaustive state-machine
|
|
174
|
-
* tests. It intentionally validates identities without interpreting their
|
|
175
|
-
* opaque generation strings.
|
|
176
|
-
*/
|
|
177
|
-
export function assertCodexRegistrationSuccessionInvariant(state) {
|
|
178
|
-
switch (state.phase) {
|
|
179
|
-
case "active_old":
|
|
180
|
-
validateIdentity(state.active, "active");
|
|
181
|
-
return;
|
|
182
|
-
case "active_new":
|
|
183
|
-
validateIdentity(state.active, "active");
|
|
184
|
-
if (state.retired !== null) {
|
|
185
|
-
validateIdentity(state.retired, "retired");
|
|
186
|
-
assertSuccessor(state.retired, state.active);
|
|
187
|
-
}
|
|
188
|
-
return;
|
|
189
|
-
case "freezing":
|
|
190
|
-
if (state.stage !== "barrier_pending" &&
|
|
191
|
-
state.stage !== "listener_pending" &&
|
|
192
|
-
state.stage !== "store_pending") {
|
|
193
|
-
throw new TypeError("Unknown Codex succession freezing stage.");
|
|
194
|
-
}
|
|
195
|
-
assertContext(state);
|
|
196
|
-
return;
|
|
197
|
-
case "prepared_new":
|
|
198
|
-
if (state.stage !== "publication_arming" &&
|
|
199
|
-
state.stage !== "registry_publishing") {
|
|
200
|
-
throw new TypeError("Unknown Codex succession publication stage.");
|
|
201
|
-
}
|
|
202
|
-
assertContext(state);
|
|
203
|
-
return;
|
|
204
|
-
case "published_new":
|
|
205
|
-
assertContext(state);
|
|
206
|
-
return;
|
|
207
|
-
case "offline_poisoned":
|
|
208
|
-
case "recovery_required":
|
|
209
|
-
assertContext(state);
|
|
210
|
-
validateSafeErrorCode(state.safeErrorCode);
|
|
211
|
-
if (state.rollback !== "old_allowed" && state.rollback !== "forbidden") {
|
|
212
|
-
throw new TypeError("Unknown Codex succession rollback disposition.");
|
|
213
|
-
}
|
|
214
|
-
if (state.publicationBoundary !== "not_armed" &&
|
|
215
|
-
state.publicationBoundary !== "armed_or_unknown" &&
|
|
216
|
-
state.publicationBoundary !== "published") {
|
|
217
|
-
throw new TypeError("Unknown Codex succession publication boundary.");
|
|
218
|
-
}
|
|
219
|
-
if ((state.rollback === "old_allowed") !==
|
|
220
|
-
(state.publicationBoundary === "not_armed")) {
|
|
221
|
-
throw new TypeError("Codex succession rollback must agree with publication evidence.");
|
|
222
|
-
}
|
|
223
|
-
return;
|
|
224
|
-
case "resuming_old":
|
|
225
|
-
assertContext(state);
|
|
226
|
-
validateSafeErrorCode(state.safeErrorCode);
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
function beginSuccession(state, requested) {
|
|
231
|
-
if (state.phase !== "active_old" && state.phase !== "active_new") {
|
|
232
|
-
return unchanged(state);
|
|
233
|
-
}
|
|
234
|
-
if (state.phase === "active_new" && state.retired !== null) {
|
|
235
|
-
// A second succession cannot create a second retired generation.
|
|
236
|
-
return unchanged(state);
|
|
237
|
-
}
|
|
238
|
-
const newRegistration = copyAndValidateIdentity(requested, "new");
|
|
239
|
-
assertSuccessor(state.active, newRegistration);
|
|
240
|
-
const next = {
|
|
241
|
-
phase: "freezing",
|
|
242
|
-
stage: "barrier_pending",
|
|
243
|
-
oldRegistration: state.active,
|
|
244
|
-
newRegistration,
|
|
245
|
-
priorStablePhase: state.phase,
|
|
246
|
-
};
|
|
247
|
-
return checked({
|
|
248
|
-
state: next,
|
|
249
|
-
effects: [
|
|
250
|
-
{ type: "freeze_old_ingress", registration: state.active },
|
|
251
|
-
{ type: "freeze_old_dispatch", registration: state.active },
|
|
252
|
-
{ type: "quiesce_and_join_old", registration: state.active },
|
|
253
|
-
{ type: "verify_full_barrier", registration: state.active },
|
|
254
|
-
],
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
function phaseFailed(state, event) {
|
|
258
|
-
validateSafeErrorCode(event.safeErrorCode);
|
|
259
|
-
if (state.phase === "freezing") {
|
|
260
|
-
const expected = state.stage === "barrier_pending"
|
|
261
|
-
? ["freeze", "barrier"]
|
|
262
|
-
: state.stage === "listener_pending"
|
|
263
|
-
? ["listener"]
|
|
264
|
-
: ["store"];
|
|
265
|
-
if (!expected.includes(event.phase)) {
|
|
266
|
-
return unchanged(state);
|
|
267
|
-
}
|
|
268
|
-
return prepublicationRecovery(state, event.phase, event.safeErrorCode);
|
|
269
|
-
}
|
|
270
|
-
if (state.phase === "prepared_new") {
|
|
271
|
-
const expected = state.stage === "publication_arming"
|
|
272
|
-
? "publication_arm"
|
|
273
|
-
: "registry";
|
|
274
|
-
if (event.phase !== expected)
|
|
275
|
-
return unchanged(state);
|
|
276
|
-
// Once publication arming begins, an ordinary failure cannot prove that
|
|
277
|
-
// neither the durable arm nor registry write became visible.
|
|
278
|
-
return poisonOffline(state, event.phase, event.safeErrorCode, "armed_or_unknown");
|
|
279
|
-
}
|
|
280
|
-
if (state.phase === "published_new" && event.phase === "activation") {
|
|
281
|
-
return poisonOffline(state, event.phase, event.safeErrorCode, "published");
|
|
282
|
-
}
|
|
283
|
-
if (state.phase === "active_new" &&
|
|
284
|
-
state.retired !== null &&
|
|
285
|
-
event.phase === "retirement") {
|
|
286
|
-
return poisonOffline({
|
|
287
|
-
oldRegistration: state.retired,
|
|
288
|
-
newRegistration: state.active,
|
|
289
|
-
priorStablePhase: "active_new",
|
|
290
|
-
}, event.phase, event.safeErrorCode, "published");
|
|
291
|
-
}
|
|
292
|
-
if (state.phase === "recovery_required" &&
|
|
293
|
-
event.phase === "cleanup") {
|
|
294
|
-
return poisonOffline(state, event.phase, event.safeErrorCode, state.publicationBoundary);
|
|
295
|
-
}
|
|
296
|
-
if (state.phase === "resuming_old" && event.phase === "resume") {
|
|
297
|
-
return poisonOffline(state, event.phase, event.safeErrorCode, "not_armed");
|
|
298
|
-
}
|
|
299
|
-
return unchanged(state);
|
|
300
|
-
}
|
|
301
|
-
function abortSuccession(state, safeErrorCode) {
|
|
302
|
-
validateSafeErrorCode(safeErrorCode);
|
|
303
|
-
if (state.phase === "freezing") {
|
|
304
|
-
return prepublicationRecovery(state, "abort", safeErrorCode);
|
|
305
|
-
}
|
|
306
|
-
if (state.phase === "prepared_new") {
|
|
307
|
-
return poisonOffline(state, "abort", safeErrorCode, "armed_or_unknown");
|
|
308
|
-
}
|
|
309
|
-
if (state.phase === "published_new") {
|
|
310
|
-
return poisonOffline(state, "abort", safeErrorCode, "published");
|
|
311
|
-
}
|
|
312
|
-
if (state.phase === "active_new" && state.retired !== null) {
|
|
313
|
-
return poisonOffline({
|
|
314
|
-
oldRegistration: state.retired,
|
|
315
|
-
newRegistration: state.active,
|
|
316
|
-
priorStablePhase: "active_new",
|
|
317
|
-
}, "abort", safeErrorCode, "published");
|
|
318
|
-
}
|
|
319
|
-
return unchanged(state);
|
|
320
|
-
}
|
|
321
|
-
function restartEvidence(state, event) {
|
|
322
|
-
validateSafeErrorCode(event.safeErrorCode);
|
|
323
|
-
if (state.phase === "freezing") {
|
|
324
|
-
return event.publication === "absent"
|
|
325
|
-
? prepublicationRecovery(state, "abort", event.safeErrorCode)
|
|
326
|
-
: poisonOffline(state, "abort", event.safeErrorCode, publicationBoundaryFromEvidence(event.publication));
|
|
327
|
-
}
|
|
328
|
-
if (state.phase === "prepared_new") {
|
|
329
|
-
return event.publication === "absent"
|
|
330
|
-
? prepublicationRecovery(state, state.stage === "publication_arming"
|
|
331
|
-
? "publication_arm"
|
|
332
|
-
: "registry", event.safeErrorCode)
|
|
333
|
-
: poisonOffline(state, state.stage === "publication_arming"
|
|
334
|
-
? "publication_arm"
|
|
335
|
-
: "registry", event.safeErrorCode, publicationBoundaryFromEvidence(event.publication));
|
|
336
|
-
}
|
|
337
|
-
if (state.phase === "published_new") {
|
|
338
|
-
return poisonOffline(state, "activation", event.safeErrorCode, "published");
|
|
339
|
-
}
|
|
340
|
-
if (state.phase === "active_new" && state.retired !== null) {
|
|
341
|
-
return poisonOffline({
|
|
342
|
-
oldRegistration: state.retired,
|
|
343
|
-
newRegistration: state.active,
|
|
344
|
-
priorStablePhase: "active_new",
|
|
345
|
-
}, "retirement", event.safeErrorCode, "published");
|
|
346
|
-
}
|
|
347
|
-
if (state.phase === "recovery_required" ||
|
|
348
|
-
state.phase === "offline_poisoned") {
|
|
349
|
-
if (event.publication === "absent") {
|
|
350
|
-
return publicationAbsenceConfirmed(state);
|
|
351
|
-
}
|
|
352
|
-
const observedBoundary = publicationBoundaryFromEvidence(event.publication);
|
|
353
|
-
if (state.publicationBoundary === "published" ||
|
|
354
|
-
state.publicationBoundary === observedBoundary) {
|
|
355
|
-
return unchanged(state);
|
|
356
|
-
}
|
|
357
|
-
return poisonOffline(state, state.failedPhase, event.safeErrorCode, observedBoundary);
|
|
358
|
-
}
|
|
359
|
-
return unchanged(state);
|
|
360
|
-
}
|
|
361
|
-
function publicationAbsenceConfirmed(state) {
|
|
362
|
-
if (state.phase === "prepared_new") {
|
|
363
|
-
return prepublicationRecovery(state, state.stage === "publication_arming" ? "publication_arm" : "registry", "PUBLICATION_ABSENCE_CONFIRMED");
|
|
364
|
-
}
|
|
365
|
-
if ((state.phase === "recovery_required" ||
|
|
366
|
-
state.phase === "offline_poisoned") &&
|
|
367
|
-
state.publicationBoundary === "armed_or_unknown") {
|
|
368
|
-
return prepublicationRecovery(state, state.failedPhase, "PUBLICATION_ABSENCE_CONFIRMED");
|
|
369
|
-
}
|
|
370
|
-
return unchanged(state);
|
|
371
|
-
}
|
|
372
|
-
function cleanupConfirmed(state) {
|
|
373
|
-
if (state.phase === "active_new" && state.retired !== null) {
|
|
374
|
-
return checked({
|
|
375
|
-
state: { ...state, retired: null },
|
|
376
|
-
effects: [],
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
if (state.phase === "recovery_required") {
|
|
380
|
-
if (state.rollback === "forbidden" || state.failedPhase === "resume") {
|
|
381
|
-
return unchanged(state);
|
|
382
|
-
}
|
|
383
|
-
return checked({
|
|
384
|
-
state: {
|
|
385
|
-
phase: "resuming_old",
|
|
386
|
-
oldRegistration: state.oldRegistration,
|
|
387
|
-
newRegistration: state.newRegistration,
|
|
388
|
-
priorStablePhase: state.priorStablePhase,
|
|
389
|
-
failedPhase: state.failedPhase,
|
|
390
|
-
safeErrorCode: state.safeErrorCode,
|
|
391
|
-
},
|
|
392
|
-
effects: [
|
|
393
|
-
{
|
|
394
|
-
type: "resume_old_ingress",
|
|
395
|
-
registration: state.oldRegistration,
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
type: "resume_old_dispatch",
|
|
399
|
-
registration: state.oldRegistration,
|
|
400
|
-
},
|
|
401
|
-
],
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
if (state.phase === "offline_poisoned") {
|
|
405
|
-
if (state.rollback === "old_allowed" && state.failedPhase !== "resume") {
|
|
406
|
-
const recoverable = {
|
|
407
|
-
...state,
|
|
408
|
-
phase: "recovery_required",
|
|
409
|
-
};
|
|
410
|
-
return cleanupConfirmed(recoverable);
|
|
411
|
-
}
|
|
412
|
-
return checked({
|
|
413
|
-
state: { ...state, phase: "recovery_required" },
|
|
414
|
-
effects: [
|
|
415
|
-
{
|
|
416
|
-
type: "manual_recovery_required",
|
|
417
|
-
registration: state.newRegistration,
|
|
418
|
-
safeErrorCode: state.safeErrorCode,
|
|
419
|
-
},
|
|
420
|
-
],
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
return unchanged(state);
|
|
424
|
-
}
|
|
425
|
-
function resumeConfirmed(state) {
|
|
426
|
-
if (state.phase !== "resuming_old")
|
|
427
|
-
return unchanged(state);
|
|
428
|
-
const restored = state.priorStablePhase === "active_old"
|
|
429
|
-
? { phase: "active_old", active: state.oldRegistration }
|
|
430
|
-
: {
|
|
431
|
-
phase: "active_new",
|
|
432
|
-
active: state.oldRegistration,
|
|
433
|
-
retired: null,
|
|
434
|
-
};
|
|
435
|
-
return checked({ state: restored, effects: [] });
|
|
436
|
-
}
|
|
437
|
-
function prepublicationRecovery(context, failedPhase, safeErrorCode) {
|
|
438
|
-
validateSafeErrorCode(safeErrorCode);
|
|
439
|
-
return checked({
|
|
440
|
-
state: {
|
|
441
|
-
phase: "recovery_required",
|
|
442
|
-
oldRegistration: context.oldRegistration,
|
|
443
|
-
newRegistration: context.newRegistration,
|
|
444
|
-
priorStablePhase: context.priorStablePhase,
|
|
445
|
-
failedPhase,
|
|
446
|
-
safeErrorCode,
|
|
447
|
-
rollback: "old_allowed",
|
|
448
|
-
publicationBoundary: "not_armed",
|
|
449
|
-
},
|
|
450
|
-
effects: [
|
|
451
|
-
{
|
|
452
|
-
type: "cleanup_unpublished_generation",
|
|
453
|
-
registration: context.newRegistration,
|
|
454
|
-
},
|
|
455
|
-
],
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
function poisonOffline(context, failedPhase, safeErrorCode, publicationBoundary) {
|
|
459
|
-
validateSafeErrorCode(safeErrorCode);
|
|
460
|
-
return checked({
|
|
461
|
-
state: {
|
|
462
|
-
phase: "offline_poisoned",
|
|
463
|
-
oldRegistration: context.oldRegistration,
|
|
464
|
-
newRegistration: context.newRegistration,
|
|
465
|
-
priorStablePhase: context.priorStablePhase,
|
|
466
|
-
failedPhase,
|
|
467
|
-
safeErrorCode,
|
|
468
|
-
rollback: publicationBoundary === "not_armed" ? "old_allowed" : "forbidden",
|
|
469
|
-
publicationBoundary,
|
|
470
|
-
},
|
|
471
|
-
effects: [
|
|
472
|
-
{
|
|
473
|
-
type: "poison_new_generation",
|
|
474
|
-
registration: context.newRegistration,
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
type: "take_registrations_offline",
|
|
478
|
-
oldRegistration: context.oldRegistration,
|
|
479
|
-
newRegistration: context.newRegistration,
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
type: "cleanup_poisoned_generations",
|
|
483
|
-
oldRegistration: context.oldRegistration,
|
|
484
|
-
newRegistration: context.newRegistration,
|
|
485
|
-
},
|
|
486
|
-
],
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
function preparedState(stage, context) {
|
|
490
|
-
return {
|
|
491
|
-
phase: "prepared_new",
|
|
492
|
-
stage,
|
|
493
|
-
oldRegistration: context.oldRegistration,
|
|
494
|
-
newRegistration: context.newRegistration,
|
|
495
|
-
priorStablePhase: context.priorStablePhase,
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
function contextState(phase, context) {
|
|
499
|
-
return {
|
|
500
|
-
phase,
|
|
501
|
-
oldRegistration: context.oldRegistration,
|
|
502
|
-
newRegistration: context.newRegistration,
|
|
503
|
-
priorStablePhase: context.priorStablePhase,
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
function successionContext(state) {
|
|
507
|
-
switch (state.phase) {
|
|
508
|
-
case "freezing":
|
|
509
|
-
case "prepared_new":
|
|
510
|
-
case "published_new":
|
|
511
|
-
case "offline_poisoned":
|
|
512
|
-
case "recovery_required":
|
|
513
|
-
case "resuming_old":
|
|
514
|
-
return state;
|
|
515
|
-
case "active_old":
|
|
516
|
-
return null;
|
|
517
|
-
case "active_new":
|
|
518
|
-
return state.retired === null
|
|
519
|
-
? null
|
|
520
|
-
: {
|
|
521
|
-
oldRegistration: state.retired,
|
|
522
|
-
newRegistration: state.active,
|
|
523
|
-
priorStablePhase: "active_new",
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
function assertContext(context) {
|
|
528
|
-
validateIdentity(context.oldRegistration, "oldRegistration");
|
|
529
|
-
validateIdentity(context.newRegistration, "newRegistration");
|
|
530
|
-
assertSuccessor(context.oldRegistration, context.newRegistration);
|
|
531
|
-
if (context.priorStablePhase !== "active_old" &&
|
|
532
|
-
context.priorStablePhase !== "active_new") {
|
|
533
|
-
throw new TypeError("Unknown Codex succession prior stable phase.");
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
function assertSuccessor(oldRegistration, newRegistration) {
|
|
537
|
-
if (newRegistration.hostId !== oldRegistration.hostId) {
|
|
538
|
-
throw new RangeError("A Codex succession must remain on the same host.");
|
|
539
|
-
}
|
|
540
|
-
if (newRegistration.alias === oldRegistration.alias) {
|
|
541
|
-
throw new RangeError("The successor Codex alias must differ from the old alias.");
|
|
542
|
-
}
|
|
543
|
-
if (newRegistration.threadId === oldRegistration.threadId) {
|
|
544
|
-
throw new RangeError("The successor Codex thread must differ from the old thread.");
|
|
545
|
-
}
|
|
546
|
-
if (newRegistration.generation === oldRegistration.generation) {
|
|
547
|
-
throw new RangeError("The successor Codex listener generation must be fresh.");
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
function copyAndValidateIdentity(identity, label) {
|
|
551
|
-
const copy = {
|
|
552
|
-
alias: identity.alias,
|
|
553
|
-
threadId: identity.threadId,
|
|
554
|
-
hostId: identity.hostId,
|
|
555
|
-
generation: identity.generation,
|
|
556
|
-
};
|
|
557
|
-
validateIdentity(copy, label);
|
|
558
|
-
return copy;
|
|
559
|
-
}
|
|
560
|
-
function validateIdentity(identity, label) {
|
|
561
|
-
validateToken(identity.alias, `${label}.alias`);
|
|
562
|
-
validateToken(identity.threadId, `${label}.threadId`);
|
|
563
|
-
validateToken(identity.hostId, `${label}.hostId`);
|
|
564
|
-
assertCodexRegistrationGeneration(identity.generation, `${label}.generation`);
|
|
565
|
-
}
|
|
566
|
-
function validateToken(value, label) {
|
|
567
|
-
if (typeof value !== "string" || value.length === 0 || value.trim() !== value) {
|
|
568
|
-
throw new TypeError(`${label} must be a non-empty, trimmed string.`);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
function validateSafeErrorCode(value) {
|
|
572
|
-
if (!/^[A-Z][A-Z0-9_]{0,127}$/u.test(value)) {
|
|
573
|
-
throw new TypeError("safeErrorCode must be a bounded uppercase token.");
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
function publicationBoundaryFromEvidence(evidence) {
|
|
577
|
-
if (evidence === "absent")
|
|
578
|
-
return "not_armed";
|
|
579
|
-
return evidence === "published" ? "published" : "armed_or_unknown";
|
|
580
|
-
}
|
|
581
|
-
function checked(transition) {
|
|
582
|
-
assertCodexRegistrationSuccessionInvariant(transition.state);
|
|
583
|
-
return transition;
|
|
584
|
-
}
|
|
585
|
-
function unchanged(state) {
|
|
586
|
-
return { state, effects: [] };
|
|
587
|
-
}
|
|
588
|
-
//# sourceMappingURL=codex-registration-succession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-registration-succession.js","sourceRoot":"","sources":["../../../src/gateway/codex-registration-succession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AAEvF;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,YAAY;IACZ,UAAU;IACV,cAAc;IACd,eAAe;IACf,YAAY;IACZ,kBAAkB;IAClB,mBAAmB;IACnB,cAAc;CACN,CAAC;AAsBX,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,QAAQ;IACR,SAAS;IACT,UAAU;IACV,OAAO;IACP,iBAAiB;IACjB,UAA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C,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,SAAS,CAAC,kDAAkD,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,SAAS,+BAA+B,CACtC,QAAsD;IAEtD,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,WAAW,CAAC;IAC9C,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC;AACrE,CAAC;AAED,SAAS,OAAO,CACd,UAAiD;IAEjD,0CAA0C,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC7D,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,SAAS,CAChB,KAAuC;IAEvC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const compatibilitySurfaces: readonly ["claude", "codex", "deepseek"];
|
|
2
|
-
export type CompatibilitySurface = (typeof compatibilitySurfaces)[number];
|
|
3
|
-
/** Bounded evidence used when a version banner is present but not parseable. */
|
|
4
|
-
export declare const UNKNOWN_COMPATIBILITY_VERSION: "unknown";
|
|
5
|
-
/** TODO(emb-69): remove with the DeepSeek online version observer. */
|
|
6
|
-
export type CompatibilityProbeResult = Readonly<{
|
|
7
|
-
name: "installation" | "harness_home" | "version";
|
|
8
|
-
outcome: "pass" | "fail";
|
|
9
|
-
safeErrorCode?: string;
|
|
10
|
-
}>;
|
|
11
|
-
/** TODO(emb-69): remove with the DeepSeek online version observer. */
|
|
12
|
-
export type CompatibilitySurfaceObservation = Readonly<{
|
|
13
|
-
surface: CompatibilitySurface;
|
|
14
|
-
version: string;
|
|
15
|
-
}>;
|
|
16
|
-
/** TODO(emb-69): remove with the DeepSeek online version observer. */
|
|
17
|
-
export interface CompatibilitySurfaceObserver {
|
|
18
|
-
compatibilitySurface(): CompatibilitySurfaceObservation;
|
|
19
|
-
runCompatibilityProbes(): Promise<readonly CompatibilityProbeResult[]>;
|
|
20
|
-
}
|
|
21
|
-
export declare function isCompatibilityVersion(value: unknown): value is string;
|
|
22
|
-
export declare function isCompatibilityVersionEvidence(value: unknown): value is string;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const compatibilitySurfaces = Object.freeze([
|
|
2
|
-
"claude",
|
|
3
|
-
"codex",
|
|
4
|
-
"deepseek",
|
|
5
|
-
]);
|
|
6
|
-
/** Bounded evidence used when a version banner is present but not parseable. */
|
|
7
|
-
export const UNKNOWN_COMPATIBILITY_VERSION = "unknown";
|
|
8
|
-
const VERSION_PATTERN = /^(?=.{1,128}$)([0-9]{1,4})\.([0-9]{1,4})\.([0-9]{1,4})(?:-([0-9A-Za-z-]{1,64}(?:\.[0-9A-Za-z-]{1,64}){0,7}))?$/;
|
|
9
|
-
export function isCompatibilityVersion(value) {
|
|
10
|
-
if (typeof value !== "string")
|
|
11
|
-
return false;
|
|
12
|
-
const match = VERSION_PATTERN.exec(value);
|
|
13
|
-
if (match === null)
|
|
14
|
-
return false;
|
|
15
|
-
const prerelease = match[4];
|
|
16
|
-
return prerelease === undefined || !prerelease.split(".").some((identifier) => /^[0-9]+$/.test(identifier) &&
|
|
17
|
-
identifier.length > 1 &&
|
|
18
|
-
identifier.startsWith("0"));
|
|
19
|
-
}
|
|
20
|
-
export function isCompatibilityVersionEvidence(value) {
|
|
21
|
-
return (value === UNKNOWN_COMPATIBILITY_VERSION || isCompatibilityVersion(value));
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=compatibility.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../../../src/gateway/compatibility.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC;IACjD,QAAQ;IACR,OAAO;IACP,UAAU;CACF,CAAC,CAAC;AAIZ,gFAAgF;AAChF,MAAM,CAAC,MAAM,6BAA6B,GAAG,SAAkB,CAAC;AAqBhE,MAAM,eAAe,GACnB,gHAAgH,CAAC;AAEnH,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACjC,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,UAAU,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAC5D,CAAC,UAAU,EAAE,EAAE,CACb,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;QAC3B,UAAU,CAAC,MAAM,GAAG,CAAC;QACrB,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAC7B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,KAAc;IAEd,OAAO,CACL,KAAK,KAAK,6BAA6B,IAAI,sBAAsB,CAAC,KAAK,CAAC,CACzE,CAAC;AACJ,CAAC"}
|