@adhdev/mesh-shared 1.0.82-rc.12 → 1.0.82-rc.120
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 +158 -6
- package/dist/decision-push-relay.d.ts +20 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1534 -112
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1400 -112
- 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 +54 -1
- package/dist/outbound-message.d.ts +9 -2
- 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/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 +210 -0
- package/dist/turn-evidence.d.ts +31 -9
- 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/worker-protocol.d.ts +41 -1
- package/package.json +1 -1
- package/src/assistant-protocol.ts +294 -6
- package/src/daemon-normalize.ts +7 -5
- package/src/decision-push-relay.ts +23 -0
- package/src/index.ts +11 -0
- 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 +54 -1
- package/src/outbound-message.ts +19 -0
- package/src/protocol/daemon-server.ts +37 -2
- package/src/protocol/dashboard-server.ts +13 -2
- 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 +459 -0
- package/src/turn-evidence.ts +47 -7
- package/src/turn-ipc-mission.ts +127 -11
- package/src/turn-ipc-queue.ts +45 -2
- package/src/turn-ipc-turn.ts +1 -1
- package/src/turn-ipc.ts +1 -0
- package/src/worker-protocol.ts +94 -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,39 @@ 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.";
|
|
1736
|
+
var WORKER_SHELL_LITERAL_PATHS_RULE = "In shell commands, write file and directory paths literally (absolute, or relative to your workspace) instead of through shell variables (`N=dir; cat $N/x`) or `$(...)` substitutions, and keep to one simple command per call, so the command can be checked before it runs. This does not change what you are allowed to run or read.";
|
|
1630
1737
|
function hasWorkerProtocolFooter(body) {
|
|
1631
1738
|
return typeof body === "string" && body.includes(WORKER_PROTOCOL_FOOTER_MARKER);
|
|
1632
1739
|
}
|
|
@@ -1648,6 +1755,9 @@ function renderWorkerProtocolFooter(input = {}) {
|
|
|
1648
1755
|
if (input.readonly) scope.push("read-only");
|
|
1649
1756
|
if (scope.length) lines.push(`You are a delegated worker (${scope.join(", ")}).`);
|
|
1650
1757
|
else lines.push("You are a delegated worker.");
|
|
1758
|
+
if (input.light) lines.push(...renderLightWorkspaceRules(input.light));
|
|
1759
|
+
else if (input.commitOnCurrentBranch && input.stage?.role !== "review") lines.push(WORKER_CURRENT_BRANCH_RULE);
|
|
1760
|
+
lines.push(WORKER_SHELL_LITERAL_PATHS_RULE);
|
|
1651
1761
|
if (input.workerMcp === false) {
|
|
1652
1762
|
lines.push(
|
|
1653
1763
|
"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 +1777,30 @@ function renderWorkerProtocolFooter(input = {}) {
|
|
|
1667
1777
|
"Memos from the coordinator arrive appended to the response of whichever worker tool you call next; read them and follow them.",
|
|
1668
1778
|
"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
1779
|
"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."
|
|
1780
|
+
"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.",
|
|
1781
|
+
"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.",
|
|
1782
|
+
"`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
1783
|
);
|
|
1672
1784
|
if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
|
|
1673
1785
|
lines.push(
|
|
1674
1786
|
`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
1787
|
);
|
|
1676
1788
|
}
|
|
1789
|
+
if (input.stage) lines.push(...renderStageProtocolLines(input.stage));
|
|
1677
1790
|
return lines.join("\n");
|
|
1678
1791
|
}
|
|
1792
|
+
function renderStageProtocolLines(stage) {
|
|
1793
|
+
if (stage.role === "review") {
|
|
1794
|
+
return [
|
|
1795
|
+
`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.") + " Do not write any file for the review, not even a report: a new or changed file in the reviewed checkout fails the review as reviewer_mutated_source, and `artifact_register` refuses files outside the workspace. Put every finding in the `review` field of `report_completion` \u2014 that is the review record.",
|
|
1796
|
+
"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."
|
|
1797
|
+
];
|
|
1798
|
+
}
|
|
1799
|
+
return [
|
|
1800
|
+
`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. When your change is committed, report outcome \`completed\` \u2014 the review starts only after that report, so never report \`blocked\` because the review has not run yet. You may receive review findings as a follow-up memo in this same session.`,
|
|
1801
|
+
...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."] : []
|
|
1802
|
+
];
|
|
1803
|
+
}
|
|
1679
1804
|
function stripWorkerProtocolFooter(body) {
|
|
1680
1805
|
if (typeof body !== "string") return body;
|
|
1681
1806
|
const at = body.indexOf(WORKER_PROTOCOL_FOOTER_MARKER);
|
|
@@ -1712,11 +1837,23 @@ var ASSISTANT_TOOLS = [
|
|
|
1712
1837
|
"project_send",
|
|
1713
1838
|
"project_read",
|
|
1714
1839
|
"project_add",
|
|
1840
|
+
"project_attach_remote",
|
|
1715
1841
|
"discover_repos",
|
|
1716
1842
|
"memory",
|
|
1843
|
+
"memory_search",
|
|
1717
1844
|
"skill_view",
|
|
1718
1845
|
"skill_manage",
|
|
1719
|
-
"project_note"
|
|
1846
|
+
"project_note",
|
|
1847
|
+
"launch_defaults",
|
|
1848
|
+
"launch_defaults_set",
|
|
1849
|
+
"driver_list",
|
|
1850
|
+
"driver_describe",
|
|
1851
|
+
"artifact_list",
|
|
1852
|
+
"artifact_read",
|
|
1853
|
+
"decision_answer",
|
|
1854
|
+
"decision_request",
|
|
1855
|
+
"session_control",
|
|
1856
|
+
"file_transfer"
|
|
1720
1857
|
];
|
|
1721
1858
|
var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
|
|
1722
1859
|
function isAssistantTool(value) {
|
|
@@ -1724,6 +1861,8 @@ function isAssistantTool(value) {
|
|
|
1724
1861
|
}
|
|
1725
1862
|
var ASSISTANT_VERB = {
|
|
1726
1863
|
// tool verbs
|
|
1864
|
+
driverList: "driver_list",
|
|
1865
|
+
driverDescribe: "driver_describe",
|
|
1727
1866
|
projects: "assistant_projects",
|
|
1728
1867
|
environment: "assistant_environment",
|
|
1729
1868
|
action: "assistant_action",
|
|
@@ -1734,20 +1873,46 @@ var ASSISTANT_VERB = {
|
|
|
1734
1873
|
projectSend: "assistant_project_send",
|
|
1735
1874
|
projectRead: "assistant_project_read",
|
|
1736
1875
|
projectAdd: "assistant_project_add",
|
|
1876
|
+
projectAttachRemote: "assistant_project_attach_remote",
|
|
1737
1877
|
discoverRepos: "assistant_discover_repos",
|
|
1738
1878
|
memory: "assistant_memory",
|
|
1879
|
+
/** Pull-only FTS search over the archive tier (memory design 2026-11-01 §3.4). */
|
|
1880
|
+
memorySearch: "assistant_memory_search",
|
|
1739
1881
|
skillView: "assistant_skill_view",
|
|
1740
1882
|
skillManage: "assistant_skill_manage",
|
|
1741
1883
|
projectNote: "assistant_project_note",
|
|
1884
|
+
launchDefaults: "assistant_launch_defaults",
|
|
1885
|
+
launchDefaultsSet: "assistant_launch_defaults_set",
|
|
1886
|
+
artifactList: "assistant_artifact_list",
|
|
1887
|
+
artifactRead: "assistant_artifact_read",
|
|
1888
|
+
/** Owner-decision inbox (structured-missions design 2026-10-28 §6.3): the owner's words recorded as answers. */
|
|
1889
|
+
decisionAnswer: "assistant_decision_answer",
|
|
1890
|
+
/** Register a plain-text question a coordinator put to the owner as a decision item (§5.2). */
|
|
1891
|
+
decisionRequest: "assistant_decision_request",
|
|
1892
|
+
/** Stop / restart / switch the provider of a coordinator, worker or the assistant session (handoff design 2026-11-01 §4). */
|
|
1893
|
+
sessionControl: "assistant_session_control",
|
|
1894
|
+
/** Request / status / cancel the assistant's own project file transfers (owner approves in the dashboard; file-transfer design section 6). */
|
|
1895
|
+
fileTransfer: "assistant_file_transfer",
|
|
1742
1896
|
// assistant-side daemon verbs without a tool of the same name
|
|
1743
1897
|
launch: "launch_assistant",
|
|
1744
1898
|
pendingRelays: "assistant_pending_relays",
|
|
1745
1899
|
// owner verbs (dashboard only)
|
|
1746
1900
|
stagedResolve: "assistant_staged_resolve",
|
|
1747
1901
|
storeAdmin: "assistant_store_admin",
|
|
1748
|
-
importSkills: "assistant_import_skills"
|
|
1902
|
+
importSkills: "assistant_import_skills",
|
|
1903
|
+
/** Owner skill list (attach/view counts, save proposals, recent skill metrics); reads move no counter. */
|
|
1904
|
+
skillsList: "assistant_skills_list",
|
|
1905
|
+
/** Owner: what the assistant remembered recently, with undo handles (memory design §3.2). */
|
|
1906
|
+
memoryDigest: "assistant_memory_digest",
|
|
1907
|
+
/** Owner: reverse one remembered write or one batch (memory design §3.2). Never an assistant tool. */
|
|
1908
|
+
memoryUndo: "assistant_memory_undo",
|
|
1909
|
+
/** Projects the assistant is following (open relay threads) — list / stop following. */
|
|
1910
|
+
threads: "assistant_threads",
|
|
1911
|
+
threadClose: "assistant_thread_close"
|
|
1749
1912
|
};
|
|
1750
1913
|
var ASSISTANT_TOOL_VERBS = {
|
|
1914
|
+
driver_list: ASSISTANT_VERB.driverList,
|
|
1915
|
+
driver_describe: ASSISTANT_VERB.driverDescribe,
|
|
1751
1916
|
projects: ASSISTANT_VERB.projects,
|
|
1752
1917
|
environment: ASSISTANT_VERB.environment,
|
|
1753
1918
|
assistant_action: ASSISTANT_VERB.action,
|
|
@@ -1756,27 +1921,110 @@ var ASSISTANT_TOOL_VERBS = {
|
|
|
1756
1921
|
project_send: ASSISTANT_VERB.projectSend,
|
|
1757
1922
|
project_read: ASSISTANT_VERB.projectRead,
|
|
1758
1923
|
project_add: ASSISTANT_VERB.projectAdd,
|
|
1924
|
+
project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
|
|
1759
1925
|
discover_repos: ASSISTANT_VERB.discoverRepos,
|
|
1760
1926
|
memory: ASSISTANT_VERB.memory,
|
|
1927
|
+
memory_search: ASSISTANT_VERB.memorySearch,
|
|
1761
1928
|
skill_view: ASSISTANT_VERB.skillView,
|
|
1762
1929
|
skill_manage: ASSISTANT_VERB.skillManage,
|
|
1763
|
-
project_note: ASSISTANT_VERB.projectNote
|
|
1930
|
+
project_note: ASSISTANT_VERB.projectNote,
|
|
1931
|
+
launch_defaults: ASSISTANT_VERB.launchDefaults,
|
|
1932
|
+
launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet,
|
|
1933
|
+
artifact_list: ASSISTANT_VERB.artifactList,
|
|
1934
|
+
artifact_read: ASSISTANT_VERB.artifactRead,
|
|
1935
|
+
decision_answer: ASSISTANT_VERB.decisionAnswer,
|
|
1936
|
+
decision_request: ASSISTANT_VERB.decisionRequest,
|
|
1937
|
+
session_control: ASSISTANT_VERB.sessionControl,
|
|
1938
|
+
file_transfer: ASSISTANT_VERB.fileTransfer
|
|
1764
1939
|
};
|
|
1765
|
-
var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add"];
|
|
1940
|
+
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"];
|
|
1766
1941
|
var ASSISTANT_OWNER_VERBS = [
|
|
1767
1942
|
ASSISTANT_VERB.executionSettings,
|
|
1768
1943
|
ASSISTANT_VERB.stagedResolve,
|
|
1769
1944
|
ASSISTANT_VERB.storeAdmin,
|
|
1770
|
-
ASSISTANT_VERB.importSkills
|
|
1945
|
+
ASSISTANT_VERB.importSkills,
|
|
1946
|
+
ASSISTANT_VERB.skillsList,
|
|
1947
|
+
ASSISTANT_VERB.memoryDigest,
|
|
1948
|
+
ASSISTANT_VERB.memoryUndo,
|
|
1949
|
+
ASSISTANT_VERB.threadClose
|
|
1771
1950
|
];
|
|
1772
1951
|
var ASSISTANT_REVIEW_TURN_VERBS = [
|
|
1773
1952
|
ASSISTANT_VERB.memory,
|
|
1953
|
+
ASSISTANT_VERB.memorySearch,
|
|
1774
1954
|
ASSISTANT_VERB.skillView,
|
|
1775
1955
|
ASSISTANT_VERB.skillManage,
|
|
1776
1956
|
ASSISTANT_VERB.projectNote
|
|
1777
1957
|
];
|
|
1778
1958
|
var ASSISTANT_SESSION_ID_ENV = "ADHDEV_ASSISTANT_SESSION_ID";
|
|
1779
1959
|
var ASSISTANT_SESSION_ID_ARG = "assistantSessionId";
|
|
1960
|
+
var ASSISTANT_ACCOUNT_SLOT = "personal";
|
|
1961
|
+
var ASSISTANT_REMOTE_PROJECT_COMMAND = "assistant_remote_project";
|
|
1962
|
+
var ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND = "assistant_remote_project_catalog";
|
|
1963
|
+
var ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND = "assistant_remote_project_access";
|
|
1964
|
+
var ASSISTANT_REMOTE_FOLLOW_COMMAND = "assistant_remote_follow";
|
|
1965
|
+
var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send", "artifact_list", "artifact_read", "decision_list", "decision_answer", "decision_request"];
|
|
1966
|
+
var ASSISTANT_FOLLOWER_ALLOWED_OP_SET = new Set(ASSISTANT_FOLLOWER_ALLOWED_OPS);
|
|
1967
|
+
function isAssistantFollowerAllowedOp(value) {
|
|
1968
|
+
return typeof value === "string" && ASSISTANT_FOLLOWER_ALLOWED_OP_SET.has(value);
|
|
1969
|
+
}
|
|
1970
|
+
var DECISION_OP_IMPLIED_BY = {
|
|
1971
|
+
decision_list: "status",
|
|
1972
|
+
decision_answer: "send",
|
|
1973
|
+
decision_request: "send"
|
|
1974
|
+
};
|
|
1975
|
+
function followerOpPermitted(op, allowedOps) {
|
|
1976
|
+
if (!isAssistantFollowerAllowedOp(op)) return false;
|
|
1977
|
+
if (allowedOps.includes(op)) return true;
|
|
1978
|
+
const implied = DECISION_OP_IMPLIED_BY[op];
|
|
1979
|
+
return implied !== void 0 && allowedOps.includes(implied);
|
|
1980
|
+
}
|
|
1981
|
+
function followedRemoteProjectKey(hostDaemonId, meshId) {
|
|
1982
|
+
const canonHost = canonicalDaemonId(hostDaemonId) ?? hostDaemonId.trim();
|
|
1983
|
+
return `${canonHost}::${meshId.trim()}`;
|
|
1984
|
+
}
|
|
1985
|
+
function sanitizeRemoteRepoIdentity(raw) {
|
|
1986
|
+
if (typeof raw !== "string") return null;
|
|
1987
|
+
const trimmed = raw.trim();
|
|
1988
|
+
if (!trimmed) return null;
|
|
1989
|
+
if (trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("~/") || trimmed.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(trimmed) || /^file:/i.test(trimmed)) {
|
|
1990
|
+
return null;
|
|
1991
|
+
}
|
|
1992
|
+
const withoutQuery = trimmed.replace(/[?#].*$/, "").replace(/\/+$/, "");
|
|
1993
|
+
if (!withoutQuery) return null;
|
|
1994
|
+
let host = "";
|
|
1995
|
+
let repoPath = "";
|
|
1996
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(withoutQuery)) {
|
|
1997
|
+
try {
|
|
1998
|
+
const url = new URL(withoutQuery);
|
|
1999
|
+
if (url.protocol === "file:") return null;
|
|
2000
|
+
host = url.hostname.toLowerCase();
|
|
2001
|
+
repoPath = decodeURIComponent(url.pathname).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
2002
|
+
} catch {
|
|
2003
|
+
return null;
|
|
2004
|
+
}
|
|
2005
|
+
} else {
|
|
2006
|
+
const scpMatch = withoutQuery.match(/^(?:[^@/:]+@)?(\[[^\]]+\]|[^/:]+):(.+)$/);
|
|
2007
|
+
if (scpMatch) {
|
|
2008
|
+
host = scpMatch[1].replace(/^\[|\]$/g, "").toLowerCase();
|
|
2009
|
+
repoPath = scpMatch[2].replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
2010
|
+
} else {
|
|
2011
|
+
const slash = withoutQuery.indexOf("/");
|
|
2012
|
+
if (slash > 0) {
|
|
2013
|
+
const rawHost = withoutQuery.slice(0, slash);
|
|
2014
|
+
const atIdx = rawHost.lastIndexOf("@");
|
|
2015
|
+
host = (atIdx >= 0 ? rawHost.slice(atIdx + 1) : rawHost).toLowerCase();
|
|
2016
|
+
repoPath = withoutQuery.slice(slash + 1).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
if (!host || !repoPath) return null;
|
|
2021
|
+
if (!host.includes(".") && host !== "localhost") return null;
|
|
2022
|
+
if (/[\s@:\\]/.test(host)) return null;
|
|
2023
|
+
const segments = repoPath.split("/").filter(Boolean);
|
|
2024
|
+
if (segments.length === 0) return null;
|
|
2025
|
+
if (segments.some((seg) => seg === "." || seg === ".." || /[\s@:\\]/.test(seg))) return null;
|
|
2026
|
+
return `${host}/${segments.join("/")}`.slice(0, 200);
|
|
2027
|
+
}
|
|
1780
2028
|
|
|
1781
2029
|
// src/turn-evidence.ts
|
|
1782
2030
|
var MESH_TOPIC_PROTOCOL_VERSION = 2;
|
|
@@ -1812,13 +2060,24 @@ var TURN_SCOPES = ["mesh_queue", "mesh_direct", "plain"];
|
|
|
1812
2060
|
var RECLAIMING_SEND_REFUSALS = ["session_exited", "no_target", "unsupported_input"];
|
|
1813
2061
|
var DELIVERY_OUTCOMES = ["delivered", "queued"];
|
|
1814
2062
|
var DELIVERY_VIAS = ["local", "p2p"];
|
|
1815
|
-
var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout"];
|
|
2063
|
+
var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout", "submit_unconfirmed"];
|
|
1816
2064
|
function sanitizeRefusalCode(value) {
|
|
1817
2065
|
if (typeof value !== "string") return void 0;
|
|
1818
2066
|
const normalized = value.trim().toLowerCase().replace(/[^a-z_]/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
|
|
1819
2067
|
if (!normalized) return void 0;
|
|
1820
2068
|
return normalized.slice(0, 64);
|
|
1821
2069
|
}
|
|
2070
|
+
var DISPATCH_REFUSAL_DETAIL_MAX = 200;
|
|
2071
|
+
function sanitizeDispatchRefusalDetail(code, message) {
|
|
2072
|
+
const cleanCode = sanitizeRefusalCode(code);
|
|
2073
|
+
let cleanMessage;
|
|
2074
|
+
if (typeof message === "string") {
|
|
2075
|
+
const line = message.replace(/(?:[A-Za-z]:)?[\\/](?:Users|home)[\\/][^\s\\/]+/g, "~").replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
|
|
2076
|
+
if (line) cleanMessage = line.length > DISPATCH_REFUSAL_DETAIL_MAX ? `${line.slice(0, DISPATCH_REFUSAL_DETAIL_MAX - 1)}\u2026` : line;
|
|
2077
|
+
}
|
|
2078
|
+
if (!cleanCode && !cleanMessage) return void 0;
|
|
2079
|
+
return { ...cleanCode ? { code: cleanCode } : {}, ...cleanMessage ? { message: cleanMessage } : {} };
|
|
2080
|
+
}
|
|
1822
2081
|
var CONSUME_PROFILES = ["default", "native_source"];
|
|
1823
2082
|
var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
|
|
1824
2083
|
var SUSPENSION_MODALS = ["approval", "choice"];
|
|
@@ -1860,9 +2119,13 @@ var HOLD_REASONS = [
|
|
|
1860
2119
|
// — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
|
|
1861
2120
|
// a session whose FSM never shows the idle edge again does not wait for
|
|
1862
2121
|
// liveness / hard_ceiling.
|
|
1863
|
-
"await_end"
|
|
2122
|
+
"await_end",
|
|
2123
|
+
"report_correction",
|
|
2124
|
+
// A generating mesh attempt with no output/activity for `stallReclaimMs`: expiry reclaims it
|
|
2125
|
+
// (`stalled_no_output`) instead of waiting for the hard ceiling. Re-armed by every output.
|
|
2126
|
+
"stall_ceiling"
|
|
1864
2127
|
];
|
|
1865
|
-
var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
|
|
2128
|
+
var TURN_OUTCOMES = ["completed", "blocked", "failed", "cancelled"];
|
|
1866
2129
|
var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
|
|
1867
2130
|
var TURN_REASONS = [
|
|
1868
2131
|
// commits
|
|
@@ -1871,6 +2134,10 @@ var TURN_REASONS = [
|
|
|
1871
2134
|
"transcript_final",
|
|
1872
2135
|
"worker_reported",
|
|
1873
2136
|
"finalization_timeout_no_response",
|
|
2137
|
+
"weak_end_liveness_unconfirmed",
|
|
2138
|
+
"weak_end_probe_unobserved",
|
|
2139
|
+
"report_correction_expired",
|
|
2140
|
+
"report_missing_timeout",
|
|
1874
2141
|
"session_error",
|
|
1875
2142
|
"provider_auth_failed",
|
|
1876
2143
|
"provider_billing_failed",
|
|
@@ -1889,6 +2156,8 @@ var TURN_REASONS = [
|
|
|
1889
2156
|
"reclaim_budget_exhausted",
|
|
1890
2157
|
"hollow_max_retries",
|
|
1891
2158
|
"migration_orphan",
|
|
2159
|
+
// a stopping attempt whose writer node stayed unreachable (or was removed) past the bound
|
|
2160
|
+
"writer_unreachable",
|
|
1892
2161
|
// reclaims (generation + 1)
|
|
1893
2162
|
"dispatch_refused_session_exited",
|
|
1894
2163
|
"dispatch_refused_no_target",
|
|
@@ -1900,10 +2169,13 @@ var TURN_REASONS = [
|
|
|
1900
2169
|
"hollow_completion",
|
|
1901
2170
|
"assigned_stranded_dispatch_unconfirmed",
|
|
1902
2171
|
"delivered_not_consumed_redrive",
|
|
1903
|
-
"delivered_no_turn_deadline"
|
|
2172
|
+
"delivered_no_turn_deadline",
|
|
2173
|
+
// a generating worker produced no output/activity for the stall reclaim bound
|
|
2174
|
+
"stalled_no_output"
|
|
1904
2175
|
];
|
|
1905
2176
|
var NOTIFY_KINDS = [
|
|
1906
2177
|
"completed",
|
|
2178
|
+
"blocked",
|
|
1907
2179
|
"failed",
|
|
1908
2180
|
"cancelled",
|
|
1909
2181
|
"stopped",
|
|
@@ -1978,7 +2250,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1978
2250
|
},
|
|
1979
2251
|
transcript_activity: { newestActivityAt: ms },
|
|
1980
2252
|
no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
|
|
1981
|
-
liveness: { result: en(LIVENESS_RESULTS) },
|
|
2253
|
+
liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
|
|
1982
2254
|
process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
|
|
1983
2255
|
session_error: { reason: en(SESSION_ERROR_REASONS) },
|
|
1984
2256
|
worker_report: {
|
|
@@ -1988,6 +2260,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1988
2260
|
branchState: enOpt(WORKER_BRANCH_STATES),
|
|
1989
2261
|
touchedFileCount: intOpt
|
|
1990
2262
|
},
|
|
2263
|
+
worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
|
|
1991
2264
|
worker_progress: { note: { t: "summary_ref", optional: true } },
|
|
1992
2265
|
git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
|
|
1993
2266
|
cancel: { reason: en(CANCEL_REASONS) },
|
|
@@ -2158,17 +2431,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
|
|
|
2158
2431
|
};
|
|
2159
2432
|
}
|
|
2160
2433
|
|
|
2434
|
+
// src/launch-defaults.ts
|
|
2435
|
+
var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
|
|
2436
|
+
var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
|
|
2437
|
+
var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
2438
|
+
function isLaunchDefaultRole(value) {
|
|
2439
|
+
return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
|
|
2440
|
+
}
|
|
2441
|
+
function isLaunchDefaultSource(value) {
|
|
2442
|
+
return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
|
|
2443
|
+
}
|
|
2444
|
+
var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
2445
|
+
"invalid_args",
|
|
2446
|
+
"launch_default_required",
|
|
2447
|
+
"launch_default_unavailable",
|
|
2448
|
+
"launch_selection_invalid",
|
|
2449
|
+
"launch_default_invalid",
|
|
2450
|
+
"revision_conflict",
|
|
2451
|
+
"store_unavailable",
|
|
2452
|
+
"store_busy",
|
|
2453
|
+
"persistence_failed",
|
|
2454
|
+
"project_not_found",
|
|
2455
|
+
"project_ambiguous",
|
|
2456
|
+
"project_not_hosted",
|
|
2457
|
+
"project_storage_unavailable",
|
|
2458
|
+
"staging_unavailable",
|
|
2459
|
+
"staging_failed",
|
|
2460
|
+
"review_turn_tool_denied"
|
|
2461
|
+
];
|
|
2462
|
+
|
|
2463
|
+
// src/role-launch.ts
|
|
2464
|
+
function record(value) {
|
|
2465
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
2466
|
+
}
|
|
2467
|
+
function ref(value) {
|
|
2468
|
+
const r = record(value);
|
|
2469
|
+
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;
|
|
2470
|
+
return {
|
|
2471
|
+
role: r.role,
|
|
2472
|
+
scope: r.scope,
|
|
2473
|
+
revision: r.revision,
|
|
2474
|
+
...r.scope === "project" ? { projectId: r.projectId } : {}
|
|
2475
|
+
};
|
|
2476
|
+
}
|
|
2477
|
+
function axis(value) {
|
|
2478
|
+
const a = record(value);
|
|
2479
|
+
if (!a || !isLaunchDefaultSource(a.source) || a.value !== null && typeof a.value !== "string") return void 0;
|
|
2480
|
+
const defaultRef = ref(a.defaultRef);
|
|
2481
|
+
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;
|
|
2482
|
+
return { value: a.value, source: a.source, ...defaultRef ? { defaultRef } : {} };
|
|
2483
|
+
}
|
|
2484
|
+
function parseRoleLaunchSelection(value) {
|
|
2485
|
+
const r = record(value), s = record(r?.selection), a = record(r?.applied);
|
|
2486
|
+
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;
|
|
2487
|
+
const provider = axis(a?.provider), model = axis(a?.model), thinkingLevel = axis(a?.thinkingLevel);
|
|
2488
|
+
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;
|
|
2489
|
+
const defaultRef = ref(r.defaultRef);
|
|
2490
|
+
return {
|
|
2491
|
+
role: r.role,
|
|
2492
|
+
selection: {
|
|
2493
|
+
provider: s.provider,
|
|
2494
|
+
...typeof s.model === "string" ? { model: s.model } : {},
|
|
2495
|
+
...typeof s.thinkingLevel === "string" ? { thinkingLevel: s.thinkingLevel } : {}
|
|
2496
|
+
},
|
|
2497
|
+
applied: { provider, model, thinkingLevel },
|
|
2498
|
+
...defaultRef ? { defaultRef } : {},
|
|
2499
|
+
documentRevision: r.documentRevision
|
|
2500
|
+
};
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2161
2503
|
// src/session-launch.ts
|
|
2162
2504
|
var MODEL_AXIS_SOURCES = [
|
|
2163
2505
|
/** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
|
|
2164
2506
|
"user",
|
|
2165
2507
|
/** The dashboard dialog restored it from the last launch (browser-local memory). */
|
|
2166
2508
|
"remembered",
|
|
2509
|
+
/** The authoritative daemon role default or host project override. */
|
|
2510
|
+
"stored_default",
|
|
2511
|
+
"project_default",
|
|
2167
2512
|
/** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
|
|
2168
2513
|
"mesh_slot",
|
|
2169
2514
|
/** An explicit per-task model / thinking level on a mesh queue task. */
|
|
2170
2515
|
"task_override",
|
|
2171
|
-
/** Nothing
|
|
2516
|
+
/** Nothing requested: the provider chooses; resolvedDefault records it when known. */
|
|
2172
2517
|
"provider_default",
|
|
2173
2518
|
/** A value was requested without saying where it came from, or nothing is known. */
|
|
2174
2519
|
"unspecified"
|
|
@@ -2212,10 +2557,10 @@ function readFiniteNumber(value) {
|
|
|
2212
2557
|
}
|
|
2213
2558
|
function parseModelSelection(raw) {
|
|
2214
2559
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2215
|
-
const
|
|
2560
|
+
const record2 = raw;
|
|
2216
2561
|
const history = [];
|
|
2217
|
-
if (Array.isArray(
|
|
2218
|
-
for (const entry of
|
|
2562
|
+
if (Array.isArray(record2.history)) {
|
|
2563
|
+
for (const entry of record2.history) {
|
|
2219
2564
|
if (!entry || typeof entry !== "object") continue;
|
|
2220
2565
|
const e = entry;
|
|
2221
2566
|
const value = readString(e.value);
|
|
@@ -2224,41 +2569,45 @@ function parseModelSelection(raw) {
|
|
|
2224
2569
|
if (value && at !== void 0 && via) history.push({ at, value, via });
|
|
2225
2570
|
}
|
|
2226
2571
|
}
|
|
2227
|
-
const requested = readString(
|
|
2228
|
-
const launchValue = readString(
|
|
2229
|
-
const resolvedDefault = readString(
|
|
2230
|
-
const current = readString(
|
|
2231
|
-
const observed = readString(
|
|
2232
|
-
const observedAt = readFiniteNumber(
|
|
2572
|
+
const requested = readString(record2.requested);
|
|
2573
|
+
const launchValue = readString(record2.launchValue);
|
|
2574
|
+
const resolvedDefault = readString(record2.resolvedDefault);
|
|
2575
|
+
const current = readString(record2.current);
|
|
2576
|
+
const observed = readString(record2.observed);
|
|
2577
|
+
const observedAt = readFiniteNumber(record2.observedAt);
|
|
2578
|
+
const fallback = record2.fallback === true;
|
|
2233
2579
|
return {
|
|
2234
|
-
source: isModelAxisSource(
|
|
2580
|
+
source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
|
|
2235
2581
|
...requested ? { requested } : {},
|
|
2236
2582
|
...launchValue ? { launchValue } : {},
|
|
2237
2583
|
...resolvedDefault ? { resolvedDefault } : {},
|
|
2238
2584
|
...current ? { current } : {},
|
|
2239
2585
|
...observed ? { observed } : {},
|
|
2240
2586
|
...observedAt !== void 0 ? { observedAt } : {},
|
|
2587
|
+
...fallback ? { fallback } : {},
|
|
2241
2588
|
history: history.slice(-MODEL_SELECTION_HISTORY_LIMIT)
|
|
2242
2589
|
};
|
|
2243
2590
|
}
|
|
2244
2591
|
function parseSessionLaunchRecord(raw) {
|
|
2245
2592
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2246
|
-
const
|
|
2247
|
-
const sessionId = readString(
|
|
2248
|
-
const providerType = readString(
|
|
2249
|
-
const launchedAt = readFiniteNumber(
|
|
2250
|
-
const model = parseModelSelection(
|
|
2251
|
-
const thinkingLevel = parseModelSelection(
|
|
2593
|
+
const record2 = raw;
|
|
2594
|
+
const sessionId = readString(record2.sessionId);
|
|
2595
|
+
const providerType = readString(record2.providerType);
|
|
2596
|
+
const launchedAt = readFiniteNumber(record2.launchedAt);
|
|
2597
|
+
const model = parseModelSelection(record2.model);
|
|
2598
|
+
const thinkingLevel = parseModelSelection(record2.thinkingLevel);
|
|
2252
2599
|
if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
|
|
2253
|
-
const providerVersion = readString(
|
|
2254
|
-
const workspace = readString(
|
|
2255
|
-
const autoApproveModeId = readString(
|
|
2600
|
+
const providerVersion = readString(record2.providerVersion);
|
|
2601
|
+
const workspace = readString(record2.workspace);
|
|
2602
|
+
const autoApproveModeId = readString(record2.autoApproveModeId);
|
|
2603
|
+
const roleLaunch = parseRoleLaunchSelection(record2.roleLaunch);
|
|
2256
2604
|
return {
|
|
2605
|
+
...roleLaunch ? { roleLaunch } : {},
|
|
2257
2606
|
sessionId,
|
|
2258
2607
|
providerType,
|
|
2259
2608
|
...providerVersion ? { providerVersion } : {},
|
|
2260
|
-
...
|
|
2261
|
-
launchedBy: isSessionLaunchedBy(
|
|
2609
|
+
...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
|
|
2610
|
+
launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
|
|
2262
2611
|
launchedAt,
|
|
2263
2612
|
...workspace ? { workspace } : {},
|
|
2264
2613
|
model,
|
|
@@ -2322,7 +2671,7 @@ function isTurnAttemptRefValue(value) {
|
|
|
2322
2671
|
function isTurnObserveResponse(value) {
|
|
2323
2672
|
return isRecord(value) && hasOnlyKeys2(value, ["verdict", "attemptRef", "outcome"]) && isTurnObserveVerdict(value.verdict) && isTurnAttemptRefValue(value.attemptRef) && (value.outcome === void 0 || isTurnOutcomeValue(value.outcome));
|
|
2324
2673
|
}
|
|
2325
|
-
var TURN_OUTCOMES_LOCAL = ["completed", "failed", "cancelled"];
|
|
2674
|
+
var TURN_OUTCOMES_LOCAL = ["completed", "blocked", "failed", "cancelled"];
|
|
2326
2675
|
function isTurnOutcomeValue(value) {
|
|
2327
2676
|
return typeof value === "string" && TURN_OUTCOMES_LOCAL.includes(value);
|
|
2328
2677
|
}
|
|
@@ -2548,8 +2897,23 @@ function isMissionBriefWire(value) {
|
|
|
2548
2897
|
}
|
|
2549
2898
|
return true;
|
|
2550
2899
|
}
|
|
2900
|
+
var STRUCTURED_MISSION_KEYS = ["summary", "releaseNote", "outcome", "outcomeReason", "version", "carryOver", "openItems"];
|
|
2901
|
+
function isOpenItemCountsWire(value) {
|
|
2902
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["remaining", "live_check", "decision", "evidence"])) return false;
|
|
2903
|
+
return ["remaining", "live_check", "decision", "evidence"].every((k) => isNonNegativeInt(value[k]));
|
|
2904
|
+
}
|
|
2905
|
+
function isStructuredMissionFields(value) {
|
|
2906
|
+
for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
|
|
2907
|
+
if (value[k] !== void 0 && typeof value[k] !== "string") return false;
|
|
2908
|
+
}
|
|
2909
|
+
if (value.version !== void 0 && !isNonNegativeInt(value.version)) return false;
|
|
2910
|
+
if (value.carryOver !== void 0 && typeof value.carryOver !== "boolean") return false;
|
|
2911
|
+
if (value.openItems !== void 0 && !isOpenItemCountsWire(value.openItems)) return false;
|
|
2912
|
+
return true;
|
|
2913
|
+
}
|
|
2551
2914
|
function isMeshMissionRecordWire(value) {
|
|
2552
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief"])) return false;
|
|
2915
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief", ...STRUCTURED_MISSION_KEYS])) return false;
|
|
2916
|
+
if (!isStructuredMissionFields(value)) return false;
|
|
2553
2917
|
if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
|
|
2554
2918
|
if (typeof value.title !== "string" || typeof value.goal !== "string") return false;
|
|
2555
2919
|
if (!isMeshMissionStatusValue(value.status)) return false;
|
|
@@ -2557,11 +2921,22 @@ function isMeshMissionRecordWire(value) {
|
|
|
2557
2921
|
return true;
|
|
2558
2922
|
}
|
|
2559
2923
|
function isMissionUpsertRequest(value) {
|
|
2560
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief"])) return false;
|
|
2924
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief", "structured", "summary", "releaseNote", "outcome", "outcomeReason", "carryOverTo", "toCarryOver", "itemsAdd", "itemsUpdate"])) return false;
|
|
2561
2925
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
|
|
2562
2926
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
2563
2927
|
if (value.id !== void 0 && !isEvidenceIdentifier(value.id)) return false;
|
|
2564
|
-
if (typeof value.title !== "string"
|
|
2928
|
+
if (typeof value.title !== "string") return false;
|
|
2929
|
+
if (value.title.trim().length === 0 && value.toCarryOver !== true && value.id === void 0) return false;
|
|
2930
|
+
if (value.structured !== void 0 && typeof value.structured !== "boolean") return false;
|
|
2931
|
+
if (value.toCarryOver !== void 0 && typeof value.toCarryOver !== "boolean") return false;
|
|
2932
|
+
for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
|
|
2933
|
+
if (value[k] !== void 0 && typeof value[k] !== "string") return false;
|
|
2934
|
+
}
|
|
2935
|
+
if (value.carryOverTo !== void 0 && !isEvidenceIdentifier(value.carryOverTo)) return false;
|
|
2936
|
+
for (const k of ["itemsAdd", "itemsUpdate"]) {
|
|
2937
|
+
const list = value[k];
|
|
2938
|
+
if (list !== void 0 && (!Array.isArray(list) || list.length > 500 || !list.every(isRecord))) return false;
|
|
2939
|
+
}
|
|
2565
2940
|
if (value.goal !== void 0 && typeof value.goal !== "string") return false;
|
|
2566
2941
|
if (value.status !== void 0 && !isMeshMissionStatusValue(value.status)) return false;
|
|
2567
2942
|
if (value.brief !== void 0 && value.brief !== null && !isMissionBriefWire(value.brief)) return false;
|
|
@@ -2571,7 +2946,7 @@ function decodeMissionUpsertRequest(value) {
|
|
|
2571
2946
|
return isMissionUpsertRequest(value) ? value : null;
|
|
2572
2947
|
}
|
|
2573
2948
|
function isMissionUpsertResponse(value) {
|
|
2574
|
-
return isRecord(value) && hasOnlyKeys2(value, ["mission"]) && isMeshMissionRecordWire(value.mission);
|
|
2949
|
+
return isRecord(value) && hasOnlyKeys2(value, ["mission", "result"]) && isMeshMissionRecordWire(value.mission) && (value.result === void 0 || isRecord(value.result));
|
|
2575
2950
|
}
|
|
2576
2951
|
function decodeMissionUpsertResponse(value) {
|
|
2577
2952
|
return isMissionUpsertResponse(value) ? value : null;
|
|
@@ -2597,7 +2972,10 @@ function decodeMissionQueryResponse(value) {
|
|
|
2597
2972
|
return isMissionQueryResponse(value) ? value : null;
|
|
2598
2973
|
}
|
|
2599
2974
|
function isMissionListQueryRequest(value) {
|
|
2600
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView"])) return false;
|
|
2975
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView", "structured", "items", "history"])) return false;
|
|
2976
|
+
for (const k of ["structured", "items", "history"]) {
|
|
2977
|
+
if (value[k] !== void 0 && typeof value[k] !== "boolean") return false;
|
|
2978
|
+
}
|
|
2601
2979
|
if (value.meshStatusView !== void 0 && value.meshStatusView !== "compact" && value.meshStatusView !== "verbose") return false;
|
|
2602
2980
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
|
|
2603
2981
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
@@ -2623,12 +3001,13 @@ function isMeshMissionTaskAggregateWire(value) {
|
|
|
2623
3001
|
return value.lastActivityAt === null || typeof value.lastActivityAt === "string";
|
|
2624
3002
|
}
|
|
2625
3003
|
function isMeshMissionStatsWire(value) {
|
|
2626
|
-
const keys = ["missionId", "taskCount", "completed", "failed", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
|
|
3004
|
+
const keys = ["missionId", "taskCount", "completed", "failed", "blocked", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
|
|
2627
3005
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
2628
3006
|
if (!isEvidenceIdentifier(value.missionId)) return false;
|
|
2629
3007
|
for (const k of ["taskCount", "completed", "failed", "totalDurationMs", "retries"]) {
|
|
2630
3008
|
if (!isNonNegativeInt(value[k])) return false;
|
|
2631
3009
|
}
|
|
3010
|
+
if (value.blocked !== void 0 && !isNonNegativeInt(value.blocked)) return false;
|
|
2632
3011
|
if (value.wallClockMs !== null && !isNonNegativeInt(value.wallClockMs)) return false;
|
|
2633
3012
|
if (!Array.isArray(value.incompleteTaskIds) || !value.incompleteTaskIds.every(isEvidenceIdentifier)) return false;
|
|
2634
3013
|
return true;
|
|
@@ -2638,7 +3017,7 @@ function isMissionListSummaryWire(value) {
|
|
|
2638
3017
|
const hasGoal = "goal" in value;
|
|
2639
3018
|
const hasPreview = "goalPreview" in value && "goalTruncated" in value;
|
|
2640
3019
|
if (hasGoal === hasPreview) return false;
|
|
2641
|
-
const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt"];
|
|
3020
|
+
const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt", ...STRUCTURED_MISSION_KEYS, "items", "history"];
|
|
2642
3021
|
const allowed = hasGoal ? [...baseKeys, "goal"] : [...baseKeys, "goalPreview", "goalTruncated"];
|
|
2643
3022
|
if (!hasOnlyKeys2(value, allowed)) return false;
|
|
2644
3023
|
if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
|
|
@@ -2652,6 +3031,10 @@ function isMissionListSummaryWire(value) {
|
|
|
2652
3031
|
if (value.createdAt !== void 0 && typeof value.createdAt !== "string") return false;
|
|
2653
3032
|
if (value.updatedAt !== void 0 && typeof value.updatedAt !== "string") return false;
|
|
2654
3033
|
if (value.closeCandidateEmittedAt !== void 0 && value.closeCandidateEmittedAt !== null && typeof value.closeCandidateEmittedAt !== "string") return false;
|
|
3034
|
+
if (!isStructuredMissionFields(value)) return false;
|
|
3035
|
+
for (const k of ["items", "history"]) {
|
|
3036
|
+
if (value[k] !== void 0 && (!Array.isArray(value[k]) || !value[k].every(isRecord))) return false;
|
|
3037
|
+
}
|
|
2655
3038
|
return true;
|
|
2656
3039
|
}
|
|
2657
3040
|
function isMeshMissionHistoryFoldWire(value) {
|
|
@@ -2750,12 +3133,15 @@ function isLedgerQueryEntryWire(value) {
|
|
|
2750
3133
|
return true;
|
|
2751
3134
|
}
|
|
2752
3135
|
function isLedgerQuerySummaryWire(value) {
|
|
2753
|
-
const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
|
|
3136
|
+
const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskBlocked", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures", "taskBlocked", "refineFailed", "recentRefineFailures"];
|
|
2754
3137
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
2755
3138
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
2756
3139
|
for (const k of ["totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "recentFailures"]) {
|
|
2757
3140
|
if (!isNonNegativeInt(value[k])) return false;
|
|
2758
3141
|
}
|
|
3142
|
+
if (value.taskBlocked !== void 0 && !isNonNegativeInt(value.taskBlocked)) return false;
|
|
3143
|
+
if (value.refineFailed !== void 0 && !isNonNegativeInt(value.refineFailed)) return false;
|
|
3144
|
+
if (value.recentRefineFailures !== void 0 && !isNonNegativeInt(value.recentRefineFailures)) return false;
|
|
2759
3145
|
if (value.lastActivityAt !== null && typeof value.lastActivityAt !== "string") return false;
|
|
2760
3146
|
return true;
|
|
2761
3147
|
}
|
|
@@ -2799,9 +3185,10 @@ function isQueueDependencyHeadWire(value) {
|
|
|
2799
3185
|
return isRecord(value) && hasOnlyKeys2(value, ["id", "status", "cancelReason"]) && typeof value.id === "string" && typeof value.status === "string" && (value.cancelReason === void 0 || typeof value.cancelReason === "string");
|
|
2800
3186
|
}
|
|
2801
3187
|
function isQueueQueryResponse(value) {
|
|
2802
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "dependencyHeads"])) return false;
|
|
3188
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "legacyReportedBlockedCount", "dependencyHeads"])) return false;
|
|
2803
3189
|
if (!Array.isArray(value.entries) || !value.entries.every(isQueueEntryWire)) return false;
|
|
2804
3190
|
if (value.counts !== void 0 && (!isRecord(value.counts) || !Object.values(value.counts).every(isNonNegativeInt))) return false;
|
|
3191
|
+
if (value.legacyReportedBlockedCount !== void 0 && !isNonNegativeInt(value.legacyReportedBlockedCount)) return false;
|
|
2805
3192
|
if (value.oldHistoricalCount !== void 0 && !isNonNegativeInt(value.oldHistoricalCount)) return false;
|
|
2806
3193
|
if (value.dependencyHeads !== void 0 && (!Array.isArray(value.dependencyHeads) || !value.dependencyHeads.every(isQueueDependencyHeadWire))) return false;
|
|
2807
3194
|
return true;
|
|
@@ -2859,7 +3246,7 @@ function decodeQueueRequeueRequest(value) {
|
|
|
2859
3246
|
return isQueueRequeueRequest(value) ? value : null;
|
|
2860
3247
|
}
|
|
2861
3248
|
function isQueueRequeueResponse(value) {
|
|
2862
|
-
return isRecord(value) && hasOnlyKeys2(value, ["task"]) && (value.task === null || isQueueEntryWire(value.task));
|
|
3249
|
+
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");
|
|
2863
3250
|
}
|
|
2864
3251
|
function decodeQueueRequeueResponse(value) {
|
|
2865
3252
|
return isQueueRequeueResponse(value) ? value : null;
|
|
@@ -2923,6 +3310,24 @@ function isRecoveryContextQueryResponse(value) {
|
|
|
2923
3310
|
function decodeRecoveryContextQueryResponse(value) {
|
|
2924
3311
|
return isRecoveryContextQueryResponse(value) ? value : null;
|
|
2925
3312
|
}
|
|
3313
|
+
function decodeQueueReviseRequest(value) {
|
|
3314
|
+
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;
|
|
3315
|
+
if (value.dryRun !== void 0 && typeof value.dryRun !== "boolean") return null;
|
|
3316
|
+
if (value.deferScheduling !== void 0 && typeof value.deferScheduling !== "boolean") return null;
|
|
3317
|
+
const p = value.patch;
|
|
3318
|
+
if (p.requestQuotaOverride && (value.dryRun !== void 0 || value.deferScheduling !== void 0)) return null;
|
|
3319
|
+
if (p.requestQuotaOverride !== void 0 && (p.requestQuotaOverride !== true || Object.keys(p).length !== 1)) return null;
|
|
3320
|
+
if (p.attestActiveOwnership && value.deferScheduling !== void 0) return null;
|
|
3321
|
+
if (p.attestActiveOwnership !== void 0 && (p.attestActiveOwnership !== true || Object.keys(p).length !== 1)) return null;
|
|
3322
|
+
if (p.message !== void 0 && (typeof p.message !== "string" || !p.message.trim())) return null;
|
|
3323
|
+
if (p.phase !== void 0 && p.phase !== "source" && p.phase !== "integration") return null;
|
|
3324
|
+
if (p.difficulty !== void 0 && p.difficulty !== "easy" && p.difficulty !== "medium" && p.difficulty !== "difficult" && p.difficulty !== "freeform") return null;
|
|
3325
|
+
for (const key of ["ownedPaths", "dependsOn"]) {
|
|
3326
|
+
if (p[key] !== void 0 && (!Array.isArray(p[key]) || !p[key].every((x) => typeof x === "string" && !!x.trim()))) return null;
|
|
3327
|
+
}
|
|
3328
|
+
return value;
|
|
3329
|
+
}
|
|
3330
|
+
var decodeQueueReviseResponse = decodeQueueRequeueResponse;
|
|
2926
3331
|
|
|
2927
3332
|
// src/turn-ipc-stats.ts
|
|
2928
3333
|
function isTaskStatsQueryRequest(value) {
|
|
@@ -3021,6 +3426,7 @@ var TURN_IPC_COMMANDS = [
|
|
|
3021
3426
|
"queue_enqueue_batch",
|
|
3022
3427
|
"queue_cancel",
|
|
3023
3428
|
"queue_requeue",
|
|
3429
|
+
"queue_revise",
|
|
3024
3430
|
"direct_dispatch_record",
|
|
3025
3431
|
"active_work_query",
|
|
3026
3432
|
"recovery_context_query",
|
|
@@ -3160,6 +3566,357 @@ function touchedFilesOutsideOwnership(touched, owned) {
|
|
|
3160
3566
|
return { undeclaredTouched, unusedDeclarations };
|
|
3161
3567
|
}
|
|
3162
3568
|
|
|
3569
|
+
// src/mission-items.ts
|
|
3570
|
+
var MISSION_ITEM_KINDS = ["remaining", "live_check", "decision", "evidence"];
|
|
3571
|
+
var MISSION_ITEM_STATES = ["open", "done", "failed", "dropped", "moved", "answered", "expired", "withdrawn", "superseded"];
|
|
3572
|
+
var COORDINATOR_SETTABLE_ITEM_STATES = {
|
|
3573
|
+
remaining: ["open", "done", "dropped"],
|
|
3574
|
+
live_check: ["open", "done", "dropped"],
|
|
3575
|
+
evidence: ["open", "done", "dropped"],
|
|
3576
|
+
decision: ["open", "withdrawn", "superseded"]
|
|
3577
|
+
};
|
|
3578
|
+
var MISSION_OUTCOMES = ["merged", "verified_live", "superseded", "not_needed", "owner_abandoned", "unspecified"];
|
|
3579
|
+
function isMissionOutcome(value) {
|
|
3580
|
+
return typeof value === "string" && MISSION_OUTCOMES.includes(value);
|
|
3581
|
+
}
|
|
3582
|
+
var MISSION_REF_KINDS = ["commit", "branch", "pr", "task", "artifact", "mission", "url"];
|
|
3583
|
+
var MISSION_LIMITS = {
|
|
3584
|
+
summary: 300,
|
|
3585
|
+
outcomeReason: 500,
|
|
3586
|
+
itemText: 300,
|
|
3587
|
+
machine: 80,
|
|
3588
|
+
refs: 8,
|
|
3589
|
+
refValue: 300,
|
|
3590
|
+
refRepo: 120,
|
|
3591
|
+
refNote: 200,
|
|
3592
|
+
dedupeKey: 400,
|
|
3593
|
+
question: 300,
|
|
3594
|
+
context: 600,
|
|
3595
|
+
options: 5,
|
|
3596
|
+
optionLabel: 60,
|
|
3597
|
+
optionDetail: 200,
|
|
3598
|
+
/** Open items per mission before the oldest `remaining` fold into a "N more" summary item. */
|
|
3599
|
+
openItemsPerMission: 200,
|
|
3600
|
+
/** One event payload (serialized). */
|
|
3601
|
+
eventPayloadBytes: 16 * 1024,
|
|
3602
|
+
/** items_add / items_update entries honoured per call (extra entries are reported, not applied). */
|
|
3603
|
+
itemsPerCall: 50
|
|
3604
|
+
};
|
|
3605
|
+
var MISSION_DECISION_OPTION_IDS = ["a", "b", "c", "d", "e"];
|
|
3606
|
+
var MISSION_DECISION_URGENCIES = ["normal", "blocking"];
|
|
3607
|
+
var MISSION_DECISION_ON_DUE = ["remind", "apply_recommended"];
|
|
3608
|
+
function truncateMissionText(value, max) {
|
|
3609
|
+
if (value.length <= max) return value;
|
|
3610
|
+
return `${value.slice(0, max - 1).trimEnd()}\u2026`;
|
|
3611
|
+
}
|
|
3612
|
+
function str(value) {
|
|
3613
|
+
return typeof value === "string" ? value.trim() : "";
|
|
3614
|
+
}
|
|
3615
|
+
function collapse(value) {
|
|
3616
|
+
return value.replace(/\s+/g, " ").trim();
|
|
3617
|
+
}
|
|
3618
|
+
function normalizeMissionSummary(value) {
|
|
3619
|
+
if (typeof value !== "string") return null;
|
|
3620
|
+
const text = collapse(value);
|
|
3621
|
+
return { value: truncateMissionText(text, MISSION_LIMITS.summary), truncated: text.length > MISSION_LIMITS.summary };
|
|
3622
|
+
}
|
|
3623
|
+
function normalizeOutcomeReason(value) {
|
|
3624
|
+
if (typeof value !== "string") return null;
|
|
3625
|
+
const text = value.trim();
|
|
3626
|
+
return { value: truncateMissionText(text, MISSION_LIMITS.outcomeReason), truncated: text.length > MISSION_LIMITS.outcomeReason };
|
|
3627
|
+
}
|
|
3628
|
+
function normalizeMissionRefs(value) {
|
|
3629
|
+
if (!Array.isArray(value)) return { refs: [], truncated: false };
|
|
3630
|
+
const refs = [];
|
|
3631
|
+
let truncated = false;
|
|
3632
|
+
for (const raw of value) {
|
|
3633
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
3634
|
+
const r = raw;
|
|
3635
|
+
const kind = str(r.kind);
|
|
3636
|
+
const refValue = str(r.value);
|
|
3637
|
+
if (!MISSION_REF_KINDS.includes(kind) || !refValue) continue;
|
|
3638
|
+
if (refs.length >= MISSION_LIMITS.refs) {
|
|
3639
|
+
truncated = true;
|
|
3640
|
+
break;
|
|
3641
|
+
}
|
|
3642
|
+
const repo = str(r.repo);
|
|
3643
|
+
const note = str(r.note);
|
|
3644
|
+
refs.push({
|
|
3645
|
+
kind,
|
|
3646
|
+
...repo ? { repo: truncateMissionText(repo, MISSION_LIMITS.refRepo) } : {},
|
|
3647
|
+
value: truncateMissionText(refValue, MISSION_LIMITS.refValue),
|
|
3648
|
+
...note ? { note: truncateMissionText(note, MISSION_LIMITS.refNote) } : {}
|
|
3649
|
+
});
|
|
3650
|
+
}
|
|
3651
|
+
return { refs, truncated };
|
|
3652
|
+
}
|
|
3653
|
+
function normalizeOptions(value, truncated) {
|
|
3654
|
+
if (!Array.isArray(value)) return [];
|
|
3655
|
+
const out = [];
|
|
3656
|
+
for (const raw of value) {
|
|
3657
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
3658
|
+
if (out.length >= MISSION_LIMITS.options) {
|
|
3659
|
+
truncated.push("options");
|
|
3660
|
+
break;
|
|
3661
|
+
}
|
|
3662
|
+
out.push({ id: MISSION_DECISION_OPTION_IDS[out.length], label: truncateMissionText(raw.trim(), MISSION_LIMITS.optionLabel) });
|
|
3663
|
+
continue;
|
|
3664
|
+
}
|
|
3665
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
3666
|
+
const o = raw;
|
|
3667
|
+
const label = collapse(str(o.label));
|
|
3668
|
+
if (!label) continue;
|
|
3669
|
+
if (out.length >= MISSION_LIMITS.options) {
|
|
3670
|
+
truncated.push("options");
|
|
3671
|
+
break;
|
|
3672
|
+
}
|
|
3673
|
+
const detail = str(o.detail);
|
|
3674
|
+
out.push({
|
|
3675
|
+
id: MISSION_DECISION_OPTION_IDS[out.length],
|
|
3676
|
+
label: truncateMissionText(label, MISSION_LIMITS.optionLabel),
|
|
3677
|
+
...detail ? { detail: truncateMissionText(detail, MISSION_LIMITS.optionDetail) } : {}
|
|
3678
|
+
});
|
|
3679
|
+
}
|
|
3680
|
+
return out;
|
|
3681
|
+
}
|
|
3682
|
+
function normalizeDueAt(value) {
|
|
3683
|
+
if (typeof value !== "string" || !value.trim()) return void 0;
|
|
3684
|
+
const ms2 = Date.parse(value);
|
|
3685
|
+
return Number.isNaN(ms2) ? void 0 : new Date(ms2).toISOString();
|
|
3686
|
+
}
|
|
3687
|
+
function normalizeDecisionInput(raw, truncated) {
|
|
3688
|
+
const questionSource = collapse(str(raw.question) || str(raw.text));
|
|
3689
|
+
if (!questionSource) return null;
|
|
3690
|
+
if (questionSource.length > MISSION_LIMITS.question) truncated.push("question");
|
|
3691
|
+
const question = truncateMissionText(questionSource, MISSION_LIMITS.question);
|
|
3692
|
+
const contextSource = str(raw.context);
|
|
3693
|
+
if (contextSource.length > MISSION_LIMITS.context) truncated.push("context");
|
|
3694
|
+
const options = normalizeOptions(raw.options, truncated);
|
|
3695
|
+
const recommendedRaw = str(raw.recommended);
|
|
3696
|
+
const recommended = recommendedRaw && options.some((o) => o.id === recommendedRaw) ? recommendedRaw : options.find((o) => recommendedRaw && o.label.toLowerCase() === recommendedRaw.toLowerCase())?.id;
|
|
3697
|
+
const dueAt = normalizeDueAt(raw.dueAt ?? raw.due_at);
|
|
3698
|
+
const onDueRaw = str(raw.onDue ?? raw.on_due);
|
|
3699
|
+
const urgencyRaw = str(raw.urgency);
|
|
3700
|
+
const allowFreeTextRaw = raw.allowFreeText ?? raw.allow_free_text;
|
|
3701
|
+
return {
|
|
3702
|
+
question,
|
|
3703
|
+
...contextSource ? { context: truncateMissionText(contextSource, MISSION_LIMITS.context) } : {},
|
|
3704
|
+
options,
|
|
3705
|
+
...recommended ? { recommended } : {},
|
|
3706
|
+
allowFreeText: typeof allowFreeTextRaw === "boolean" ? allowFreeTextRaw : true,
|
|
3707
|
+
...dueAt ? { dueAt } : {},
|
|
3708
|
+
// apply_recommended without a recommended option has nothing to apply — fall back to remind.
|
|
3709
|
+
onDue: onDueRaw === "apply_recommended" && recommended ? "apply_recommended" : "remind",
|
|
3710
|
+
urgency: urgencyRaw === "blocking" ? "blocking" : "normal"
|
|
3711
|
+
};
|
|
3712
|
+
}
|
|
3713
|
+
function normalizeForDedupe(text) {
|
|
3714
|
+
return collapse(text).toLowerCase().replace(/[\s.!?。]+$/u, "");
|
|
3715
|
+
}
|
|
3716
|
+
function deriveItemDedupeKey(kind, parts) {
|
|
3717
|
+
const explicit = str(parts.explicit);
|
|
3718
|
+
if (explicit) return truncateMissionText(`k:${explicit}`, MISSION_LIMITS.dedupeKey);
|
|
3719
|
+
if (kind === "decision") return truncateMissionText(`decision:${normalizeForDedupe(parts.question ?? parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
|
|
3720
|
+
if (kind === "evidence") {
|
|
3721
|
+
const ref2 = parts.refs?.[0];
|
|
3722
|
+
if (ref2) return truncateMissionText(`evidence:${ref2.kind}:${ref2.repo ?? ""}:${ref2.value}`, MISSION_LIMITS.dedupeKey);
|
|
3723
|
+
}
|
|
3724
|
+
const machine = parts.machine ? `@${normalizeForDedupe(parts.machine)}` : "";
|
|
3725
|
+
return truncateMissionText(`${kind}${machine}:${normalizeForDedupe(parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
|
|
3726
|
+
}
|
|
3727
|
+
function normalizeMissionItemInput(raw) {
|
|
3728
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "item must be an object" };
|
|
3729
|
+
const r = raw;
|
|
3730
|
+
const kind = str(r.kind) || "remaining";
|
|
3731
|
+
if (!MISSION_ITEM_KINDS.includes(kind)) {
|
|
3732
|
+
return { error: `invalid kind '${kind}' (valid: ${MISSION_ITEM_KINDS.join(", ")})` };
|
|
3733
|
+
}
|
|
3734
|
+
const truncated = [];
|
|
3735
|
+
const { refs, truncated: refsTruncated } = normalizeMissionRefs(r.refs);
|
|
3736
|
+
if (refsTruncated) truncated.push("refs");
|
|
3737
|
+
const machineRaw = collapse(str(r.machine));
|
|
3738
|
+
const machine = machineRaw ? truncateMissionText(machineRaw, MISSION_LIMITS.machine) : void 0;
|
|
3739
|
+
const explicitKey = str(r.dedupe_key ?? r.dedupeKey);
|
|
3740
|
+
if (kind === "decision") {
|
|
3741
|
+
const decisionRaw = r.decision && typeof r.decision === "object" && !Array.isArray(r.decision) ? r.decision : r;
|
|
3742
|
+
const decision = normalizeDecisionInput({ ...decisionRaw, question: decisionRaw.question ?? r.question ?? r.text }, truncated);
|
|
3743
|
+
if (!decision) return { error: "decision item needs a question" };
|
|
3744
|
+
return {
|
|
3745
|
+
item: {
|
|
3746
|
+
kind,
|
|
3747
|
+
text: decision.question,
|
|
3748
|
+
...machine ? { machine } : {},
|
|
3749
|
+
refs,
|
|
3750
|
+
decision,
|
|
3751
|
+
dedupeKey: deriveItemDedupeKey("decision", { question: decision.question, explicit: explicitKey }),
|
|
3752
|
+
truncated
|
|
3753
|
+
}
|
|
3754
|
+
};
|
|
3755
|
+
}
|
|
3756
|
+
const textSource = collapse(str(r.text));
|
|
3757
|
+
if (!textSource && !(kind === "evidence" && refs.length > 0)) return { error: `${kind} item needs text` };
|
|
3758
|
+
if (textSource.length > MISSION_LIMITS.itemText) truncated.push("text");
|
|
3759
|
+
const text = truncateMissionText(textSource || `${refs[0].kind}: ${refs[0].value}`, MISSION_LIMITS.itemText);
|
|
3760
|
+
return {
|
|
3761
|
+
item: {
|
|
3762
|
+
kind,
|
|
3763
|
+
text,
|
|
3764
|
+
...machine ? { machine } : {},
|
|
3765
|
+
refs,
|
|
3766
|
+
dedupeKey: deriveItemDedupeKey(kind, { text, machine, refs, explicit: explicitKey }),
|
|
3767
|
+
truncated
|
|
3768
|
+
}
|
|
3769
|
+
};
|
|
3770
|
+
}
|
|
3771
|
+
function normalizeMissionItemUpdate(raw) {
|
|
3772
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "update must be an object" };
|
|
3773
|
+
const r = raw;
|
|
3774
|
+
const id2 = str(r.id ?? r.item_id ?? r.itemId);
|
|
3775
|
+
if (!id2) return { error: "update needs an item id" };
|
|
3776
|
+
const truncated = [];
|
|
3777
|
+
const update = { id: id2 };
|
|
3778
|
+
if (r.state !== void 0) {
|
|
3779
|
+
const state = str(r.state);
|
|
3780
|
+
if (!MISSION_ITEM_STATES.includes(state)) return { error: `invalid state '${state}'` };
|
|
3781
|
+
update.state = state;
|
|
3782
|
+
}
|
|
3783
|
+
if (typeof r.text === "string") {
|
|
3784
|
+
const text = collapse(r.text);
|
|
3785
|
+
if (text.length > MISSION_LIMITS.itemText) truncated.push("text");
|
|
3786
|
+
if (text) update.text = truncateMissionText(text, MISSION_LIMITS.itemText);
|
|
3787
|
+
}
|
|
3788
|
+
if (r.machine === null) update.machine = null;
|
|
3789
|
+
else if (typeof r.machine === "string") {
|
|
3790
|
+
const machine = collapse(r.machine);
|
|
3791
|
+
update.machine = machine ? truncateMissionText(machine, MISSION_LIMITS.machine) : null;
|
|
3792
|
+
}
|
|
3793
|
+
if (r.refs !== void 0) {
|
|
3794
|
+
const { refs, truncated: t } = normalizeMissionRefs(r.refs);
|
|
3795
|
+
if (t) truncated.push("refs");
|
|
3796
|
+
update.refs = refs;
|
|
3797
|
+
}
|
|
3798
|
+
return { update, truncated };
|
|
3799
|
+
}
|
|
3800
|
+
function boundEventPayload(payload) {
|
|
3801
|
+
let json = JSON.stringify(payload);
|
|
3802
|
+
if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
|
|
3803
|
+
const shrunk = {};
|
|
3804
|
+
for (const [k, v] of Object.entries(payload)) {
|
|
3805
|
+
shrunk[k] = typeof v === "string" && v.length > 4e3 ? `${v.slice(0, 4e3)}\u2026` : v;
|
|
3806
|
+
}
|
|
3807
|
+
shrunk.payloadTruncated = true;
|
|
3808
|
+
json = JSON.stringify(shrunk);
|
|
3809
|
+
if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
|
|
3810
|
+
return JSON.stringify({ payloadTruncated: true, keys: Object.keys(payload).slice(0, 20) });
|
|
3811
|
+
}
|
|
3812
|
+
var CARRY_OVER_MISSION_TITLE = "Carry-over \u2014 open items from closed missions";
|
|
3813
|
+
var LEGACY_CARRY_OVER_MISSION_TITLE = "\uC774\uC6D4 \u2014 \uB2EB\uD78C \uBBF8\uC158\uC5D0\uC11C \uB118\uC5B4\uC628 \uD56D\uBAA9";
|
|
3814
|
+
var CARRY_OVER_MISSION_GOAL = "Open items carried over from closed missions, and decisions requested without a mission. Managed automatically \u2014 do not close.";
|
|
3815
|
+
function isCarryOverMissionRecord(m) {
|
|
3816
|
+
return !!m && (m.isCarryOver === true || isCarryOverMissionTitle(m.title));
|
|
3817
|
+
}
|
|
3818
|
+
function isCarryOverMissionTitle(title) {
|
|
3819
|
+
if (typeof title !== "string") return false;
|
|
3820
|
+
const t = title.trim();
|
|
3821
|
+
return t === CARRY_OVER_MISSION_TITLE || t === LEGACY_CARRY_OVER_MISSION_TITLE;
|
|
3822
|
+
}
|
|
3823
|
+
var OWNER_ABANDON_CONFIRM_KEY_PREFIX = "owner-abandon-confirm:";
|
|
3824
|
+
var OWNER_ABANDON_CONFIRM_QUESTION = "The coordinator closed this as 'owner abandoned' \u2014 correct?";
|
|
3825
|
+
var OWNER_ABANDON_CONFIRM_OPTIONS = ["Correct", "Reopen"];
|
|
3826
|
+
var WORKER_DECISIONS_NEEDED_MAX = 3;
|
|
3827
|
+
var WORKER_COMMITS_MAX = 20;
|
|
3828
|
+
var SHA_RE = /^[0-9a-f]{7,64}$/i;
|
|
3829
|
+
function normalizeReportCommits(value) {
|
|
3830
|
+
if (!Array.isArray(value)) return null;
|
|
3831
|
+
const out = [];
|
|
3832
|
+
for (const v of value) {
|
|
3833
|
+
if (typeof v !== "string") return null;
|
|
3834
|
+
const sha = v.trim();
|
|
3835
|
+
if (!SHA_RE.test(sha)) return null;
|
|
3836
|
+
if (!out.includes(sha.toLowerCase())) out.push(sha.toLowerCase());
|
|
3837
|
+
}
|
|
3838
|
+
return out;
|
|
3839
|
+
}
|
|
3840
|
+
|
|
3841
|
+
// src/mission-git-state.ts
|
|
3842
|
+
var MISSION_REF_GIT_STATUSES = ["contained_ancestor", "contained_patch_equivalent", "not_contained", "unknown"];
|
|
3843
|
+
var MISSION_REF_GIT_METHODS = ["ancestry", "cherry", "residual_patch"];
|
|
3844
|
+
var MISSION_GIT_STATES = ["no_refs", "landed", "partial", "not_landed", "unknown"];
|
|
3845
|
+
function isMissionRefContained(status) {
|
|
3846
|
+
return status === "contained_ancestor" || status === "contained_patch_equivalent";
|
|
3847
|
+
}
|
|
3848
|
+
function aggregateMissionGitState(statuses) {
|
|
3849
|
+
const total = statuses.length;
|
|
3850
|
+
const contained = statuses.filter(isMissionRefContained).length;
|
|
3851
|
+
const notContained = statuses.filter((s) => s === "not_contained").length;
|
|
3852
|
+
const unknown = statuses.filter((s) => s === "unknown").length;
|
|
3853
|
+
const counts = { total, contained, notContained, unknown };
|
|
3854
|
+
if (total === 0) return { state: "no_refs", partialUnknown: false, counts };
|
|
3855
|
+
if (contained === total) return { state: "landed", partialUnknown: false, counts };
|
|
3856
|
+
if (contained > 0) return { state: "partial", partialUnknown: unknown > 0, counts };
|
|
3857
|
+
if (notContained === total) return { state: "not_landed", partialUnknown: false, counts };
|
|
3858
|
+
return { state: "unknown", partialUnknown: false, counts };
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
// src/release.ts
|
|
3862
|
+
var MESH_RELEASE_CHANNELS = ["preview", "stable"];
|
|
3863
|
+
function isMeshReleaseChannel(value) {
|
|
3864
|
+
return typeof value === "string" && MESH_RELEASE_CHANNELS.includes(value);
|
|
3865
|
+
}
|
|
3866
|
+
var MESH_RELEASE_STATUSES = ["planned", "frozen", "deployed", "verified", "superseded", "cancelled"];
|
|
3867
|
+
function isReleaseStatus(value) {
|
|
3868
|
+
return typeof value === "string" && MESH_RELEASE_STATUSES.includes(value);
|
|
3869
|
+
}
|
|
3870
|
+
var RELEASE_MEMBER_STATES = ["member", "moved_out", "removed"];
|
|
3871
|
+
var RELEASE_ACTORS = ["coordinator", "owner", "assistant", "script"];
|
|
3872
|
+
var RELEASE_EVENT_TYPES = [
|
|
3873
|
+
"created",
|
|
3874
|
+
"status_changed",
|
|
3875
|
+
"scope_added",
|
|
3876
|
+
"scope_moved",
|
|
3877
|
+
"scope_removed",
|
|
3878
|
+
"deploy_recorded",
|
|
3879
|
+
"changelog_drafted",
|
|
3880
|
+
"changelog_applied"
|
|
3881
|
+
];
|
|
3882
|
+
var MISSION_RELEASE_EVENT_TYPES = ["release_attached", "release_moved", "release_detached"];
|
|
3883
|
+
var RELEASE_LIMITS = {
|
|
3884
|
+
name: 80,
|
|
3885
|
+
note: 500,
|
|
3886
|
+
/** `mesh_missions.release_note`: one user/operator-visible sentence. */
|
|
3887
|
+
releaseNote: 400,
|
|
3888
|
+
missionsPerCall: 100,
|
|
3889
|
+
changelogEntries: 300
|
|
3890
|
+
};
|
|
3891
|
+
var CHANGELOG_SECTIONS = ["Added", "Fixed", "Changed"];
|
|
3892
|
+
var NEEDS_WORDING_MARKER = "[needs user-facing wording]";
|
|
3893
|
+
function changelogMissionMarker(missionId) {
|
|
3894
|
+
return `<!-- m:${missionId.slice(0, 8)} -->`;
|
|
3895
|
+
}
|
|
3896
|
+
function classifyChangelogSection(text, hint) {
|
|
3897
|
+
const m = /^\s*\[(added|fixed|changed)\]\s*/i.exec(text);
|
|
3898
|
+
if (m) {
|
|
3899
|
+
const key = m[1].toLowerCase();
|
|
3900
|
+
return { section: key === "added" ? "Added" : key === "fixed" ? "Fixed" : "Changed", text: text.slice(m[0].length).trim() };
|
|
3901
|
+
}
|
|
3902
|
+
const probe = `${hint ?? ""} ${text}`.toLowerCase();
|
|
3903
|
+
if (/\b(fix|fixes|fixed|bug|regression|crash|error)\b|오류|결함|버그|수정/.test(probe)) return { section: "Fixed", text };
|
|
3904
|
+
if (/\b(add|adds|added|new|introduc\w*|support\w*)\b|신규|추가/.test(probe)) return { section: "Added", text };
|
|
3905
|
+
return { section: "Changed", text };
|
|
3906
|
+
}
|
|
3907
|
+
function lintChangelogText(text) {
|
|
3908
|
+
const out = [];
|
|
3909
|
+
if (/\bwave[\s-]*\d+/i.test(text) || /웨이브\s*\d+/.test(text)) out.push("mentions an internal wave number");
|
|
3910
|
+
if (/\brc[.\s-]?\d+\b/i.test(text)) out.push("mentions an internal rc number");
|
|
3911
|
+
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");
|
|
3912
|
+
if (/\bmission\b/i.test(text)) out.push('mentions "mission" (internal vocabulary)');
|
|
3913
|
+
return out;
|
|
3914
|
+
}
|
|
3915
|
+
|
|
3916
|
+
// src/decision-push-relay.ts
|
|
3917
|
+
var DECISION_PUSH_RELAY_COMMAND = "mission_decision_push_relay_answer";
|
|
3918
|
+
var DECISION_PUSH_RELAY_SOURCE = "push_relay";
|
|
3919
|
+
|
|
3163
3920
|
// src/keyed-doc-delta.ts
|
|
3164
3921
|
function sig(value) {
|
|
3165
3922
|
if (value === void 0) return void 0;
|
|
@@ -3522,8 +4279,411 @@ function isProviderQuestionBinding(value) {
|
|
|
3522
4279
|
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
3523
4280
|
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
3524
4281
|
}
|
|
4282
|
+
|
|
4283
|
+
// src/task-source-phase.ts
|
|
4284
|
+
function reviewIndependenceOf(review) {
|
|
4285
|
+
return review.independence ?? "different_provider";
|
|
4286
|
+
}
|
|
4287
|
+
|
|
4288
|
+
// src/light-task.ts
|
|
4289
|
+
var LIGHT_REJECT = {
|
|
4290
|
+
REQUIRES_LOCAL_BASE: "light_requires_local_base",
|
|
4291
|
+
NOT_CONFIGURED: "light_workspace_not_configured",
|
|
4292
|
+
REQUIRES_OWNED_PATHS: "light_requires_owned_paths",
|
|
4293
|
+
MODE_CONFLICT: "light_mode_conflict"
|
|
4294
|
+
};
|
|
4295
|
+
var LIGHT_HOLD = {
|
|
4296
|
+
PREPARE_FAILED: "light_workspace_prepare_failed",
|
|
4297
|
+
LIMIT: "light_workspace_limit",
|
|
4298
|
+
DISK_LOW: "light_workspace_disk_low",
|
|
4299
|
+
CAP: "max_light_parallel_tasks_reached"
|
|
4300
|
+
};
|
|
4301
|
+
var LIGHT_BLOCK_REASONS = [
|
|
4302
|
+
"light_uncommitted_changes",
|
|
4303
|
+
"light_dependency_change",
|
|
4304
|
+
"light_lineage_unproven",
|
|
4305
|
+
"shared_checkout_mutated"
|
|
4306
|
+
];
|
|
4307
|
+
var LIGHT_WARNINGS = ["shared_checkout_changed_during_task", "light_base_dirty_overlap"];
|
|
4308
|
+
var LIGHT_LAND_MODES = ["refine", "apply_to_checkout"];
|
|
4309
|
+
var LIGHT_TESTS_RUN_MAX = 20;
|
|
4310
|
+
function isLightWorkerSession(session) {
|
|
4311
|
+
const s = session;
|
|
4312
|
+
if (!s || typeof s !== "object") return false;
|
|
4313
|
+
const has = (o) => !!o && typeof o === "object" && typeof o.lightWorkspaceId === "string" && o.lightWorkspaceId.trim() !== "";
|
|
4314
|
+
return has(s.settings) || has(s.launchRecord?.settings) || has(s);
|
|
4315
|
+
}
|
|
4316
|
+
|
|
4317
|
+
// src/relay-reprobe.ts
|
|
4318
|
+
var RELAY_REPROBE_BASE_DELAY_MS = 6e4;
|
|
4319
|
+
var RELAY_REPROBE_MAX_DELAY_MS = 5 * 6e4;
|
|
4320
|
+
var RELAY_REPROBE_JITTER_RATIO = 0.2;
|
|
4321
|
+
function computeRelayReprobeDelay(failures, random, timing = {}) {
|
|
4322
|
+
const base = timing.baseDelayMs ?? RELAY_REPROBE_BASE_DELAY_MS;
|
|
4323
|
+
const max = timing.maxDelayMs ?? RELAY_REPROBE_MAX_DELAY_MS;
|
|
4324
|
+
const jitter = timing.jitterRatio ?? RELAY_REPROBE_JITTER_RATIO;
|
|
4325
|
+
const grown = Math.min(max, base * 2 ** Math.max(0, failures));
|
|
4326
|
+
const factor = 1 + jitter * (Math.min(1, Math.max(0, random())) * 2 - 1);
|
|
4327
|
+
return Math.round(grown * factor);
|
|
4328
|
+
}
|
|
4329
|
+
var RelayReprobeScheduler = class {
|
|
4330
|
+
constructor(options) {
|
|
4331
|
+
this.options = options;
|
|
4332
|
+
}
|
|
4333
|
+
handle = null;
|
|
4334
|
+
running = false;
|
|
4335
|
+
inFlight = false;
|
|
4336
|
+
failureCount = 0;
|
|
4337
|
+
generation = 0;
|
|
4338
|
+
get isRunning() {
|
|
4339
|
+
return this.running;
|
|
4340
|
+
}
|
|
4341
|
+
get failures() {
|
|
4342
|
+
return this.failureCount;
|
|
4343
|
+
}
|
|
4344
|
+
get probing() {
|
|
4345
|
+
return this.inFlight;
|
|
4346
|
+
}
|
|
4347
|
+
/** Begin probing (idempotent). Call when a connection is selected as relay. */
|
|
4348
|
+
start() {
|
|
4349
|
+
if (this.running) return;
|
|
4350
|
+
this.running = true;
|
|
4351
|
+
this.failureCount = 0;
|
|
4352
|
+
this.generation++;
|
|
4353
|
+
this.schedule();
|
|
4354
|
+
}
|
|
4355
|
+
/** Stop for good (direct path found, connection closed, auth epoch changed). */
|
|
4356
|
+
stop() {
|
|
4357
|
+
this.running = false;
|
|
4358
|
+
this.generation++;
|
|
4359
|
+
if (this.handle !== null) {
|
|
4360
|
+
this.options.clearTimer(this.handle);
|
|
4361
|
+
this.handle = null;
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
schedule() {
|
|
4365
|
+
if (!this.running) return;
|
|
4366
|
+
const generation = this.generation;
|
|
4367
|
+
const delay = computeRelayReprobeDelay(this.failureCount, this.options.random, this.options);
|
|
4368
|
+
this.handle = this.options.setTimer(() => {
|
|
4369
|
+
this.handle = null;
|
|
4370
|
+
void this.tick(generation);
|
|
4371
|
+
}, delay);
|
|
4372
|
+
}
|
|
4373
|
+
async tick(generation) {
|
|
4374
|
+
if (!this.running || generation !== this.generation) return;
|
|
4375
|
+
if (this.inFlight || !this.options.shouldProbe()) {
|
|
4376
|
+
this.schedule();
|
|
4377
|
+
return;
|
|
4378
|
+
}
|
|
4379
|
+
this.inFlight = true;
|
|
4380
|
+
let outcome;
|
|
4381
|
+
try {
|
|
4382
|
+
outcome = await this.options.probe();
|
|
4383
|
+
} catch {
|
|
4384
|
+
outcome = "failed";
|
|
4385
|
+
}
|
|
4386
|
+
this.inFlight = false;
|
|
4387
|
+
if (!this.running || generation !== this.generation) return;
|
|
4388
|
+
if (outcome === "direct") {
|
|
4389
|
+
this.stop();
|
|
4390
|
+
return;
|
|
4391
|
+
}
|
|
4392
|
+
if (outcome !== "skipped") this.failureCount++;
|
|
4393
|
+
this.schedule();
|
|
4394
|
+
}
|
|
4395
|
+
};
|
|
4396
|
+
|
|
4397
|
+
// src/task-stages.ts
|
|
4398
|
+
var REVIEW_VERDICTS = ["approve", "approve_with_nits", "changes_requested", "reject_approach"];
|
|
4399
|
+
var FINDING_SEVERITIES = ["blocking", "major", "minor", "nit"];
|
|
4400
|
+
var FINDING_CATEGORIES = ["correctness", "regression", "test_gap", "scope", "security", "performance", "maintainability"];
|
|
4401
|
+
var PRIOR_FINDING_STATUSES = ["resolved", "unresolved", "dispute_accepted", "dispute_rejected"];
|
|
4402
|
+
var FINDING_RESPONSE_KINDS = ["fixed", "disputed"];
|
|
4403
|
+
var STAGE_PHASES = ["implementing", "self_checking", "awaiting_review", "reviewing", "revising", "done"];
|
|
4404
|
+
var STAGE_PARKED_PHASES = ["self_checking", "awaiting_review", "reviewing"];
|
|
4405
|
+
var STAGE_INDEPENDENCE_MODES = ["different_provider", "fresh_session_ok"];
|
|
4406
|
+
var STAGE_ROLES = ["implement", "revise", "review"];
|
|
4407
|
+
var STAGE_BLOCKED_REASONS = [
|
|
4408
|
+
"review_unresolved",
|
|
4409
|
+
"review_rejected_approach",
|
|
4410
|
+
"review_unavailable",
|
|
4411
|
+
"self_check_failed",
|
|
4412
|
+
"stage_pipeline_ceiling",
|
|
4413
|
+
"reviewer_mutated_source",
|
|
4414
|
+
// The read-lease checkout could not be fingerprinted (start or end): the review's integrity cannot be verified.
|
|
4415
|
+
"reviewer_integrity_unverifiable"
|
|
4416
|
+
];
|
|
4417
|
+
var STAGE_DECIDE_ACTIONS = ["accept", "revise_once", "rereview", "abandon"];
|
|
4418
|
+
var STAGE_MAX_REVISIONS_LIMIT = 3;
|
|
4419
|
+
var STAGE_DEFAULT_MAX_REVISIONS = 2;
|
|
4420
|
+
var STAGE_SELF_CHECK_MAX_BOUNCES = 2;
|
|
4421
|
+
var STAGE_INDEPENDENCE_FALLBACK_MS = 10 * 60 * 1e3;
|
|
4422
|
+
var STAGE_PIPELINE_CEILING_DEFAULT_MS = 4 * 60 * 60 * 1e3;
|
|
4423
|
+
var REVIEW_FINDINGS_MAX = 30;
|
|
4424
|
+
var REVIEW_CLAIM_MAX_CHARS = 500;
|
|
4425
|
+
var REVIEW_EVIDENCE_MAX_CHARS = 1e3;
|
|
4426
|
+
var REVIEW_FIX_MAX_CHARS = 500;
|
|
4427
|
+
var REVIEW_FINDING_ID_MAX_CHARS = 40;
|
|
4428
|
+
var REVIEW_CHECKED_MAX = 20;
|
|
4429
|
+
var REVIEW_NOTE_MAX_CHARS = 500;
|
|
4430
|
+
var REVIEW_TESTS_RUN_MAX = 20;
|
|
4431
|
+
var FINDING_RESPONSES_MAX = 30;
|
|
4432
|
+
function makeGuard4(values) {
|
|
4433
|
+
const set = new Set(values);
|
|
4434
|
+
return (value) => typeof value === "string" && set.has(value);
|
|
4435
|
+
}
|
|
4436
|
+
var isReviewVerdict = makeGuard4(REVIEW_VERDICTS);
|
|
4437
|
+
var isFindingSeverity = makeGuard4(FINDING_SEVERITIES);
|
|
4438
|
+
var isFindingCategory = makeGuard4(FINDING_CATEGORIES);
|
|
4439
|
+
var isPriorFindingStatus = makeGuard4(PRIOR_FINDING_STATUSES);
|
|
4440
|
+
var isFindingResponseKind = makeGuard4(FINDING_RESPONSE_KINDS);
|
|
4441
|
+
var isStageBlockedReason = makeGuard4(STAGE_BLOCKED_REASONS);
|
|
4442
|
+
var isRecord4 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
4443
|
+
function isBlockingSeverity(severity) {
|
|
4444
|
+
return severity === "blocking" || severity === "major";
|
|
4445
|
+
}
|
|
4446
|
+
function resolveStagePlan(raw, task, opts = {}) {
|
|
4447
|
+
const eligible = isStageEligibleTask(task);
|
|
4448
|
+
if (raw === void 0 || raw === null) return (opts.defaultOn ?? false) && defaultsOnFor(task) ? defaultStagePlan() : null;
|
|
4449
|
+
if (raw === false) return null;
|
|
4450
|
+
if (raw === true) {
|
|
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
|
+
return defaultStagePlan();
|
|
4453
|
+
}
|
|
4454
|
+
if (!isRecord4(raw)) throw new Error("invalid_review_option: review must be true, false or {max_revisions?, independence?}");
|
|
4455
|
+
const allowed = /* @__PURE__ */ new Set(["max_revisions", "maxRevisions", "independence"]);
|
|
4456
|
+
for (const key of Object.keys(raw)) {
|
|
4457
|
+
if (!allowed.has(key)) throw new Error(`invalid_review_option: unknown review key '${key}' (expected max_revisions, independence)`);
|
|
4458
|
+
}
|
|
4459
|
+
if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
|
|
4460
|
+
const rawMax = raw.max_revisions ?? raw.maxRevisions;
|
|
4461
|
+
let maxRevisions = STAGE_DEFAULT_MAX_REVISIONS;
|
|
4462
|
+
if (rawMax !== void 0) {
|
|
4463
|
+
if (typeof rawMax !== "number" || !Number.isInteger(rawMax) || rawMax < 0 || rawMax > STAGE_MAX_REVISIONS_LIMIT) {
|
|
4464
|
+
throw new Error(`invalid_review_option: max_revisions must be an integer 0..${STAGE_MAX_REVISIONS_LIMIT}`);
|
|
4465
|
+
}
|
|
4466
|
+
maxRevisions = rawMax;
|
|
4467
|
+
}
|
|
4468
|
+
let independence = "fresh_session_ok";
|
|
4469
|
+
if (raw.independence !== void 0) {
|
|
4470
|
+
if (!STAGE_INDEPENDENCE_MODES.includes(raw.independence)) {
|
|
4471
|
+
throw new Error(`invalid_review_option: independence must be one of ${STAGE_INDEPENDENCE_MODES.join(" | ")}`);
|
|
4472
|
+
}
|
|
4473
|
+
independence = raw.independence;
|
|
4474
|
+
}
|
|
4475
|
+
return { review: true, maxRevisions, independence };
|
|
4476
|
+
}
|
|
4477
|
+
function defaultStagePlan() {
|
|
4478
|
+
return { review: true, maxRevisions: STAGE_DEFAULT_MAX_REVISIONS, independence: "fresh_session_ok" };
|
|
4479
|
+
}
|
|
4480
|
+
function isStageEligibleTask(task) {
|
|
4481
|
+
if (task.readonly) return false;
|
|
4482
|
+
return (task.taskMode ?? "code_change") === "code_change";
|
|
4483
|
+
}
|
|
4484
|
+
function defaultsOnFor(task) {
|
|
4485
|
+
return isStageEligibleTask(task) && (task.difficulty === "medium" || task.difficulty === "difficult");
|
|
4486
|
+
}
|
|
4487
|
+
function str2(value) {
|
|
4488
|
+
return typeof value === "string" ? value.trim() : "";
|
|
4489
|
+
}
|
|
4490
|
+
function validateStringList(value, field, max, maxChars, errors, minItems = 0) {
|
|
4491
|
+
if (!Array.isArray(value)) {
|
|
4492
|
+
errors.push({ field, message: `${field} must be an array of strings` });
|
|
4493
|
+
return [];
|
|
4494
|
+
}
|
|
4495
|
+
if (value.length > max) errors.push({ field, message: `${field} has ${value.length} entries, over the ${max} limit` });
|
|
4496
|
+
const out = [];
|
|
4497
|
+
for (const item of value) {
|
|
4498
|
+
const text = str2(item);
|
|
4499
|
+
if (!text) continue;
|
|
4500
|
+
if (text.length > maxChars) {
|
|
4501
|
+
errors.push({ field, message: `${field} contains an entry over ${maxChars} chars` });
|
|
4502
|
+
continue;
|
|
4503
|
+
}
|
|
4504
|
+
out.push(text);
|
|
4505
|
+
}
|
|
4506
|
+
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` });
|
|
4507
|
+
return out;
|
|
4508
|
+
}
|
|
4509
|
+
function validateReviewReport(raw, ctx) {
|
|
4510
|
+
const errors = [];
|
|
4511
|
+
if (!isRecord4(raw)) return { errors: [{ field: "review", message: "review must be an object {verdict, findings, checked, notChecked, ...}" }] };
|
|
4512
|
+
const KNOWN = /* @__PURE__ */ new Set(["verdict", "findings", "priorFindings", "checked", "notChecked", "testsRun"]);
|
|
4513
|
+
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(", ")})` });
|
|
4514
|
+
const verdict = raw.verdict;
|
|
4515
|
+
if (!isReviewVerdict(verdict)) errors.push({ field: "review.verdict", message: `verdict must be one of ${REVIEW_VERDICTS.join(" | ")}` });
|
|
4516
|
+
const findings = [];
|
|
4517
|
+
if (!Array.isArray(raw.findings)) errors.push({ field: "review.findings", message: "findings must be an array (use [] when there are none)" });
|
|
4518
|
+
else {
|
|
4519
|
+
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` });
|
|
4520
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4521
|
+
raw.findings.forEach((f, i) => {
|
|
4522
|
+
const at = `review.findings[${i}]`;
|
|
4523
|
+
if (!isRecord4(f)) {
|
|
4524
|
+
errors.push({ field: at, message: "each finding must be an object" });
|
|
4525
|
+
return;
|
|
4526
|
+
}
|
|
4527
|
+
const FK = /* @__PURE__ */ new Set(["id", "severity", "category", "file", "line", "claim", "evidence", "suggestedFix"]);
|
|
4528
|
+
for (const key of Object.keys(f)) if (!FK.has(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
4529
|
+
const id2 = str2(f.id);
|
|
4530
|
+
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)` });
|
|
4531
|
+
else if (seen.has(id2)) errors.push({ field: `${at}.id`, message: `duplicate finding id '${id2}'` });
|
|
4532
|
+
else seen.add(id2);
|
|
4533
|
+
if (!isFindingSeverity(f.severity)) errors.push({ field: `${at}.severity`, message: `severity must be one of ${FINDING_SEVERITIES.join(" | ")}` });
|
|
4534
|
+
if (!isFindingCategory(f.category)) errors.push({ field: `${at}.category`, message: `category must be one of ${FINDING_CATEGORIES.join(" | ")}` });
|
|
4535
|
+
const claim = str2(f.claim);
|
|
4536
|
+
if (!claim) errors.push({ field: `${at}.claim`, message: "claim is required" });
|
|
4537
|
+
else if (claim.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.claim`, message: `claim is over ${REVIEW_CLAIM_MAX_CHARS} chars` });
|
|
4538
|
+
const evidence = str2(f.evidence);
|
|
4539
|
+
if (!evidence) errors.push({ field: `${at}.evidence`, message: "evidence is required \u2014 what did you read or run to know this" });
|
|
4540
|
+
else if (evidence.length > REVIEW_EVIDENCE_MAX_CHARS) errors.push({ field: `${at}.evidence`, message: `evidence is over ${REVIEW_EVIDENCE_MAX_CHARS} chars` });
|
|
4541
|
+
const fix = f.suggestedFix === void 0 ? void 0 : str2(f.suggestedFix);
|
|
4542
|
+
if (fix !== void 0 && fix.length > REVIEW_FIX_MAX_CHARS) errors.push({ field: `${at}.suggestedFix`, message: `suggestedFix is over ${REVIEW_FIX_MAX_CHARS} chars` });
|
|
4543
|
+
if (f.file !== void 0 && typeof f.file !== "string") errors.push({ field: `${at}.file`, message: "file must be a string" });
|
|
4544
|
+
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" });
|
|
4545
|
+
if (id2 && isFindingSeverity(f.severity) && isFindingCategory(f.category) && claim && evidence) {
|
|
4546
|
+
findings.push({
|
|
4547
|
+
id: id2,
|
|
4548
|
+
severity: f.severity,
|
|
4549
|
+
category: f.category,
|
|
4550
|
+
...typeof f.file === "string" && f.file.trim() ? { file: f.file.trim() } : {},
|
|
4551
|
+
...typeof f.line === "number" ? { line: f.line } : {},
|
|
4552
|
+
claim,
|
|
4553
|
+
evidence,
|
|
4554
|
+
...fix ? { suggestedFix: fix } : {}
|
|
4555
|
+
});
|
|
4556
|
+
}
|
|
4557
|
+
});
|
|
4558
|
+
}
|
|
4559
|
+
const checked = validateStringList(raw.checked, "review.checked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
|
|
4560
|
+
const notChecked = validateStringList(raw.notChecked, "review.notChecked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
|
|
4561
|
+
let priorFindings;
|
|
4562
|
+
if (raw.priorFindings !== void 0) {
|
|
4563
|
+
if (!Array.isArray(raw.priorFindings)) errors.push({ field: "review.priorFindings", message: "priorFindings must be an array" });
|
|
4564
|
+
else {
|
|
4565
|
+
priorFindings = [];
|
|
4566
|
+
raw.priorFindings.forEach((p, i) => {
|
|
4567
|
+
const at = `review.priorFindings[${i}]`;
|
|
4568
|
+
if (!isRecord4(p)) {
|
|
4569
|
+
errors.push({ field: at, message: "each entry must be an object {id, status, note?}" });
|
|
4570
|
+
return;
|
|
4571
|
+
}
|
|
4572
|
+
for (const key of Object.keys(p)) if (!["id", "status", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
4573
|
+
const id2 = str2(p.id);
|
|
4574
|
+
if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
|
|
4575
|
+
if (!isPriorFindingStatus(p.status)) errors.push({ field: `${at}.status`, message: `status must be one of ${PRIOR_FINDING_STATUSES.join(" | ")}` });
|
|
4576
|
+
const note = p.note === void 0 ? void 0 : str2(p.note);
|
|
4577
|
+
if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
|
|
4578
|
+
if (id2 && isPriorFindingStatus(p.status)) priorFindings.push({ id: id2, status: p.status, ...note ? { note } : {} });
|
|
4579
|
+
});
|
|
4580
|
+
}
|
|
4581
|
+
}
|
|
4582
|
+
const testsRun = raw.testsRun === void 0 ? void 0 : validateTestsRun(raw.testsRun, "review.testsRun", errors);
|
|
4583
|
+
if (isReviewVerdict(verdict)) {
|
|
4584
|
+
const blocking = findings.filter((f) => isBlockingSeverity(f.severity));
|
|
4585
|
+
if (verdict === "changes_requested" && blocking.length === 0 && Array.isArray(raw.findings) && errors.length === 0) {
|
|
4586
|
+
errors.push({ field: "review.verdict", message: "changes_requested needs at least one blocking or major finding \u2014 nits alone are approve_with_nits" });
|
|
4587
|
+
}
|
|
4588
|
+
if (verdict === "approve" && blocking.length > 0) {
|
|
4589
|
+
errors.push({ field: "review.verdict", message: "approve cannot carry blocking or major findings" });
|
|
4590
|
+
}
|
|
4591
|
+
if (verdict === "approve_with_nits" && blocking.length > 0) {
|
|
4592
|
+
errors.push({ field: "review.verdict", message: "approve_with_nits cannot carry blocking or major findings \u2014 use changes_requested" });
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4595
|
+
if (ctx.round >= 2 && ctx.priorOpenBlockingIds?.length) {
|
|
4596
|
+
const answered = new Set((priorFindings ?? []).map((p) => p.id));
|
|
4597
|
+
const missing = ctx.priorOpenBlockingIds.filter((id2) => !answered.has(id2));
|
|
4598
|
+
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(", ")}` });
|
|
4599
|
+
}
|
|
4600
|
+
if (errors.length) return { errors };
|
|
4601
|
+
return {
|
|
4602
|
+
report: {
|
|
4603
|
+
verdict,
|
|
4604
|
+
findings,
|
|
4605
|
+
...priorFindings?.length ? { priorFindings } : {},
|
|
4606
|
+
checked,
|
|
4607
|
+
notChecked,
|
|
4608
|
+
...testsRun?.length ? { testsRun } : {}
|
|
4609
|
+
},
|
|
4610
|
+
errors: []
|
|
4611
|
+
};
|
|
4612
|
+
}
|
|
4613
|
+
function validateTestsRun(raw, field, errors) {
|
|
4614
|
+
if (!Array.isArray(raw)) {
|
|
4615
|
+
errors.push({ field, message: `${field} must be an array of {command, exit, passed?, failed?, note?}` });
|
|
4616
|
+
return [];
|
|
4617
|
+
}
|
|
4618
|
+
if (raw.length > REVIEW_TESTS_RUN_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${REVIEW_TESTS_RUN_MAX} limit` });
|
|
4619
|
+
const out = [];
|
|
4620
|
+
raw.forEach((t, i) => {
|
|
4621
|
+
const at = `${field}[${i}]`;
|
|
4622
|
+
if (!isRecord4(t)) {
|
|
4623
|
+
errors.push({ field: at, message: "each entry must be an object" });
|
|
4624
|
+
return;
|
|
4625
|
+
}
|
|
4626
|
+
for (const key of Object.keys(t)) if (!["command", "exit", "passed", "failed", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
4627
|
+
const command = str2(t.command);
|
|
4628
|
+
if (!command || command.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.command`, message: `command is required (\u2264 ${REVIEW_CLAIM_MAX_CHARS} chars)` });
|
|
4629
|
+
if (typeof t.exit !== "number" || !Number.isInteger(t.exit)) errors.push({ field: `${at}.exit`, message: "exit must be an integer" });
|
|
4630
|
+
for (const k of ["passed", "failed"]) {
|
|
4631
|
+
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` });
|
|
4632
|
+
}
|
|
4633
|
+
const note = t.note === void 0 ? void 0 : str2(t.note);
|
|
4634
|
+
if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
|
|
4635
|
+
if (command && typeof t.exit === "number") {
|
|
4636
|
+
out.push({
|
|
4637
|
+
command,
|
|
4638
|
+
exit: t.exit,
|
|
4639
|
+
...typeof t.passed === "number" ? { passed: t.passed } : {},
|
|
4640
|
+
...typeof t.failed === "number" ? { failed: t.failed } : {},
|
|
4641
|
+
...note ? { note } : {}
|
|
4642
|
+
});
|
|
4643
|
+
}
|
|
4644
|
+
});
|
|
4645
|
+
return out;
|
|
4646
|
+
}
|
|
4647
|
+
function validateFindingResponses(raw, field = "findingResponses") {
|
|
4648
|
+
const errors = [];
|
|
4649
|
+
if (!Array.isArray(raw)) return { errors: [{ field, message: `${field} must be an array of {id, response, note}` }] };
|
|
4650
|
+
if (raw.length > FINDING_RESPONSES_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${FINDING_RESPONSES_MAX} limit` });
|
|
4651
|
+
const out = [];
|
|
4652
|
+
raw.forEach((r, i) => {
|
|
4653
|
+
const at = `${field}[${i}]`;
|
|
4654
|
+
if (!isRecord4(r)) {
|
|
4655
|
+
errors.push({ field: at, message: "each entry must be an object {id, response, note}" });
|
|
4656
|
+
return;
|
|
4657
|
+
}
|
|
4658
|
+
for (const key of Object.keys(r)) if (!["id", "response", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
4659
|
+
const id2 = str2(r.id);
|
|
4660
|
+
if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
|
|
4661
|
+
if (!isFindingResponseKind(r.response)) errors.push({ field: `${at}.response`, message: `response must be one of ${FINDING_RESPONSE_KINDS.join(" | ")}` });
|
|
4662
|
+
const note = str2(r.note);
|
|
4663
|
+
if (!note) errors.push({ field: `${at}.note`, message: "note is required \u2014 say what changed, or why you dispute it" });
|
|
4664
|
+
else if (note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
|
|
4665
|
+
if (id2 && isFindingResponseKind(r.response) && note && note.length <= REVIEW_NOTE_MAX_CHARS) out.push({ id: id2, response: r.response, note });
|
|
4666
|
+
});
|
|
4667
|
+
return errors.length ? { errors } : { responses: out, errors: [] };
|
|
4668
|
+
}
|
|
4669
|
+
function formatStageVerdictLine(input) {
|
|
4670
|
+
const parts = [`review: ${input.verdict}`];
|
|
4671
|
+
if (input.verdict === "skipped_no_diff") return parts[0];
|
|
4672
|
+
parts.push(`${input.rounds} round${input.rounds === 1 ? "" : "s"}`);
|
|
4673
|
+
if (input.reviewerProvider) parts.push(`reviewer ${input.reviewerProvider} (${input.independenceUsed ?? "different_provider"})`);
|
|
4674
|
+
const tail = [];
|
|
4675
|
+
if (input.fixed) tail.push(`${input.fixed} finding${input.fixed === 1 ? "" : "s"} fixed`);
|
|
4676
|
+
if (input.openNits) tail.push(`${input.openNits} nit${input.openNits === 1 ? "" : "s"} open`);
|
|
4677
|
+
return tail.length ? `${parts.join(" \xB7 ")} \xB7 ${tail.join(", ")}` : parts.join(" \xB7 ");
|
|
4678
|
+
}
|
|
3525
4679
|
export {
|
|
4680
|
+
ASSISTANT_ACCOUNT_SLOT,
|
|
4681
|
+
ASSISTANT_FOLLOWER_ALLOWED_OPS,
|
|
3526
4682
|
ASSISTANT_OWNER_VERBS,
|
|
4683
|
+
ASSISTANT_REMOTE_FOLLOW_COMMAND,
|
|
4684
|
+
ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND,
|
|
4685
|
+
ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND,
|
|
4686
|
+
ASSISTANT_REMOTE_PROJECT_COMMAND,
|
|
3527
4687
|
ASSISTANT_REVIEW_TURN_VERBS,
|
|
3528
4688
|
ASSISTANT_SESSION_ID_ARG,
|
|
3529
4689
|
ASSISTANT_SESSION_ID_ENV,
|
|
@@ -3535,12 +4695,16 @@ export {
|
|
|
3535
4695
|
CANCEL_REASONS,
|
|
3536
4696
|
CANONICAL_MESH_TOOL_COUNT,
|
|
3537
4697
|
CANONICAL_MESH_TOOL_NAMES,
|
|
4698
|
+
CARRY_OVER_MISSION_GOAL,
|
|
4699
|
+
CARRY_OVER_MISSION_TITLE,
|
|
4700
|
+
CHANGELOG_SECTIONS,
|
|
3538
4701
|
CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX,
|
|
3539
4702
|
CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX,
|
|
3540
4703
|
CLI_SLOT_RECIPES,
|
|
3541
4704
|
COMMIT_STRENGTHS,
|
|
3542
4705
|
CONSUME_PROFILES,
|
|
3543
4706
|
COORDINATOR_ACK_OUTCOMES,
|
|
4707
|
+
COORDINATOR_SETTABLE_ITEM_STATES,
|
|
3544
4708
|
DAEMON_METADATA_DOC_SPEC,
|
|
3545
4709
|
DAEMON_P2P_SIGNAL_TYPES,
|
|
3546
4710
|
DAEMON_STATUS_EVENT_NAMES,
|
|
@@ -3553,13 +4717,34 @@ export {
|
|
|
3553
4717
|
DASHBOARD_TO_DAEMON_P2P_TYPES,
|
|
3554
4718
|
DASHBOARD_TO_USER_SESSION_TYPES,
|
|
3555
4719
|
DASHBOARD_WIRE_VERSION,
|
|
4720
|
+
DECISION_PUSH_OPTIONS_MAX,
|
|
4721
|
+
DECISION_PUSH_OPTION_LABEL_MAX,
|
|
4722
|
+
DECISION_PUSH_QUESTION_MAX,
|
|
4723
|
+
DECISION_PUSH_RELAY_COMMAND,
|
|
4724
|
+
DECISION_PUSH_RELAY_SOURCE,
|
|
3556
4725
|
DEFAULT_DIFFICULTY_BRAINS,
|
|
3557
4726
|
DELIVERY_OUTCOMES,
|
|
3558
4727
|
DELIVERY_VIAS,
|
|
3559
4728
|
DISPATCH_FAILURE_REASONS,
|
|
4729
|
+
DISPATCH_REFUSAL_DETAIL_MAX,
|
|
3560
4730
|
EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
3561
4731
|
EVIDENCE_SOURCE_IDS,
|
|
4732
|
+
FINDING_CATEGORIES,
|
|
4733
|
+
FINDING_RESPONSES_MAX,
|
|
4734
|
+
FINDING_RESPONSE_KINDS,
|
|
4735
|
+
FINDING_SEVERITIES,
|
|
3562
4736
|
HOLD_REASONS,
|
|
4737
|
+
LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
|
|
4738
|
+
LAUNCH_DEFAULT_ERROR_CODES,
|
|
4739
|
+
LAUNCH_DEFAULT_ROLES,
|
|
4740
|
+
LAUNCH_DEFAULT_SOURCES,
|
|
4741
|
+
LEGACY_CARRY_OVER_MISSION_TITLE,
|
|
4742
|
+
LIGHT_BLOCK_REASONS,
|
|
4743
|
+
LIGHT_HOLD,
|
|
4744
|
+
LIGHT_LAND_MODES,
|
|
4745
|
+
LIGHT_REJECT,
|
|
4746
|
+
LIGHT_TESTS_RUN_MAX,
|
|
4747
|
+
LIGHT_WARNINGS,
|
|
3563
4748
|
LIVENESS_RESULTS,
|
|
3564
4749
|
MAX_MESH_RECORD_STRING,
|
|
3565
4750
|
MAX_OWNED_PATHS,
|
|
@@ -3574,6 +4759,8 @@ export {
|
|
|
3574
4759
|
MESH_MISSION_STATUSES,
|
|
3575
4760
|
MESH_P2P_SIGNAL_TYPES,
|
|
3576
4761
|
MESH_RECORD_PAYLOAD_KEYS,
|
|
4762
|
+
MESH_RELEASE_CHANNELS,
|
|
4763
|
+
MESH_RELEASE_STATUSES,
|
|
3577
4764
|
MESH_SESSION_CLEANUP_MODES,
|
|
3578
4765
|
MESH_STATUS_DOC_SPEC,
|
|
3579
4766
|
MESH_TASK_DIFFICULTIES,
|
|
@@ -3585,10 +4772,23 @@ export {
|
|
|
3585
4772
|
MESH_TOPIC_ENTRY_KINDS,
|
|
3586
4773
|
MESH_TOPIC_PROTOCOL_VERSION,
|
|
3587
4774
|
MISSION_BRIEF_RENDER_MAX_CHARS,
|
|
4775
|
+
MISSION_DECISION_ON_DUE,
|
|
4776
|
+
MISSION_DECISION_OPTION_IDS,
|
|
4777
|
+
MISSION_DECISION_URGENCIES,
|
|
4778
|
+
MISSION_GIT_STATES,
|
|
4779
|
+
MISSION_ITEM_KINDS,
|
|
4780
|
+
MISSION_ITEM_STATES,
|
|
4781
|
+
MISSION_LIMITS,
|
|
4782
|
+
MISSION_OUTCOMES,
|
|
4783
|
+
MISSION_REF_GIT_METHODS,
|
|
4784
|
+
MISSION_REF_GIT_STATUSES,
|
|
4785
|
+
MISSION_REF_KINDS,
|
|
4786
|
+
MISSION_RELEASE_EVENT_TYPES,
|
|
3588
4787
|
MODEL_AXIS_SOURCES,
|
|
3589
4788
|
MODEL_SELECTION_HISTORY_LIMIT,
|
|
3590
4789
|
MeshChunkAssembler,
|
|
3591
4790
|
NATIVE_TURN_OUTCOMES,
|
|
4791
|
+
NEEDS_WORDING_MARKER,
|
|
3592
4792
|
NOTIFY_KINDS,
|
|
3593
4793
|
NO_PROGRESS_OBSERVED_STATUSES,
|
|
3594
4794
|
NPM_UPDATE_TAGS,
|
|
@@ -3598,16 +4798,37 @@ export {
|
|
|
3598
4798
|
OPERATOR_STATUS_REASON_VALUES,
|
|
3599
4799
|
OPERATOR_STATUS_VALUES,
|
|
3600
4800
|
OUTBOUND_MESSAGE_ORIGINS,
|
|
4801
|
+
OWNER_ABANDON_CONFIRM_KEY_PREFIX,
|
|
4802
|
+
OWNER_ABANDON_CONFIRM_OPTIONS,
|
|
4803
|
+
OWNER_ABANDON_CONFIRM_QUESTION,
|
|
3601
4804
|
P2P_SIGNAL_TYPES,
|
|
4805
|
+
PRIOR_FINDING_STATUSES,
|
|
3602
4806
|
PROVIDER_FAILURES,
|
|
3603
4807
|
QUOTA_BACKFILL_HORIZON_MS,
|
|
3604
4808
|
QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
3605
4809
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
3606
4810
|
RECENT_SESSION_BUCKETS,
|
|
3607
4811
|
RECLAIMING_SEND_REFUSALS,
|
|
4812
|
+
RELAY_REPROBE_BASE_DELAY_MS,
|
|
4813
|
+
RELAY_REPROBE_JITTER_RATIO,
|
|
4814
|
+
RELAY_REPROBE_MAX_DELAY_MS,
|
|
4815
|
+
RELEASE_ACTORS,
|
|
3608
4816
|
RELEASE_CHANNELS,
|
|
4817
|
+
RELEASE_EVENT_TYPES,
|
|
4818
|
+
RELEASE_LIMITS,
|
|
4819
|
+
RELEASE_MEMBER_STATES,
|
|
3609
4820
|
REMOVED_MESH_TOOLS,
|
|
3610
4821
|
RETIRED_MESH_TOOLS,
|
|
4822
|
+
REVIEW_CHECKED_MAX,
|
|
4823
|
+
REVIEW_CLAIM_MAX_CHARS,
|
|
4824
|
+
REVIEW_EVIDENCE_MAX_CHARS,
|
|
4825
|
+
REVIEW_FINDINGS_MAX,
|
|
4826
|
+
REVIEW_FINDING_ID_MAX_CHARS,
|
|
4827
|
+
REVIEW_FIX_MAX_CHARS,
|
|
4828
|
+
REVIEW_NOTE_MAX_CHARS,
|
|
4829
|
+
REVIEW_TESTS_RUN_MAX,
|
|
4830
|
+
REVIEW_VERDICTS,
|
|
4831
|
+
RelayReprobeScheduler,
|
|
3611
4832
|
SEND_POLICY_MODES,
|
|
3612
4833
|
SEND_REFUSAL_REASONS,
|
|
3613
4834
|
SERVER_STATUS_EVENT_NAMES,
|
|
@@ -3620,6 +4841,17 @@ export {
|
|
|
3620
4841
|
SESSION_STATUS_ALIASES,
|
|
3621
4842
|
SESSION_STATUS_CLASS,
|
|
3622
4843
|
SHARED_SESSION_TO_VIEWER_TYPES,
|
|
4844
|
+
STAGE_BLOCKED_REASONS,
|
|
4845
|
+
STAGE_DECIDE_ACTIONS,
|
|
4846
|
+
STAGE_DEFAULT_MAX_REVISIONS,
|
|
4847
|
+
STAGE_INDEPENDENCE_FALLBACK_MS,
|
|
4848
|
+
STAGE_INDEPENDENCE_MODES,
|
|
4849
|
+
STAGE_MAX_REVISIONS_LIMIT,
|
|
4850
|
+
STAGE_PARKED_PHASES,
|
|
4851
|
+
STAGE_PHASES,
|
|
4852
|
+
STAGE_PIPELINE_CEILING_DEFAULT_MS,
|
|
4853
|
+
STAGE_ROLES,
|
|
4854
|
+
STAGE_SELF_CHECK_MAX_BOUNCES,
|
|
3623
4855
|
STATUS_PROBE_ARG_KEY,
|
|
3624
4856
|
SUSPENSION_MODALS,
|
|
3625
4857
|
SUSPENSION_RESOLUTIONS,
|
|
@@ -3645,17 +4877,27 @@ export {
|
|
|
3645
4877
|
VERSION_UPDATE_REASONS,
|
|
3646
4878
|
VIEWER_TO_SHARED_SESSION_TYPES,
|
|
3647
4879
|
WORKER_BRANCH_STATES,
|
|
4880
|
+
WORKER_COMMITS_MAX,
|
|
4881
|
+
WORKER_CURRENT_BRANCH_RULE,
|
|
4882
|
+
WORKER_DECISIONS_NEEDED_MAX,
|
|
3648
4883
|
WORKER_PROTOCOL_FOOTER_MARKER,
|
|
3649
4884
|
WORKER_REPORT_OUTCOMES,
|
|
4885
|
+
WORKER_REPORT_SUMMARY_MAX_CHARS,
|
|
4886
|
+
WORKER_SHELL_LITERAL_PATHS_RULE,
|
|
3650
4887
|
WORKER_TOOLS,
|
|
4888
|
+
aggregateMissionGitState,
|
|
3651
4889
|
appendWorkerProtocolFooter,
|
|
3652
4890
|
argsCarryStatusProbeMarker,
|
|
3653
4891
|
assessQuotaFreshness,
|
|
4892
|
+
boundEventPayload,
|
|
3654
4893
|
buildSlotProposal,
|
|
3655
4894
|
canonicalDaemonId,
|
|
4895
|
+
changelogMissionMarker,
|
|
4896
|
+
classifyChangelogSection,
|
|
3656
4897
|
classifySessionStatus,
|
|
3657
4898
|
compareDashboardWireVersion,
|
|
3658
4899
|
compareSemver,
|
|
4900
|
+
computeRelayReprobeDelay,
|
|
3659
4901
|
daemonIdsEquivalent,
|
|
3660
4902
|
decodeActiveWorkQueryRequest,
|
|
3661
4903
|
decodeActiveWorkQueryResponse,
|
|
@@ -3698,6 +4940,8 @@ export {
|
|
|
3698
4940
|
decodeQueueQueryResponse,
|
|
3699
4941
|
decodeQueueRequeueRequest,
|
|
3700
4942
|
decodeQueueRequeueResponse,
|
|
4943
|
+
decodeQueueReviseRequest,
|
|
4944
|
+
decodeQueueReviseResponse,
|
|
3701
4945
|
decodeRecordLocalRequest,
|
|
3702
4946
|
decodeRecordLocalResponse,
|
|
3703
4947
|
decodeRecoveryContextQueryRequest,
|
|
@@ -3717,6 +4961,8 @@ export {
|
|
|
3717
4961
|
decodeUserSessionToDashboard,
|
|
3718
4962
|
decodeViewerToSharedSession,
|
|
3719
4963
|
defaultProviderPriorityFromNodeFacts,
|
|
4964
|
+
defaultStagePlan,
|
|
4965
|
+
deriveItemDedupeKey,
|
|
3720
4966
|
deriveProviderPriorityFromSlots,
|
|
3721
4967
|
deriveSlotsFromLegacy,
|
|
3722
4968
|
describeModelSelection,
|
|
@@ -3727,14 +4973,21 @@ export {
|
|
|
3727
4973
|
expandDaemonIdForms,
|
|
3728
4974
|
findOwnershipConflicts,
|
|
3729
4975
|
foldKeyedDoc,
|
|
4976
|
+
followedRemoteProjectKey,
|
|
4977
|
+
followerOpPermitted,
|
|
3730
4978
|
formatQuotaAccount,
|
|
4979
|
+
formatStageVerdictLine,
|
|
3731
4980
|
hasGitStatusEvidence,
|
|
3732
4981
|
hasWorkerProtocolFooter,
|
|
3733
4982
|
interpolateString,
|
|
3734
4983
|
isActionableProviderApproval,
|
|
4984
|
+
isAssistantFollowerAllowedOp,
|
|
3735
4985
|
isAssistantTool,
|
|
3736
4986
|
isBlockedStatus,
|
|
4987
|
+
isBlockingSeverity,
|
|
3737
4988
|
isBusyStatus,
|
|
4989
|
+
isCarryOverMissionRecord,
|
|
4990
|
+
isCarryOverMissionTitle,
|
|
3738
4991
|
isChunkType,
|
|
3739
4992
|
isCommitStrength,
|
|
3740
4993
|
isDaemonDirectCommandType,
|
|
@@ -3750,14 +5003,21 @@ export {
|
|
|
3750
5003
|
isDeadStatus,
|
|
3751
5004
|
isDowngrade,
|
|
3752
5005
|
isEvidenceIdentifier,
|
|
5006
|
+
isFindingCategory,
|
|
5007
|
+
isFindingResponseKind,
|
|
5008
|
+
isFindingSeverity,
|
|
3753
5009
|
isFiniteNumber,
|
|
3754
5010
|
isIdleSessionState,
|
|
3755
5011
|
isInputEnvelopeWire,
|
|
5012
|
+
isLaunchDefaultRole,
|
|
5013
|
+
isLaunchDefaultSource,
|
|
5014
|
+
isLightWorkerSession,
|
|
3756
5015
|
isMeshDeliveryMode,
|
|
3757
5016
|
isMeshIndexQueryResponse,
|
|
3758
5017
|
isMeshMissionStatusValue,
|
|
3759
5018
|
isMeshP2PSignalType,
|
|
3760
5019
|
isMeshRecordPayload,
|
|
5020
|
+
isMeshReleaseChannel,
|
|
3761
5021
|
isMeshTaskDifficulty,
|
|
3762
5022
|
isMeshTaskMode,
|
|
3763
5023
|
isMeshTaskPriority,
|
|
@@ -3765,6 +5025,8 @@ export {
|
|
|
3765
5025
|
isMeshTerminalTaskStatus,
|
|
3766
5026
|
isMeshTopicEntry,
|
|
3767
5027
|
isMessageId,
|
|
5028
|
+
isMissionOutcome,
|
|
5029
|
+
isMissionRefContained,
|
|
3768
5030
|
isMissionUpsertResponse,
|
|
3769
5031
|
isModelAxisSource,
|
|
3770
5032
|
isNativeMarkerRef,
|
|
@@ -3774,10 +5036,13 @@ export {
|
|
|
3774
5036
|
isOutboundMessageOrigin,
|
|
3775
5037
|
isP2PSignalType,
|
|
3776
5038
|
isPhantomDaemonEntry,
|
|
5039
|
+
isPriorFindingStatus,
|
|
3777
5040
|
isProviderQuestionBinding,
|
|
3778
5041
|
isRawDaemonDoId,
|
|
3779
5042
|
isReadyStatus,
|
|
3780
5043
|
isRecord,
|
|
5044
|
+
isReleaseStatus,
|
|
5045
|
+
isReviewVerdict,
|
|
3781
5046
|
isSendPolicy,
|
|
3782
5047
|
isSendPolicyMode,
|
|
3783
5048
|
isSendRefusal,
|
|
@@ -3786,6 +5051,8 @@ export {
|
|
|
3786
5051
|
isSessionLaunchedBy,
|
|
3787
5052
|
isSessionStatus,
|
|
3788
5053
|
isSharedSessionToViewerType,
|
|
5054
|
+
isStageBlockedReason,
|
|
5055
|
+
isStageEligibleTask,
|
|
3789
5056
|
isSubmitOutcome,
|
|
3790
5057
|
isSummaryRef,
|
|
3791
5058
|
isTerminalSessionRecordStatus,
|
|
@@ -3804,6 +5071,7 @@ export {
|
|
|
3804
5071
|
isWorkingStatus,
|
|
3805
5072
|
joinRepoPath,
|
|
3806
5073
|
launchModelSelectionValue,
|
|
5074
|
+
lintChangelogText,
|
|
3807
5075
|
machineCoreFromDaemonId,
|
|
3808
5076
|
makeTypeGuard,
|
|
3809
5077
|
measureWorstCaseChunkEnvelopeBytes,
|
|
@@ -3815,20 +5083,29 @@ export {
|
|
|
3815
5083
|
minutesUntilQuotaCheck,
|
|
3816
5084
|
normalizeAuthOkLimits,
|
|
3817
5085
|
normalizeBrainSlot,
|
|
5086
|
+
normalizeDecisionInput,
|
|
3818
5087
|
normalizeDifficultyBrainMap,
|
|
5088
|
+
normalizeForDedupe,
|
|
3819
5089
|
normalizeGitStatus,
|
|
3820
5090
|
normalizeMeshNodeFacts,
|
|
3821
5091
|
normalizeMeshNodeId,
|
|
3822
5092
|
normalizeMeshSessionRecord,
|
|
3823
5093
|
normalizeMeshWorkspaceForCompare,
|
|
3824
5094
|
normalizeMissionBrief,
|
|
5095
|
+
normalizeMissionItemInput,
|
|
5096
|
+
normalizeMissionItemUpdate,
|
|
5097
|
+
normalizeMissionRefs,
|
|
5098
|
+
normalizeMissionSummary,
|
|
3825
5099
|
normalizeNodeCapabilitySlot,
|
|
3826
5100
|
normalizeNodeCapabilitySlots,
|
|
5101
|
+
normalizeOutcomeReason,
|
|
3827
5102
|
normalizeOwnedPaths,
|
|
5103
|
+
normalizeReportCommits,
|
|
3828
5104
|
normalizeSessionStatus,
|
|
3829
5105
|
normalizeThinkingLevel,
|
|
3830
5106
|
orderProvidersByBuiltinPreference,
|
|
3831
5107
|
parseJsonRecord,
|
|
5108
|
+
parseRoleLaunchSelection,
|
|
3832
5109
|
parseSemver,
|
|
3833
5110
|
parseSessionLaunchRecord,
|
|
3834
5111
|
pathsOverlap,
|
|
@@ -3847,11 +5124,17 @@ export {
|
|
|
3847
5124
|
readStringArray,
|
|
3848
5125
|
readText,
|
|
3849
5126
|
renderCoordinatorWorkerSection,
|
|
5127
|
+
renderLightWorkspaceRules,
|
|
3850
5128
|
renderMissionBriefBlock,
|
|
5129
|
+
renderStageProtocolLines,
|
|
3851
5130
|
renderWorkerProtocolFooter,
|
|
5131
|
+
resolveStagePlan,
|
|
3852
5132
|
retiredMeshToolError,
|
|
5133
|
+
reviewIndependenceOf,
|
|
5134
|
+
sanitizeDispatchRefusalDetail,
|
|
3853
5135
|
sanitizeModelIdentifier,
|
|
3854
5136
|
sanitizeRefusalCode,
|
|
5137
|
+
sanitizeRemoteRepoIdentity,
|
|
3855
5138
|
scoreGitStatusCandidate,
|
|
3856
5139
|
scoreGitUpstreamFreshness,
|
|
3857
5140
|
sessionIdsEquivalent,
|
|
@@ -3862,6 +5145,11 @@ export {
|
|
|
3862
5145
|
summarizeGitShape,
|
|
3863
5146
|
supportsQuota,
|
|
3864
5147
|
touchedFilesOutsideOwnership,
|
|
5148
|
+
truncateMissionText,
|
|
5149
|
+
unwrapPastedContent,
|
|
5150
|
+
validateFindingResponses,
|
|
5151
|
+
validateReviewReport,
|
|
5152
|
+
validateTestsRun,
|
|
3865
5153
|
withStatusProbeMarker
|
|
3866
5154
|
};
|
|
3867
5155
|
//# sourceMappingURL=index.mjs.map
|