agent-embassy 1.4.0 → 1.5.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 +61 -6
- package/README.md +6 -5
- package/README.zh-CN.md +4 -4
- package/SECURITY.md +128 -24
- package/dist/src/gateway/claude-peer.d.ts +8 -5
- package/dist/src/gateway/claude-peer.js +81 -36
- package/dist/src/gateway/claude-peer.js.map +1 -1
- package/dist/src/gateway/claude-runtime.d.ts +4 -0
- package/dist/src/gateway/claude-runtime.js +50 -39
- package/dist/src/gateway/claude-runtime.js.map +1 -1
- package/dist/src/gateway/cli-copy.d.ts +1 -1
- package/dist/src/gateway/cli-copy.en.d.ts +1 -1
- package/dist/src/gateway/cli-copy.en.js +1 -1
- package/dist/src/gateway/cli-copy.en.js.map +1 -1
- package/dist/src/gateway/cli-copy.js +1 -1
- package/dist/src/gateway/cli-copy.js.map +1 -1
- package/dist/src/gateway/cli-copy.zh-CN.d.ts +1 -1
- package/dist/src/gateway/cli-copy.zh-CN.js +1 -1
- package/dist/src/gateway/cli-copy.zh-CN.js.map +1 -1
- package/dist/src/gateway/cli.d.ts +1 -1
- package/dist/src/gateway/cli.js +3 -7
- package/dist/src/gateway/cli.js.map +1 -1
- package/dist/src/gateway/codex-app-server.d.ts +2 -1
- package/dist/src/gateway/codex-app-server.js +1 -1
- package/dist/src/gateway/codex-app-server.js.map +1 -1
- package/dist/src/gateway/codex-local-transport.d.ts +10 -6
- package/dist/src/gateway/codex-local-transport.js +101 -56
- package/dist/src/gateway/codex-local-transport.js.map +1 -1
- package/dist/src/gateway/compatibility.d.ts +11 -0
- package/dist/src/gateway/compatibility.js +104 -22
- package/dist/src/gateway/compatibility.js.map +1 -1
- package/dist/src/gateway/control.js +28 -30
- 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 +36 -17
- package/dist/src/gateway/dashboard-copy.en.js +50 -31
- package/dist/src/gateway/dashboard-copy.en.js.map +1 -1
- package/dist/src/gateway/dashboard-copy.js +36 -17
- package/dist/src/gateway/dashboard-copy.js.map +1 -1
- package/dist/src/gateway/dashboard-copy.zh-CN.d.ts +36 -17
- package/dist/src/gateway/dashboard-copy.zh-CN.js +50 -31
- package/dist/src/gateway/dashboard-copy.zh-CN.js.map +1 -1
- package/dist/src/gateway/dashboard-model.d.ts +176 -8
- package/dist/src/gateway/dashboard-model.js +420 -70
- package/dist/src/gateway/dashboard-model.js.map +1 -1
- package/dist/src/gateway/dashboard.js +48 -135
- package/dist/src/gateway/dashboard.js.map +1 -1
- package/dist/src/gateway/live-dashboard-app/app.js +148 -247
- package/dist/src/gateway/live-dashboard-assets.js +2 -1
- package/dist/src/gateway/live-dashboard-assets.js.map +1 -1
- package/dist/src/gateway/live-dashboard-stream.d.ts +2 -2
- package/dist/src/gateway/live-dashboard-stream.js +2 -2
- package/dist/src/gateway/live-dashboard-stream.js.map +1 -1
- package/dist/src/gateway/progress-watch-machine.d.ts +50 -64
- package/dist/src/gateway/progress-watch-machine.js +42 -133
- package/dist/src/gateway/progress-watch-machine.js.map +1 -1
- package/dist/src/gateway/provenance-envelope.d.ts +2 -0
- package/dist/src/gateway/provenance-envelope.js +13 -3
- package/dist/src/gateway/provenance-envelope.js.map +1 -1
- package/dist/src/gateway/providers.d.ts +69 -15
- package/dist/src/gateway/providers.js +456 -109
- package/dist/src/gateway/providers.js.map +1 -1
- package/dist/src/gateway/server.d.ts +8 -5
- package/dist/src/gateway/server.js +94 -13
- package/dist/src/gateway/server.js.map +1 -1
- package/dist/src/gateway/service.d.ts +25 -1
- package/dist/src/gateway/service.js +252 -69
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/gateway/store.d.ts +23 -28
- package/dist/src/gateway/store.js +479 -467
- package/dist/src/gateway/store.js.map +1 -1
- package/dist/src/gateway/types.d.ts +38 -11
- package/dist/src/gateway/types.js +141 -3
- package/dist/src/gateway/types.js.map +1 -1
- package/docs/CONFIGURATION.md +8 -8
- package/docs/CONFIGURATION.zh-CN.md +8 -8
- package/docs/DASHBOARD.md +29 -6
- package/docs/DASHBOARD.zh-CN.md +1 -1
- package/docs/GATEWAY-ARCHITECTURE.md +143 -57
- package/package.json +1 -1
- package/skills/embassy-peer/SKILL.md +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-dashboard-stream.js","sourceRoot":"","sources":["../../../src/gateway/live-dashboard-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"live-dashboard-stream.js","sourceRoot":"","sources":["../../../src/gateway/live-dashboard-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,2BAA2B,GAE5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAoBrE,MAAM,CAAC,MAAM,yBAAyB,GAAuB;IAC3D,GAAG,EAAE,IAAI,CAAC,GAAG;IACb,WAAW,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC;IAC5E,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAwB,CAAC;CACnE,CAAC;AAwCF,SAAS,iBAAiB,CACxB,QAAuC;IAEvC,IACE,OAAO,QAAQ,KAAK,QAAQ;QAC5B,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC;QAC9B,QAAQ,IAAI,CAAC,EACb,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IACE,OAAO,QAAQ,KAAK,QAAQ;QAC5B,qCAAqC,CAAC,IAAI,CAAC,QAAQ,CAAC,EACpD,CAAC;QACD,OAAO,QAAQ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CAAC,GAAG,OAAO,CAAC;gBAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -1,91 +1,68 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export type ProgressWatchPhase = (typeof progressWatchPhases)[number];
|
|
3
|
-
export declare const progressWatchCapabilities: readonly ["conversation", "route"];
|
|
4
|
-
export type ProgressWatchCapability = (typeof progressWatchCapabilities)[number];
|
|
5
|
-
export declare const progressWatchOutcomes: readonly ["done", "unresponsive", "endpoint_retired", "disabled"];
|
|
6
|
-
export type ProgressWatchOutcome = (typeof progressWatchOutcomes)[number];
|
|
7
|
-
export declare const progressWatchJournalKinds: readonly ["opened", "replaced", "activity", "nudge", "worker_reported_complete", "capability_degraded", "conversation_rebound", "done", "unresponsive", "pair_removed", "endpoint_retired", "disabled"];
|
|
8
|
-
export type ProgressWatchJournalKind = (typeof progressWatchJournalKinds)[number];
|
|
1
|
+
export declare const progressWatchJournalKinds: readonly ["opened", "replaced", "settled"];
|
|
9
2
|
export declare const PROGRESS_WATCH_DEFAULT_IDLE_MS: number;
|
|
10
3
|
export declare const PROGRESS_WATCH_MIN_IDLE_MS = 60000;
|
|
11
4
|
export declare const PROGRESS_WATCH_MAX_IDLE_MS: number;
|
|
12
5
|
export declare const PROGRESS_WATCH_DEFAULT_CAPACITY = 32;
|
|
13
6
|
export declare const PROGRESS_WATCH_HARD_CAPACITY = 256;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
* the exact consent edge that opened it; they are never publicly projected.
|
|
17
|
-
*/
|
|
18
|
-
export type ProgressWatchMachine = Readonly<{
|
|
7
|
+
/** One durable active watch. Settlement is represented by its absence. */
|
|
8
|
+
export type ProgressWatch = Readonly<{
|
|
19
9
|
conversationId: string;
|
|
20
10
|
ownerAlias: string;
|
|
21
11
|
workerAlias: string;
|
|
22
12
|
ownerLease: string;
|
|
23
13
|
workerLease: string;
|
|
24
|
-
createdAt: string;
|
|
25
|
-
updatedAt: string;
|
|
26
14
|
lastActivityAt: string;
|
|
27
15
|
idleMs: number;
|
|
28
|
-
phase: ProgressWatchPhase;
|
|
29
16
|
nudgeCount: 0 | 1 | 2;
|
|
30
17
|
nextActionAt: string;
|
|
31
|
-
capability: ProgressWatchCapability;
|
|
32
|
-
degradedNoticeSent: boolean;
|
|
33
18
|
}>;
|
|
34
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Settlement attribution is intentionally closed: live completion names the
|
|
21
|
+
* reporting side, operator commands name the operator, automatic transitions
|
|
22
|
+
* name the gateway, and only evidence inherited without attribution is unknown.
|
|
23
|
+
*/
|
|
24
|
+
export type ProgressWatchSettlement = Readonly<{
|
|
25
|
+
actor: "owner" | "worker";
|
|
26
|
+
reason: "done";
|
|
27
|
+
}> | Readonly<{
|
|
28
|
+
actor: "operator";
|
|
29
|
+
reason: "untracked" | "pair_removed" | "endpoint_retired";
|
|
30
|
+
}> | Readonly<{
|
|
31
|
+
actor: "gateway";
|
|
32
|
+
reason: "idle_timeout" | "endpoint_retired" | "tracking_disabled" | "legacy_upgrade";
|
|
33
|
+
}> | Readonly<{
|
|
34
|
+
actor: "unknown";
|
|
35
|
+
reason: "legacy_done";
|
|
36
|
+
}>;
|
|
37
|
+
type ProgressWatchJournalBase = Readonly<{
|
|
35
38
|
sequence: number;
|
|
36
39
|
timestamp: string;
|
|
37
40
|
conversationId: string;
|
|
38
41
|
ownerAlias: string;
|
|
39
42
|
workerAlias: string;
|
|
40
|
-
kind: ProgressWatchJournalKind;
|
|
41
|
-
nudgeNumber?: 1 | 2;
|
|
42
43
|
}>;
|
|
43
|
-
export type
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}> | Readonly<{
|
|
47
|
-
type: "route_activity";
|
|
48
|
-
at: number;
|
|
49
|
-
}> | Readonly<{
|
|
50
|
-
type: "due";
|
|
51
|
-
at: number;
|
|
52
|
-
bothIdle: boolean;
|
|
53
|
-
endpointsPresent: boolean;
|
|
54
|
-
}> | Readonly<{
|
|
55
|
-
type: "restart";
|
|
56
|
-
at: number;
|
|
57
|
-
conversationCapabilityRestored: boolean;
|
|
58
|
-
}> | Readonly<{
|
|
59
|
-
type: "nudge_deferred";
|
|
60
|
-
at: number;
|
|
61
|
-
retryAt: number;
|
|
62
|
-
}> | Readonly<{
|
|
63
|
-
type: "owner_done";
|
|
64
|
-
at: number;
|
|
44
|
+
export type ProgressWatchJournalEvent = ProgressWatchJournalBase & (Readonly<{
|
|
45
|
+
kind: "opened";
|
|
46
|
+
actor: "owner";
|
|
65
47
|
}> | Readonly<{
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
kind: "replaced";
|
|
49
|
+
actor: "owner" | "unknown";
|
|
50
|
+
}> | (Readonly<{
|
|
51
|
+
kind: "settled";
|
|
52
|
+
}> & ProgressWatchSettlement));
|
|
53
|
+
type ProgressWatchDueInspection = Readonly<{
|
|
54
|
+
kind: "not_due";
|
|
68
55
|
}> | Readonly<{
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
kind: "rescheduled";
|
|
57
|
+
watch: ProgressWatch;
|
|
71
58
|
}> | Readonly<{
|
|
72
|
-
|
|
73
|
-
at: number;
|
|
74
|
-
}>;
|
|
75
|
-
export type ProgressWatchEffect = Readonly<{
|
|
76
|
-
type: "send_nudge";
|
|
59
|
+
kind: "nudge";
|
|
77
60
|
nudgeNumber: 1 | 2;
|
|
78
61
|
}> | Readonly<{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
type: "settled";
|
|
82
|
-
outcome: ProgressWatchOutcome;
|
|
62
|
+
kind: "settled";
|
|
63
|
+
reason: "idle_timeout";
|
|
83
64
|
}>;
|
|
84
|
-
export
|
|
85
|
-
state: ProgressWatchMachine | null;
|
|
86
|
-
effects: readonly ProgressWatchEffect[];
|
|
87
|
-
}>;
|
|
88
|
-
export declare function createProgressWatchMachine(input: Readonly<{
|
|
65
|
+
export declare function createProgressWatch(input: Readonly<{
|
|
89
66
|
conversationId: string;
|
|
90
67
|
ownerAlias: string;
|
|
91
68
|
workerAlias: string;
|
|
@@ -93,6 +70,15 @@ export declare function createProgressWatchMachine(input: Readonly<{
|
|
|
93
70
|
workerLease: string;
|
|
94
71
|
idleMs: number;
|
|
95
72
|
at: number;
|
|
96
|
-
}>):
|
|
97
|
-
|
|
98
|
-
export declare function
|
|
73
|
+
}>): ProgressWatch;
|
|
74
|
+
export declare function recordProgressWatchActivity(watch: ProgressWatch, at: number): ProgressWatch;
|
|
75
|
+
export declare function inspectProgressWatchDue(watch: ProgressWatch, input: Readonly<{
|
|
76
|
+
at: number;
|
|
77
|
+
bothIdle: boolean;
|
|
78
|
+
}>): ProgressWatchDueInspection;
|
|
79
|
+
export declare function commitProgressWatchNudge(watch: ProgressWatch, input: Readonly<{
|
|
80
|
+
at: number;
|
|
81
|
+
nudgeNumber: 1 | 2;
|
|
82
|
+
}>): ProgressWatch;
|
|
83
|
+
export declare function deferProgressWatchNudge(watch: ProgressWatch, at: number): ProgressWatch;
|
|
84
|
+
export {};
|
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
export const progressWatchPhases = ["quiet", "episode"];
|
|
2
|
-
export const progressWatchCapabilities = ["conversation", "route"];
|
|
3
|
-
export const progressWatchOutcomes = [
|
|
4
|
-
"done",
|
|
5
|
-
"unresponsive",
|
|
6
|
-
"endpoint_retired",
|
|
7
|
-
"disabled",
|
|
8
|
-
];
|
|
9
1
|
export const progressWatchJournalKinds = [
|
|
10
2
|
"opened",
|
|
11
3
|
"replaced",
|
|
12
|
-
"
|
|
13
|
-
"nudge",
|
|
14
|
-
"worker_reported_complete",
|
|
15
|
-
"capability_degraded",
|
|
16
|
-
"conversation_rebound",
|
|
17
|
-
"done",
|
|
18
|
-
"unresponsive",
|
|
19
|
-
"pair_removed",
|
|
20
|
-
"endpoint_retired",
|
|
21
|
-
"disabled",
|
|
4
|
+
"settled",
|
|
22
5
|
];
|
|
23
6
|
export const PROGRESS_WATCH_DEFAULT_IDLE_MS = 5 * 60_000;
|
|
24
7
|
export const PROGRESS_WATCH_MIN_IDLE_MS = 60_000;
|
|
25
8
|
export const PROGRESS_WATCH_MAX_IDLE_MS = 24 * 60 * 60_000;
|
|
9
|
+
const PROGRESS_WATCH_NUDGE_RETRY_MS = 1_000;
|
|
26
10
|
export const PROGRESS_WATCH_DEFAULT_CAPACITY = 32;
|
|
27
11
|
export const PROGRESS_WATCH_HARD_CAPACITY = 256;
|
|
28
12
|
function iso(at) {
|
|
@@ -33,10 +17,7 @@ function iso(at) {
|
|
|
33
17
|
function plus(at, delayMs) {
|
|
34
18
|
return iso(at + delayMs);
|
|
35
19
|
}
|
|
36
|
-
function
|
|
37
|
-
return { state: null, effects: [{ type: "settled", outcome }] };
|
|
38
|
-
}
|
|
39
|
-
export function createProgressWatchMachine(input) {
|
|
20
|
+
export function createProgressWatch(input) {
|
|
40
21
|
if (!Number.isSafeInteger(input.idleMs) ||
|
|
41
22
|
input.idleMs < PROGRESS_WATCH_MIN_IDLE_MS ||
|
|
42
23
|
input.idleMs > PROGRESS_WATCH_MAX_IDLE_MS) {
|
|
@@ -49,124 +30,52 @@ export function createProgressWatchMachine(input) {
|
|
|
49
30
|
workerAlias: input.workerAlias,
|
|
50
31
|
ownerLease: input.ownerLease,
|
|
51
32
|
workerLease: input.workerLease,
|
|
52
|
-
createdAt: timestamp,
|
|
53
|
-
updatedAt: timestamp,
|
|
54
33
|
lastActivityAt: timestamp,
|
|
55
34
|
idleMs: input.idleMs,
|
|
56
|
-
phase: "quiet",
|
|
57
35
|
nudgeCount: 0,
|
|
58
36
|
nextActionAt: plus(input.at, input.idleMs),
|
|
59
|
-
capability: "conversation",
|
|
60
|
-
degradedNoticeSent: false,
|
|
61
37
|
};
|
|
62
38
|
}
|
|
63
|
-
|
|
64
|
-
export function transitionProgressWatch(state, event) {
|
|
65
|
-
const at = event.at;
|
|
39
|
+
export function recordProgressWatchActivity(watch, at) {
|
|
66
40
|
const timestamp = iso(at);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
effects: [],
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
case "restart": {
|
|
90
|
-
if (event.conversationCapabilityRestored) {
|
|
91
|
-
return {
|
|
92
|
-
state: {
|
|
93
|
-
...state,
|
|
94
|
-
updatedAt: timestamp,
|
|
95
|
-
capability: "conversation",
|
|
96
|
-
},
|
|
97
|
-
effects: [],
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
const notify = !state.degradedNoticeSent;
|
|
101
|
-
return {
|
|
102
|
-
state: {
|
|
103
|
-
...state,
|
|
104
|
-
updatedAt: timestamp,
|
|
105
|
-
capability: "route",
|
|
106
|
-
degradedNoticeSent: true,
|
|
107
|
-
},
|
|
108
|
-
effects: notify ? [{ type: "record_capability_degraded" }] : [],
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
case "nudge_deferred": {
|
|
112
|
-
if (!Number.isFinite(event.retryAt) ||
|
|
113
|
-
event.retryAt <= at ||
|
|
114
|
-
event.retryAt > at + Math.min(state.idleMs, 60_000)) {
|
|
115
|
-
throw new RangeError("INVALID_PROGRESS_WATCH_RETRY_AT");
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
state: {
|
|
119
|
-
...state,
|
|
120
|
-
updatedAt: timestamp,
|
|
121
|
-
nextActionAt: iso(event.retryAt),
|
|
122
|
-
},
|
|
123
|
-
effects: [],
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
case "due": {
|
|
127
|
-
if (at < Date.parse(state.nextActionAt)) {
|
|
128
|
-
return { state, effects: [] };
|
|
129
|
-
}
|
|
130
|
-
if (!event.endpointsPresent)
|
|
131
|
-
return settle("endpoint_retired");
|
|
132
|
-
if (!event.bothIdle) {
|
|
133
|
-
return {
|
|
134
|
-
state: {
|
|
135
|
-
...state,
|
|
136
|
-
updatedAt: timestamp,
|
|
137
|
-
lastActivityAt: timestamp,
|
|
138
|
-
phase: "quiet",
|
|
139
|
-
nudgeCount: 0,
|
|
140
|
-
nextActionAt: plus(at, state.idleMs),
|
|
141
|
-
},
|
|
142
|
-
effects: [],
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
if (state.phase === "quiet") {
|
|
146
|
-
return {
|
|
147
|
-
state: {
|
|
148
|
-
...state,
|
|
149
|
-
updatedAt: timestamp,
|
|
150
|
-
phase: "episode",
|
|
151
|
-
nudgeCount: 1,
|
|
152
|
-
nextActionAt: plus(at, state.idleMs),
|
|
153
|
-
},
|
|
154
|
-
effects: [{ type: "send_nudge", nudgeNumber: 1 }],
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
if (state.nudgeCount === 1) {
|
|
158
|
-
return {
|
|
159
|
-
state: {
|
|
160
|
-
...state,
|
|
161
|
-
updatedAt: timestamp,
|
|
162
|
-
nudgeCount: 2,
|
|
163
|
-
nextActionAt: plus(at, state.idleMs * 2),
|
|
164
|
-
},
|
|
165
|
-
effects: [{ type: "send_nudge", nudgeNumber: 2 }],
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
return settle("unresponsive");
|
|
169
|
-
}
|
|
41
|
+
return {
|
|
42
|
+
...watch,
|
|
43
|
+
lastActivityAt: timestamp,
|
|
44
|
+
nudgeCount: 0,
|
|
45
|
+
nextActionAt: plus(at, watch.idleMs),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function inspectProgressWatchDue(watch, input) {
|
|
49
|
+
iso(input.at);
|
|
50
|
+
if (input.at < Date.parse(watch.nextActionAt))
|
|
51
|
+
return { kind: "not_due" };
|
|
52
|
+
if (!input.bothIdle) {
|
|
53
|
+
return {
|
|
54
|
+
kind: "rescheduled",
|
|
55
|
+
watch: recordProgressWatchActivity(watch, input.at),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (watch.nudgeCount < 2) {
|
|
59
|
+
return { kind: "nudge", nudgeNumber: (watch.nudgeCount + 1) };
|
|
170
60
|
}
|
|
61
|
+
return { kind: "settled", reason: "idle_timeout" };
|
|
62
|
+
}
|
|
63
|
+
export function commitProgressWatchNudge(watch, input) {
|
|
64
|
+
iso(input.at);
|
|
65
|
+
if (input.at < Date.parse(watch.nextActionAt) ||
|
|
66
|
+
input.nudgeNumber !== watch.nudgeCount + 1) {
|
|
67
|
+
throw new RangeError("INVALID_PROGRESS_WATCH_NUDGE");
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
...watch,
|
|
71
|
+
nudgeCount: input.nudgeNumber,
|
|
72
|
+
nextActionAt: plus(input.at, watch.idleMs * (input.nudgeNumber === 1 ? 1 : 2)),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export function deferProgressWatchNudge(watch, at) {
|
|
76
|
+
return {
|
|
77
|
+
...watch,
|
|
78
|
+
nextActionAt: plus(at, PROGRESS_WATCH_NUDGE_RETRY_MS),
|
|
79
|
+
};
|
|
171
80
|
}
|
|
172
81
|
//# sourceMappingURL=progress-watch-machine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-watch-machine.js","sourceRoot":"","sources":["../../../src/gateway/progress-watch-machine.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"progress-watch-machine.js","sourceRoot":"","sources":["../../../src/gateway/progress-watch-machine.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,QAAQ;IACR,UAAU;IACV,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,GAAG,MAAM,CAAC;AACzD,MAAM,CAAC,MAAM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D,MAAM,IAAI,UAAU,CAAC,8BAA8B,CAAC,CAAC;IACvD,CAAC;IACD,OAAO;QACL,GAAG,KAAK;QACR,UAAU,EAAE,KAAK,CAAC,WAAW;QAC7B,YAAY,EAAE,IAAI,CAChB,KAAK,CAAC,EAAE,EACR,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACjD;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,KAAoB,EACpB,EAAU;IAEV,OAAO;QACL,GAAG,KAAK;QACR,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE,6BAA6B,CAAC;KACtD,CAAC;AACJ,CAAC"}
|
|
@@ -8,6 +8,8 @@ export type ComposeProvenanceEnvelopeInput = Readonly<{
|
|
|
8
8
|
conversationId: string;
|
|
9
9
|
body: string;
|
|
10
10
|
progressWatchActive?: true;
|
|
11
|
+
/** Older accepted rows on this exact route when a STEER is injected. */
|
|
12
|
+
queuedAhead?: number;
|
|
11
13
|
}>;
|
|
12
14
|
/**
|
|
13
15
|
* Adds broker-owned, Claude-compatible textual framing at the provider write
|
|
@@ -4,7 +4,7 @@ export const PROVENANCE_RAW_BODY_MAX_BYTES = 16 * 1024;
|
|
|
4
4
|
export const PROVENANCE_ENVELOPE_MAX_BYTES = 64 * 1024;
|
|
5
5
|
const ALIAS_PATTERN = /^[a-z][a-z0-9_-]{0,31}@[a-z0-9](?:[a-z0-9.-]{0,61}[a-z0-9])?$/;
|
|
6
6
|
const CONVERSATION_ID_PATTERN = /^conv_[A-Za-z0-9_-]{16,64}$/;
|
|
7
|
-
const RESERVED_TAG_PATTERN = /<(?=\/?(?:cross-session-message|embassy-reply-hint|embassy-track-active)(?:[>\s/]|$))/giu;
|
|
7
|
+
const RESERVED_TAG_PATTERN = /<(?=\/?(?:cross-session-message|embassy-reply-hint|embassy-track-active|embassy-queued-ahead)(?:[>\s/]|$))/giu;
|
|
8
8
|
const CLAUDE_FROM_NAME_MAX_CODEPOINTS = 64;
|
|
9
9
|
const LONG_ALIAS_PREFIX_CODEPOINTS = 47;
|
|
10
10
|
const LONG_ALIAS_HASH_HEX_LENGTH = 16;
|
|
@@ -26,7 +26,11 @@ function validateInput(input) {
|
|
|
26
26
|
!CONVERSATION_ID_PATTERN.test(input.conversationId) ||
|
|
27
27
|
typeof input.body !== "string" ||
|
|
28
28
|
(input.progressWatchActive !== undefined &&
|
|
29
|
-
input.progressWatchActive !== true)
|
|
29
|
+
input.progressWatchActive !== true) ||
|
|
30
|
+
(input.queuedAhead !== undefined &&
|
|
31
|
+
(input.direction !== "codex" ||
|
|
32
|
+
!Number.isSafeInteger(input.queuedAhead) ||
|
|
33
|
+
input.queuedAhead < 1))) {
|
|
30
34
|
invalidEnvelope();
|
|
31
35
|
}
|
|
32
36
|
if (Buffer.byteLength(input.body, "utf8") > PROVENANCE_RAW_BODY_MAX_BYTES) {
|
|
@@ -76,9 +80,15 @@ export function composeProvenanceEnvelope(input) {
|
|
|
76
80
|
"conversation. Reply with a leading `DONE:` when the assigned work " +
|
|
77
81
|
"is complete; that completion closes the watch.</embassy-track-active>"
|
|
78
82
|
: "";
|
|
83
|
+
const queuedAheadMarker = input.queuedAhead === undefined
|
|
84
|
+
? ""
|
|
85
|
+
: `\n<embassy-queued-ahead count="${input.queuedAhead}">` +
|
|
86
|
+
`${input.queuedAhead} earlier ${input.queuedAhead === 1 ? "message is" : "messages are"} ` +
|
|
87
|
+
"queued for this route and will arrive at your next turn " +
|
|
88
|
+
"boundaries.</embassy-queued-ahead>";
|
|
79
89
|
const body = neutralizeReservedTags(input.body);
|
|
80
90
|
const envelope = `<cross-session-message from-name="${fromName}"${conversationAttribute}>\n` +
|
|
81
|
-
`${hint}${trackMarker}\n${body}\n</cross-session-message>`;
|
|
91
|
+
`${hint}${trackMarker}${queuedAheadMarker}\n${body}\n</cross-session-message>`;
|
|
82
92
|
if (Buffer.byteLength(envelope, "utf8") > PROVENANCE_ENVELOPE_MAX_BYTES) {
|
|
83
93
|
envelopeTooLarge();
|
|
84
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provenance-envelope.js","sourceRoot":"","sources":["../../../src/gateway/provenance-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,GAAG,IAAI,CAAC;AACvD,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvD,MAAM,aAAa,GACjB,+DAA+D,CAAC;AAClE,MAAM,uBAAuB,GAAG,6BAA6B,CAAC;AAC9D,MAAM,oBAAoB,GACxB,
|
|
1
|
+
{"version":3,"file":"provenance-envelope.js","sourceRoot":"","sources":["../../../src/gateway/provenance-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,GAAG,IAAI,CAAC;AACvD,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvD,MAAM,aAAa,GACjB,+DAA+D,CAAC;AAClE,MAAM,uBAAuB,GAAG,6BAA6B,CAAC;AAC9D,MAAM,oBAAoB,GACxB,+GAA+G,CAAC;AAClH,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAC3C,MAAM,4BAA4B,GAAG,EAAE,CAAC;AACxC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAetC,SAAS,eAAe;IACtB,MAAM,IAAI,WAAW,CACnB,6BAA6B,EAC7B,8CAA8C,CAC/C,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB;IACvB,MAAM,IAAI,WAAW,CAC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AAI,GACR,qCAAqC,KAAK,CAAC,cAAc,GAAG;QAC5D,cAAc,KAAK,CAAC,WAAW,IAAI,oBAAoB,GAAG;QAC1D,sBAAsB,YAAY,mCAAmC;QACrE,4EAA4E,CAAC;IAC/E,MAAM,WAAW,GACf,KAAK,CAAC,mBAAmB,KAAK,IAAI;QAChC,CAAC,CAAC,kEAAkE;YAClE,oEAAoE;YACpE,uEAAuE;QACzE,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,iBAAiB,GACrB,KAAK,CAAC,WAAW,KAAK,SAAS;QAC7B,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,kCAAkC,KAAK,CAAC,WAAW,IAAI;YACvD,GAAG,KAAK,CAAC,WAAW,YAAY,KAAK,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,GAAG;YAC1F,0DAA0D;YAC1D,oCAAoC,CAAC;IAC3C,MAAM,IAAI,GAAG,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,QAAQ,GACZ,qCAAqC,QAAQ,IAAI,qBAAqB,KAAK;QAC3E,GAAG,IAAI,GAAG,WAAW,GAAG,iBAAiB,KAAK,IAAI,4BAA4B,CAAC;IAEjF,IACE,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,6BAA6B,EACnE,CAAC;QACD,gBAAgB,EAAE,CAAC;IACrB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -6,12 +6,14 @@ import type { LocalCodexTransportFactory } from "./codex-local-transport.js";
|
|
|
6
6
|
import type { GatewayDeliveryNoticeMode } from "./config.js";
|
|
7
7
|
import type { ClaudeNativeHelperFactory } from "./claude-helper-client.js";
|
|
8
8
|
import { type DashboardLocale } from "./locale.js";
|
|
9
|
-
import type { GatewayAdapterCallbacks, GatewayAdapterDiscoverySnapshot, GatewayAdapterDispatchResult, GatewayAdapterEndpointRefresh, GatewayAdapterDispatchInput, GatewayAdapterRouteState, GatewayAdapterStart, GatewayProviderAdapter } from "./service.js";
|
|
10
|
-
import type { PrivateEndpointIdentity
|
|
9
|
+
import type { GatewayAdapterCallbacks, GatewayAdapterDiscoverySnapshot, GatewayAdapterDispatchResult, GatewayAdapterEndpointRefresh, GatewayAdapterDispatchInput, GatewayAdapterRouteState, GatewayAdapterRegistryObservation, GatewayAdapterStart, GatewayProviderAdapter } from "./service.js";
|
|
10
|
+
import type { PrivateEndpointIdentity } from "./types.js";
|
|
11
11
|
type ClaudePeerFactory = (runtime: AttestedClaudePeerRuntime, locale: DashboardLocale, deliveryNotices: GatewayDeliveryNoticeMode) => ClaudePeerAdapter;
|
|
12
12
|
export type LocalClaudeGatewayProviderOptions = {
|
|
13
13
|
/** Exact result of attestClaudePeerRuntime; paths are never rediscovered. */
|
|
14
14
|
runtime: AttestedClaudePeerRuntime;
|
|
15
|
+
/** OS-attested launcher version used only for compatibility classification. */
|
|
16
|
+
compatibilityVersion?: string;
|
|
15
17
|
hostId?: "this-mac";
|
|
16
18
|
/** Locale for bounded notices written into native Claude sessions. */
|
|
17
19
|
locale?: DashboardLocale;
|
|
@@ -52,6 +54,62 @@ export type CodexRouteSuccessionBarrier = Readonly<{
|
|
|
52
54
|
pendingCallbacks: number;
|
|
53
55
|
clean: boolean;
|
|
54
56
|
}>;
|
|
57
|
+
export type IncompatibleGatewayProviderOptions = Readonly<{
|
|
58
|
+
identity: PrivateEndpointIdentity;
|
|
59
|
+
version: string;
|
|
60
|
+
probes: readonly CompatibilityProbeResult[];
|
|
61
|
+
safeErrorCode: string;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* A bounded observation-only surface for an installed provider generation
|
|
65
|
+
* whose protocol cannot be used safely. It deliberately performs no provider
|
|
66
|
+
* discovery, listener construction, route selection, or message write.
|
|
67
|
+
*/
|
|
68
|
+
export declare class IncompatibleGatewayProvider implements GatewayProviderAdapter {
|
|
69
|
+
readonly identity: PrivateEndpointIdentity;
|
|
70
|
+
readonly protocol = "not-attested";
|
|
71
|
+
readonly protocolVersion = "unknown";
|
|
72
|
+
private readonly version;
|
|
73
|
+
private readonly probes;
|
|
74
|
+
private readonly safeErrorCode;
|
|
75
|
+
private initialized;
|
|
76
|
+
private closed;
|
|
77
|
+
constructor(options: IncompatibleGatewayProviderOptions);
|
|
78
|
+
compatibilitySurface(): CompatibilitySurfaceObservation;
|
|
79
|
+
runCompatibilityProbes(): Promise<readonly CompatibilityProbeResult[]>;
|
|
80
|
+
acceptCompatibilityAttestation(attestation: CompatibilityAttestation): void;
|
|
81
|
+
initialize(_callbacks: GatewayAdapterCallbacks): Promise<GatewayAdapterStart>;
|
|
82
|
+
discoverClaudePeers(): Promise<GatewayAdapterDiscoverySnapshot>;
|
|
83
|
+
selectRoute(_input: {
|
|
84
|
+
alias: string;
|
|
85
|
+
routeHandle: string;
|
|
86
|
+
}): Promise<{
|
|
87
|
+
routeHandle: string;
|
|
88
|
+
state: GatewayAdapterRouteState;
|
|
89
|
+
}>;
|
|
90
|
+
assertWorkspaceDisjoint(_routeHandle: string, _stateRoot: string): Promise<void>;
|
|
91
|
+
resolveReplyAddress(_address: string): Promise<{
|
|
92
|
+
routeHandle: string;
|
|
93
|
+
}>;
|
|
94
|
+
advertiseNativeCodexPeer(_input: {
|
|
95
|
+
alias: string;
|
|
96
|
+
cwd: string;
|
|
97
|
+
}): Promise<void>;
|
|
98
|
+
dispatch(_input: GatewayAdapterDispatchInput): Promise<GatewayAdapterDispatchResult>;
|
|
99
|
+
releaseRoute(_routeHandle: string): Promise<void>;
|
|
100
|
+
close(): Promise<void>;
|
|
101
|
+
private unavailable;
|
|
102
|
+
}
|
|
103
|
+
export declare function createIncompatibleClaudeGatewayProvider(options: Readonly<{
|
|
104
|
+
runtime: AttestedClaudePeerRuntime;
|
|
105
|
+
version: string;
|
|
106
|
+
safeErrorCode: string;
|
|
107
|
+
}>): IncompatibleGatewayProvider;
|
|
108
|
+
export declare function createIncompatibleCodexGatewayProvider(options: Readonly<{
|
|
109
|
+
identity: PrivateEndpointIdentity;
|
|
110
|
+
version: string;
|
|
111
|
+
safeErrorCode: string;
|
|
112
|
+
}>): IncompatibleGatewayProvider;
|
|
55
113
|
export declare class LocalClaudeGatewayProvider implements GatewayProviderAdapter {
|
|
56
114
|
readonly identity: PrivateEndpointIdentity;
|
|
57
115
|
readonly protocol = "claude-peer";
|
|
@@ -85,6 +143,7 @@ export declare class LocalClaudeGatewayProvider implements GatewayProviderAdapte
|
|
|
85
143
|
/** Provider-owned terminal rejections that never enter the service queue. */
|
|
86
144
|
private readonly rejectedNativeInbound;
|
|
87
145
|
private discoveryInFlight;
|
|
146
|
+
private registryObservation;
|
|
88
147
|
private monitorTimer;
|
|
89
148
|
/** Invocation-ordered registry mutations; the tail itself never rejects. */
|
|
90
149
|
private nativeCodexRegistrationTail;
|
|
@@ -95,11 +154,16 @@ export declare class LocalClaudeGatewayProvider implements GatewayProviderAdapte
|
|
|
95
154
|
private retiredNativeCodexListener;
|
|
96
155
|
/** Fences discovery callbacks and monitor restarts across listener rotation. */
|
|
97
156
|
private nativeCodexSuccessionFreeze;
|
|
157
|
+
/** A completed failed probe set fences every authority-bearing operation. */
|
|
158
|
+
private compatibilityBlocked;
|
|
159
|
+
private compatibilityFailureCode;
|
|
98
160
|
private initialized;
|
|
99
161
|
private closed;
|
|
100
162
|
constructor(options: LocalClaudeGatewayProviderOptions);
|
|
101
163
|
compatibilitySurface(): CompatibilitySurfaceObservation;
|
|
102
164
|
runCompatibilityProbes(): Promise<readonly CompatibilityProbeResult[]>;
|
|
165
|
+
latestRegistryObservation(): GatewayAdapterRegistryObservation | undefined;
|
|
166
|
+
acceptCompatibilityAttestation(attestation: CompatibilityAttestation): void;
|
|
103
167
|
initialize(callbacks: GatewayAdapterCallbacks): Promise<GatewayAdapterStart>;
|
|
104
168
|
discoverClaudePeers(): Promise<GatewayAdapterDiscoverySnapshot>;
|
|
105
169
|
assertWorkspaceDisjoint(routeHandle: string, stateRoot: string): Promise<void>;
|
|
@@ -150,18 +214,7 @@ export declare class LocalClaudeGatewayProvider implements GatewayProviderAdapte
|
|
|
150
214
|
notifyNativeInboundProgress(receiptHandle: string, progress: ClaudePeerInboundProgress): Promise<void>;
|
|
151
215
|
releaseNativeInboundReceipt(receiptHandle: string): Promise<boolean>;
|
|
152
216
|
quiesceNativeInbound(): Promise<void>;
|
|
153
|
-
dispatch(input:
|
|
154
|
-
sourceAlias: string;
|
|
155
|
-
targetAlias: string;
|
|
156
|
-
conversationId: string;
|
|
157
|
-
binding: PrivateRouteBinding;
|
|
158
|
-
authorization: "selected_route" | "native_reply";
|
|
159
|
-
messageId: string;
|
|
160
|
-
text: string;
|
|
161
|
-
expectsReply: boolean;
|
|
162
|
-
deadlineAt: string;
|
|
163
|
-
progressWatchActive?: true;
|
|
164
|
-
}): Promise<GatewayAdapterDispatchResult>;
|
|
217
|
+
dispatch(input: GatewayAdapterDispatchInput): Promise<GatewayAdapterDispatchResult>;
|
|
165
218
|
releaseRoute(routeHandle: string): Promise<void>;
|
|
166
219
|
close(): Promise<void>;
|
|
167
220
|
private assertReady;
|
|
@@ -192,7 +245,7 @@ export declare class LocalClaudeGatewayProvider implements GatewayProviderAdapte
|
|
|
192
245
|
export declare function createLocalClaudeGatewayProvider(options: LocalClaudeGatewayProviderOptions): LocalClaudeGatewayProvider;
|
|
193
246
|
export type LocalCodexGatewayProviderOptions = {
|
|
194
247
|
factory: LocalCodexTransportFactory;
|
|
195
|
-
/** Re-resolves the
|
|
248
|
+
/** Re-resolves the managed install after its generation moves. */
|
|
196
249
|
refreshFactory?: () => Promise<LocalCodexTransportFactory>;
|
|
197
250
|
cleanupPollMs?: number;
|
|
198
251
|
cleanupTimeoutMs?: number;
|
|
@@ -235,6 +288,7 @@ export declare class LocalCodexGatewayProvider implements GatewayProviderAdapter
|
|
|
235
288
|
private endpointActivationRetryTimer;
|
|
236
289
|
private callbackDrainFrozen;
|
|
237
290
|
private compatibilityAttested;
|
|
291
|
+
private compatibilityFailureCode;
|
|
238
292
|
private endpointUnavailable;
|
|
239
293
|
private pendingEndpointAttestation;
|
|
240
294
|
private pendingEndpointRefreshEvent;
|