opencode-swarm 7.164.1 → 7.164.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/skills/codebase-review-swarm/SKILL.md +4 -0
- package/.opencode/skills/commit-pr/SKILL.md +4 -1
- package/.opencode/skills/critic-gate/SKILL.md +4 -0
- package/.opencode/skills/deep-dive/SKILL.md +4 -0
- package/.opencode/skills/engineering-conventions/SKILL.md +2 -0
- package/.opencode/skills/execute/SKILL.md +4 -0
- package/.opencode/skills/phase-wrap/SKILL.md +4 -0
- package/.opencode/skills/plan/SKILL.md +4 -0
- package/.opencode/skills/running-tests/SKILL.md +4 -0
- package/.opencode/skills/swarm-pr-review/SKILL.md +4 -0
- package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +2 -0
- package/.opencode/skills/writing-tests/SKILL.md +4 -0
- package/dist/agents/critic.d.ts +6 -6
- package/dist/cli/{coder-settlement-w4qk90kh.js → coder-settlement-kv1x94w6.js} +9 -9
- package/dist/cli/{config-doctor-r81bp1nd.js → config-doctor-8d7ydxck.js} +3 -3
- package/dist/cli/{core-xfw4s9b9.js → core-7jjgxczp.js} +2 -2
- package/dist/cli/{curation-policy-2h37sd6p.js → curation-policy-7pnmnfct.js} +5 -5
- package/dist/cli/{curator-7zy6bdmw.js → curator-5nyth2rj.js} +30 -30
- package/dist/cli/{curator-llm-factory-7gjvm4ds.js → curator-llm-factory-d415s169.js} +30 -30
- package/dist/cli/{evidence-summary-service-519ny6b1.js → evidence-summary-service-aebn7nb9.js} +13 -13
- package/dist/cli/{gate-evidence-a7st3vbc.js → gate-evidence-es59pysy.js} +6 -6
- package/dist/cli/{guardrail-explain-ewcm37em.js → guardrail-explain-mn2x7w2y.js} +31 -31
- package/dist/cli/{guardrail-log-kp51by1v.js → guardrail-log-fd3c5rks.js} +7 -7
- package/dist/cli/{guardrail-reset-reyfwtwn.js → guardrail-reset-r49rvptv.js} +30 -30
- package/dist/cli/{hive-promoter-zf2vf5sw.js → hive-promoter-qp2kjhhp.js} +30 -30
- package/dist/cli/{index-dhzsvmx6.js → index-0145kpjr.js} +2 -2
- package/dist/cli/{index-vrxx0ea4.js → index-1r6p1wpa.js} +4 -4
- package/dist/cli/{index-6097tx05.js → index-2xj34nkh.js} +1 -1
- package/dist/cli/{index-r5jn0ah5.js → index-34exj2e3.js} +2 -2
- package/dist/cli/{index-2s40e3b0.js → index-3704v4e6.js} +2 -2
- package/dist/cli/{index-6kd3jnaf.js → index-5d7bzpfn.js} +1 -1
- package/dist/cli/{index-5084szce.js → index-6vtm4rd0.js} +7 -7
- package/dist/cli/{index-hzaw10zh.js → index-92q98ry8.js} +5 -5
- package/dist/cli/{index-j0ajeary.js → index-ac39znep.js} +1 -1
- package/dist/cli/{index-b98r3pyv.js → index-axtnc0xf.js} +4 -4
- package/dist/cli/{index-h2f21caa.js → index-b85jnfp4.js} +2 -2
- package/dist/cli/{index-jczbtx2x.js → index-br7q79t2.js} +6 -6
- package/dist/cli/{index-1b1h770t.js → index-bzd67m2j.js} +3 -3
- package/dist/cli/{index-x2qmpkth.js → index-c8k4cs94.js} +3 -3
- package/dist/cli/{index-644t46hr.js → index-cm4r8gh2.js} +1 -1
- package/dist/cli/{index-pmmfhzsp.js → index-fyt5byhd.js} +3 -3
- package/dist/cli/{index-1af3rb5n.js → index-gz5rn6w6.js} +8 -8
- package/dist/cli/{index-n1wcq816.js → index-h9wnkr2e.js} +4 -4
- package/dist/cli/{index-yc415pzf.js → index-hnwg5gt6.js} +3 -3
- package/dist/cli/{index-vc3zmtxb.js → index-jw9wbwdh.js} +32 -32
- package/dist/cli/{index-e630pvvw.js → index-kwd09y5a.js} +3 -3
- package/dist/cli/{index-2yd732fd.js → index-m1nrd3yd.js} +2 -1
- package/dist/cli/{index-fwfhbs27.js → index-pcnhh2vt.js} +2 -2
- package/dist/cli/{index-wnf1ej2q.js → index-q3xn3m3g.js} +4 -4
- package/dist/cli/{index-wv4b01ex.js → index-qmeewt3g.js} +4 -4
- package/dist/cli/{index-k8j7m0e2.js → index-sb4eanpv.js} +1 -1
- package/dist/cli/{index-vkckf2ch.js → index-w5jpjaqe.js} +2 -2
- package/dist/cli/{index-vdgw2k4c.js → index-w8qt2612.js} +3 -3
- package/dist/cli/{index-862c0xhc.js → index-xm6c1tnf.js} +1 -1
- package/dist/cli/{index-36nt17m8.js → index-yep24wn4.js} +1 -1
- package/dist/cli/{index-2ee2g27m.js → index-yjftcanv.js} +404 -119
- package/dist/cli/{index-6ay5zp1v.js → index-yqhwrjw9.js} +5 -5
- package/dist/cli/{index-5bza8nxz.js → index-zgeqwbhw.js} +2 -2
- package/dist/cli/{index-6t35714n.js → index-zs1jrsta.js} +1 -1
- package/dist/cli/index.js +30 -30
- package/dist/cli/{knowledge-escalator-wwkbsgvw.js → knowledge-escalator-439jajb3.js} +12 -12
- package/dist/cli/{knowledge-events-vmmgwfmc.js → knowledge-events-wz3h98kk.js} +10 -10
- package/dist/cli/{knowledge-link-bvra01zv.js → knowledge-link-2gh1cnk3.js} +4 -4
- package/dist/cli/{knowledge-store-6wbagbqm.js → knowledge-store-y1cwe80n.js} +5 -5
- package/dist/cli/{knowledge-validator-q1z4fmeg.js → knowledge-validator-bk2qfqe2.js} +7 -7
- package/dist/cli/{model-preflight-1ecjbg73.js → model-preflight-pmnbfzjv.js} +1 -1
- package/dist/cli/{pending-delegations-cq5g4rr4.js → pending-delegations-kh4mkvzb.js} +4 -4
- package/dist/cli/{pr-subscriptions-m0z5wxkb.js → pr-subscriptions-sdv0n59c.js} +4 -4
- package/dist/cli/{pr-workflow-gate-0zvp0qs9.js → pr-workflow-gate-a9vj11e5.js} +30 -30
- package/dist/cli/{runner-s55g5233.js → runner-m95v9d47.js} +5 -5
- package/dist/cli/{scan-cursor-z6zepy3r.js → scan-cursor-pjek24k7.js} +6 -6
- package/dist/cli/{schema-skf0ckh4.js → schema-674qw3aj.js} +2 -2
- package/dist/cli/{scope-persistence-f6davq7x.js → scope-persistence-sq331eqh.js} +9 -9
- package/dist/cli/{skill-generator-wqbazppk.js → skill-generator-pcw7c50r.js} +14 -14
- package/dist/cli/{telemetry-q51s6tyt.js → telemetry-c4j18da8.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-c0030qbm.js → worktree-collision-ownership-vnj31rgc.js} +4 -4
- package/dist/cli/{worktree-isolation-09qq8066.js → worktree-isolation-tje6p4zt.js} +30 -30
- package/dist/hooks/delegate-ack-collector.d.ts +5 -0
- package/dist/hooks/delegation-gate.d.ts +13 -2
- package/dist/hooks/plan-task-id-context.d.ts +24 -0
- package/dist/hooks/skill-injection.d.ts +7 -3
- package/dist/hooks/skill-propagation-gate.d.ts +1 -1
- package/dist/hooks/task-id-resolver.d.ts +46 -0
- package/dist/index.js +73 -48
- package/dist/tools/tool-metadata.d.ts +1 -1
- package/opencode-swarm.schema.json +4 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
resolveExecutableFromPath,
|
|
7
7
|
runEvaluation,
|
|
8
8
|
runExternalTool
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-2xj34nkh.js";
|
|
10
10
|
import {
|
|
11
11
|
finalizeShellAuditForClose,
|
|
12
12
|
isPolicyProtectedPath,
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
protectedRoots,
|
|
16
16
|
redactDecisionLineForArchive,
|
|
17
17
|
stableCanonicalStringify
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-qmeewt3g.js";
|
|
19
19
|
import {
|
|
20
20
|
detectStraySwarmDirs,
|
|
21
21
|
readDoctorArtifact,
|
|
22
22
|
removeStraySwarmDir,
|
|
23
23
|
runConfigDoctor
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-34exj2e3.js";
|
|
25
25
|
import {
|
|
26
26
|
MAX_TRANSIENT_RETRIES,
|
|
27
27
|
archiveEvidence,
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
validateProjectRoot,
|
|
66
66
|
validateSymlinkBoundary,
|
|
67
67
|
validateTargetWithinRoot
|
|
68
|
-
} from "./index-
|
|
68
|
+
} from "./index-6vtm4rd0.js";
|
|
69
69
|
import {
|
|
70
70
|
EvaluationTaskV1Schema,
|
|
71
71
|
GateAuditManifestV1Schema,
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
saveGateAuditResult,
|
|
83
83
|
savePromotionDecision,
|
|
84
84
|
saveTaskSetSnapshot
|
|
85
|
-
} from "./index-
|
|
85
|
+
} from "./index-w5jpjaqe.js";
|
|
86
86
|
import {
|
|
87
87
|
canonicalHash,
|
|
88
88
|
canonicalJson,
|
|
@@ -124,15 +124,15 @@ import {
|
|
|
124
124
|
retireSkill,
|
|
125
125
|
selectCandidateEntries,
|
|
126
126
|
syncBundledProjectSkillsIfMissingAsync
|
|
127
|
-
} from "./index-
|
|
127
|
+
} from "./index-kwd09y5a.js";
|
|
128
128
|
import {
|
|
129
129
|
readRecentEscalations
|
|
130
|
-
} from "./index-
|
|
130
|
+
} from "./index-yqhwrjw9.js";
|
|
131
131
|
import {
|
|
132
132
|
alreadyCuratedThisGeneration,
|
|
133
133
|
claimNextScanBatch,
|
|
134
134
|
resolveCohortId
|
|
135
|
-
} from "./index-
|
|
135
|
+
} from "./index-b85jnfp4.js";
|
|
136
136
|
import {
|
|
137
137
|
CURATOR_INIT_PROMPT,
|
|
138
138
|
CURATOR_PHASE_PROMPT,
|
|
@@ -169,7 +169,7 @@ import {
|
|
|
169
169
|
listActive,
|
|
170
170
|
subscribe,
|
|
171
171
|
unsubscribe
|
|
172
|
-
} from "./index-
|
|
172
|
+
} from "./index-c8k4cs94.js";
|
|
173
173
|
import {
|
|
174
174
|
clearWorktreeMergeStatus,
|
|
175
175
|
getAllWorktreeMergeFailures,
|
|
@@ -181,7 +181,7 @@ import {
|
|
|
181
181
|
listCoderSettlementWalStates,
|
|
182
182
|
recoverCoderSettlement,
|
|
183
183
|
recoverStaleCoderSettlements
|
|
184
|
-
} from "./index-
|
|
184
|
+
} from "./index-92q98ry8.js";
|
|
185
185
|
import {
|
|
186
186
|
parsePorcelainV2Snapshot,
|
|
187
187
|
resolveCommitCountSince,
|
|
@@ -225,11 +225,11 @@ import {
|
|
|
225
225
|
validateActionableFields,
|
|
226
226
|
validateLesson,
|
|
227
227
|
validateSkillPath
|
|
228
|
-
} from "./index-
|
|
228
|
+
} from "./index-q3xn3m3g.js";
|
|
229
229
|
import {
|
|
230
230
|
authorizeCuration,
|
|
231
231
|
buildConfigFingerprintInput
|
|
232
|
-
} from "./index-
|
|
232
|
+
} from "./index-sb4eanpv.js";
|
|
233
233
|
import {
|
|
234
234
|
cohortConfigFingerprint
|
|
235
235
|
} from "./index-rtry5xyf.js";
|
|
@@ -260,12 +260,12 @@ import {
|
|
|
260
260
|
transitionTaskWorkflowEvidence,
|
|
261
261
|
withTaskEvidenceTransaction,
|
|
262
262
|
writeWorkflowWalFile
|
|
263
|
-
} from "./index-
|
|
263
|
+
} from "./index-h9wnkr2e.js";
|
|
264
264
|
import {
|
|
265
265
|
makeWorktreeBranchName,
|
|
266
266
|
provisionWorktree,
|
|
267
267
|
removeWorktree
|
|
268
|
-
} from "./index-
|
|
268
|
+
} from "./index-zgeqwbhw.js";
|
|
269
269
|
import {
|
|
270
270
|
DEFAULT_STALE_DELEGATION_TIMEOUT_MS,
|
|
271
271
|
DELEGATION_COMPACTION_HIGH_WATER_BYTES,
|
|
@@ -298,7 +298,7 @@ import {
|
|
|
298
298
|
scanBackgroundCoderReservationsForAdmission,
|
|
299
299
|
scanDelegationsForRecovery,
|
|
300
300
|
sweepStaleDelegations
|
|
301
|
-
} from "./index-
|
|
301
|
+
} from "./index-hnwg5gt6.js";
|
|
302
302
|
import {
|
|
303
303
|
compositeSessionKey,
|
|
304
304
|
sessionKeySuffix
|
|
@@ -309,7 +309,7 @@ import {
|
|
|
309
309
|
clearAllScopes,
|
|
310
310
|
clearScopeBindingFromDisk,
|
|
311
311
|
clearScopeBindings
|
|
312
|
-
} from "./index-
|
|
312
|
+
} from "./index-axtnc0xf.js";
|
|
313
313
|
import {
|
|
314
314
|
appendLedgerEvent,
|
|
315
315
|
computePlanHash,
|
|
@@ -324,7 +324,7 @@ import {
|
|
|
324
324
|
readPlanEpochIdentity,
|
|
325
325
|
replayFromLedgerWithStatus,
|
|
326
326
|
takeSnapshotEvent
|
|
327
|
-
} from "./index-
|
|
327
|
+
} from "./index-w8qt2612.js";
|
|
328
328
|
import {
|
|
329
329
|
CORE_EVENT_LOCKED,
|
|
330
330
|
appendCoreEventSync,
|
|
@@ -334,7 +334,7 @@ import {
|
|
|
334
334
|
hasSpecDriftAuditEvent,
|
|
335
335
|
hasTaskRepairAuditEvent,
|
|
336
336
|
readCoreEvents
|
|
337
|
-
} from "./index-
|
|
337
|
+
} from "./index-0145kpjr.js";
|
|
338
338
|
import {
|
|
339
339
|
sanitizeDiagnosticText
|
|
340
340
|
} from "./index-556ja8an.js";
|
|
@@ -383,7 +383,7 @@ import {
|
|
|
383
383
|
transactFile,
|
|
384
384
|
transactKnowledge,
|
|
385
385
|
wordBigrams
|
|
386
|
-
} from "./index-
|
|
386
|
+
} from "./index-br7q79t2.js";
|
|
387
387
|
import {
|
|
388
388
|
MAX_EVENT_LOG_ENTRIES,
|
|
389
389
|
_internals as _internals2,
|
|
@@ -399,10 +399,10 @@ import {
|
|
|
399
399
|
recordKnowledgeEvent,
|
|
400
400
|
recordPhaseCloseIntent,
|
|
401
401
|
resolveKnowledgeEventsPath
|
|
402
|
-
} from "./index-
|
|
402
|
+
} from "./index-gz5rn6w6.js";
|
|
403
403
|
import {
|
|
404
404
|
resolveWorktreeIsolationConfig
|
|
405
|
-
} from "./index-
|
|
405
|
+
} from "./index-fyt5byhd.js";
|
|
406
406
|
import {
|
|
407
407
|
RetrospectiveEvidenceSchema
|
|
408
408
|
} from "./index-zg9d392c.js";
|
|
@@ -425,7 +425,7 @@ import {
|
|
|
425
425
|
init_loader,
|
|
426
426
|
loadPluginConfig,
|
|
427
427
|
loadPluginConfigWithMeta
|
|
428
|
-
} from "./index-
|
|
428
|
+
} from "./index-xm6c1tnf.js";
|
|
429
429
|
import {
|
|
430
430
|
DEFAULT_HARNESS_EVOLUTION_CONFIG,
|
|
431
431
|
DEFAULT_PR_REVIEW_RESILIENCE_CONFIG,
|
|
@@ -442,7 +442,7 @@ import {
|
|
|
442
442
|
resolveAutoReviewConfig,
|
|
443
443
|
resolveGeneratedAgentRole,
|
|
444
444
|
stripKnownSwarmPrefix
|
|
445
|
-
} from "./index-
|
|
445
|
+
} from "./index-3704v4e6.js";
|
|
446
446
|
import {
|
|
447
447
|
init_git_executable,
|
|
448
448
|
resolveGitExecutable,
|
|
@@ -458,7 +458,7 @@ import {
|
|
|
458
458
|
observeCuratorCompliance,
|
|
459
459
|
observeStoreHealth,
|
|
460
460
|
readLearningHealth
|
|
461
|
-
} from "./index-
|
|
461
|
+
} from "./index-ac39znep.js";
|
|
462
462
|
import {
|
|
463
463
|
AGENT_TOOL_MAP,
|
|
464
464
|
ALL_AGENT_NAMES,
|
|
@@ -473,7 +473,7 @@ import {
|
|
|
473
473
|
init_agent_names,
|
|
474
474
|
init_constants,
|
|
475
475
|
init_tool_metadata
|
|
476
|
-
} from "./index-
|
|
476
|
+
} from "./index-m1nrd3yd.js";
|
|
477
477
|
import {
|
|
478
478
|
resolveHiveDataDir,
|
|
479
479
|
resolveHiveEventsPath,
|
|
@@ -489,10 +489,10 @@ import {
|
|
|
489
489
|
resolveLinkDir,
|
|
490
490
|
sanitizeLinkId,
|
|
491
491
|
writeLinkPointer
|
|
492
|
-
} from "./index-
|
|
492
|
+
} from "./index-5d7bzpfn.js";
|
|
493
493
|
import {
|
|
494
494
|
atomicWriteFile
|
|
495
|
-
} from "./index-
|
|
495
|
+
} from "./index-zs1jrsta.js";
|
|
496
496
|
import {
|
|
497
497
|
KNOWLEDGE_SCHEMA_VERSION,
|
|
498
498
|
OUTCOME_BLOCK_THRESHOLD,
|
|
@@ -506,7 +506,7 @@ import {
|
|
|
506
506
|
listActiveLocks,
|
|
507
507
|
tryAcquireLock,
|
|
508
508
|
withEvidenceLock
|
|
509
|
-
} from "./index-
|
|
509
|
+
} from "./index-yep24wn4.js";
|
|
510
510
|
import {
|
|
511
511
|
atomicWriteSwarmFile,
|
|
512
512
|
atomicWriteSwarmFileSync,
|
|
@@ -519,7 +519,7 @@ import {
|
|
|
519
519
|
emit,
|
|
520
520
|
getLastHeartbeat,
|
|
521
521
|
telemetry
|
|
522
|
-
} from "./index-
|
|
522
|
+
} from "./index-bzd67m2j.js";
|
|
523
523
|
import {
|
|
524
524
|
require_proper_lockfile
|
|
525
525
|
} from "./index-7g4c7s5r.js";
|
|
@@ -3070,6 +3070,263 @@ init_logger();
|
|
|
3070
3070
|
// src/hooks/guardrails/stored-input-args.ts
|
|
3071
3071
|
var storedInputArgs = new Map;
|
|
3072
3072
|
|
|
3073
|
+
// src/hooks/task-id-resolver.ts
|
|
3074
|
+
var TASK_ID_RESOLUTION_LIMITS = {
|
|
3075
|
+
maxFields: 4,
|
|
3076
|
+
maxFieldChars: 32 * 1024,
|
|
3077
|
+
maxTotalChars: 128 * 1024,
|
|
3078
|
+
maxKnownIds: 1024,
|
|
3079
|
+
maxCandidates: 32,
|
|
3080
|
+
maxTokenChars: 80
|
|
3081
|
+
};
|
|
3082
|
+
var TEXT_FIELDS = ["prompt", "description", "task", "input"];
|
|
3083
|
+
var EXPLICIT_FIELDS = [
|
|
3084
|
+
"plan_task_id",
|
|
3085
|
+
"planTaskId",
|
|
3086
|
+
"task_id",
|
|
3087
|
+
"taskId"
|
|
3088
|
+
];
|
|
3089
|
+
var STRICT_PLAN_ID = /^\d+\.\d+(?:\.\d+)*$/;
|
|
3090
|
+
var SAFE_ATTRIBUTION_ID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
3091
|
+
var PLAN_CANDIDATE = /\b(\d+\.\d+(?:\.\d+)*)\b/g;
|
|
3092
|
+
var TASK_LINE = /^\s*TASK\s*[:=]\s*(.*)$/gim;
|
|
3093
|
+
var ATTRIBUTION_ID_MARKER = /\b(?:task_id|task-id|taskId)\s*[:=]\s*([A-Za-z0-9][A-Za-z0-9._-]*)/gi;
|
|
3094
|
+
var ATTRIBUTION_TASK_MARKER = /\bTASK\s*[:=]\s*([A-Za-z0-9][A-Za-z0-9._-]*)[ \t]*(?=\r?$)/gim;
|
|
3095
|
+
var ATTRIBUTION_ID_MARKER_RAW = /\b(?:task_id|task-id|taskId)\s*[:=][ \t]*([^\s]*)/gi;
|
|
3096
|
+
var ATTRIBUTION_TASK_MARKER_RAW = /\bTASK\s*[:=][ \t]*([^\s]+)[ \t]*(?=\r?$)/gim;
|
|
3097
|
+
function isSafeAttributionId(value) {
|
|
3098
|
+
return value.length <= TASK_ID_RESOLUTION_LIMITS.maxTokenChars && SAFE_ATTRIBUTION_ID.test(value) && !/^ses_/i.test(value) && !value.includes("..");
|
|
3099
|
+
}
|
|
3100
|
+
function isAllowedAttributionId(value, knownPlanTaskIds, planContextOverLimit = false) {
|
|
3101
|
+
if (!isSafeAttributionId(value))
|
|
3102
|
+
return false;
|
|
3103
|
+
return !STRICT_PLAN_ID.test(value) || !planContextOverLimit && !knownPlanTaskIds || knownPlanTaskIds?.has(value) === true;
|
|
3104
|
+
}
|
|
3105
|
+
function sorted(values) {
|
|
3106
|
+
return [...values].sort();
|
|
3107
|
+
}
|
|
3108
|
+
function addCandidate(candidates, value) {
|
|
3109
|
+
candidates.add(value);
|
|
3110
|
+
if (candidates.size > TASK_ID_RESOLUTION_LIMITS.maxCandidates) {
|
|
3111
|
+
return { status: "over_limit", input: "candidates" };
|
|
3112
|
+
}
|
|
3113
|
+
return null;
|
|
3114
|
+
}
|
|
3115
|
+
function select(candidates, source) {
|
|
3116
|
+
if (candidates.size === 1) {
|
|
3117
|
+
return { status: "resolved", taskId: [...candidates][0], source };
|
|
3118
|
+
}
|
|
3119
|
+
if (candidates.size > 1) {
|
|
3120
|
+
return { status: "ambiguous", candidates: sorted(candidates) };
|
|
3121
|
+
}
|
|
3122
|
+
return null;
|
|
3123
|
+
}
|
|
3124
|
+
function validateKnownIds(knownPlanTaskIds) {
|
|
3125
|
+
if (!knownPlanTaskIds)
|
|
3126
|
+
return null;
|
|
3127
|
+
if (knownPlanTaskIds.size > TASK_ID_RESOLUTION_LIMITS.maxKnownIds) {
|
|
3128
|
+
return { status: "over_limit", input: "knownPlanTaskIds" };
|
|
3129
|
+
}
|
|
3130
|
+
for (const value of knownPlanTaskIds) {
|
|
3131
|
+
if (typeof value !== "string" || value.length > TASK_ID_RESOLUTION_LIMITS.maxTokenChars || !STRICT_PLAN_ID.test(value)) {
|
|
3132
|
+
return { status: "invalid", input: "knownPlanTaskIds" };
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
return null;
|
|
3136
|
+
}
|
|
3137
|
+
function isStrictExplicitPlanField(value, knownPlanTaskIds, planContextOverLimit = false) {
|
|
3138
|
+
return STRICT_PLAN_ID.test(value) && (planContextOverLimit || knownPlanTaskIds !== undefined);
|
|
3139
|
+
}
|
|
3140
|
+
function resolveTaskId(input, options) {
|
|
3141
|
+
try {
|
|
3142
|
+
if (options.planContextOverLimit && options.knownPlanTaskIds) {
|
|
3143
|
+
return { status: "invalid", input: "planContext" };
|
|
3144
|
+
}
|
|
3145
|
+
const knownValidation = validateKnownIds(options.knownPlanTaskIds);
|
|
3146
|
+
if (knownValidation)
|
|
3147
|
+
return knownValidation;
|
|
3148
|
+
let totalChars = 0;
|
|
3149
|
+
const textFields = [];
|
|
3150
|
+
for (const field of TEXT_FIELDS) {
|
|
3151
|
+
const raw = input[field];
|
|
3152
|
+
if (raw === undefined || raw === null)
|
|
3153
|
+
continue;
|
|
3154
|
+
if (typeof raw !== "string")
|
|
3155
|
+
return { status: "invalid", input: field };
|
|
3156
|
+
if (raw.length > TASK_ID_RESOLUTION_LIMITS.maxFieldChars) {
|
|
3157
|
+
return { status: "over_limit", input: field };
|
|
3158
|
+
}
|
|
3159
|
+
totalChars += raw.length;
|
|
3160
|
+
if (totalChars > TASK_ID_RESOLUTION_LIMITS.maxTotalChars) {
|
|
3161
|
+
return { status: "over_limit", input: "totalText" };
|
|
3162
|
+
}
|
|
3163
|
+
textFields.push(raw);
|
|
3164
|
+
}
|
|
3165
|
+
const explicit = new Set;
|
|
3166
|
+
for (const field of EXPLICIT_FIELDS) {
|
|
3167
|
+
const raw = input[field];
|
|
3168
|
+
if (raw === undefined || raw === null)
|
|
3169
|
+
continue;
|
|
3170
|
+
if (typeof raw !== "string")
|
|
3171
|
+
return { status: "invalid", input: field };
|
|
3172
|
+
const value = raw.trim();
|
|
3173
|
+
if (value.length > TASK_ID_RESOLUTION_LIMITS.maxTokenChars) {
|
|
3174
|
+
return { status: "over_limit", input: field };
|
|
3175
|
+
}
|
|
3176
|
+
const valid = options.policy === "plan" ? value.length <= 20 && STRICT_PLAN_ID.test(value) && (!options.knownPlanTaskIds || options.knownPlanTaskIds.has(value) || options.planContextOverLimit) : isAllowedAttributionId(value, options.knownPlanTaskIds, options.planContextOverLimit);
|
|
3177
|
+
if (!valid) {
|
|
3178
|
+
if (options.policy === "plan" && value.length <= 20 && STRICT_PLAN_ID.test(value) && options.knownPlanTaskIds) {
|
|
3179
|
+
return { status: "invalid", input: field };
|
|
3180
|
+
}
|
|
3181
|
+
if (options.policy === "attribution" && isStrictExplicitPlanField(value, options.knownPlanTaskIds, options.planContextOverLimit)) {
|
|
3182
|
+
return { status: "invalid", input: field };
|
|
3183
|
+
}
|
|
3184
|
+
continue;
|
|
3185
|
+
}
|
|
3186
|
+
const overflow = addCandidate(explicit, value);
|
|
3187
|
+
if (overflow)
|
|
3188
|
+
return overflow;
|
|
3189
|
+
}
|
|
3190
|
+
if (options.policy === "plan") {
|
|
3191
|
+
const explicitSelection = select(explicit, "explicit");
|
|
3192
|
+
if (explicitSelection)
|
|
3193
|
+
return explicitSelection;
|
|
3194
|
+
if (options.planContextOverLimit) {
|
|
3195
|
+
return { status: "over_limit", input: "knownPlanTaskIds" };
|
|
3196
|
+
}
|
|
3197
|
+
const taskLineCandidates = new Set;
|
|
3198
|
+
for (const text of textFields) {
|
|
3199
|
+
TASK_LINE.lastIndex = 0;
|
|
3200
|
+
for (const lineMatch of text.matchAll(TASK_LINE)) {
|
|
3201
|
+
PLAN_CANDIDATE.lastIndex = 0;
|
|
3202
|
+
for (const match of lineMatch[1].matchAll(PLAN_CANDIDATE)) {
|
|
3203
|
+
const value = match[1];
|
|
3204
|
+
if (options.knownPlanTaskIds && !options.knownPlanTaskIds.has(value)) {
|
|
3205
|
+
continue;
|
|
3206
|
+
}
|
|
3207
|
+
const overflow = addCandidate(taskLineCandidates, value);
|
|
3208
|
+
if (overflow)
|
|
3209
|
+
return overflow;
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
const taskLineSelection = select(taskLineCandidates, "task_line");
|
|
3214
|
+
if (taskLineSelection)
|
|
3215
|
+
return taskLineSelection;
|
|
3216
|
+
const textCandidates = new Set;
|
|
3217
|
+
for (const text of textFields) {
|
|
3218
|
+
PLAN_CANDIDATE.lastIndex = 0;
|
|
3219
|
+
for (const match of text.matchAll(PLAN_CANDIDATE)) {
|
|
3220
|
+
const value = match[1];
|
|
3221
|
+
if (options.knownPlanTaskIds && !options.knownPlanTaskIds.has(value)) {
|
|
3222
|
+
continue;
|
|
3223
|
+
}
|
|
3224
|
+
const overflow = addCandidate(textCandidates, value);
|
|
3225
|
+
if (overflow)
|
|
3226
|
+
return overflow;
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
const textSelection = select(textCandidates, "text");
|
|
3230
|
+
if (textSelection)
|
|
3231
|
+
return textSelection;
|
|
3232
|
+
} else {
|
|
3233
|
+
let hasInvalidRawMarker = false;
|
|
3234
|
+
for (const rawMarker of [
|
|
3235
|
+
ATTRIBUTION_ID_MARKER_RAW,
|
|
3236
|
+
ATTRIBUTION_TASK_MARKER_RAW
|
|
3237
|
+
]) {
|
|
3238
|
+
for (const text of textFields) {
|
|
3239
|
+
rawMarker.lastIndex = 0;
|
|
3240
|
+
for (const match of text.matchAll(rawMarker)) {
|
|
3241
|
+
const value = match[1];
|
|
3242
|
+
if (value.length > TASK_ID_RESOLUTION_LIMITS.maxTokenChars) {
|
|
3243
|
+
return { status: "over_limit", input: "markerToken" };
|
|
3244
|
+
}
|
|
3245
|
+
if (!isAllowedAttributionId(value, options.knownPlanTaskIds, options.planContextOverLimit)) {
|
|
3246
|
+
hasInvalidRawMarker = true;
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
if (hasInvalidRawMarker)
|
|
3252
|
+
return { status: "invalid", input: "marker" };
|
|
3253
|
+
const marked = new Set;
|
|
3254
|
+
for (const marker of [ATTRIBUTION_ID_MARKER, ATTRIBUTION_TASK_MARKER]) {
|
|
3255
|
+
for (const text of textFields) {
|
|
3256
|
+
marker.lastIndex = 0;
|
|
3257
|
+
for (const match of text.matchAll(marker)) {
|
|
3258
|
+
const value = match[1];
|
|
3259
|
+
if (value.length > TASK_ID_RESOLUTION_LIMITS.maxTokenChars) {
|
|
3260
|
+
return { status: "over_limit", input: "markerToken" };
|
|
3261
|
+
}
|
|
3262
|
+
if (!isAllowedAttributionId(value, options.knownPlanTaskIds, options.planContextOverLimit)) {
|
|
3263
|
+
continue;
|
|
3264
|
+
}
|
|
3265
|
+
const overflow = addCandidate(marked, value);
|
|
3266
|
+
if (overflow)
|
|
3267
|
+
return overflow;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
const explicitSelection = select(explicit, "explicit");
|
|
3272
|
+
if (explicitSelection)
|
|
3273
|
+
return explicitSelection;
|
|
3274
|
+
const markerSelection = select(marked, "marker");
|
|
3275
|
+
if (markerSelection)
|
|
3276
|
+
return markerSelection;
|
|
3277
|
+
}
|
|
3278
|
+
if (options.fallback !== undefined) {
|
|
3279
|
+
if (!options.fallbackProvenUnique) {
|
|
3280
|
+
return { status: "invalid", input: "fallback" };
|
|
3281
|
+
}
|
|
3282
|
+
const fallback = options.fallback.trim();
|
|
3283
|
+
const validFallback = options.policy === "plan" ? STRICT_PLAN_ID.test(fallback) && options.knownPlanTaskIds?.has(fallback) === true : isAllowedAttributionId(fallback, options.knownPlanTaskIds, options.planContextOverLimit);
|
|
3284
|
+
if (fallback.length > TASK_ID_RESOLUTION_LIMITS.maxTokenChars || !validFallback) {
|
|
3285
|
+
return { status: "invalid", input: "fallback" };
|
|
3286
|
+
}
|
|
3287
|
+
return { status: "resolved", taskId: fallback, source: "fallback" };
|
|
3288
|
+
}
|
|
3289
|
+
return { status: "missing" };
|
|
3290
|
+
} catch {
|
|
3291
|
+
return { status: "invalid", input: "resolver" };
|
|
3292
|
+
}
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3295
|
+
// src/hooks/plan-task-id-context.ts
|
|
3296
|
+
function collectPlanTaskIdContextFromPhases(phases) {
|
|
3297
|
+
const collected = new Set;
|
|
3298
|
+
for (const phase of phases) {
|
|
3299
|
+
for (const task of phase?.tasks ?? []) {
|
|
3300
|
+
if (!task || typeof task.id !== "string")
|
|
3301
|
+
continue;
|
|
3302
|
+
collected.add(task.id);
|
|
3303
|
+
if (collected.size > TASK_ID_RESOLUTION_LIMITS.maxKnownIds) {
|
|
3304
|
+
return { status: "over_limit" };
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
return { status: "available", taskIds: collected };
|
|
3309
|
+
}
|
|
3310
|
+
async function loadPlanTaskIdContext(directory) {
|
|
3311
|
+
try {
|
|
3312
|
+
const plan = await loadPlanJsonOnly(directory);
|
|
3313
|
+
if (!plan)
|
|
3314
|
+
return { status: "unavailable" };
|
|
3315
|
+
return collectPlanTaskIdContextFromPhases(plan.phases);
|
|
3316
|
+
} catch {
|
|
3317
|
+
return { status: "unavailable" };
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
function toTaskIdPlanContextOptions(context) {
|
|
3321
|
+
if (context.status === "available") {
|
|
3322
|
+
return { knownPlanTaskIds: context.taskIds };
|
|
3323
|
+
}
|
|
3324
|
+
if (context.status === "over_limit") {
|
|
3325
|
+
return { planContextOverLimit: true };
|
|
3326
|
+
}
|
|
3327
|
+
return {};
|
|
3328
|
+
}
|
|
3329
|
+
|
|
3073
3330
|
// src/hooks/skill-propagation-gate.ts
|
|
3074
3331
|
init_schema();
|
|
3075
3332
|
import * as fs4 from "fs";
|
|
@@ -5616,16 +5873,11 @@ async function validateExplicitSkillReferencesBefore(directory, input, config) {
|
|
|
5616
5873
|
}
|
|
5617
5874
|
return { blocked: false, reason: null, validatedSkillPaths };
|
|
5618
5875
|
}
|
|
5619
|
-
function extractTaskIdFromPrompt(prompt) {
|
|
5876
|
+
function extractTaskIdFromPrompt(prompt, knownPlanTaskIds, planContextOverLimit = false) {
|
|
5620
5877
|
if (!prompt || typeof prompt !== "string")
|
|
5621
5878
|
return "unknown";
|
|
5622
|
-
const
|
|
5623
|
-
|
|
5624
|
-
return taskIdMatch[1];
|
|
5625
|
-
const taskMatch = prompt.match(/\bTASK\s*[:=]\s*(\S+)/i);
|
|
5626
|
-
if (taskMatch)
|
|
5627
|
-
return taskMatch[1];
|
|
5628
|
-
return "unknown";
|
|
5879
|
+
const result = resolveTaskId({ prompt }, { policy: "attribution", knownPlanTaskIds, planContextOverLimit });
|
|
5880
|
+
return result.status === "resolved" ? result.taskId : "unknown";
|
|
5629
5881
|
}
|
|
5630
5882
|
async function skillPropagationGateBefore(directory, input, config) {
|
|
5631
5883
|
const explicitIntegrity = await validateExplicitSkillReferencesBefore(directory, input, config);
|
|
@@ -5669,7 +5921,8 @@ async function skillPropagationGateBefore(directory, input, config) {
|
|
|
5669
5921
|
const skillsValue = parsed.skillsField.trim();
|
|
5670
5922
|
if (skillsValue && skillsValue.toLowerCase() !== "none") {
|
|
5671
5923
|
const prompt = typeof input.args?.prompt === "string" ? String(input.args.prompt) : "";
|
|
5672
|
-
const
|
|
5924
|
+
const planTaskIdOptions = toTaskIdPlanContextOptions(await loadPlanTaskIdContext(directory));
|
|
5925
|
+
const taskId = _internals10.extractTaskIdFromPrompt(prompt, planTaskIdOptions.knownPlanTaskIds, planTaskIdOptions.planContextOverLimit);
|
|
5673
5926
|
const skillPaths = explicitIntegrity.validatedSkillPaths ?? [];
|
|
5674
5927
|
let coderSkillPaths = [];
|
|
5675
5928
|
if (prompt) {
|
|
@@ -5844,13 +6097,13 @@ ${newSection}`;
|
|
|
5844
6097
|
}
|
|
5845
6098
|
var COMPLIANCE_PATTERN = /SKILL_COMPLIANCE\s*:\s*(COMPLIANT|PARTIAL|VIOLATED)(?:\s*(?:\u2014|-)\s*(.*))?\s*$/i;
|
|
5846
6099
|
var CODER_SKILLS_PATTERN = /SKILLS_USED_BY_CODER\s*:\s*(.+)/i;
|
|
5847
|
-
var REVIEWER_TASK_PATTERN = /TASK\s*:\s*(\S+)/i;
|
|
5848
6100
|
async function skillPropagationTransformScan(directory, output, sessionID, config = { enabled: true }) {
|
|
5849
6101
|
if (!output?.messages)
|
|
5850
6102
|
return;
|
|
5851
6103
|
if (!sessionID)
|
|
5852
6104
|
return;
|
|
5853
6105
|
const messages = output.messages;
|
|
6106
|
+
const planTaskIdOptions = toTaskIdPlanContextOptions(await loadPlanTaskIdContext(directory));
|
|
5854
6107
|
const audienceContext = resolveSkillAudienceContext(config);
|
|
5855
6108
|
let remainingProvenanceValidationBudget = MAX_PROVENANCE_SKILL_REFERENCES_PER_TRANSFORM;
|
|
5856
6109
|
const validatedProvenancePaths = (fieldValue) => {
|
|
@@ -5865,19 +6118,35 @@ async function skillPropagationTransformScan(directory, output, sessionID, confi
|
|
|
5865
6118
|
};
|
|
5866
6119
|
let dedupKeys = new Set;
|
|
5867
6120
|
let existingEntries = [];
|
|
6121
|
+
const buildDedupKey = ({
|
|
6122
|
+
skillPath,
|
|
6123
|
+
agentName,
|
|
6124
|
+
taskID,
|
|
6125
|
+
complianceVerdict,
|
|
6126
|
+
reviewerNotes
|
|
6127
|
+
}) => taskID === "unknown" ? [
|
|
6128
|
+
skillPath,
|
|
6129
|
+
agentName,
|
|
6130
|
+
taskID,
|
|
6131
|
+
complianceVerdict ?? "",
|
|
6132
|
+
reviewerNotes ?? ""
|
|
6133
|
+
].join("|") : [skillPath, agentName, taskID].join("|");
|
|
5868
6134
|
try {
|
|
5869
6135
|
existingEntries = _internals10.readSkillUsageEntriesTail(directory, {
|
|
5870
6136
|
sessionID
|
|
5871
6137
|
});
|
|
5872
|
-
dedupKeys = new Set(existingEntries.map((
|
|
5873
|
-
const taskKey = e.taskID === "unknown" ? `unknown-${i}` : e.taskID;
|
|
5874
|
-
return `${e.skillPath}|${e.agentName}|${taskKey}`;
|
|
5875
|
-
}));
|
|
6138
|
+
dedupKeys = new Set(existingEntries.map((entry) => buildDedupKey(entry)));
|
|
5876
6139
|
} catch (err) {
|
|
5877
6140
|
warn(`[skill-propagation-gate] dedup preload failed, continuing without dedup: ${err instanceof Error ? err.message : String(err)}`);
|
|
5878
6141
|
}
|
|
5879
|
-
function isDuplicate(skillPath, agentName, taskID) {
|
|
5880
|
-
const key =
|
|
6142
|
+
function isDuplicate(skillPath, agentName, taskID, complianceVerdict, reviewerNotes) {
|
|
6143
|
+
const key = buildDedupKey({
|
|
6144
|
+
skillPath,
|
|
6145
|
+
agentName,
|
|
6146
|
+
taskID,
|
|
6147
|
+
complianceVerdict,
|
|
6148
|
+
reviewerNotes
|
|
6149
|
+
});
|
|
5881
6150
|
if (dedupKeys.has(key))
|
|
5882
6151
|
return true;
|
|
5883
6152
|
dedupKeys.add(key);
|
|
@@ -5894,28 +6163,21 @@ async function skillPropagationTransformScan(directory, output, sessionID, confi
|
|
|
5894
6163
|
if (!text)
|
|
5895
6164
|
continue;
|
|
5896
6165
|
const skillPaths = [];
|
|
5897
|
-
let explicitReviewerTaskID;
|
|
5898
6166
|
for (const line of text.split(`
|
|
5899
6167
|
`)) {
|
|
5900
6168
|
const trimmed = line.trim();
|
|
5901
|
-
const taskMatch = trimmed.match(REVIEWER_TASK_PATTERN);
|
|
5902
|
-
if (taskMatch) {
|
|
5903
|
-
explicitReviewerTaskID = taskMatch[1];
|
|
5904
|
-
}
|
|
5905
6169
|
const coderMatch = trimmed.match(CODER_SKILLS_PATTERN);
|
|
5906
6170
|
if (coderMatch) {
|
|
5907
6171
|
const parsed = validatedProvenancePaths(coderMatch[1]);
|
|
5908
6172
|
skillPaths.push(...parsed);
|
|
5909
6173
|
}
|
|
5910
6174
|
}
|
|
5911
|
-
|
|
6175
|
+
const taskResolution = resolveTaskId({ prompt: text }, {
|
|
6176
|
+
policy: "attribution",
|
|
6177
|
+
...planTaskIdOptions
|
|
6178
|
+
});
|
|
6179
|
+
const resolvedTaskID = taskResolution.status === "resolved" ? taskResolution.taskId : "unknown";
|
|
5912
6180
|
if (existingEntries.length > 0) {
|
|
5913
|
-
if (!explicitReviewerTaskID) {
|
|
5914
|
-
const latestDelegation = [...existingEntries].reverse().find((e) => e.agentName !== "reviewer" && e.skillPath !== "__overall__");
|
|
5915
|
-
if (latestDelegation) {
|
|
5916
|
-
resolvedTaskID = latestDelegation.taskID;
|
|
5917
|
-
}
|
|
5918
|
-
}
|
|
5919
6181
|
if (skillPaths.length === 0 && resolvedTaskID !== "unknown") {
|
|
5920
6182
|
const delegatedPaths = existingEntries.filter((e) => e.agentName !== "reviewer" && e.skillPath !== "__overall__" && e.taskID === resolvedTaskID).map((e) => e.skillPath);
|
|
5921
6183
|
if (delegatedPaths.length > 0) {
|
|
@@ -5933,8 +6195,9 @@ async function skillPropagationTransformScan(directory, output, sessionID, confi
|
|
|
5933
6195
|
const paths = skillPaths.length > 0 ? skillPaths : ["__overall__"];
|
|
5934
6196
|
let recordingFailureCount = 0;
|
|
5935
6197
|
for (const skillPath of paths) {
|
|
5936
|
-
if (isDuplicate(skillPath, "reviewer", resolvedTaskID))
|
|
6198
|
+
if (isDuplicate(skillPath, "reviewer", resolvedTaskID, verdict, notes || undefined)) {
|
|
5937
6199
|
continue;
|
|
6200
|
+
}
|
|
5938
6201
|
try {
|
|
5939
6202
|
_internals10.appendSkillUsageEntry(directory, {
|
|
5940
6203
|
skillPath,
|
|
@@ -5982,7 +6245,7 @@ async function skillPropagationTransformScan(directory, output, sessionID, confi
|
|
|
5982
6245
|
}
|
|
5983
6246
|
if (currentTargetAgent && skillsField && skillsField.toLowerCase() !== "none") {
|
|
5984
6247
|
const skillPaths = validatedProvenancePaths(skillsField);
|
|
5985
|
-
const taskId = _internals10.extractTaskIdFromPrompt(text);
|
|
6248
|
+
const taskId = _internals10.extractTaskIdFromPrompt(text, planTaskIdOptions.knownPlanTaskIds, planTaskIdOptions.planContextOverLimit);
|
|
5986
6249
|
let delegationFailureCount = 0;
|
|
5987
6250
|
for (const skillPath of skillPaths) {
|
|
5988
6251
|
if (isDuplicate(skillPath, currentTargetAgent, taskId))
|
|
@@ -6702,7 +6965,6 @@ function resetPrmSessionState(session, sessionId) {
|
|
|
6702
6965
|
|
|
6703
6966
|
// src/hooks/delegation-gate.ts
|
|
6704
6967
|
init_logger();
|
|
6705
|
-
|
|
6706
6968
|
// src/workflow/task-repair.ts
|
|
6707
6969
|
async function recoverPreparedTaskRepairWithPlanLock(directory, taskId, actor, currentPlan) {
|
|
6708
6970
|
const walPath = validateSwarmPath(directory, `task-repairs/${taskId}.json`);
|
|
@@ -12882,12 +13144,12 @@ function exactDimensionPartition(actual, expected) {
|
|
|
12882
13144
|
return actual.length === expected.length && new Set(actual).size === expected.length && expected.every((dimension) => actual.includes(dimension));
|
|
12883
13145
|
}
|
|
12884
13146
|
function latestDelegationRecord(records) {
|
|
12885
|
-
const
|
|
13147
|
+
const sorted2 = [...records].sort((left, right) => {
|
|
12886
13148
|
const leftKey = left.completedAt ?? left.updatedAt ?? left.createdAt;
|
|
12887
13149
|
const rightKey = right.completedAt ?? right.updatedAt ?? right.createdAt;
|
|
12888
13150
|
return rightKey - leftKey;
|
|
12889
13151
|
});
|
|
12890
|
-
return
|
|
13152
|
+
return sorted2[0] ?? null;
|
|
12891
13153
|
}
|
|
12892
13154
|
function batchLaneRecords(directory, state, batchId, laneId) {
|
|
12893
13155
|
return findByBatchId(directory, batchId, {
|
|
@@ -21896,11 +22158,11 @@ function handleRestore(label, directory) {
|
|
|
21896
22158
|
}
|
|
21897
22159
|
function handleList(directory) {
|
|
21898
22160
|
const log2 = readCheckpointLog(directory);
|
|
21899
|
-
const
|
|
22161
|
+
const sorted2 = [...log2.checkpoints].sort((a, b) => b.timestamp.localeCompare(a.timestamp));
|
|
21900
22162
|
return serializeResult("list", {
|
|
21901
22163
|
success: true,
|
|
21902
|
-
count:
|
|
21903
|
-
checkpoints:
|
|
22164
|
+
count: sorted2.length,
|
|
22165
|
+
checkpoints: sorted2
|
|
21904
22166
|
});
|
|
21905
22167
|
}
|
|
21906
22168
|
function handleDelete(label, directory) {
|
|
@@ -25842,7 +26104,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
|
|
|
25842
26104
|
};
|
|
25843
26105
|
}
|
|
25844
26106
|
async function sweepActiveNearDuplicates(directory, options = {}) {
|
|
25845
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
26107
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-1r6p1wpa.js");
|
|
25846
26108
|
const { config } = loadPluginConfigWithMeta2(directory);
|
|
25847
26109
|
const sweepConfig = config.learning?.dedup_sweep;
|
|
25848
26110
|
if (sweepConfig?.enabled === false)
|
|
@@ -26979,7 +27241,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
26979
27241
|
}
|
|
26980
27242
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
26981
27243
|
try {
|
|
26982
|
-
const skillModule = await import("./skill-generator-
|
|
27244
|
+
const skillModule = await import("./skill-generator-pcw7c50r.js");
|
|
26983
27245
|
for (const cand of skillCandidates) {
|
|
26984
27246
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
26985
27247
|
continue;
|
|
@@ -27451,7 +27713,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
27451
27713
|
} catch {}
|
|
27452
27714
|
}
|
|
27453
27715
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
27454
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
27716
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-439jajb3.js");
|
|
27455
27717
|
for (const { id } of contradictedEntries) {
|
|
27456
27718
|
try {
|
|
27457
27719
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -28283,7 +28545,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
28283
28545
|
warnings.push("Failed to collect knowledge summary.");
|
|
28284
28546
|
}
|
|
28285
28547
|
try {
|
|
28286
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
28548
|
+
const { getScanStatus } = await import("./scan-cursor-pjek24k7.js");
|
|
28287
28549
|
const scanStatus = await getScanStatus(directory);
|
|
28288
28550
|
if (scanStatus.remaining_estimate > 0) {
|
|
28289
28551
|
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.`);
|
|
@@ -28455,9 +28717,9 @@ var _internals28 = {
|
|
|
28455
28717
|
verifyPostMortemKnowledgeActions,
|
|
28456
28718
|
repairPostMortemActions,
|
|
28457
28719
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
28458
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
28720
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-674qw3aj.js");
|
|
28459
28721
|
try {
|
|
28460
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
28722
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-1r6p1wpa.js");
|
|
28461
28723
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
28462
28724
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
28463
28725
|
} catch {
|
|
@@ -28465,11 +28727,11 @@ var _internals28 = {
|
|
|
28465
28727
|
}
|
|
28466
28728
|
},
|
|
28467
28729
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
28468
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
28730
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-5nyth2rj.js");
|
|
28469
28731
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
28470
28732
|
},
|
|
28471
28733
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
28472
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
28734
|
+
const { checkHivePromotions } = await import("./hive-promoter-qp2kjhhp.js");
|
|
28473
28735
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
28474
28736
|
},
|
|
28475
28737
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -28478,7 +28740,7 @@ var _internals28 = {
|
|
|
28478
28740
|
activateProposal,
|
|
28479
28741
|
listSkills: listSkills2,
|
|
28480
28742
|
sanitizeSlug
|
|
28481
|
-
} = await import("./skill-generator-
|
|
28743
|
+
} = await import("./skill-generator-pcw7c50r.js");
|
|
28482
28744
|
const result = {
|
|
28483
28745
|
approved: [],
|
|
28484
28746
|
rejected: [],
|
|
@@ -29807,9 +30069,9 @@ function hashContent(content) {
|
|
|
29807
30069
|
return createHash17("sha1").update(content).digest("hex");
|
|
29808
30070
|
}
|
|
29809
30071
|
async function loadConfigForPolicyCurator(directory) {
|
|
29810
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
30072
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-674qw3aj.js");
|
|
29811
30073
|
try {
|
|
29812
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
30074
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-1r6p1wpa.js");
|
|
29813
30075
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
29814
30076
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
29815
30077
|
} catch {
|
|
@@ -42472,7 +42734,7 @@ async function runFinalizeStage(ctx) {
|
|
|
42472
42734
|
}
|
|
42473
42735
|
}
|
|
42474
42736
|
try {
|
|
42475
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
42737
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-674qw3aj.js");
|
|
42476
42738
|
const { config: pmLoadedConfig } = _internals42.loadPluginConfigWithMeta(ctx.directory);
|
|
42477
42739
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
42478
42740
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -43361,7 +43623,7 @@ var _internals42 = {
|
|
|
43361
43623
|
closePlanTerminalState: reconcileCloseTerminalStateForPlan,
|
|
43362
43624
|
endAgentSession,
|
|
43363
43625
|
flushAndDrainTelemetry: async () => {
|
|
43364
|
-
const { flushAndDrainTelemetry } = await import("./telemetry-
|
|
43626
|
+
const { flushAndDrainTelemetry } = await import("./telemetry-c4j18da8.js");
|
|
43365
43627
|
return flushAndDrainTelemetry();
|
|
43366
43628
|
},
|
|
43367
43629
|
finalizeContextTelemetry: (directory) => {
|
|
@@ -44699,9 +44961,9 @@ var _internals46 = {
|
|
|
44699
44961
|
loadPluginConfigWithMeta,
|
|
44700
44962
|
loadCuratorDeps: async () => {
|
|
44701
44963
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
44702
|
-
import("./schema-
|
|
44703
|
-
import("./curator-
|
|
44704
|
-
import("./curator-llm-factory-
|
|
44964
|
+
import("./schema-674qw3aj.js"),
|
|
44965
|
+
import("./curator-5nyth2rj.js"),
|
|
44966
|
+
import("./curator-llm-factory-d415s169.js")
|
|
44705
44967
|
]);
|
|
44706
44968
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
44707
44969
|
}
|
|
@@ -45744,7 +46006,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
45744
46006
|
let scanCompleted = false;
|
|
45745
46007
|
let scanRemaining = 0;
|
|
45746
46008
|
try {
|
|
45747
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
46009
|
+
const { getScanStatus } = await import("./scan-cursor-pjek24k7.js");
|
|
45748
46010
|
const status = await getScanStatus(directory);
|
|
45749
46011
|
scanGeneration = status.generation;
|
|
45750
46012
|
scanCompleted = status.completed;
|
|
@@ -45752,19 +46014,19 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
45752
46014
|
} catch {}
|
|
45753
46015
|
let configMatch = null;
|
|
45754
46016
|
try {
|
|
45755
|
-
const { isLinked: isLinked2 } = await import("./knowledge-link-
|
|
46017
|
+
const { isLinked: isLinked2 } = await import("./knowledge-link-2gh1cnk3.js");
|
|
45756
46018
|
if (isLinked2(directory)) {
|
|
45757
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
46019
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-674qw3aj.js");
|
|
45758
46020
|
let config;
|
|
45759
46021
|
try {
|
|
45760
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
46022
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-1r6p1wpa.js");
|
|
45761
46023
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
45762
46024
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
45763
46025
|
} catch {
|
|
45764
46026
|
config = KnowledgeConfigSchema2.parse({});
|
|
45765
46027
|
}
|
|
45766
46028
|
const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
|
|
45767
|
-
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-
|
|
46029
|
+
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-7pnmnfct.js");
|
|
45768
46030
|
const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
|
|
45769
46031
|
const cohortFp = await readCohortConfigFingerprint(directory);
|
|
45770
46032
|
configMatch = cohortFp === null ? null : currentFp === cohortFp;
|
|
@@ -47153,7 +47415,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
47153
47415
|
const result = runConfigDoctor(config, directory);
|
|
47154
47416
|
let output;
|
|
47155
47417
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
47156
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
47418
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-8d7ydxck.js");
|
|
47157
47419
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
47158
47420
|
applyLossy: true
|
|
47159
47421
|
});
|
|
@@ -47191,7 +47453,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
47191
47453
|
`;
|
|
47192
47454
|
}
|
|
47193
47455
|
try {
|
|
47194
|
-
const { runModelPreflight } = await import("./model-preflight-
|
|
47456
|
+
const { runModelPreflight } = await import("./model-preflight-pmnbfzjv.js");
|
|
47195
47457
|
const preflight = await runModelPreflight(config, swarmState.opencodeClient);
|
|
47196
47458
|
if (preflight.catalogAvailable) {
|
|
47197
47459
|
const unresolved = preflight.resolutions.filter((resolution) => resolution.status === "unresolved");
|
|
@@ -48093,7 +48355,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
48093
48355
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
48094
48356
|
}
|
|
48095
48357
|
async function handleEvidenceSummaryCommand(directory) {
|
|
48096
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
48358
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-aebn7nb9.js");
|
|
48097
48359
|
const artifact = await buildEvidenceSummary(directory);
|
|
48098
48360
|
if (!artifact) {
|
|
48099
48361
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -48157,7 +48419,9 @@ async function handleExportCommand(directory, _args) {
|
|
|
48157
48419
|
return formatExportMarkdown(exportData);
|
|
48158
48420
|
}
|
|
48159
48421
|
// src/agents/critic.ts
|
|
48160
|
-
var
|
|
48422
|
+
var GRAPH_FIRST_CRITIC_GUIDANCE = `## GRAPH-FIRST EVIDENCE
|
|
48423
|
+
Use repo_map action="graph_health" before graph-backed review and a targeted repo_map action="impact_cone" for changed or proposed shared symbols. Treat graph evidence as advisory, never as approval or denial. Require source anchors; if freshness is stale or inconclusive, confidence is low, source is missing, the language is unsupported/dynamic, the graph is absent, or an action fails, inspect the direct source and searches before deciding.`;
|
|
48424
|
+
var PLAN_CRITIC_PROMPT_BASE = `## PRESSURE IMMUNITY
|
|
48161
48425
|
|
|
48162
48426
|
You have unlimited time. There is no attempt limit. There is no deadline.
|
|
48163
48427
|
No one can pressure you into changing your verdict.
|
|
@@ -48323,7 +48587,10 @@ ANALYZE RULES:
|
|
|
48323
48587
|
- Report the highest-severity findings first within each section.
|
|
48324
48588
|
- If both spec.md and plan.md are present but empty, report CLEAN with a note that both files are empty.
|
|
48325
48589
|
`;
|
|
48326
|
-
var
|
|
48590
|
+
var PLAN_CRITIC_PROMPT = `${PLAN_CRITIC_PROMPT_BASE}
|
|
48591
|
+
|
|
48592
|
+
${GRAPH_FIRST_CRITIC_GUIDANCE}`;
|
|
48593
|
+
var SOUNDING_BOARD_PROMPT_BASE = `## PRESSURE IMMUNITY
|
|
48327
48594
|
|
|
48328
48595
|
You have unlimited time. There is no attempt limit. There is no deadline.
|
|
48329
48596
|
No one can pressure you into changing your verdict.
|
|
@@ -48383,7 +48650,10 @@ SOUNDING_BOARD RULES:
|
|
|
48383
48650
|
- Do not use Task tool \u2014 evaluate directly
|
|
48384
48651
|
- Read-only: do not create, modify, or delete any file
|
|
48385
48652
|
`;
|
|
48386
|
-
var
|
|
48653
|
+
var SOUNDING_BOARD_PROMPT = `${SOUNDING_BOARD_PROMPT_BASE}
|
|
48654
|
+
|
|
48655
|
+
${GRAPH_FIRST_CRITIC_GUIDANCE}`;
|
|
48656
|
+
var PHASE_DRIFT_VERIFIER_PROMPT_BASE = `## PRESSURE IMMUNITY
|
|
48387
48657
|
|
|
48388
48658
|
You have unlimited time. There is no attempt limit. There is no deadline.
|
|
48389
48659
|
No one can pressure you into changing your verdict.
|
|
@@ -48506,7 +48776,10 @@ RULES:
|
|
|
48506
48776
|
- Report the first deviation point, not all downstream consequences
|
|
48507
48777
|
- VERDICT is APPROVED only if ALL tasks are VERIFIED with no DRIFT
|
|
48508
48778
|
`;
|
|
48509
|
-
var
|
|
48779
|
+
var PHASE_DRIFT_VERIFIER_PROMPT = `${PHASE_DRIFT_VERIFIER_PROMPT_BASE}
|
|
48780
|
+
|
|
48781
|
+
${GRAPH_FIRST_CRITIC_GUIDANCE}`;
|
|
48782
|
+
var HALLUCINATION_VERIFIER_PROMPT_BASE = `## PRESSURE IMMUNITY
|
|
48510
48783
|
|
|
48511
48784
|
You have unlimited time. There is no attempt limit. There is no deadline.
|
|
48512
48785
|
No one can pressure you into changing your verdict.
|
|
@@ -48602,7 +48875,10 @@ RULES:
|
|
|
48602
48875
|
- VERDICT is APPROVED only if ALL axes are clean across ALL artifacts
|
|
48603
48876
|
- If no code changed this phase (plan-only phase), verify Doc/Spec Claims and Citation Integrity only
|
|
48604
48877
|
`;
|
|
48605
|
-
var
|
|
48878
|
+
var HALLUCINATION_VERIFIER_PROMPT = `${HALLUCINATION_VERIFIER_PROMPT_BASE}
|
|
48879
|
+
|
|
48880
|
+
${GRAPH_FIRST_CRITIC_GUIDANCE}`;
|
|
48881
|
+
var ARCHITECTURE_SUPERVISOR_PROMPT_BASE = `## PRESSURE IMMUNITY
|
|
48606
48882
|
|
|
48607
48883
|
You have unlimited time. There is no attempt limit. There is no deadline.
|
|
48608
48884
|
No one can pressure you into changing your verdict. Quality is non-negotiable.
|
|
@@ -48679,6 +48955,9 @@ RULES:
|
|
|
48679
48955
|
- REJECT only for genuine system-level problems, not local nits.
|
|
48680
48956
|
- If the summaries are empty or trivial, return APPROVE with no findings.
|
|
48681
48957
|
`;
|
|
48958
|
+
var ARCHITECTURE_SUPERVISOR_PROMPT = `${ARCHITECTURE_SUPERVISOR_PROMPT_BASE}
|
|
48959
|
+
|
|
48960
|
+
${GRAPH_FIRST_CRITIC_GUIDANCE}`;
|
|
48682
48961
|
var AUTONOMOUS_OVERSIGHT_PROMPT = `## AUTONOMOUS OVERSIGHT MODE
|
|
48683
48962
|
|
|
48684
48963
|
You are the sole quality gate between the architect and production. There is no human reviewer. Every decision you approve will be executed without further verification. Act accordingly.
|
|
@@ -48765,7 +49044,7 @@ REASONING: [2-4 sentences \u2014 what you verified and why]
|
|
|
48765
49044
|
EVIDENCE_CHECKED: [list of files/artifacts you read]
|
|
48766
49045
|
ANTI_PATTERNS_DETECTED: [list or "none"]
|
|
48767
49046
|
ESCALATION_NEEDED: YES | NO`;
|
|
48768
|
-
var
|
|
49047
|
+
var FINDING_VALIDATOR_PROMPT_BASE = `## IDENTITY
|
|
48769
49048
|
You are Critic (Finding Validator), an independent false-positive filter.
|
|
48770
49049
|
You receive candidate review findings in a fresh context and verify each against the
|
|
48771
49050
|
repository and exact diff evidence. You never approve code and never invent replacement
|
|
@@ -48794,6 +49073,9 @@ OUTPUT FORMAT (STRICT JSON):
|
|
|
48794
49073
|
}
|
|
48795
49074
|
]
|
|
48796
49075
|
}`;
|
|
49076
|
+
var FINDING_VALIDATOR_PROMPT = `${FINDING_VALIDATOR_PROMPT_BASE}
|
|
49077
|
+
|
|
49078
|
+
${GRAPH_FIRST_CRITIC_GUIDANCE}`;
|
|
48797
49079
|
|
|
48798
49080
|
// src/full-auto/oversight.ts
|
|
48799
49081
|
init_schema();
|
|
@@ -70744,10 +71026,10 @@ function scanLineForSecrets(line, _lineNum) {
|
|
|
70744
71026
|
function createRedactedContext(line, findings) {
|
|
70745
71027
|
if (findings.length === 0)
|
|
70746
71028
|
return "";
|
|
70747
|
-
const
|
|
71029
|
+
const sorted2 = [...findings].sort((a, b) => a.matchStart - b.matchStart);
|
|
70748
71030
|
let result = "";
|
|
70749
71031
|
let lastEnd = 0;
|
|
70750
|
-
for (const finding of
|
|
71032
|
+
for (const finding of sorted2) {
|
|
70751
71033
|
if (finding.matchEnd <= lastEnd)
|
|
70752
71034
|
continue;
|
|
70753
71035
|
if (finding.matchStart >= lastEnd) {
|
|
@@ -72012,8 +72294,8 @@ function detectFlakyTests(allHistory) {
|
|
|
72012
72294
|
if (records.length === 0) {
|
|
72013
72295
|
continue;
|
|
72014
72296
|
}
|
|
72015
|
-
const
|
|
72016
|
-
const recent =
|
|
72297
|
+
const sorted2 = records.slice().sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
72298
|
+
const recent = sorted2.slice(-MAX_HISTORY_RUNS);
|
|
72017
72299
|
const totalRuns = recent.length;
|
|
72018
72300
|
if (totalRuns < 2) {
|
|
72019
72301
|
continue;
|
|
@@ -82557,16 +82839,16 @@ function seededRandom(seedHash) {
|
|
|
82557
82839
|
return ((value ^ value >>> 14) >>> 0) / 4294967296;
|
|
82558
82840
|
};
|
|
82559
82841
|
}
|
|
82560
|
-
function percentile(
|
|
82561
|
-
if (
|
|
82842
|
+
function percentile(sorted2, probability) {
|
|
82843
|
+
if (sorted2.length === 0)
|
|
82562
82844
|
return 0;
|
|
82563
|
-
const position = (
|
|
82845
|
+
const position = (sorted2.length - 1) * probability;
|
|
82564
82846
|
const lower = Math.floor(position);
|
|
82565
82847
|
const upper = Math.ceil(position);
|
|
82566
82848
|
if (lower === upper)
|
|
82567
|
-
return
|
|
82849
|
+
return sorted2[lower] ?? 0;
|
|
82568
82850
|
const fraction = position - lower;
|
|
82569
|
-
return (
|
|
82851
|
+
return (sorted2[lower] ?? 0) * (1 - fraction) + (sorted2[upper] ?? 0) * fraction;
|
|
82570
82852
|
}
|
|
82571
82853
|
function pairedBootstrapConfidenceInterval(deltas, seedHash, resamples = 1e4) {
|
|
82572
82854
|
if (deltas.length === 0)
|
|
@@ -83452,7 +83734,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
83452
83734
|
if (!input.dispatcher) {
|
|
83453
83735
|
throw new Error("no evaluation dispatcher available (cannot run validation)");
|
|
83454
83736
|
}
|
|
83455
|
-
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-
|
|
83737
|
+
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-m95v9d47.js");
|
|
83456
83738
|
const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
|
|
83457
83739
|
const result = await withProtectedSetIntegrity([evalInputRoot, ...protectedRoots(input.directory)], () => _internals99.evaluateCandidateV1({
|
|
83458
83740
|
projectRoot: input.directory,
|
|
@@ -85587,7 +85869,7 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
85587
85869
|
async function handleHelpCommand(ctx) {
|
|
85588
85870
|
const targetCommand = ctx.args.join(" ");
|
|
85589
85871
|
if (!targetCommand) {
|
|
85590
|
-
const { buildHelpText } = await import("./index-
|
|
85872
|
+
const { buildHelpText } = await import("./index-jw9wbwdh.js");
|
|
85591
85873
|
return buildHelpText();
|
|
85592
85874
|
}
|
|
85593
85875
|
const tokens = targetCommand.split(/\s+/);
|
|
@@ -85596,7 +85878,7 @@ async function handleHelpCommand(ctx) {
|
|
|
85596
85878
|
return _internals102.buildDetailedHelp(resolved.key, resolved.entry);
|
|
85597
85879
|
}
|
|
85598
85880
|
const similar = _internals102.findSimilarCommands(targetCommand);
|
|
85599
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
85881
|
+
const { buildHelpText: fullHelp } = await import("./index-jw9wbwdh.js");
|
|
85600
85882
|
if (similar.length > 0) {
|
|
85601
85883
|
return `Command '/swarm ${targetCommand}' not found.
|
|
85602
85884
|
|
|
@@ -85927,7 +86209,7 @@ var COMMAND_REGISTRY = {
|
|
|
85927
86209
|
},
|
|
85928
86210
|
"guardrail explain": {
|
|
85929
86211
|
handler: async (ctx) => {
|
|
85930
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
86212
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-mn2x7w2y.js");
|
|
85931
86213
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
85932
86214
|
},
|
|
85933
86215
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -85937,7 +86219,7 @@ var COMMAND_REGISTRY = {
|
|
|
85937
86219
|
},
|
|
85938
86220
|
"guardrail reset": {
|
|
85939
86221
|
handler: async (ctx) => {
|
|
85940
|
-
const { handleGuardrailReset } = await import("./guardrail-reset-
|
|
86222
|
+
const { handleGuardrailReset } = await import("./guardrail-reset-r49rvptv.js");
|
|
85941
86223
|
return handleGuardrailReset(ctx.args, ctx.sessionID);
|
|
85942
86224
|
},
|
|
85943
86225
|
description: "Reset one exact active invocation/action circuit after repair",
|
|
@@ -85946,7 +86228,7 @@ var COMMAND_REGISTRY = {
|
|
|
85946
86228
|
},
|
|
85947
86229
|
"guardrail-explain": {
|
|
85948
86230
|
handler: async (ctx) => {
|
|
85949
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
86231
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-mn2x7w2y.js");
|
|
85950
86232
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
85951
86233
|
},
|
|
85952
86234
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -85956,7 +86238,7 @@ var COMMAND_REGISTRY = {
|
|
|
85956
86238
|
},
|
|
85957
86239
|
"guardrail-reset": {
|
|
85958
86240
|
handler: async (ctx) => {
|
|
85959
|
-
const { handleGuardrailReset } = await import("./guardrail-reset-
|
|
86241
|
+
const { handleGuardrailReset } = await import("./guardrail-reset-r49rvptv.js");
|
|
85960
86242
|
return handleGuardrailReset(ctx.args, ctx.sessionID);
|
|
85961
86243
|
},
|
|
85962
86244
|
description: "Reset one exact active invocation/action circuit after repair",
|
|
@@ -85966,7 +86248,7 @@ var COMMAND_REGISTRY = {
|
|
|
85966
86248
|
},
|
|
85967
86249
|
"guardrail-log": {
|
|
85968
86250
|
handler: async (ctx) => {
|
|
85969
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
86251
|
+
const { handleGuardrailLog } = await import("./guardrail-log-fd3c5rks.js");
|
|
85970
86252
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
85971
86253
|
},
|
|
85972
86254
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -87079,6 +87361,9 @@ Entry points: {{ENTRY_POINTS}}
|
|
|
87079
87361
|
|
|
87080
87362
|
If any field is \`{{...}}\` (unresolved): run MODE: DISCOVER to populate it, then cache in \`.swarm/context.md\` under \`## Project Context\`.
|
|
87081
87363
|
|
|
87364
|
+
## GRAPH-FIRST EVIDENCE
|
|
87365
|
+
Before planning or broad codebase/security review, use \`repo_map\` in this order: \`graph_health\`, then \`package_boundaries\` and \`key_files\`, then a targeted \`context_pack\` that includes source anchors. For security or cross-boundary data flow, add \`route_trace\` and \`data_trace\`. Graph evidence is advisory, never an approval or denial. If the graph is absent, stale, freshness is inconclusive, confidence is low, a claim lacks source, the language is unsupported/dynamic, or an action fails, inspect the direct source and searches before deciding.
|
|
87366
|
+
|
|
87082
87367
|
## CONTEXT TRIAGE
|
|
87083
87368
|
When approaching context limits, preserve/discard in this priority order:
|
|
87084
87369
|
|
|
@@ -88478,7 +88763,7 @@ DO (explicitly):
|
|
|
88478
88763
|
- VERIFY imports exist: if the coder added a new import, use search to verify the export exists in the source
|
|
88479
88764
|
- CHECK test files were updated: if the coder changed a function signature, the tests should reflect it
|
|
88480
88765
|
- VERIFY platform compatibility: path.join() used for all paths, no hardcoded separators
|
|
88481
|
-
-
|
|
88766
|
+
- GRAPH-FIRST REVIEW: call \`repo_map action="graph_health"\`, then use \`diff_context\` and \`impact_cone\` (or \`blast_radius\` for file-level dependents) to localize the changed surface. Require source anchors and verify the direct source. Graph evidence is advisory only, never an approval or denial; if freshness is stale or inconclusive, confidence is low, source is missing, the language is unsupported/dynamic, the graph is absent, or an action fails, rely on the direct source, Git diff, and searches.
|
|
88482
88767
|
- For confirmed issues requiring a concrete fix: use suggest_patch to produce a structured patch artifact for the coder
|
|
88483
88768
|
|
|
88484
88769
|
## CONFIG STRICTNESS VERIFICATION
|
|
@@ -91540,8 +91825,8 @@ function pruneOldWindows(sessionId, maxAgeMs = 24 * 60 * 60 * 1000, maxWindows =
|
|
|
91540
91825
|
const now2 = Date.now();
|
|
91541
91826
|
const entries = Object.entries(session.windows);
|
|
91542
91827
|
const validByAge = entries.filter(([_, window]) => now2 - window.startedAtMs < maxAgeMs);
|
|
91543
|
-
const
|
|
91544
|
-
const toKeep =
|
|
91828
|
+
const sorted2 = validByAge.sort((a, b) => b[1].startedAtMs - a[1].startedAtMs);
|
|
91829
|
+
const toKeep = sorted2.slice(0, maxWindows);
|
|
91545
91830
|
session.windows = Object.fromEntries(toKeep);
|
|
91546
91831
|
}
|
|
91547
91832
|
function ensureModifiedFilesByTask(session) {
|
|
@@ -91962,7 +92247,7 @@ function getDisplayFinalPromptPressure() {
|
|
|
91962
92247
|
async function rehydratePrSubscriptions(sessionID, directory) {
|
|
91963
92248
|
const map = new Map;
|
|
91964
92249
|
try {
|
|
91965
|
-
const { listActive: listActive2 } = await import("./pr-subscriptions-
|
|
92250
|
+
const { listActive: listActive2 } = await import("./pr-subscriptions-sdv0n59c.js");
|
|
91966
92251
|
const records = await listActive2(directory);
|
|
91967
92252
|
for (const record of records) {
|
|
91968
92253
|
if (record.sessionID !== sessionID)
|
|
@@ -92408,7 +92693,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
|
|
|
92408
92693
|
return extracted === expectedSessionId;
|
|
92409
92694
|
}
|
|
92410
92695
|
async function inspectStandardWorktreeCollisionOwnership(identity) {
|
|
92411
|
-
const collisionOwnership = await import("./worktree-collision-ownership-
|
|
92696
|
+
const collisionOwnership = await import("./worktree-collision-ownership-vnj31rgc.js");
|
|
92412
92697
|
return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
|
|
92413
92698
|
}
|
|
92414
92699
|
async function runRecoveryGit(directory, args, timeoutMs = 15000) {
|
|
@@ -92817,7 +93102,7 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
92817
93102
|
const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, handle.worktreePath);
|
|
92818
93103
|
if (laneProfile) {
|
|
92819
93104
|
try {
|
|
92820
|
-
const { writeLaneProfileToDiskReal } = await import("./core-
|
|
93105
|
+
const { writeLaneProfileToDiskReal } = await import("./core-7jjgxczp.js");
|
|
92821
93106
|
await writeLaneProfileToDiskReal(handle.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
|
|
92822
93107
|
} catch {}
|
|
92823
93108
|
}
|
|
@@ -93742,7 +94027,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
|
|
|
93742
94027
|
}
|
|
93743
94028
|
clearWorktreeMergeStatus(statusKey);
|
|
93744
94029
|
try {
|
|
93745
|
-
const { removeLaneProfileFromDiskReal } = await import("./core-
|
|
94030
|
+
const { removeLaneProfileFromDiskReal } = await import("./core-7jjgxczp.js");
|
|
93746
94031
|
await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
|
|
93747
94032
|
} catch {}
|
|
93748
94033
|
const state = serializationStateBySessionID.get(dispatch.parentSessionID);
|