pilotswarm-sdk 0.5.0 → 0.5.2
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/api/src/http-api-transport.js +10 -0
- package/api/src/protocol.js +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +12 -0
- package/dist/client.js.map +1 -1
- package/dist/cms.d.ts +10 -0
- package/dist/cms.d.ts.map +1 -1
- package/dist/cms.js +15 -0
- package/dist/cms.js.map +1 -1
- package/dist/management-client.d.ts +20 -0
- package/dist/management-client.d.ts.map +1 -1
- package/dist/management-client.js +45 -4
- package/dist/management-client.js.map +1 -1
- package/dist/model-providers.d.ts +20 -0
- package/dist/model-providers.d.ts.map +1 -1
- package/dist/model-providers.js +64 -9
- package/dist/model-providers.js.map +1 -1
- package/dist/orchestration/agents.d.ts.map +1 -1
- package/dist/orchestration/agents.js +9 -1
- package/dist/orchestration/agents.js.map +1 -1
- package/dist/orchestration/index.d.ts +2 -2
- package/dist/orchestration/index.js +1 -1
- package/dist/orchestration/runtime.d.ts +1 -1
- package/dist/orchestration/turn.d.ts.map +1 -1
- package/dist/orchestration/turn.js +31 -3
- package/dist/orchestration/turn.js.map +1 -1
- package/dist/orchestration-registry.d.ts.map +1 -1
- package/dist/orchestration-registry.js +4 -2
- package/dist/orchestration-registry.js.map +1 -1
- package/dist/orchestration-version.d.ts +1 -1
- package/dist/orchestration-version.js +1 -1
- package/dist/orchestration.d.ts +2 -2
- package/dist/orchestration.js +1 -1
- package/dist/orchestration_1_0_46.d.ts +1 -1
- package/dist/orchestration_1_0_47.d.ts +1 -1
- package/dist/orchestration_1_0_48.d.ts +1 -1
- package/dist/orchestration_1_0_49.d.ts +1 -1
- package/dist/orchestration_1_0_50.d.ts +1 -1
- package/dist/orchestration_1_0_58/agents.d.ts +41 -0
- package/dist/orchestration_1_0_58/agents.d.ts.map +1 -0
- package/dist/orchestration_1_0_58/agents.js +758 -0
- package/dist/orchestration_1_0_58/agents.js.map +1 -0
- package/dist/orchestration_1_0_58/index.d.ts +24 -0
- package/dist/orchestration_1_0_58/index.d.ts.map +1 -0
- package/dist/orchestration_1_0_58/index.js +13 -0
- package/dist/orchestration_1_0_58/index.js.map +1 -0
- package/dist/orchestration_1_0_58/lifecycle.d.ts +48 -0
- package/dist/orchestration_1_0_58/lifecycle.d.ts.map +1 -0
- package/dist/orchestration_1_0_58/lifecycle.js +546 -0
- package/dist/orchestration_1_0_58/lifecycle.js.map +1 -0
- package/dist/orchestration_1_0_58/queue.d.ts +7 -0
- package/dist/orchestration_1_0_58/queue.d.ts.map +1 -0
- package/dist/orchestration_1_0_58/queue.js +644 -0
- package/dist/orchestration_1_0_58/queue.js.map +1 -0
- package/dist/orchestration_1_0_58/runtime.d.ts +29 -0
- package/dist/orchestration_1_0_58/runtime.d.ts.map +1 -0
- package/dist/orchestration_1_0_58/runtime.js +199 -0
- package/dist/orchestration_1_0_58/runtime.js.map +1 -0
- package/dist/orchestration_1_0_58/state.d.ts +130 -0
- package/dist/orchestration_1_0_58/state.d.ts.map +1 -0
- package/dist/orchestration_1_0_58/state.js +115 -0
- package/dist/orchestration_1_0_58/state.js.map +1 -0
- package/dist/orchestration_1_0_58/turn.d.ts +30 -0
- package/dist/orchestration_1_0_58/turn.d.ts.map +1 -0
- package/dist/orchestration_1_0_58/turn.js +1107 -0
- package/dist/orchestration_1_0_58/turn.js.map +1 -0
- package/dist/orchestration_1_0_58/utils.d.ts +22 -0
- package/dist/orchestration_1_0_58/utils.d.ts.map +1 -0
- package/dist/orchestration_1_0_58/utils.js +226 -0
- package/dist/orchestration_1_0_58/utils.js.map +1 -0
- package/dist/session-lifecycle.d.ts +39 -5
- package/dist/session-lifecycle.d.ts.map +1 -1
- package/dist/session-lifecycle.js +143 -76
- package/dist/session-lifecycle.js.map +1 -1
- package/dist/session-manager.d.ts +7 -0
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +67 -14
- package/dist/session-manager.js.map +1 -1
- package/dist/session-proxy.d.ts +1 -1
- package/dist/session-proxy.d.ts.map +1 -1
- package/dist/session-proxy.js +50 -2
- package/dist/session-proxy.js.map +1 -1
- package/dist/web/web-management-client.d.ts +2 -0
- package/dist/web/web-management-client.d.ts.map +1 -1
- package/dist/web/web-management-client.js +6 -0
- package/dist/web/web-management-client.js.map +1 -1
- package/dist/worker.d.ts +3 -0
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +25 -3
- package/dist/worker.js.map +1 -1
- package/package.json +2 -2
|
@@ -4,26 +4,32 @@
|
|
|
4
4
|
*
|
|
5
5
|
* The whole lifecycle lives inside the single runTurn activity (principle
|
|
6
6
|
* P5 — no other session activity depends on landing where a previous one
|
|
7
|
-
* did):
|
|
7
|
+
* did). Reconcile is STORE-WINS (docs/proposals/snapshot-store-wins.md): one
|
|
8
|
+
* probe per turn is the only oracle — never the orchestration's expectation,
|
|
9
|
+
* which goes stale the moment a stopped/zombie turn advances the store the
|
|
10
|
+
* control plane discarded.
|
|
8
11
|
*
|
|
9
|
-
* preamble p1.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* preamble p1. one probe. Store bears this turn's own turnKey →
|
|
13
|
+
* already-committed recovery (restore, never replay).
|
|
14
|
+
* p2. store empty → trust a clean local dir (only truth), else fresh;
|
|
15
|
+
* legacy snapshot → trust clean local, else hydrate.
|
|
16
|
+
* p3. warm ONLY when a clean local dir's marker matches the store's
|
|
17
|
+
* (version AND content hash); every other state — store ahead
|
|
18
|
+
* (a discarded/foreign turn advanced it — NO fence, we adopt it),
|
|
19
|
+
* a same-version content swap, a torn/dirty dir, or no marker —
|
|
20
|
+
* hydrates the store. Store below the marker is hydrated too and
|
|
21
|
+
* flagged `regressed`.
|
|
22
|
+
* p4. (caller) write the turn sentinel just before the body
|
|
16
23
|
* postamble c1. write .ps-turn-commit.json {turnKey, result} into the dir
|
|
17
|
-
* c2.
|
|
18
|
-
* → restore the winner's snapshot + result
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* and must fail loudly instead of re-applying its turn.
|
|
24
|
+
* c2. commit the tar (store.commitSnapshot) at base+1. alreadyCommitted
|
|
25
|
+
* (same turnKey) → restore the winner's snapshot + result. A
|
|
26
|
+
* SnapshotConflictError (store moved off base while we ran) is NOT
|
|
27
|
+
* fatal: the turn is left UNPUBLISHED (superseded), the sentinel
|
|
28
|
+
* stays dirty so the next preamble rehydrates the winner, and the
|
|
29
|
+
* caller emits `session.snapshot_unpublished`. A user-stopped
|
|
30
|
+
* result skips the commit entirely (also unpublished).
|
|
31
|
+
* c3. write the local version marker (published turns only)
|
|
32
|
+
* c4. clear the turn sentinel (published turns only)
|
|
27
33
|
*
|
|
28
34
|
* @internal
|
|
29
35
|
*/
|
|
@@ -46,6 +52,19 @@ function sessionDirOf(ctx) {
|
|
|
46
52
|
function hasUsableSessionLayout(sessionDir) {
|
|
47
53
|
return fs.existsSync(path.join(sessionDir, "workspace.yaml"));
|
|
48
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Content-identity gate for the warm fast path. Only a mismatch between two
|
|
57
|
+
* PRESENT hashes forces a hydrate (a rule-breaking restore that overwrote the
|
|
58
|
+
* same version number with different content — the ETag CAS can't catch that,
|
|
59
|
+
* §5.1). When either side lacks a hash (a legacy marker/probe), fall back to
|
|
60
|
+
* version-only trust so an upgrade doesn't churn every warm worker into a
|
|
61
|
+
* spurious one-time hydrate.
|
|
62
|
+
*/
|
|
63
|
+
function contentMatches(markerHash, probeHash) {
|
|
64
|
+
if (markerHash && probeHash)
|
|
65
|
+
return markerHash === probeHash;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
49
68
|
function markerFromHydrate(sessionDir, hydrated) {
|
|
50
69
|
writeSnapshotMarker(sessionDir, {
|
|
51
70
|
version: hydrated.version,
|
|
@@ -72,7 +91,7 @@ async function recoverAlreadyCommitted(ctx) {
|
|
|
72
91
|
`turn-commit file is missing/unreadable; degrading to hydrated re-run`);
|
|
73
92
|
return { kind: "hydrated", baseVersion: hydrated.version, storeBehindExpected: false };
|
|
74
93
|
}
|
|
75
|
-
async function resolveFromStore(ctx) {
|
|
94
|
+
async function resolveFromStore(ctx, regressed) {
|
|
76
95
|
const sessionDir = sessionDirOf(ctx);
|
|
77
96
|
await ctx.dropWarmSession();
|
|
78
97
|
const hydrated = await ctx.store.hydrateSnapshot(ctx.sessionId);
|
|
@@ -83,83 +102,89 @@ async function resolveFromStore(ctx) {
|
|
|
83
102
|
ctx.trace(`session=${ctx.sessionId} store snapshot v${hydrated.version} is BEHIND the orchestration's ` +
|
|
84
103
|
`expected v${ctx.expectedVersion} (store restored from backup?); proceeding from stored state`);
|
|
85
104
|
}
|
|
86
|
-
|
|
105
|
+
if (regressed) {
|
|
106
|
+
ctx.trace(`session=${ctx.sessionId} store snapshot v${regressed.storeVersion} is BELOW the local marker ` +
|
|
107
|
+
`v${regressed.markerVersion} (store restored/lost data); store wins — hydrating v${hydrated.version}`);
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
kind: "hydrated",
|
|
111
|
+
baseVersion: hydrated.version,
|
|
112
|
+
storeBehindExpected,
|
|
113
|
+
...(regressed ? { regressed } : {}),
|
|
114
|
+
};
|
|
87
115
|
}
|
|
88
116
|
/**
|
|
89
|
-
* Preamble (
|
|
90
|
-
* getOrCreate.
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
117
|
+
* Preamble (store-wins). Runs under the per-session run-turn lock, before
|
|
118
|
+
* getOrCreate. ONE probe per turn is the reconcile oracle — never the
|
|
119
|
+
* orchestration's `expectedVersion`, which goes stale the moment a stopped or
|
|
120
|
+
* zombie turn advances the store the control plane discarded (the divergence
|
|
121
|
+
* this protocol removes). On return the local dir is in exactly one state:
|
|
122
|
+
* trusted at `baseVersion` (warm — local marker matches the store's
|
|
123
|
+
* version+hash), restored at the stored version (hydrated — the store wins),
|
|
124
|
+
* absent (fresh), or restored at this turn's committed version
|
|
125
|
+
* (already-committed — the caller returns the stored result without a body).
|
|
94
126
|
*/
|
|
95
127
|
export async function runTurnPreamble(ctx) {
|
|
96
128
|
const sessionDir = sessionDirOf(ctx);
|
|
97
129
|
const sentinel = readTurnSentinel(sessionDir);
|
|
98
130
|
const marker = readSnapshotMarker(sessionDir);
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
if (!sentinel && marker && marker.version === ctx.expectedVersion && localDirUsable) {
|
|
105
|
-
return { kind: "warm", baseVersion: marker.version };
|
|
106
|
-
}
|
|
131
|
+
const localDirUsable = fs.existsSync(sessionDir) && hasUsableSessionLayout(sessionDir);
|
|
132
|
+
// Store-wins: one metadata probe is the ONLY oracle. `expectedVersion`
|
|
133
|
+
// rides in the input for frozen orchestration versions but is load-bearing
|
|
134
|
+
// for nothing here except the lossy-replay observability flag.
|
|
135
|
+
const probe = await ctx.store.probeSnapshot(ctx.sessionId);
|
|
107
136
|
if (sentinel) {
|
|
108
137
|
ctx.trace(`session=${ctx.sessionId} turn sentinel present (started ${sentinel.startedAt || "unknown"}); ` +
|
|
109
138
|
`local dir untrusted, resolving from store`);
|
|
110
139
|
}
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// exactly this local shape while the store already has v1).
|
|
117
|
-
if (!sentinel && !marker && ctx.expectedVersion === 0 && localDirUsable) {
|
|
118
|
-
const probe0 = await ctx.store.probeSnapshot(ctx.sessionId);
|
|
119
|
-
if (!probe0.exists || probe0.legacy) {
|
|
120
|
-
return { kind: "warm", baseVersion: 0 };
|
|
121
|
-
}
|
|
122
|
-
if (probe0.turnKey && probe0.turnKey === ctx.turnKey) {
|
|
123
|
-
return recoverAlreadyCommitted(ctx);
|
|
124
|
-
}
|
|
125
|
-
ctx.trace(`session=${ctx.sessionId} unmarked local dir but the store holds versioned v${probe0.version}; ` +
|
|
126
|
-
`resolving from store`);
|
|
127
|
-
return resolveFromStore(ctx);
|
|
140
|
+
// Idempotency (keeper): the store bears THIS turn's own key — a prior
|
|
141
|
+
// attempt of this very turn already committed (crash-after-commit, or a
|
|
142
|
+
// racing drain/lock-steal duplicate). Restore, never replay.
|
|
143
|
+
if (probe.exists && probe.turnKey && probe.turnKey === ctx.turnKey) {
|
|
144
|
+
return recoverAlreadyCommitted(ctx);
|
|
128
145
|
}
|
|
129
|
-
//
|
|
130
|
-
// resolve from the store.
|
|
131
|
-
const probe = await ctx.store.probeSnapshot(ctx.sessionId);
|
|
146
|
+
// Store holds nothing.
|
|
132
147
|
if (!probe.exists) {
|
|
133
|
-
//
|
|
134
|
-
//
|
|
148
|
+
// A clean, usable local dir is the best (only) data — trust it over a
|
|
149
|
+
// fresh replay; the fresh chain publishes from here.
|
|
135
150
|
if (!sentinel && localDirUsable) {
|
|
136
|
-
ctx.trace(`session=${ctx.sessionId} store empty but clean local dir exists ` +
|
|
137
|
-
`(marker=${marker?.version ?? "none"} expected=${ctx.expectedVersion}); using local files`);
|
|
138
151
|
return { kind: "warm", baseVersion: marker?.version ?? 0 };
|
|
139
152
|
}
|
|
140
153
|
// Dirty or unusable local + empty store → fresh; lossy iff turns had
|
|
141
|
-
// been committed before (
|
|
154
|
+
// been committed before (marker present, or a frozen orchestration
|
|
155
|
+
// still reports a nonzero expected version). W3 in the protocol doc.
|
|
142
156
|
await ctx.dropWarmSession();
|
|
143
157
|
fs.rmSync(sessionDir, { recursive: true, force: true });
|
|
144
|
-
return { kind: "fresh", baseVersion: 0, lossy: ctx.expectedVersion > 0 };
|
|
158
|
+
return { kind: "fresh", baseVersion: 0, lossy: (marker?.version ?? ctx.expectedVersion) > 0 };
|
|
145
159
|
}
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
160
|
+
// Legacy snapshot (pre-protocol, no version metadata, counts as v0): a
|
|
161
|
+
// clean local dir is still trustworthy; otherwise hydrate what's stored.
|
|
162
|
+
if (probe.legacy) {
|
|
163
|
+
if (!sentinel && localDirUsable) {
|
|
164
|
+
return { kind: "warm", baseVersion: marker?.version ?? 0 };
|
|
165
|
+
}
|
|
166
|
+
return resolveFromStore(ctx);
|
|
151
167
|
}
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
// Regressed: the store sits BELOW this worker's own marker — a restore from
|
|
169
|
+
// an older backup, or store data loss. Anomalous (surfaced by the caller),
|
|
170
|
+
// but the store still wins: we hydrate what it holds.
|
|
171
|
+
const regressed = marker && probe.version < marker.version
|
|
172
|
+
? { markerVersion: marker.version, storeVersion: probe.version }
|
|
173
|
+
: undefined;
|
|
174
|
+
// Warm fast path: a clean local dir whose marker names EXACTLY the stored
|
|
175
|
+
// state — same version AND (when both carry a hash) same content. The
|
|
176
|
+
// layout anchor guards a marker orphaned by a torn delete; the hash guards
|
|
177
|
+
// a rule-breaking same-version restore (§5.1). Only branch that trusts
|
|
178
|
+
// local files without hydrating.
|
|
179
|
+
if (!sentinel && localDirUsable && marker
|
|
180
|
+
&& marker.version === probe.version
|
|
181
|
+
&& contentMatches(marker.contentHash, probe.contentHash)) {
|
|
182
|
+
return { kind: "warm", baseVersion: marker.version };
|
|
159
183
|
}
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
|
|
184
|
+
// Store wins for everything else: store AHEAD (a discarded/foreign turn
|
|
185
|
+
// advanced it — the incident; adopt it, no zombie fence), a same-version
|
|
186
|
+
// content swap, a torn/dirty dir, or no marker.
|
|
187
|
+
return resolveFromStore(ctx, regressed);
|
|
163
188
|
}
|
|
164
189
|
/**
|
|
165
190
|
* Last-resort recovery when getOrCreate fails on missing/lost local state
|
|
@@ -189,6 +214,28 @@ export async function attemptStoreRecovery(ctx) {
|
|
|
189
214
|
* adopted, discarding this attempt's divergent local state.
|
|
190
215
|
*/
|
|
191
216
|
export async function runTurnCommit(ctx, baseVersion, result) {
|
|
217
|
+
// Stop-turn divergence guard: a user-stopped turn (result type "stopped")
|
|
218
|
+
// is discarded by the orchestration (stop won the ctx.race →
|
|
219
|
+
// handleTurnStopped; this runTurn is the dropped race loser) and its
|
|
220
|
+
// turnKey is never re-run. Committing its snapshot would advance the
|
|
221
|
+
// stored version while the orchestration keeps state.snapshotVersion at the
|
|
222
|
+
// base — leaving the store one ahead so every later turn fails the CAS
|
|
223
|
+
// (zombie-duplicate fence: "expected N, found N+1"). Skip the commit and
|
|
224
|
+
// leave the .ps-turn-inprogress sentinel in place so the next preamble
|
|
225
|
+
// re-hydrates the base version and discards this partial turn. (Drain and
|
|
226
|
+
// lock-steal classify as "cancelled", not "stopped", and DO commit so their
|
|
227
|
+
// same-turnKey re-run adopts the already-committed snapshot.)
|
|
228
|
+
if (result?.type === "stopped") {
|
|
229
|
+
ctx.trace(`session=${ctx.sessionId} user-stopped turn: skipping snapshot commit at ` +
|
|
230
|
+
`base v${baseVersion}; sentinel left dirty for next-turn re-hydrate`);
|
|
231
|
+
return {
|
|
232
|
+
version: baseVersion,
|
|
233
|
+
contentHash: "",
|
|
234
|
+
alreadyCommitted: false,
|
|
235
|
+
published: false,
|
|
236
|
+
unpublishedReason: "stopped",
|
|
237
|
+
};
|
|
238
|
+
}
|
|
192
239
|
const sessionDir = sessionDirOf(ctx);
|
|
193
240
|
writeTurnCommitFile(sessionDir, ctx.turnKey, result);
|
|
194
241
|
faultPoint("turn.commit.before-cas");
|
|
@@ -217,6 +264,7 @@ export async function runTurnCommit(ctx, baseVersion, result) {
|
|
|
217
264
|
...(hydrated.sizeBytes != null ? { sizeBytes: hydrated.sizeBytes } : {}),
|
|
218
265
|
...(hydrated.rawSizeBytes != null ? { rawSizeBytes: hydrated.rawSizeBytes } : {}),
|
|
219
266
|
alreadyCommitted: true,
|
|
267
|
+
published: true,
|
|
220
268
|
...(commitFile && commitFile.turnKey === ctx.turnKey
|
|
221
269
|
? { storedResult: commitFile.result }
|
|
222
270
|
: {}),
|
|
@@ -236,11 +284,30 @@ export async function runTurnCommit(ctx, baseVersion, result) {
|
|
|
236
284
|
...(committed.sizeBytes != null ? { sizeBytes: committed.sizeBytes } : {}),
|
|
237
285
|
...(committed.rawSizeBytes != null ? { rawSizeBytes: committed.rawSizeBytes } : {}),
|
|
238
286
|
alreadyCommitted: false,
|
|
287
|
+
published: true,
|
|
239
288
|
};
|
|
240
289
|
}
|
|
241
290
|
catch (error) {
|
|
242
|
-
if (error instanceof SnapshotConflictError)
|
|
243
|
-
|
|
291
|
+
if (error instanceof SnapshotConflictError) {
|
|
292
|
+
// Store-wins: a turn the control plane discarded — or a foreign
|
|
293
|
+
// writer — advanced the store off our base while this turn ran.
|
|
294
|
+
// Do NOT brick (the old zombie-duplicate fence). Give up this
|
|
295
|
+
// publish: leave the sentinel dirty so the next preamble
|
|
296
|
+
// rehydrates the winner. The turn's result still returns to the
|
|
297
|
+
// orchestration; only its snapshot memory is superseded, and
|
|
298
|
+
// the caller emits `session.snapshot_unpublished{superseded}`.
|
|
299
|
+
ctx.trace(`session=${ctx.sessionId} commit superseded: store advanced off base v${baseVersion} ` +
|
|
300
|
+
`while this turn ran (${error.message}); leaving turn unpublished, sentinel dirty`);
|
|
301
|
+
return {
|
|
302
|
+
version: baseVersion,
|
|
303
|
+
contentHash: "",
|
|
304
|
+
alreadyCommitted: false,
|
|
305
|
+
published: false,
|
|
306
|
+
unpublishedReason: "superseded",
|
|
307
|
+
observedStoreVersion: error.storedVersion,
|
|
308
|
+
...(error.storedTurnKey ? { observedStoreTurnKey: error.storedTurnKey } : {}),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
244
311
|
lastError = error;
|
|
245
312
|
const message = error instanceof Error ? error.message : String(error);
|
|
246
313
|
ctx.trace(`session=${ctx.sessionId} turn commit attempt ${attempt}/${COMMIT_TRANSIENT_RETRIES} ` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-lifecycle.js","sourceRoot":"","sources":["../src/session-lifecycle.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"session-lifecycle.js","sourceRoot":"","sources":["../src/session-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACH,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GAGtB,MAAM,wBAAwB,CAAC;AA4EhC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC,kEAAkE;AAClE,MAAM,0BAA0B,GAC5B,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gCAAgC,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC;AAErF,SAAS,YAAY,CAAC,GAAyB;IAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;AACzD,CAAC;AAED;;;;;GAKG;AACH,SAAS,sBAAsB,CAAC,UAAkB;IAC9C,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,UAAmB,EAAE,SAAkB;IAC3D,IAAI,UAAU,IAAI,SAAS;QAAE,OAAO,UAAU,KAAK,SAAS,CAAC;IAC7D,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,iBAAiB,CAAC,UAAkB,EAAE,QAA+B;IAC1E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A6C,CACrF,CAAC;gBACF,OAAO;oBACH,OAAO,EAAE,WAAW;oBACpB,WAAW,EAAE,EAAE;oBACf,gBAAgB,EAAE,KAAK;oBACvB,SAAS,EAAE,KAAK;oBAChB,iBAAiB,EAAE,YAAY;oBAC/B,oBAAoB,EAAE,KAAK,CAAC,aAAa;oBACzC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAChF,CAAC;YACN,CAAC;YACD,SAAS,GAAG,KAAK,CAAC;YAClB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,GAAG,CAAC,KAAK,CACL,WAAW,GAAG,CAAC,SAAS,wBAAwB,OAAO,IAAI,wBAAwB,GAAG;gBACtF,WAAW,OAAO,EAAE,CACvB,CAAC;YACF,IAAI,OAAO,GAAG,wBAAwB,EAAE,CAAC;gBACrC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,CAAC,CAAC;YAC9F,CAAC;QACL,CAAC;IACL,CAAC;IACD,MAAM,SAAS,YAAY,KAAK;QAC5B,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,IAAI,KAAK,CAAC,0BAA0B,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -150,6 +150,13 @@ export declare class SessionManager {
|
|
|
150
150
|
setGraphStore(graphStore: GraphStore | null): void;
|
|
151
151
|
/** Set the CMS catalog for always-on inspect tools (e.g. read_agent_events). */
|
|
152
152
|
setSessionCatalog(catalog: SessionCatalog | null): void;
|
|
153
|
+
/**
|
|
154
|
+
* Hot-swap the model-provider registry after a config-file change on
|
|
155
|
+
* disk (ConfigMap update). Applies to all subsequent model resolution;
|
|
156
|
+
* live warm sessions keep their bound client until their next
|
|
157
|
+
* getOrCreate re-resolves.
|
|
158
|
+
*/
|
|
159
|
+
setModelProviders(registry: import("./model-providers.js").ModelProviderRegistry | null): void;
|
|
153
160
|
/** Set the duroxide client for tuner-only inspect tools. */
|
|
154
161
|
setDuroxideClient(client: any): void;
|
|
155
162
|
/** Set the lineage lookup for ancestor/descendant facts access. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../src/session-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuE,KAAK,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACpI,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAgC,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC3I,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAIlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../src/session-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuE,KAAK,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACpI,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAgC,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC3I,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAIlE,OAAO,KAAK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E,GAAG,OAAO,CAAC,OAAO,CAAC;IA+BnG;;OAEG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWxF;;;;OAIG;IACG,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAY/F;;;;OAIG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3F;;;OAGG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IASpF,mDAAmD;IACnD,gBAAgB,IAAI,MAAM,EAAE;IAI5B,0DAA0D;IACpD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAY/B;;;OAGG;IACH,OAAO,CAAC,aAAa;IA8BrB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAgC9B;;;;;;OAMG;IACH,OAAO,CAAC,sCAAsC;IAuC9C,OAAO,CAAC,6BAA6B;IAqBrC,OAAO,CAAC,mBAAmB;CAyB9B"}
|
package/dist/session-manager.js
CHANGED
|
@@ -4,6 +4,7 @@ import { SESSION_STATE_MISSING_PREFIX } from "./types.js";
|
|
|
4
4
|
import { createFactTools } from "./facts-tools.js";
|
|
5
5
|
import { createGraphTools } from "./graph-tools.js";
|
|
6
6
|
import { createInspectTools } from "./inspect-tools.js";
|
|
7
|
+
import { SYSTEM_USER_PRINCIPAL } from "./cms.js";
|
|
7
8
|
import { isEnhancedFactStore } from "./facts-store.js";
|
|
8
9
|
import { buildKnowledgePromptBlocks, loadKnowledgeIndexFromFactStore, buildEnhancedRetrievalPromptBlock, buildGraphReaderPromptBlock } from "./knowledge-index.js";
|
|
9
10
|
import { composeStructuredSystemMessage, extractPromptContent, mergePromptSections } from "./prompt-layering.js";
|
|
@@ -222,6 +223,15 @@ export class SessionManager {
|
|
|
222
223
|
setSessionCatalog(catalog) {
|
|
223
224
|
this.sessionCatalog = catalog;
|
|
224
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Hot-swap the model-provider registry after a config-file change on
|
|
228
|
+
* disk (ConfigMap update). Applies to all subsequent model resolution;
|
|
229
|
+
* live warm sessions keep their bound client until their next
|
|
230
|
+
* getOrCreate re-resolves.
|
|
231
|
+
*/
|
|
232
|
+
setModelProviders(registry) {
|
|
233
|
+
this.workerDefaults.modelProviders = registry ?? undefined;
|
|
234
|
+
}
|
|
225
235
|
/** Set the duroxide client for tuner-only inspect tools. */
|
|
226
236
|
setDuroxideClient(client) {
|
|
227
237
|
this._duroxideClient = client;
|
|
@@ -309,7 +319,7 @@ export class SessionManager {
|
|
|
309
319
|
* Returns `undefined` to mean "use the worker default", which is the
|
|
310
320
|
* shape `ensureClient` already understands.
|
|
311
321
|
*/
|
|
312
|
-
async _resolveSessionGitHubToken(sessionId, config, effectiveModel) {
|
|
322
|
+
async _resolveSessionGitHubToken(sessionId, config, effectiveModel, preloadedRow) {
|
|
313
323
|
if (!this.sessionCatalog)
|
|
314
324
|
return undefined;
|
|
315
325
|
const registry = this.workerDefaults.modelProviders;
|
|
@@ -318,23 +328,31 @@ export class SessionManager {
|
|
|
318
328
|
const resolved = registry.resolve(effectiveModel);
|
|
319
329
|
if (!resolved || resolved.type !== "github")
|
|
320
330
|
return undefined;
|
|
321
|
-
let row = null;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
331
|
+
let row = preloadedRow ?? null;
|
|
332
|
+
if (!row) {
|
|
333
|
+
try {
|
|
334
|
+
row = await this.sessionCatalog.getSession(sessionId);
|
|
335
|
+
}
|
|
336
|
+
catch {
|
|
337
|
+
return undefined;
|
|
338
|
+
}
|
|
327
339
|
}
|
|
340
|
+
// Ownerless system sessions act as the first-class SYSTEM user for
|
|
341
|
+
// credential purposes: an admin-stored System key (Admin Console →
|
|
342
|
+
// "Store as System key") resolves through the same per-user path.
|
|
328
343
|
const owner = row?.owner;
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
try {
|
|
332
|
-
const userKey = await this.sessionCatalog.getUserGitHubCopilotKey({
|
|
344
|
+
const principal = owner?.provider && owner?.subject
|
|
345
|
+
? {
|
|
333
346
|
provider: owner.provider,
|
|
334
347
|
subject: owner.subject,
|
|
335
348
|
email: owner.email ?? null,
|
|
336
349
|
displayName: owner.displayName ?? null,
|
|
337
|
-
}
|
|
350
|
+
}
|
|
351
|
+
: (row?.isSystem ? SYSTEM_USER_PRINCIPAL : null);
|
|
352
|
+
if (!principal)
|
|
353
|
+
return undefined;
|
|
354
|
+
try {
|
|
355
|
+
const userKey = await this.sessionCatalog.getUserGitHubCopilotKey(principal);
|
|
338
356
|
return userKey ?? undefined;
|
|
339
357
|
}
|
|
340
358
|
catch {
|
|
@@ -645,6 +663,41 @@ export class SessionManager {
|
|
|
645
663
|
turnTimeoutMs: this.workerDefaults.turnTimeoutMs,
|
|
646
664
|
};
|
|
647
665
|
this.sessionConfigs.set(sessionId, config);
|
|
666
|
+
// ── Catalog model is the source of truth ─────────────────────────
|
|
667
|
+
// The CMS session row's `model` is what the user selected and what
|
|
668
|
+
// every surface displays. If the runtime config disagrees (a create
|
|
669
|
+
// path that dropped the field, a stale snapshot from an older
|
|
670
|
+
// deploy, a CMS-only model edit), complain LOUDLY and adopt the
|
|
671
|
+
// catalog model — a session must never silently run something other
|
|
672
|
+
// than what the catalog says. Adopting before the warm-session check
|
|
673
|
+
// below means requiresModelRebind() also recreates a warm CLI
|
|
674
|
+
// session that was frozen on the wrong model.
|
|
675
|
+
let catalogRow = null;
|
|
676
|
+
if (this.sessionCatalog) {
|
|
677
|
+
try {
|
|
678
|
+
catalogRow = await this.sessionCatalog.getSession(sessionId);
|
|
679
|
+
}
|
|
680
|
+
catch { /* row not readable — fall through to configured model */ }
|
|
681
|
+
const catalogModel = String(catalogRow?.model || "").trim();
|
|
682
|
+
const configuredModel = String(config.model || "").trim();
|
|
683
|
+
if (catalogModel && catalogModel !== configuredModel) {
|
|
684
|
+
emitSessionManagerTrace(sessionId, `model mismatch: catalog=${catalogModel} configured=${configuredModel || "(default)"}; catalog wins`, { trace });
|
|
685
|
+
config.model = catalogModel;
|
|
686
|
+
this.sessionConfigs.set(sessionId, config);
|
|
687
|
+
try {
|
|
688
|
+
await this.sessionCatalog.recordEvents(sessionId, [{
|
|
689
|
+
eventType: "session.model_mismatch",
|
|
690
|
+
data: {
|
|
691
|
+
catalogModel,
|
|
692
|
+
configuredModel: configuredModel || null,
|
|
693
|
+
action: "catalog_model_adopted",
|
|
694
|
+
message: "Runtime session config disagreed with the session catalog model; the catalog is authoritative and its model was adopted for this turn.",
|
|
695
|
+
},
|
|
696
|
+
}]);
|
|
697
|
+
}
|
|
698
|
+
catch { /* observability only — never fails the create */ }
|
|
699
|
+
}
|
|
700
|
+
}
|
|
648
701
|
// Resolve model up-front so we can pick the right CopilotClient
|
|
649
702
|
// (per-user GitHub Copilot token) before any session create/resume.
|
|
650
703
|
const registry = this.workerDefaults.modelProviders;
|
|
@@ -662,10 +715,10 @@ export class SessionManager {
|
|
|
662
715
|
// for the SessionManager unit tests that exercise lock ordering
|
|
663
716
|
// by counting microtasks before the first `resumeSession()` call.
|
|
664
717
|
const userGithubToken = this.sessionCatalog
|
|
665
|
-
? await this._resolveSessionGitHubToken(sessionId, config, effectiveModel)
|
|
718
|
+
? await this._resolveSessionGitHubToken(sessionId, config, effectiveModel, catalogRow)
|
|
666
719
|
: undefined;
|
|
667
720
|
if (resolvedProvider?.type === "github" && !userGithubToken && !this.githubToken && !resolvedProvider.githubToken) {
|
|
668
|
-
throw new Error("GitHub Copilot key not configured. Set GITHUB_TOKEN on the worker
|
|
721
|
+
throw new Error("GitHub Copilot key not configured. Set GITHUB_TOKEN on the worker, set your per-user GitHub Copilot key in Admin, or (for system sessions) have an admin store a System key in the Admin Console before creating GitHub Copilot model sessions.");
|
|
669
722
|
}
|
|
670
723
|
const desiredClientKey = userGithubToken || "";
|
|
671
724
|
const previousClientKey = this.sessionClientKeys.get(sessionId);
|