opencode-swarm 7.174.0 → 7.176.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
- package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
- package/dist/background/pending-delegations.d.ts +10 -0
- package/dist/background/pr-review-contract.d.ts +3 -0
- package/dist/background/status-artifact.d.ts +24 -1
- package/dist/cli/{coder-settlement-pwct8te4.js → coder-settlement-y3ftsdje.js} +10 -10
- package/dist/cli/{config-doctor-tnta65bf.js → config-doctor-3x9d5y3w.js} +2 -2
- package/dist/cli/{core-421gbna2.js → core-hf9pjm7y.js} +3 -3
- package/dist/cli/{curation-policy-dw25zm05.js → curation-policy-8h25hyf8.js} +4 -4
- package/dist/cli/{curator-drift-x3tt8apf.js → curator-drift-qxgs5ee4.js} +2 -2
- package/dist/cli/{curator-llm-factory-4e73613g.js → curator-llm-factory-rs8zyytn.js} +33 -33
- package/dist/cli/{curator-yrhc4epa.js → curator-pf4n52b1.js} +33 -33
- package/dist/cli/{evidence-summary-service-f4vem356.js → evidence-summary-service-t4nnvgyz.js} +14 -14
- package/dist/cli/{gate-evidence-t2dyfvc4.js → gate-evidence-d6wmarwz.js} +6 -6
- package/dist/cli/{guardrail-explain-hf5gawe2.js → guardrail-explain-x8n8dtq6.js} +34 -34
- package/dist/cli/{guardrail-log-9dkyvdbw.js → guardrail-log-ehwt0w51.js} +6 -6
- package/dist/cli/{guardrail-reset-26bxnh2e.js → guardrail-reset-ceqcapzm.js} +33 -33
- package/dist/cli/{hive-promoter-6s6xbq5x.js → hive-promoter-9dgmk5nq.js} +33 -33
- package/dist/cli/{index-nwew2anc.js → index-2xm1xtqy.js} +1 -1
- package/dist/cli/{index-a1w58b47.js → index-4ddpvd5c.js} +32 -0
- package/dist/cli/{index-jd2f7thw.js → index-509g4m8s.js} +508 -260
- package/dist/cli/{index-0hgmsyfp.js → index-549wxbe1.js} +1 -1
- package/dist/cli/{index-saw0ambb.js → index-569pn3vz.js} +16 -10
- package/dist/cli/{index-bf6w27sb.js → index-580v9v50.js} +3 -3
- package/dist/cli/{index-5prgmf00.js → index-68nc7zev.js} +3 -3
- package/dist/cli/{index-c60t3sw6.js → index-9fnjkqsr.js} +1 -1
- package/dist/cli/{index-vsvdh976.js → index-bym86sb4.js} +1 -1
- package/dist/cli/{index-0c7y177k.js → index-c45zvjeg.js} +2 -2
- package/dist/cli/{index-ddz0a0ew.js → index-cfjbrcv7.js} +3 -3
- package/dist/cli/{index-e4g3487s.js → index-crx99j5b.js} +3 -3
- package/dist/cli/{index-dfd6d64k.js → index-dn5kkjfv.js} +35 -35
- package/dist/cli/{index-nxnmy2da.js → index-dq0fbb2g.js} +4 -4
- package/dist/cli/{index-mmnk7nt1.js → index-eawhasqk.js} +1 -1
- package/dist/cli/{index-snd34n1y.js → index-fh8jh5n1.js} +5 -5
- package/dist/cli/{index-dfey3jpn.js → index-g9pqwf7v.js} +3 -3
- package/dist/cli/{index-6v1cz898.js → index-gtjx3q5h.js} +1 -1
- package/dist/cli/{index-m8c44754.js → index-hvt8902r.js} +5 -5
- package/dist/cli/{index-z2deqhpp.js → index-n1tcj1q7.js} +1 -1
- package/dist/cli/{index-2qawngxn.js → index-n1wean2y.js} +16 -9
- package/dist/cli/{index-8d3qzvbb.js → index-n5aa7f72.js} +2 -2
- package/dist/cli/{index-s6wb6sjk.js → index-pd3yg1mh.js} +4 -4
- package/dist/cli/{index-rgvg7d6k.js → index-r3ftkdvn.js} +1 -1
- package/dist/cli/{index-vwjfm0s6.js → index-rekx0gq7.js} +3 -3
- package/dist/cli/{index-23fwhwrb.js → index-rm1k8ekt.js} +33 -33
- package/dist/cli/{index-qc4nvg0m.js → index-s0w34gp3.js} +4 -4
- package/dist/cli/{index-kyakvkpk.js → index-s1cm0jre.js} +3 -1
- package/dist/cli/{index-mjtja1wq.js → index-t4kwsbhj.js} +1 -1
- package/dist/cli/{index-hkx8tqa4.js → index-t5t6cqfb.js} +4 -4
- package/dist/cli/{index-cw1nbtvh.js → index-twymcfj9.js} +1 -1
- package/dist/cli/{index-py58gern.js → index-wdcsy80q.js} +6 -6
- package/dist/cli/{index-9gpf4tt4.js → index-wer28675.js} +7 -7
- package/dist/cli/{index-rjjtn1w5.js → index-wn00ra10.js} +2 -2
- package/dist/cli/{index-fagcasf8.js → index-wpae4r9j.js} +5 -5
- package/dist/cli/{index-3yw5h3bt.js → index-z9nzrjf7.js} +1 -1
- package/dist/cli/{index-v8ykb3hq.js → index-zpa6ywts.js} +9 -9
- package/dist/cli/{index-0mhftbpp.js → index-zz7gzw57.js} +1 -1
- package/dist/cli/index.js +34 -34
- package/dist/cli/{knowledge-escalator-bra0fkfm.js → knowledge-escalator-0eyjbhap.js} +12 -12
- package/dist/cli/{knowledge-events-v4hq7wr9.js → knowledge-events-64k22qmf.js} +10 -10
- package/dist/cli/{knowledge-link-dw12x2ns.js → knowledge-link-yx57s7zb.js} +3 -3
- package/dist/cli/{knowledge-store-3hx2896s.js → knowledge-store-q3k2zf8a.js} +4 -4
- package/dist/cli/{knowledge-validator-9wj31ym5.js → knowledge-validator-ywbk1gpw.js} +6 -6
- package/dist/cli/{mcp-d7yptqpg.js → mcp-yas626k0.js} +1 -1
- package/dist/cli/{pending-delegations-8ghc75b2.js → pending-delegations-91a6nb8z.js} +6 -6
- package/dist/cli/{pr-subscriptions-yceed093.js → pr-subscriptions-dyn9hn9g.js} +6 -6
- package/dist/cli/{pr-workflow-gate-sc4c4cmk.js → pr-workflow-gate-xwz3f6zm.js} +33 -33
- package/dist/cli/{runner-k1pmc3z8.js → runner-j4hrfyve.js} +4 -4
- package/dist/cli/{scan-cursor-mtja4626.js → scan-cursor-etrpan51.js} +7 -7
- package/dist/cli/{schema-x2nb18fg.js → schema-aarfgdn3.js} +1 -1
- package/dist/cli/{scope-persistence-tafxf6yz.js → scope-persistence-j0vzwybd.js} +12 -12
- package/dist/cli/{server-hk378mzc.js → server-rhpwneb6.js} +33 -33
- package/dist/cli/{skill-generator-vz5vtgk6.js → skill-generator-m6yrxy2s.js} +14 -14
- package/dist/cli/{snapshot-coordination-init-8x5n1q8c.js → snapshot-coordination-init-1yn3fyt4.js} +33 -33
- package/dist/cli/{telemetry-m580862y.js → telemetry-1cfatyt0.js} +1 -1
- package/dist/cli/{workspace-snapshot-6aw002e8.js → workspace-snapshot-07rzjg7s.js} +3 -3
- package/dist/cli/{worktree-collision-ownership-cfx1tsaf.js → worktree-collision-ownership-g6bjm090.js} +9 -9
- package/dist/cli/{worktree-isolation-t3fm1c5w.js → worktree-isolation-6kebmn1t.js} +33 -33
- package/dist/commands/registry.d.ts +1 -1
- package/dist/hooks/pr-workflow-gate.d.ts +6 -0
- package/dist/index.js +511 -510
- package/dist/observability/startup-contract.d.ts +134 -0
- package/dist/pr-review/types.d.ts +8 -0
- package/dist/tools/dispatch-lanes.d.ts +29 -0
- package/dist/workflow/coder-settlement.d.ts +7 -0
- package/dist/workflow/recovery-invocation.d.ts +35 -0
- package/dist/workflow/stage-a-repair.d.ts +17 -0
- package/dist/workflow/task-recovery-status.d.ts +61 -0
- package/package.json +3 -1
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
resolveExecutableFromPath,
|
|
17
17
|
runEvaluation,
|
|
18
18
|
runExternalTool
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-2xm1xtqy.js";
|
|
20
20
|
import {
|
|
21
21
|
finalizeShellAuditForClose,
|
|
22
22
|
isPolicyProtectedPath,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
protectedRoots,
|
|
27
27
|
redactDecisionLineForArchive,
|
|
28
28
|
stableCanonicalStringify
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-580v9v50.js";
|
|
30
30
|
import {
|
|
31
31
|
canonicalProjectKey,
|
|
32
32
|
closeGroupCommitWriter,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
readDoctorArtifact,
|
|
40
40
|
removeStraySwarmDir,
|
|
41
41
|
runConfigDoctor
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-eawhasqk.js";
|
|
43
43
|
import {
|
|
44
44
|
MAX_TRANSIENT_RETRIES,
|
|
45
45
|
archiveEvidence,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
updateTaskStatus,
|
|
82
82
|
validateProjectRoot,
|
|
83
83
|
withPlanLifecycleLock
|
|
84
|
-
} from "./index-
|
|
84
|
+
} from "./index-zpa6ywts.js";
|
|
85
85
|
import {
|
|
86
86
|
EvaluationTaskV1Schema,
|
|
87
87
|
GateAuditManifestV1Schema,
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
saveGateAuditResult,
|
|
99
99
|
savePromotionDecision,
|
|
100
100
|
saveTaskSetSnapshot
|
|
101
|
-
} from "./index-
|
|
101
|
+
} from "./index-z9nzrjf7.js";
|
|
102
102
|
import {
|
|
103
103
|
canonicalHash,
|
|
104
104
|
canonicalJson,
|
|
@@ -118,7 +118,7 @@ import {
|
|
|
118
118
|
resolveSpeckitProjection,
|
|
119
119
|
validateSpeckit,
|
|
120
120
|
writeProjectedSpecSync
|
|
121
|
-
} from "./index-
|
|
121
|
+
} from "./index-n1tcj1q7.js";
|
|
122
122
|
import {
|
|
123
123
|
containsControlChars,
|
|
124
124
|
containsPathTraversal,
|
|
@@ -146,15 +146,15 @@ import {
|
|
|
146
146
|
retireSkill,
|
|
147
147
|
selectCandidateEntries,
|
|
148
148
|
syncBundledProjectSkillsIfMissingAsync
|
|
149
|
-
} from "./index-
|
|
149
|
+
} from "./index-s0w34gp3.js";
|
|
150
150
|
import {
|
|
151
151
|
readRecentEscalations
|
|
152
|
-
} from "./index-
|
|
152
|
+
} from "./index-wpae4r9j.js";
|
|
153
153
|
import {
|
|
154
154
|
alreadyCuratedThisGeneration,
|
|
155
155
|
claimNextScanBatch,
|
|
156
156
|
resolveCohortId
|
|
157
|
-
} from "./index-
|
|
157
|
+
} from "./index-g9pqwf7v.js";
|
|
158
158
|
import {
|
|
159
159
|
CURATOR_CONSOLIDATION_PROMPT,
|
|
160
160
|
CURATOR_INIT_PROMPT,
|
|
@@ -174,7 +174,7 @@ import {
|
|
|
174
174
|
sweepStale,
|
|
175
175
|
unsubscribe,
|
|
176
176
|
updateSnapshot
|
|
177
|
-
} from "./index-
|
|
177
|
+
} from "./index-rekx0gq7.js";
|
|
178
178
|
import {
|
|
179
179
|
clearWorktreeMergeStatus,
|
|
180
180
|
getAllWorktreeMergeFailures,
|
|
@@ -186,7 +186,7 @@ import {
|
|
|
186
186
|
listCoderSettlementWalStates,
|
|
187
187
|
recoverCoderSettlement,
|
|
188
188
|
recoverStaleCoderSettlements
|
|
189
|
-
} from "./index-
|
|
189
|
+
} from "./index-n1wean2y.js";
|
|
190
190
|
import {
|
|
191
191
|
parsePorcelainV2Snapshot,
|
|
192
192
|
resolveCommitCountSince,
|
|
@@ -214,7 +214,7 @@ import {
|
|
|
214
214
|
resolveRemoteUrlIdentity,
|
|
215
215
|
resolveRemoteUrlIdentityAsync,
|
|
216
216
|
switchPrFeedbackTrackingCandidateAsync
|
|
217
|
-
} from "./index-
|
|
217
|
+
} from "./index-9fnjkqsr.js";
|
|
218
218
|
import {
|
|
219
219
|
WORKTREE_LIFECYCLE_LOCK_FILE,
|
|
220
220
|
recordWorktreeProvisioningOwner,
|
|
@@ -257,7 +257,7 @@ import {
|
|
|
257
257
|
transitionTaskWorkflowEvidence,
|
|
258
258
|
withTaskEvidenceTransaction,
|
|
259
259
|
writeWorkflowWalFile
|
|
260
|
-
} from "./index-
|
|
260
|
+
} from "./index-fh8jh5n1.js";
|
|
261
261
|
import {
|
|
262
262
|
isPathUnderSwarmWorktreeBase,
|
|
263
263
|
listLiveLaneOwners,
|
|
@@ -266,7 +266,7 @@ import {
|
|
|
266
266
|
recordLiveLaneOwner,
|
|
267
267
|
removeWorktree,
|
|
268
268
|
resolveWorktreeBaseDir
|
|
269
|
-
} from "./index-
|
|
269
|
+
} from "./index-crx99j5b.js";
|
|
270
270
|
import {
|
|
271
271
|
DEFAULT_STALE_DELEGATION_TIMEOUT_MS,
|
|
272
272
|
DELEGATION_COMPACTION_HIGH_WATER_BYTES,
|
|
@@ -300,7 +300,7 @@ import {
|
|
|
300
300
|
scanBackgroundCoderReservationsForAdmission,
|
|
301
301
|
scanDelegationsForRecovery,
|
|
302
302
|
sweepStaleDelegations
|
|
303
|
-
} from "./index-
|
|
303
|
+
} from "./index-569pn3vz.js";
|
|
304
304
|
import {
|
|
305
305
|
MAX_EVENT_LOG_ENTRIES,
|
|
306
306
|
_internals,
|
|
@@ -316,7 +316,7 @@ import {
|
|
|
316
316
|
recordKnowledgeEvent,
|
|
317
317
|
recordPhaseCloseIntent,
|
|
318
318
|
resolveKnowledgeEventsPath
|
|
319
|
-
} from "./index-
|
|
319
|
+
} from "./index-wer28675.js";
|
|
320
320
|
import {
|
|
321
321
|
estimateTokens,
|
|
322
322
|
readSwarmFileAsync,
|
|
@@ -342,18 +342,18 @@ import {
|
|
|
342
342
|
validateActionableFields,
|
|
343
343
|
validateLesson,
|
|
344
344
|
validateSkillPath
|
|
345
|
-
} from "./index-
|
|
345
|
+
} from "./index-pd3yg1mh.js";
|
|
346
346
|
import {
|
|
347
347
|
MAX_CURATION_PROPOSALS,
|
|
348
348
|
authorizeCuration,
|
|
349
349
|
buildConfigFingerprintInput
|
|
350
|
-
} from "./index-
|
|
350
|
+
} from "./index-twymcfj9.js";
|
|
351
351
|
import {
|
|
352
352
|
cohortConfigFingerprint
|
|
353
353
|
} from "./index-rtry5xyf.js";
|
|
354
354
|
import {
|
|
355
355
|
resolveWorktreeIsolationConfig
|
|
356
|
-
} from "./index-
|
|
356
|
+
} from "./index-c45zvjeg.js";
|
|
357
357
|
import {
|
|
358
358
|
RetrospectiveEvidenceSchema
|
|
359
359
|
} from "./index-frcemc0b.js";
|
|
@@ -364,7 +364,7 @@ import {
|
|
|
364
364
|
clearScopeBindingFromDisk,
|
|
365
365
|
clearScopeBindings,
|
|
366
366
|
readScopeFromDisk
|
|
367
|
-
} from "./index-
|
|
367
|
+
} from "./index-dq0fbb2g.js";
|
|
368
368
|
import {
|
|
369
369
|
clearPlanLedgerForReset,
|
|
370
370
|
computePlanStructureHash,
|
|
@@ -380,7 +380,7 @@ import {
|
|
|
380
380
|
replayFromLedgerWithStatus,
|
|
381
381
|
resolvePlanningProfile,
|
|
382
382
|
takeSnapshotEvent
|
|
383
|
-
} from "./index-
|
|
383
|
+
} from "./index-t5t6cqfb.js";
|
|
384
384
|
import {
|
|
385
385
|
CORE_EVENT_LOCKED,
|
|
386
386
|
appendCoreEventSync,
|
|
@@ -390,7 +390,7 @@ import {
|
|
|
390
390
|
hasSpecDriftAuditEvent,
|
|
391
391
|
hasTaskRepairAuditEvent,
|
|
392
392
|
readCoreEvents
|
|
393
|
-
} from "./index-
|
|
393
|
+
} from "./index-wn00ra10.js";
|
|
394
394
|
import {
|
|
395
395
|
DEFAULT_QA_GATES,
|
|
396
396
|
computeProfileHash,
|
|
@@ -433,7 +433,7 @@ import {
|
|
|
433
433
|
observeCuratorCompliance,
|
|
434
434
|
observeStoreHealth,
|
|
435
435
|
readLearningHealth
|
|
436
|
-
} from "./index-
|
|
436
|
+
} from "./index-t4kwsbhj.js";
|
|
437
437
|
import {
|
|
438
438
|
appendKnowledge,
|
|
439
439
|
appendRejectedLesson,
|
|
@@ -463,7 +463,7 @@ import {
|
|
|
463
463
|
transactFile,
|
|
464
464
|
transactKnowledge,
|
|
465
465
|
wordBigrams
|
|
466
|
-
} from "./index-
|
|
466
|
+
} from "./index-wdcsy80q.js";
|
|
467
467
|
import {
|
|
468
468
|
readTailJsonl,
|
|
469
469
|
readTailJsonlDetailed,
|
|
@@ -484,7 +484,7 @@ import {
|
|
|
484
484
|
resolveLinkDir,
|
|
485
485
|
sanitizeLinkId,
|
|
486
486
|
writeLinkPointer
|
|
487
|
-
} from "./index-
|
|
487
|
+
} from "./index-gtjx3q5h.js";
|
|
488
488
|
import {
|
|
489
489
|
assertProjectRoot,
|
|
490
490
|
atomicWriteFile,
|
|
@@ -493,7 +493,7 @@ import {
|
|
|
493
493
|
listActiveLocks,
|
|
494
494
|
tryAcquireLock,
|
|
495
495
|
withEvidenceLock
|
|
496
|
-
} from "./index-
|
|
496
|
+
} from "./index-bym86sb4.js";
|
|
497
497
|
import {
|
|
498
498
|
require_proper_lockfile
|
|
499
499
|
} from "./index-7g4c7s5r.js";
|
|
@@ -507,7 +507,7 @@ import {
|
|
|
507
507
|
pseudonymousRef,
|
|
508
508
|
resolveLineageSalt,
|
|
509
509
|
telemetry
|
|
510
|
-
} from "./index-
|
|
510
|
+
} from "./index-68nc7zev.js";
|
|
511
511
|
import {
|
|
512
512
|
atomicWriteSwarmFile,
|
|
513
513
|
atomicWriteSwarmFileSync,
|
|
@@ -532,18 +532,18 @@ import {
|
|
|
532
532
|
loadGateOverrides,
|
|
533
533
|
loadPluginConfig,
|
|
534
534
|
loadPluginConfigWithMeta
|
|
535
|
-
} from "./index-
|
|
535
|
+
} from "./index-cfjbrcv7.js";
|
|
536
536
|
import {
|
|
537
537
|
init_git_executable,
|
|
538
538
|
resolveGitExecutable,
|
|
539
539
|
resolveGitExecutableAsync
|
|
540
|
-
} from "./index-
|
|
540
|
+
} from "./index-zz7gzw57.js";
|
|
541
541
|
import {
|
|
542
542
|
addDeferredWarning,
|
|
543
543
|
advisoryWarn,
|
|
544
544
|
getDeferredWarnings,
|
|
545
545
|
init_warning_buffer
|
|
546
|
-
} from "./index-
|
|
546
|
+
} from "./index-4ddpvd5c.js";
|
|
547
547
|
import {
|
|
548
548
|
DEFAULT_HARNESS_EVOLUTION_CONFIG,
|
|
549
549
|
DEFAULT_PR_REVIEW_RESILIENCE_CONFIG,
|
|
@@ -561,7 +561,7 @@ import {
|
|
|
561
561
|
resolveAutoReviewConfig,
|
|
562
562
|
resolveGeneratedAgentRole,
|
|
563
563
|
stripKnownSwarmPrefix
|
|
564
|
-
} from "./index-
|
|
564
|
+
} from "./index-s1cm0jre.js";
|
|
565
565
|
import {
|
|
566
566
|
AGENT_TOOL_MAP,
|
|
567
567
|
ALL_AGENT_NAMES,
|
|
@@ -3175,7 +3175,7 @@ async function importLegacyPrWorkflowGateStateIfNeeded(directory, sessionID, all
|
|
|
3175
3175
|
return null;
|
|
3176
3176
|
throw error2;
|
|
3177
3177
|
}
|
|
3178
|
-
const legacy = allowSalvagedImport ? (await (await import("./pr-workflow-gate-
|
|
3178
|
+
const legacy = allowSalvagedImport ? (await (await import("./pr-workflow-gate-xwz3f6zm.js")).readPrWorkflowGateStateForRecovery(directory, sessionID))?.state ?? null : await readPrWorkflowGateStateFileFromDisk(filePath, sessionID);
|
|
3179
3179
|
if (!legacy)
|
|
3180
3180
|
return null;
|
|
3181
3181
|
const namespace = workflowGateStateCoordinationNamespace(sessionID);
|
|
@@ -3245,7 +3245,7 @@ async function deleteStateWhileLocked(directory, sessionID, options = {}) {
|
|
|
3245
3245
|
let recoveryState = null;
|
|
3246
3246
|
if (!currentAuthoritative) {
|
|
3247
3247
|
if (options.allowSalvagedRead) {
|
|
3248
|
-
const { readPrWorkflowGateStateForRecovery } = await import("./pr-workflow-gate-
|
|
3248
|
+
const { readPrWorkflowGateStateForRecovery } = await import("./pr-workflow-gate-xwz3f6zm.js");
|
|
3249
3249
|
recoveryState = (await readPrWorkflowGateStateForRecovery(directory, normalizedSessionID))?.state ?? null;
|
|
3250
3250
|
}
|
|
3251
3251
|
if (!recoveryState) {
|
|
@@ -14210,7 +14210,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
|
|
|
14210
14210
|
return extracted === expectedSessionId;
|
|
14211
14211
|
}
|
|
14212
14212
|
async function inspectStandardWorktreeCollisionOwnership(identity) {
|
|
14213
|
-
const collisionOwnership = await import("./worktree-collision-ownership-
|
|
14213
|
+
const collisionOwnership = await import("./worktree-collision-ownership-g6bjm090.js");
|
|
14214
14214
|
return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
|
|
14215
14215
|
}
|
|
14216
14216
|
async function runRecoveryGit(directory, args, timeoutMs = 15000) {
|
|
@@ -14636,7 +14636,7 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
14636
14636
|
const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, handle.worktreePath);
|
|
14637
14637
|
if (laneProfile) {
|
|
14638
14638
|
try {
|
|
14639
|
-
const { writeLaneProfileToDiskReal } = await import("./core-
|
|
14639
|
+
const { writeLaneProfileToDiskReal } = await import("./core-hf9pjm7y.js");
|
|
14640
14640
|
await writeLaneProfileToDiskReal(handle.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
|
|
14641
14641
|
} catch {}
|
|
14642
14642
|
}
|
|
@@ -15615,7 +15615,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
|
|
|
15615
15615
|
}
|
|
15616
15616
|
clearWorktreeMergeStatus(statusKey);
|
|
15617
15617
|
try {
|
|
15618
|
-
const { removeLaneProfileFromDiskReal } = await import("./core-
|
|
15618
|
+
const { removeLaneProfileFromDiskReal } = await import("./core-hf9pjm7y.js");
|
|
15619
15619
|
await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
|
|
15620
15620
|
} catch {}
|
|
15621
15621
|
const state = serializationStateBySessionID.get(dispatch.parentSessionID);
|
|
@@ -22232,7 +22232,7 @@ function getDisplayFinalPromptPressure() {
|
|
|
22232
22232
|
async function rehydratePrSubscriptions(sessionID, directory) {
|
|
22233
22233
|
const map = new Map;
|
|
22234
22234
|
try {
|
|
22235
|
-
const { listActive: listActive2 } = await import("./pr-subscriptions-
|
|
22235
|
+
const { listActive: listActive2 } = await import("./pr-subscriptions-dyn9hn9g.js");
|
|
22236
22236
|
const records = await listActive2(directory);
|
|
22237
22237
|
for (const record of records) {
|
|
22238
22238
|
if (record.sessionID !== sessionID)
|
|
@@ -22772,6 +22772,12 @@ async function readPrWorkflowGateState(directory, sessionID) {
|
|
|
22772
22772
|
}
|
|
22773
22773
|
return state;
|
|
22774
22774
|
}
|
|
22775
|
+
function isLivenessTerminalLaneRecord(record) {
|
|
22776
|
+
if (record.status !== "cancelled" && record.status !== "stale" && record.status !== "error") {
|
|
22777
|
+
return false;
|
|
22778
|
+
}
|
|
22779
|
+
return record.terminalResult?.result.workflowLaneFailureClass === "liveness" || record.result?.workflowLaneFailureClass === "liveness";
|
|
22780
|
+
}
|
|
22775
22781
|
async function submitPrReviewResult(directory, childSessionId, input) {
|
|
22776
22782
|
const child = childSessionId.trim();
|
|
22777
22783
|
const parsedResult = PrReviewLaneResultEnvelopeSchema.safeParse(input.result);
|
|
@@ -22789,14 +22795,26 @@ async function submitPrReviewResult(directory, childSessionId, input) {
|
|
|
22789
22795
|
};
|
|
22790
22796
|
}
|
|
22791
22797
|
const preliminary = childRead.records.filter((record2) => record2.subagentSessionId === child && record2.correlationId === child && (record2.mode === "swarm-pr-review:base" || record2.mode === "swarm-pr-review:micro"));
|
|
22798
|
+
let repairRecord = null;
|
|
22792
22799
|
if (preliminary.length !== 1) {
|
|
22793
|
-
|
|
22794
|
-
|
|
22795
|
-
|
|
22796
|
-
|
|
22800
|
+
const repairCandidates = childRead.records.filter((candidate) => candidate.parentSessionId === child && (candidate.mode === "swarm-pr-review:base" || candidate.mode === "swarm-pr-review:micro") && (input.batchId === undefined || input.batchId === candidate.batchId) && (input.laneId === undefined || input.laneId === candidate.laneId) && isLivenessTerminalLaneRecord(candidate));
|
|
22801
|
+
if (repairCandidates.length !== 1) {
|
|
22802
|
+
return {
|
|
22803
|
+
status: "rejected",
|
|
22804
|
+
reason: `expected one exact child delegation, found ${preliminary.length}`
|
|
22805
|
+
};
|
|
22806
|
+
}
|
|
22807
|
+
repairRecord = repairCandidates[0];
|
|
22808
|
+
if (parsedResult.data.outcome !== "INCOMPLETE") {
|
|
22809
|
+
return {
|
|
22810
|
+
status: "rejected",
|
|
22811
|
+
reason: "architect-parent repair may only record an unresolved-terminal (INCOMPLETE) outcome"
|
|
22812
|
+
};
|
|
22813
|
+
}
|
|
22797
22814
|
}
|
|
22798
|
-
const parentSessionId = preliminary[0].parentSessionId;
|
|
22799
|
-
const record = preliminary[0];
|
|
22815
|
+
const parentSessionId = (repairRecord ?? preliminary[0]).parentSessionId;
|
|
22816
|
+
const record = repairRecord ?? preliminary[0];
|
|
22817
|
+
const childOfRecord = record.subagentSessionId;
|
|
22800
22818
|
if (!record.batchId || !record.laneId) {
|
|
22801
22819
|
return {
|
|
22802
22820
|
status: "rejected",
|
|
@@ -22834,6 +22852,12 @@ async function submitPrReviewResult(directory, childSessionId, input) {
|
|
|
22834
22852
|
if (dispatchWorkflowInstanceId !== state.workflowInstanceId) {
|
|
22835
22853
|
return { status: "rejected", reason: "stale workflow instance binding" };
|
|
22836
22854
|
}
|
|
22855
|
+
if (repairRecord && dispatchWorkflowRevision !== state.revision) {
|
|
22856
|
+
return {
|
|
22857
|
+
status: "rejected",
|
|
22858
|
+
reason: `superseded workflow generation binding (delegation generation ${dispatchWorkflowRevision}, active generation ${state.revision})`
|
|
22859
|
+
};
|
|
22860
|
+
}
|
|
22837
22861
|
if (record.mode !== "swarm-pr-review:base" && record.mode !== "swarm-pr-review:micro" || !sameProjectRoot(record.workspace?.directory ?? "", directory)) {
|
|
22838
22862
|
return {
|
|
22839
22863
|
status: "rejected",
|
|
@@ -22853,7 +22877,8 @@ async function submitPrReviewResult(directory, childSessionId, input) {
|
|
|
22853
22877
|
generation: state.revision,
|
|
22854
22878
|
semanticEnvelopeDigest,
|
|
22855
22879
|
outcome: parsedResult.data.outcome,
|
|
22856
|
-
...existingReceiptDigest !== undefined ? { existingReceiptDigest } : {}
|
|
22880
|
+
...existingReceiptDigest !== undefined ? { existingReceiptDigest } : {},
|
|
22881
|
+
...repairRecord ? { submittedBy: "workflow_parent" } : {}
|
|
22857
22882
|
});
|
|
22858
22883
|
if (submission.status === "rejected") {
|
|
22859
22884
|
return {
|
|
@@ -22863,12 +22888,13 @@ async function submitPrReviewResult(directory, childSessionId, input) {
|
|
|
22863
22888
|
}
|
|
22864
22889
|
const published = await publishPrReviewResultReceipt(directory, {
|
|
22865
22890
|
parentSessionId,
|
|
22866
|
-
childSessionId:
|
|
22891
|
+
childSessionId: childOfRecord,
|
|
22867
22892
|
batchId,
|
|
22868
22893
|
laneId,
|
|
22869
22894
|
expectedWorkflowInstanceId: state.workflowInstanceId,
|
|
22870
22895
|
expectedWorkflowRevision: dispatchWorkflowRevision,
|
|
22871
22896
|
expectedBaseSha: state.prReviewBaseSha,
|
|
22897
|
+
...repairRecord ? { parentRepair: true } : {},
|
|
22872
22898
|
receipt: {
|
|
22873
22899
|
schemaVersion: 1,
|
|
22874
22900
|
mode: record.mode,
|
|
@@ -22881,10 +22907,15 @@ async function submitPrReviewResult(directory, childSessionId, input) {
|
|
|
22881
22907
|
baseSha: state.prReviewBaseSha,
|
|
22882
22908
|
headSha: state.prHeadSha,
|
|
22883
22909
|
dispatchRevisionDigest: input.revisionDigest,
|
|
22884
|
-
childSessionId:
|
|
22910
|
+
childSessionId: childOfRecord,
|
|
22885
22911
|
generation: record.generation ?? 1,
|
|
22886
22912
|
semanticEnvelopeDigest,
|
|
22887
|
-
envelope: parsedResult.data
|
|
22913
|
+
envelope: parsedResult.data,
|
|
22914
|
+
...repairRecord ? {
|
|
22915
|
+
submittedBy: "workflow_parent",
|
|
22916
|
+
submittedByParentSessionId: parentSessionId,
|
|
22917
|
+
laneTerminalStateAtSubmission: record.status
|
|
22918
|
+
} : {}
|
|
22888
22919
|
}
|
|
22889
22920
|
});
|
|
22890
22921
|
if (published.status === "recorded" || published.status === "duplicate") {
|
|
@@ -39076,9 +39107,9 @@ function hashContent(content) {
|
|
|
39076
39107
|
return createHash24("sha1").update(content).digest("hex");
|
|
39077
39108
|
}
|
|
39078
39109
|
async function loadConfigForPolicyCurator(directory) {
|
|
39079
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
39110
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-aarfgdn3.js");
|
|
39080
39111
|
try {
|
|
39081
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
39112
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-hvt8902r.js");
|
|
39082
39113
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
39083
39114
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
39084
39115
|
} catch {
|
|
@@ -42136,7 +42167,7 @@ async function resolveCuratorLLMDelegate(directory, mode, sessionId) {
|
|
|
42136
42167
|
const seam = _internals36.createCuratorLLMDelegate;
|
|
42137
42168
|
if (seam)
|
|
42138
42169
|
return seam(directory, mode, sessionId);
|
|
42139
|
-
const { createCuratorLLMDelegate } = await import("./curator-llm-factory-
|
|
42170
|
+
const { createCuratorLLMDelegate } = await import("./curator-llm-factory-rs8zyytn.js");
|
|
42140
42171
|
return createCuratorLLMDelegate(directory, mode, sessionId);
|
|
42141
42172
|
}
|
|
42142
42173
|
async function reconcileCloseTerminalStateForPlan(directory, targetPlan, options) {
|
|
@@ -42531,7 +42562,7 @@ async function runFinalizeStage(ctx) {
|
|
|
42531
42562
|
}
|
|
42532
42563
|
}
|
|
42533
42564
|
try {
|
|
42534
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
42565
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-aarfgdn3.js");
|
|
42535
42566
|
const { config: pmLoadedConfig } = _internals36.loadPluginConfigWithMeta(ctx.directory);
|
|
42536
42567
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
42537
42568
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -44375,7 +44406,7 @@ function serializeAgentSession(s) {
|
|
|
44375
44406
|
}
|
|
44376
44407
|
async function writeSnapshot(directory, state) {
|
|
44377
44408
|
try {
|
|
44378
|
-
const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-
|
|
44409
|
+
const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-1yn3fyt4.js");
|
|
44379
44410
|
await ensureSnapshotCoordinationReady(directory);
|
|
44380
44411
|
const snapshot = {
|
|
44381
44412
|
version: 3,
|
|
@@ -47301,7 +47332,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
|
|
|
47301
47332
|
};
|
|
47302
47333
|
}
|
|
47303
47334
|
async function sweepActiveNearDuplicates(directory, options = {}) {
|
|
47304
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
47335
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-hvt8902r.js");
|
|
47305
47336
|
const { config } = loadPluginConfigWithMeta2(directory);
|
|
47306
47337
|
const sweepConfig = config.learning?.dedup_sweep;
|
|
47307
47338
|
if (sweepConfig?.enabled === false)
|
|
@@ -48425,7 +48456,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
48425
48456
|
}
|
|
48426
48457
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
48427
48458
|
try {
|
|
48428
|
-
const skillModule = await import("./skill-generator-
|
|
48459
|
+
const skillModule = await import("./skill-generator-m6yrxy2s.js");
|
|
48429
48460
|
for (const cand of skillCandidates) {
|
|
48430
48461
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
48431
48462
|
continue;
|
|
@@ -48897,7 +48928,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
48897
48928
|
} catch {}
|
|
48898
48929
|
}
|
|
48899
48930
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
48900
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
48931
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-0eyjbhap.js");
|
|
48901
48932
|
for (const { id } of contradictedEntries) {
|
|
48902
48933
|
try {
|
|
48903
48934
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -49729,7 +49760,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
49729
49760
|
warnings.push("Failed to collect knowledge summary.");
|
|
49730
49761
|
}
|
|
49731
49762
|
try {
|
|
49732
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
49763
|
+
const { getScanStatus } = await import("./scan-cursor-etrpan51.js");
|
|
49733
49764
|
const scanStatus = await getScanStatus(directory);
|
|
49734
49765
|
if (scanStatus.remaining_estimate > 0) {
|
|
49735
49766
|
warnings.push(`Fair scan: reviewed ${knowledgeSummary.length} entries this sweep (generation ${scanStatus.generation}); ${scanStatus.remaining_estimate} more eligible entries will be visited in future curation sweeps.`);
|
|
@@ -49901,9 +49932,9 @@ var _internals53 = {
|
|
|
49901
49932
|
verifyPostMortemKnowledgeActions,
|
|
49902
49933
|
repairPostMortemActions,
|
|
49903
49934
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
49904
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
49935
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-aarfgdn3.js");
|
|
49905
49936
|
try {
|
|
49906
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
49937
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-hvt8902r.js");
|
|
49907
49938
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
49908
49939
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
49909
49940
|
} catch {
|
|
@@ -49911,11 +49942,11 @@ var _internals53 = {
|
|
|
49911
49942
|
}
|
|
49912
49943
|
},
|
|
49913
49944
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
49914
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
49945
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-pf4n52b1.js");
|
|
49915
49946
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
49916
49947
|
},
|
|
49917
49948
|
checkHivePromotions: async (entries2, knowledgeConfig, directory) => {
|
|
49918
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
49949
|
+
const { checkHivePromotions } = await import("./hive-promoter-9dgmk5nq.js");
|
|
49919
49950
|
return checkHivePromotions(entries2, knowledgeConfig, directory);
|
|
49920
49951
|
},
|
|
49921
49952
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -49924,7 +49955,7 @@ var _internals53 = {
|
|
|
49924
49955
|
activateProposal,
|
|
49925
49956
|
listSkills: listSkills2,
|
|
49926
49957
|
sanitizeSlug
|
|
49927
|
-
} = await import("./skill-generator-
|
|
49958
|
+
} = await import("./skill-generator-m6yrxy2s.js");
|
|
49928
49959
|
const result = {
|
|
49929
49960
|
approved: [],
|
|
49930
49961
|
rejected: [],
|
|
@@ -49966,7 +49997,7 @@ var _internals53 = {
|
|
|
49966
49997
|
return result;
|
|
49967
49998
|
},
|
|
49968
49999
|
readPriorDriftReports: async (directory) => {
|
|
49969
|
-
const { readPriorDriftReports } = await import("./curator-drift-
|
|
50000
|
+
const { readPriorDriftReports } = await import("./curator-drift-qxgs5ee4.js");
|
|
49970
50001
|
return readPriorDriftReports(directory);
|
|
49971
50002
|
},
|
|
49972
50003
|
readSwarmKnowledge: (directory) => readKnowledge(resolveSwarmKnowledgePath(directory))
|
|
@@ -58410,7 +58441,7 @@ function wireCloseInternals() {
|
|
|
58410
58441
|
archiveEvidence,
|
|
58411
58442
|
endAgentSession,
|
|
58412
58443
|
flushAndDrainTelemetry: async () => {
|
|
58413
|
-
const { flushAndDrainTelemetry } = await import("./telemetry-
|
|
58444
|
+
const { flushAndDrainTelemetry } = await import("./telemetry-1cfatyt0.js");
|
|
58414
58445
|
return flushAndDrainTelemetry();
|
|
58415
58446
|
},
|
|
58416
58447
|
finalizeContextTelemetry,
|
|
@@ -59762,9 +59793,9 @@ var _internals63 = {
|
|
|
59762
59793
|
loadPluginConfigWithMeta,
|
|
59763
59794
|
loadCuratorDeps: async () => {
|
|
59764
59795
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate }] = await Promise.all([
|
|
59765
|
-
import("./schema-
|
|
59766
|
-
import("./curator-
|
|
59767
|
-
import("./curator-llm-factory-
|
|
59796
|
+
import("./schema-aarfgdn3.js"),
|
|
59797
|
+
import("./curator-pf4n52b1.js"),
|
|
59798
|
+
import("./curator-llm-factory-rs8zyytn.js")
|
|
59768
59799
|
]);
|
|
59769
59800
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate };
|
|
59770
59801
|
}
|
|
@@ -61321,6 +61352,349 @@ init_executor();
|
|
|
61321
61352
|
init_path_identity();
|
|
61322
61353
|
init_git_executable();
|
|
61323
61354
|
|
|
61355
|
+
// src/workflow/recovery-invocation.ts
|
|
61356
|
+
var RECOVERY_RUNBOOK_DOC_PATH = "docs/troubleshooting/recovery-runbook.md";
|
|
61357
|
+
var RECOVERY_INVOCATIONS = [
|
|
61358
|
+
{
|
|
61359
|
+
surface: "host",
|
|
61360
|
+
invocation: "/swarm recover <task_id>",
|
|
61361
|
+
note: "Host command path \u2014 type it verbatim in the OpenCode TUI/GUI command line."
|
|
61362
|
+
},
|
|
61363
|
+
{
|
|
61364
|
+
surface: "powershell",
|
|
61365
|
+
invocation: "opencode run --dir <project-dir> '/swarm recover <task_id>'",
|
|
61366
|
+
note: "PowerShell headless \u2014 single quotes keep the /swarm message argument literal."
|
|
61367
|
+
},
|
|
61368
|
+
{
|
|
61369
|
+
surface: "git-bash",
|
|
61370
|
+
invocation: 'opencode run --dir <project-dir> "//swarm recover <task_id>"',
|
|
61371
|
+
note: "Git Bash (MSYS) headless \u2014 the leading slash is doubled because MSYS rewrites a single leading-slash argument to C:/Program Files/Git/swarm \u2026; do NOT set MSYS_NO_PATHCONV=1 globally (it breaks --dir /c/... conversion)."
|
|
61372
|
+
},
|
|
61373
|
+
{
|
|
61374
|
+
surface: "cli",
|
|
61375
|
+
invocation: "bunx opencode-swarm run recover <task_id> [--force]",
|
|
61376
|
+
note: "Shell-neutral CLI \u2014 same command in every shell; --force is an operator assertion that no dispatch is genuinely in flight."
|
|
61377
|
+
}
|
|
61378
|
+
];
|
|
61379
|
+
function renderRecoveryInvocationQuickForms(docPath = RECOVERY_RUNBOOK_DOC_PATH) {
|
|
61380
|
+
const labels = {
|
|
61381
|
+
host: "host command path",
|
|
61382
|
+
powershell: "PowerShell headless",
|
|
61383
|
+
"git-bash": "Git Bash (MSYS) headless",
|
|
61384
|
+
cli: "shell-neutral CLI"
|
|
61385
|
+
};
|
|
61386
|
+
const notes = {
|
|
61387
|
+
host: "",
|
|
61388
|
+
powershell: "",
|
|
61389
|
+
"git-bash": " (leading slash doubled \u2014 MSYS rewrites a single leading slash; never set MSYS_NO_PATHCONV=1 for the whole invocation)",
|
|
61390
|
+
cli: ""
|
|
61391
|
+
};
|
|
61392
|
+
return [
|
|
61393
|
+
`Shell-correct invocations (see ${docPath}):`,
|
|
61394
|
+
...RECOVERY_INVOCATIONS.map((form) => `- ${labels[form.surface]}: ${form.invocation}${notes[form.surface]}`)
|
|
61395
|
+
].join(`
|
|
61396
|
+
`);
|
|
61397
|
+
}
|
|
61398
|
+
|
|
61399
|
+
// src/workflow/stage-a-repair.ts
|
|
61400
|
+
import { readdir as readdir5 } from "fs/promises";
|
|
61401
|
+
init_path_identity();
|
|
61402
|
+
init_logger();
|
|
61403
|
+
|
|
61404
|
+
// src/workflow/task-recovery-status.ts
|
|
61405
|
+
init_path_identity();
|
|
61406
|
+
function identitySuffix(status) {
|
|
61407
|
+
const parts = [];
|
|
61408
|
+
if (status.transitionId)
|
|
61409
|
+
parts.push(`transition ${sanitizeDiagnosticText(status.transitionId)}`);
|
|
61410
|
+
if (typeof status.generation === "number")
|
|
61411
|
+
parts.push(`generation ${status.generation}`);
|
|
61412
|
+
return parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
61413
|
+
}
|
|
61414
|
+
function classifySettlementWalState(entry, workflow) {
|
|
61415
|
+
const base = {
|
|
61416
|
+
taskId: entry.taskId,
|
|
61417
|
+
transitionId: entry.transitionId,
|
|
61418
|
+
generation: entry.expectedGeneration ?? (workflow && workflow.authoritative ? workflow.generation : undefined)
|
|
61419
|
+
};
|
|
61420
|
+
if (entry.state === "unreadable") {
|
|
61421
|
+
return {
|
|
61422
|
+
...base,
|
|
61423
|
+
category: "corrupt",
|
|
61424
|
+
repairAllowed: false,
|
|
61425
|
+
uncertainExternalEffect: true,
|
|
61426
|
+
explanation: "settlement WAL is corrupt (unreadable bytes) \u2014 recovery refuses corrupt facts instead of rewriting them; the task stays blocked until a human reconciles the file",
|
|
61427
|
+
suggestedNextCommand: "inspect .swarm/coder-settlements/" + entry.taskId + ".json and consult docs/troubleshooting/recovery-runbook.md \u2014 do not delete or hand-edit the file"
|
|
61428
|
+
};
|
|
61429
|
+
}
|
|
61430
|
+
if (entry.ownedByLiveForeignPid) {
|
|
61431
|
+
return {
|
|
61432
|
+
...base,
|
|
61433
|
+
category: "ambiguous",
|
|
61434
|
+
repairAllowed: false,
|
|
61435
|
+
uncertainExternalEffect: true,
|
|
61436
|
+
explanation: `owned by live foreign process pid ${entry.processId ?? "?"} (another OpenCode instance) \u2014 the dispatch may genuinely be in flight, so this host never interrupts it and the external effect stays uncertain`,
|
|
61437
|
+
suggestedNextCommand: `close that instance (or run /swarm recover ${entry.taskId} there), then re-run diagnose here`
|
|
61438
|
+
};
|
|
61439
|
+
}
|
|
61440
|
+
if (entry.ownedInProcess) {
|
|
61441
|
+
return {
|
|
61442
|
+
...base,
|
|
61443
|
+
category: "ambiguous",
|
|
61444
|
+
repairAllowed: false,
|
|
61445
|
+
uncertainExternalEffect: true,
|
|
61446
|
+
explanation: "in flight, in this process \u2014 the dispatch may still complete on its own; releasing it is an operator assertion, not a status claim",
|
|
61447
|
+
suggestedNextCommand: `wait for the dispatch to settle, or re-run /swarm recover ${entry.taskId} --force only if no coder is genuinely running`
|
|
61448
|
+
};
|
|
61449
|
+
}
|
|
61450
|
+
if (entry.state === "DISPATCHED" || entry.state === "PREPARED") {
|
|
61451
|
+
const generationConflict = typeof entry.expectedGeneration === "number" && workflow !== null && workflow.authoritative && workflow.generation !== entry.expectedGeneration;
|
|
61452
|
+
return {
|
|
61453
|
+
...base,
|
|
61454
|
+
category: "stale",
|
|
61455
|
+
repairAllowed: true,
|
|
61456
|
+
uncertainExternalEffect: false,
|
|
61457
|
+
explanation: `${entry.state.toLowerCase()} settlement whose owning process is gone${generationConflict ? ` \u2014 the WAL's generation fence (${entry.expectedGeneration}) no longer matches the workflow generation (${workflow?.generation}), so the stale receipt cannot be consumed by a normal settle and recovery is the only deterministic path` : ""} \u2014 blocks dispatches with CODER_DISPATCH_IN_PROGRESS`,
|
|
61458
|
+
suggestedNextCommand: `/swarm recover ${entry.taskId}`
|
|
61459
|
+
};
|
|
61460
|
+
}
|
|
61461
|
+
return {
|
|
61462
|
+
...base,
|
|
61463
|
+
category: "healthy",
|
|
61464
|
+
repairAllowed: false,
|
|
61465
|
+
uncertainExternalEffect: false,
|
|
61466
|
+
explanation: `settlement ${entry.state.toLowerCase()}`,
|
|
61467
|
+
suggestedNextCommand: ""
|
|
61468
|
+
};
|
|
61469
|
+
}
|
|
61470
|
+
function classifyEvidenceRecoveryTask(taskId, evidence2, greenPreCheck) {
|
|
61471
|
+
const snapshot = evidence2?.workflow !== undefined && evidence2.workflow !== null ? { ...evidence2.workflow, authoritative: true } : null;
|
|
61472
|
+
if (snapshot === null) {
|
|
61473
|
+
return {
|
|
61474
|
+
taskId,
|
|
61475
|
+
category: "missing",
|
|
61476
|
+
repairAllowed: false,
|
|
61477
|
+
uncertainExternalEffect: false,
|
|
61478
|
+
explanation: "no durable receipt exists for this task (no settlement WAL, no evidence workflow) \u2014 nothing to repair",
|
|
61479
|
+
suggestedNextCommand: "dispatch the task normally, then re-run diagnose; if it was dispatched, see docs/troubleshooting/recovery-runbook.md"
|
|
61480
|
+
};
|
|
61481
|
+
}
|
|
61482
|
+
const base = {
|
|
61483
|
+
taskId,
|
|
61484
|
+
transitionId: snapshot.lastTransitionId ?? undefined,
|
|
61485
|
+
generation: snapshot.generation
|
|
61486
|
+
};
|
|
61487
|
+
if (snapshot.state === "coder_delegated") {
|
|
61488
|
+
const hasPreCheckProof = evidence2?.gates?.pre_check !== undefined;
|
|
61489
|
+
if (!hasPreCheckProof) {
|
|
61490
|
+
return {
|
|
61491
|
+
...base,
|
|
61492
|
+
category: "live_wedge",
|
|
61493
|
+
repairAllowed: greenPreCheck === true,
|
|
61494
|
+
uncertainExternalEffect: false,
|
|
61495
|
+
explanation: `live-shaped task wedge \u2014 workflow at coder_delegated with no pre_check gate proof${greenPreCheck === true ? " and green post-settlement pre-check bundles: the missing Stage A receipt is deterministically repairable without re-running the coder or editing evidence" : greenPreCheck === false ? " but pre-check proof is missing or not green: run pre_check_batch first \u2014 the repair refuses to mark Stage A passed without proof" : ""}`,
|
|
61496
|
+
suggestedNextCommand: `/swarm recover ${taskId}`
|
|
61497
|
+
};
|
|
61498
|
+
}
|
|
61499
|
+
}
|
|
61500
|
+
return {
|
|
61501
|
+
...base,
|
|
61502
|
+
category: "healthy",
|
|
61503
|
+
repairAllowed: false,
|
|
61504
|
+
uncertainExternalEffect: false,
|
|
61505
|
+
explanation: `workflow ${snapshot.state}`,
|
|
61506
|
+
suggestedNextCommand: ""
|
|
61507
|
+
};
|
|
61508
|
+
}
|
|
61509
|
+
function renderTaskRecoveryLine(status) {
|
|
61510
|
+
if (status.category === "healthy")
|
|
61511
|
+
return "";
|
|
61512
|
+
const suffix = identitySuffix(status);
|
|
61513
|
+
const command = status.suggestedNextCommand ? ` \u2014 ${status.suggestedNextCommand}` : "";
|
|
61514
|
+
return `task ${status.taskId} [${status.category}] ${status.explanation}${suffix}${command}`;
|
|
61515
|
+
}
|
|
61516
|
+
|
|
61517
|
+
// src/workflow/stage-a-repair.ts
|
|
61518
|
+
var MAX_STAGE_A_REPAIR_SCAN = 200;
|
|
61519
|
+
async function appendStageARepairEvent(directory, payload) {
|
|
61520
|
+
try {
|
|
61521
|
+
appendCoreEventSync(directory, {
|
|
61522
|
+
type: "stage_a_repair",
|
|
61523
|
+
timestamp: new Date().toISOString(),
|
|
61524
|
+
...payload
|
|
61525
|
+
});
|
|
61526
|
+
} catch (error2) {
|
|
61527
|
+
criticalWarn(`[stage-a-repair] audit event write failed: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
61528
|
+
}
|
|
61529
|
+
}
|
|
61530
|
+
async function hasGreenPostSettlementPreCheck(directory, settledAfterMs) {
|
|
61531
|
+
let sawSecretscanGreen = false;
|
|
61532
|
+
let sawSastGreen = false;
|
|
61533
|
+
for (const evidenceType of ["secretscan", "sast_scan"]) {
|
|
61534
|
+
let result;
|
|
61535
|
+
try {
|
|
61536
|
+
result = await loadEvidence(directory, evidenceType, { migrate: false });
|
|
61537
|
+
} catch {
|
|
61538
|
+
continue;
|
|
61539
|
+
}
|
|
61540
|
+
if (result.status !== "found")
|
|
61541
|
+
continue;
|
|
61542
|
+
const entryTypeTag = evidenceType === "sast_scan" ? "sast" : evidenceType;
|
|
61543
|
+
const typed = result.bundle.entries.filter((entry) => entry.type === entryTypeTag);
|
|
61544
|
+
if (typed.length === 0)
|
|
61545
|
+
continue;
|
|
61546
|
+
const last = typed[typed.length - 1];
|
|
61547
|
+
const ts = Date.parse(String(last.timestamp ?? ""));
|
|
61548
|
+
if (settledAfterMs !== null && Number.isFinite(ts) && ts < settledAfterMs) {
|
|
61549
|
+
return { green: false, reason: "pre_check_failed_or_stale" };
|
|
61550
|
+
}
|
|
61551
|
+
if (evidenceType === "secretscan") {
|
|
61552
|
+
if ((last.verdict === "pass" || last.verdict === "approved" || last.verdict === "info") && isSecretscanEvidence(last) && (last.incomplete_files ?? 0) === 0 && (last.files_scanned ?? 0) > 0 && (last.findings_count ?? 0) === 0) {
|
|
61553
|
+
sawSecretscanGreen = true;
|
|
61554
|
+
continue;
|
|
61555
|
+
}
|
|
61556
|
+
} else if (last.verdict === "pass" || last.verdict === "approved" || last.verdict === "info") {
|
|
61557
|
+
sawSastGreen = true;
|
|
61558
|
+
continue;
|
|
61559
|
+
}
|
|
61560
|
+
if (last.verdict === "fail" || last.verdict === "rejected") {
|
|
61561
|
+
return { green: false, reason: "pre_check_failed_or_stale" };
|
|
61562
|
+
}
|
|
61563
|
+
}
|
|
61564
|
+
if (!sawSecretscanGreen || !sawSastGreen) {
|
|
61565
|
+
return { green: false, reason: "no_pre_check_bundles" };
|
|
61566
|
+
}
|
|
61567
|
+
return { green: true };
|
|
61568
|
+
}
|
|
61569
|
+
async function enumerateStageACandidates(directory, requested) {
|
|
61570
|
+
let entries2;
|
|
61571
|
+
try {
|
|
61572
|
+
const evidenceDir = validateSwarmPath(directory, "evidence");
|
|
61573
|
+
entries2 = await readdir5(evidenceDir);
|
|
61574
|
+
} catch {
|
|
61575
|
+
return { selected: [], truncated: false };
|
|
61576
|
+
}
|
|
61577
|
+
const candidates = entries2.filter((entry) => entry.endsWith(".json") && isStrictTaskId(entry.slice(0, -".json".length)));
|
|
61578
|
+
const selected = requested?.length ? candidates.filter((entry) => requested.includes(entry.slice(0, -".json".length))) : candidates;
|
|
61579
|
+
const truncated = !requested?.length && candidates.length > MAX_STAGE_A_REPAIR_SCAN;
|
|
61580
|
+
return {
|
|
61581
|
+
selected: selected.sort().slice(0, MAX_STAGE_A_REPAIR_SCAN).map((entry) => entry.slice(0, -".json".length)),
|
|
61582
|
+
truncated
|
|
61583
|
+
};
|
|
61584
|
+
}
|
|
61585
|
+
async function scanStageATask(directory, taskId, walStates) {
|
|
61586
|
+
const evidence2 = await readTaskEvidence(directory, taskId);
|
|
61587
|
+
const workflow = getTaskWorkflowSnapshot(evidence2);
|
|
61588
|
+
if (workflow.state !== "coder_delegated") {
|
|
61589
|
+
return { kind: "not_wedged", state: workflow.state, evidence: evidence2 };
|
|
61590
|
+
}
|
|
61591
|
+
if (evidence2?.gates?.pre_check) {
|
|
61592
|
+
return { kind: "not_wedged", state: workflow.state, evidence: evidence2 };
|
|
61593
|
+
}
|
|
61594
|
+
let settledAfterMs = null;
|
|
61595
|
+
for (const state of walStates) {
|
|
61596
|
+
if (state.taskId !== taskId)
|
|
61597
|
+
continue;
|
|
61598
|
+
if (state.state !== "COMMITTED")
|
|
61599
|
+
continue;
|
|
61600
|
+
if (state.recordedAt === undefined)
|
|
61601
|
+
continue;
|
|
61602
|
+
const parsed = Date.parse(state.recordedAt);
|
|
61603
|
+
if (!Number.isFinite(parsed))
|
|
61604
|
+
continue;
|
|
61605
|
+
settledAfterMs = settledAfterMs === null ? parsed : Math.max(settledAfterMs, parsed);
|
|
61606
|
+
}
|
|
61607
|
+
if (settledAfterMs === null) {
|
|
61608
|
+
const fallbackTs = Date.parse(workflow.updatedAt);
|
|
61609
|
+
if (Number.isFinite(fallbackTs))
|
|
61610
|
+
settledAfterMs = fallbackTs;
|
|
61611
|
+
}
|
|
61612
|
+
const greenness = await hasGreenPostSettlementPreCheck(directory, settledAfterMs);
|
|
61613
|
+
if (!greenness.green) {
|
|
61614
|
+
return { kind: "not_green", reason: greenness.reason, evidence: evidence2 };
|
|
61615
|
+
}
|
|
61616
|
+
return {
|
|
61617
|
+
kind: "repairable",
|
|
61618
|
+
generation: workflow.generation,
|
|
61619
|
+
green: true,
|
|
61620
|
+
predecessorTransitionId: workflow.lastTransitionId ?? null,
|
|
61621
|
+
evidence: evidence2
|
|
61622
|
+
};
|
|
61623
|
+
}
|
|
61624
|
+
async function scanWedgedStageA(directory, options) {
|
|
61625
|
+
const { selected, truncated } = await enumerateStageACandidates(directory, options?.taskIds);
|
|
61626
|
+
const { states: walStates } = await listCoderSettlementWalStates(directory);
|
|
61627
|
+
const results = [];
|
|
61628
|
+
for (const taskId of selected) {
|
|
61629
|
+
try {
|
|
61630
|
+
const verdict = await scanStageATask(directory, taskId, walStates);
|
|
61631
|
+
if (verdict.kind === "repairable") {
|
|
61632
|
+
results.push(classifyEvidenceRecoveryTask(taskId, verdict.evidence, verdict.green));
|
|
61633
|
+
} else if (verdict.kind === "not_green") {
|
|
61634
|
+
results.push(classifyEvidenceRecoveryTask(taskId, verdict.evidence, false));
|
|
61635
|
+
} else {
|
|
61636
|
+
results.push(classifyEvidenceRecoveryTask(taskId, verdict.evidence, null));
|
|
61637
|
+
}
|
|
61638
|
+
} catch {}
|
|
61639
|
+
}
|
|
61640
|
+
return { results, truncated };
|
|
61641
|
+
}
|
|
61642
|
+
async function repairWedgedStageA(directory, options) {
|
|
61643
|
+
const requested = options?.taskIds;
|
|
61644
|
+
const { selected, truncated } = await enumerateStageACandidates(directory, requested);
|
|
61645
|
+
const { states: walStates } = await listCoderSettlementWalStates(directory);
|
|
61646
|
+
const results = [];
|
|
61647
|
+
for (const taskId of selected) {
|
|
61648
|
+
try {
|
|
61649
|
+
const scan = await scanStageATask(directory, taskId, walStates);
|
|
61650
|
+
if (scan.kind === "not_wedged") {
|
|
61651
|
+
results.push({
|
|
61652
|
+
taskId,
|
|
61653
|
+
outcome: "skipped_not_wedged",
|
|
61654
|
+
state: scan.state
|
|
61655
|
+
});
|
|
61656
|
+
continue;
|
|
61657
|
+
}
|
|
61658
|
+
if (scan.kind === "not_green") {
|
|
61659
|
+
results.push({
|
|
61660
|
+
taskId,
|
|
61661
|
+
outcome: "skipped_not_green",
|
|
61662
|
+
reason: scan.reason
|
|
61663
|
+
});
|
|
61664
|
+
continue;
|
|
61665
|
+
}
|
|
61666
|
+
const transitionId = `stage-a-repair:${taskId}:${scan.generation}`;
|
|
61667
|
+
await transitionTaskWorkflowEvidence(directory, taskId, {
|
|
61668
|
+
type: "stage_a_passed",
|
|
61669
|
+
expectedGeneration: scan.generation,
|
|
61670
|
+
transitionId
|
|
61671
|
+
});
|
|
61672
|
+
await appendStageARepairEvent(directory, {
|
|
61673
|
+
action: "repaired",
|
|
61674
|
+
taskId,
|
|
61675
|
+
transitionId,
|
|
61676
|
+
generation: scan.generation,
|
|
61677
|
+
predecessorTransitionId: scan.predecessorTransitionId
|
|
61678
|
+
});
|
|
61679
|
+
results.push({
|
|
61680
|
+
taskId,
|
|
61681
|
+
outcome: "repaired",
|
|
61682
|
+
generation: scan.generation,
|
|
61683
|
+
transitionId
|
|
61684
|
+
});
|
|
61685
|
+
} catch (error2) {
|
|
61686
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
61687
|
+
await appendStageARepairEvent(directory, {
|
|
61688
|
+
action: "repair-failed",
|
|
61689
|
+
taskId,
|
|
61690
|
+
message: sanitizeDiagnosticText(message, 512)
|
|
61691
|
+
});
|
|
61692
|
+
results.push({ taskId, outcome: "error", message });
|
|
61693
|
+
}
|
|
61694
|
+
}
|
|
61695
|
+
return { results, truncated };
|
|
61696
|
+
}
|
|
61697
|
+
|
|
61324
61698
|
// src/services/knowledge-diagnostics.ts
|
|
61325
61699
|
init_package();
|
|
61326
61700
|
import { existsSync as existsSync44, readFileSync as readFileSync34 } from "fs";
|
|
@@ -61673,7 +62047,7 @@ async function computeCurationDiagnostics(directory, entries2) {
|
|
|
61673
62047
|
let scanCompleted = false;
|
|
61674
62048
|
let scanRemaining = 0;
|
|
61675
62049
|
try {
|
|
61676
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
62050
|
+
const { getScanStatus } = await import("./scan-cursor-etrpan51.js");
|
|
61677
62051
|
const status = await getScanStatus(directory);
|
|
61678
62052
|
scanGeneration = status.generation;
|
|
61679
62053
|
scanCompleted = status.completed;
|
|
@@ -61681,19 +62055,19 @@ async function computeCurationDiagnostics(directory, entries2) {
|
|
|
61681
62055
|
} catch {}
|
|
61682
62056
|
let configMatch = null;
|
|
61683
62057
|
try {
|
|
61684
|
-
const { isLinked: isLinked2 } = await import("./knowledge-link-
|
|
62058
|
+
const { isLinked: isLinked2 } = await import("./knowledge-link-yx57s7zb.js");
|
|
61685
62059
|
if (isLinked2(directory)) {
|
|
61686
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
62060
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-aarfgdn3.js");
|
|
61687
62061
|
let config;
|
|
61688
62062
|
try {
|
|
61689
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
62063
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-hvt8902r.js");
|
|
61690
62064
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
61691
62065
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
61692
62066
|
} catch {
|
|
61693
62067
|
config = KnowledgeConfigSchema2.parse({});
|
|
61694
62068
|
}
|
|
61695
62069
|
const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
|
|
61696
|
-
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-
|
|
62070
|
+
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-8h25hyf8.js");
|
|
61697
62071
|
const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
|
|
61698
62072
|
const cohortFp = await readCohortConfigFingerprint(directory);
|
|
61699
62073
|
configMatch = cohortFp === null ? null : currentFp === cohortFp;
|
|
@@ -62668,34 +63042,59 @@ async function getDiagnoseData(directory, sessionID) {
|
|
|
62668
63042
|
try {
|
|
62669
63043
|
const { states: settlementStates, truncated } = await listCoderSettlementWalStates(directory);
|
|
62670
63044
|
const truncationNote = truncated ? " MORE settlement WALs exist than the scan cap (200) \u2014 older ones are not shown." : "";
|
|
62671
|
-
|
|
63045
|
+
const settlementStatuses = [];
|
|
63046
|
+
for (const entry of settlementStates) {
|
|
63047
|
+
let workflow = null;
|
|
63048
|
+
try {
|
|
63049
|
+
workflow = getTaskWorkflowSnapshot(await readTaskEvidence(directory, entry.taskId));
|
|
63050
|
+
} catch {
|
|
63051
|
+
workflow = null;
|
|
63052
|
+
}
|
|
63053
|
+
settlementStatuses.push(classifySettlementWalState(entry, workflow));
|
|
63054
|
+
}
|
|
63055
|
+
const wedgeScan = await scanWedgedStageA(directory);
|
|
63056
|
+
const wedgeStatuses = wedgeScan.results.filter((status) => status.category === "live_wedge");
|
|
63057
|
+
const knownTaskIds = new Set([
|
|
63058
|
+
...settlementStates.map((entry) => entry.taskId),
|
|
63059
|
+
...wedgeScan.results.map((status) => status.taskId)
|
|
63060
|
+
]);
|
|
63061
|
+
const missingStatuses = [];
|
|
63062
|
+
if (!truncated && !wedgeScan.truncated) {
|
|
63063
|
+
const planTaskIds = (plan?.phases ?? []).flatMap((phase) => phase.tasks.map((task) => task.id)).slice(0, 200);
|
|
63064
|
+
for (const taskId of planTaskIds) {
|
|
63065
|
+
if (knownTaskIds.has(taskId))
|
|
63066
|
+
continue;
|
|
63067
|
+
missingStatuses.push(classifyEvidenceRecoveryTask(taskId, null, null));
|
|
63068
|
+
}
|
|
63069
|
+
}
|
|
63070
|
+
const nonHealthy = [
|
|
63071
|
+
...settlementStatuses.filter((s) => s.category !== "healthy"),
|
|
63072
|
+
...wedgeStatuses
|
|
63073
|
+
];
|
|
63074
|
+
const missingLines = missingStatuses.map(renderTaskRecoveryLine).filter(Boolean);
|
|
63075
|
+
const healthyCount = settlementStatuses.filter((s) => s.category === "healthy").length;
|
|
63076
|
+
if (nonHealthy.length === 0 && !truncated) {
|
|
62672
63077
|
checks.push({
|
|
62673
63078
|
name: "Coder Settlements",
|
|
62674
|
-
status:
|
|
62675
|
-
detail:
|
|
63079
|
+
status: "\u2705",
|
|
63080
|
+
detail: `${missingLines.length > 0 ? `${missingLines.join("; ")}. ` : ""}${settlementStates.length === 0 ? "No coder settlement WALs" : `${settlementStates.length} settlement(s) all in terminal state`}`
|
|
63081
|
+
});
|
|
63082
|
+
} else if (nonHealthy.length === 0 && truncated) {
|
|
63083
|
+
checks.push({
|
|
63084
|
+
name: "Coder Settlements",
|
|
63085
|
+
status: "\u26A0\uFE0F",
|
|
63086
|
+
detail: `All shown settlements are terminal, but the scan was truncated.${truncationNote} ${renderRecoveryInvocationQuickForms()}`
|
|
62676
63087
|
});
|
|
62677
63088
|
} else {
|
|
62678
|
-
const
|
|
62679
|
-
|
|
62680
|
-
|
|
62681
|
-
|
|
62682
|
-
|
|
62683
|
-
|
|
62684
|
-
|
|
62685
|
-
|
|
62686
|
-
|
|
62687
|
-
if (entry.state === "unreadable") {
|
|
62688
|
-
return `task ${entry.taskId}: WAL unreadable`;
|
|
62689
|
-
}
|
|
62690
|
-
const owner = entry.ownedInProcess || entry.ownedByLiveForeignPid ? `owner pid ${entry.processId ?? "?"} still alive \u2014 in flight or wedged` : "owner process is gone \u2014 stale";
|
|
62691
|
-
return `task ${entry.taskId} (${entry.state}, ${owner})`;
|
|
62692
|
-
});
|
|
62693
|
-
checks.push({
|
|
62694
|
-
name: "Coder Settlements",
|
|
62695
|
-
status: "\u26A0\uFE0F",
|
|
62696
|
-
detail: `${nonTerminal.length > 0 ? `${nonTerminal.length} non-terminal settlement(s): ${details.join("; ")}.` : "All shown settlements are terminal, but the scan was truncated."} Stale settlements block dispatches with CODER_DISPATCH_IN_PROGRESS \u2014 run /swarm recover [task_id] (--force if no dispatch is genuinely running) or /swarm reset-session.${truncationNote}`
|
|
62697
|
-
});
|
|
62698
|
-
}
|
|
63089
|
+
const lines = [
|
|
63090
|
+
...nonHealthy.map(renderTaskRecoveryLine).filter(Boolean),
|
|
63091
|
+
...missingLines
|
|
63092
|
+
];
|
|
63093
|
+
checks.push({
|
|
63094
|
+
name: "Coder Settlements",
|
|
63095
|
+
status: "\u26A0\uFE0F",
|
|
63096
|
+
detail: `${lines.join("; ")}${healthyCount > 0 ? `; ${healthyCount} healthy settlement(s)` : ""}. Categories: missing/stale/ambiguous/corrupt/live_wedge \u2014 stale settlements block dispatches with CODER_DISPATCH_IN_PROGRESS. ${renderRecoveryInvocationQuickForms()}${truncationNote}`
|
|
63097
|
+
});
|
|
62699
63098
|
}
|
|
62700
63099
|
} catch (error2) {
|
|
62701
63100
|
checks.push({
|
|
@@ -63084,7 +63483,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
63084
63483
|
const result = runConfigDoctor(config, directory);
|
|
63085
63484
|
let output;
|
|
63086
63485
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
63087
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
63486
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-3x9d5y3w.js");
|
|
63088
63487
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
63089
63488
|
applyLossy: true
|
|
63090
63489
|
});
|
|
@@ -64038,7 +64437,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
64038
64437
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
64039
64438
|
}
|
|
64040
64439
|
async function handleEvidenceSummaryCommand(directory) {
|
|
64041
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
64440
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-t4nnvgyz.js");
|
|
64042
64441
|
const artifact = await buildEvidenceSummary(directory);
|
|
64043
64442
|
if (!artifact) {
|
|
64044
64443
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -74027,7 +74426,7 @@ import {
|
|
|
74027
74426
|
chmod,
|
|
74028
74427
|
copyFile as copyFile2,
|
|
74029
74428
|
mkdir as mkdir16,
|
|
74030
|
-
readdir as
|
|
74429
|
+
readdir as readdir6,
|
|
74031
74430
|
readFile as readFile21,
|
|
74032
74431
|
realpath as realpath5,
|
|
74033
74432
|
rm as rm6,
|
|
@@ -74828,7 +75227,7 @@ var _internals79 = {
|
|
|
74828
75227
|
copyFile: copyFile2,
|
|
74829
75228
|
mkdir: mkdir16,
|
|
74830
75229
|
stat: stat8,
|
|
74831
|
-
readdir:
|
|
75230
|
+
readdir: readdir6,
|
|
74832
75231
|
resolveHiveDataDir,
|
|
74833
75232
|
resolveHiveKnowledgePath,
|
|
74834
75233
|
transactHiveStore,
|
|
@@ -84086,7 +84485,7 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
|
|
|
84086
84485
|
}
|
|
84087
84486
|
const sdkOpts = signal ? { signal } : {};
|
|
84088
84487
|
try {
|
|
84089
|
-
const { getSwarmAgents: getSwarmAgents2, resolveFallbackModel: resolveFallbackModel2 } = await import("./index-
|
|
84488
|
+
const { getSwarmAgents: getSwarmAgents2, resolveFallbackModel: resolveFallbackModel2 } = await import("./index-rm1k8ekt.js");
|
|
84090
84489
|
const createResult = await client.session.create({
|
|
84091
84490
|
...sessionId ? {
|
|
84092
84491
|
body: {
|
|
@@ -91960,158 +92359,6 @@ async function handleQaGatesCommand(directory, args, sessionID) {
|
|
|
91960
92359
|
|
|
91961
92360
|
// src/commands/recover.ts
|
|
91962
92361
|
init_path_identity();
|
|
91963
|
-
|
|
91964
|
-
// src/workflow/stage-a-repair.ts
|
|
91965
|
-
import { readdir as readdir8 } from "fs/promises";
|
|
91966
|
-
init_path_identity();
|
|
91967
|
-
init_logger();
|
|
91968
|
-
var MAX_STAGE_A_REPAIR_SCAN = 200;
|
|
91969
|
-
async function appendStageARepairEvent(directory, payload) {
|
|
91970
|
-
try {
|
|
91971
|
-
appendCoreEventSync(directory, {
|
|
91972
|
-
type: "stage_a_repair",
|
|
91973
|
-
timestamp: new Date().toISOString(),
|
|
91974
|
-
...payload
|
|
91975
|
-
});
|
|
91976
|
-
} catch (error2) {
|
|
91977
|
-
criticalWarn(`[stage-a-repair] audit event write failed: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
91978
|
-
}
|
|
91979
|
-
}
|
|
91980
|
-
async function hasGreenPostSettlementPreCheck(directory, settledAfterMs) {
|
|
91981
|
-
let sawSecretscanGreen = false;
|
|
91982
|
-
let sawSastGreen = false;
|
|
91983
|
-
for (const evidenceType of ["secretscan", "sast_scan"]) {
|
|
91984
|
-
let result;
|
|
91985
|
-
try {
|
|
91986
|
-
result = await loadEvidence(directory, evidenceType, { migrate: false });
|
|
91987
|
-
} catch {
|
|
91988
|
-
continue;
|
|
91989
|
-
}
|
|
91990
|
-
if (result.status !== "found")
|
|
91991
|
-
continue;
|
|
91992
|
-
const entryTypeTag = evidenceType === "sast_scan" ? "sast" : evidenceType;
|
|
91993
|
-
const typed = result.bundle.entries.filter((entry) => entry.type === entryTypeTag);
|
|
91994
|
-
if (typed.length === 0)
|
|
91995
|
-
continue;
|
|
91996
|
-
const last = typed[typed.length - 1];
|
|
91997
|
-
const ts = Date.parse(String(last.timestamp ?? ""));
|
|
91998
|
-
if (settledAfterMs !== null && Number.isFinite(ts) && ts < settledAfterMs) {
|
|
91999
|
-
return { green: false, reason: "pre_check_failed_or_stale" };
|
|
92000
|
-
}
|
|
92001
|
-
if (evidenceType === "secretscan") {
|
|
92002
|
-
if ((last.verdict === "pass" || last.verdict === "approved" || last.verdict === "info") && isSecretscanEvidence(last) && (last.incomplete_files ?? 0) === 0 && (last.files_scanned ?? 0) > 0 && (last.findings_count ?? 0) === 0) {
|
|
92003
|
-
sawSecretscanGreen = true;
|
|
92004
|
-
continue;
|
|
92005
|
-
}
|
|
92006
|
-
} else if (last.verdict === "pass" || last.verdict === "approved" || last.verdict === "info") {
|
|
92007
|
-
sawSastGreen = true;
|
|
92008
|
-
continue;
|
|
92009
|
-
}
|
|
92010
|
-
if (last.verdict === "fail" || last.verdict === "rejected") {
|
|
92011
|
-
return { green: false, reason: "pre_check_failed_or_stale" };
|
|
92012
|
-
}
|
|
92013
|
-
}
|
|
92014
|
-
if (!sawSecretscanGreen || !sawSastGreen) {
|
|
92015
|
-
return { green: false, reason: "no_pre_check_bundles" };
|
|
92016
|
-
}
|
|
92017
|
-
return { green: true };
|
|
92018
|
-
}
|
|
92019
|
-
async function repairWedgedStageA(directory, options) {
|
|
92020
|
-
const requested = options?.taskIds;
|
|
92021
|
-
let entries2;
|
|
92022
|
-
try {
|
|
92023
|
-
const evidenceDir = validateSwarmPath(directory, "evidence");
|
|
92024
|
-
entries2 = await readdir8(evidenceDir);
|
|
92025
|
-
} catch {
|
|
92026
|
-
return { results: [], truncated: false };
|
|
92027
|
-
}
|
|
92028
|
-
const candidates = entries2.filter((entry) => entry.endsWith(".json") && isStrictTaskId(entry.slice(0, -".json".length)));
|
|
92029
|
-
const selected = requested?.length ? candidates.filter((entry) => requested.includes(entry.slice(0, -".json".length))) : candidates;
|
|
92030
|
-
const truncated = !requested?.length && candidates.length > MAX_STAGE_A_REPAIR_SCAN;
|
|
92031
|
-
const results = [];
|
|
92032
|
-
for (const entry of selected.sort().slice(0, MAX_STAGE_A_REPAIR_SCAN)) {
|
|
92033
|
-
const taskId = entry.slice(0, -".json".length);
|
|
92034
|
-
try {
|
|
92035
|
-
const evidence2 = await readTaskEvidence(directory, taskId);
|
|
92036
|
-
const workflow = getTaskWorkflowSnapshot(evidence2);
|
|
92037
|
-
if (workflow.state !== "coder_delegated") {
|
|
92038
|
-
results.push({
|
|
92039
|
-
taskId,
|
|
92040
|
-
outcome: "skipped_not_wedged",
|
|
92041
|
-
state: workflow.state
|
|
92042
|
-
});
|
|
92043
|
-
continue;
|
|
92044
|
-
}
|
|
92045
|
-
if (evidence2?.gates?.pre_check) {
|
|
92046
|
-
results.push({
|
|
92047
|
-
taskId,
|
|
92048
|
-
outcome: "skipped_not_wedged",
|
|
92049
|
-
state: workflow.state
|
|
92050
|
-
});
|
|
92051
|
-
continue;
|
|
92052
|
-
}
|
|
92053
|
-
let settledAfterMs = null;
|
|
92054
|
-
try {
|
|
92055
|
-
const { states } = await listCoderSettlementWalStates(directory);
|
|
92056
|
-
for (const state of states) {
|
|
92057
|
-
if (state.taskId !== taskId)
|
|
92058
|
-
continue;
|
|
92059
|
-
if (state.state !== "COMMITTED")
|
|
92060
|
-
continue;
|
|
92061
|
-
if (state.recordedAt === undefined)
|
|
92062
|
-
continue;
|
|
92063
|
-
const parsed = Date.parse(state.recordedAt);
|
|
92064
|
-
if (!Number.isFinite(parsed))
|
|
92065
|
-
continue;
|
|
92066
|
-
settledAfterMs = settledAfterMs === null ? parsed : Math.max(settledAfterMs, parsed);
|
|
92067
|
-
}
|
|
92068
|
-
} catch {}
|
|
92069
|
-
if (settledAfterMs === null) {
|
|
92070
|
-
const fallbackTs = Date.parse(workflow.updatedAt);
|
|
92071
|
-
if (Number.isFinite(fallbackTs))
|
|
92072
|
-
settledAfterMs = fallbackTs;
|
|
92073
|
-
}
|
|
92074
|
-
const greenness = await hasGreenPostSettlementPreCheck(directory, settledAfterMs);
|
|
92075
|
-
if (!greenness.green) {
|
|
92076
|
-
results.push({
|
|
92077
|
-
taskId,
|
|
92078
|
-
outcome: "skipped_not_green",
|
|
92079
|
-
reason: greenness.reason
|
|
92080
|
-
});
|
|
92081
|
-
continue;
|
|
92082
|
-
}
|
|
92083
|
-
const transitionId = `stage-a-repair:${taskId}:${workflow.generation}`;
|
|
92084
|
-
await transitionTaskWorkflowEvidence(directory, taskId, {
|
|
92085
|
-
type: "stage_a_passed",
|
|
92086
|
-
expectedGeneration: workflow.generation,
|
|
92087
|
-
transitionId
|
|
92088
|
-
});
|
|
92089
|
-
await appendStageARepairEvent(directory, {
|
|
92090
|
-
action: "repaired",
|
|
92091
|
-
taskId,
|
|
92092
|
-
transitionId,
|
|
92093
|
-
generation: workflow.generation
|
|
92094
|
-
});
|
|
92095
|
-
results.push({
|
|
92096
|
-
taskId,
|
|
92097
|
-
outcome: "repaired",
|
|
92098
|
-
generation: workflow.generation,
|
|
92099
|
-
transitionId
|
|
92100
|
-
});
|
|
92101
|
-
} catch (error2) {
|
|
92102
|
-
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
92103
|
-
await appendStageARepairEvent(directory, {
|
|
92104
|
-
action: "repair-failed",
|
|
92105
|
-
taskId,
|
|
92106
|
-
message: sanitizeDiagnosticText(message, 512)
|
|
92107
|
-
});
|
|
92108
|
-
results.push({ taskId, outcome: "error", message });
|
|
92109
|
-
}
|
|
92110
|
-
}
|
|
92111
|
-
return { results, truncated };
|
|
92112
|
-
}
|
|
92113
|
-
|
|
92114
|
-
// src/commands/recover.ts
|
|
92115
92362
|
function renderOutcome(outcome) {
|
|
92116
92363
|
switch (outcome.outcome) {
|
|
92117
92364
|
case "recovered":
|
|
@@ -92123,7 +92370,7 @@ function renderOutcome(outcome) {
|
|
|
92123
92370
|
case "owned_by_live_foreign_pid":
|
|
92124
92371
|
return `\u2139\uFE0F Task ${outcome.taskId}: owned by live process pid ${outcome.processId} (another OpenCode instance). Close that instance or run /swarm recover there; this command never interrupts another live process's dispatch.`;
|
|
92125
92372
|
case "unreadable_wal":
|
|
92126
|
-
return `\u26A0\uFE0F Task ${outcome.taskId}: settlement WAL is unreadable \u2014 inspect .swarm/coder-settlements/${outcome.taskId}.json`;
|
|
92373
|
+
return `\u26A0\uFE0F Task ${outcome.taskId}: settlement WAL is unreadable (corrupt) \u2014 this command refuses corrupt WALs; inspect .swarm/coder-settlements/${outcome.taskId}.json and consult docs/troubleshooting/recovery-runbook.md; do not delete or hand-edit the file`;
|
|
92127
92374
|
case "error":
|
|
92128
92375
|
return `\u274C Task ${outcome.taskId}: recovery failed \u2014 ${sanitizeDiagnosticText(outcome.message, 512)}`;
|
|
92129
92376
|
default:
|
|
@@ -92213,6 +92460,7 @@ async function handleRecoverCommand(directory, args) {
|
|
|
92213
92460
|
} catch (err) {
|
|
92214
92461
|
report.push("", `\u26A0\uFE0F Wedged Stage A repair failed (settlement recovery above is unaffected): ${sanitizeDiagnosticText(err instanceof Error ? err.message : String(err), 512)}`);
|
|
92215
92462
|
}
|
|
92463
|
+
report.push("", renderRecoveryInvocationQuickForms());
|
|
92216
92464
|
return report.join(`
|
|
92217
92465
|
`);
|
|
92218
92466
|
}
|
|
@@ -98155,7 +98403,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
98155
98403
|
if (!input.dispatcher) {
|
|
98156
98404
|
throw new Error("no evaluation dispatcher available (cannot run validation)");
|
|
98157
98405
|
}
|
|
98158
|
-
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-
|
|
98406
|
+
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-j4hrfyve.js");
|
|
98159
98407
|
const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
|
|
98160
98408
|
const result = await withProtectedSetIntegrity([evalInputRoot, ...protectedRoots(input.directory)], () => _internals118.evaluateCandidateV1({
|
|
98161
98409
|
projectRoot: input.directory,
|
|
@@ -100784,7 +101032,7 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
100784
101032
|
async function handleHelpCommand(ctx) {
|
|
100785
101033
|
const targetCommand = ctx.args.join(" ");
|
|
100786
101034
|
if (!targetCommand) {
|
|
100787
|
-
const { buildHelpText } = await import("./index-
|
|
101035
|
+
const { buildHelpText } = await import("./index-dn5kkjfv.js");
|
|
100788
101036
|
return buildHelpText();
|
|
100789
101037
|
}
|
|
100790
101038
|
const tokens = targetCommand.split(/\s+/);
|
|
@@ -100798,7 +101046,7 @@ async function handleHelpCommand(ctx) {
|
|
|
100798
101046
|
> Note: \`/swarm ${resolved.key}\` is a deprecated alias for \`/swarm ${aliasTarget}\`.` : detailed;
|
|
100799
101047
|
}
|
|
100800
101048
|
const similar = _internals24.findSimilarCommands(targetCommand);
|
|
100801
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
101049
|
+
const { buildHelpText: fullHelp } = await import("./index-dn5kkjfv.js");
|
|
100802
101050
|
if (similar.length > 0) {
|
|
100803
101051
|
return `Command '/swarm ${targetCommand}' not found.
|
|
100804
101052
|
|
|
@@ -101113,7 +101361,7 @@ var COMMAND_REGISTRY = {
|
|
|
101113
101361
|
},
|
|
101114
101362
|
"guardrail explain": {
|
|
101115
101363
|
handler: async (ctx) => {
|
|
101116
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
101364
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-x8n8dtq6.js");
|
|
101117
101365
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
101118
101366
|
},
|
|
101119
101367
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -101123,7 +101371,7 @@ var COMMAND_REGISTRY = {
|
|
|
101123
101371
|
},
|
|
101124
101372
|
"guardrail reset": {
|
|
101125
101373
|
handler: async (ctx) => {
|
|
101126
|
-
const { handleGuardrailReset } = await import("./guardrail-reset-
|
|
101374
|
+
const { handleGuardrailReset } = await import("./guardrail-reset-ceqcapzm.js");
|
|
101127
101375
|
return handleGuardrailReset(ctx.args, ctx.sessionID);
|
|
101128
101376
|
},
|
|
101129
101377
|
description: "Reset one exact active invocation/action circuit after repair",
|
|
@@ -101144,7 +101392,7 @@ var COMMAND_REGISTRY = {
|
|
|
101144
101392
|
},
|
|
101145
101393
|
"guardrail-log": {
|
|
101146
101394
|
handler: async (ctx) => {
|
|
101147
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
101395
|
+
const { handleGuardrailLog } = await import("./guardrail-log-ehwt0w51.js");
|
|
101148
101396
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
101149
101397
|
},
|
|
101150
101398
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -101840,7 +102088,7 @@ Subcommands:
|
|
|
101840
102088
|
recover: {
|
|
101841
102089
|
handler: (ctx) => handleRecoverCommand(ctx.directory, ctx.args),
|
|
101842
102090
|
description: "Recover wedged coder settlements [task_id] [--force]",
|
|
101843
|
-
details: "Settles stale coder-settlement WALs in .swarm/coder-settlements/ \u2014 the CODER_DISPATCH_IN_PROGRESS wedge where a dispatch's completion never fired (issue #2268). Safe mode recovers settlements whose owner process is gone. --force also releases ownership keys held by this process: use only when no dispatch is genuinely running (a late completion then reports CODER_SETTLEMENT_IDEMPOTENCY_CONFLICT, safe to ignore). Never interrupts another live OpenCode process. Also repairs tasks wedged at coder_delegated with unattributed green pre_check evidence \u2014 the post-reset TASK_WORKFLOW_STAGE_A_REQUIRED wedge \u2014 by writing the missing stage_a_passed transition directly (audit events land in .swarm/events.jsonl); pass [task_id] to scope both phases to one task. Human-only.",
|
|
102091
|
+
details: "Settles stale coder-settlement WALs in .swarm/coder-settlements/ \u2014 the CODER_DISPATCH_IN_PROGRESS wedge where a dispatch's completion never fired (issue #2268). Safe mode recovers settlements whose owner process is gone. --force also releases ownership keys held by this process: use only when no dispatch is genuinely running (a late completion then reports CODER_SETTLEMENT_IDEMPOTENCY_CONFLICT, safe to ignore). Never interrupts another live OpenCode process. Also repairs tasks wedged at coder_delegated with unattributed green pre_check evidence \u2014 the post-reset TASK_WORKFLOW_STAGE_A_REQUIRED wedge \u2014 by writing the missing stage_a_passed transition directly (audit events land in .swarm/events.jsonl); pass [task_id] to scope both phases to one task. Diagnose and repair emit per-category status explanations (missing/stale/ambiguous/corrupt/live_wedge) with shell-correct invocation guidance per host \u2014 see docs/troubleshooting/recovery-runbook.md (#2665). Human-only.",
|
|
101844
102092
|
args: "[task_id] [--force]",
|
|
101845
102093
|
category: "utility",
|
|
101846
102094
|
toolPolicy: "human-only"
|