opencode-swarm 7.137.3 → 7.137.5
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/test-file-split/SKILL.md +2 -2
- package/.opencode/skills/writing-tests/SKILL.md +15 -1
- package/dist/background/pending-delegations.d.ts +23 -3
- package/dist/cli/{config-doctor-t560ks5q.js → config-doctor-kv6hgx4a.js} +2 -2
- package/dist/cli/{curation-policy-r1ddgn8c.js → curation-policy-92ecp6y6.js} +2 -2
- package/dist/cli/{curator-zcg176y4.js → curator-dwnsf527.js} +13 -13
- package/dist/cli/{curator-llm-factory-ny0hcz11.js → curator-llm-factory-9p2eajyj.js} +13 -13
- package/dist/cli/{guardrail-explain-wmc2c89t.js → guardrail-explain-8r62kbz8.js} +14 -14
- package/dist/cli/{guardrail-log-m7th4yac.js → guardrail-log-evq3pke7.js} +3 -3
- package/dist/cli/{hive-promoter-m9fbm8hg.js → hive-promoter-9f8e7csh.js} +13 -13
- package/dist/cli/{index-c2v79596.js → index-0s4gr6qh.js} +53 -6
- package/dist/cli/{index-amf649jq.js → index-5ykb4nfj.js} +4 -4
- package/dist/cli/{index-cqsxdb6f.js → index-891ym5hz.js} +1 -1
- package/dist/cli/{index-2xvtskcg.js → index-a2xw89st.js} +1 -1
- package/dist/cli/{index-hsc81cfm.js → index-ahkb1nty.js} +1 -1
- package/dist/cli/{index-ab7p3gq6.js → index-akka5gyb.js} +2 -2
- package/dist/cli/{index-kbksjvte.js → index-cyew7vak.js} +5 -5
- package/dist/cli/{index-ky1kr5my.js → index-fc3pppmj.js} +15 -15
- package/dist/cli/{index-j215fc3r.js → index-g691qtx1.js} +3 -3
- package/dist/cli/{index-d39q5r1s.js → index-gmkjwk07.js} +1 -1
- package/dist/cli/{index-9b1vtdpm.js → index-k7m0q2nz.js} +2 -2
- package/dist/cli/{index-ryw98ynn.js → index-qdk110fr.js} +4 -2
- package/dist/cli/{index-897js8x8.js → index-s1d1k64e.js} +37 -37
- package/dist/cli/{index-es88kmrz.js → index-sww6s8r5.js} +1 -1
- package/dist/cli/{index-3zj70fr9.js → index-w8kddryz.js} +1 -1
- package/dist/cli/{index-e1xt3r6c.js → index-yrqf3b44.js} +2 -2
- package/dist/cli/{index-dkzct23a.js → index-ywyxtq1a.js} +1 -1
- package/dist/cli/index.js +13 -13
- package/dist/cli/{knowledge-escalator-6bw0gxkh.js → knowledge-escalator-av6ve14j.js} +3 -3
- package/dist/cli/{knowledge-events-cdwbxkr2.js → knowledge-events-3h7a1edr.js} +1 -1
- package/dist/cli/{knowledge-store-5y46n3as.js → knowledge-store-595cq24n.js} +1 -1
- package/dist/cli/{knowledge-validator-bekm8t70.js → knowledge-validator-cvdj3atv.js} +4 -4
- package/dist/cli/{pending-delegations-gee019ec.js → pending-delegations-ztb67amh.js} +3 -1
- package/dist/cli/{scan-cursor-jqwzvkw9.js → scan-cursor-0sbrsd5q.js} +2 -2
- package/dist/cli/{schema-zgrd42bf.js → schema-8gp25rde.js} +1 -1
- package/dist/cli/{skill-generator-q1jh5agj.js → skill-generator-gdqvy68y.js} +5 -5
- package/dist/cli/{worktree-collision-ownership-y1c7yx14.js → worktree-collision-ownership-rc6pe17g.js} +1 -1
- package/dist/context/role-filter.d.ts +21 -2
- package/dist/hooks/delegation-gate.d.ts +1 -1
- package/dist/index.js +130 -129
- package/dist/tools/dispatch-lanes.d.ts +4 -0
- package/package.json +4 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: test-file-split
|
|
3
3
|
audience: swarm-plugin
|
|
4
|
-
description: Protocol for splitting test files that approach or exceed the FR-006 500-line limit (enforced in CI by scripts/check-test-file-cap.
|
|
4
|
+
description: Protocol for splitting test files that approach or exceed the FR-006 500-line limit (enforced in CI by scripts/check-test-file-cap.ts as a diff-scoped ratchet). Covers describe-block extraction, shared helper management, pure-function extraction, mock isolation verification, and cascading-split detection. Load when a test file approaches or exceeds 500 lines.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Test File Split Protocol (FR-006)
|
|
8
8
|
|
|
9
|
-
`scripts/check-test-file-cap.
|
|
9
|
+
`scripts/check-test-file-cap.ts` enforces the **500-line cap** per test file (FR-006 / SC-006.1) as a **diff-scoped ratchet**: new test files over 500 lines and existing over-cap files that grew fail the quality gate and block PR merge. Pre-existing over-cap files not touched by the PR are non-blocking. Escape hatch: `TEST_CAP_ENFORCE=0` soft-warns. This skill covers the complete splitting protocol.
|
|
10
10
|
|
|
11
11
|
Read first: `.opencode/skills/writing-tests/SKILL.md` (or `.claude/skills/writing-tests/SKILL.md`) for bun:test framework rules, mock isolation patterns, and file placement conventions.
|
|
12
12
|
|
|
@@ -615,7 +615,21 @@ authority checks:
|
|
|
615
615
|
|
|
616
616
|
## FR-006: Test File Size Limit (500 lines)
|
|
617
617
|
|
|
618
|
-
`scripts/check-test-file-cap.
|
|
618
|
+
`scripts/check-test-file-cap.ts` enforces the **500-line cap** per test file (FR-006) as a **diff-scoped ratchet**: new test files over 500 lines and existing over-cap files that grew fail the quality gate and block PR merge. Pre-existing over-cap files not touched by the PR are non-blocking. Escape hatch: `TEST_CAP_ENFORCE=0` soft-warns (use only for a deliberate growth PR).
|
|
619
|
+
|
|
620
|
+
### Local validation (all platforms, including Windows)
|
|
621
|
+
|
|
622
|
+
Run the **identical** gate CI runs — no Bash required (issue #2078):
|
|
623
|
+
|
|
624
|
+
```
|
|
625
|
+
bun run check:test-file-cap
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
- Works in Windows PowerShell, macOS, and Linux; `scripts/check-test-file-cap.sh` is a zero-logic shim that `exec`s the same TypeScript file, so the two entry points cannot report different results.
|
|
629
|
+
- The gate is **diff-scoped**: it compares your branch against the first of `origin/main`, `origin/master`, `main`, `master` that resolves. Run `git fetch origin main` first — a stale or missing base makes the comparison stale, and with **no** base branch resolvable the gate has nothing to compare and reports zero violations (a vacuous pass, not a real one). A branch that is *behind* its base is the other stale-base trap: the diff then contains the base's own commits in reverse, so counts are meaningless until you rebase.
|
|
630
|
+
- Directory-independent: the gate resolves the repository root itself, so running it from a subdirectory gives the same result as running it from the root.
|
|
631
|
+
- Exit `1` means a violation and enforcement is on; exit `0` with printed `ERROR` lines means you set `TEST_CAP_ENFORCE=0` (soft-warn). Verify the summary counters, not just the exit code.
|
|
632
|
+
- The gate reads files **from the working tree** but takes the changed-file list from `<base>..HEAD`, so a new over-cap test file that is not yet committed is invisible to it. Commit before trusting a green run.
|
|
619
633
|
|
|
620
634
|
For the full splitting protocol (describe-block extraction, shared helper management, pure-function extraction, mock isolation verification, cascading-split detection), read `file:.swarm/bundled-skills/test-file-split/SKILL.md`.
|
|
621
635
|
|
|
@@ -251,9 +251,29 @@ export interface RecordPendingInput {
|
|
|
251
251
|
/**
|
|
252
252
|
* Record a `pending` background delegation. Runs the stale sweep first (lazy maintenance,
|
|
253
253
|
* no plugin-init cost), then appends the pending snapshot — all under one lock acquisition
|
|
254
|
-
* so concurrent dispatches cannot interleave.
|
|
255
|
-
*
|
|
256
|
-
*
|
|
254
|
+
* so concurrent dispatches cannot interleave. The discriminated outcome lets async
|
|
255
|
+
* launchers distinguish a safe duplicate from a write failure without disrupting
|
|
256
|
+
* the already-owned session.
|
|
257
|
+
*/
|
|
258
|
+
export type RecordPendingDelegationOutcome = {
|
|
259
|
+
status: 'recorded';
|
|
260
|
+
record: BackgroundDelegationRecord;
|
|
261
|
+
} | {
|
|
262
|
+
status: 'duplicate';
|
|
263
|
+
record: BackgroundDelegationRecord;
|
|
264
|
+
} | {
|
|
265
|
+
status: 'conflict';
|
|
266
|
+
record: BackgroundDelegationRecord;
|
|
267
|
+
} | {
|
|
268
|
+
status: 'failed';
|
|
269
|
+
record: null;
|
|
270
|
+
};
|
|
271
|
+
export declare function recordPendingDelegationDetailed(directory: string, input: RecordPendingInput, options?: {
|
|
272
|
+
staleTimeoutMs?: number;
|
|
273
|
+
}): Promise<RecordPendingDelegationOutcome>;
|
|
274
|
+
/**
|
|
275
|
+
* Idempotent compatibility wrapper. A duplicate returns the authoritative
|
|
276
|
+
* existing record so native Task replay does not create a fallback owner.
|
|
257
277
|
*/
|
|
258
278
|
export declare function recordPendingDelegation(directory: string, input: RecordPendingInput, options?: {
|
|
259
279
|
staleTimeoutMs?: number;
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
shouldRunOnStartup,
|
|
13
13
|
writeBackupArtifact,
|
|
14
14
|
writeDoctorArtifact
|
|
15
|
-
} from "./index-
|
|
16
|
-
import"./index-
|
|
15
|
+
} from "./index-ywyxtq1a.js";
|
|
16
|
+
import"./index-qdk110fr.js";
|
|
17
17
|
import"./index-bk5tah7q.js";
|
|
18
18
|
import"./index-3jcyn8g6.js";
|
|
19
19
|
import"./index-bpmtbmy9.js";
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
authorizeCuration,
|
|
5
5
|
buildConfigFingerprintInput,
|
|
6
6
|
readCohortConfigFingerprint
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-gmkjwk07.js";
|
|
8
8
|
import"./index-rtry5xyf.js";
|
|
9
|
-
import"./index-
|
|
9
|
+
import"./index-891ym5hz.js";
|
|
10
10
|
import"./index-ae75rja9.js";
|
|
11
11
|
import"./index-en4fb04r.js";
|
|
12
12
|
import"./index-tqshdzaw.js";
|
|
@@ -14,36 +14,36 @@ import {
|
|
|
14
14
|
runCuratorInit,
|
|
15
15
|
runCuratorPhase,
|
|
16
16
|
writeCuratorSummary
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-s1d1k64e.js";
|
|
18
18
|
import"./index-vm4xw9z3.js";
|
|
19
19
|
import"./index-rrxcfxrd.js";
|
|
20
|
-
import"./index-
|
|
21
|
-
import"./index-
|
|
20
|
+
import"./index-sww6s8r5.js";
|
|
21
|
+
import"./index-ywyxtq1a.js";
|
|
22
22
|
import"./index-fmh15wxb.js";
|
|
23
23
|
import"./index-ngqxzkqm.js";
|
|
24
24
|
import"./index-y8552snf.js";
|
|
25
25
|
import"./index-4905hd2m.js";
|
|
26
26
|
import"./index-134d35c1.js";
|
|
27
|
-
import"./index-
|
|
28
|
-
import"./index-
|
|
29
|
-
import"./index-
|
|
27
|
+
import"./index-g691qtx1.js";
|
|
28
|
+
import"./index-cyew7vak.js";
|
|
29
|
+
import"./index-a2xw89st.js";
|
|
30
30
|
import"./index-6mjf4vr1.js";
|
|
31
31
|
import"./index-c8s9a3zh.js";
|
|
32
32
|
import"./index-9ss2m4rs.js";
|
|
33
33
|
import"./index-wsdnttf4.js";
|
|
34
34
|
import"./index-39k6y018.js";
|
|
35
|
-
import"./index-
|
|
36
|
-
import"./index-
|
|
35
|
+
import"./index-k7m0q2nz.js";
|
|
36
|
+
import"./index-gmkjwk07.js";
|
|
37
37
|
import"./index-rtry5xyf.js";
|
|
38
|
-
import"./index-
|
|
39
|
-
import"./index-
|
|
38
|
+
import"./index-5ykb4nfj.js";
|
|
39
|
+
import"./index-891ym5hz.js";
|
|
40
40
|
import"./index-ae75rja9.js";
|
|
41
41
|
import"./index-en4fb04r.js";
|
|
42
42
|
import"./index-tqshdzaw.js";
|
|
43
|
-
import"./index-
|
|
43
|
+
import"./index-ahkb1nty.js";
|
|
44
44
|
import"./index-k5jrywpr.js";
|
|
45
45
|
import"./index-n832052r.js";
|
|
46
|
-
import"./index-
|
|
46
|
+
import"./index-qdk110fr.js";
|
|
47
47
|
import"./index-bk5tah7q.js";
|
|
48
48
|
import"./index-8fwhhayc.js";
|
|
49
49
|
import"./index-q1exe2b3.js";
|
|
@@ -56,7 +56,7 @@ import"./index-b8zgtz81.js";
|
|
|
56
56
|
import"./index-j0xx9wpj.js";
|
|
57
57
|
import"./index-4rhhvd1a.js";
|
|
58
58
|
import"./index-3jcyn8g6.js";
|
|
59
|
-
import"./index-
|
|
59
|
+
import"./index-0s4gr6qh.js";
|
|
60
60
|
import"./index-4qzeef9h.js";
|
|
61
61
|
import"./index-fsrp8wp3.js";
|
|
62
62
|
import"./index-xybtaph7.js";
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
createCuratorLLMDelegate
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-s1d1k64e.js";
|
|
5
5
|
import"./index-vm4xw9z3.js";
|
|
6
6
|
import"./index-rrxcfxrd.js";
|
|
7
|
-
import"./index-
|
|
8
|
-
import"./index-
|
|
7
|
+
import"./index-sww6s8r5.js";
|
|
8
|
+
import"./index-ywyxtq1a.js";
|
|
9
9
|
import"./index-fmh15wxb.js";
|
|
10
10
|
import"./index-ngqxzkqm.js";
|
|
11
11
|
import"./index-y8552snf.js";
|
|
12
12
|
import"./index-4905hd2m.js";
|
|
13
13
|
import"./index-134d35c1.js";
|
|
14
|
-
import"./index-
|
|
15
|
-
import"./index-
|
|
16
|
-
import"./index-
|
|
14
|
+
import"./index-g691qtx1.js";
|
|
15
|
+
import"./index-cyew7vak.js";
|
|
16
|
+
import"./index-a2xw89st.js";
|
|
17
17
|
import"./index-6mjf4vr1.js";
|
|
18
18
|
import"./index-c8s9a3zh.js";
|
|
19
19
|
import"./index-9ss2m4rs.js";
|
|
20
20
|
import"./index-wsdnttf4.js";
|
|
21
21
|
import"./index-39k6y018.js";
|
|
22
|
-
import"./index-
|
|
23
|
-
import"./index-
|
|
22
|
+
import"./index-k7m0q2nz.js";
|
|
23
|
+
import"./index-gmkjwk07.js";
|
|
24
24
|
import"./index-rtry5xyf.js";
|
|
25
|
-
import"./index-
|
|
26
|
-
import"./index-
|
|
25
|
+
import"./index-5ykb4nfj.js";
|
|
26
|
+
import"./index-891ym5hz.js";
|
|
27
27
|
import"./index-ae75rja9.js";
|
|
28
28
|
import"./index-en4fb04r.js";
|
|
29
29
|
import"./index-tqshdzaw.js";
|
|
30
|
-
import"./index-
|
|
30
|
+
import"./index-ahkb1nty.js";
|
|
31
31
|
import"./index-k5jrywpr.js";
|
|
32
32
|
import"./index-n832052r.js";
|
|
33
|
-
import"./index-
|
|
33
|
+
import"./index-qdk110fr.js";
|
|
34
34
|
import"./index-bk5tah7q.js";
|
|
35
35
|
import"./index-8fwhhayc.js";
|
|
36
36
|
import"./index-q1exe2b3.js";
|
|
@@ -43,7 +43,7 @@ import"./index-b8zgtz81.js";
|
|
|
43
43
|
import"./index-j0xx9wpj.js";
|
|
44
44
|
import"./index-4rhhvd1a.js";
|
|
45
45
|
import"./index-3jcyn8g6.js";
|
|
46
|
-
import"./index-
|
|
46
|
+
import"./index-0s4gr6qh.js";
|
|
47
47
|
import"./index-4qzeef9h.js";
|
|
48
48
|
import"./index-fsrp8wp3.js";
|
|
49
49
|
import"./index-xybtaph7.js";
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-yrqf3b44.js";
|
|
5
|
+
import"./index-s1d1k64e.js";
|
|
6
6
|
import"./index-vm4xw9z3.js";
|
|
7
7
|
import"./index-rrxcfxrd.js";
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
8
|
+
import"./index-sww6s8r5.js";
|
|
9
|
+
import"./index-ywyxtq1a.js";
|
|
10
10
|
import"./index-fmh15wxb.js";
|
|
11
11
|
import"./index-ngqxzkqm.js";
|
|
12
12
|
import"./index-y8552snf.js";
|
|
13
13
|
import"./index-4905hd2m.js";
|
|
14
14
|
import"./index-134d35c1.js";
|
|
15
|
-
import"./index-
|
|
16
|
-
import"./index-
|
|
17
|
-
import"./index-
|
|
15
|
+
import"./index-g691qtx1.js";
|
|
16
|
+
import"./index-cyew7vak.js";
|
|
17
|
+
import"./index-a2xw89st.js";
|
|
18
18
|
import"./index-6mjf4vr1.js";
|
|
19
19
|
import"./index-c8s9a3zh.js";
|
|
20
20
|
import"./index-9ss2m4rs.js";
|
|
21
21
|
import"./index-wsdnttf4.js";
|
|
22
22
|
import"./index-39k6y018.js";
|
|
23
|
-
import"./index-
|
|
24
|
-
import"./index-
|
|
23
|
+
import"./index-k7m0q2nz.js";
|
|
24
|
+
import"./index-gmkjwk07.js";
|
|
25
25
|
import"./index-rtry5xyf.js";
|
|
26
|
-
import"./index-
|
|
27
|
-
import"./index-
|
|
26
|
+
import"./index-5ykb4nfj.js";
|
|
27
|
+
import"./index-891ym5hz.js";
|
|
28
28
|
import"./index-ae75rja9.js";
|
|
29
29
|
import"./index-en4fb04r.js";
|
|
30
30
|
import"./index-tqshdzaw.js";
|
|
31
|
-
import"./index-
|
|
31
|
+
import"./index-ahkb1nty.js";
|
|
32
32
|
import"./index-k5jrywpr.js";
|
|
33
33
|
import"./index-n832052r.js";
|
|
34
|
-
import"./index-
|
|
34
|
+
import"./index-qdk110fr.js";
|
|
35
35
|
import"./index-bk5tah7q.js";
|
|
36
36
|
import"./index-8fwhhayc.js";
|
|
37
37
|
import"./index-q1exe2b3.js";
|
|
@@ -44,7 +44,7 @@ import"./index-b8zgtz81.js";
|
|
|
44
44
|
import"./index-j0xx9wpj.js";
|
|
45
45
|
import"./index-4rhhvd1a.js";
|
|
46
46
|
import"./index-3jcyn8g6.js";
|
|
47
|
-
import"./index-
|
|
47
|
+
import"./index-0s4gr6qh.js";
|
|
48
48
|
import"./index-4qzeef9h.js";
|
|
49
49
|
import"./index-fsrp8wp3.js";
|
|
50
50
|
import"./index-xybtaph7.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailLog
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-
|
|
4
|
+
} from "./index-w8kddryz.js";
|
|
5
|
+
import"./index-sww6s8r5.js";
|
|
6
|
+
import"./index-qdk110fr.js";
|
|
7
7
|
import"./index-bk5tah7q.js";
|
|
8
8
|
import"./index-3jcyn8g6.js";
|
|
9
9
|
import"./index-bpmtbmy9.js";
|
|
@@ -7,38 +7,38 @@ import {
|
|
|
7
7
|
isHiveEligible,
|
|
8
8
|
promoteFromSwarm,
|
|
9
9
|
promoteToHive
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-s1d1k64e.js";
|
|
11
11
|
import"./index-vm4xw9z3.js";
|
|
12
12
|
import"./index-rrxcfxrd.js";
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
13
|
+
import"./index-sww6s8r5.js";
|
|
14
|
+
import"./index-ywyxtq1a.js";
|
|
15
15
|
import"./index-fmh15wxb.js";
|
|
16
16
|
import"./index-ngqxzkqm.js";
|
|
17
17
|
import"./index-y8552snf.js";
|
|
18
18
|
import"./index-4905hd2m.js";
|
|
19
19
|
import"./index-134d35c1.js";
|
|
20
|
-
import"./index-
|
|
21
|
-
import"./index-
|
|
22
|
-
import"./index-
|
|
20
|
+
import"./index-g691qtx1.js";
|
|
21
|
+
import"./index-cyew7vak.js";
|
|
22
|
+
import"./index-a2xw89st.js";
|
|
23
23
|
import"./index-6mjf4vr1.js";
|
|
24
24
|
import"./index-c8s9a3zh.js";
|
|
25
25
|
import"./index-9ss2m4rs.js";
|
|
26
26
|
import"./index-wsdnttf4.js";
|
|
27
27
|
import"./index-39k6y018.js";
|
|
28
|
-
import"./index-
|
|
29
|
-
import"./index-
|
|
28
|
+
import"./index-k7m0q2nz.js";
|
|
29
|
+
import"./index-gmkjwk07.js";
|
|
30
30
|
import"./index-rtry5xyf.js";
|
|
31
31
|
import {
|
|
32
32
|
resolveHiveKnowledgePath
|
|
33
|
-
} from "./index-
|
|
34
|
-
import"./index-
|
|
33
|
+
} from "./index-5ykb4nfj.js";
|
|
34
|
+
import"./index-891ym5hz.js";
|
|
35
35
|
import"./index-ae75rja9.js";
|
|
36
36
|
import"./index-en4fb04r.js";
|
|
37
37
|
import"./index-tqshdzaw.js";
|
|
38
|
-
import"./index-
|
|
38
|
+
import"./index-ahkb1nty.js";
|
|
39
39
|
import"./index-k5jrywpr.js";
|
|
40
40
|
import"./index-n832052r.js";
|
|
41
|
-
import"./index-
|
|
41
|
+
import"./index-qdk110fr.js";
|
|
42
42
|
import"./index-bk5tah7q.js";
|
|
43
43
|
import"./index-8fwhhayc.js";
|
|
44
44
|
import"./index-q1exe2b3.js";
|
|
@@ -51,7 +51,7 @@ import"./index-b8zgtz81.js";
|
|
|
51
51
|
import"./index-j0xx9wpj.js";
|
|
52
52
|
import"./index-4rhhvd1a.js";
|
|
53
53
|
import"./index-3jcyn8g6.js";
|
|
54
|
-
import"./index-
|
|
54
|
+
import"./index-0s4gr6qh.js";
|
|
55
55
|
import"./index-4qzeef9h.js";
|
|
56
56
|
import"./index-fsrp8wp3.js";
|
|
57
57
|
import"./index-xybtaph7.js";
|
|
@@ -22,6 +22,7 @@ init_zod();
|
|
|
22
22
|
import { createHash } from "crypto";
|
|
23
23
|
import * as fs from "fs";
|
|
24
24
|
import * as path from "path";
|
|
25
|
+
import { isDeepStrictEqual } from "util";
|
|
25
26
|
init_logger();
|
|
26
27
|
var BACKGROUND_DELEGATIONS_FILE = "background-delegations.jsonl";
|
|
27
28
|
var BACKGROUND_DELEGATION_FALLBACK_DIR = "background-delegation-fallback";
|
|
@@ -30,6 +31,7 @@ var MAX_LIVE_BACKGROUND_FALLBACKS = 256;
|
|
|
30
31
|
var MAX_LIVE_BACKGROUND_CODER_RESERVATIONS = 256;
|
|
31
32
|
var MAX_BACKGROUND_OBSERVED_FILES = 5000;
|
|
32
33
|
var MAX_BACKGROUND_ADVISORY_CHARS = 4000;
|
|
34
|
+
var MAX_BACKGROUND_DELEGATION_GENERATION = 1e6;
|
|
33
35
|
var MAX_RECOVERY_LEDGER_BYTES = 4 * 1024 * 1024;
|
|
34
36
|
var MAX_RECOVERY_FALLBACK_BYTES = 1024 * 1024;
|
|
35
37
|
var STORE_LOCK_AGENT = "background";
|
|
@@ -260,7 +262,7 @@ var RecordSchema = exports_external.object({
|
|
|
260
262
|
worktree: WorktreeDescriptorSchema.optional(),
|
|
261
263
|
coderReservationId: exports_external.string().min(1).max(256).optional(),
|
|
262
264
|
prompt: PromptSchema.optional(),
|
|
263
|
-
generation: exports_external.number().optional(),
|
|
265
|
+
generation: exports_external.number().int().positive().max(MAX_BACKGROUND_DELEGATION_GENERATION).optional(),
|
|
264
266
|
terminalResult: TerminalResultSchema.optional(),
|
|
265
267
|
coderSettlement: CoderSettlementSchema.optional(),
|
|
266
268
|
advisoryInbox: AdvisoryInboxSchema.optional(),
|
|
@@ -422,27 +424,72 @@ function buildPendingRecord(input, now) {
|
|
|
422
424
|
...input.generation !== undefined ? { generation: input.generation } : {}
|
|
423
425
|
};
|
|
424
426
|
}
|
|
425
|
-
|
|
427
|
+
function pendingLaunchIdentity(record) {
|
|
428
|
+
return {
|
|
429
|
+
correlationId: record.correlationId,
|
|
430
|
+
jobId: record.jobId,
|
|
431
|
+
subagentSessionId: record.subagentSessionId,
|
|
432
|
+
parentSessionId: record.parentSessionId,
|
|
433
|
+
callID: record.callID,
|
|
434
|
+
normalizedAgent: record.normalizedAgent,
|
|
435
|
+
swarmPrefixedAgent: record.swarmPrefixedAgent,
|
|
436
|
+
planTaskId: record.planTaskId,
|
|
437
|
+
evidenceTaskId: record.evidenceTaskId,
|
|
438
|
+
batchId: record.batchId,
|
|
439
|
+
laneId: record.laneId,
|
|
440
|
+
mode: record.mode,
|
|
441
|
+
workflowLane: record.workflowLane,
|
|
442
|
+
ownedWorkflowLanes: record.ownedWorkflowLanes,
|
|
443
|
+
promptHash: record.promptHash,
|
|
444
|
+
workspace: record.workspace,
|
|
445
|
+
taskChangeContext: record.taskChangeContext,
|
|
446
|
+
worktree: record.worktree,
|
|
447
|
+
coderReservationId: record.coderReservationId,
|
|
448
|
+
prompt: record.prompt,
|
|
449
|
+
generation: record.generation ?? 1
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
function samePendingLaunchIdentity(left, right) {
|
|
453
|
+
return isDeepStrictEqual(pendingLaunchIdentity(left), pendingLaunchIdentity(right));
|
|
454
|
+
}
|
|
455
|
+
async function recordPendingDelegationDetailed(directory, input, options = {}) {
|
|
426
456
|
const now = Date.now();
|
|
427
457
|
const record = buildPendingRecord(input, now);
|
|
428
458
|
const parsedRecord = RecordSchema.safeParse(record);
|
|
429
459
|
if (!parsedRecord.success) {
|
|
430
460
|
warn("[background] recordPendingDelegation rejected invalid input");
|
|
431
|
-
return null;
|
|
461
|
+
return { status: "failed", record: null };
|
|
432
462
|
}
|
|
433
463
|
try {
|
|
464
|
+
let outcome = {
|
|
465
|
+
status: "failed",
|
|
466
|
+
record: null
|
|
467
|
+
};
|
|
434
468
|
await withEvidenceLock(directory, BACKGROUND_DELEGATIONS_FILE, STORE_LOCK_AGENT, STORE_LOCK_TASK, async () => {
|
|
435
469
|
if (options.staleTimeoutMs && options.staleTimeoutMs > 0) {
|
|
436
470
|
sweepStaleLocked(directory, options.staleTimeoutMs, now);
|
|
437
471
|
}
|
|
472
|
+
const existing = findByCorrelationId(directory, parsedRecord.data.correlationId);
|
|
473
|
+
if (existing) {
|
|
474
|
+
outcome = {
|
|
475
|
+
status: samePendingLaunchIdentity(existing, parsedRecord.data) ? "duplicate" : "conflict",
|
|
476
|
+
record: existing
|
|
477
|
+
};
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
438
480
|
appendRecord(directory, parsedRecord.data);
|
|
481
|
+
outcome = { status: "recorded", record: parsedRecord.data };
|
|
439
482
|
});
|
|
440
|
-
return
|
|
483
|
+
return outcome;
|
|
441
484
|
} catch (err) {
|
|
442
485
|
warn(`[background] recordPendingDelegation failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
443
|
-
return null;
|
|
486
|
+
return { status: "failed", record: null };
|
|
444
487
|
}
|
|
445
488
|
}
|
|
489
|
+
async function recordPendingDelegation(directory, input, options = {}) {
|
|
490
|
+
const outcome = await recordPendingDelegationDetailed(directory, input, options);
|
|
491
|
+
return outcome.status === "recorded" || outcome.status === "duplicate" ? outcome.record : null;
|
|
492
|
+
}
|
|
446
493
|
function buildPromptSnapshot(text, maxChars) {
|
|
447
494
|
const boundedMax = Math.max(0, Math.min(maxChars, 20000));
|
|
448
495
|
const truncated = text.length > boundedMax;
|
|
@@ -1622,4 +1669,4 @@ async function releaseBackgroundCoderReservation(directory, input) {
|
|
|
1622
1669
|
}
|
|
1623
1670
|
}
|
|
1624
1671
|
|
|
1625
|
-
export { BACKGROUND_DELEGATIONS_FILE, BACKGROUND_DELEGATION_FALLBACK_DIR, BACKGROUND_CODER_RESERVATIONS_FILE, MAX_LIVE_BACKGROUND_FALLBACKS, MAX_LIVE_BACKGROUND_CODER_RESERVATIONS, MAX_BACKGROUND_OBSERVED_FILES, MAX_BACKGROUND_ADVISORY_CHARS, BACKGROUND_INGESTION_LEASE_MS, readDelegations, scanDelegationsForRecovery, findByCorrelationId, recordPendingDelegation, buildPromptSnapshot, appendDelegationTransition, buildBackgroundCompletionEventId, claimTerminalResult, claimCoderSettlement, normalizeBackgroundObservedFiles, updateCoderSettlement, claimDelegationIngestion, recordDelegationIngestionResult, putPendingBackgroundAdvisory, preparePendingBackgroundAdvisories, acknowledgeObservedBackgroundAdvisories, releasePreparedBackgroundAdvisories, findByBatchId, findOpenAsyncLaneBatches, sweepStaleDelegations, readDelegationFallback, listDelegationFallbacks, scanDelegationFallbacksForRecovery, writeDelegationFallback, removeDelegationFallback, findDelegationForCompletion, promoteDelegationFallback, buildBackgroundCoderReservationId, scanBackgroundCoderReservationsForAdmission, reserveBackgroundCoderSlot, bindBackgroundCoderReservation, releaseBackgroundCoderReservation };
|
|
1672
|
+
export { BACKGROUND_DELEGATIONS_FILE, BACKGROUND_DELEGATION_FALLBACK_DIR, BACKGROUND_CODER_RESERVATIONS_FILE, MAX_LIVE_BACKGROUND_FALLBACKS, MAX_LIVE_BACKGROUND_CODER_RESERVATIONS, MAX_BACKGROUND_OBSERVED_FILES, MAX_BACKGROUND_ADVISORY_CHARS, BACKGROUND_INGESTION_LEASE_MS, readDelegations, scanDelegationsForRecovery, findByCorrelationId, recordPendingDelegationDetailed, recordPendingDelegation, buildPromptSnapshot, appendDelegationTransition, buildBackgroundCompletionEventId, claimTerminalResult, claimCoderSettlement, normalizeBackgroundObservedFiles, updateCoderSettlement, claimDelegationIngestion, recordDelegationIngestionResult, putPendingBackgroundAdvisory, preparePendingBackgroundAdvisories, acknowledgeObservedBackgroundAdvisories, releasePreparedBackgroundAdvisories, findByBatchId, findOpenAsyncLaneBatches, sweepStaleDelegations, readDelegationFallback, listDelegationFallbacks, scanDelegationFallbacksForRecovery, writeDelegationFallback, removeDelegationFallback, findDelegationForCompletion, promoteDelegationFallback, buildBackgroundCoderReservationId, scanBackgroundCoderReservationsForAdmission, reserveBackgroundCoderSlot, bindBackgroundCoderReservation, releaseBackgroundCoderReservation };
|
|
@@ -702,7 +702,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
702
702
|
const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
|
|
703
703
|
if (atFloor.length === 0 && recovered.length === 0)
|
|
704
704
|
return;
|
|
705
|
-
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-
|
|
705
|
+
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-3h7a1edr.js");
|
|
706
706
|
const rollups = await readKnowledgeCounterRollups(directory);
|
|
707
707
|
const flagIds = new Set;
|
|
708
708
|
for (const e of atFloor) {
|
|
@@ -769,11 +769,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
if (action === "quarantine" && toQuarantine.length > 0) {
|
|
772
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
773
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
772
|
+
const { quarantineEntry } = await import("./knowledge-validator-cvdj3atv.js");
|
|
773
|
+
const { KnowledgeConfigSchema } = await import("./schema-8gp25rde.js");
|
|
774
774
|
let config;
|
|
775
775
|
try {
|
|
776
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
776
|
+
const { loadPluginConfigWithMeta } = await import("./index-akka5gyb.js");
|
|
777
777
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
778
778
|
config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
779
779
|
} catch {
|
|
@@ -625,7 +625,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
|
|
|
625
625
|
deltas.push({ id, delta });
|
|
626
626
|
}
|
|
627
627
|
if (deltas.length > 0) {
|
|
628
|
-
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-
|
|
628
|
+
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-595cq24n.js");
|
|
629
629
|
await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
|
|
630
630
|
}
|
|
631
631
|
return {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
loadPluginConfigWithMeta,
|
|
8
8
|
loadPluginConfigWithMetaAsync,
|
|
9
9
|
resolveWorktreeIsolationConfig
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-ahkb1nty.js";
|
|
11
11
|
import {
|
|
12
12
|
ApprovalEvidenceSchema,
|
|
13
13
|
BaseEvidenceSchema,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
TurboConfigSchema,
|
|
55
55
|
WorktreeIsolationConfigSchema,
|
|
56
56
|
resolveAutoReviewConfig
|
|
57
|
-
} from "./index-
|
|
57
|
+
} from "./index-qdk110fr.js";
|
|
58
58
|
import"./index-bk5tah7q.js";
|
|
59
59
|
import {
|
|
60
60
|
MigrationStatusSchema,
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
resolveSwarmKnowledgePath,
|
|
7
7
|
transactKnowledge,
|
|
8
8
|
wordBigrams
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-5ykb4nfj.js";
|
|
10
10
|
import {
|
|
11
11
|
countEntryContradictionsInWindow,
|
|
12
12
|
countEntryViolationsInWindow,
|
|
13
13
|
readKnowledgeEvents,
|
|
14
14
|
recordKnowledgeEvent
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-891ym5hz.js";
|
|
16
16
|
import {
|
|
17
17
|
init_knowledge_types,
|
|
18
18
|
isActiveStatus
|
|
@@ -190,11 +190,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
|
|
|
190
190
|
alreadyInactive: true
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
193
|
+
const { quarantineEntry } = await import("./knowledge-validator-cvdj3atv.js");
|
|
194
194
|
let policyConfig;
|
|
195
195
|
try {
|
|
196
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
197
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
196
|
+
const { KnowledgeConfigSchema } = await import("./schema-8gp25rde.js");
|
|
197
|
+
const { loadPluginConfigWithMeta } = await import("./index-akka5gyb.js");
|
|
198
198
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
199
199
|
policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
200
200
|
} catch {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-yrqf3b44.js";
|
|
5
5
|
import {
|
|
6
6
|
handleGuardrailLog
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-w8kddryz.js";
|
|
8
8
|
import {
|
|
9
9
|
COMMAND_REGISTRY,
|
|
10
10
|
SWARM_COMMAND_TOOL_ALLOWLIST,
|
|
@@ -84,39 +84,39 @@ import {
|
|
|
84
84
|
handleWriteRetroCommand,
|
|
85
85
|
normalizeSwarmCommandInput,
|
|
86
86
|
resolveCommand
|
|
87
|
-
} from "./index-
|
|
87
|
+
} from "./index-s1d1k64e.js";
|
|
88
88
|
import"./index-vm4xw9z3.js";
|
|
89
89
|
import"./index-rrxcfxrd.js";
|
|
90
|
-
import"./index-
|
|
91
|
-
import"./index-
|
|
90
|
+
import"./index-sww6s8r5.js";
|
|
91
|
+
import"./index-ywyxtq1a.js";
|
|
92
92
|
import"./index-fmh15wxb.js";
|
|
93
93
|
import"./index-ngqxzkqm.js";
|
|
94
94
|
import"./index-y8552snf.js";
|
|
95
95
|
import"./index-4905hd2m.js";
|
|
96
96
|
import"./index-134d35c1.js";
|
|
97
|
-
import"./index-
|
|
98
|
-
import"./index-
|
|
99
|
-
import"./index-
|
|
97
|
+
import"./index-g691qtx1.js";
|
|
98
|
+
import"./index-cyew7vak.js";
|
|
99
|
+
import"./index-a2xw89st.js";
|
|
100
100
|
import"./index-6mjf4vr1.js";
|
|
101
101
|
import"./index-c8s9a3zh.js";
|
|
102
102
|
import"./index-9ss2m4rs.js";
|
|
103
103
|
import"./index-wsdnttf4.js";
|
|
104
104
|
import"./index-39k6y018.js";
|
|
105
|
-
import"./index-
|
|
106
|
-
import"./index-
|
|
105
|
+
import"./index-k7m0q2nz.js";
|
|
106
|
+
import"./index-gmkjwk07.js";
|
|
107
107
|
import"./index-rtry5xyf.js";
|
|
108
|
-
import"./index-
|
|
109
|
-
import"./index-
|
|
108
|
+
import"./index-5ykb4nfj.js";
|
|
109
|
+
import"./index-891ym5hz.js";
|
|
110
110
|
import"./index-ae75rja9.js";
|
|
111
111
|
import"./index-en4fb04r.js";
|
|
112
112
|
import"./index-tqshdzaw.js";
|
|
113
|
-
import"./index-
|
|
113
|
+
import"./index-ahkb1nty.js";
|
|
114
114
|
import"./index-k5jrywpr.js";
|
|
115
115
|
import"./index-n832052r.js";
|
|
116
116
|
import {
|
|
117
117
|
init_schema,
|
|
118
118
|
stripKnownSwarmPrefix
|
|
119
|
-
} from "./index-
|
|
119
|
+
} from "./index-qdk110fr.js";
|
|
120
120
|
import"./index-bk5tah7q.js";
|
|
121
121
|
import"./index-8fwhhayc.js";
|
|
122
122
|
import"./index-q1exe2b3.js";
|
|
@@ -133,7 +133,7 @@ import {
|
|
|
133
133
|
ORCHESTRATOR_NAME,
|
|
134
134
|
init_constants
|
|
135
135
|
} from "./index-3jcyn8g6.js";
|
|
136
|
-
import"./index-
|
|
136
|
+
import"./index-0s4gr6qh.js";
|
|
137
137
|
import"./index-4qzeef9h.js";
|
|
138
138
|
import"./index-fsrp8wp3.js";
|
|
139
139
|
import"./index-xybtaph7.js";
|