opencode-swarm 7.181.1 → 7.181.3
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/stage-b-gates.d.ts +4 -0
- package/dist/cli/{coder-settlement-ee8bmg83.js → coder-settlement-txte2m87.js} +11 -11
- package/dist/cli/{config-doctor-mnmxzg86.js → config-doctor-101n3c1r.js} +3 -3
- package/dist/cli/{core-m9yymv84.js → core-s0yzzpaj.js} +3 -3
- package/dist/cli/{curation-policy-m3x9mkj9.js → curation-policy-r4dkajw9.js} +4 -4
- package/dist/cli/{curator-7nmwpcxy.js → curator-dp49fr0p.js} +38 -38
- package/dist/cli/curator-drift-r7w3cg3m.js +37 -0
- package/dist/cli/curator-llm-factory-tycc9xkw.js +74 -0
- package/dist/cli/{evidence-summary-service-m2b0mxmr.js → evidence-summary-service-r648x5f2.js} +17 -17
- package/dist/cli/{gate-evidence-4y2x85g4.js → gate-evidence-8rh69tsh.js} +6 -6
- package/dist/cli/guardrail-explain-dfyj1g1c.js +75 -0
- package/dist/cli/{guardrail-log-202rfw7b.js → guardrail-log-yr60w7h6.js} +7 -7
- package/dist/cli/{guardrail-reset-7nt7z18b.js → guardrail-reset-eztc62va.js} +38 -38
- package/dist/cli/{hive-promoter-segsykns.js → hive-promoter-g56ba4a4.js} +38 -38
- package/dist/cli/{index-m65tnv4j.js → index-01r2wrwa.js} +1 -1
- package/dist/cli/{index-hxe22tx3.js → index-1ks0rnzn.js} +5 -5
- package/dist/cli/{index-ztph1v9m.js → index-1w1xrk5k.js} +1 -1
- package/dist/cli/{index-12ewkms0.js → index-23mdeh2a.js} +1 -1
- package/dist/cli/{index-a7z6jygf.js → index-2pt5g7zz.js} +3 -3
- package/dist/cli/{index-y4zjbrqs.js → index-2t21pv2v.js} +1 -1
- package/dist/cli/{index-38cfx8g8.js → index-427x3j6p.js} +2 -2
- package/dist/cli/{index-tczqm089.js → index-4ffryqb1.js} +1 -1
- package/dist/cli/{index-pee6ykkg.js → index-4jvt3r77.js} +5 -5
- package/dist/cli/{index-908yea8v.js → index-6ep83w7x.js} +1 -1
- package/dist/cli/{index-r6p6x0pb.js → index-789tdsfv.js} +4 -4
- package/dist/cli/{index-yhx94xpr.js → index-7s6ct0t2.js} +6 -6
- package/dist/cli/{index-9j5jjqks.js → index-8c37kzh6.js} +7 -7
- package/dist/cli/{index-gc6h1fmf.js → index-a2hvmc3a.js} +1 -1
- package/dist/cli/{index-ea9fk6v0.js → index-ap6hs8fj.js} +1 -1
- package/dist/cli/{index-92m05mew.js → index-by9wfeja.js} +1 -1
- package/dist/cli/{index-kjstkfgh.js → index-ckrm4784.js} +7 -7
- package/dist/cli/{index-rxs0rrv1.js → index-dy9mxh0z.js} +40 -40
- package/dist/cli/{index-b2zbak7v.js → index-ekwe81my.js} +2 -2
- package/dist/cli/{index-3qhx9dx0.js → index-h6gxh3an.js} +4946 -1965
- package/dist/cli/{index-basp4sxt.js → index-hcaspktr.js} +1 -1
- package/dist/cli/{index-bdpgfep1.js → index-jrxrjz89.js} +1 -1
- package/dist/cli/{index-q1prchye.js → index-k5rqe97g.js} +27 -13
- package/dist/cli/{index-4h54k8h3.js → index-kexzhwbq.js} +2 -2
- package/dist/cli/{index-516j9vsk.js → index-kkrbybgt.js} +27 -2
- package/dist/cli/{index-cyyvc1cd.js → index-m4e3p8na.js} +2 -2
- package/dist/cli/{index-jqjdejqe.js → index-mdqp0cq2.js} +4 -4
- package/dist/cli/{index-6mwha20t.js → index-mkpdcbye.js} +3 -3
- package/dist/cli/{index-y30y1rkg.js → index-nw3z614g.js} +6 -6
- package/dist/cli/{index-nhxykfyy.js → index-nw8pfcw1.js} +270 -10
- package/dist/cli/{index-na3br902.js → index-qdz43cne.js} +38 -38
- package/dist/cli/{index-g9ax7jyf.js → index-rchygh27.js} +57 -4
- package/dist/cli/{index-6gcxgx84.js → index-s34y6gbh.js} +1 -1
- package/dist/cli/{index-s0zgz4p1.js → index-sf51gh68.js} +1 -1
- package/dist/cli/{index-gydvqmtg.js → index-sr9k8sh7.js} +4 -4
- package/dist/cli/{index-edb3sgxg.js → index-ttgex8ky.js} +6 -6
- package/dist/cli/{index-91dhg3wr.js → index-ved1325w.js} +2 -2
- package/dist/cli/{index-rw0wy2y7.js → index-vgjmahnd.js} +3 -3
- package/dist/cli/{index-bv4b8tpa.js → index-vvgpgcyn.js} +10 -0
- package/dist/cli/{index-vmthakz0.js → index-w1ydvzef.js} +1 -1
- package/dist/cli/{index-gqe4sm73.js → index-xqr076aq.js} +4 -4
- package/dist/cli/{index-g5wjasjn.js → index-yv0q0hp9.js} +140 -9
- package/dist/cli/{index-vs83acgx.js → index-yzapt508.js} +3 -3
- package/dist/cli/index.js +39 -39
- package/dist/cli/{knowledge-escalator-r9chkas8.js → knowledge-escalator-0rcft6q4.js} +12 -12
- package/dist/cli/{knowledge-events-5j2n6age.js → knowledge-events-7jyz3qxs.js} +10 -10
- package/dist/cli/{knowledge-link-s2qs178z.js → knowledge-link-655xa3db.js} +3 -3
- package/dist/cli/{knowledge-store-mybx9bmx.js → knowledge-store-asa26g6p.js} +4 -4
- package/dist/cli/{knowledge-validator-v1sj9tv4.js → knowledge-validator-j3x9ezej.js} +6 -6
- package/dist/cli/{mcp-7yx5230p.js → mcp-70hefjk6.js} +1 -1
- package/dist/cli/model-preflight-szekh1dc.js +359 -0
- package/dist/cli/{pending-delegations-amjfmc7t.js → pending-delegations-rb6bhv5x.js} +10 -10
- package/dist/cli/{pr-subscriptions-rctqs0gk.js → pr-subscriptions-v4ms5pfb.js} +10 -10
- package/dist/cli/{pr-workflow-gate-9he8ys4e.js → pr-workflow-gate-qmfpz6wb.js} +38 -38
- package/dist/cli/{runner-tzgwvvn1.js → runner-b5vt1any.js} +4 -4
- package/dist/cli/{scan-cursor-pxqkphrh.js → scan-cursor-7zn4t1hw.js} +5 -5
- package/dist/cli/{schema-n8pk3f80.js → schema-tx62mfy8.js} +2 -2
- package/dist/cli/{scope-persistence-p992x2yd.js → scope-persistence-f8w12sns.js} +14 -14
- package/dist/cli/{server-ywrd2q6z.js → server-f2vrp2wc.js} +73 -603
- package/dist/cli/{skill-generator-cdppktqx.js → skill-generator-jme09w7n.js} +14 -14
- package/dist/cli/{snapshot-coordination-init-z42ev5g9.js → snapshot-coordination-init-ad83sq6c.js} +38 -38
- package/dist/cli/{speckit-checkoff-6ynv46bn.js → speckit-checkoff-98gfvn3r.js} +4 -4
- package/dist/cli/{telemetry-zhcgfe70.js → telemetry-6k8t2mrw.js} +1 -1
- package/dist/cli/{workspace-snapshot-4m2ex1ey.js → workspace-snapshot-hsssm50w.js} +2 -2
- package/dist/cli/{worktree-collision-ownership-65971p3m.js → worktree-collision-ownership-47kdjtqb.js} +11 -11
- package/dist/cli/{worktree-isolation-xf7dfc46.js → worktree-isolation-etaawcnt.js} +38 -38
- package/dist/commands/registry.d.ts +1 -1
- package/dist/config/agent-model.d.ts +14 -0
- package/dist/config/bundled-skill-dispositions.d.ts +29 -0
- package/dist/db/qa-gate-profile.d.ts +6 -3
- package/dist/db/qa-gate-session-override.d.ts +72 -0
- package/dist/index.js +404 -390
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/instruction-pairing.d.ts +112 -0
- package/dist/services/model-preflight.d.ts +103 -21
- package/dist/session/restart-reconciliation.d.ts +74 -0
- package/dist/state.d.ts +6 -3
- package/dist/tools/get-qa-gate-profile.d.ts +13 -6
- package/package.json +1 -1
- package/dist/cli/curator-drift-q42fr0c9.js +0 -297
- package/dist/cli/curator-llm-factory-s1b2p162.js +0 -74
- package/dist/cli/guardrail-explain-nvmf3y7j.js +0 -75
- package/dist/cli/model-preflight-ckvv1arg.js +0 -170
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
EvaluationRunV1Schema,
|
|
4
4
|
GateAuditResultV1Schema,
|
|
5
5
|
getProtectedEvaluationRunIds
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-sf51gh68.js";
|
|
7
7
|
import {
|
|
8
8
|
readEffectiveSpecSync
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-4ffryqb1.js";
|
|
10
10
|
import {
|
|
11
11
|
validateWorkspaceRoot
|
|
12
12
|
} from "./index-6b295cas.js";
|
|
@@ -23,13 +23,13 @@ import {
|
|
|
23
23
|
readTaskEvidence,
|
|
24
24
|
readTaskEvidenceRaw,
|
|
25
25
|
sanitizeTaskId
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-789tdsfv.js";
|
|
27
27
|
import {
|
|
28
28
|
estimateCharsForTokens,
|
|
29
29
|
estimateTokens,
|
|
30
30
|
readSwarmFileAsync,
|
|
31
31
|
validateSwarmPath
|
|
32
|
-
} from "./index-
|
|
32
|
+
} from "./index-a2hvmc3a.js";
|
|
33
33
|
import {
|
|
34
34
|
bunHash,
|
|
35
35
|
bunWrite,
|
|
@@ -58,10 +58,10 @@ import {
|
|
|
58
58
|
replayFromLedgerWithStatus,
|
|
59
59
|
takeSnapshotEvent,
|
|
60
60
|
takeSnapshotWithRetry
|
|
61
|
-
} from "./index-
|
|
61
|
+
} from "./index-ttgex8ky.js";
|
|
62
62
|
import {
|
|
63
63
|
appendCoreEventSync
|
|
64
|
-
} from "./index-
|
|
64
|
+
} from "./index-427x3j6p.js";
|
|
65
65
|
import {
|
|
66
66
|
derivePlanId,
|
|
67
67
|
derivePlanIdentityHash,
|
|
@@ -69,20 +69,20 @@ import {
|
|
|
69
69
|
importCoordinationOnce,
|
|
70
70
|
listCoordinationStates,
|
|
71
71
|
transitionCoordinationState
|
|
72
|
-
} from "./index-
|
|
72
|
+
} from "./index-w1ydvzef.js";
|
|
73
73
|
import {
|
|
74
74
|
DURABILITY_CLASSES,
|
|
75
75
|
getProjectDb,
|
|
76
76
|
projectDbExists,
|
|
77
77
|
withDurabilityClass
|
|
78
|
-
} from "./index-
|
|
78
|
+
} from "./index-vvgpgcyn.js";
|
|
79
79
|
import {
|
|
80
80
|
assertProjectRoot,
|
|
81
81
|
withEvidenceLock
|
|
82
|
-
} from "./index-
|
|
82
|
+
} from "./index-ap6hs8fj.js";
|
|
83
83
|
import {
|
|
84
84
|
emit
|
|
85
|
-
} from "./index-
|
|
85
|
+
} from "./index-mkpdcbye.js";
|
|
86
86
|
import {
|
|
87
87
|
canonicalRootKeyFresh
|
|
88
88
|
} from "./index-1xnse449.js";
|
|
@@ -2940,7 +2940,7 @@ async function updateTaskStatus(directory, taskId, status, options) {
|
|
|
2940
2940
|
if (status === "completed") {
|
|
2941
2941
|
try {
|
|
2942
2942
|
const completedTask = updatedPlan.phases.flatMap((phase) => phase.tasks).find((candidate) => candidate.id === taskId);
|
|
2943
|
-
const { maybePropagateSpeckitCheckoff } = await import("./speckit-checkoff-
|
|
2943
|
+
const { maybePropagateSpeckitCheckoff } = await import("./speckit-checkoff-98gfvn3r.js");
|
|
2944
2944
|
await maybePropagateSpeckitCheckoff(directory, {
|
|
2945
2945
|
taskId,
|
|
2946
2946
|
frRefs: completedTask?.fr_refs ?? [],
|
|
@@ -2965,7 +2965,7 @@ async function updateTaskStatus(directory, taskId, status, options) {
|
|
|
2965
2965
|
break;
|
|
2966
2966
|
}
|
|
2967
2967
|
}
|
|
2968
|
-
const { readDeclaredScopeFilesFromBindings } = await import("./scope-persistence-
|
|
2968
|
+
const { readDeclaredScopeFilesFromBindings } = await import("./scope-persistence-f8w12sns.js");
|
|
2969
2969
|
const canonicalScope = readDeclaredScopeFilesFromBindings({
|
|
2970
2970
|
directory,
|
|
2971
2971
|
taskId,
|
|
@@ -3077,6 +3077,20 @@ ${phases.join(`
|
|
|
3077
3077
|
return `${markdown.trim()}
|
|
3078
3078
|
`;
|
|
3079
3079
|
}
|
|
3080
|
+
function getCurrentTaskId(plan) {
|
|
3081
|
+
if (!plan)
|
|
3082
|
+
return;
|
|
3083
|
+
const currentPhase = resolveActivePhaseId(plan);
|
|
3084
|
+
const phase = plan.phases.find((p) => p.id === currentPhase);
|
|
3085
|
+
if (!phase)
|
|
3086
|
+
return;
|
|
3087
|
+
const sortedTasks = [...phase.tasks].sort((a, b) => compareTaskIds(a.id, b.id));
|
|
3088
|
+
const inProgress = sortedTasks.find((t) => t.status === "in_progress");
|
|
3089
|
+
if (inProgress)
|
|
3090
|
+
return inProgress.id;
|
|
3091
|
+
const incomplete = sortedTasks.find((t) => t.status !== "completed" && t.status !== "closed");
|
|
3092
|
+
return incomplete?.id;
|
|
3093
|
+
}
|
|
3080
3094
|
function migrateLegacyPlan(planContent, swarmId) {
|
|
3081
3095
|
const lines = planContent.split(`
|
|
3082
3096
|
`);
|
|
@@ -4157,4 +4171,4 @@ function mergeDurableGateEntriesFromEvidence(taskId, entries, evidence) {
|
|
|
4157
4171
|
return merged;
|
|
4158
4172
|
}
|
|
4159
4173
|
|
|
4160
|
-
export { buildTaskCompletionDescriptor, ensureTaskCheckpointReceipt, updateTaskCheckpointReceipt, MAX_TRANSIENT_RETRIES, isTransientSpawnError, transientBackoff, readLaneEnvFileFromDiskSync, getGitRepositoryStatus, isGitRepo, getDefaultBaseBranch, detectDefaultRemoteBranch, resetToRemoteBranch, resetToMainAfterMerge, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, loadPlanJsonOnly, loadPlan, withPlanLifecycleLock, savePlan, closePlanTerminalState, updateTaskStatus, derivePlanMarkdown, isValidEvidenceType, isSecretscanEvidence, sanitizeTaskId2 as sanitizeTaskId, validateProjectRoot, saveEvidence, loadEvidence, listEvidenceTaskIds, checkRequirementCoverage, archiveEvidence, _internals7 as _internals, readDurableGateEvidence, getDurableGateEvidenceStatus, getDurableGateEvidenceStatusForTask, mergeDurableGateEntriesFromEvidence };
|
|
4174
|
+
export { buildTaskCompletionDescriptor, ensureTaskCheckpointReceipt, updateTaskCheckpointReceipt, MAX_TRANSIENT_RETRIES, isTransientSpawnError, transientBackoff, readLaneEnvFileFromDiskSync, getGitRepositoryStatus, isGitRepo, getDefaultBaseBranch, detectDefaultRemoteBranch, resetToRemoteBranch, resetToMainAfterMerge, sanitizeContextText, getRunMemorySummary, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, loadPlanJsonOnly, loadPlan, withPlanLifecycleLock, savePlan, closePlanTerminalState, updateTaskStatus, derivePlanMarkdown, getCurrentTaskId, isValidEvidenceType, isSecretscanEvidence, sanitizeTaskId2 as sanitizeTaskId, validateProjectRoot, saveEvidence, loadEvidence, listEvidenceTaskIds, checkRequirementCoverage, archiveEvidence, _internals7 as _internals, readDurableGateEvidence, getDurableGateEvidenceStatus, getDurableGateEvidenceStatusForTask, mergeDurableGateEntriesFromEvidence };
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
detectWindowsWrites,
|
|
15
15
|
getSharedClassifierGuardrailBlock,
|
|
16
16
|
resolveWriteTargets
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-h6gxh3an.js";
|
|
18
18
|
import {
|
|
19
19
|
checkFileAuthority,
|
|
20
20
|
classifyFile,
|
|
21
21
|
isInDeclaredScope,
|
|
22
22
|
redactPath,
|
|
23
23
|
redactShellCommand
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-mdqp0cq2.js";
|
|
25
25
|
|
|
26
26
|
// src/services/guardrail-explain-service.ts
|
|
27
27
|
import path from "path";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
pseudonymousRef,
|
|
4
4
|
resolveLineageSalt,
|
|
5
5
|
telemetry
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-mkpdcbye.js";
|
|
7
7
|
import {
|
|
8
8
|
canonicalRootKeyFresh
|
|
9
9
|
} from "./index-1xnse449.js";
|
|
@@ -476,6 +476,31 @@ function isAdoptableScopeKey(key) {
|
|
|
476
476
|
function isFiniteCounter(value) {
|
|
477
477
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
478
478
|
}
|
|
479
|
+
function observeModelLimitResolution(input) {
|
|
480
|
+
try {
|
|
481
|
+
ensureLearningHealth();
|
|
482
|
+
const now = _internals.now();
|
|
483
|
+
const identity = input.directory ? `${projectRef(input.directory)}/identity/${input.modelID || "unknown"}::${input.providerID || "unknown"}` : `u/identity/${input.modelID || "unknown"}::${input.providerID || "unknown"}`;
|
|
484
|
+
const scope = ensureScope("model_limit_fallback", identity, now);
|
|
485
|
+
const config = LEARNING_HEALTH_ALARM_CONFIG.model_limit_fallback;
|
|
486
|
+
const fallback = input.resolution === "static_provider_cap" || input.resolution === "static_native" || input.resolution === "static_default";
|
|
487
|
+
appendFact(scope, fallback ? "fallback" : "resolved", now, config.windowMs);
|
|
488
|
+
if (input.invalidOverride) {
|
|
489
|
+
appendFact(scope, "invalid_override", now, config.windowMs);
|
|
490
|
+
}
|
|
491
|
+
const detail = {
|
|
492
|
+
model: input.modelID || "unknown",
|
|
493
|
+
provider: input.providerID || "unknown",
|
|
494
|
+
role: input.aliasKeyClass,
|
|
495
|
+
reason: input.invalidOverride ? "invalid_override_skipped" : fallback ? String(input.resolution) : undefined
|
|
496
|
+
};
|
|
497
|
+
if (fallback || input.invalidOverride) {
|
|
498
|
+
applyAlarmState("model_limit_fallback", "identity", identity, "active", config.severity, detail, input.directory, now);
|
|
499
|
+
} else {
|
|
500
|
+
applyAlarmState("model_limit_fallback", "identity", identity, "idle", config.severity, detail, input.directory, now);
|
|
501
|
+
}
|
|
502
|
+
} catch {}
|
|
503
|
+
}
|
|
479
504
|
function livenessMap(directory) {
|
|
480
505
|
const key = canonicalRootKeyFresh(directory);
|
|
481
506
|
let map = livenessGaps.get(key);
|
|
@@ -793,4 +818,4 @@ function scopeClassFor(alarm) {
|
|
|
793
818
|
}
|
|
794
819
|
}
|
|
795
820
|
|
|
796
|
-
export { observeReceiptTransition, observeCuratorCompliance, observeCloseArchive, observeDelegationLedgerPressure, observeStoreHealth, readLearningHealth };
|
|
821
|
+
export { observeModelLimitResolution, observeReceiptTransition, observeCuratorCompliance, observeCloseArchive, observeDelegationLedgerPressure, observeStoreHealth, readLearningHealth };
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
readKnowledge,
|
|
4
4
|
transactKnowledge
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-7s6ct0t2.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveKnowledgeStoreDir
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-23mdeh2a.js";
|
|
9
9
|
import {
|
|
10
10
|
init_git_executable,
|
|
11
11
|
resolveGitExecutableAsync
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
observeStoreHealth
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-kkrbybgt.js";
|
|
5
5
|
import {
|
|
6
6
|
telemetry
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-mkpdcbye.js";
|
|
8
8
|
import {
|
|
9
9
|
init_schema,
|
|
10
10
|
stripKnownSwarmPrefix
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-rchygh27.js";
|
|
12
12
|
import {
|
|
13
13
|
init_constants
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-2t21pv2v.js";
|
|
15
15
|
import {
|
|
16
16
|
getPathFlavor,
|
|
17
17
|
init_path_identity,
|
|
@@ -236,7 +236,7 @@ var CATALOG_SOURCE = [
|
|
|
236
236
|
category: "delegation",
|
|
237
237
|
severity: "info",
|
|
238
238
|
privacyClass: "pseudonymous",
|
|
239
|
-
producer: "src/index.ts:
|
|
239
|
+
producer: "src/index.ts:881",
|
|
240
240
|
consumers: CONSUMER_COST_CORRECTION,
|
|
241
241
|
retentionOwnerIssue: ISSUE_COST_RETENTION,
|
|
242
242
|
requiredWorkflowIds: REQUIRE_SESSION_AND_TASK,
|
|
@@ -249,7 +249,7 @@ var CATALOG_SOURCE = [
|
|
|
249
249
|
category: "delegation",
|
|
250
250
|
severity: "info",
|
|
251
251
|
privacyClass: "pseudonymous",
|
|
252
|
-
producer: "src/index.ts:
|
|
252
|
+
producer: "src/index.ts:1901",
|
|
253
253
|
consumers: NO_CONSUMERS,
|
|
254
254
|
futureOwnerIssue: ISSUE_SINK,
|
|
255
255
|
retentionOwnerIssue: ISSUE_COST_RETENTION,
|
|
@@ -263,7 +263,7 @@ var CATALOG_SOURCE = [
|
|
|
263
263
|
category: "delegation",
|
|
264
264
|
severity: "notice",
|
|
265
265
|
privacyClass: "pseudonymous",
|
|
266
|
-
producer: "src/index.ts:
|
|
266
|
+
producer: "src/index.ts:1921",
|
|
267
267
|
consumers: CONSUMER_COST_JOIN,
|
|
268
268
|
retentionOwnerIssue: ISSUE_COST_RETENTION,
|
|
269
269
|
requiredWorkflowIds: REQUIRE_SESSION,
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
validateSwarmPath
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-a2hvmc3a.js";
|
|
5
5
|
import {
|
|
6
6
|
deleteCoordinationState,
|
|
7
7
|
importCoordinationOnce,
|
|
8
8
|
listCoordinationStates,
|
|
9
9
|
transitionCoordinationState,
|
|
10
10
|
withCoordinationTransaction
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-w1ydvzef.js";
|
|
12
12
|
import {
|
|
13
13
|
getProjectDb,
|
|
14
14
|
projectDbExists
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-vvgpgcyn.js";
|
|
16
16
|
import {
|
|
17
17
|
observeStoreHealth
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-kkrbybgt.js";
|
|
19
19
|
import {
|
|
20
20
|
withEvidenceLock
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-ap6hs8fj.js";
|
|
22
22
|
import {
|
|
23
23
|
telemetry
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-mkpdcbye.js";
|
|
25
25
|
import {
|
|
26
26
|
canonicalRootKey,
|
|
27
27
|
canonicalRootKeyFresh,
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
+
readEffectiveSpecSync
|
|
4
|
+
} from "./index-4ffryqb1.js";
|
|
5
|
+
import {
|
|
6
|
+
readSwarmFileAsync
|
|
7
|
+
} from "./index-a2hvmc3a.js";
|
|
8
|
+
import {
|
|
9
|
+
DURABILITY_CLASSES,
|
|
3
10
|
DbWriteError,
|
|
4
11
|
applySynchronousForClass,
|
|
5
12
|
batchDurabilityClass,
|
|
6
13
|
classifyDbWriteError,
|
|
7
|
-
getProjectDb
|
|
8
|
-
|
|
14
|
+
getProjectDb,
|
|
15
|
+
projectDbExists
|
|
16
|
+
} from "./index-vvgpgcyn.js";
|
|
9
17
|
import {
|
|
10
18
|
_internals,
|
|
11
19
|
canonicalRootKeyFresh
|
|
@@ -16,13 +24,6 @@ import {
|
|
|
16
24
|
warn
|
|
17
25
|
} from "./index-zgwm4ryv.js";
|
|
18
26
|
|
|
19
|
-
// src/db/canonical-project.ts
|
|
20
|
-
var defaultCanonicalRootRealpath = _internals.realpathSync;
|
|
21
|
-
var defaultCanonicalRootNativeRealpath = _internals.realpathSyncNative;
|
|
22
|
-
function canonicalProjectKey(directory) {
|
|
23
|
-
return canonicalRootKeyFresh(directory);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
27
|
// src/background/event-bus.ts
|
|
27
28
|
class AutomationEventBus {
|
|
28
29
|
listeners = new Map;
|
|
@@ -90,6 +91,17 @@ function getGlobalEventBus() {
|
|
|
90
91
|
return globalEventBus;
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
// src/db/phase-report-store.ts
|
|
95
|
+
import { readdirSync as readdirSync2 } from "fs";
|
|
96
|
+
import { join as join2 } from "path";
|
|
97
|
+
|
|
98
|
+
// src/db/canonical-project.ts
|
|
99
|
+
var defaultCanonicalRootRealpath = _internals.realpathSync;
|
|
100
|
+
var defaultCanonicalRootNativeRealpath = _internals.realpathSyncNative;
|
|
101
|
+
function canonicalProjectKey(directory) {
|
|
102
|
+
return canonicalRootKeyFresh(directory);
|
|
103
|
+
}
|
|
104
|
+
|
|
93
105
|
// src/db/group-commit-writer.ts
|
|
94
106
|
init_logger();
|
|
95
107
|
function isClosedHandleError(err) {
|
|
@@ -410,4 +422,252 @@ function importLegacyJsonFiles(directory, opts) {
|
|
|
410
422
|
return { imported: 0, skipped, archived: false };
|
|
411
423
|
}
|
|
412
424
|
|
|
413
|
-
|
|
425
|
+
// src/db/phase-report-store.ts
|
|
426
|
+
var PHASE_REPORT_LEGACY_PREFIXES = {
|
|
427
|
+
curator_drift: "drift-report-phase-",
|
|
428
|
+
design_doc_drift: "doc-drift-phase-"
|
|
429
|
+
};
|
|
430
|
+
var importedRoots = new Set;
|
|
431
|
+
function hasAnyPhaseReportState(directory) {
|
|
432
|
+
if (projectDbExists(directory))
|
|
433
|
+
return true;
|
|
434
|
+
const root = canonicalProjectKey(directory);
|
|
435
|
+
let entries;
|
|
436
|
+
try {
|
|
437
|
+
entries = readdirSync2(join2(root, ".swarm"));
|
|
438
|
+
} catch {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
for (const prefix of Object.values(PHASE_REPORT_LEGACY_PREFIXES)) {
|
|
442
|
+
if (entries.some((name) => name.startsWith(prefix) && name.endsWith(".json") && !name.includes(".imported"))) {
|
|
443
|
+
return true;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
function kindCount(db, kind) {
|
|
449
|
+
return db.query("SELECT COUNT(*) as count FROM phase_report WHERE kind = ?").get(kind)?.count ?? 0;
|
|
450
|
+
}
|
|
451
|
+
function ensurePhaseReportsImported(directory) {
|
|
452
|
+
const root = canonicalProjectKey(directory);
|
|
453
|
+
if (importedRoots.has(root))
|
|
454
|
+
return;
|
|
455
|
+
for (const kind of Object.keys(PHASE_REPORT_LEGACY_PREFIXES)) {
|
|
456
|
+
importLegacyJsonFiles(directory, {
|
|
457
|
+
filePrefix: PHASE_REPORT_LEGACY_PREFIXES[kind],
|
|
458
|
+
kind,
|
|
459
|
+
kindCount: (db) => kindCount(db, kind),
|
|
460
|
+
upsertRow: (db, phase, payload) => {
|
|
461
|
+
db.run(`INSERT INTO phase_report (kind, phase, payload, updated_at)
|
|
462
|
+
VALUES (?, ?, ?, datetime('now'))
|
|
463
|
+
ON CONFLICT(kind, phase) DO UPDATE SET
|
|
464
|
+
payload = excluded.payload,
|
|
465
|
+
updated_at = datetime('now')`, [kind, phase, payload]);
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
importedRoots.add(root);
|
|
470
|
+
}
|
|
471
|
+
async function upsertPhaseReportDb(directory, kind, phase, payload) {
|
|
472
|
+
ensurePhaseReportsImported(directory);
|
|
473
|
+
const writer = getGroupCommitWriter(directory);
|
|
474
|
+
writer.enqueue({
|
|
475
|
+
durability: DURABILITY_CLASSES.phase_report,
|
|
476
|
+
run: (db) => {
|
|
477
|
+
db.run(`INSERT INTO phase_report (kind, phase, payload, updated_at)
|
|
478
|
+
VALUES (?, ?, ?, datetime('now'))
|
|
479
|
+
ON CONFLICT(kind, phase) DO UPDATE SET
|
|
480
|
+
payload = excluded.payload,
|
|
481
|
+
updated_at = datetime('now')`, [kind, phase, payload]);
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
await writer.flush();
|
|
485
|
+
}
|
|
486
|
+
function readPhaseReportsDb(directory, kind) {
|
|
487
|
+
if (!hasAnyPhaseReportState(directory))
|
|
488
|
+
return [];
|
|
489
|
+
ensurePhaseReportsImported(directory);
|
|
490
|
+
const db = getProjectDb(directory);
|
|
491
|
+
return db.query("SELECT phase, payload FROM phase_report WHERE kind = ? ORDER BY phase").all(kind).map((row) => ({ phase: row.phase, payload: row.payload }));
|
|
492
|
+
}
|
|
493
|
+
function phaseReportLocator(kind, phase) {
|
|
494
|
+
return `swarm.db:phase_report(${kind},${phase})`;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// src/hooks/curator-drift.ts
|
|
498
|
+
init_logger();
|
|
499
|
+
async function readPriorDriftReports(directory) {
|
|
500
|
+
const reports = [];
|
|
501
|
+
try {
|
|
502
|
+
for (const row of readPhaseReportsDb(directory, "curator_drift")) {
|
|
503
|
+
try {
|
|
504
|
+
const report = JSON.parse(row.payload);
|
|
505
|
+
if (typeof report.phase !== "number" || typeof report.alignment !== "string" || typeof report.timestamp !== "string" || typeof report.drift_score !== "number" || typeof report.schema_version !== "number" || !Array.isArray(report.compounding_effects)) {
|
|
506
|
+
warn(`[curator-drift] Skipping corrupt drift report: phase ${row.phase}`);
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
509
|
+
reports.push(report);
|
|
510
|
+
} catch {
|
|
511
|
+
warn(`[curator-drift] Skipping unreadable drift report: phase ${row.phase}`);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
} catch {
|
|
515
|
+
return [];
|
|
516
|
+
}
|
|
517
|
+
reports.sort((a, b) => a.phase - b.phase);
|
|
518
|
+
return reports;
|
|
519
|
+
}
|
|
520
|
+
async function writeDriftReport(directory, report) {
|
|
521
|
+
const locator = phaseReportLocator("curator_drift", report.phase);
|
|
522
|
+
try {
|
|
523
|
+
await upsertPhaseReportDb(directory, "curator_drift", report.phase, JSON.stringify(report, null, 2));
|
|
524
|
+
} catch (err) {
|
|
525
|
+
throw new Error(`[curator-drift] Failed to write drift report to ${locator}: ${String(err)}`);
|
|
526
|
+
}
|
|
527
|
+
return locator;
|
|
528
|
+
}
|
|
529
|
+
var _internals4 = {
|
|
530
|
+
readPriorDriftReports,
|
|
531
|
+
writeDriftReport,
|
|
532
|
+
runDeterministicDriftCheck,
|
|
533
|
+
buildDriftInjectionText
|
|
534
|
+
};
|
|
535
|
+
function extractRequirementIds(text) {
|
|
536
|
+
const matches = text.match(/(?:[A-Za-z0-9][A-Za-z0-9._-]*\/)?FR-\d{3}/g);
|
|
537
|
+
return matches ? [...new Set(matches)] : [];
|
|
538
|
+
}
|
|
539
|
+
function bareSuffixCovers(specId, refId) {
|
|
540
|
+
return refId === specId || !refId.includes("/") && specId.endsWith(`/${refId}`);
|
|
541
|
+
}
|
|
542
|
+
async function runDeterministicDriftCheck(directory, phase, curatorResult, config, injectAdvisory) {
|
|
543
|
+
try {
|
|
544
|
+
const planMd = await readSwarmFileAsync(directory, "plan.md");
|
|
545
|
+
const specMd = readEffectiveSpecSync(directory)?.content ?? null;
|
|
546
|
+
const priorReports = await _internals4.readPriorDriftReports(directory);
|
|
547
|
+
const complianceCount = curatorResult.compliance.length;
|
|
548
|
+
const warningCompliance = curatorResult.compliance.filter((obs) => obs.severity === "warning");
|
|
549
|
+
let alignment = "ALIGNED";
|
|
550
|
+
let driftScore = 0;
|
|
551
|
+
const specRequirements = specMd ? extractRequirementIds(specMd) : [];
|
|
552
|
+
const planRequirements = planMd ? extractRequirementIds(planMd) : [];
|
|
553
|
+
const digestRequirements = extractRequirementIds(JSON.stringify(curatorResult.digest) + JSON.stringify(curatorResult.compliance) + JSON.stringify(curatorResult.knowledge_recommendations ?? []));
|
|
554
|
+
if (!planMd) {
|
|
555
|
+
alignment = "MINOR_DRIFT";
|
|
556
|
+
driftScore = 0.3;
|
|
557
|
+
} else if (specRequirements.length > 0) {
|
|
558
|
+
const coveredInPlan = specRequirements.filter((fr) => planRequirements.some((ref) => bareSuffixCovers(fr, ref)));
|
|
559
|
+
const coveredInDigest = specRequirements.filter((fr) => digestRequirements.some((ref) => bareSuffixCovers(fr, ref)));
|
|
560
|
+
const specCoverageRatio = coveredInPlan.length / specRequirements.length;
|
|
561
|
+
const implementationRatio = coveredInDigest.length / specRequirements.length;
|
|
562
|
+
if (specCoverageRatio < 0.5) {
|
|
563
|
+
alignment = "MAJOR_DRIFT";
|
|
564
|
+
driftScore = Math.min(0.9, 0.6 + (1 - specCoverageRatio) * 0.3);
|
|
565
|
+
} else if (warningCompliance.length >= 3) {
|
|
566
|
+
alignment = "MAJOR_DRIFT";
|
|
567
|
+
driftScore = Math.min(0.9, 0.5 + warningCompliance.length * 0.1);
|
|
568
|
+
} else if (warningCompliance.length >= 1 || complianceCount >= 3) {
|
|
569
|
+
alignment = "MINOR_DRIFT";
|
|
570
|
+
driftScore = Math.min(0.49, 0.2 + complianceCount * 0.05);
|
|
571
|
+
} else if (implementationRatio < 0.5) {
|
|
572
|
+
alignment = "MINOR_DRIFT";
|
|
573
|
+
driftScore = Math.min(0.6, 0.2 + (1 - implementationRatio) * 0.3);
|
|
574
|
+
}
|
|
575
|
+
} else {
|
|
576
|
+
if (warningCompliance.length >= 3) {
|
|
577
|
+
alignment = "MAJOR_DRIFT";
|
|
578
|
+
driftScore = Math.min(0.9, 0.5 + warningCompliance.length * 0.1);
|
|
579
|
+
} else if (warningCompliance.length >= 1 || complianceCount >= 3) {
|
|
580
|
+
alignment = "MINOR_DRIFT";
|
|
581
|
+
driftScore = Math.min(0.49, 0.2 + complianceCount * 0.05);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
const keyCorrections = warningCompliance.map((obs) => obs.description);
|
|
585
|
+
const firstDeviation = warningCompliance.length > 0 ? {
|
|
586
|
+
phase,
|
|
587
|
+
task: "unknown",
|
|
588
|
+
description: warningCompliance[0]?.description ?? ""
|
|
589
|
+
} : null;
|
|
590
|
+
const requirementsChecked = curatorResult.digest.tasks_total;
|
|
591
|
+
const requirementsSatisfied = curatorResult.digest.tasks_completed;
|
|
592
|
+
const coverageNote = specRequirements.length > 0 ? ` [${digestRequirements.filter((ref) => specRequirements.some((fr) => bareSuffixCovers(fr, ref))).length}/${specRequirements.length} FRs covered]` : "";
|
|
593
|
+
const injectionSummaryRaw = `Phase ${phase}: ${alignment} (${driftScore.toFixed(2)})${coverageNote} \u2014 ${firstDeviation ? firstDeviation.description : "all requirements on track"}.${keyCorrections.length > 0 ? `Correction: ${keyCorrections[0] ?? ""}.` : ""}`;
|
|
594
|
+
const injectionSummary = injectionSummaryRaw.slice(0, config.drift_inject_max_chars);
|
|
595
|
+
const report = {
|
|
596
|
+
schema_version: 1,
|
|
597
|
+
phase,
|
|
598
|
+
timestamp: new Date().toISOString(),
|
|
599
|
+
alignment,
|
|
600
|
+
drift_score: driftScore,
|
|
601
|
+
first_deviation: firstDeviation,
|
|
602
|
+
compounding_effects: priorReports.filter((r) => r.alignment !== "ALIGNED").map((r) => `Phase ${r.phase}: ${r.alignment}`).slice(0, 5),
|
|
603
|
+
corrections: keyCorrections.slice(0, 5),
|
|
604
|
+
requirements_checked: requirementsChecked,
|
|
605
|
+
requirements_satisfied: requirementsSatisfied,
|
|
606
|
+
scope_additions: [],
|
|
607
|
+
injection_summary: injectionSummary
|
|
608
|
+
};
|
|
609
|
+
const reportPath = await _internals4.writeDriftReport(directory, report);
|
|
610
|
+
getGlobalEventBus().publish("curator.drift.completed", {
|
|
611
|
+
phase,
|
|
612
|
+
alignment,
|
|
613
|
+
drift_score: driftScore,
|
|
614
|
+
report_path: reportPath
|
|
615
|
+
});
|
|
616
|
+
if (injectAdvisory && alignment !== "ALIGNED" && driftScore > 0) {
|
|
617
|
+
try {
|
|
618
|
+
const advisoryText = `CURATOR DRIFT DETECTED (phase ${phase}, score ${driftScore.toFixed(2)}): ${injectionSummary.slice(0, 300)}. Review the phase-${phase} drift report stored in .swarm/swarm.db (${phaseReportLocator("curator_drift", phase)}) and address spec alignment before proceeding. Consider running critic_drift_verifier before phase completion to get a proper drift review.`;
|
|
619
|
+
injectAdvisory(advisoryText);
|
|
620
|
+
} catch {}
|
|
621
|
+
}
|
|
622
|
+
const injectionText = injectionSummary;
|
|
623
|
+
return {
|
|
624
|
+
phase,
|
|
625
|
+
report,
|
|
626
|
+
report_path: reportPath,
|
|
627
|
+
injection_text: injectionText
|
|
628
|
+
};
|
|
629
|
+
} catch (err) {
|
|
630
|
+
getGlobalEventBus().publish("curator.error", {
|
|
631
|
+
operation: "drift",
|
|
632
|
+
phase,
|
|
633
|
+
error: String(err)
|
|
634
|
+
});
|
|
635
|
+
const defaultReport = {
|
|
636
|
+
schema_version: 1,
|
|
637
|
+
phase,
|
|
638
|
+
timestamp: new Date().toISOString(),
|
|
639
|
+
alignment: "ALIGNED",
|
|
640
|
+
drift_score: 0,
|
|
641
|
+
first_deviation: null,
|
|
642
|
+
compounding_effects: [],
|
|
643
|
+
corrections: [],
|
|
644
|
+
requirements_checked: 0,
|
|
645
|
+
requirements_satisfied: 0,
|
|
646
|
+
scope_additions: [],
|
|
647
|
+
injection_summary: `Phase ${phase}: drift analysis unavailable (${String(err)})`
|
|
648
|
+
};
|
|
649
|
+
return {
|
|
650
|
+
phase,
|
|
651
|
+
report: defaultReport,
|
|
652
|
+
report_path: "",
|
|
653
|
+
injection_text: ""
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
function buildDriftInjectionText(report, maxChars) {
|
|
658
|
+
if (maxChars <= 0) {
|
|
659
|
+
return "";
|
|
660
|
+
}
|
|
661
|
+
let text;
|
|
662
|
+
if (report.alignment === "ALIGNED" && report.drift_score < 0.1) {
|
|
663
|
+
text = `<drift_report>Phase ${report.phase}: ALIGNED, all requirements on track.</drift_report>`;
|
|
664
|
+
} else {
|
|
665
|
+
const keyFinding = report.first_deviation?.description ?? "no deviation recorded";
|
|
666
|
+
const score = report.drift_score ?? 0;
|
|
667
|
+
const correctionClause = report.corrections?.[0] ? `Correction: ${report.corrections[0]}.` : "";
|
|
668
|
+
text = `<drift_report>Phase ${report.phase}: ${report.alignment} (${score.toFixed(2)}) \u2014 ${keyFinding}. ${correctionClause}</drift_report>`;
|
|
669
|
+
}
|
|
670
|
+
return text.slice(0, maxChars);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
export { canonicalProjectKey, getGroupCommitWriter, closeGroupCommitWriter, importLegacyJsonl, getGlobalEventBus, readPriorDriftReports, writeDriftReport, _internals4 as _internals, runDeterministicDriftCheck, buildDriftInjectionText };
|