@adhdev/mesh-shared 1.0.82-rc.7 → 1.0.82-rc.71
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/dist/assistant-protocol.d.ts +163 -6
- package/dist/decision-push-relay.d.ts +20 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1637 -124
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1499 -124
- package/dist/index.mjs.map +1 -1
- package/dist/launch-defaults.d.ts +196 -0
- package/dist/light-task.d.ts +96 -0
- package/dist/mesh-tool-names.d.ts +2 -2
- package/dist/mesh-vocabulary.d.ts +13 -4
- package/dist/mission-git-state.d.ts +83 -0
- package/dist/mission-items.d.ts +202 -0
- package/dist/node-facts.d.ts +61 -1
- package/dist/outbound-message.d.ts +9 -2
- package/dist/path-ownership.d.ts +1 -1
- package/dist/protocol/daemon-server.d.ts +42 -2
- package/dist/protocol/dashboard-daemon-p2p.d.ts +1 -1
- package/dist/protocol/dashboard-server.d.ts +20 -2
- package/dist/provider-approval.d.ts +36 -0
- package/dist/provider-question.d.ts +19 -0
- package/dist/quota-freshness.d.ts +4 -4
- package/dist/relay-reprobe.d.ts +52 -0
- package/dist/release.d.ts +90 -0
- package/dist/role-launch.d.ts +11 -0
- package/dist/session-launch.d.ts +10 -22
- package/dist/slot-proposal.d.ts +14 -0
- package/dist/task-source-phase.d.ts +83 -0
- package/dist/task-stages.d.ts +206 -0
- package/dist/turn-evidence.d.ts +43 -13
- package/dist/turn-ipc-mission.d.ts +72 -1
- package/dist/turn-ipc-queue.d.ts +30 -0
- package/dist/turn-ipc.d.ts +2 -2
- package/dist/types.d.ts +1 -0
- package/dist/worker-protocol.d.ts +33 -1
- package/package.json +1 -1
- package/src/assistant-protocol.ts +306 -6
- package/src/daemon-normalize.ts +7 -5
- package/src/decision-push-relay.ts +23 -0
- package/src/index.ts +13 -0
- package/src/keyed-doc-delta.ts +9 -1
- package/src/launch-defaults.ts +170 -0
- package/src/light-task.ts +116 -0
- package/src/mesh-tool-names.ts +22 -0
- package/src/mesh-vocabulary.ts +12 -2
- package/src/mission-git-state.ts +112 -0
- package/src/mission-items.ts +421 -0
- package/src/node-facts.ts +56 -1
- package/src/outbound-message.ts +19 -0
- package/src/path-ownership.ts +4 -6
- package/src/protocol/daemon-server.ts +37 -2
- package/src/protocol/dashboard-server.ts +13 -2
- package/src/provider-approval.ts +59 -0
- package/src/provider-question.ts +31 -0
- package/src/quota-freshness.ts +29 -13
- package/src/relay-reprobe.ts +117 -0
- package/src/release.ts +121 -0
- package/src/role-launch.ts +51 -0
- package/src/session-launch.ts +17 -1
- package/src/slot-proposal.ts +61 -2
- package/src/task-source-phase.ts +70 -0
- package/src/task-stages.ts +455 -0
- package/src/turn-evidence.ts +56 -20
- package/src/turn-ipc-mission.ts +127 -11
- package/src/turn-ipc-queue.ts +43 -2
- package/src/turn-ipc-turn.ts +1 -1
- package/src/turn-ipc.ts +1 -0
- package/src/types.ts +1 -0
- package/src/worker-protocol.ts +79 -0
package/dist/index.mjs
CHANGED
|
@@ -194,15 +194,15 @@ function pickBestTransitGitStatus(node, options) {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
// src/session-normalize.ts
|
|
197
|
-
function deriveSyntheticSessionId(
|
|
197
|
+
function deriveSyntheticSessionId(record2) {
|
|
198
198
|
const parts = [
|
|
199
|
-
readString(
|
|
200
|
-
readString(
|
|
201
|
-
readString(
|
|
202
|
-
readString(
|
|
203
|
-
readString(
|
|
204
|
-
readString(
|
|
205
|
-
readString(
|
|
199
|
+
readString(record2.workspace),
|
|
200
|
+
readString(record2.providerType, record2.provider),
|
|
201
|
+
readString(record2.role),
|
|
202
|
+
readString(record2.state, record2.status),
|
|
203
|
+
readString(record2.title),
|
|
204
|
+
readString(record2.createdAt, record2.created_at),
|
|
205
|
+
readString(record2.startedAt, record2.started_at)
|
|
206
206
|
].filter((part) => Boolean(part));
|
|
207
207
|
if (parts.length === 0) return void 0;
|
|
208
208
|
return `synthetic:${parts.join("|")}`;
|
|
@@ -214,33 +214,33 @@ function sessionIdsEquivalent(a, b) {
|
|
|
214
214
|
return idA === idB;
|
|
215
215
|
}
|
|
216
216
|
function normalizeMeshSessionRecord(entry) {
|
|
217
|
-
const
|
|
218
|
-
const sessionId = readString(
|
|
217
|
+
const record2 = readRecord(entry);
|
|
218
|
+
const sessionId = readString(record2.sessionId, record2.session_id, record2.id) ?? deriveSyntheticSessionId(record2);
|
|
219
219
|
if (!sessionId) return null;
|
|
220
220
|
return {
|
|
221
221
|
sessionId,
|
|
222
|
-
...readString(
|
|
223
|
-
...readString(
|
|
224
|
-
...readString(
|
|
225
|
-
...readString(
|
|
226
|
-
...readString(
|
|
227
|
-
...readString(
|
|
228
|
-
...readString(
|
|
229
|
-
...readString(
|
|
230
|
-
...readString(
|
|
231
|
-
...readBoolean(
|
|
232
|
-
...readString(
|
|
233
|
-
...readString(
|
|
234
|
-
...readString(
|
|
235
|
-
...readString(
|
|
236
|
-
...readBoolean(
|
|
222
|
+
...readString(record2.providerType, record2.provider) ? { providerType: readString(record2.providerType, record2.provider) } : {},
|
|
223
|
+
...readString(record2.state, record2.status) ? { state: readString(record2.state, record2.status) } : {},
|
|
224
|
+
...readString(record2.chatStatus, record2.chat_status) ? { chatStatus: readString(record2.chatStatus, record2.chat_status) } : {},
|
|
225
|
+
...readString(record2.lifecycle) ? { lifecycle: readString(record2.lifecycle) } : {},
|
|
226
|
+
...readString(record2.surfaceKind, record2.surface_kind) ? { surfaceKind: readString(record2.surfaceKind, record2.surface_kind) } : {},
|
|
227
|
+
...readString(record2.recoveryState, record2.recovery_state) ? { recoveryState: readString(record2.recoveryState, record2.recovery_state) } : {},
|
|
228
|
+
...readString(record2.workspace) ? { workspace: readString(record2.workspace) } : {},
|
|
229
|
+
...readString(record2.title) ? { title: readString(record2.title) } : {},
|
|
230
|
+
...readString(record2.role) ? { role: readString(record2.role) } : {},
|
|
231
|
+
...readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) } : {},
|
|
232
|
+
...readString(record2.statusNote, record2.status_note) ? { statusNote: readString(record2.statusNote, record2.status_note) } : {},
|
|
233
|
+
...readString(record2.createdAt, record2.created_at) ? { createdAt: readString(record2.createdAt, record2.created_at) } : {},
|
|
234
|
+
...readString(record2.startedAt, record2.started_at) ? { startedAt: readString(record2.startedAt, record2.started_at) } : {},
|
|
235
|
+
...readString(record2.lastActivityAt, record2.last_activity_at) ? { lastActivityAt: readString(record2.lastActivityAt, record2.last_activity_at) } : {},
|
|
236
|
+
...readBoolean(record2.isCached, record2.is_cached) !== void 0 ? { isCached: readBoolean(record2.isCached, record2.is_cached) } : {}
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
// src/node-normalize.ts
|
|
241
241
|
function normalizeMeshNodeId(node) {
|
|
242
|
-
const
|
|
243
|
-
return readString(
|
|
242
|
+
const record2 = node && typeof node === "object" ? node : {};
|
|
243
|
+
return readString(record2.id, record2.nodeId, record2.node_id);
|
|
244
244
|
}
|
|
245
245
|
function meshNodeIdMatches(node, candidateId) {
|
|
246
246
|
if (!candidateId) return false;
|
|
@@ -252,12 +252,12 @@ function meshNodeIdMatches(node, candidateId) {
|
|
|
252
252
|
// src/node-facts.ts
|
|
253
253
|
function normalizeMeshNodeFacts(raw) {
|
|
254
254
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
255
|
-
const
|
|
256
|
-
const schemaVersion = Number(
|
|
257
|
-
const reportedAt = Number(
|
|
255
|
+
const record2 = raw;
|
|
256
|
+
const schemaVersion = Number(record2.schemaVersion);
|
|
257
|
+
const reportedAt = Number(record2.reportedAt);
|
|
258
258
|
if (!Number.isFinite(schemaVersion) || schemaVersion < 1) return void 0;
|
|
259
259
|
if (!Number.isFinite(reportedAt) || reportedAt <= 0) return void 0;
|
|
260
|
-
return { ...
|
|
260
|
+
return { ...record2, schemaVersion, reportedAt };
|
|
261
261
|
}
|
|
262
262
|
var QUOTA_SUPPORTED_PROVIDERS = [
|
|
263
263
|
"antigravity-cli",
|
|
@@ -307,7 +307,7 @@ function hasUsableWindow(window) {
|
|
|
307
307
|
return !!window && typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent);
|
|
308
308
|
}
|
|
309
309
|
function hasReading(quota) {
|
|
310
|
-
if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly)) return true;
|
|
310
|
+
if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly) || hasUsableWindow(quota.monthly)) return true;
|
|
311
311
|
return Array.isArray(quota.buckets) && quota.buckets.some((b) => !!b && typeof b.usedPercent === "number" && Number.isFinite(b.usedPercent));
|
|
312
312
|
}
|
|
313
313
|
function finiteMs(value) {
|
|
@@ -325,9 +325,17 @@ function backfillCheckAt(quota, now) {
|
|
|
325
325
|
function assessQuotaFreshness(quota, now = Date.now()) {
|
|
326
326
|
const meta = quota.metadata;
|
|
327
327
|
const kind = meta?.failureKind;
|
|
328
|
-
const userMustAct = kind === "no-data" && quota.provider !== "codex-cli"
|
|
329
|
-
|
|
330
|
-
if (
|
|
328
|
+
const userMustAct = kind === "no-data" && quota.provider !== "codex-cli";
|
|
329
|
+
const awaitsCliUse = kind === "expired-token" && ["grok-cli", "kimi", "antigravity-cli"].includes(quota.provider);
|
|
330
|
+
if (userMustAct) return hasReading(quota) ? { cue: "stale", userMustAct: true } : { userMustAct: true };
|
|
331
|
+
if (awaitsCliUse) return hasReading(quota) ? { cue: "stale", userMustAct: false } : { userMustAct: false };
|
|
332
|
+
if (meta?.lastGoodWindows !== true) {
|
|
333
|
+
const measuredAt = finiteMs(quota.updatedAt);
|
|
334
|
+
if (hasReading(quota) && (measuredAt === void 0 || now - measuredAt >= QUOTA_BACKFILL_HORIZON_MS)) {
|
|
335
|
+
return { cue: "stale", userMustAct };
|
|
336
|
+
}
|
|
337
|
+
return { userMustAct };
|
|
338
|
+
}
|
|
331
339
|
const retryAtMs = finiteMs(meta?.retryAtMs);
|
|
332
340
|
const retryStopped = meta?.retryExhausted === true || retryAtMs !== void 0 && retryAtMs + QUOTA_RETRY_INFLIGHT_GRACE_MS < now;
|
|
333
341
|
if (kind !== "no-data" && !retryStopped) return { cue: "refreshing", userMustAct: false };
|
|
@@ -367,19 +375,21 @@ function isPhantomDaemonEntry(entry) {
|
|
|
367
375
|
function machineCoreFromDaemonId(id2) {
|
|
368
376
|
const trimmed = readString(id2);
|
|
369
377
|
if (!trimmed) return void 0;
|
|
378
|
+
const lower = trimmed.toLowerCase();
|
|
370
379
|
for (const prefix of DAEMON_ID_PREFIXES) {
|
|
371
|
-
if (
|
|
380
|
+
if (lower.startsWith(prefix)) {
|
|
372
381
|
const core = trimmed.slice(prefix.length).trim();
|
|
373
|
-
|
|
382
|
+
if (!core) return void 0;
|
|
383
|
+
return /^mach_/i.test(core) ? `mach_${core.slice(5)}` : core;
|
|
374
384
|
}
|
|
375
385
|
}
|
|
376
|
-
return trimmed;
|
|
386
|
+
return /^mach_/i.test(trimmed) ? `mach_${trimmed.slice(5)}` : trimmed;
|
|
377
387
|
}
|
|
378
388
|
function canonicalDaemonId(id2) {
|
|
379
389
|
const core = machineCoreFromDaemonId(id2);
|
|
380
390
|
if (!core) return void 0;
|
|
381
|
-
if (
|
|
382
|
-
return `
|
|
391
|
+
if (!/^mach_/i.test(core)) return core;
|
|
392
|
+
return `daemon_mach_${core.slice(5)}`;
|
|
383
393
|
}
|
|
384
394
|
function daemonIdsEquivalent(a, b) {
|
|
385
395
|
const coreA = machineCoreFromDaemonId(a);
|
|
@@ -408,9 +418,9 @@ function expandDaemonIdForms(ids) {
|
|
|
408
418
|
|
|
409
419
|
// src/git-summarize.ts
|
|
410
420
|
function summarizeGitShape(status) {
|
|
411
|
-
const
|
|
412
|
-
if (!Object.keys(
|
|
413
|
-
const submodules = Array.isArray(
|
|
421
|
+
const record2 = readRecord(status);
|
|
422
|
+
if (!Object.keys(record2).length) return null;
|
|
423
|
+
const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => {
|
|
414
424
|
const sub = readRecord(entry);
|
|
415
425
|
return {
|
|
416
426
|
path: readString(sub.path) ?? null,
|
|
@@ -420,23 +430,23 @@ function summarizeGitShape(status) {
|
|
|
420
430
|
};
|
|
421
431
|
}) : [];
|
|
422
432
|
return {
|
|
423
|
-
isGitRepo: readBoolean(
|
|
424
|
-
workspace: readString(
|
|
425
|
-
repoRoot: readString(
|
|
426
|
-
branch: readString(
|
|
427
|
-
upstream: readString(
|
|
428
|
-
upstreamStatus: readString(
|
|
429
|
-
headCommit: readString(
|
|
430
|
-
ahead: readNumber(
|
|
431
|
-
behind: readNumber(
|
|
433
|
+
isGitRepo: readBoolean(record2.isGitRepo),
|
|
434
|
+
workspace: readString(record2.workspace) ?? null,
|
|
435
|
+
repoRoot: readString(record2.repoRoot, record2.repo_root) ?? null,
|
|
436
|
+
branch: readString(record2.branch) ?? null,
|
|
437
|
+
upstream: readString(record2.upstream) ?? null,
|
|
438
|
+
upstreamStatus: readString(record2.upstreamStatus, record2.upstream_status) ?? null,
|
|
439
|
+
headCommit: readString(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
|
|
440
|
+
ahead: readNumber(record2.ahead) ?? null,
|
|
441
|
+
behind: readNumber(record2.behind) ?? null,
|
|
432
442
|
dirtyCounts: {
|
|
433
|
-
staged: readNumber(
|
|
434
|
-
modified: readNumber(
|
|
435
|
-
untracked: readNumber(
|
|
436
|
-
deleted: readNumber(
|
|
437
|
-
renamed: readNumber(
|
|
443
|
+
staged: readNumber(record2.staged) ?? 0,
|
|
444
|
+
modified: readNumber(record2.modified) ?? 0,
|
|
445
|
+
untracked: readNumber(record2.untracked) ?? 0,
|
|
446
|
+
deleted: readNumber(record2.deleted) ?? 0,
|
|
447
|
+
renamed: readNumber(record2.renamed) ?? 0
|
|
438
448
|
},
|
|
439
|
-
lastCheckedAt: readNumber(
|
|
449
|
+
lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
|
|
440
450
|
submoduleCount: submodules.length,
|
|
441
451
|
submodules
|
|
442
452
|
};
|
|
@@ -602,10 +612,25 @@ var CLI_SLOT_RECIPES = Object.freeze({
|
|
|
602
612
|
],
|
|
603
613
|
"antigravity-cli": [
|
|
604
614
|
{
|
|
605
|
-
model: "Gemini 3.
|
|
615
|
+
model: "Gemini 3.8 Flash (High)",
|
|
616
|
+
modelCandidates: ["Gemini 3.8 Flash (High)", "Gemini 4 Argon (Low)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
606
617
|
difficulty: ["easy"],
|
|
607
618
|
maxParallel: 2,
|
|
608
619
|
rationale: "Cheap capacity for easy tasks."
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
model: "Gemini 4 Argon (Medium)",
|
|
623
|
+
modelCandidates: ["Gemini 4 Argon (Medium)", "Gemini 3.8 Flash (High)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
624
|
+
difficulty: ["medium"],
|
|
625
|
+
maxParallel: 2,
|
|
626
|
+
rationale: "Balanced Argon tier for medium tasks."
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
model: "Gemini 4 Argon (High)",
|
|
630
|
+
modelCandidates: ["Gemini 4 Argon (High)", "Gemini 3.8 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
631
|
+
difficulty: ["difficult"],
|
|
632
|
+
maxParallel: 1,
|
|
633
|
+
rationale: "Reserved for hard tasks; capped at 1 to bound cost."
|
|
609
634
|
}
|
|
610
635
|
],
|
|
611
636
|
"cursor-cli": [
|
|
@@ -644,6 +669,24 @@ function dedupeDetected(detected) {
|
|
|
644
669
|
}
|
|
645
670
|
return out;
|
|
646
671
|
}
|
|
672
|
+
function resolveRecipeModel(recipe, modelOptions) {
|
|
673
|
+
if (!Array.isArray(modelOptions) || modelOptions.length === 0) {
|
|
674
|
+
return recipe.model;
|
|
675
|
+
}
|
|
676
|
+
const available = new Set(
|
|
677
|
+
modelOptions.filter((m) => typeof m === "string" && m.trim().length > 0).map((m) => m.trim())
|
|
678
|
+
);
|
|
679
|
+
if (available.size === 0) return recipe.model;
|
|
680
|
+
const candidates = [
|
|
681
|
+
...recipe.model ? [recipe.model] : [],
|
|
682
|
+
...recipe.modelCandidates ?? []
|
|
683
|
+
];
|
|
684
|
+
for (const candidate of candidates) {
|
|
685
|
+
const trimmed = typeof candidate === "string" ? candidate.trim() : "";
|
|
686
|
+
if (trimmed && available.has(trimmed)) return trimmed;
|
|
687
|
+
}
|
|
688
|
+
return recipe.model;
|
|
689
|
+
}
|
|
647
690
|
function buildSlotProposal(detected, currentSlots = []) {
|
|
648
691
|
const providers = dedupeDetected(detected ?? []);
|
|
649
692
|
const proposedSlots = [];
|
|
@@ -659,7 +702,7 @@ function buildSlotProposal(detected, currentSlots = []) {
|
|
|
659
702
|
for (const recipe of recipes) {
|
|
660
703
|
const slot = normalizeNodeCapabilitySlot({
|
|
661
704
|
provider: provider.type,
|
|
662
|
-
model: recipe.
|
|
705
|
+
model: resolveRecipeModel(recipe, provider.modelOptions),
|
|
663
706
|
thinkingLevel: recipe.thinkingLevel,
|
|
664
707
|
difficulty: recipe.difficulty,
|
|
665
708
|
maxParallel: recipe.maxParallel
|
|
@@ -712,7 +755,12 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
712
755
|
"mesh_enqueue_task",
|
|
713
756
|
"mesh_view_queue",
|
|
714
757
|
"mesh_queue_cancel",
|
|
758
|
+
"mesh_task_stage_decide",
|
|
759
|
+
"mesh_direct_cancel",
|
|
715
760
|
"mesh_queue_requeue",
|
|
761
|
+
"mesh_queue_revise",
|
|
762
|
+
"mesh_light_land",
|
|
763
|
+
"mesh_light_discard",
|
|
716
764
|
"mesh_send_task",
|
|
717
765
|
"mesh_read_chat",
|
|
718
766
|
"mesh_read_debug",
|
|
@@ -729,8 +777,13 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
729
777
|
"mesh_list_pending_approvals",
|
|
730
778
|
"mesh_create",
|
|
731
779
|
"mesh_add_node",
|
|
780
|
+
"mesh_reattach_source_parent",
|
|
781
|
+
"mesh_attach_remote",
|
|
782
|
+
"mesh_host_pairing",
|
|
732
783
|
"mesh_clone_node",
|
|
733
784
|
"mesh_remove_node",
|
|
785
|
+
"mesh_retry_node_bootstrap",
|
|
786
|
+
"mesh_recover_node_identity",
|
|
734
787
|
"mesh_cleanup_worktree_nodes",
|
|
735
788
|
"mesh_refine_node",
|
|
736
789
|
"mesh_refine_batch",
|
|
@@ -747,8 +800,20 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
747
800
|
"mesh_reconcile_ledger",
|
|
748
801
|
"mesh_mission_upsert",
|
|
749
802
|
"mesh_mission_list",
|
|
803
|
+
"mesh_mission_git_eval",
|
|
804
|
+
"mesh_release_upsert",
|
|
805
|
+
"mesh_release_scope",
|
|
806
|
+
"mesh_release_list",
|
|
807
|
+
"mesh_release_record_deploy",
|
|
808
|
+
"mesh_release_changelog_draft",
|
|
809
|
+
"mesh_file_transfer",
|
|
750
810
|
"mesh_review_inbox",
|
|
751
|
-
"mesh_node_slots"
|
|
811
|
+
"mesh_node_slots",
|
|
812
|
+
"driver_list",
|
|
813
|
+
"driver_describe",
|
|
814
|
+
"artifact_list",
|
|
815
|
+
"artifact_read",
|
|
816
|
+
"artifact_register"
|
|
752
817
|
];
|
|
753
818
|
var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
|
|
754
819
|
var RETIRED_MESH_TOOLS = {
|
|
@@ -1058,9 +1123,15 @@ var DAEMON_STATUS_EVENT_NAMES = [
|
|
|
1058
1123
|
"agent:waiting_choice",
|
|
1059
1124
|
"agent:generating_completed",
|
|
1060
1125
|
"agent:stopped",
|
|
1061
|
-
"monitor:no_progress"
|
|
1126
|
+
"monitor:no_progress",
|
|
1127
|
+
// An owner decision (structured missions) needs the owner. Server-bound for the push only;
|
|
1128
|
+
// the dashboard learns about decisions over P2P (`mission_decisions_list`).
|
|
1129
|
+
"agent:decision_needed"
|
|
1062
1130
|
];
|
|
1063
1131
|
var isDaemonStatusEventName = makeTypeGuard(DAEMON_STATUS_EVENT_NAMES);
|
|
1132
|
+
var DECISION_PUSH_QUESTION_MAX = 80;
|
|
1133
|
+
var DECISION_PUSH_OPTION_LABEL_MAX = 24;
|
|
1134
|
+
var DECISION_PUSH_OPTIONS_MAX = 3;
|
|
1064
1135
|
var RELEASE_CHANNELS = ["stable", "preview"];
|
|
1065
1136
|
var NPM_UPDATE_TAGS = ["latest", "next"];
|
|
1066
1137
|
var VERSION_UPDATE_REASONS = ["force_update_below", "major_minor_mismatch", "patch_mismatch", "daemon_ahead"];
|
|
@@ -1423,21 +1494,22 @@ function isTerminalSessionRecordStatus(raw) {
|
|
|
1423
1494
|
return typeof raw === "string" && TERMINAL_SESSION_RECORD_STATUSES.includes(raw.trim().toLowerCase());
|
|
1424
1495
|
}
|
|
1425
1496
|
function isIdleSessionState(state) {
|
|
1426
|
-
const
|
|
1427
|
-
const status = typeof
|
|
1497
|
+
const record2 = state && typeof state === "object" ? state : {};
|
|
1498
|
+
const status = typeof record2.status === "string" ? record2.status.trim().toLowerCase() : "";
|
|
1428
1499
|
if (isTerminalSessionRecordStatus(status) || isDeadStatus(status)) return false;
|
|
1429
|
-
return isReadyStatus(status) ||
|
|
1500
|
+
return isReadyStatus(status) || record2.activeChat?.status === "waiting_input";
|
|
1430
1501
|
}
|
|
1431
1502
|
|
|
1432
1503
|
// src/mesh-vocabulary.ts
|
|
1433
|
-
var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "failed", "cancelled"];
|
|
1434
|
-
var MESH_TERMINAL_TASK_STATUSES = ["completed", "failed", "cancelled"];
|
|
1504
|
+
var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "blocked", "failed", "cancelled"];
|
|
1505
|
+
var MESH_TERMINAL_TASK_STATUSES = ["completed", "blocked", "failed", "cancelled"];
|
|
1435
1506
|
var MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
1436
1507
|
var MESH_TASK_PRIORITIES = ["low", "normal", "high"];
|
|
1437
1508
|
var MESH_THINKING_LEVELS = ["low", "medium", "high"];
|
|
1438
1509
|
var MESH_DELIVERY_MODES = ["when_idle", "interrupt"];
|
|
1439
1510
|
var MESH_SESSION_CLEANUP_MODES = ["preserve", "stop", "delete_stopped", "stop_and_delete"];
|
|
1440
1511
|
var WORKER_REPORT_OUTCOMES = ["completed", "blocked", "failed"];
|
|
1512
|
+
var WORKER_REPORT_SUMMARY_MAX_CHARS = 8e3;
|
|
1441
1513
|
var WORKER_BRANCH_STATES = [
|
|
1442
1514
|
"merged_to_main",
|
|
1443
1515
|
"pushed_feature_branch_needs_merge",
|
|
@@ -1504,6 +1576,7 @@ var SEND_REFUSAL_REASONS = [
|
|
|
1504
1576
|
"no_target",
|
|
1505
1577
|
"bootstrap_pending",
|
|
1506
1578
|
"duplicate_dispatch",
|
|
1579
|
+
"new_work_held",
|
|
1507
1580
|
"internal_error"
|
|
1508
1581
|
];
|
|
1509
1582
|
function isSendRefusal(value) {
|
|
@@ -1535,6 +1608,14 @@ function isOutboundMessage(value) {
|
|
|
1535
1608
|
const candidate = value;
|
|
1536
1609
|
return isMessageId(candidate.messageId) && typeof candidate.sessionId === "string" && candidate.sessionId.length > 0 && isInputEnvelopeWire(candidate.input) && isOutboundMessageOrigin(candidate.origin) && isSendPolicy(candidate.policy) && typeof candidate.createdAt === "number";
|
|
1537
1610
|
}
|
|
1611
|
+
var PASTED_OPEN_RE = /^\s*<pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
|
|
1612
|
+
var PASTED_CLOSE_RE = /^\s*<\/pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
|
|
1613
|
+
function unwrapPastedContent(text) {
|
|
1614
|
+
const lines = text.replace(/\r\n?/g, "\n").split("\n");
|
|
1615
|
+
const first = lines.findIndex((line) => line.trim());
|
|
1616
|
+
if (first < 0 || !PASTED_OPEN_RE.test(lines[first])) return text;
|
|
1617
|
+
return lines.filter((line) => !PASTED_OPEN_RE.test(line) && !PASTED_CLOSE_RE.test(line)).join("\n");
|
|
1618
|
+
}
|
|
1538
1619
|
|
|
1539
1620
|
// src/mission-brief.ts
|
|
1540
1621
|
var GOAL_MAX = 500;
|
|
@@ -1620,13 +1701,38 @@ var WORKER_TOOLS = [
|
|
|
1620
1701
|
"peer_context_pull",
|
|
1621
1702
|
"git_status",
|
|
1622
1703
|
"git_log",
|
|
1623
|
-
"git_diff"
|
|
1704
|
+
"git_diff",
|
|
1705
|
+
"driver_list",
|
|
1706
|
+
"driver_describe",
|
|
1707
|
+
"driver_invoke",
|
|
1708
|
+
"driver_scaffold",
|
|
1709
|
+
"driver_validate",
|
|
1710
|
+
"driver_export",
|
|
1711
|
+
"driver_install",
|
|
1712
|
+
"artifact_register",
|
|
1713
|
+
"artifact_list",
|
|
1714
|
+
"artifact_read",
|
|
1715
|
+
// Contract versioning (Cut A): exact pinned-unit reads (E2), the explicit
|
|
1716
|
+
// read claim (C1) and the authoritative head/notice pull.
|
|
1717
|
+
"contract_read",
|
|
1718
|
+
"contract_observe",
|
|
1719
|
+
"contract_current"
|
|
1624
1720
|
];
|
|
1625
1721
|
var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
|
|
1626
1722
|
function isWorkerTool(value) {
|
|
1627
1723
|
return typeof value === "string" && WORKER_TOOL_SET.has(value);
|
|
1628
1724
|
}
|
|
1629
1725
|
var WORKER_PROTOCOL_FOOTER_MARKER = "--- adhdev worker protocol ---";
|
|
1726
|
+
function renderLightWorkspaceRules(light) {
|
|
1727
|
+
const base = light.ossBaseSha ? `${light.baseSha} (oss ${light.ossBaseSha})` : light.baseSha;
|
|
1728
|
+
return [
|
|
1729
|
+
`You are working in a temporary light workspace at \`${light.workspace}\` based on \`${base}\`. Work only inside it. Commit your change there (the branch is already set up); do not push.`,
|
|
1730
|
+
"Do not run `npm install`/`npm ci`/`npm rebuild`/`node-gyp`, do not change package.json or lockfiles \u2014 if the fix needs a dependency change, stop and report `blocked`.",
|
|
1731
|
+
"Do not start long-running servers on fixed ports. Run the narrowest tests that cover your change and list them in `report_completion.testsRun`.",
|
|
1732
|
+
light.ownedPaths.length ? `Stay inside \`owned_paths\` (${light.ownedPaths.join(", ")}); if you must touch more, say why in the summary.` : "Stay inside the paths the task names; if you must touch more, say why in the summary."
|
|
1733
|
+
];
|
|
1734
|
+
}
|
|
1735
|
+
var WORKER_CURRENT_BRANCH_RULE = "Commit your change on the branch that is currently checked out in this workspace. Do not create or switch branches (no `git checkout -b` / `git switch`) unless the task explicitly says to; report the branch you committed on.";
|
|
1630
1736
|
function hasWorkerProtocolFooter(body) {
|
|
1631
1737
|
return typeof body === "string" && body.includes(WORKER_PROTOCOL_FOOTER_MARKER);
|
|
1632
1738
|
}
|
|
@@ -1648,6 +1754,8 @@ function renderWorkerProtocolFooter(input = {}) {
|
|
|
1648
1754
|
if (input.readonly) scope.push("read-only");
|
|
1649
1755
|
if (scope.length) lines.push(`You are a delegated worker (${scope.join(", ")}).`);
|
|
1650
1756
|
else lines.push("You are a delegated worker.");
|
|
1757
|
+
if (input.light) lines.push(...renderLightWorkspaceRules(input.light));
|
|
1758
|
+
else if (input.commitOnCurrentBranch && input.stage?.role !== "review") lines.push(WORKER_CURRENT_BRANCH_RULE);
|
|
1651
1759
|
if (input.workerMcp === false) {
|
|
1652
1760
|
lines.push(
|
|
1653
1761
|
"This session has NO adhdev worker tools (`report_completion`, `progress_update`, `peer_context_pull`, `git_*`) \u2014 do not look for them. When your work is finished, blocked, or has failed, end your turn with a plain final summary: what you did, what you found, which files you changed, and where you left the branch. That final message is what the coordinator receives.",
|
|
@@ -1667,15 +1775,30 @@ function renderWorkerProtocolFooter(input = {}) {
|
|
|
1667
1775
|
"Memos from the coordinator arrive appended to the response of whichever worker tool you call next; read them and follow them.",
|
|
1668
1776
|
"You have no coordinator tools (no `mesh_*`) by design: do not enqueue, dispatch, or restart anything. If you need a decision from the coordinator, finish with `report_completion` and outcome `blocked`, listing what you need in `blockers`.",
|
|
1669
1777
|
"On a code-changing task, `report_completion` with outcome `completed` requires `touched_files` \u2014 send `[]` if you changed nothing, omitting the field is what gets refused. `blocked`/`failed` never need it, and a read-only task should omit it or send `[]`.",
|
|
1670
|
-
"If `report_completion` is refused, the response carries `validationErrors` (or a `hint`) naming exactly what to fix \u2014 correct that field and call it again; a refusal records nothing."
|
|
1778
|
+
"If `report_completion` is refused, the response carries `validationErrors` (or a `hint`) naming exactly what to fix \u2014 correct that field and call it again; a refusal records nothing.",
|
|
1779
|
+
"Put substantial findings (a diagnosis, evidence, repro steps, review findings) in a workspace file and register it with `artifact_register`, then cite the returned ids in `report_completion` `artifact_ids`. The next task in this mission inherits them as input artifacts instead of re-investigating \u2014 keep each artifact self-contained and factual.",
|
|
1780
|
+
"`driver_invoke` results that carry an image or a large body arrive already registered: take `artifacts[].artifactId` from the result and cite it in `artifact_ids` \u2014 do not paste the body."
|
|
1671
1781
|
);
|
|
1672
1782
|
if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
|
|
1673
1783
|
lines.push(
|
|
1674
1784
|
`The ${input.enclosedHandoffNotes} handoff note(s) above were written by agents who touched this code before you; honour their conflict guidance and add your own in \`handoff_notes\` when you report.`
|
|
1675
1785
|
);
|
|
1676
1786
|
}
|
|
1787
|
+
if (input.stage) lines.push(...renderStageProtocolLines(input.stage));
|
|
1677
1788
|
return lines.join("\n");
|
|
1678
1789
|
}
|
|
1790
|
+
function renderStageProtocolLines(stage) {
|
|
1791
|
+
if (stage.role === "review") {
|
|
1792
|
+
return [
|
|
1793
|
+
`STAGE: you are the independent reviewer (round ${stage.round} of at most ${stage.maxRevisions + 1}). Read the input artifacts first (diff, self-check log, previous verdict).` + (stage.workspace ? ` Your workspace ${stage.workspace} is pinned to the round head \u2014 you may run tests, but nothing you change lands; do not fix, record findings instead.` : " Do not modify the workspace: read it, and record findings instead of fixing."),
|
|
1794
|
+
"Your `report_completion` MUST carry `review`: {verdict: approve | approve_with_nits | changes_requested | reject_approach, findings[{id, severity, category, claim, evidence, suggested_fix?}], checked[], not_checked[], tests_run?[]}. `changes_requested` needs at least one blocking/major finding; `approve` allows none. From round 2 also give `prior_findings[{id, status}]` for every earlier blocking/major finding. `reject_approach` is only for a wrong approach, not for fixable defects."
|
|
1795
|
+
];
|
|
1796
|
+
}
|
|
1797
|
+
return [
|
|
1798
|
+
`STAGE: your \`report_completion\` is a stage report (${stage.role}, round ${stage.round}). An independent reviewer reads your diff next, so commit your work and leave the workspace clean before you report. You may receive review findings as a follow-up memo in this same session.`,
|
|
1799
|
+
...stage.role === "revise" ? ["For every open blocking/major finding in the memo, fill `finding_responses[{id, response: fixed | disputed, note}]` \u2014 `disputed` needs your reasoning; the reviewer judges it next round."] : []
|
|
1800
|
+
];
|
|
1801
|
+
}
|
|
1679
1802
|
function stripWorkerProtocolFooter(body) {
|
|
1680
1803
|
if (typeof body !== "string") return body;
|
|
1681
1804
|
const at = body.indexOf(WORKER_PROTOCOL_FOOTER_MARKER);
|
|
@@ -1705,15 +1828,30 @@ function renderCoordinatorWorkerSection() {
|
|
|
1705
1828
|
// src/assistant-protocol.ts
|
|
1706
1829
|
var ASSISTANT_TOOLS = [
|
|
1707
1830
|
"projects",
|
|
1831
|
+
"environment",
|
|
1832
|
+
"assistant_action",
|
|
1833
|
+
"project_watch",
|
|
1708
1834
|
"project_status",
|
|
1709
1835
|
"project_send",
|
|
1710
1836
|
"project_read",
|
|
1711
1837
|
"project_add",
|
|
1838
|
+
"project_attach_remote",
|
|
1712
1839
|
"discover_repos",
|
|
1713
1840
|
"memory",
|
|
1841
|
+
"memory_search",
|
|
1714
1842
|
"skill_view",
|
|
1715
1843
|
"skill_manage",
|
|
1716
|
-
"project_note"
|
|
1844
|
+
"project_note",
|
|
1845
|
+
"launch_defaults",
|
|
1846
|
+
"launch_defaults_set",
|
|
1847
|
+
"driver_list",
|
|
1848
|
+
"driver_describe",
|
|
1849
|
+
"artifact_list",
|
|
1850
|
+
"artifact_read",
|
|
1851
|
+
"decision_answer",
|
|
1852
|
+
"decision_request",
|
|
1853
|
+
"session_control",
|
|
1854
|
+
"file_transfer"
|
|
1717
1855
|
];
|
|
1718
1856
|
var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
|
|
1719
1857
|
function isAssistantTool(value) {
|
|
@@ -1721,50 +1859,170 @@ function isAssistantTool(value) {
|
|
|
1721
1859
|
}
|
|
1722
1860
|
var ASSISTANT_VERB = {
|
|
1723
1861
|
// tool verbs
|
|
1862
|
+
driverList: "driver_list",
|
|
1863
|
+
driverDescribe: "driver_describe",
|
|
1724
1864
|
projects: "assistant_projects",
|
|
1865
|
+
environment: "assistant_environment",
|
|
1866
|
+
action: "assistant_action",
|
|
1867
|
+
watch: "assistant_project_watch",
|
|
1868
|
+
executionState: "assistant_execution_state",
|
|
1869
|
+
executionSettings: "assistant_execution_settings",
|
|
1725
1870
|
projectStatus: "assistant_project_status",
|
|
1726
1871
|
projectSend: "assistant_project_send",
|
|
1727
1872
|
projectRead: "assistant_project_read",
|
|
1728
1873
|
projectAdd: "assistant_project_add",
|
|
1874
|
+
projectAttachRemote: "assistant_project_attach_remote",
|
|
1729
1875
|
discoverRepos: "assistant_discover_repos",
|
|
1730
1876
|
memory: "assistant_memory",
|
|
1877
|
+
/** Pull-only FTS search over the archive tier (memory design 2026-11-01 §3.4). */
|
|
1878
|
+
memorySearch: "assistant_memory_search",
|
|
1731
1879
|
skillView: "assistant_skill_view",
|
|
1732
1880
|
skillManage: "assistant_skill_manage",
|
|
1733
1881
|
projectNote: "assistant_project_note",
|
|
1882
|
+
launchDefaults: "assistant_launch_defaults",
|
|
1883
|
+
launchDefaultsSet: "assistant_launch_defaults_set",
|
|
1884
|
+
artifactList: "assistant_artifact_list",
|
|
1885
|
+
artifactRead: "assistant_artifact_read",
|
|
1886
|
+
/** Owner-decision inbox (structured-missions design 2026-10-28 §6.3): the owner's words recorded as answers. */
|
|
1887
|
+
decisionAnswer: "assistant_decision_answer",
|
|
1888
|
+
/** Register a plain-text question a coordinator put to the owner as a decision item (§5.2). */
|
|
1889
|
+
decisionRequest: "assistant_decision_request",
|
|
1890
|
+
/** Stop / restart / switch the provider of a coordinator, worker or the assistant session (handoff design 2026-11-01 §4). */
|
|
1891
|
+
sessionControl: "assistant_session_control",
|
|
1892
|
+
/** Request / status / cancel the assistant's own project file transfers (owner approves in the dashboard; file-transfer design section 6). */
|
|
1893
|
+
fileTransfer: "assistant_file_transfer",
|
|
1734
1894
|
// assistant-side daemon verbs without a tool of the same name
|
|
1735
1895
|
launch: "launch_assistant",
|
|
1736
1896
|
pendingRelays: "assistant_pending_relays",
|
|
1737
1897
|
// owner verbs (dashboard only)
|
|
1738
1898
|
stagedResolve: "assistant_staged_resolve",
|
|
1739
1899
|
storeAdmin: "assistant_store_admin",
|
|
1740
|
-
importSkills: "assistant_import_skills"
|
|
1900
|
+
importSkills: "assistant_import_skills",
|
|
1901
|
+
/** Owner skill list (attach/view counts, save proposals, recent skill metrics); reads move no counter. */
|
|
1902
|
+
skillsList: "assistant_skills_list",
|
|
1903
|
+
/** Owner: what the assistant remembered recently, with undo handles (memory design §3.2). */
|
|
1904
|
+
memoryDigest: "assistant_memory_digest",
|
|
1905
|
+
/** Owner: reverse one remembered write or one batch (memory design §3.2). Never an assistant tool. */
|
|
1906
|
+
memoryUndo: "assistant_memory_undo",
|
|
1907
|
+
/** Projects the assistant is following (open relay threads) — list / stop following. */
|
|
1908
|
+
threads: "assistant_threads",
|
|
1909
|
+
threadClose: "assistant_thread_close"
|
|
1741
1910
|
};
|
|
1742
1911
|
var ASSISTANT_TOOL_VERBS = {
|
|
1912
|
+
driver_list: ASSISTANT_VERB.driverList,
|
|
1913
|
+
driver_describe: ASSISTANT_VERB.driverDescribe,
|
|
1743
1914
|
projects: ASSISTANT_VERB.projects,
|
|
1915
|
+
environment: ASSISTANT_VERB.environment,
|
|
1916
|
+
assistant_action: ASSISTANT_VERB.action,
|
|
1917
|
+
project_watch: ASSISTANT_VERB.watch,
|
|
1744
1918
|
project_status: ASSISTANT_VERB.projectStatus,
|
|
1745
1919
|
project_send: ASSISTANT_VERB.projectSend,
|
|
1746
1920
|
project_read: ASSISTANT_VERB.projectRead,
|
|
1747
1921
|
project_add: ASSISTANT_VERB.projectAdd,
|
|
1922
|
+
project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
|
|
1748
1923
|
discover_repos: ASSISTANT_VERB.discoverRepos,
|
|
1749
1924
|
memory: ASSISTANT_VERB.memory,
|
|
1925
|
+
memory_search: ASSISTANT_VERB.memorySearch,
|
|
1750
1926
|
skill_view: ASSISTANT_VERB.skillView,
|
|
1751
1927
|
skill_manage: ASSISTANT_VERB.skillManage,
|
|
1752
|
-
project_note: ASSISTANT_VERB.projectNote
|
|
1928
|
+
project_note: ASSISTANT_VERB.projectNote,
|
|
1929
|
+
launch_defaults: ASSISTANT_VERB.launchDefaults,
|
|
1930
|
+
launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet,
|
|
1931
|
+
artifact_list: ASSISTANT_VERB.artifactList,
|
|
1932
|
+
artifact_read: ASSISTANT_VERB.artifactRead,
|
|
1933
|
+
decision_answer: ASSISTANT_VERB.decisionAnswer,
|
|
1934
|
+
decision_request: ASSISTANT_VERB.decisionRequest,
|
|
1935
|
+
session_control: ASSISTANT_VERB.sessionControl,
|
|
1936
|
+
file_transfer: ASSISTANT_VERB.fileTransfer
|
|
1753
1937
|
};
|
|
1754
|
-
var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
|
|
1938
|
+
var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add", "project_attach_remote", "launch_defaults_set", "decision_answer", "decision_request", "session_control", "file_transfer"];
|
|
1755
1939
|
var ASSISTANT_OWNER_VERBS = [
|
|
1940
|
+
ASSISTANT_VERB.executionSettings,
|
|
1756
1941
|
ASSISTANT_VERB.stagedResolve,
|
|
1757
1942
|
ASSISTANT_VERB.storeAdmin,
|
|
1758
|
-
ASSISTANT_VERB.importSkills
|
|
1943
|
+
ASSISTANT_VERB.importSkills,
|
|
1944
|
+
ASSISTANT_VERB.skillsList,
|
|
1945
|
+
ASSISTANT_VERB.memoryDigest,
|
|
1946
|
+
ASSISTANT_VERB.memoryUndo,
|
|
1947
|
+
ASSISTANT_VERB.threadClose
|
|
1759
1948
|
];
|
|
1760
1949
|
var ASSISTANT_REVIEW_TURN_VERBS = [
|
|
1761
1950
|
ASSISTANT_VERB.memory,
|
|
1951
|
+
ASSISTANT_VERB.memorySearch,
|
|
1762
1952
|
ASSISTANT_VERB.skillView,
|
|
1763
1953
|
ASSISTANT_VERB.skillManage,
|
|
1764
1954
|
ASSISTANT_VERB.projectNote
|
|
1765
1955
|
];
|
|
1766
1956
|
var ASSISTANT_SESSION_ID_ENV = "ADHDEV_ASSISTANT_SESSION_ID";
|
|
1767
1957
|
var ASSISTANT_SESSION_ID_ARG = "assistantSessionId";
|
|
1958
|
+
var ASSISTANT_ACCOUNT_SLOT = "personal";
|
|
1959
|
+
var ASSISTANT_REMOTE_PROJECT_COMMAND = "assistant_remote_project";
|
|
1960
|
+
var ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND = "assistant_remote_project_catalog";
|
|
1961
|
+
var ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND = "assistant_remote_project_access";
|
|
1962
|
+
var ASSISTANT_REMOTE_FOLLOW_COMMAND = "assistant_remote_follow";
|
|
1963
|
+
var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send", "artifact_list", "artifact_read", "decision_list", "decision_answer", "decision_request"];
|
|
1964
|
+
var ASSISTANT_FOLLOWER_ALLOWED_OP_SET = new Set(ASSISTANT_FOLLOWER_ALLOWED_OPS);
|
|
1965
|
+
function isAssistantFollowerAllowedOp(value) {
|
|
1966
|
+
return typeof value === "string" && ASSISTANT_FOLLOWER_ALLOWED_OP_SET.has(value);
|
|
1967
|
+
}
|
|
1968
|
+
var DECISION_OP_IMPLIED_BY = {
|
|
1969
|
+
decision_list: "status",
|
|
1970
|
+
decision_answer: "send",
|
|
1971
|
+
decision_request: "send"
|
|
1972
|
+
};
|
|
1973
|
+
function followerOpPermitted(op, allowedOps) {
|
|
1974
|
+
if (!isAssistantFollowerAllowedOp(op)) return false;
|
|
1975
|
+
if (allowedOps.includes(op)) return true;
|
|
1976
|
+
const implied = DECISION_OP_IMPLIED_BY[op];
|
|
1977
|
+
return implied !== void 0 && allowedOps.includes(implied);
|
|
1978
|
+
}
|
|
1979
|
+
function followedRemoteProjectKey(hostDaemonId, meshId) {
|
|
1980
|
+
const canonHost = canonicalDaemonId(hostDaemonId) ?? hostDaemonId.trim();
|
|
1981
|
+
return `${canonHost}::${meshId.trim()}`;
|
|
1982
|
+
}
|
|
1983
|
+
function sanitizeRemoteRepoIdentity(raw) {
|
|
1984
|
+
if (typeof raw !== "string") return null;
|
|
1985
|
+
const trimmed = raw.trim();
|
|
1986
|
+
if (!trimmed) return null;
|
|
1987
|
+
if (trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("~/") || trimmed.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(trimmed) || /^file:/i.test(trimmed)) {
|
|
1988
|
+
return null;
|
|
1989
|
+
}
|
|
1990
|
+
const withoutQuery = trimmed.replace(/[?#].*$/, "").replace(/\/+$/, "");
|
|
1991
|
+
if (!withoutQuery) return null;
|
|
1992
|
+
let host = "";
|
|
1993
|
+
let repoPath = "";
|
|
1994
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(withoutQuery)) {
|
|
1995
|
+
try {
|
|
1996
|
+
const url = new URL(withoutQuery);
|
|
1997
|
+
if (url.protocol === "file:") return null;
|
|
1998
|
+
host = url.hostname.toLowerCase();
|
|
1999
|
+
repoPath = decodeURIComponent(url.pathname).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
2000
|
+
} catch {
|
|
2001
|
+
return null;
|
|
2002
|
+
}
|
|
2003
|
+
} else {
|
|
2004
|
+
const scpMatch = withoutQuery.match(/^(?:[^@/:]+@)?(\[[^\]]+\]|[^/:]+):(.+)$/);
|
|
2005
|
+
if (scpMatch) {
|
|
2006
|
+
host = scpMatch[1].replace(/^\[|\]$/g, "").toLowerCase();
|
|
2007
|
+
repoPath = scpMatch[2].replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
2008
|
+
} else {
|
|
2009
|
+
const slash = withoutQuery.indexOf("/");
|
|
2010
|
+
if (slash > 0) {
|
|
2011
|
+
const rawHost = withoutQuery.slice(0, slash);
|
|
2012
|
+
const atIdx = rawHost.lastIndexOf("@");
|
|
2013
|
+
host = (atIdx >= 0 ? rawHost.slice(atIdx + 1) : rawHost).toLowerCase();
|
|
2014
|
+
repoPath = withoutQuery.slice(slash + 1).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
if (!host || !repoPath) return null;
|
|
2019
|
+
if (!host.includes(".") && host !== "localhost") return null;
|
|
2020
|
+
if (/[\s@:\\]/.test(host)) return null;
|
|
2021
|
+
const segments = repoPath.split("/").filter(Boolean);
|
|
2022
|
+
if (segments.length === 0) return null;
|
|
2023
|
+
if (segments.some((seg) => seg === "." || seg === ".." || /[\s@:\\]/.test(seg))) return null;
|
|
2024
|
+
return `${host}/${segments.join("/")}`.slice(0, 200);
|
|
2025
|
+
}
|
|
1768
2026
|
|
|
1769
2027
|
// src/turn-evidence.ts
|
|
1770
2028
|
var MESH_TOPIC_PROTOCOL_VERSION = 2;
|
|
@@ -1800,18 +2058,29 @@ var TURN_SCOPES = ["mesh_queue", "mesh_direct", "plain"];
|
|
|
1800
2058
|
var RECLAIMING_SEND_REFUSALS = ["session_exited", "no_target", "unsupported_input"];
|
|
1801
2059
|
var DELIVERY_OUTCOMES = ["delivered", "queued"];
|
|
1802
2060
|
var DELIVERY_VIAS = ["local", "p2p"];
|
|
1803
|
-
var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout"];
|
|
2061
|
+
var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout", "submit_unconfirmed"];
|
|
1804
2062
|
function sanitizeRefusalCode(value) {
|
|
1805
2063
|
if (typeof value !== "string") return void 0;
|
|
1806
2064
|
const normalized = value.trim().toLowerCase().replace(/[^a-z_]/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
|
|
1807
2065
|
if (!normalized) return void 0;
|
|
1808
2066
|
return normalized.slice(0, 64);
|
|
1809
2067
|
}
|
|
2068
|
+
var DISPATCH_REFUSAL_DETAIL_MAX = 200;
|
|
2069
|
+
function sanitizeDispatchRefusalDetail(code, message) {
|
|
2070
|
+
const cleanCode = sanitizeRefusalCode(code);
|
|
2071
|
+
let cleanMessage;
|
|
2072
|
+
if (typeof message === "string") {
|
|
2073
|
+
const line = message.replace(/(?:[A-Za-z]:)?[\\/](?:Users|home)[\\/][^\s\\/]+/g, "~").replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
|
|
2074
|
+
if (line) cleanMessage = line.length > DISPATCH_REFUSAL_DETAIL_MAX ? `${line.slice(0, DISPATCH_REFUSAL_DETAIL_MAX - 1)}\u2026` : line;
|
|
2075
|
+
}
|
|
2076
|
+
if (!cleanCode && !cleanMessage) return void 0;
|
|
2077
|
+
return { ...cleanCode ? { code: cleanCode } : {}, ...cleanMessage ? { message: cleanMessage } : {} };
|
|
2078
|
+
}
|
|
1810
2079
|
var CONSUME_PROFILES = ["default", "native_source"];
|
|
1811
2080
|
var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
|
|
1812
2081
|
var SUSPENSION_MODALS = ["approval", "choice"];
|
|
1813
|
-
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
|
|
1814
|
-
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
|
|
2082
|
+
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
|
|
2083
|
+
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
|
|
1815
2084
|
var TURN_END_STRENGTHS = ["genuine", "weak"];
|
|
1816
2085
|
var TURN_END_BLOCK_REASONS = [
|
|
1817
2086
|
"missing_final_assistant",
|
|
@@ -1819,9 +2088,9 @@ var TURN_END_BLOCK_REASONS = [
|
|
|
1819
2088
|
"terminal_block_hard_cap",
|
|
1820
2089
|
"decoupled_completion"
|
|
1821
2090
|
];
|
|
1822
|
-
var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
|
|
2091
|
+
var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
|
|
1823
2092
|
var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
|
|
1824
|
-
var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
|
|
2093
|
+
var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
|
|
1825
2094
|
var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
|
|
1826
2095
|
var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
|
|
1827
2096
|
var OPERATOR_STATUSES = ["completed", "failed"];
|
|
@@ -1848,9 +2117,10 @@ var HOLD_REASONS = [
|
|
|
1848
2117
|
// — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
|
|
1849
2118
|
// a session whose FSM never shows the idle edge again does not wait for
|
|
1850
2119
|
// liveness / hard_ceiling.
|
|
1851
|
-
"await_end"
|
|
2120
|
+
"await_end",
|
|
2121
|
+
"report_correction"
|
|
1852
2122
|
];
|
|
1853
|
-
var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
|
|
2123
|
+
var TURN_OUTCOMES = ["completed", "blocked", "failed", "cancelled"];
|
|
1854
2124
|
var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
|
|
1855
2125
|
var TURN_REASONS = [
|
|
1856
2126
|
// commits
|
|
@@ -1859,9 +2129,15 @@ var TURN_REASONS = [
|
|
|
1859
2129
|
"transcript_final",
|
|
1860
2130
|
"worker_reported",
|
|
1861
2131
|
"finalization_timeout_no_response",
|
|
2132
|
+
"weak_end_liveness_unconfirmed",
|
|
2133
|
+
"weak_end_probe_unobserved",
|
|
2134
|
+
"report_correction_expired",
|
|
1862
2135
|
"session_error",
|
|
1863
2136
|
"provider_auth_failed",
|
|
1864
2137
|
"provider_billing_failed",
|
|
2138
|
+
"provider_usage_limit_exceeded",
|
|
2139
|
+
"provider_server_overloaded",
|
|
2140
|
+
"provider_error",
|
|
1865
2141
|
"operator_cancel",
|
|
1866
2142
|
"intentional_cleanup",
|
|
1867
2143
|
"task_removed",
|
|
@@ -1874,6 +2150,8 @@ var TURN_REASONS = [
|
|
|
1874
2150
|
"reclaim_budget_exhausted",
|
|
1875
2151
|
"hollow_max_retries",
|
|
1876
2152
|
"migration_orphan",
|
|
2153
|
+
// a stopping attempt whose writer node stayed unreachable (or was removed) past the bound
|
|
2154
|
+
"writer_unreachable",
|
|
1877
2155
|
// reclaims (generation + 1)
|
|
1878
2156
|
"dispatch_refused_session_exited",
|
|
1879
2157
|
"dispatch_refused_no_target",
|
|
@@ -1889,6 +2167,7 @@ var TURN_REASONS = [
|
|
|
1889
2167
|
];
|
|
1890
2168
|
var NOTIFY_KINDS = [
|
|
1891
2169
|
"completed",
|
|
2170
|
+
"blocked",
|
|
1892
2171
|
"failed",
|
|
1893
2172
|
"cancelled",
|
|
1894
2173
|
"stopped",
|
|
@@ -1938,8 +2217,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1938
2217
|
duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
|
|
1939
2218
|
session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
|
|
1940
2219
|
turn_started: { retro: bool },
|
|
1941
|
-
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
|
|
1942
|
-
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
|
|
2220
|
+
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
|
|
2221
|
+
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
|
|
1943
2222
|
turn_end: {
|
|
1944
2223
|
strength: en(TURN_END_STRENGTHS),
|
|
1945
2224
|
afterFinalizationTimeout: boolOpt,
|
|
@@ -1949,6 +2228,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1949
2228
|
releasedByHardCap: boolOpt,
|
|
1950
2229
|
nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
|
|
1951
2230
|
live: { t: "live", optional: true },
|
|
2231
|
+
nativeMarker: { t: "native_marker", optional: true },
|
|
1952
2232
|
reportExpected: boolOpt,
|
|
1953
2233
|
providerFailure: enOpt(PROVIDER_FAILURES)
|
|
1954
2234
|
},
|
|
@@ -1962,7 +2242,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1962
2242
|
},
|
|
1963
2243
|
transcript_activity: { newestActivityAt: ms },
|
|
1964
2244
|
no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
|
|
1965
|
-
liveness: { result: en(LIVENESS_RESULTS) },
|
|
2245
|
+
liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
|
|
1966
2246
|
process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
|
|
1967
2247
|
session_error: { reason: en(SESSION_ERROR_REASONS) },
|
|
1968
2248
|
worker_report: {
|
|
@@ -1972,6 +2252,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1972
2252
|
branchState: enOpt(WORKER_BRANCH_STATES),
|
|
1973
2253
|
touchedFileCount: intOpt
|
|
1974
2254
|
},
|
|
2255
|
+
worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
|
|
1975
2256
|
worker_progress: { note: { t: "summary_ref", optional: true } },
|
|
1976
2257
|
git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
|
|
1977
2258
|
cancel: { reason: en(CANCEL_REASONS) },
|
|
@@ -2019,7 +2300,7 @@ function isLiveTurnPending(value) {
|
|
|
2019
2300
|
return isRecord2(value) && hasOnlyKeys(value, ["modal", "adapterPending", "trailingTool", "newestActivityAt"]) && typeof value.modal === "boolean" && typeof value.adapterPending === "boolean" && typeof value.trailingTool === "boolean" && (value.newestActivityAt === void 0 || isFiniteNumber2(value.newestActivityAt));
|
|
2020
2301
|
}
|
|
2021
2302
|
function isNativeMarkerRef(value) {
|
|
2022
|
-
return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
|
|
2303
|
+
return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId", "receivedAt", "startedAt", "errorAt"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId)) && ["receivedAt", "startedAt", "errorAt"].every((key) => value[key] === void 0 || isFiniteNumber2(value[key]));
|
|
2023
2304
|
}
|
|
2024
2305
|
function isCoordinatorIdentity(value) {
|
|
2025
2306
|
return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
|
|
@@ -2142,17 +2423,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
|
|
|
2142
2423
|
};
|
|
2143
2424
|
}
|
|
2144
2425
|
|
|
2426
|
+
// src/launch-defaults.ts
|
|
2427
|
+
var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
|
|
2428
|
+
var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
|
|
2429
|
+
var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
2430
|
+
function isLaunchDefaultRole(value) {
|
|
2431
|
+
return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
|
|
2432
|
+
}
|
|
2433
|
+
function isLaunchDefaultSource(value) {
|
|
2434
|
+
return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
|
|
2435
|
+
}
|
|
2436
|
+
var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
2437
|
+
"invalid_args",
|
|
2438
|
+
"launch_default_required",
|
|
2439
|
+
"launch_default_unavailable",
|
|
2440
|
+
"launch_selection_invalid",
|
|
2441
|
+
"launch_default_invalid",
|
|
2442
|
+
"revision_conflict",
|
|
2443
|
+
"store_unavailable",
|
|
2444
|
+
"store_busy",
|
|
2445
|
+
"persistence_failed",
|
|
2446
|
+
"project_not_found",
|
|
2447
|
+
"project_ambiguous",
|
|
2448
|
+
"project_not_hosted",
|
|
2449
|
+
"project_storage_unavailable",
|
|
2450
|
+
"staging_unavailable",
|
|
2451
|
+
"staging_failed",
|
|
2452
|
+
"review_turn_tool_denied"
|
|
2453
|
+
];
|
|
2454
|
+
|
|
2455
|
+
// src/role-launch.ts
|
|
2456
|
+
function record(value) {
|
|
2457
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
2458
|
+
}
|
|
2459
|
+
function ref(value) {
|
|
2460
|
+
const r = record(value);
|
|
2461
|
+
if (!r || !isLaunchDefaultRole(r.role) || r.scope !== "global" && r.scope !== "project" || !Number.isSafeInteger(r.revision) || r.revision < 1 || r.scope === "project" && (typeof r.projectId !== "string" || !r.projectId)) return void 0;
|
|
2462
|
+
return {
|
|
2463
|
+
role: r.role,
|
|
2464
|
+
scope: r.scope,
|
|
2465
|
+
revision: r.revision,
|
|
2466
|
+
...r.scope === "project" ? { projectId: r.projectId } : {}
|
|
2467
|
+
};
|
|
2468
|
+
}
|
|
2469
|
+
function axis(value) {
|
|
2470
|
+
const a = record(value);
|
|
2471
|
+
if (!a || !isLaunchDefaultSource(a.source) || a.value !== null && typeof a.value !== "string") return void 0;
|
|
2472
|
+
const defaultRef = ref(a.defaultRef);
|
|
2473
|
+
if (a.source === "stored_default" && defaultRef?.scope !== "global" || a.source === "project_default" && defaultRef?.scope !== "project" || (a.source === "user" || a.source === "provider_default") && a.defaultRef !== void 0) return void 0;
|
|
2474
|
+
return { value: a.value, source: a.source, ...defaultRef ? { defaultRef } : {} };
|
|
2475
|
+
}
|
|
2476
|
+
function parseRoleLaunchSelection(value) {
|
|
2477
|
+
const r = record(value), s = record(r?.selection), a = record(r?.applied);
|
|
2478
|
+
if (!r || !isLaunchDefaultRole(r.role) || !s || typeof s.provider !== "string" || !s.provider || !Number.isSafeInteger(r.documentRevision) || r.documentRevision < 1 || s.model !== void 0 && typeof s.model !== "string" || s.thinkingLevel !== void 0 && typeof s.thinkingLevel !== "string") return void 0;
|
|
2479
|
+
const provider = axis(a?.provider), model = axis(a?.model), thinkingLevel = axis(a?.thinkingLevel);
|
|
2480
|
+
if (!provider || !model || !thinkingLevel || [provider, model, thinkingLevel].some((axis2) => axis2.defaultRef && (axis2.defaultRef.role !== r.role || axis2.defaultRef.scope === "global" && axis2.defaultRef.revision > r.documentRevision)) || provider.value !== s.provider || model.value !== (s.model ?? null) || thinkingLevel.value !== (s.thinkingLevel ?? null)) return void 0;
|
|
2481
|
+
const defaultRef = ref(r.defaultRef);
|
|
2482
|
+
return {
|
|
2483
|
+
role: r.role,
|
|
2484
|
+
selection: {
|
|
2485
|
+
provider: s.provider,
|
|
2486
|
+
...typeof s.model === "string" ? { model: s.model } : {},
|
|
2487
|
+
...typeof s.thinkingLevel === "string" ? { thinkingLevel: s.thinkingLevel } : {}
|
|
2488
|
+
},
|
|
2489
|
+
applied: { provider, model, thinkingLevel },
|
|
2490
|
+
...defaultRef ? { defaultRef } : {},
|
|
2491
|
+
documentRevision: r.documentRevision
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2145
2495
|
// src/session-launch.ts
|
|
2146
2496
|
var MODEL_AXIS_SOURCES = [
|
|
2147
2497
|
/** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
|
|
2148
2498
|
"user",
|
|
2149
2499
|
/** The dashboard dialog restored it from the last launch (browser-local memory). */
|
|
2150
2500
|
"remembered",
|
|
2501
|
+
/** The authoritative daemon role default or host project override. */
|
|
2502
|
+
"stored_default",
|
|
2503
|
+
"project_default",
|
|
2151
2504
|
/** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
|
|
2152
2505
|
"mesh_slot",
|
|
2153
2506
|
/** An explicit per-task model / thinking level on a mesh queue task. */
|
|
2154
2507
|
"task_override",
|
|
2155
|
-
/** Nothing
|
|
2508
|
+
/** Nothing requested: the provider chooses; resolvedDefault records it when known. */
|
|
2156
2509
|
"provider_default",
|
|
2157
2510
|
/** A value was requested without saying where it came from, or nothing is known. */
|
|
2158
2511
|
"unspecified"
|
|
@@ -2196,10 +2549,10 @@ function readFiniteNumber(value) {
|
|
|
2196
2549
|
}
|
|
2197
2550
|
function parseModelSelection(raw) {
|
|
2198
2551
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2199
|
-
const
|
|
2552
|
+
const record2 = raw;
|
|
2200
2553
|
const history = [];
|
|
2201
|
-
if (Array.isArray(
|
|
2202
|
-
for (const entry of
|
|
2554
|
+
if (Array.isArray(record2.history)) {
|
|
2555
|
+
for (const entry of record2.history) {
|
|
2203
2556
|
if (!entry || typeof entry !== "object") continue;
|
|
2204
2557
|
const e = entry;
|
|
2205
2558
|
const value = readString(e.value);
|
|
@@ -2208,41 +2561,45 @@ function parseModelSelection(raw) {
|
|
|
2208
2561
|
if (value && at !== void 0 && via) history.push({ at, value, via });
|
|
2209
2562
|
}
|
|
2210
2563
|
}
|
|
2211
|
-
const requested = readString(
|
|
2212
|
-
const launchValue = readString(
|
|
2213
|
-
const resolvedDefault = readString(
|
|
2214
|
-
const current = readString(
|
|
2215
|
-
const observed = readString(
|
|
2216
|
-
const observedAt = readFiniteNumber(
|
|
2564
|
+
const requested = readString(record2.requested);
|
|
2565
|
+
const launchValue = readString(record2.launchValue);
|
|
2566
|
+
const resolvedDefault = readString(record2.resolvedDefault);
|
|
2567
|
+
const current = readString(record2.current);
|
|
2568
|
+
const observed = readString(record2.observed);
|
|
2569
|
+
const observedAt = readFiniteNumber(record2.observedAt);
|
|
2570
|
+
const fallback = record2.fallback === true;
|
|
2217
2571
|
return {
|
|
2218
|
-
source: isModelAxisSource(
|
|
2572
|
+
source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
|
|
2219
2573
|
...requested ? { requested } : {},
|
|
2220
2574
|
...launchValue ? { launchValue } : {},
|
|
2221
2575
|
...resolvedDefault ? { resolvedDefault } : {},
|
|
2222
2576
|
...current ? { current } : {},
|
|
2223
2577
|
...observed ? { observed } : {},
|
|
2224
2578
|
...observedAt !== void 0 ? { observedAt } : {},
|
|
2579
|
+
...fallback ? { fallback } : {},
|
|
2225
2580
|
history: history.slice(-MODEL_SELECTION_HISTORY_LIMIT)
|
|
2226
2581
|
};
|
|
2227
2582
|
}
|
|
2228
2583
|
function parseSessionLaunchRecord(raw) {
|
|
2229
2584
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2230
|
-
const
|
|
2231
|
-
const sessionId = readString(
|
|
2232
|
-
const providerType = readString(
|
|
2233
|
-
const launchedAt = readFiniteNumber(
|
|
2234
|
-
const model = parseModelSelection(
|
|
2235
|
-
const thinkingLevel = parseModelSelection(
|
|
2585
|
+
const record2 = raw;
|
|
2586
|
+
const sessionId = readString(record2.sessionId);
|
|
2587
|
+
const providerType = readString(record2.providerType);
|
|
2588
|
+
const launchedAt = readFiniteNumber(record2.launchedAt);
|
|
2589
|
+
const model = parseModelSelection(record2.model);
|
|
2590
|
+
const thinkingLevel = parseModelSelection(record2.thinkingLevel);
|
|
2236
2591
|
if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
|
|
2237
|
-
const providerVersion = readString(
|
|
2238
|
-
const workspace = readString(
|
|
2239
|
-
const autoApproveModeId = readString(
|
|
2592
|
+
const providerVersion = readString(record2.providerVersion);
|
|
2593
|
+
const workspace = readString(record2.workspace);
|
|
2594
|
+
const autoApproveModeId = readString(record2.autoApproveModeId);
|
|
2595
|
+
const roleLaunch = parseRoleLaunchSelection(record2.roleLaunch);
|
|
2240
2596
|
return {
|
|
2597
|
+
...roleLaunch ? { roleLaunch } : {},
|
|
2241
2598
|
sessionId,
|
|
2242
2599
|
providerType,
|
|
2243
2600
|
...providerVersion ? { providerVersion } : {},
|
|
2244
|
-
...
|
|
2245
|
-
launchedBy: isSessionLaunchedBy(
|
|
2601
|
+
...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
|
|
2602
|
+
launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
|
|
2246
2603
|
launchedAt,
|
|
2247
2604
|
...workspace ? { workspace } : {},
|
|
2248
2605
|
model,
|
|
@@ -2306,7 +2663,7 @@ function isTurnAttemptRefValue(value) {
|
|
|
2306
2663
|
function isTurnObserveResponse(value) {
|
|
2307
2664
|
return isRecord(value) && hasOnlyKeys2(value, ["verdict", "attemptRef", "outcome"]) && isTurnObserveVerdict(value.verdict) && isTurnAttemptRefValue(value.attemptRef) && (value.outcome === void 0 || isTurnOutcomeValue(value.outcome));
|
|
2308
2665
|
}
|
|
2309
|
-
var TURN_OUTCOMES_LOCAL = ["completed", "failed", "cancelled"];
|
|
2666
|
+
var TURN_OUTCOMES_LOCAL = ["completed", "blocked", "failed", "cancelled"];
|
|
2310
2667
|
function isTurnOutcomeValue(value) {
|
|
2311
2668
|
return typeof value === "string" && TURN_OUTCOMES_LOCAL.includes(value);
|
|
2312
2669
|
}
|
|
@@ -2532,8 +2889,23 @@ function isMissionBriefWire(value) {
|
|
|
2532
2889
|
}
|
|
2533
2890
|
return true;
|
|
2534
2891
|
}
|
|
2892
|
+
var STRUCTURED_MISSION_KEYS = ["summary", "releaseNote", "outcome", "outcomeReason", "version", "carryOver", "openItems"];
|
|
2893
|
+
function isOpenItemCountsWire(value) {
|
|
2894
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["remaining", "live_check", "decision", "evidence"])) return false;
|
|
2895
|
+
return ["remaining", "live_check", "decision", "evidence"].every((k) => isNonNegativeInt(value[k]));
|
|
2896
|
+
}
|
|
2897
|
+
function isStructuredMissionFields(value) {
|
|
2898
|
+
for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
|
|
2899
|
+
if (value[k] !== void 0 && typeof value[k] !== "string") return false;
|
|
2900
|
+
}
|
|
2901
|
+
if (value.version !== void 0 && !isNonNegativeInt(value.version)) return false;
|
|
2902
|
+
if (value.carryOver !== void 0 && typeof value.carryOver !== "boolean") return false;
|
|
2903
|
+
if (value.openItems !== void 0 && !isOpenItemCountsWire(value.openItems)) return false;
|
|
2904
|
+
return true;
|
|
2905
|
+
}
|
|
2535
2906
|
function isMeshMissionRecordWire(value) {
|
|
2536
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief"])) return false;
|
|
2907
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief", ...STRUCTURED_MISSION_KEYS])) return false;
|
|
2908
|
+
if (!isStructuredMissionFields(value)) return false;
|
|
2537
2909
|
if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
|
|
2538
2910
|
if (typeof value.title !== "string" || typeof value.goal !== "string") return false;
|
|
2539
2911
|
if (!isMeshMissionStatusValue(value.status)) return false;
|
|
@@ -2541,11 +2913,22 @@ function isMeshMissionRecordWire(value) {
|
|
|
2541
2913
|
return true;
|
|
2542
2914
|
}
|
|
2543
2915
|
function isMissionUpsertRequest(value) {
|
|
2544
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief"])) return false;
|
|
2916
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief", "structured", "summary", "releaseNote", "outcome", "outcomeReason", "carryOverTo", "toCarryOver", "itemsAdd", "itemsUpdate"])) return false;
|
|
2545
2917
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
|
|
2546
2918
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
2547
2919
|
if (value.id !== void 0 && !isEvidenceIdentifier(value.id)) return false;
|
|
2548
|
-
if (typeof value.title !== "string"
|
|
2920
|
+
if (typeof value.title !== "string") return false;
|
|
2921
|
+
if (value.title.trim().length === 0 && value.toCarryOver !== true && value.id === void 0) return false;
|
|
2922
|
+
if (value.structured !== void 0 && typeof value.structured !== "boolean") return false;
|
|
2923
|
+
if (value.toCarryOver !== void 0 && typeof value.toCarryOver !== "boolean") return false;
|
|
2924
|
+
for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
|
|
2925
|
+
if (value[k] !== void 0 && typeof value[k] !== "string") return false;
|
|
2926
|
+
}
|
|
2927
|
+
if (value.carryOverTo !== void 0 && !isEvidenceIdentifier(value.carryOverTo)) return false;
|
|
2928
|
+
for (const k of ["itemsAdd", "itemsUpdate"]) {
|
|
2929
|
+
const list = value[k];
|
|
2930
|
+
if (list !== void 0 && (!Array.isArray(list) || list.length > 500 || !list.every(isRecord))) return false;
|
|
2931
|
+
}
|
|
2549
2932
|
if (value.goal !== void 0 && typeof value.goal !== "string") return false;
|
|
2550
2933
|
if (value.status !== void 0 && !isMeshMissionStatusValue(value.status)) return false;
|
|
2551
2934
|
if (value.brief !== void 0 && value.brief !== null && !isMissionBriefWire(value.brief)) return false;
|
|
@@ -2555,7 +2938,7 @@ function decodeMissionUpsertRequest(value) {
|
|
|
2555
2938
|
return isMissionUpsertRequest(value) ? value : null;
|
|
2556
2939
|
}
|
|
2557
2940
|
function isMissionUpsertResponse(value) {
|
|
2558
|
-
return isRecord(value) && hasOnlyKeys2(value, ["mission"]) && isMeshMissionRecordWire(value.mission);
|
|
2941
|
+
return isRecord(value) && hasOnlyKeys2(value, ["mission", "result"]) && isMeshMissionRecordWire(value.mission) && (value.result === void 0 || isRecord(value.result));
|
|
2559
2942
|
}
|
|
2560
2943
|
function decodeMissionUpsertResponse(value) {
|
|
2561
2944
|
return isMissionUpsertResponse(value) ? value : null;
|
|
@@ -2581,7 +2964,10 @@ function decodeMissionQueryResponse(value) {
|
|
|
2581
2964
|
return isMissionQueryResponse(value) ? value : null;
|
|
2582
2965
|
}
|
|
2583
2966
|
function isMissionListQueryRequest(value) {
|
|
2584
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView"])) return false;
|
|
2967
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView", "structured", "items", "history"])) return false;
|
|
2968
|
+
for (const k of ["structured", "items", "history"]) {
|
|
2969
|
+
if (value[k] !== void 0 && typeof value[k] !== "boolean") return false;
|
|
2970
|
+
}
|
|
2585
2971
|
if (value.meshStatusView !== void 0 && value.meshStatusView !== "compact" && value.meshStatusView !== "verbose") return false;
|
|
2586
2972
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
|
|
2587
2973
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
@@ -2607,12 +2993,13 @@ function isMeshMissionTaskAggregateWire(value) {
|
|
|
2607
2993
|
return value.lastActivityAt === null || typeof value.lastActivityAt === "string";
|
|
2608
2994
|
}
|
|
2609
2995
|
function isMeshMissionStatsWire(value) {
|
|
2610
|
-
const keys = ["missionId", "taskCount", "completed", "failed", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
|
|
2996
|
+
const keys = ["missionId", "taskCount", "completed", "failed", "blocked", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
|
|
2611
2997
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
2612
2998
|
if (!isEvidenceIdentifier(value.missionId)) return false;
|
|
2613
2999
|
for (const k of ["taskCount", "completed", "failed", "totalDurationMs", "retries"]) {
|
|
2614
3000
|
if (!isNonNegativeInt(value[k])) return false;
|
|
2615
3001
|
}
|
|
3002
|
+
if (value.blocked !== void 0 && !isNonNegativeInt(value.blocked)) return false;
|
|
2616
3003
|
if (value.wallClockMs !== null && !isNonNegativeInt(value.wallClockMs)) return false;
|
|
2617
3004
|
if (!Array.isArray(value.incompleteTaskIds) || !value.incompleteTaskIds.every(isEvidenceIdentifier)) return false;
|
|
2618
3005
|
return true;
|
|
@@ -2622,7 +3009,7 @@ function isMissionListSummaryWire(value) {
|
|
|
2622
3009
|
const hasGoal = "goal" in value;
|
|
2623
3010
|
const hasPreview = "goalPreview" in value && "goalTruncated" in value;
|
|
2624
3011
|
if (hasGoal === hasPreview) return false;
|
|
2625
|
-
const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt"];
|
|
3012
|
+
const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt", ...STRUCTURED_MISSION_KEYS, "items", "history"];
|
|
2626
3013
|
const allowed = hasGoal ? [...baseKeys, "goal"] : [...baseKeys, "goalPreview", "goalTruncated"];
|
|
2627
3014
|
if (!hasOnlyKeys2(value, allowed)) return false;
|
|
2628
3015
|
if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
|
|
@@ -2636,6 +3023,10 @@ function isMissionListSummaryWire(value) {
|
|
|
2636
3023
|
if (value.createdAt !== void 0 && typeof value.createdAt !== "string") return false;
|
|
2637
3024
|
if (value.updatedAt !== void 0 && typeof value.updatedAt !== "string") return false;
|
|
2638
3025
|
if (value.closeCandidateEmittedAt !== void 0 && value.closeCandidateEmittedAt !== null && typeof value.closeCandidateEmittedAt !== "string") return false;
|
|
3026
|
+
if (!isStructuredMissionFields(value)) return false;
|
|
3027
|
+
for (const k of ["items", "history"]) {
|
|
3028
|
+
if (value[k] !== void 0 && (!Array.isArray(value[k]) || !value[k].every(isRecord))) return false;
|
|
3029
|
+
}
|
|
2639
3030
|
return true;
|
|
2640
3031
|
}
|
|
2641
3032
|
function isMeshMissionHistoryFoldWire(value) {
|
|
@@ -2734,12 +3125,15 @@ function isLedgerQueryEntryWire(value) {
|
|
|
2734
3125
|
return true;
|
|
2735
3126
|
}
|
|
2736
3127
|
function isLedgerQuerySummaryWire(value) {
|
|
2737
|
-
const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
|
|
3128
|
+
const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskBlocked", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures", "taskBlocked", "refineFailed", "recentRefineFailures"];
|
|
2738
3129
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
2739
3130
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
2740
3131
|
for (const k of ["totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "recentFailures"]) {
|
|
2741
3132
|
if (!isNonNegativeInt(value[k])) return false;
|
|
2742
3133
|
}
|
|
3134
|
+
if (value.taskBlocked !== void 0 && !isNonNegativeInt(value.taskBlocked)) return false;
|
|
3135
|
+
if (value.refineFailed !== void 0 && !isNonNegativeInt(value.refineFailed)) return false;
|
|
3136
|
+
if (value.recentRefineFailures !== void 0 && !isNonNegativeInt(value.recentRefineFailures)) return false;
|
|
2743
3137
|
if (value.lastActivityAt !== null && typeof value.lastActivityAt !== "string") return false;
|
|
2744
3138
|
return true;
|
|
2745
3139
|
}
|
|
@@ -2783,9 +3177,10 @@ function isQueueDependencyHeadWire(value) {
|
|
|
2783
3177
|
return isRecord(value) && hasOnlyKeys2(value, ["id", "status", "cancelReason"]) && typeof value.id === "string" && typeof value.status === "string" && (value.cancelReason === void 0 || typeof value.cancelReason === "string");
|
|
2784
3178
|
}
|
|
2785
3179
|
function isQueueQueryResponse(value) {
|
|
2786
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "dependencyHeads"])) return false;
|
|
3180
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "legacyReportedBlockedCount", "dependencyHeads"])) return false;
|
|
2787
3181
|
if (!Array.isArray(value.entries) || !value.entries.every(isQueueEntryWire)) return false;
|
|
2788
3182
|
if (value.counts !== void 0 && (!isRecord(value.counts) || !Object.values(value.counts).every(isNonNegativeInt))) return false;
|
|
3183
|
+
if (value.legacyReportedBlockedCount !== void 0 && !isNonNegativeInt(value.legacyReportedBlockedCount)) return false;
|
|
2789
3184
|
if (value.oldHistoricalCount !== void 0 && !isNonNegativeInt(value.oldHistoricalCount)) return false;
|
|
2790
3185
|
if (value.dependencyHeads !== void 0 && (!Array.isArray(value.dependencyHeads) || !value.dependencyHeads.every(isQueueDependencyHeadWire))) return false;
|
|
2791
3186
|
return true;
|
|
@@ -2843,7 +3238,7 @@ function decodeQueueRequeueRequest(value) {
|
|
|
2843
3238
|
return isQueueRequeueRequest(value) ? value : null;
|
|
2844
3239
|
}
|
|
2845
3240
|
function isQueueRequeueResponse(value) {
|
|
2846
|
-
return isRecord(value) && hasOnlyKeys2(value, ["task"]) && (value.task === null || isQueueEntryWire(value.task));
|
|
3241
|
+
return isRecord(value) && hasOnlyKeys2(value, ["task", "quotaOverrideRequested"]) && (value.task === null || isQueueEntryWire(value.task)) && (value.quotaOverrideRequested === void 0 || isRecord(value.quotaOverrideRequested) && typeof value.quotaOverrideRequested.decisionId === "string");
|
|
2847
3242
|
}
|
|
2848
3243
|
function decodeQueueRequeueResponse(value) {
|
|
2849
3244
|
return isQueueRequeueResponse(value) ? value : null;
|
|
@@ -2907,6 +3302,24 @@ function isRecoveryContextQueryResponse(value) {
|
|
|
2907
3302
|
function decodeRecoveryContextQueryResponse(value) {
|
|
2908
3303
|
return isRecoveryContextQueryResponse(value) ? value : null;
|
|
2909
3304
|
}
|
|
3305
|
+
function decodeQueueReviseRequest(value) {
|
|
3306
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "taskId", "expectedRevision", "patch", "dryRun", "deferScheduling"]) || value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId) || !isEvidenceIdentifier(value.taskId) || !Number.isSafeInteger(value.expectedRevision) || value.expectedRevision < 0 || !isRecord(value.patch) || !Object.keys(value.patch).length || !hasOnlyKeys2(value.patch, ["message", "ownedPaths", "phase", "dependsOn", "routingPreferences", "review", "difficulty", "requestQuotaOverride", "attestActiveOwnership"])) return null;
|
|
3307
|
+
if (value.dryRun !== void 0 && typeof value.dryRun !== "boolean") return null;
|
|
3308
|
+
if (value.deferScheduling !== void 0 && typeof value.deferScheduling !== "boolean") return null;
|
|
3309
|
+
const p = value.patch;
|
|
3310
|
+
if (p.requestQuotaOverride && (value.dryRun !== void 0 || value.deferScheduling !== void 0)) return null;
|
|
3311
|
+
if (p.requestQuotaOverride !== void 0 && (p.requestQuotaOverride !== true || Object.keys(p).length !== 1)) return null;
|
|
3312
|
+
if (p.attestActiveOwnership && (value.dryRun !== void 0 || value.deferScheduling !== void 0)) return null;
|
|
3313
|
+
if (p.attestActiveOwnership !== void 0 && (p.attestActiveOwnership !== true || Object.keys(p).length !== 1)) return null;
|
|
3314
|
+
if (p.message !== void 0 && (typeof p.message !== "string" || !p.message.trim())) return null;
|
|
3315
|
+
if (p.phase !== void 0 && p.phase !== "source" && p.phase !== "integration") return null;
|
|
3316
|
+
if (p.difficulty !== void 0 && p.difficulty !== "easy" && p.difficulty !== "medium" && p.difficulty !== "difficult" && p.difficulty !== "freeform") return null;
|
|
3317
|
+
for (const key of ["ownedPaths", "dependsOn"]) {
|
|
3318
|
+
if (p[key] !== void 0 && (!Array.isArray(p[key]) || !p[key].every((x) => typeof x === "string" && !!x.trim()))) return null;
|
|
3319
|
+
}
|
|
3320
|
+
return value;
|
|
3321
|
+
}
|
|
3322
|
+
var decodeQueueReviseResponse = decodeQueueRequeueResponse;
|
|
2910
3323
|
|
|
2911
3324
|
// src/turn-ipc-stats.ts
|
|
2912
3325
|
function isTaskStatsQueryRequest(value) {
|
|
@@ -3005,6 +3418,7 @@ var TURN_IPC_COMMANDS = [
|
|
|
3005
3418
|
"queue_enqueue_batch",
|
|
3006
3419
|
"queue_cancel",
|
|
3007
3420
|
"queue_requeue",
|
|
3421
|
+
"queue_revise",
|
|
3008
3422
|
"direct_dispatch_record",
|
|
3009
3423
|
"active_work_query",
|
|
3010
3424
|
"recovery_context_query",
|
|
@@ -3088,14 +3502,11 @@ function normalizeOwnedPaths(input) {
|
|
|
3088
3502
|
}
|
|
3089
3503
|
function entryContains(base, path) {
|
|
3090
3504
|
if (path === base.path) return true;
|
|
3091
|
-
if (base.subtree && (path ===
|
|
3505
|
+
if (base.subtree && (base.path === "" || path.startsWith(`${base.path}/`))) return true;
|
|
3092
3506
|
return false;
|
|
3093
3507
|
}
|
|
3094
3508
|
function entriesOverlap(a, b) {
|
|
3095
|
-
|
|
3096
|
-
if (a.subtree && (b.path === a.path || b.path.startsWith(`${a.path}/`))) return true;
|
|
3097
|
-
if (b.subtree && (a.path === b.path || a.path.startsWith(`${b.path}/`))) return true;
|
|
3098
|
-
return false;
|
|
3509
|
+
return entryContains(a, b.path) || entryContains(b, a.path);
|
|
3099
3510
|
}
|
|
3100
3511
|
function pathsOverlap(a, b) {
|
|
3101
3512
|
if (a.paths.length === 0 || b.paths.length === 0) return false;
|
|
@@ -3147,6 +3558,357 @@ function touchedFilesOutsideOwnership(touched, owned) {
|
|
|
3147
3558
|
return { undeclaredTouched, unusedDeclarations };
|
|
3148
3559
|
}
|
|
3149
3560
|
|
|
3561
|
+
// src/mission-items.ts
|
|
3562
|
+
var MISSION_ITEM_KINDS = ["remaining", "live_check", "decision", "evidence"];
|
|
3563
|
+
var MISSION_ITEM_STATES = ["open", "done", "failed", "dropped", "moved", "answered", "expired", "withdrawn", "superseded"];
|
|
3564
|
+
var COORDINATOR_SETTABLE_ITEM_STATES = {
|
|
3565
|
+
remaining: ["open", "done", "dropped"],
|
|
3566
|
+
live_check: ["open", "done", "dropped"],
|
|
3567
|
+
evidence: ["open", "done", "dropped"],
|
|
3568
|
+
decision: ["open", "withdrawn", "superseded"]
|
|
3569
|
+
};
|
|
3570
|
+
var MISSION_OUTCOMES = ["merged", "verified_live", "superseded", "not_needed", "owner_abandoned", "unspecified"];
|
|
3571
|
+
function isMissionOutcome(value) {
|
|
3572
|
+
return typeof value === "string" && MISSION_OUTCOMES.includes(value);
|
|
3573
|
+
}
|
|
3574
|
+
var MISSION_REF_KINDS = ["commit", "branch", "pr", "task", "artifact", "mission", "url"];
|
|
3575
|
+
var MISSION_LIMITS = {
|
|
3576
|
+
summary: 300,
|
|
3577
|
+
outcomeReason: 500,
|
|
3578
|
+
itemText: 300,
|
|
3579
|
+
machine: 80,
|
|
3580
|
+
refs: 8,
|
|
3581
|
+
refValue: 300,
|
|
3582
|
+
refRepo: 120,
|
|
3583
|
+
refNote: 200,
|
|
3584
|
+
dedupeKey: 400,
|
|
3585
|
+
question: 300,
|
|
3586
|
+
context: 600,
|
|
3587
|
+
options: 5,
|
|
3588
|
+
optionLabel: 60,
|
|
3589
|
+
optionDetail: 200,
|
|
3590
|
+
/** Open items per mission before the oldest `remaining` fold into a "N more" summary item. */
|
|
3591
|
+
openItemsPerMission: 200,
|
|
3592
|
+
/** One event payload (serialized). */
|
|
3593
|
+
eventPayloadBytes: 16 * 1024,
|
|
3594
|
+
/** items_add / items_update entries honoured per call (extra entries are reported, not applied). */
|
|
3595
|
+
itemsPerCall: 50
|
|
3596
|
+
};
|
|
3597
|
+
var MISSION_DECISION_OPTION_IDS = ["a", "b", "c", "d", "e"];
|
|
3598
|
+
var MISSION_DECISION_URGENCIES = ["normal", "blocking"];
|
|
3599
|
+
var MISSION_DECISION_ON_DUE = ["remind", "apply_recommended"];
|
|
3600
|
+
function truncateMissionText(value, max) {
|
|
3601
|
+
if (value.length <= max) return value;
|
|
3602
|
+
return `${value.slice(0, max - 1).trimEnd()}\u2026`;
|
|
3603
|
+
}
|
|
3604
|
+
function str(value) {
|
|
3605
|
+
return typeof value === "string" ? value.trim() : "";
|
|
3606
|
+
}
|
|
3607
|
+
function collapse(value) {
|
|
3608
|
+
return value.replace(/\s+/g, " ").trim();
|
|
3609
|
+
}
|
|
3610
|
+
function normalizeMissionSummary(value) {
|
|
3611
|
+
if (typeof value !== "string") return null;
|
|
3612
|
+
const text = collapse(value);
|
|
3613
|
+
return { value: truncateMissionText(text, MISSION_LIMITS.summary), truncated: text.length > MISSION_LIMITS.summary };
|
|
3614
|
+
}
|
|
3615
|
+
function normalizeOutcomeReason(value) {
|
|
3616
|
+
if (typeof value !== "string") return null;
|
|
3617
|
+
const text = value.trim();
|
|
3618
|
+
return { value: truncateMissionText(text, MISSION_LIMITS.outcomeReason), truncated: text.length > MISSION_LIMITS.outcomeReason };
|
|
3619
|
+
}
|
|
3620
|
+
function normalizeMissionRefs(value) {
|
|
3621
|
+
if (!Array.isArray(value)) return { refs: [], truncated: false };
|
|
3622
|
+
const refs = [];
|
|
3623
|
+
let truncated = false;
|
|
3624
|
+
for (const raw of value) {
|
|
3625
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
3626
|
+
const r = raw;
|
|
3627
|
+
const kind = str(r.kind);
|
|
3628
|
+
const refValue = str(r.value);
|
|
3629
|
+
if (!MISSION_REF_KINDS.includes(kind) || !refValue) continue;
|
|
3630
|
+
if (refs.length >= MISSION_LIMITS.refs) {
|
|
3631
|
+
truncated = true;
|
|
3632
|
+
break;
|
|
3633
|
+
}
|
|
3634
|
+
const repo = str(r.repo);
|
|
3635
|
+
const note = str(r.note);
|
|
3636
|
+
refs.push({
|
|
3637
|
+
kind,
|
|
3638
|
+
...repo ? { repo: truncateMissionText(repo, MISSION_LIMITS.refRepo) } : {},
|
|
3639
|
+
value: truncateMissionText(refValue, MISSION_LIMITS.refValue),
|
|
3640
|
+
...note ? { note: truncateMissionText(note, MISSION_LIMITS.refNote) } : {}
|
|
3641
|
+
});
|
|
3642
|
+
}
|
|
3643
|
+
return { refs, truncated };
|
|
3644
|
+
}
|
|
3645
|
+
function normalizeOptions(value, truncated) {
|
|
3646
|
+
if (!Array.isArray(value)) return [];
|
|
3647
|
+
const out = [];
|
|
3648
|
+
for (const raw of value) {
|
|
3649
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
3650
|
+
if (out.length >= MISSION_LIMITS.options) {
|
|
3651
|
+
truncated.push("options");
|
|
3652
|
+
break;
|
|
3653
|
+
}
|
|
3654
|
+
out.push({ id: MISSION_DECISION_OPTION_IDS[out.length], label: truncateMissionText(raw.trim(), MISSION_LIMITS.optionLabel) });
|
|
3655
|
+
continue;
|
|
3656
|
+
}
|
|
3657
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
3658
|
+
const o = raw;
|
|
3659
|
+
const label = collapse(str(o.label));
|
|
3660
|
+
if (!label) continue;
|
|
3661
|
+
if (out.length >= MISSION_LIMITS.options) {
|
|
3662
|
+
truncated.push("options");
|
|
3663
|
+
break;
|
|
3664
|
+
}
|
|
3665
|
+
const detail = str(o.detail);
|
|
3666
|
+
out.push({
|
|
3667
|
+
id: MISSION_DECISION_OPTION_IDS[out.length],
|
|
3668
|
+
label: truncateMissionText(label, MISSION_LIMITS.optionLabel),
|
|
3669
|
+
...detail ? { detail: truncateMissionText(detail, MISSION_LIMITS.optionDetail) } : {}
|
|
3670
|
+
});
|
|
3671
|
+
}
|
|
3672
|
+
return out;
|
|
3673
|
+
}
|
|
3674
|
+
function normalizeDueAt(value) {
|
|
3675
|
+
if (typeof value !== "string" || !value.trim()) return void 0;
|
|
3676
|
+
const ms2 = Date.parse(value);
|
|
3677
|
+
return Number.isNaN(ms2) ? void 0 : new Date(ms2).toISOString();
|
|
3678
|
+
}
|
|
3679
|
+
function normalizeDecisionInput(raw, truncated) {
|
|
3680
|
+
const questionSource = collapse(str(raw.question) || str(raw.text));
|
|
3681
|
+
if (!questionSource) return null;
|
|
3682
|
+
if (questionSource.length > MISSION_LIMITS.question) truncated.push("question");
|
|
3683
|
+
const question = truncateMissionText(questionSource, MISSION_LIMITS.question);
|
|
3684
|
+
const contextSource = str(raw.context);
|
|
3685
|
+
if (contextSource.length > MISSION_LIMITS.context) truncated.push("context");
|
|
3686
|
+
const options = normalizeOptions(raw.options, truncated);
|
|
3687
|
+
const recommendedRaw = str(raw.recommended);
|
|
3688
|
+
const recommended = recommendedRaw && options.some((o) => o.id === recommendedRaw) ? recommendedRaw : options.find((o) => recommendedRaw && o.label.toLowerCase() === recommendedRaw.toLowerCase())?.id;
|
|
3689
|
+
const dueAt = normalizeDueAt(raw.dueAt ?? raw.due_at);
|
|
3690
|
+
const onDueRaw = str(raw.onDue ?? raw.on_due);
|
|
3691
|
+
const urgencyRaw = str(raw.urgency);
|
|
3692
|
+
const allowFreeTextRaw = raw.allowFreeText ?? raw.allow_free_text;
|
|
3693
|
+
return {
|
|
3694
|
+
question,
|
|
3695
|
+
...contextSource ? { context: truncateMissionText(contextSource, MISSION_LIMITS.context) } : {},
|
|
3696
|
+
options,
|
|
3697
|
+
...recommended ? { recommended } : {},
|
|
3698
|
+
allowFreeText: typeof allowFreeTextRaw === "boolean" ? allowFreeTextRaw : true,
|
|
3699
|
+
...dueAt ? { dueAt } : {},
|
|
3700
|
+
// apply_recommended without a recommended option has nothing to apply — fall back to remind.
|
|
3701
|
+
onDue: onDueRaw === "apply_recommended" && recommended ? "apply_recommended" : "remind",
|
|
3702
|
+
urgency: urgencyRaw === "blocking" ? "blocking" : "normal"
|
|
3703
|
+
};
|
|
3704
|
+
}
|
|
3705
|
+
function normalizeForDedupe(text) {
|
|
3706
|
+
return collapse(text).toLowerCase().replace(/[\s.!?。]+$/u, "");
|
|
3707
|
+
}
|
|
3708
|
+
function deriveItemDedupeKey(kind, parts) {
|
|
3709
|
+
const explicit = str(parts.explicit);
|
|
3710
|
+
if (explicit) return truncateMissionText(`k:${explicit}`, MISSION_LIMITS.dedupeKey);
|
|
3711
|
+
if (kind === "decision") return truncateMissionText(`decision:${normalizeForDedupe(parts.question ?? parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
|
|
3712
|
+
if (kind === "evidence") {
|
|
3713
|
+
const ref2 = parts.refs?.[0];
|
|
3714
|
+
if (ref2) return truncateMissionText(`evidence:${ref2.kind}:${ref2.repo ?? ""}:${ref2.value}`, MISSION_LIMITS.dedupeKey);
|
|
3715
|
+
}
|
|
3716
|
+
const machine = parts.machine ? `@${normalizeForDedupe(parts.machine)}` : "";
|
|
3717
|
+
return truncateMissionText(`${kind}${machine}:${normalizeForDedupe(parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
|
|
3718
|
+
}
|
|
3719
|
+
function normalizeMissionItemInput(raw) {
|
|
3720
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "item must be an object" };
|
|
3721
|
+
const r = raw;
|
|
3722
|
+
const kind = str(r.kind) || "remaining";
|
|
3723
|
+
if (!MISSION_ITEM_KINDS.includes(kind)) {
|
|
3724
|
+
return { error: `invalid kind '${kind}' (valid: ${MISSION_ITEM_KINDS.join(", ")})` };
|
|
3725
|
+
}
|
|
3726
|
+
const truncated = [];
|
|
3727
|
+
const { refs, truncated: refsTruncated } = normalizeMissionRefs(r.refs);
|
|
3728
|
+
if (refsTruncated) truncated.push("refs");
|
|
3729
|
+
const machineRaw = collapse(str(r.machine));
|
|
3730
|
+
const machine = machineRaw ? truncateMissionText(machineRaw, MISSION_LIMITS.machine) : void 0;
|
|
3731
|
+
const explicitKey = str(r.dedupe_key ?? r.dedupeKey);
|
|
3732
|
+
if (kind === "decision") {
|
|
3733
|
+
const decisionRaw = r.decision && typeof r.decision === "object" && !Array.isArray(r.decision) ? r.decision : r;
|
|
3734
|
+
const decision = normalizeDecisionInput({ ...decisionRaw, question: decisionRaw.question ?? r.question ?? r.text }, truncated);
|
|
3735
|
+
if (!decision) return { error: "decision item needs a question" };
|
|
3736
|
+
return {
|
|
3737
|
+
item: {
|
|
3738
|
+
kind,
|
|
3739
|
+
text: decision.question,
|
|
3740
|
+
...machine ? { machine } : {},
|
|
3741
|
+
refs,
|
|
3742
|
+
decision,
|
|
3743
|
+
dedupeKey: deriveItemDedupeKey("decision", { question: decision.question, explicit: explicitKey }),
|
|
3744
|
+
truncated
|
|
3745
|
+
}
|
|
3746
|
+
};
|
|
3747
|
+
}
|
|
3748
|
+
const textSource = collapse(str(r.text));
|
|
3749
|
+
if (!textSource && !(kind === "evidence" && refs.length > 0)) return { error: `${kind} item needs text` };
|
|
3750
|
+
if (textSource.length > MISSION_LIMITS.itemText) truncated.push("text");
|
|
3751
|
+
const text = truncateMissionText(textSource || `${refs[0].kind}: ${refs[0].value}`, MISSION_LIMITS.itemText);
|
|
3752
|
+
return {
|
|
3753
|
+
item: {
|
|
3754
|
+
kind,
|
|
3755
|
+
text,
|
|
3756
|
+
...machine ? { machine } : {},
|
|
3757
|
+
refs,
|
|
3758
|
+
dedupeKey: deriveItemDedupeKey(kind, { text, machine, refs, explicit: explicitKey }),
|
|
3759
|
+
truncated
|
|
3760
|
+
}
|
|
3761
|
+
};
|
|
3762
|
+
}
|
|
3763
|
+
function normalizeMissionItemUpdate(raw) {
|
|
3764
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "update must be an object" };
|
|
3765
|
+
const r = raw;
|
|
3766
|
+
const id2 = str(r.id ?? r.item_id ?? r.itemId);
|
|
3767
|
+
if (!id2) return { error: "update needs an item id" };
|
|
3768
|
+
const truncated = [];
|
|
3769
|
+
const update = { id: id2 };
|
|
3770
|
+
if (r.state !== void 0) {
|
|
3771
|
+
const state = str(r.state);
|
|
3772
|
+
if (!MISSION_ITEM_STATES.includes(state)) return { error: `invalid state '${state}'` };
|
|
3773
|
+
update.state = state;
|
|
3774
|
+
}
|
|
3775
|
+
if (typeof r.text === "string") {
|
|
3776
|
+
const text = collapse(r.text);
|
|
3777
|
+
if (text.length > MISSION_LIMITS.itemText) truncated.push("text");
|
|
3778
|
+
if (text) update.text = truncateMissionText(text, MISSION_LIMITS.itemText);
|
|
3779
|
+
}
|
|
3780
|
+
if (r.machine === null) update.machine = null;
|
|
3781
|
+
else if (typeof r.machine === "string") {
|
|
3782
|
+
const machine = collapse(r.machine);
|
|
3783
|
+
update.machine = machine ? truncateMissionText(machine, MISSION_LIMITS.machine) : null;
|
|
3784
|
+
}
|
|
3785
|
+
if (r.refs !== void 0) {
|
|
3786
|
+
const { refs, truncated: t } = normalizeMissionRefs(r.refs);
|
|
3787
|
+
if (t) truncated.push("refs");
|
|
3788
|
+
update.refs = refs;
|
|
3789
|
+
}
|
|
3790
|
+
return { update, truncated };
|
|
3791
|
+
}
|
|
3792
|
+
function boundEventPayload(payload) {
|
|
3793
|
+
let json = JSON.stringify(payload);
|
|
3794
|
+
if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
|
|
3795
|
+
const shrunk = {};
|
|
3796
|
+
for (const [k, v] of Object.entries(payload)) {
|
|
3797
|
+
shrunk[k] = typeof v === "string" && v.length > 4e3 ? `${v.slice(0, 4e3)}\u2026` : v;
|
|
3798
|
+
}
|
|
3799
|
+
shrunk.payloadTruncated = true;
|
|
3800
|
+
json = JSON.stringify(shrunk);
|
|
3801
|
+
if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
|
|
3802
|
+
return JSON.stringify({ payloadTruncated: true, keys: Object.keys(payload).slice(0, 20) });
|
|
3803
|
+
}
|
|
3804
|
+
var CARRY_OVER_MISSION_TITLE = "Carry-over \u2014 open items from closed missions";
|
|
3805
|
+
var LEGACY_CARRY_OVER_MISSION_TITLE = "\uC774\uC6D4 \u2014 \uB2EB\uD78C \uBBF8\uC158\uC5D0\uC11C \uB118\uC5B4\uC628 \uD56D\uBAA9";
|
|
3806
|
+
var CARRY_OVER_MISSION_GOAL = "Open items carried over from closed missions, and decisions requested without a mission. Managed automatically \u2014 do not close.";
|
|
3807
|
+
function isCarryOverMissionRecord(m) {
|
|
3808
|
+
return !!m && (m.isCarryOver === true || isCarryOverMissionTitle(m.title));
|
|
3809
|
+
}
|
|
3810
|
+
function isCarryOverMissionTitle(title) {
|
|
3811
|
+
if (typeof title !== "string") return false;
|
|
3812
|
+
const t = title.trim();
|
|
3813
|
+
return t === CARRY_OVER_MISSION_TITLE || t === LEGACY_CARRY_OVER_MISSION_TITLE;
|
|
3814
|
+
}
|
|
3815
|
+
var OWNER_ABANDON_CONFIRM_KEY_PREFIX = "owner-abandon-confirm:";
|
|
3816
|
+
var OWNER_ABANDON_CONFIRM_QUESTION = "The coordinator closed this as 'owner abandoned' \u2014 correct?";
|
|
3817
|
+
var OWNER_ABANDON_CONFIRM_OPTIONS = ["Correct", "Reopen"];
|
|
3818
|
+
var WORKER_DECISIONS_NEEDED_MAX = 3;
|
|
3819
|
+
var WORKER_COMMITS_MAX = 20;
|
|
3820
|
+
var SHA_RE = /^[0-9a-f]{7,64}$/i;
|
|
3821
|
+
function normalizeReportCommits(value) {
|
|
3822
|
+
if (!Array.isArray(value)) return null;
|
|
3823
|
+
const out = [];
|
|
3824
|
+
for (const v of value) {
|
|
3825
|
+
if (typeof v !== "string") return null;
|
|
3826
|
+
const sha = v.trim();
|
|
3827
|
+
if (!SHA_RE.test(sha)) return null;
|
|
3828
|
+
if (!out.includes(sha.toLowerCase())) out.push(sha.toLowerCase());
|
|
3829
|
+
}
|
|
3830
|
+
return out;
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
// src/mission-git-state.ts
|
|
3834
|
+
var MISSION_REF_GIT_STATUSES = ["contained_ancestor", "contained_patch_equivalent", "not_contained", "unknown"];
|
|
3835
|
+
var MISSION_REF_GIT_METHODS = ["ancestry", "cherry", "residual_patch"];
|
|
3836
|
+
var MISSION_GIT_STATES = ["no_refs", "landed", "partial", "not_landed", "unknown"];
|
|
3837
|
+
function isMissionRefContained(status) {
|
|
3838
|
+
return status === "contained_ancestor" || status === "contained_patch_equivalent";
|
|
3839
|
+
}
|
|
3840
|
+
function aggregateMissionGitState(statuses) {
|
|
3841
|
+
const total = statuses.length;
|
|
3842
|
+
const contained = statuses.filter(isMissionRefContained).length;
|
|
3843
|
+
const notContained = statuses.filter((s) => s === "not_contained").length;
|
|
3844
|
+
const unknown = statuses.filter((s) => s === "unknown").length;
|
|
3845
|
+
const counts = { total, contained, notContained, unknown };
|
|
3846
|
+
if (total === 0) return { state: "no_refs", partialUnknown: false, counts };
|
|
3847
|
+
if (contained === total) return { state: "landed", partialUnknown: false, counts };
|
|
3848
|
+
if (contained > 0) return { state: "partial", partialUnknown: unknown > 0, counts };
|
|
3849
|
+
if (notContained === total) return { state: "not_landed", partialUnknown: false, counts };
|
|
3850
|
+
return { state: "unknown", partialUnknown: false, counts };
|
|
3851
|
+
}
|
|
3852
|
+
|
|
3853
|
+
// src/release.ts
|
|
3854
|
+
var MESH_RELEASE_CHANNELS = ["preview", "stable"];
|
|
3855
|
+
function isMeshReleaseChannel(value) {
|
|
3856
|
+
return typeof value === "string" && MESH_RELEASE_CHANNELS.includes(value);
|
|
3857
|
+
}
|
|
3858
|
+
var MESH_RELEASE_STATUSES = ["planned", "frozen", "deployed", "verified", "superseded", "cancelled"];
|
|
3859
|
+
function isReleaseStatus(value) {
|
|
3860
|
+
return typeof value === "string" && MESH_RELEASE_STATUSES.includes(value);
|
|
3861
|
+
}
|
|
3862
|
+
var RELEASE_MEMBER_STATES = ["member", "moved_out", "removed"];
|
|
3863
|
+
var RELEASE_ACTORS = ["coordinator", "owner", "assistant", "script"];
|
|
3864
|
+
var RELEASE_EVENT_TYPES = [
|
|
3865
|
+
"created",
|
|
3866
|
+
"status_changed",
|
|
3867
|
+
"scope_added",
|
|
3868
|
+
"scope_moved",
|
|
3869
|
+
"scope_removed",
|
|
3870
|
+
"deploy_recorded",
|
|
3871
|
+
"changelog_drafted",
|
|
3872
|
+
"changelog_applied"
|
|
3873
|
+
];
|
|
3874
|
+
var MISSION_RELEASE_EVENT_TYPES = ["release_attached", "release_moved", "release_detached"];
|
|
3875
|
+
var RELEASE_LIMITS = {
|
|
3876
|
+
name: 80,
|
|
3877
|
+
note: 500,
|
|
3878
|
+
/** `mesh_missions.release_note`: one user/operator-visible sentence. */
|
|
3879
|
+
releaseNote: 400,
|
|
3880
|
+
missionsPerCall: 100,
|
|
3881
|
+
changelogEntries: 300
|
|
3882
|
+
};
|
|
3883
|
+
var CHANGELOG_SECTIONS = ["Added", "Fixed", "Changed"];
|
|
3884
|
+
var NEEDS_WORDING_MARKER = "[needs user-facing wording]";
|
|
3885
|
+
function changelogMissionMarker(missionId) {
|
|
3886
|
+
return `<!-- m:${missionId.slice(0, 8)} -->`;
|
|
3887
|
+
}
|
|
3888
|
+
function classifyChangelogSection(text, hint) {
|
|
3889
|
+
const m = /^\s*\[(added|fixed|changed)\]\s*/i.exec(text);
|
|
3890
|
+
if (m) {
|
|
3891
|
+
const key = m[1].toLowerCase();
|
|
3892
|
+
return { section: key === "added" ? "Added" : key === "fixed" ? "Fixed" : "Changed", text: text.slice(m[0].length).trim() };
|
|
3893
|
+
}
|
|
3894
|
+
const probe = `${hint ?? ""} ${text}`.toLowerCase();
|
|
3895
|
+
if (/\b(fix|fixes|fixed|bug|regression|crash|error)\b|오류|결함|버그|수정/.test(probe)) return { section: "Fixed", text };
|
|
3896
|
+
if (/\b(add|adds|added|new|introduc\w*|support\w*)\b|신규|추가/.test(probe)) return { section: "Added", text };
|
|
3897
|
+
return { section: "Changed", text };
|
|
3898
|
+
}
|
|
3899
|
+
function lintChangelogText(text) {
|
|
3900
|
+
const out = [];
|
|
3901
|
+
if (/\bwave[\s-]*\d+/i.test(text) || /웨이브\s*\d+/.test(text)) out.push("mentions an internal wave number");
|
|
3902
|
+
if (/\brc[.\s-]?\d+\b/i.test(text)) out.push("mentions an internal rc number");
|
|
3903
|
+
if (/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i.test(text) || /\bmi_[0-9a-f]{12}\b/.test(text) || /\brel_[0-9a-f]{12}\b/.test(text)) out.push("contains an internal id");
|
|
3904
|
+
if (/\bmission\b/i.test(text)) out.push('mentions "mission" (internal vocabulary)');
|
|
3905
|
+
return out;
|
|
3906
|
+
}
|
|
3907
|
+
|
|
3908
|
+
// src/decision-push-relay.ts
|
|
3909
|
+
var DECISION_PUSH_RELAY_COMMAND = "mission_decision_push_relay_answer";
|
|
3910
|
+
var DECISION_PUSH_RELAY_SOURCE = "push_relay";
|
|
3911
|
+
|
|
3150
3912
|
// src/keyed-doc-delta.ts
|
|
3151
3913
|
function sig(value) {
|
|
3152
3914
|
if (value === void 0) return void 0;
|
|
@@ -3367,7 +4129,15 @@ function foldKeyedDoc(held, delta, spec) {
|
|
|
3367
4129
|
const heldList = heldCollections.get(path);
|
|
3368
4130
|
if (change?.absent) {
|
|
3369
4131
|
const [head2, tail2] = splitPath(path);
|
|
3370
|
-
if (!tail2)
|
|
4132
|
+
if (!tail2) {
|
|
4133
|
+
delete next[head2];
|
|
4134
|
+
continue;
|
|
4135
|
+
}
|
|
4136
|
+
const parent2 = next[head2];
|
|
4137
|
+
if (!isRecord3(parent2) || !(tail2 in parent2)) continue;
|
|
4138
|
+
const copy = { ...parent2 };
|
|
4139
|
+
delete copy[tail2];
|
|
4140
|
+
next[head2] = copy;
|
|
3371
4141
|
continue;
|
|
3372
4142
|
}
|
|
3373
4143
|
if (!change && heldList === void 0) continue;
|
|
@@ -3431,8 +4201,481 @@ function stableMeshNodeRow(row) {
|
|
|
3431
4201
|
}
|
|
3432
4202
|
return out;
|
|
3433
4203
|
}
|
|
4204
|
+
|
|
4205
|
+
// src/provider-approval.ts
|
|
4206
|
+
function isActionableProviderApproval(approval) {
|
|
4207
|
+
return !!approval && approval.source === "provider_modal" && approval.type === "tool_permission" && approval.lifecycle === "pending" && approval.evidence === "live" && approval.actionable && !!approval.modalKey && Array.isArray(approval.buttons) && approval.buttons.some((button) => typeof button === "string" && !!button.trim());
|
|
4208
|
+
}
|
|
4209
|
+
function readProviderDecision(approval, waiting, hasModal = false) {
|
|
4210
|
+
if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
|
|
4211
|
+
if (!waiting) return null;
|
|
4212
|
+
return {
|
|
4213
|
+
source: hasModal ? "legacy_provider" : "status_only",
|
|
4214
|
+
type: "unknown",
|
|
4215
|
+
compatibility: hasModal ? "session_only" : "unknown",
|
|
4216
|
+
evidence: "unavailable",
|
|
4217
|
+
lifecycle: "pending",
|
|
4218
|
+
modalKey: null,
|
|
4219
|
+
createdAt: null,
|
|
4220
|
+
resolvedAt: null,
|
|
4221
|
+
description: "",
|
|
4222
|
+
buttons: [],
|
|
4223
|
+
actionable: false
|
|
4224
|
+
};
|
|
4225
|
+
}
|
|
4226
|
+
function providerApprovalSnapshot(approval) {
|
|
4227
|
+
if (!approval) return null;
|
|
4228
|
+
const {
|
|
4229
|
+
source,
|
|
4230
|
+
type,
|
|
4231
|
+
lifecycle,
|
|
4232
|
+
modalKey,
|
|
4233
|
+
createdAt,
|
|
4234
|
+
resolvedAt,
|
|
4235
|
+
providerType,
|
|
4236
|
+
sessionId,
|
|
4237
|
+
nodeId,
|
|
4238
|
+
meshId,
|
|
4239
|
+
taskId,
|
|
4240
|
+
attemptId,
|
|
4241
|
+
generation
|
|
4242
|
+
} = approval;
|
|
4243
|
+
return {
|
|
4244
|
+
source,
|
|
4245
|
+
type,
|
|
4246
|
+
lifecycle,
|
|
4247
|
+
modalKey,
|
|
4248
|
+
createdAt,
|
|
4249
|
+
resolvedAt,
|
|
4250
|
+
providerType,
|
|
4251
|
+
sessionId,
|
|
4252
|
+
nodeId,
|
|
4253
|
+
meshId,
|
|
4254
|
+
taskId,
|
|
4255
|
+
attemptId,
|
|
4256
|
+
generation,
|
|
4257
|
+
evidence: "cached",
|
|
4258
|
+
actionable: false,
|
|
4259
|
+
description: "",
|
|
4260
|
+
buttons: []
|
|
4261
|
+
};
|
|
4262
|
+
}
|
|
4263
|
+
|
|
4264
|
+
// src/provider-question.ts
|
|
4265
|
+
function isProviderQuestionBinding(value) {
|
|
4266
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
4267
|
+
const b = value;
|
|
4268
|
+
if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
|
|
4269
|
+
const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
|
|
4270
|
+
if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
|
|
4271
|
+
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
4272
|
+
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
4273
|
+
}
|
|
4274
|
+
|
|
4275
|
+
// src/task-source-phase.ts
|
|
4276
|
+
function reviewIndependenceOf(review) {
|
|
4277
|
+
return review.independence ?? "different_provider";
|
|
4278
|
+
}
|
|
4279
|
+
|
|
4280
|
+
// src/light-task.ts
|
|
4281
|
+
var LIGHT_REJECT = {
|
|
4282
|
+
REQUIRES_LOCAL_BASE: "light_requires_local_base",
|
|
4283
|
+
NOT_CONFIGURED: "light_workspace_not_configured",
|
|
4284
|
+
REQUIRES_OWNED_PATHS: "light_requires_owned_paths",
|
|
4285
|
+
MODE_CONFLICT: "light_mode_conflict"
|
|
4286
|
+
};
|
|
4287
|
+
var LIGHT_HOLD = {
|
|
4288
|
+
PREPARE_FAILED: "light_workspace_prepare_failed",
|
|
4289
|
+
LIMIT: "light_workspace_limit",
|
|
4290
|
+
DISK_LOW: "light_workspace_disk_low",
|
|
4291
|
+
CAP: "max_light_parallel_tasks_reached"
|
|
4292
|
+
};
|
|
4293
|
+
var LIGHT_BLOCK_REASONS = [
|
|
4294
|
+
"light_uncommitted_changes",
|
|
4295
|
+
"light_dependency_change",
|
|
4296
|
+
"light_lineage_unproven",
|
|
4297
|
+
"shared_checkout_mutated"
|
|
4298
|
+
];
|
|
4299
|
+
var LIGHT_WARNINGS = ["shared_checkout_changed_during_task", "light_base_dirty_overlap"];
|
|
4300
|
+
var LIGHT_LAND_MODES = ["refine", "apply_to_checkout"];
|
|
4301
|
+
var LIGHT_TESTS_RUN_MAX = 20;
|
|
4302
|
+
function isLightWorkerSession(session) {
|
|
4303
|
+
const s = session;
|
|
4304
|
+
if (!s || typeof s !== "object") return false;
|
|
4305
|
+
const has = (o) => !!o && typeof o === "object" && typeof o.lightWorkspaceId === "string" && o.lightWorkspaceId.trim() !== "";
|
|
4306
|
+
return has(s.settings) || has(s.launchRecord?.settings) || has(s);
|
|
4307
|
+
}
|
|
4308
|
+
|
|
4309
|
+
// src/relay-reprobe.ts
|
|
4310
|
+
var RELAY_REPROBE_BASE_DELAY_MS = 6e4;
|
|
4311
|
+
var RELAY_REPROBE_MAX_DELAY_MS = 5 * 6e4;
|
|
4312
|
+
var RELAY_REPROBE_JITTER_RATIO = 0.2;
|
|
4313
|
+
function computeRelayReprobeDelay(failures, random, timing = {}) {
|
|
4314
|
+
const base = timing.baseDelayMs ?? RELAY_REPROBE_BASE_DELAY_MS;
|
|
4315
|
+
const max = timing.maxDelayMs ?? RELAY_REPROBE_MAX_DELAY_MS;
|
|
4316
|
+
const jitter = timing.jitterRatio ?? RELAY_REPROBE_JITTER_RATIO;
|
|
4317
|
+
const grown = Math.min(max, base * 2 ** Math.max(0, failures));
|
|
4318
|
+
const factor = 1 + jitter * (Math.min(1, Math.max(0, random())) * 2 - 1);
|
|
4319
|
+
return Math.round(grown * factor);
|
|
4320
|
+
}
|
|
4321
|
+
var RelayReprobeScheduler = class {
|
|
4322
|
+
constructor(options) {
|
|
4323
|
+
this.options = options;
|
|
4324
|
+
}
|
|
4325
|
+
handle = null;
|
|
4326
|
+
running = false;
|
|
4327
|
+
inFlight = false;
|
|
4328
|
+
failureCount = 0;
|
|
4329
|
+
generation = 0;
|
|
4330
|
+
get isRunning() {
|
|
4331
|
+
return this.running;
|
|
4332
|
+
}
|
|
4333
|
+
get failures() {
|
|
4334
|
+
return this.failureCount;
|
|
4335
|
+
}
|
|
4336
|
+
get probing() {
|
|
4337
|
+
return this.inFlight;
|
|
4338
|
+
}
|
|
4339
|
+
/** Begin probing (idempotent). Call when a connection is selected as relay. */
|
|
4340
|
+
start() {
|
|
4341
|
+
if (this.running) return;
|
|
4342
|
+
this.running = true;
|
|
4343
|
+
this.failureCount = 0;
|
|
4344
|
+
this.generation++;
|
|
4345
|
+
this.schedule();
|
|
4346
|
+
}
|
|
4347
|
+
/** Stop for good (direct path found, connection closed, auth epoch changed). */
|
|
4348
|
+
stop() {
|
|
4349
|
+
this.running = false;
|
|
4350
|
+
this.generation++;
|
|
4351
|
+
if (this.handle !== null) {
|
|
4352
|
+
this.options.clearTimer(this.handle);
|
|
4353
|
+
this.handle = null;
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
4356
|
+
schedule() {
|
|
4357
|
+
if (!this.running) return;
|
|
4358
|
+
const generation = this.generation;
|
|
4359
|
+
const delay = computeRelayReprobeDelay(this.failureCount, this.options.random, this.options);
|
|
4360
|
+
this.handle = this.options.setTimer(() => {
|
|
4361
|
+
this.handle = null;
|
|
4362
|
+
void this.tick(generation);
|
|
4363
|
+
}, delay);
|
|
4364
|
+
}
|
|
4365
|
+
async tick(generation) {
|
|
4366
|
+
if (!this.running || generation !== this.generation) return;
|
|
4367
|
+
if (this.inFlight || !this.options.shouldProbe()) {
|
|
4368
|
+
this.schedule();
|
|
4369
|
+
return;
|
|
4370
|
+
}
|
|
4371
|
+
this.inFlight = true;
|
|
4372
|
+
let outcome;
|
|
4373
|
+
try {
|
|
4374
|
+
outcome = await this.options.probe();
|
|
4375
|
+
} catch {
|
|
4376
|
+
outcome = "failed";
|
|
4377
|
+
}
|
|
4378
|
+
this.inFlight = false;
|
|
4379
|
+
if (!this.running || generation !== this.generation) return;
|
|
4380
|
+
if (outcome === "direct") {
|
|
4381
|
+
this.stop();
|
|
4382
|
+
return;
|
|
4383
|
+
}
|
|
4384
|
+
if (outcome !== "skipped") this.failureCount++;
|
|
4385
|
+
this.schedule();
|
|
4386
|
+
}
|
|
4387
|
+
};
|
|
4388
|
+
|
|
4389
|
+
// src/task-stages.ts
|
|
4390
|
+
var REVIEW_VERDICTS = ["approve", "approve_with_nits", "changes_requested", "reject_approach"];
|
|
4391
|
+
var FINDING_SEVERITIES = ["blocking", "major", "minor", "nit"];
|
|
4392
|
+
var FINDING_CATEGORIES = ["correctness", "regression", "test_gap", "scope", "security", "performance", "maintainability"];
|
|
4393
|
+
var PRIOR_FINDING_STATUSES = ["resolved", "unresolved", "dispute_accepted", "dispute_rejected"];
|
|
4394
|
+
var FINDING_RESPONSE_KINDS = ["fixed", "disputed"];
|
|
4395
|
+
var STAGE_PHASES = ["implementing", "self_checking", "awaiting_review", "reviewing", "revising", "done"];
|
|
4396
|
+
var STAGE_PARKED_PHASES = ["self_checking", "awaiting_review", "reviewing"];
|
|
4397
|
+
var STAGE_INDEPENDENCE_MODES = ["different_provider", "fresh_session_ok"];
|
|
4398
|
+
var STAGE_ROLES = ["implement", "revise", "review"];
|
|
4399
|
+
var STAGE_BLOCKED_REASONS = [
|
|
4400
|
+
"review_unresolved",
|
|
4401
|
+
"review_rejected_approach",
|
|
4402
|
+
"review_unavailable",
|
|
4403
|
+
"self_check_failed",
|
|
4404
|
+
"stage_pipeline_ceiling",
|
|
4405
|
+
"reviewer_mutated_source",
|
|
4406
|
+
// The read-lease checkout could not be fingerprinted (start or end): the review's integrity cannot be verified.
|
|
4407
|
+
"reviewer_integrity_unverifiable"
|
|
4408
|
+
];
|
|
4409
|
+
var STAGE_DECIDE_ACTIONS = ["accept", "revise_once", "rereview", "abandon"];
|
|
4410
|
+
var STAGE_MAX_REVISIONS_LIMIT = 3;
|
|
4411
|
+
var STAGE_DEFAULT_MAX_REVISIONS = 2;
|
|
4412
|
+
var STAGE_SELF_CHECK_MAX_BOUNCES = 2;
|
|
4413
|
+
var STAGE_INDEPENDENCE_FALLBACK_MS = 10 * 60 * 1e3;
|
|
4414
|
+
var STAGE_PIPELINE_CEILING_DEFAULT_MS = 4 * 60 * 60 * 1e3;
|
|
4415
|
+
var REVIEW_FINDINGS_MAX = 30;
|
|
4416
|
+
var REVIEW_CLAIM_MAX_CHARS = 500;
|
|
4417
|
+
var REVIEW_EVIDENCE_MAX_CHARS = 1e3;
|
|
4418
|
+
var REVIEW_FIX_MAX_CHARS = 500;
|
|
4419
|
+
var REVIEW_FINDING_ID_MAX_CHARS = 40;
|
|
4420
|
+
var REVIEW_CHECKED_MAX = 20;
|
|
4421
|
+
var REVIEW_NOTE_MAX_CHARS = 500;
|
|
4422
|
+
var REVIEW_TESTS_RUN_MAX = 20;
|
|
4423
|
+
var FINDING_RESPONSES_MAX = 30;
|
|
4424
|
+
function makeGuard4(values) {
|
|
4425
|
+
const set = new Set(values);
|
|
4426
|
+
return (value) => typeof value === "string" && set.has(value);
|
|
4427
|
+
}
|
|
4428
|
+
var isReviewVerdict = makeGuard4(REVIEW_VERDICTS);
|
|
4429
|
+
var isFindingSeverity = makeGuard4(FINDING_SEVERITIES);
|
|
4430
|
+
var isFindingCategory = makeGuard4(FINDING_CATEGORIES);
|
|
4431
|
+
var isPriorFindingStatus = makeGuard4(PRIOR_FINDING_STATUSES);
|
|
4432
|
+
var isFindingResponseKind = makeGuard4(FINDING_RESPONSE_KINDS);
|
|
4433
|
+
var isStageBlockedReason = makeGuard4(STAGE_BLOCKED_REASONS);
|
|
4434
|
+
var isRecord4 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
4435
|
+
function isBlockingSeverity(severity) {
|
|
4436
|
+
return severity === "blocking" || severity === "major";
|
|
4437
|
+
}
|
|
4438
|
+
function resolveStagePlan(raw, task, opts = {}) {
|
|
4439
|
+
const eligible = isStageEligibleTask(task);
|
|
4440
|
+
if (raw === void 0 || raw === null) return (opts.defaultOn ?? true) && defaultsOnFor(task) ? defaultStagePlan() : null;
|
|
4441
|
+
if (raw === false) return null;
|
|
4442
|
+
if (raw === true) {
|
|
4443
|
+
if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
|
|
4444
|
+
return defaultStagePlan();
|
|
4445
|
+
}
|
|
4446
|
+
if (!isRecord4(raw)) throw new Error("invalid_review_option: review must be true, false or {max_revisions?, independence?}");
|
|
4447
|
+
const allowed = /* @__PURE__ */ new Set(["max_revisions", "maxRevisions", "independence"]);
|
|
4448
|
+
for (const key of Object.keys(raw)) {
|
|
4449
|
+
if (!allowed.has(key)) throw new Error(`invalid_review_option: unknown review key '${key}' (expected max_revisions, independence)`);
|
|
4450
|
+
}
|
|
4451
|
+
if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
|
|
4452
|
+
const rawMax = raw.max_revisions ?? raw.maxRevisions;
|
|
4453
|
+
let maxRevisions = STAGE_DEFAULT_MAX_REVISIONS;
|
|
4454
|
+
if (rawMax !== void 0) {
|
|
4455
|
+
if (typeof rawMax !== "number" || !Number.isInteger(rawMax) || rawMax < 0 || rawMax > STAGE_MAX_REVISIONS_LIMIT) {
|
|
4456
|
+
throw new Error(`invalid_review_option: max_revisions must be an integer 0..${STAGE_MAX_REVISIONS_LIMIT}`);
|
|
4457
|
+
}
|
|
4458
|
+
maxRevisions = rawMax;
|
|
4459
|
+
}
|
|
4460
|
+
let independence = "fresh_session_ok";
|
|
4461
|
+
if (raw.independence !== void 0) {
|
|
4462
|
+
if (!STAGE_INDEPENDENCE_MODES.includes(raw.independence)) {
|
|
4463
|
+
throw new Error(`invalid_review_option: independence must be one of ${STAGE_INDEPENDENCE_MODES.join(" | ")}`);
|
|
4464
|
+
}
|
|
4465
|
+
independence = raw.independence;
|
|
4466
|
+
}
|
|
4467
|
+
return { review: true, maxRevisions, independence };
|
|
4468
|
+
}
|
|
4469
|
+
function defaultStagePlan() {
|
|
4470
|
+
return { review: true, maxRevisions: STAGE_DEFAULT_MAX_REVISIONS, independence: "fresh_session_ok" };
|
|
4471
|
+
}
|
|
4472
|
+
function isStageEligibleTask(task) {
|
|
4473
|
+
if (task.readonly) return false;
|
|
4474
|
+
return (task.taskMode ?? "code_change") === "code_change";
|
|
4475
|
+
}
|
|
4476
|
+
function defaultsOnFor(task) {
|
|
4477
|
+
return isStageEligibleTask(task) && (task.difficulty === "medium" || task.difficulty === "difficult");
|
|
4478
|
+
}
|
|
4479
|
+
function str2(value) {
|
|
4480
|
+
return typeof value === "string" ? value.trim() : "";
|
|
4481
|
+
}
|
|
4482
|
+
function validateStringList(value, field, max, maxChars, errors, minItems = 0) {
|
|
4483
|
+
if (!Array.isArray(value)) {
|
|
4484
|
+
errors.push({ field, message: `${field} must be an array of strings` });
|
|
4485
|
+
return [];
|
|
4486
|
+
}
|
|
4487
|
+
if (value.length > max) errors.push({ field, message: `${field} has ${value.length} entries, over the ${max} limit` });
|
|
4488
|
+
const out = [];
|
|
4489
|
+
for (const item of value) {
|
|
4490
|
+
const text = str2(item);
|
|
4491
|
+
if (!text) continue;
|
|
4492
|
+
if (text.length > maxChars) {
|
|
4493
|
+
errors.push({ field, message: `${field} contains an entry over ${maxChars} chars` });
|
|
4494
|
+
continue;
|
|
4495
|
+
}
|
|
4496
|
+
out.push(text);
|
|
4497
|
+
}
|
|
4498
|
+
if (out.length < minItems) errors.push({ field, message: `${field} needs at least ${minItems} entry \u2014 an empty ${field} list is a review with no recorded scope` });
|
|
4499
|
+
return out;
|
|
4500
|
+
}
|
|
4501
|
+
function validateReviewReport(raw, ctx) {
|
|
4502
|
+
const errors = [];
|
|
4503
|
+
if (!isRecord4(raw)) return { errors: [{ field: "review", message: "review must be an object {verdict, findings, checked, notChecked, ...}" }] };
|
|
4504
|
+
const KNOWN = /* @__PURE__ */ new Set(["verdict", "findings", "priorFindings", "checked", "notChecked", "testsRun"]);
|
|
4505
|
+
for (const key of Object.keys(raw)) if (!KNOWN.has(key)) errors.push({ field: `review.${key}`, message: `unknown field '${key}' (expected one of: ${[...KNOWN].join(", ")})` });
|
|
4506
|
+
const verdict = raw.verdict;
|
|
4507
|
+
if (!isReviewVerdict(verdict)) errors.push({ field: "review.verdict", message: `verdict must be one of ${REVIEW_VERDICTS.join(" | ")}` });
|
|
4508
|
+
const findings = [];
|
|
4509
|
+
if (!Array.isArray(raw.findings)) errors.push({ field: "review.findings", message: "findings must be an array (use [] when there are none)" });
|
|
4510
|
+
else {
|
|
4511
|
+
if (raw.findings.length > REVIEW_FINDINGS_MAX) errors.push({ field: "review.findings", message: `findings has ${raw.findings.length} entries, over the ${REVIEW_FINDINGS_MAX} limit \u2014 keep the most important` });
|
|
4512
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4513
|
+
raw.findings.forEach((f, i) => {
|
|
4514
|
+
const at = `review.findings[${i}]`;
|
|
4515
|
+
if (!isRecord4(f)) {
|
|
4516
|
+
errors.push({ field: at, message: "each finding must be an object" });
|
|
4517
|
+
return;
|
|
4518
|
+
}
|
|
4519
|
+
const FK = /* @__PURE__ */ new Set(["id", "severity", "category", "file", "line", "claim", "evidence", "suggestedFix"]);
|
|
4520
|
+
for (const key of Object.keys(f)) if (!FK.has(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
4521
|
+
const id2 = str2(f.id);
|
|
4522
|
+
if (!id2 || id2.length > REVIEW_FINDING_ID_MAX_CHARS) errors.push({ field: `${at}.id`, message: `id is required (\u2264 ${REVIEW_FINDING_ID_MAX_CHARS} chars)` });
|
|
4523
|
+
else if (seen.has(id2)) errors.push({ field: `${at}.id`, message: `duplicate finding id '${id2}'` });
|
|
4524
|
+
else seen.add(id2);
|
|
4525
|
+
if (!isFindingSeverity(f.severity)) errors.push({ field: `${at}.severity`, message: `severity must be one of ${FINDING_SEVERITIES.join(" | ")}` });
|
|
4526
|
+
if (!isFindingCategory(f.category)) errors.push({ field: `${at}.category`, message: `category must be one of ${FINDING_CATEGORIES.join(" | ")}` });
|
|
4527
|
+
const claim = str2(f.claim);
|
|
4528
|
+
if (!claim) errors.push({ field: `${at}.claim`, message: "claim is required" });
|
|
4529
|
+
else if (claim.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.claim`, message: `claim is over ${REVIEW_CLAIM_MAX_CHARS} chars` });
|
|
4530
|
+
const evidence = str2(f.evidence);
|
|
4531
|
+
if (!evidence) errors.push({ field: `${at}.evidence`, message: "evidence is required \u2014 what did you read or run to know this" });
|
|
4532
|
+
else if (evidence.length > REVIEW_EVIDENCE_MAX_CHARS) errors.push({ field: `${at}.evidence`, message: `evidence is over ${REVIEW_EVIDENCE_MAX_CHARS} chars` });
|
|
4533
|
+
const fix = f.suggestedFix === void 0 ? void 0 : str2(f.suggestedFix);
|
|
4534
|
+
if (fix !== void 0 && fix.length > REVIEW_FIX_MAX_CHARS) errors.push({ field: `${at}.suggestedFix`, message: `suggestedFix is over ${REVIEW_FIX_MAX_CHARS} chars` });
|
|
4535
|
+
if (f.file !== void 0 && typeof f.file !== "string") errors.push({ field: `${at}.file`, message: "file must be a string" });
|
|
4536
|
+
if (f.line !== void 0 && (typeof f.line !== "number" || !Number.isInteger(f.line) || f.line < 1)) errors.push({ field: `${at}.line`, message: "line must be a positive integer" });
|
|
4537
|
+
if (id2 && isFindingSeverity(f.severity) && isFindingCategory(f.category) && claim && evidence) {
|
|
4538
|
+
findings.push({
|
|
4539
|
+
id: id2,
|
|
4540
|
+
severity: f.severity,
|
|
4541
|
+
category: f.category,
|
|
4542
|
+
...typeof f.file === "string" && f.file.trim() ? { file: f.file.trim() } : {},
|
|
4543
|
+
...typeof f.line === "number" ? { line: f.line } : {},
|
|
4544
|
+
claim,
|
|
4545
|
+
evidence,
|
|
4546
|
+
...fix ? { suggestedFix: fix } : {}
|
|
4547
|
+
});
|
|
4548
|
+
}
|
|
4549
|
+
});
|
|
4550
|
+
}
|
|
4551
|
+
const checked = validateStringList(raw.checked, "review.checked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
|
|
4552
|
+
const notChecked = validateStringList(raw.notChecked, "review.notChecked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
|
|
4553
|
+
let priorFindings;
|
|
4554
|
+
if (raw.priorFindings !== void 0) {
|
|
4555
|
+
if (!Array.isArray(raw.priorFindings)) errors.push({ field: "review.priorFindings", message: "priorFindings must be an array" });
|
|
4556
|
+
else {
|
|
4557
|
+
priorFindings = [];
|
|
4558
|
+
raw.priorFindings.forEach((p, i) => {
|
|
4559
|
+
const at = `review.priorFindings[${i}]`;
|
|
4560
|
+
if (!isRecord4(p)) {
|
|
4561
|
+
errors.push({ field: at, message: "each entry must be an object {id, status, note?}" });
|
|
4562
|
+
return;
|
|
4563
|
+
}
|
|
4564
|
+
for (const key of Object.keys(p)) if (!["id", "status", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
4565
|
+
const id2 = str2(p.id);
|
|
4566
|
+
if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
|
|
4567
|
+
if (!isPriorFindingStatus(p.status)) errors.push({ field: `${at}.status`, message: `status must be one of ${PRIOR_FINDING_STATUSES.join(" | ")}` });
|
|
4568
|
+
const note = p.note === void 0 ? void 0 : str2(p.note);
|
|
4569
|
+
if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
|
|
4570
|
+
if (id2 && isPriorFindingStatus(p.status)) priorFindings.push({ id: id2, status: p.status, ...note ? { note } : {} });
|
|
4571
|
+
});
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4574
|
+
const testsRun = raw.testsRun === void 0 ? void 0 : validateTestsRun(raw.testsRun, "review.testsRun", errors);
|
|
4575
|
+
if (isReviewVerdict(verdict)) {
|
|
4576
|
+
const blocking = findings.filter((f) => isBlockingSeverity(f.severity));
|
|
4577
|
+
if (verdict === "changes_requested" && blocking.length === 0 && Array.isArray(raw.findings) && errors.length === 0) {
|
|
4578
|
+
errors.push({ field: "review.verdict", message: "changes_requested needs at least one blocking or major finding \u2014 nits alone are approve_with_nits" });
|
|
4579
|
+
}
|
|
4580
|
+
if (verdict === "approve" && blocking.length > 0) {
|
|
4581
|
+
errors.push({ field: "review.verdict", message: "approve cannot carry blocking or major findings" });
|
|
4582
|
+
}
|
|
4583
|
+
if (verdict === "approve_with_nits" && blocking.length > 0) {
|
|
4584
|
+
errors.push({ field: "review.verdict", message: "approve_with_nits cannot carry blocking or major findings \u2014 use changes_requested" });
|
|
4585
|
+
}
|
|
4586
|
+
}
|
|
4587
|
+
if (ctx.round >= 2 && ctx.priorOpenBlockingIds?.length) {
|
|
4588
|
+
const answered = new Set((priorFindings ?? []).map((p) => p.id));
|
|
4589
|
+
const missing = ctx.priorOpenBlockingIds.filter((id2) => !answered.has(id2));
|
|
4590
|
+
if (missing.length) errors.push({ field: "review.priorFindings", message: `round ${ctx.round} must give a status for every prior blocking/major finding; missing: ${missing.join(", ")}` });
|
|
4591
|
+
}
|
|
4592
|
+
if (errors.length) return { errors };
|
|
4593
|
+
return {
|
|
4594
|
+
report: {
|
|
4595
|
+
verdict,
|
|
4596
|
+
findings,
|
|
4597
|
+
...priorFindings?.length ? { priorFindings } : {},
|
|
4598
|
+
checked,
|
|
4599
|
+
notChecked,
|
|
4600
|
+
...testsRun?.length ? { testsRun } : {}
|
|
4601
|
+
},
|
|
4602
|
+
errors: []
|
|
4603
|
+
};
|
|
4604
|
+
}
|
|
4605
|
+
function validateTestsRun(raw, field, errors) {
|
|
4606
|
+
if (!Array.isArray(raw)) {
|
|
4607
|
+
errors.push({ field, message: `${field} must be an array of {command, exit, passed?, failed?, note?}` });
|
|
4608
|
+
return [];
|
|
4609
|
+
}
|
|
4610
|
+
if (raw.length > REVIEW_TESTS_RUN_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${REVIEW_TESTS_RUN_MAX} limit` });
|
|
4611
|
+
const out = [];
|
|
4612
|
+
raw.forEach((t, i) => {
|
|
4613
|
+
const at = `${field}[${i}]`;
|
|
4614
|
+
if (!isRecord4(t)) {
|
|
4615
|
+
errors.push({ field: at, message: "each entry must be an object" });
|
|
4616
|
+
return;
|
|
4617
|
+
}
|
|
4618
|
+
for (const key of Object.keys(t)) if (!["command", "exit", "passed", "failed", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
4619
|
+
const command = str2(t.command);
|
|
4620
|
+
if (!command || command.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.command`, message: `command is required (\u2264 ${REVIEW_CLAIM_MAX_CHARS} chars)` });
|
|
4621
|
+
if (typeof t.exit !== "number" || !Number.isInteger(t.exit)) errors.push({ field: `${at}.exit`, message: "exit must be an integer" });
|
|
4622
|
+
for (const k of ["passed", "failed"]) {
|
|
4623
|
+
if (t[k] !== void 0 && (typeof t[k] !== "number" || !Number.isInteger(t[k]) || t[k] < 0)) errors.push({ field: `${at}.${k}`, message: `${k} must be a non-negative integer` });
|
|
4624
|
+
}
|
|
4625
|
+
const note = t.note === void 0 ? void 0 : str2(t.note);
|
|
4626
|
+
if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
|
|
4627
|
+
if (command && typeof t.exit === "number") {
|
|
4628
|
+
out.push({
|
|
4629
|
+
command,
|
|
4630
|
+
exit: t.exit,
|
|
4631
|
+
...typeof t.passed === "number" ? { passed: t.passed } : {},
|
|
4632
|
+
...typeof t.failed === "number" ? { failed: t.failed } : {},
|
|
4633
|
+
...note ? { note } : {}
|
|
4634
|
+
});
|
|
4635
|
+
}
|
|
4636
|
+
});
|
|
4637
|
+
return out;
|
|
4638
|
+
}
|
|
4639
|
+
function validateFindingResponses(raw, field = "findingResponses") {
|
|
4640
|
+
const errors = [];
|
|
4641
|
+
if (!Array.isArray(raw)) return { errors: [{ field, message: `${field} must be an array of {id, response, note}` }] };
|
|
4642
|
+
if (raw.length > FINDING_RESPONSES_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${FINDING_RESPONSES_MAX} limit` });
|
|
4643
|
+
const out = [];
|
|
4644
|
+
raw.forEach((r, i) => {
|
|
4645
|
+
const at = `${field}[${i}]`;
|
|
4646
|
+
if (!isRecord4(r)) {
|
|
4647
|
+
errors.push({ field: at, message: "each entry must be an object {id, response, note}" });
|
|
4648
|
+
return;
|
|
4649
|
+
}
|
|
4650
|
+
for (const key of Object.keys(r)) if (!["id", "response", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
4651
|
+
const id2 = str2(r.id);
|
|
4652
|
+
if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
|
|
4653
|
+
if (!isFindingResponseKind(r.response)) errors.push({ field: `${at}.response`, message: `response must be one of ${FINDING_RESPONSE_KINDS.join(" | ")}` });
|
|
4654
|
+
const note = str2(r.note);
|
|
4655
|
+
if (!note) errors.push({ field: `${at}.note`, message: "note is required \u2014 say what changed, or why you dispute it" });
|
|
4656
|
+
else if (note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
|
|
4657
|
+
if (id2 && isFindingResponseKind(r.response) && note && note.length <= REVIEW_NOTE_MAX_CHARS) out.push({ id: id2, response: r.response, note });
|
|
4658
|
+
});
|
|
4659
|
+
return errors.length ? { errors } : { responses: out, errors: [] };
|
|
4660
|
+
}
|
|
4661
|
+
function formatStageVerdictLine(input) {
|
|
4662
|
+
const parts = [`review: ${input.verdict}`];
|
|
4663
|
+
if (input.verdict === "skipped_no_diff") return parts[0];
|
|
4664
|
+
parts.push(`${input.rounds} round${input.rounds === 1 ? "" : "s"}`);
|
|
4665
|
+
if (input.reviewerProvider) parts.push(`reviewer ${input.reviewerProvider} (${input.independenceUsed ?? "different_provider"})`);
|
|
4666
|
+
const tail = [];
|
|
4667
|
+
if (input.fixed) tail.push(`${input.fixed} finding${input.fixed === 1 ? "" : "s"} fixed`);
|
|
4668
|
+
if (input.openNits) tail.push(`${input.openNits} nit${input.openNits === 1 ? "" : "s"} open`);
|
|
4669
|
+
return tail.length ? `${parts.join(" \xB7 ")} \xB7 ${tail.join(", ")}` : parts.join(" \xB7 ");
|
|
4670
|
+
}
|
|
3434
4671
|
export {
|
|
4672
|
+
ASSISTANT_ACCOUNT_SLOT,
|
|
4673
|
+
ASSISTANT_FOLLOWER_ALLOWED_OPS,
|
|
3435
4674
|
ASSISTANT_OWNER_VERBS,
|
|
4675
|
+
ASSISTANT_REMOTE_FOLLOW_COMMAND,
|
|
4676
|
+
ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND,
|
|
4677
|
+
ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND,
|
|
4678
|
+
ASSISTANT_REMOTE_PROJECT_COMMAND,
|
|
3436
4679
|
ASSISTANT_REVIEW_TURN_VERBS,
|
|
3437
4680
|
ASSISTANT_SESSION_ID_ARG,
|
|
3438
4681
|
ASSISTANT_SESSION_ID_ENV,
|
|
@@ -3444,12 +4687,16 @@ export {
|
|
|
3444
4687
|
CANCEL_REASONS,
|
|
3445
4688
|
CANONICAL_MESH_TOOL_COUNT,
|
|
3446
4689
|
CANONICAL_MESH_TOOL_NAMES,
|
|
4690
|
+
CARRY_OVER_MISSION_GOAL,
|
|
4691
|
+
CARRY_OVER_MISSION_TITLE,
|
|
4692
|
+
CHANGELOG_SECTIONS,
|
|
3447
4693
|
CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX,
|
|
3448
4694
|
CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX,
|
|
3449
4695
|
CLI_SLOT_RECIPES,
|
|
3450
4696
|
COMMIT_STRENGTHS,
|
|
3451
4697
|
CONSUME_PROFILES,
|
|
3452
4698
|
COORDINATOR_ACK_OUTCOMES,
|
|
4699
|
+
COORDINATOR_SETTABLE_ITEM_STATES,
|
|
3453
4700
|
DAEMON_METADATA_DOC_SPEC,
|
|
3454
4701
|
DAEMON_P2P_SIGNAL_TYPES,
|
|
3455
4702
|
DAEMON_STATUS_EVENT_NAMES,
|
|
@@ -3462,13 +4709,34 @@ export {
|
|
|
3462
4709
|
DASHBOARD_TO_DAEMON_P2P_TYPES,
|
|
3463
4710
|
DASHBOARD_TO_USER_SESSION_TYPES,
|
|
3464
4711
|
DASHBOARD_WIRE_VERSION,
|
|
4712
|
+
DECISION_PUSH_OPTIONS_MAX,
|
|
4713
|
+
DECISION_PUSH_OPTION_LABEL_MAX,
|
|
4714
|
+
DECISION_PUSH_QUESTION_MAX,
|
|
4715
|
+
DECISION_PUSH_RELAY_COMMAND,
|
|
4716
|
+
DECISION_PUSH_RELAY_SOURCE,
|
|
3465
4717
|
DEFAULT_DIFFICULTY_BRAINS,
|
|
3466
4718
|
DELIVERY_OUTCOMES,
|
|
3467
4719
|
DELIVERY_VIAS,
|
|
3468
4720
|
DISPATCH_FAILURE_REASONS,
|
|
4721
|
+
DISPATCH_REFUSAL_DETAIL_MAX,
|
|
3469
4722
|
EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
3470
4723
|
EVIDENCE_SOURCE_IDS,
|
|
4724
|
+
FINDING_CATEGORIES,
|
|
4725
|
+
FINDING_RESPONSES_MAX,
|
|
4726
|
+
FINDING_RESPONSE_KINDS,
|
|
4727
|
+
FINDING_SEVERITIES,
|
|
3471
4728
|
HOLD_REASONS,
|
|
4729
|
+
LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
|
|
4730
|
+
LAUNCH_DEFAULT_ERROR_CODES,
|
|
4731
|
+
LAUNCH_DEFAULT_ROLES,
|
|
4732
|
+
LAUNCH_DEFAULT_SOURCES,
|
|
4733
|
+
LEGACY_CARRY_OVER_MISSION_TITLE,
|
|
4734
|
+
LIGHT_BLOCK_REASONS,
|
|
4735
|
+
LIGHT_HOLD,
|
|
4736
|
+
LIGHT_LAND_MODES,
|
|
4737
|
+
LIGHT_REJECT,
|
|
4738
|
+
LIGHT_TESTS_RUN_MAX,
|
|
4739
|
+
LIGHT_WARNINGS,
|
|
3472
4740
|
LIVENESS_RESULTS,
|
|
3473
4741
|
MAX_MESH_RECORD_STRING,
|
|
3474
4742
|
MAX_OWNED_PATHS,
|
|
@@ -3483,6 +4751,8 @@ export {
|
|
|
3483
4751
|
MESH_MISSION_STATUSES,
|
|
3484
4752
|
MESH_P2P_SIGNAL_TYPES,
|
|
3485
4753
|
MESH_RECORD_PAYLOAD_KEYS,
|
|
4754
|
+
MESH_RELEASE_CHANNELS,
|
|
4755
|
+
MESH_RELEASE_STATUSES,
|
|
3486
4756
|
MESH_SESSION_CLEANUP_MODES,
|
|
3487
4757
|
MESH_STATUS_DOC_SPEC,
|
|
3488
4758
|
MESH_TASK_DIFFICULTIES,
|
|
@@ -3494,10 +4764,23 @@ export {
|
|
|
3494
4764
|
MESH_TOPIC_ENTRY_KINDS,
|
|
3495
4765
|
MESH_TOPIC_PROTOCOL_VERSION,
|
|
3496
4766
|
MISSION_BRIEF_RENDER_MAX_CHARS,
|
|
4767
|
+
MISSION_DECISION_ON_DUE,
|
|
4768
|
+
MISSION_DECISION_OPTION_IDS,
|
|
4769
|
+
MISSION_DECISION_URGENCIES,
|
|
4770
|
+
MISSION_GIT_STATES,
|
|
4771
|
+
MISSION_ITEM_KINDS,
|
|
4772
|
+
MISSION_ITEM_STATES,
|
|
4773
|
+
MISSION_LIMITS,
|
|
4774
|
+
MISSION_OUTCOMES,
|
|
4775
|
+
MISSION_REF_GIT_METHODS,
|
|
4776
|
+
MISSION_REF_GIT_STATUSES,
|
|
4777
|
+
MISSION_REF_KINDS,
|
|
4778
|
+
MISSION_RELEASE_EVENT_TYPES,
|
|
3497
4779
|
MODEL_AXIS_SOURCES,
|
|
3498
4780
|
MODEL_SELECTION_HISTORY_LIMIT,
|
|
3499
4781
|
MeshChunkAssembler,
|
|
3500
4782
|
NATIVE_TURN_OUTCOMES,
|
|
4783
|
+
NEEDS_WORDING_MARKER,
|
|
3501
4784
|
NOTIFY_KINDS,
|
|
3502
4785
|
NO_PROGRESS_OBSERVED_STATUSES,
|
|
3503
4786
|
NPM_UPDATE_TAGS,
|
|
@@ -3507,16 +4790,37 @@ export {
|
|
|
3507
4790
|
OPERATOR_STATUS_REASON_VALUES,
|
|
3508
4791
|
OPERATOR_STATUS_VALUES,
|
|
3509
4792
|
OUTBOUND_MESSAGE_ORIGINS,
|
|
4793
|
+
OWNER_ABANDON_CONFIRM_KEY_PREFIX,
|
|
4794
|
+
OWNER_ABANDON_CONFIRM_OPTIONS,
|
|
4795
|
+
OWNER_ABANDON_CONFIRM_QUESTION,
|
|
3510
4796
|
P2P_SIGNAL_TYPES,
|
|
4797
|
+
PRIOR_FINDING_STATUSES,
|
|
3511
4798
|
PROVIDER_FAILURES,
|
|
3512
4799
|
QUOTA_BACKFILL_HORIZON_MS,
|
|
3513
4800
|
QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
3514
4801
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
3515
4802
|
RECENT_SESSION_BUCKETS,
|
|
3516
4803
|
RECLAIMING_SEND_REFUSALS,
|
|
4804
|
+
RELAY_REPROBE_BASE_DELAY_MS,
|
|
4805
|
+
RELAY_REPROBE_JITTER_RATIO,
|
|
4806
|
+
RELAY_REPROBE_MAX_DELAY_MS,
|
|
4807
|
+
RELEASE_ACTORS,
|
|
3517
4808
|
RELEASE_CHANNELS,
|
|
4809
|
+
RELEASE_EVENT_TYPES,
|
|
4810
|
+
RELEASE_LIMITS,
|
|
4811
|
+
RELEASE_MEMBER_STATES,
|
|
3518
4812
|
REMOVED_MESH_TOOLS,
|
|
3519
4813
|
RETIRED_MESH_TOOLS,
|
|
4814
|
+
REVIEW_CHECKED_MAX,
|
|
4815
|
+
REVIEW_CLAIM_MAX_CHARS,
|
|
4816
|
+
REVIEW_EVIDENCE_MAX_CHARS,
|
|
4817
|
+
REVIEW_FINDINGS_MAX,
|
|
4818
|
+
REVIEW_FINDING_ID_MAX_CHARS,
|
|
4819
|
+
REVIEW_FIX_MAX_CHARS,
|
|
4820
|
+
REVIEW_NOTE_MAX_CHARS,
|
|
4821
|
+
REVIEW_TESTS_RUN_MAX,
|
|
4822
|
+
REVIEW_VERDICTS,
|
|
4823
|
+
RelayReprobeScheduler,
|
|
3520
4824
|
SEND_POLICY_MODES,
|
|
3521
4825
|
SEND_REFUSAL_REASONS,
|
|
3522
4826
|
SERVER_STATUS_EVENT_NAMES,
|
|
@@ -3529,6 +4833,17 @@ export {
|
|
|
3529
4833
|
SESSION_STATUS_ALIASES,
|
|
3530
4834
|
SESSION_STATUS_CLASS,
|
|
3531
4835
|
SHARED_SESSION_TO_VIEWER_TYPES,
|
|
4836
|
+
STAGE_BLOCKED_REASONS,
|
|
4837
|
+
STAGE_DECIDE_ACTIONS,
|
|
4838
|
+
STAGE_DEFAULT_MAX_REVISIONS,
|
|
4839
|
+
STAGE_INDEPENDENCE_FALLBACK_MS,
|
|
4840
|
+
STAGE_INDEPENDENCE_MODES,
|
|
4841
|
+
STAGE_MAX_REVISIONS_LIMIT,
|
|
4842
|
+
STAGE_PARKED_PHASES,
|
|
4843
|
+
STAGE_PHASES,
|
|
4844
|
+
STAGE_PIPELINE_CEILING_DEFAULT_MS,
|
|
4845
|
+
STAGE_ROLES,
|
|
4846
|
+
STAGE_SELF_CHECK_MAX_BOUNCES,
|
|
3532
4847
|
STATUS_PROBE_ARG_KEY,
|
|
3533
4848
|
SUSPENSION_MODALS,
|
|
3534
4849
|
SUSPENSION_RESOLUTIONS,
|
|
@@ -3554,17 +4869,26 @@ export {
|
|
|
3554
4869
|
VERSION_UPDATE_REASONS,
|
|
3555
4870
|
VIEWER_TO_SHARED_SESSION_TYPES,
|
|
3556
4871
|
WORKER_BRANCH_STATES,
|
|
4872
|
+
WORKER_COMMITS_MAX,
|
|
4873
|
+
WORKER_CURRENT_BRANCH_RULE,
|
|
4874
|
+
WORKER_DECISIONS_NEEDED_MAX,
|
|
3557
4875
|
WORKER_PROTOCOL_FOOTER_MARKER,
|
|
3558
4876
|
WORKER_REPORT_OUTCOMES,
|
|
4877
|
+
WORKER_REPORT_SUMMARY_MAX_CHARS,
|
|
3559
4878
|
WORKER_TOOLS,
|
|
4879
|
+
aggregateMissionGitState,
|
|
3560
4880
|
appendWorkerProtocolFooter,
|
|
3561
4881
|
argsCarryStatusProbeMarker,
|
|
3562
4882
|
assessQuotaFreshness,
|
|
4883
|
+
boundEventPayload,
|
|
3563
4884
|
buildSlotProposal,
|
|
3564
4885
|
canonicalDaemonId,
|
|
4886
|
+
changelogMissionMarker,
|
|
4887
|
+
classifyChangelogSection,
|
|
3565
4888
|
classifySessionStatus,
|
|
3566
4889
|
compareDashboardWireVersion,
|
|
3567
4890
|
compareSemver,
|
|
4891
|
+
computeRelayReprobeDelay,
|
|
3568
4892
|
daemonIdsEquivalent,
|
|
3569
4893
|
decodeActiveWorkQueryRequest,
|
|
3570
4894
|
decodeActiveWorkQueryResponse,
|
|
@@ -3607,6 +4931,8 @@ export {
|
|
|
3607
4931
|
decodeQueueQueryResponse,
|
|
3608
4932
|
decodeQueueRequeueRequest,
|
|
3609
4933
|
decodeQueueRequeueResponse,
|
|
4934
|
+
decodeQueueReviseRequest,
|
|
4935
|
+
decodeQueueReviseResponse,
|
|
3610
4936
|
decodeRecordLocalRequest,
|
|
3611
4937
|
decodeRecordLocalResponse,
|
|
3612
4938
|
decodeRecoveryContextQueryRequest,
|
|
@@ -3626,6 +4952,8 @@ export {
|
|
|
3626
4952
|
decodeUserSessionToDashboard,
|
|
3627
4953
|
decodeViewerToSharedSession,
|
|
3628
4954
|
defaultProviderPriorityFromNodeFacts,
|
|
4955
|
+
defaultStagePlan,
|
|
4956
|
+
deriveItemDedupeKey,
|
|
3629
4957
|
deriveProviderPriorityFromSlots,
|
|
3630
4958
|
deriveSlotsFromLegacy,
|
|
3631
4959
|
describeModelSelection,
|
|
@@ -3636,13 +4964,21 @@ export {
|
|
|
3636
4964
|
expandDaemonIdForms,
|
|
3637
4965
|
findOwnershipConflicts,
|
|
3638
4966
|
foldKeyedDoc,
|
|
4967
|
+
followedRemoteProjectKey,
|
|
4968
|
+
followerOpPermitted,
|
|
3639
4969
|
formatQuotaAccount,
|
|
4970
|
+
formatStageVerdictLine,
|
|
3640
4971
|
hasGitStatusEvidence,
|
|
3641
4972
|
hasWorkerProtocolFooter,
|
|
3642
4973
|
interpolateString,
|
|
4974
|
+
isActionableProviderApproval,
|
|
4975
|
+
isAssistantFollowerAllowedOp,
|
|
3643
4976
|
isAssistantTool,
|
|
3644
4977
|
isBlockedStatus,
|
|
4978
|
+
isBlockingSeverity,
|
|
3645
4979
|
isBusyStatus,
|
|
4980
|
+
isCarryOverMissionRecord,
|
|
4981
|
+
isCarryOverMissionTitle,
|
|
3646
4982
|
isChunkType,
|
|
3647
4983
|
isCommitStrength,
|
|
3648
4984
|
isDaemonDirectCommandType,
|
|
@@ -3658,14 +4994,21 @@ export {
|
|
|
3658
4994
|
isDeadStatus,
|
|
3659
4995
|
isDowngrade,
|
|
3660
4996
|
isEvidenceIdentifier,
|
|
4997
|
+
isFindingCategory,
|
|
4998
|
+
isFindingResponseKind,
|
|
4999
|
+
isFindingSeverity,
|
|
3661
5000
|
isFiniteNumber,
|
|
3662
5001
|
isIdleSessionState,
|
|
3663
5002
|
isInputEnvelopeWire,
|
|
5003
|
+
isLaunchDefaultRole,
|
|
5004
|
+
isLaunchDefaultSource,
|
|
5005
|
+
isLightWorkerSession,
|
|
3664
5006
|
isMeshDeliveryMode,
|
|
3665
5007
|
isMeshIndexQueryResponse,
|
|
3666
5008
|
isMeshMissionStatusValue,
|
|
3667
5009
|
isMeshP2PSignalType,
|
|
3668
5010
|
isMeshRecordPayload,
|
|
5011
|
+
isMeshReleaseChannel,
|
|
3669
5012
|
isMeshTaskDifficulty,
|
|
3670
5013
|
isMeshTaskMode,
|
|
3671
5014
|
isMeshTaskPriority,
|
|
@@ -3673,17 +5016,24 @@ export {
|
|
|
3673
5016
|
isMeshTerminalTaskStatus,
|
|
3674
5017
|
isMeshTopicEntry,
|
|
3675
5018
|
isMessageId,
|
|
5019
|
+
isMissionOutcome,
|
|
5020
|
+
isMissionRefContained,
|
|
3676
5021
|
isMissionUpsertResponse,
|
|
3677
5022
|
isModelAxisSource,
|
|
5023
|
+
isNativeMarkerRef,
|
|
3678
5024
|
isNonEmptyString,
|
|
3679
5025
|
isNotifyKind,
|
|
3680
5026
|
isOutboundMessage,
|
|
3681
5027
|
isOutboundMessageOrigin,
|
|
3682
5028
|
isP2PSignalType,
|
|
3683
5029
|
isPhantomDaemonEntry,
|
|
5030
|
+
isPriorFindingStatus,
|
|
5031
|
+
isProviderQuestionBinding,
|
|
3684
5032
|
isRawDaemonDoId,
|
|
3685
5033
|
isReadyStatus,
|
|
3686
5034
|
isRecord,
|
|
5035
|
+
isReleaseStatus,
|
|
5036
|
+
isReviewVerdict,
|
|
3687
5037
|
isSendPolicy,
|
|
3688
5038
|
isSendPolicyMode,
|
|
3689
5039
|
isSendRefusal,
|
|
@@ -3692,6 +5042,8 @@ export {
|
|
|
3692
5042
|
isSessionLaunchedBy,
|
|
3693
5043
|
isSessionStatus,
|
|
3694
5044
|
isSharedSessionToViewerType,
|
|
5045
|
+
isStageBlockedReason,
|
|
5046
|
+
isStageEligibleTask,
|
|
3695
5047
|
isSubmitOutcome,
|
|
3696
5048
|
isSummaryRef,
|
|
3697
5049
|
isTerminalSessionRecordStatus,
|
|
@@ -3710,6 +5062,7 @@ export {
|
|
|
3710
5062
|
isWorkingStatus,
|
|
3711
5063
|
joinRepoPath,
|
|
3712
5064
|
launchModelSelectionValue,
|
|
5065
|
+
lintChangelogText,
|
|
3713
5066
|
machineCoreFromDaemonId,
|
|
3714
5067
|
makeTypeGuard,
|
|
3715
5068
|
measureWorstCaseChunkEnvelopeBytes,
|
|
@@ -3721,41 +5074,58 @@ export {
|
|
|
3721
5074
|
minutesUntilQuotaCheck,
|
|
3722
5075
|
normalizeAuthOkLimits,
|
|
3723
5076
|
normalizeBrainSlot,
|
|
5077
|
+
normalizeDecisionInput,
|
|
3724
5078
|
normalizeDifficultyBrainMap,
|
|
5079
|
+
normalizeForDedupe,
|
|
3725
5080
|
normalizeGitStatus,
|
|
3726
5081
|
normalizeMeshNodeFacts,
|
|
3727
5082
|
normalizeMeshNodeId,
|
|
3728
5083
|
normalizeMeshSessionRecord,
|
|
3729
5084
|
normalizeMeshWorkspaceForCompare,
|
|
3730
5085
|
normalizeMissionBrief,
|
|
5086
|
+
normalizeMissionItemInput,
|
|
5087
|
+
normalizeMissionItemUpdate,
|
|
5088
|
+
normalizeMissionRefs,
|
|
5089
|
+
normalizeMissionSummary,
|
|
3731
5090
|
normalizeNodeCapabilitySlot,
|
|
3732
5091
|
normalizeNodeCapabilitySlots,
|
|
5092
|
+
normalizeOutcomeReason,
|
|
3733
5093
|
normalizeOwnedPaths,
|
|
5094
|
+
normalizeReportCommits,
|
|
3734
5095
|
normalizeSessionStatus,
|
|
3735
5096
|
normalizeThinkingLevel,
|
|
3736
5097
|
orderProvidersByBuiltinPreference,
|
|
3737
5098
|
parseJsonRecord,
|
|
5099
|
+
parseRoleLaunchSelection,
|
|
3738
5100
|
parseSemver,
|
|
3739
5101
|
parseSessionLaunchRecord,
|
|
3740
5102
|
pathsOverlap,
|
|
3741
5103
|
pickBestTransitGitStatus,
|
|
3742
5104
|
projectFileDiffRow,
|
|
3743
5105
|
projectTurnEvidenceEntry,
|
|
5106
|
+
providerApprovalSnapshot,
|
|
3744
5107
|
readBoolean,
|
|
3745
5108
|
readEnvelopeFields,
|
|
3746
5109
|
readGitSubmodules,
|
|
3747
5110
|
readNumber,
|
|
3748
5111
|
readOptionalRecord,
|
|
5112
|
+
readProviderDecision,
|
|
3749
5113
|
readRecord,
|
|
3750
5114
|
readString,
|
|
3751
5115
|
readStringArray,
|
|
3752
5116
|
readText,
|
|
3753
5117
|
renderCoordinatorWorkerSection,
|
|
5118
|
+
renderLightWorkspaceRules,
|
|
3754
5119
|
renderMissionBriefBlock,
|
|
5120
|
+
renderStageProtocolLines,
|
|
3755
5121
|
renderWorkerProtocolFooter,
|
|
5122
|
+
resolveStagePlan,
|
|
3756
5123
|
retiredMeshToolError,
|
|
5124
|
+
reviewIndependenceOf,
|
|
5125
|
+
sanitizeDispatchRefusalDetail,
|
|
3757
5126
|
sanitizeModelIdentifier,
|
|
3758
5127
|
sanitizeRefusalCode,
|
|
5128
|
+
sanitizeRemoteRepoIdentity,
|
|
3759
5129
|
scoreGitStatusCandidate,
|
|
3760
5130
|
scoreGitUpstreamFreshness,
|
|
3761
5131
|
sessionIdsEquivalent,
|
|
@@ -3766,6 +5136,11 @@ export {
|
|
|
3766
5136
|
summarizeGitShape,
|
|
3767
5137
|
supportsQuota,
|
|
3768
5138
|
touchedFilesOutsideOwnership,
|
|
5139
|
+
truncateMissionText,
|
|
5140
|
+
unwrapPastedContent,
|
|
5141
|
+
validateFindingResponses,
|
|
5142
|
+
validateReviewReport,
|
|
5143
|
+
validateTestsRun,
|
|
3769
5144
|
withStatusProbeMarker
|
|
3770
5145
|
};
|
|
3771
5146
|
//# sourceMappingURL=index.mjs.map
|