@adhdev/mesh-shared 1.0.82-rc.13 → 1.0.82-rc.130
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 +1524 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1391 -110
- 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 +6 -4
- package/dist/mission-git-state.d.ts +83 -0
- package/dist/mission-items.d.ts +202 -0
- package/dist/node-facts.d.ts +35 -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 +26 -8
- 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 +4 -2
- package/src/mission-git-state.ts +112 -0
- package/src/mission-items.ts +421 -0
- package/src/node-facts.ts +35 -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 +22 -11
- 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 +42 -4
- 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",
|
|
@@ -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,15 +1494,15 @@ 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"];
|
|
@@ -1505,6 +1576,7 @@ var SEND_REFUSAL_REASONS = [
|
|
|
1505
1576
|
"no_target",
|
|
1506
1577
|
"bootstrap_pending",
|
|
1507
1578
|
"duplicate_dispatch",
|
|
1579
|
+
"new_work_held",
|
|
1508
1580
|
"internal_error"
|
|
1509
1581
|
];
|
|
1510
1582
|
function isSendRefusal(value) {
|
|
@@ -1536,6 +1608,14 @@ function isOutboundMessage(value) {
|
|
|
1536
1608
|
const candidate = value;
|
|
1537
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";
|
|
1538
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
|
+
}
|
|
1539
1619
|
|
|
1540
1620
|
// src/mission-brief.ts
|
|
1541
1621
|
var GOAL_MAX = 500;
|
|
@@ -1621,13 +1701,39 @@ var WORKER_TOOLS = [
|
|
|
1621
1701
|
"peer_context_pull",
|
|
1622
1702
|
"git_status",
|
|
1623
1703
|
"git_log",
|
|
1624
|
-
"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"
|
|
1625
1720
|
];
|
|
1626
1721
|
var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
|
|
1627
1722
|
function isWorkerTool(value) {
|
|
1628
1723
|
return typeof value === "string" && WORKER_TOOL_SET.has(value);
|
|
1629
1724
|
}
|
|
1630
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.";
|
|
1631
1737
|
function hasWorkerProtocolFooter(body) {
|
|
1632
1738
|
return typeof body === "string" && body.includes(WORKER_PROTOCOL_FOOTER_MARKER);
|
|
1633
1739
|
}
|
|
@@ -1649,6 +1755,9 @@ function renderWorkerProtocolFooter(input = {}) {
|
|
|
1649
1755
|
if (input.readonly) scope.push("read-only");
|
|
1650
1756
|
if (scope.length) lines.push(`You are a delegated worker (${scope.join(", ")}).`);
|
|
1651
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);
|
|
1652
1761
|
if (input.workerMcp === false) {
|
|
1653
1762
|
lines.push(
|
|
1654
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.",
|
|
@@ -1668,15 +1777,30 @@ function renderWorkerProtocolFooter(input = {}) {
|
|
|
1668
1777
|
"Memos from the coordinator arrive appended to the response of whichever worker tool you call next; read them and follow them.",
|
|
1669
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`.",
|
|
1670
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 `[]`.",
|
|
1671
|
-
"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."
|
|
1672
1783
|
);
|
|
1673
1784
|
if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
|
|
1674
1785
|
lines.push(
|
|
1675
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.`
|
|
1676
1787
|
);
|
|
1677
1788
|
}
|
|
1789
|
+
if (input.stage) lines.push(...renderStageProtocolLines(input.stage));
|
|
1678
1790
|
return lines.join("\n");
|
|
1679
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
|
+
}
|
|
1680
1804
|
function stripWorkerProtocolFooter(body) {
|
|
1681
1805
|
if (typeof body !== "string") return body;
|
|
1682
1806
|
const at = body.indexOf(WORKER_PROTOCOL_FOOTER_MARKER);
|
|
@@ -1713,11 +1837,23 @@ var ASSISTANT_TOOLS = [
|
|
|
1713
1837
|
"project_send",
|
|
1714
1838
|
"project_read",
|
|
1715
1839
|
"project_add",
|
|
1840
|
+
"project_attach_remote",
|
|
1716
1841
|
"discover_repos",
|
|
1717
1842
|
"memory",
|
|
1843
|
+
"memory_search",
|
|
1718
1844
|
"skill_view",
|
|
1719
1845
|
"skill_manage",
|
|
1720
|
-
"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"
|
|
1721
1857
|
];
|
|
1722
1858
|
var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
|
|
1723
1859
|
function isAssistantTool(value) {
|
|
@@ -1725,6 +1861,8 @@ function isAssistantTool(value) {
|
|
|
1725
1861
|
}
|
|
1726
1862
|
var ASSISTANT_VERB = {
|
|
1727
1863
|
// tool verbs
|
|
1864
|
+
driverList: "driver_list",
|
|
1865
|
+
driverDescribe: "driver_describe",
|
|
1728
1866
|
projects: "assistant_projects",
|
|
1729
1867
|
environment: "assistant_environment",
|
|
1730
1868
|
action: "assistant_action",
|
|
@@ -1735,20 +1873,46 @@ var ASSISTANT_VERB = {
|
|
|
1735
1873
|
projectSend: "assistant_project_send",
|
|
1736
1874
|
projectRead: "assistant_project_read",
|
|
1737
1875
|
projectAdd: "assistant_project_add",
|
|
1876
|
+
projectAttachRemote: "assistant_project_attach_remote",
|
|
1738
1877
|
discoverRepos: "assistant_discover_repos",
|
|
1739
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",
|
|
1740
1881
|
skillView: "assistant_skill_view",
|
|
1741
1882
|
skillManage: "assistant_skill_manage",
|
|
1742
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",
|
|
1743
1896
|
// assistant-side daemon verbs without a tool of the same name
|
|
1744
1897
|
launch: "launch_assistant",
|
|
1745
1898
|
pendingRelays: "assistant_pending_relays",
|
|
1746
1899
|
// owner verbs (dashboard only)
|
|
1747
1900
|
stagedResolve: "assistant_staged_resolve",
|
|
1748
1901
|
storeAdmin: "assistant_store_admin",
|
|
1749
|
-
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"
|
|
1750
1912
|
};
|
|
1751
1913
|
var ASSISTANT_TOOL_VERBS = {
|
|
1914
|
+
driver_list: ASSISTANT_VERB.driverList,
|
|
1915
|
+
driver_describe: ASSISTANT_VERB.driverDescribe,
|
|
1752
1916
|
projects: ASSISTANT_VERB.projects,
|
|
1753
1917
|
environment: ASSISTANT_VERB.environment,
|
|
1754
1918
|
assistant_action: ASSISTANT_VERB.action,
|
|
@@ -1757,27 +1921,110 @@ var ASSISTANT_TOOL_VERBS = {
|
|
|
1757
1921
|
project_send: ASSISTANT_VERB.projectSend,
|
|
1758
1922
|
project_read: ASSISTANT_VERB.projectRead,
|
|
1759
1923
|
project_add: ASSISTANT_VERB.projectAdd,
|
|
1924
|
+
project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
|
|
1760
1925
|
discover_repos: ASSISTANT_VERB.discoverRepos,
|
|
1761
1926
|
memory: ASSISTANT_VERB.memory,
|
|
1927
|
+
memory_search: ASSISTANT_VERB.memorySearch,
|
|
1762
1928
|
skill_view: ASSISTANT_VERB.skillView,
|
|
1763
1929
|
skill_manage: ASSISTANT_VERB.skillManage,
|
|
1764
|
-
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
|
|
1765
1939
|
};
|
|
1766
|
-
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"];
|
|
1767
1941
|
var ASSISTANT_OWNER_VERBS = [
|
|
1768
1942
|
ASSISTANT_VERB.executionSettings,
|
|
1769
1943
|
ASSISTANT_VERB.stagedResolve,
|
|
1770
1944
|
ASSISTANT_VERB.storeAdmin,
|
|
1771
|
-
ASSISTANT_VERB.importSkills
|
|
1945
|
+
ASSISTANT_VERB.importSkills,
|
|
1946
|
+
ASSISTANT_VERB.skillsList,
|
|
1947
|
+
ASSISTANT_VERB.memoryDigest,
|
|
1948
|
+
ASSISTANT_VERB.memoryUndo,
|
|
1949
|
+
ASSISTANT_VERB.threadClose
|
|
1772
1950
|
];
|
|
1773
1951
|
var ASSISTANT_REVIEW_TURN_VERBS = [
|
|
1774
1952
|
ASSISTANT_VERB.memory,
|
|
1953
|
+
ASSISTANT_VERB.memorySearch,
|
|
1775
1954
|
ASSISTANT_VERB.skillView,
|
|
1776
1955
|
ASSISTANT_VERB.skillManage,
|
|
1777
1956
|
ASSISTANT_VERB.projectNote
|
|
1778
1957
|
];
|
|
1779
1958
|
var ASSISTANT_SESSION_ID_ENV = "ADHDEV_ASSISTANT_SESSION_ID";
|
|
1780
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
|
+
}
|
|
1781
2028
|
|
|
1782
2029
|
// src/turn-evidence.ts
|
|
1783
2030
|
var MESH_TOPIC_PROTOCOL_VERSION = 2;
|
|
@@ -1813,13 +2060,24 @@ var TURN_SCOPES = ["mesh_queue", "mesh_direct", "plain"];
|
|
|
1813
2060
|
var RECLAIMING_SEND_REFUSALS = ["session_exited", "no_target", "unsupported_input"];
|
|
1814
2061
|
var DELIVERY_OUTCOMES = ["delivered", "queued"];
|
|
1815
2062
|
var DELIVERY_VIAS = ["local", "p2p"];
|
|
1816
|
-
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"];
|
|
1817
2064
|
function sanitizeRefusalCode(value) {
|
|
1818
2065
|
if (typeof value !== "string") return void 0;
|
|
1819
2066
|
const normalized = value.trim().toLowerCase().replace(/[^a-z_]/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
|
|
1820
2067
|
if (!normalized) return void 0;
|
|
1821
2068
|
return normalized.slice(0, 64);
|
|
1822
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
|
+
}
|
|
1823
2081
|
var CONSUME_PROFILES = ["default", "native_source"];
|
|
1824
2082
|
var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
|
|
1825
2083
|
var SUSPENSION_MODALS = ["approval", "choice"];
|
|
@@ -1862,9 +2120,12 @@ var HOLD_REASONS = [
|
|
|
1862
2120
|
// a session whose FSM never shows the idle edge again does not wait for
|
|
1863
2121
|
// liveness / hard_ceiling.
|
|
1864
2122
|
"await_end",
|
|
1865
|
-
"report_correction"
|
|
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"
|
|
1866
2127
|
];
|
|
1867
|
-
var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
|
|
2128
|
+
var TURN_OUTCOMES = ["completed", "blocked", "failed", "cancelled"];
|
|
1868
2129
|
var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
|
|
1869
2130
|
var TURN_REASONS = [
|
|
1870
2131
|
// commits
|
|
@@ -1876,6 +2137,7 @@ var TURN_REASONS = [
|
|
|
1876
2137
|
"weak_end_liveness_unconfirmed",
|
|
1877
2138
|
"weak_end_probe_unobserved",
|
|
1878
2139
|
"report_correction_expired",
|
|
2140
|
+
"report_missing_timeout",
|
|
1879
2141
|
"session_error",
|
|
1880
2142
|
"provider_auth_failed",
|
|
1881
2143
|
"provider_billing_failed",
|
|
@@ -1894,6 +2156,8 @@ var TURN_REASONS = [
|
|
|
1894
2156
|
"reclaim_budget_exhausted",
|
|
1895
2157
|
"hollow_max_retries",
|
|
1896
2158
|
"migration_orphan",
|
|
2159
|
+
// a stopping attempt whose writer node stayed unreachable (or was removed) past the bound
|
|
2160
|
+
"writer_unreachable",
|
|
1897
2161
|
// reclaims (generation + 1)
|
|
1898
2162
|
"dispatch_refused_session_exited",
|
|
1899
2163
|
"dispatch_refused_no_target",
|
|
@@ -1905,10 +2169,13 @@ var TURN_REASONS = [
|
|
|
1905
2169
|
"hollow_completion",
|
|
1906
2170
|
"assigned_stranded_dispatch_unconfirmed",
|
|
1907
2171
|
"delivered_not_consumed_redrive",
|
|
1908
|
-
"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"
|
|
1909
2175
|
];
|
|
1910
2176
|
var NOTIFY_KINDS = [
|
|
1911
2177
|
"completed",
|
|
2178
|
+
"blocked",
|
|
1912
2179
|
"failed",
|
|
1913
2180
|
"cancelled",
|
|
1914
2181
|
"stopped",
|
|
@@ -2164,17 +2431,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
|
|
|
2164
2431
|
};
|
|
2165
2432
|
}
|
|
2166
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
|
+
|
|
2167
2503
|
// src/session-launch.ts
|
|
2168
2504
|
var MODEL_AXIS_SOURCES = [
|
|
2169
2505
|
/** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
|
|
2170
2506
|
"user",
|
|
2171
2507
|
/** The dashboard dialog restored it from the last launch (browser-local memory). */
|
|
2172
2508
|
"remembered",
|
|
2509
|
+
/** The authoritative daemon role default or host project override. */
|
|
2510
|
+
"stored_default",
|
|
2511
|
+
"project_default",
|
|
2173
2512
|
/** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
|
|
2174
2513
|
"mesh_slot",
|
|
2175
2514
|
/** An explicit per-task model / thinking level on a mesh queue task. */
|
|
2176
2515
|
"task_override",
|
|
2177
|
-
/** Nothing
|
|
2516
|
+
/** Nothing requested: the provider chooses; resolvedDefault records it when known. */
|
|
2178
2517
|
"provider_default",
|
|
2179
2518
|
/** A value was requested without saying where it came from, or nothing is known. */
|
|
2180
2519
|
"unspecified"
|
|
@@ -2218,10 +2557,10 @@ function readFiniteNumber(value) {
|
|
|
2218
2557
|
}
|
|
2219
2558
|
function parseModelSelection(raw) {
|
|
2220
2559
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2221
|
-
const
|
|
2560
|
+
const record2 = raw;
|
|
2222
2561
|
const history = [];
|
|
2223
|
-
if (Array.isArray(
|
|
2224
|
-
for (const entry of
|
|
2562
|
+
if (Array.isArray(record2.history)) {
|
|
2563
|
+
for (const entry of record2.history) {
|
|
2225
2564
|
if (!entry || typeof entry !== "object") continue;
|
|
2226
2565
|
const e = entry;
|
|
2227
2566
|
const value = readString(e.value);
|
|
@@ -2230,41 +2569,45 @@ function parseModelSelection(raw) {
|
|
|
2230
2569
|
if (value && at !== void 0 && via) history.push({ at, value, via });
|
|
2231
2570
|
}
|
|
2232
2571
|
}
|
|
2233
|
-
const requested = readString(
|
|
2234
|
-
const launchValue = readString(
|
|
2235
|
-
const resolvedDefault = readString(
|
|
2236
|
-
const current = readString(
|
|
2237
|
-
const observed = readString(
|
|
2238
|
-
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;
|
|
2239
2579
|
return {
|
|
2240
|
-
source: isModelAxisSource(
|
|
2580
|
+
source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
|
|
2241
2581
|
...requested ? { requested } : {},
|
|
2242
2582
|
...launchValue ? { launchValue } : {},
|
|
2243
2583
|
...resolvedDefault ? { resolvedDefault } : {},
|
|
2244
2584
|
...current ? { current } : {},
|
|
2245
2585
|
...observed ? { observed } : {},
|
|
2246
2586
|
...observedAt !== void 0 ? { observedAt } : {},
|
|
2587
|
+
...fallback ? { fallback } : {},
|
|
2247
2588
|
history: history.slice(-MODEL_SELECTION_HISTORY_LIMIT)
|
|
2248
2589
|
};
|
|
2249
2590
|
}
|
|
2250
2591
|
function parseSessionLaunchRecord(raw) {
|
|
2251
2592
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2252
|
-
const
|
|
2253
|
-
const sessionId = readString(
|
|
2254
|
-
const providerType = readString(
|
|
2255
|
-
const launchedAt = readFiniteNumber(
|
|
2256
|
-
const model = parseModelSelection(
|
|
2257
|
-
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);
|
|
2258
2599
|
if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
|
|
2259
|
-
const providerVersion = readString(
|
|
2260
|
-
const workspace = readString(
|
|
2261
|
-
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);
|
|
2262
2604
|
return {
|
|
2605
|
+
...roleLaunch ? { roleLaunch } : {},
|
|
2263
2606
|
sessionId,
|
|
2264
2607
|
providerType,
|
|
2265
2608
|
...providerVersion ? { providerVersion } : {},
|
|
2266
|
-
...
|
|
2267
|
-
launchedBy: isSessionLaunchedBy(
|
|
2609
|
+
...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
|
|
2610
|
+
launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
|
|
2268
2611
|
launchedAt,
|
|
2269
2612
|
...workspace ? { workspace } : {},
|
|
2270
2613
|
model,
|
|
@@ -2328,7 +2671,7 @@ function isTurnAttemptRefValue(value) {
|
|
|
2328
2671
|
function isTurnObserveResponse(value) {
|
|
2329
2672
|
return isRecord(value) && hasOnlyKeys2(value, ["verdict", "attemptRef", "outcome"]) && isTurnObserveVerdict(value.verdict) && isTurnAttemptRefValue(value.attemptRef) && (value.outcome === void 0 || isTurnOutcomeValue(value.outcome));
|
|
2330
2673
|
}
|
|
2331
|
-
var TURN_OUTCOMES_LOCAL = ["completed", "failed", "cancelled"];
|
|
2674
|
+
var TURN_OUTCOMES_LOCAL = ["completed", "blocked", "failed", "cancelled"];
|
|
2332
2675
|
function isTurnOutcomeValue(value) {
|
|
2333
2676
|
return typeof value === "string" && TURN_OUTCOMES_LOCAL.includes(value);
|
|
2334
2677
|
}
|
|
@@ -2554,8 +2897,23 @@ function isMissionBriefWire(value) {
|
|
|
2554
2897
|
}
|
|
2555
2898
|
return true;
|
|
2556
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
|
+
}
|
|
2557
2914
|
function isMeshMissionRecordWire(value) {
|
|
2558
|
-
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;
|
|
2559
2917
|
if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
|
|
2560
2918
|
if (typeof value.title !== "string" || typeof value.goal !== "string") return false;
|
|
2561
2919
|
if (!isMeshMissionStatusValue(value.status)) return false;
|
|
@@ -2563,11 +2921,22 @@ function isMeshMissionRecordWire(value) {
|
|
|
2563
2921
|
return true;
|
|
2564
2922
|
}
|
|
2565
2923
|
function isMissionUpsertRequest(value) {
|
|
2566
|
-
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;
|
|
2567
2925
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
|
|
2568
2926
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
2569
2927
|
if (value.id !== void 0 && !isEvidenceIdentifier(value.id)) return false;
|
|
2570
|
-
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
|
+
}
|
|
2571
2940
|
if (value.goal !== void 0 && typeof value.goal !== "string") return false;
|
|
2572
2941
|
if (value.status !== void 0 && !isMeshMissionStatusValue(value.status)) return false;
|
|
2573
2942
|
if (value.brief !== void 0 && value.brief !== null && !isMissionBriefWire(value.brief)) return false;
|
|
@@ -2577,7 +2946,7 @@ function decodeMissionUpsertRequest(value) {
|
|
|
2577
2946
|
return isMissionUpsertRequest(value) ? value : null;
|
|
2578
2947
|
}
|
|
2579
2948
|
function isMissionUpsertResponse(value) {
|
|
2580
|
-
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));
|
|
2581
2950
|
}
|
|
2582
2951
|
function decodeMissionUpsertResponse(value) {
|
|
2583
2952
|
return isMissionUpsertResponse(value) ? value : null;
|
|
@@ -2603,7 +2972,10 @@ function decodeMissionQueryResponse(value) {
|
|
|
2603
2972
|
return isMissionQueryResponse(value) ? value : null;
|
|
2604
2973
|
}
|
|
2605
2974
|
function isMissionListQueryRequest(value) {
|
|
2606
|
-
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
|
+
}
|
|
2607
2979
|
if (value.meshStatusView !== void 0 && value.meshStatusView !== "compact" && value.meshStatusView !== "verbose") return false;
|
|
2608
2980
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
|
|
2609
2981
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
@@ -2629,12 +3001,13 @@ function isMeshMissionTaskAggregateWire(value) {
|
|
|
2629
3001
|
return value.lastActivityAt === null || typeof value.lastActivityAt === "string";
|
|
2630
3002
|
}
|
|
2631
3003
|
function isMeshMissionStatsWire(value) {
|
|
2632
|
-
const keys = ["missionId", "taskCount", "completed", "failed", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
|
|
3004
|
+
const keys = ["missionId", "taskCount", "completed", "failed", "blocked", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
|
|
2633
3005
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
2634
3006
|
if (!isEvidenceIdentifier(value.missionId)) return false;
|
|
2635
3007
|
for (const k of ["taskCount", "completed", "failed", "totalDurationMs", "retries"]) {
|
|
2636
3008
|
if (!isNonNegativeInt(value[k])) return false;
|
|
2637
3009
|
}
|
|
3010
|
+
if (value.blocked !== void 0 && !isNonNegativeInt(value.blocked)) return false;
|
|
2638
3011
|
if (value.wallClockMs !== null && !isNonNegativeInt(value.wallClockMs)) return false;
|
|
2639
3012
|
if (!Array.isArray(value.incompleteTaskIds) || !value.incompleteTaskIds.every(isEvidenceIdentifier)) return false;
|
|
2640
3013
|
return true;
|
|
@@ -2644,7 +3017,7 @@ function isMissionListSummaryWire(value) {
|
|
|
2644
3017
|
const hasGoal = "goal" in value;
|
|
2645
3018
|
const hasPreview = "goalPreview" in value && "goalTruncated" in value;
|
|
2646
3019
|
if (hasGoal === hasPreview) return false;
|
|
2647
|
-
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"];
|
|
2648
3021
|
const allowed = hasGoal ? [...baseKeys, "goal"] : [...baseKeys, "goalPreview", "goalTruncated"];
|
|
2649
3022
|
if (!hasOnlyKeys2(value, allowed)) return false;
|
|
2650
3023
|
if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
|
|
@@ -2658,6 +3031,10 @@ function isMissionListSummaryWire(value) {
|
|
|
2658
3031
|
if (value.createdAt !== void 0 && typeof value.createdAt !== "string") return false;
|
|
2659
3032
|
if (value.updatedAt !== void 0 && typeof value.updatedAt !== "string") return false;
|
|
2660
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
|
+
}
|
|
2661
3038
|
return true;
|
|
2662
3039
|
}
|
|
2663
3040
|
function isMeshMissionHistoryFoldWire(value) {
|
|
@@ -2756,12 +3133,15 @@ function isLedgerQueryEntryWire(value) {
|
|
|
2756
3133
|
return true;
|
|
2757
3134
|
}
|
|
2758
3135
|
function isLedgerQuerySummaryWire(value) {
|
|
2759
|
-
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"];
|
|
2760
3137
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
2761
3138
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
2762
3139
|
for (const k of ["totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "recentFailures"]) {
|
|
2763
3140
|
if (!isNonNegativeInt(value[k])) return false;
|
|
2764
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;
|
|
2765
3145
|
if (value.lastActivityAt !== null && typeof value.lastActivityAt !== "string") return false;
|
|
2766
3146
|
return true;
|
|
2767
3147
|
}
|
|
@@ -2805,9 +3185,10 @@ function isQueueDependencyHeadWire(value) {
|
|
|
2805
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");
|
|
2806
3186
|
}
|
|
2807
3187
|
function isQueueQueryResponse(value) {
|
|
2808
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "dependencyHeads"])) return false;
|
|
3188
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "legacyReportedBlockedCount", "dependencyHeads"])) return false;
|
|
2809
3189
|
if (!Array.isArray(value.entries) || !value.entries.every(isQueueEntryWire)) return false;
|
|
2810
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;
|
|
2811
3192
|
if (value.oldHistoricalCount !== void 0 && !isNonNegativeInt(value.oldHistoricalCount)) return false;
|
|
2812
3193
|
if (value.dependencyHeads !== void 0 && (!Array.isArray(value.dependencyHeads) || !value.dependencyHeads.every(isQueueDependencyHeadWire))) return false;
|
|
2813
3194
|
return true;
|
|
@@ -2865,7 +3246,7 @@ function decodeQueueRequeueRequest(value) {
|
|
|
2865
3246
|
return isQueueRequeueRequest(value) ? value : null;
|
|
2866
3247
|
}
|
|
2867
3248
|
function isQueueRequeueResponse(value) {
|
|
2868
|
-
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");
|
|
2869
3250
|
}
|
|
2870
3251
|
function decodeQueueRequeueResponse(value) {
|
|
2871
3252
|
return isQueueRequeueResponse(value) ? value : null;
|
|
@@ -2929,6 +3310,24 @@ function isRecoveryContextQueryResponse(value) {
|
|
|
2929
3310
|
function decodeRecoveryContextQueryResponse(value) {
|
|
2930
3311
|
return isRecoveryContextQueryResponse(value) ? value : null;
|
|
2931
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;
|
|
2932
3331
|
|
|
2933
3332
|
// src/turn-ipc-stats.ts
|
|
2934
3333
|
function isTaskStatsQueryRequest(value) {
|
|
@@ -3027,6 +3426,7 @@ var TURN_IPC_COMMANDS = [
|
|
|
3027
3426
|
"queue_enqueue_batch",
|
|
3028
3427
|
"queue_cancel",
|
|
3029
3428
|
"queue_requeue",
|
|
3429
|
+
"queue_revise",
|
|
3030
3430
|
"direct_dispatch_record",
|
|
3031
3431
|
"active_work_query",
|
|
3032
3432
|
"recovery_context_query",
|
|
@@ -3166,6 +3566,357 @@ function touchedFilesOutsideOwnership(touched, owned) {
|
|
|
3166
3566
|
return { undeclaredTouched, unusedDeclarations };
|
|
3167
3567
|
}
|
|
3168
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
|
+
|
|
3169
3920
|
// src/keyed-doc-delta.ts
|
|
3170
3921
|
function sig(value) {
|
|
3171
3922
|
if (value === void 0) return void 0;
|
|
@@ -3528,8 +4279,411 @@ function isProviderQuestionBinding(value) {
|
|
|
3528
4279
|
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
3529
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);
|
|
3530
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
|
+
}
|
|
3531
4679
|
export {
|
|
4680
|
+
ASSISTANT_ACCOUNT_SLOT,
|
|
4681
|
+
ASSISTANT_FOLLOWER_ALLOWED_OPS,
|
|
3532
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,
|
|
3533
4687
|
ASSISTANT_REVIEW_TURN_VERBS,
|
|
3534
4688
|
ASSISTANT_SESSION_ID_ARG,
|
|
3535
4689
|
ASSISTANT_SESSION_ID_ENV,
|
|
@@ -3541,12 +4695,16 @@ export {
|
|
|
3541
4695
|
CANCEL_REASONS,
|
|
3542
4696
|
CANONICAL_MESH_TOOL_COUNT,
|
|
3543
4697
|
CANONICAL_MESH_TOOL_NAMES,
|
|
4698
|
+
CARRY_OVER_MISSION_GOAL,
|
|
4699
|
+
CARRY_OVER_MISSION_TITLE,
|
|
4700
|
+
CHANGELOG_SECTIONS,
|
|
3544
4701
|
CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX,
|
|
3545
4702
|
CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX,
|
|
3546
4703
|
CLI_SLOT_RECIPES,
|
|
3547
4704
|
COMMIT_STRENGTHS,
|
|
3548
4705
|
CONSUME_PROFILES,
|
|
3549
4706
|
COORDINATOR_ACK_OUTCOMES,
|
|
4707
|
+
COORDINATOR_SETTABLE_ITEM_STATES,
|
|
3550
4708
|
DAEMON_METADATA_DOC_SPEC,
|
|
3551
4709
|
DAEMON_P2P_SIGNAL_TYPES,
|
|
3552
4710
|
DAEMON_STATUS_EVENT_NAMES,
|
|
@@ -3559,13 +4717,34 @@ export {
|
|
|
3559
4717
|
DASHBOARD_TO_DAEMON_P2P_TYPES,
|
|
3560
4718
|
DASHBOARD_TO_USER_SESSION_TYPES,
|
|
3561
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,
|
|
3562
4725
|
DEFAULT_DIFFICULTY_BRAINS,
|
|
3563
4726
|
DELIVERY_OUTCOMES,
|
|
3564
4727
|
DELIVERY_VIAS,
|
|
3565
4728
|
DISPATCH_FAILURE_REASONS,
|
|
4729
|
+
DISPATCH_REFUSAL_DETAIL_MAX,
|
|
3566
4730
|
EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
3567
4731
|
EVIDENCE_SOURCE_IDS,
|
|
4732
|
+
FINDING_CATEGORIES,
|
|
4733
|
+
FINDING_RESPONSES_MAX,
|
|
4734
|
+
FINDING_RESPONSE_KINDS,
|
|
4735
|
+
FINDING_SEVERITIES,
|
|
3568
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,
|
|
3569
4748
|
LIVENESS_RESULTS,
|
|
3570
4749
|
MAX_MESH_RECORD_STRING,
|
|
3571
4750
|
MAX_OWNED_PATHS,
|
|
@@ -3580,6 +4759,8 @@ export {
|
|
|
3580
4759
|
MESH_MISSION_STATUSES,
|
|
3581
4760
|
MESH_P2P_SIGNAL_TYPES,
|
|
3582
4761
|
MESH_RECORD_PAYLOAD_KEYS,
|
|
4762
|
+
MESH_RELEASE_CHANNELS,
|
|
4763
|
+
MESH_RELEASE_STATUSES,
|
|
3583
4764
|
MESH_SESSION_CLEANUP_MODES,
|
|
3584
4765
|
MESH_STATUS_DOC_SPEC,
|
|
3585
4766
|
MESH_TASK_DIFFICULTIES,
|
|
@@ -3591,10 +4772,23 @@ export {
|
|
|
3591
4772
|
MESH_TOPIC_ENTRY_KINDS,
|
|
3592
4773
|
MESH_TOPIC_PROTOCOL_VERSION,
|
|
3593
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,
|
|
3594
4787
|
MODEL_AXIS_SOURCES,
|
|
3595
4788
|
MODEL_SELECTION_HISTORY_LIMIT,
|
|
3596
4789
|
MeshChunkAssembler,
|
|
3597
4790
|
NATIVE_TURN_OUTCOMES,
|
|
4791
|
+
NEEDS_WORDING_MARKER,
|
|
3598
4792
|
NOTIFY_KINDS,
|
|
3599
4793
|
NO_PROGRESS_OBSERVED_STATUSES,
|
|
3600
4794
|
NPM_UPDATE_TAGS,
|
|
@@ -3604,16 +4798,37 @@ export {
|
|
|
3604
4798
|
OPERATOR_STATUS_REASON_VALUES,
|
|
3605
4799
|
OPERATOR_STATUS_VALUES,
|
|
3606
4800
|
OUTBOUND_MESSAGE_ORIGINS,
|
|
4801
|
+
OWNER_ABANDON_CONFIRM_KEY_PREFIX,
|
|
4802
|
+
OWNER_ABANDON_CONFIRM_OPTIONS,
|
|
4803
|
+
OWNER_ABANDON_CONFIRM_QUESTION,
|
|
3607
4804
|
P2P_SIGNAL_TYPES,
|
|
4805
|
+
PRIOR_FINDING_STATUSES,
|
|
3608
4806
|
PROVIDER_FAILURES,
|
|
3609
4807
|
QUOTA_BACKFILL_HORIZON_MS,
|
|
3610
4808
|
QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
3611
4809
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
3612
4810
|
RECENT_SESSION_BUCKETS,
|
|
3613
4811
|
RECLAIMING_SEND_REFUSALS,
|
|
4812
|
+
RELAY_REPROBE_BASE_DELAY_MS,
|
|
4813
|
+
RELAY_REPROBE_JITTER_RATIO,
|
|
4814
|
+
RELAY_REPROBE_MAX_DELAY_MS,
|
|
4815
|
+
RELEASE_ACTORS,
|
|
3614
4816
|
RELEASE_CHANNELS,
|
|
4817
|
+
RELEASE_EVENT_TYPES,
|
|
4818
|
+
RELEASE_LIMITS,
|
|
4819
|
+
RELEASE_MEMBER_STATES,
|
|
3615
4820
|
REMOVED_MESH_TOOLS,
|
|
3616
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,
|
|
3617
4832
|
SEND_POLICY_MODES,
|
|
3618
4833
|
SEND_REFUSAL_REASONS,
|
|
3619
4834
|
SERVER_STATUS_EVENT_NAMES,
|
|
@@ -3626,6 +4841,17 @@ export {
|
|
|
3626
4841
|
SESSION_STATUS_ALIASES,
|
|
3627
4842
|
SESSION_STATUS_CLASS,
|
|
3628
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,
|
|
3629
4855
|
STATUS_PROBE_ARG_KEY,
|
|
3630
4856
|
SUSPENSION_MODALS,
|
|
3631
4857
|
SUSPENSION_RESOLUTIONS,
|
|
@@ -3651,18 +4877,27 @@ export {
|
|
|
3651
4877
|
VERSION_UPDATE_REASONS,
|
|
3652
4878
|
VIEWER_TO_SHARED_SESSION_TYPES,
|
|
3653
4879
|
WORKER_BRANCH_STATES,
|
|
4880
|
+
WORKER_COMMITS_MAX,
|
|
4881
|
+
WORKER_CURRENT_BRANCH_RULE,
|
|
4882
|
+
WORKER_DECISIONS_NEEDED_MAX,
|
|
3654
4883
|
WORKER_PROTOCOL_FOOTER_MARKER,
|
|
3655
4884
|
WORKER_REPORT_OUTCOMES,
|
|
3656
4885
|
WORKER_REPORT_SUMMARY_MAX_CHARS,
|
|
4886
|
+
WORKER_SHELL_LITERAL_PATHS_RULE,
|
|
3657
4887
|
WORKER_TOOLS,
|
|
4888
|
+
aggregateMissionGitState,
|
|
3658
4889
|
appendWorkerProtocolFooter,
|
|
3659
4890
|
argsCarryStatusProbeMarker,
|
|
3660
4891
|
assessQuotaFreshness,
|
|
4892
|
+
boundEventPayload,
|
|
3661
4893
|
buildSlotProposal,
|
|
3662
4894
|
canonicalDaemonId,
|
|
4895
|
+
changelogMissionMarker,
|
|
4896
|
+
classifyChangelogSection,
|
|
3663
4897
|
classifySessionStatus,
|
|
3664
4898
|
compareDashboardWireVersion,
|
|
3665
4899
|
compareSemver,
|
|
4900
|
+
computeRelayReprobeDelay,
|
|
3666
4901
|
daemonIdsEquivalent,
|
|
3667
4902
|
decodeActiveWorkQueryRequest,
|
|
3668
4903
|
decodeActiveWorkQueryResponse,
|
|
@@ -3705,6 +4940,8 @@ export {
|
|
|
3705
4940
|
decodeQueueQueryResponse,
|
|
3706
4941
|
decodeQueueRequeueRequest,
|
|
3707
4942
|
decodeQueueRequeueResponse,
|
|
4943
|
+
decodeQueueReviseRequest,
|
|
4944
|
+
decodeQueueReviseResponse,
|
|
3708
4945
|
decodeRecordLocalRequest,
|
|
3709
4946
|
decodeRecordLocalResponse,
|
|
3710
4947
|
decodeRecoveryContextQueryRequest,
|
|
@@ -3724,6 +4961,8 @@ export {
|
|
|
3724
4961
|
decodeUserSessionToDashboard,
|
|
3725
4962
|
decodeViewerToSharedSession,
|
|
3726
4963
|
defaultProviderPriorityFromNodeFacts,
|
|
4964
|
+
defaultStagePlan,
|
|
4965
|
+
deriveItemDedupeKey,
|
|
3727
4966
|
deriveProviderPriorityFromSlots,
|
|
3728
4967
|
deriveSlotsFromLegacy,
|
|
3729
4968
|
describeModelSelection,
|
|
@@ -3734,14 +4973,21 @@ export {
|
|
|
3734
4973
|
expandDaemonIdForms,
|
|
3735
4974
|
findOwnershipConflicts,
|
|
3736
4975
|
foldKeyedDoc,
|
|
4976
|
+
followedRemoteProjectKey,
|
|
4977
|
+
followerOpPermitted,
|
|
3737
4978
|
formatQuotaAccount,
|
|
4979
|
+
formatStageVerdictLine,
|
|
3738
4980
|
hasGitStatusEvidence,
|
|
3739
4981
|
hasWorkerProtocolFooter,
|
|
3740
4982
|
interpolateString,
|
|
3741
4983
|
isActionableProviderApproval,
|
|
4984
|
+
isAssistantFollowerAllowedOp,
|
|
3742
4985
|
isAssistantTool,
|
|
3743
4986
|
isBlockedStatus,
|
|
4987
|
+
isBlockingSeverity,
|
|
3744
4988
|
isBusyStatus,
|
|
4989
|
+
isCarryOverMissionRecord,
|
|
4990
|
+
isCarryOverMissionTitle,
|
|
3745
4991
|
isChunkType,
|
|
3746
4992
|
isCommitStrength,
|
|
3747
4993
|
isDaemonDirectCommandType,
|
|
@@ -3757,14 +5003,21 @@ export {
|
|
|
3757
5003
|
isDeadStatus,
|
|
3758
5004
|
isDowngrade,
|
|
3759
5005
|
isEvidenceIdentifier,
|
|
5006
|
+
isFindingCategory,
|
|
5007
|
+
isFindingResponseKind,
|
|
5008
|
+
isFindingSeverity,
|
|
3760
5009
|
isFiniteNumber,
|
|
3761
5010
|
isIdleSessionState,
|
|
3762
5011
|
isInputEnvelopeWire,
|
|
5012
|
+
isLaunchDefaultRole,
|
|
5013
|
+
isLaunchDefaultSource,
|
|
5014
|
+
isLightWorkerSession,
|
|
3763
5015
|
isMeshDeliveryMode,
|
|
3764
5016
|
isMeshIndexQueryResponse,
|
|
3765
5017
|
isMeshMissionStatusValue,
|
|
3766
5018
|
isMeshP2PSignalType,
|
|
3767
5019
|
isMeshRecordPayload,
|
|
5020
|
+
isMeshReleaseChannel,
|
|
3768
5021
|
isMeshTaskDifficulty,
|
|
3769
5022
|
isMeshTaskMode,
|
|
3770
5023
|
isMeshTaskPriority,
|
|
@@ -3772,6 +5025,8 @@ export {
|
|
|
3772
5025
|
isMeshTerminalTaskStatus,
|
|
3773
5026
|
isMeshTopicEntry,
|
|
3774
5027
|
isMessageId,
|
|
5028
|
+
isMissionOutcome,
|
|
5029
|
+
isMissionRefContained,
|
|
3775
5030
|
isMissionUpsertResponse,
|
|
3776
5031
|
isModelAxisSource,
|
|
3777
5032
|
isNativeMarkerRef,
|
|
@@ -3781,10 +5036,13 @@ export {
|
|
|
3781
5036
|
isOutboundMessageOrigin,
|
|
3782
5037
|
isP2PSignalType,
|
|
3783
5038
|
isPhantomDaemonEntry,
|
|
5039
|
+
isPriorFindingStatus,
|
|
3784
5040
|
isProviderQuestionBinding,
|
|
3785
5041
|
isRawDaemonDoId,
|
|
3786
5042
|
isReadyStatus,
|
|
3787
5043
|
isRecord,
|
|
5044
|
+
isReleaseStatus,
|
|
5045
|
+
isReviewVerdict,
|
|
3788
5046
|
isSendPolicy,
|
|
3789
5047
|
isSendPolicyMode,
|
|
3790
5048
|
isSendRefusal,
|
|
@@ -3793,6 +5051,8 @@ export {
|
|
|
3793
5051
|
isSessionLaunchedBy,
|
|
3794
5052
|
isSessionStatus,
|
|
3795
5053
|
isSharedSessionToViewerType,
|
|
5054
|
+
isStageBlockedReason,
|
|
5055
|
+
isStageEligibleTask,
|
|
3796
5056
|
isSubmitOutcome,
|
|
3797
5057
|
isSummaryRef,
|
|
3798
5058
|
isTerminalSessionRecordStatus,
|
|
@@ -3811,6 +5071,7 @@ export {
|
|
|
3811
5071
|
isWorkingStatus,
|
|
3812
5072
|
joinRepoPath,
|
|
3813
5073
|
launchModelSelectionValue,
|
|
5074
|
+
lintChangelogText,
|
|
3814
5075
|
machineCoreFromDaemonId,
|
|
3815
5076
|
makeTypeGuard,
|
|
3816
5077
|
measureWorstCaseChunkEnvelopeBytes,
|
|
@@ -3822,20 +5083,29 @@ export {
|
|
|
3822
5083
|
minutesUntilQuotaCheck,
|
|
3823
5084
|
normalizeAuthOkLimits,
|
|
3824
5085
|
normalizeBrainSlot,
|
|
5086
|
+
normalizeDecisionInput,
|
|
3825
5087
|
normalizeDifficultyBrainMap,
|
|
5088
|
+
normalizeForDedupe,
|
|
3826
5089
|
normalizeGitStatus,
|
|
3827
5090
|
normalizeMeshNodeFacts,
|
|
3828
5091
|
normalizeMeshNodeId,
|
|
3829
5092
|
normalizeMeshSessionRecord,
|
|
3830
5093
|
normalizeMeshWorkspaceForCompare,
|
|
3831
5094
|
normalizeMissionBrief,
|
|
5095
|
+
normalizeMissionItemInput,
|
|
5096
|
+
normalizeMissionItemUpdate,
|
|
5097
|
+
normalizeMissionRefs,
|
|
5098
|
+
normalizeMissionSummary,
|
|
3832
5099
|
normalizeNodeCapabilitySlot,
|
|
3833
5100
|
normalizeNodeCapabilitySlots,
|
|
5101
|
+
normalizeOutcomeReason,
|
|
3834
5102
|
normalizeOwnedPaths,
|
|
5103
|
+
normalizeReportCommits,
|
|
3835
5104
|
normalizeSessionStatus,
|
|
3836
5105
|
normalizeThinkingLevel,
|
|
3837
5106
|
orderProvidersByBuiltinPreference,
|
|
3838
5107
|
parseJsonRecord,
|
|
5108
|
+
parseRoleLaunchSelection,
|
|
3839
5109
|
parseSemver,
|
|
3840
5110
|
parseSessionLaunchRecord,
|
|
3841
5111
|
pathsOverlap,
|
|
@@ -3854,11 +5124,17 @@ export {
|
|
|
3854
5124
|
readStringArray,
|
|
3855
5125
|
readText,
|
|
3856
5126
|
renderCoordinatorWorkerSection,
|
|
5127
|
+
renderLightWorkspaceRules,
|
|
3857
5128
|
renderMissionBriefBlock,
|
|
5129
|
+
renderStageProtocolLines,
|
|
3858
5130
|
renderWorkerProtocolFooter,
|
|
5131
|
+
resolveStagePlan,
|
|
3859
5132
|
retiredMeshToolError,
|
|
5133
|
+
reviewIndependenceOf,
|
|
5134
|
+
sanitizeDispatchRefusalDetail,
|
|
3860
5135
|
sanitizeModelIdentifier,
|
|
3861
5136
|
sanitizeRefusalCode,
|
|
5137
|
+
sanitizeRemoteRepoIdentity,
|
|
3862
5138
|
scoreGitStatusCandidate,
|
|
3863
5139
|
scoreGitUpstreamFreshness,
|
|
3864
5140
|
sessionIdsEquivalent,
|
|
@@ -3869,6 +5145,11 @@ export {
|
|
|
3869
5145
|
summarizeGitShape,
|
|
3870
5146
|
supportsQuota,
|
|
3871
5147
|
touchedFilesOutsideOwnership,
|
|
5148
|
+
truncateMissionText,
|
|
5149
|
+
unwrapPastedContent,
|
|
5150
|
+
validateFindingResponses,
|
|
5151
|
+
validateReviewReport,
|
|
5152
|
+
validateTestsRun,
|
|
3872
5153
|
withStatusProbeMarker
|
|
3873
5154
|
};
|
|
3874
5155
|
//# sourceMappingURL=index.mjs.map
|