opencode-swarm 7.142.1 → 7.143.1

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.
Files changed (74) hide show
  1. package/.opencode/skills/execute/SKILL.md +1 -1
  2. package/.opencode/skills/loop/SKILL.md +4 -2
  3. package/.opencode/skills/phase-wrap/SKILL.md +2 -2
  4. package/dist/cli/ast-diff-ypptrcan.js +422 -0
  5. package/dist/cli/{config-doctor-2a3qmp5p.js → config-doctor-ajq3sts3.js} +4 -4
  6. package/dist/cli/{core-h9z49ant.js → core-0jn7sk7t.js} +4 -4
  7. package/dist/cli/curation-policy-pkb2eeb1.js +1 -1
  8. package/dist/cli/{curator-drift-49p3jnte.js → curator-drift-2jbjv03a.js} +6 -6
  9. package/dist/cli/{curator-mtz194wy.js → curator-ff53rwz5.js} +36 -35
  10. package/dist/cli/{curator-llm-factory-9fr243kj.js → curator-llm-factory-2mz7fgd1.js} +36 -35
  11. package/dist/cli/{dispatch-rd10kdk1.js → dispatch-1y1rnv1h.js} +3 -3
  12. package/dist/cli/{evidence-summary-service-fgckng0a.js → evidence-summary-service-08zcq836.js} +16 -16
  13. package/dist/cli/{gate-evidence-ppna7em4.js → gate-evidence-2r7n4qjv.js} +9 -9
  14. package/dist/cli/{guardrail-explain-ejdvvnjz.js → guardrail-explain-cm5je07b.js} +37 -36
  15. package/dist/cli/{guardrail-log-adjs25ye.js → guardrail-log-jf4430p5.js} +6 -6
  16. package/dist/cli/{hive-promoter-jejme31e.js → hive-promoter-738bf1fj.js} +36 -35
  17. package/dist/cli/{index-2mb5y2w1.js → index-0kqs2fbm.js} +15 -15
  18. package/dist/cli/{index-ktazgjqw.js → index-254xf5y6.js} +2 -2
  19. package/dist/cli/{index-9wmx9ca8.js → index-3fg8kx7n.js} +4 -4
  20. package/dist/cli/{runtime-ykafcwc6.js → index-5n69863d.js} +2 -10
  21. package/dist/cli/{index-rthq1a6w.js → index-7317fvce.js} +5 -5
  22. package/dist/cli/index-7sy3aa9m.js +115 -0
  23. package/dist/cli/{index-7c4bxgdh.js → index-8aabbfhv.js} +5 -5
  24. package/dist/cli/{index-k1xsjzm3.js → index-91dz0zct.js} +10 -10
  25. package/dist/cli/{index-bb4pcn58.js → index-a5rky7fv.js} +2 -2
  26. package/dist/cli/{index-gtkk5rx7.js → index-awzwmx8p.js} +32 -32
  27. package/dist/cli/{index-ebwznsfy.js → index-b6e016tv.js} +1 -1
  28. package/dist/cli/{index-9kf3mj08.js → index-cfwdm1dx.js} +1 -1
  29. package/dist/cli/{index-vy11zjvh.js → index-crt7xw29.js} +5 -5
  30. package/dist/cli/{index-kbshtwha.js → index-cz9tc0h8.js} +5 -5
  31. package/dist/cli/{index-82m5kwtd.js → index-gdd4jt6b.js} +4 -4
  32. package/dist/cli/{index-qwm6vdyv.js → index-k3cxyk66.js} +1 -1
  33. package/dist/cli/{index-we279je2.js → index-mpw32szm.js} +1 -1
  34. package/dist/cli/{index-vefjxxmb.js → index-n2jk8ajv.js} +1 -1
  35. package/dist/cli/{index-bkkxxwcd.js → index-n48cwf1a.js} +7 -7
  36. package/dist/cli/{index-myav90y6.js → index-q68a8h37.js} +6 -6
  37. package/dist/cli/{index-h7ye3bzp.js → index-q7jv0c8e.js} +343 -357
  38. package/dist/cli/{index-ajfa2wmj.js → index-qmfzfh7m.js} +9 -9
  39. package/dist/cli/{index-k46me75h.js → index-rn0eq85g.js} +1 -1
  40. package/dist/cli/{index-j02ez59y.js → index-srd87kxc.js} +8 -8
  41. package/dist/cli/{index-0r4qs243.js → index-wnj1d1es.js} +43 -42
  42. package/dist/cli/{index-xfhe29z3.js → index-x10a9cz6.js} +5 -5
  43. package/dist/cli/{index-sdqtecsd.js → index-zgq25ze6.js} +5 -5
  44. package/dist/cli/{index-xah70t2t.js → index-zky3vt90.js} +4 -4
  45. package/dist/cli/index.js +45 -41
  46. package/dist/cli/{knowledge-escalator-0b80ryka.js → knowledge-escalator-9mdajq4s.js} +15 -15
  47. package/dist/cli/{knowledge-events-8x2wt562.js → knowledge-events-pz58s2r1.js} +13 -13
  48. package/dist/cli/knowledge-link-fn5j3r4q.js +1 -1
  49. package/dist/cli/{knowledge-store-d0xj6wht.js → knowledge-store-sz8vat89.js} +3 -3
  50. package/dist/cli/{knowledge-validator-ewfj679a.js → knowledge-validator-w5vmvf0a.js} +4 -4
  51. package/dist/cli/{pending-delegations-0hb97ps1.js → pending-delegations-b3pt3w5w.js} +5 -5
  52. package/dist/cli/{pr-subscriptions-b63t252j.js → pr-subscriptions-jyav582d.js} +5 -5
  53. package/dist/cli/{runner-hrg7h2h4.js → runner-pde6b5sx.js} +2 -2
  54. package/dist/cli/runtime-te94z1zb.js +23 -0
  55. package/dist/cli/{scan-cursor-hfyz7zpw.js → scan-cursor-p54xsx41.js} +4 -4
  56. package/dist/cli/{schema-ney3c685.js → schema-p74hnrfz.js} +1 -1
  57. package/dist/cli/{scope-persistence-dbfgs7gh.js → scope-persistence-1fc2ncsk.js} +9 -9
  58. package/dist/cli/semantic-classifier-ygqk0me1.js +147 -0
  59. package/dist/cli/{skill-generator-p651jex5.js → skill-generator-yv46bt1a.js} +16 -16
  60. package/dist/cli/{worktree-collision-ownership-ymdxetnn.js → worktree-collision-ownership-bfz3drxm.js} +6 -6
  61. package/dist/cli/{worktree-isolation-513vx61s.js → worktree-isolation-qfgc3vma.js} +38 -37
  62. package/dist/cli/{worktree-provisioning-owner-sjh7te1h.js → worktree-provisioning-owner-g24xd417.js} +4 -4
  63. package/dist/commands/registry.d.ts +1 -1
  64. package/dist/config/constants.d.ts +2 -2
  65. package/dist/hooks/delegation-gate.d.ts +84 -2
  66. package/dist/index.js +393 -380
  67. package/dist/parallel/review-router.d.ts +16 -0
  68. package/dist/parallel/tier3-classifier.d.ts +11 -0
  69. package/dist/utils/patch-dedent.d.ts +33 -0
  70. package/dist/workflow/coder-settlement.d.ts +30 -0
  71. package/dist/workflow/workflow-wal-schema.d.ts +2 -0
  72. package/package.json +1 -1
  73. package/dist/cli/{index-y9h2vqf6.js → index-4q9vfav6.js} +3 -3
  74. package/dist/cli/{index-ee3x66a5.js → index-z6xqpmqg.js} +3 -3
@@ -66,7 +66,7 @@ All other gates: failure → return to coder. No self-fixes. No workarounds.
66
66
  → Subsequent `pre_check_batch` calls with `phase: <N>` will automatically diff against this baseline — only NEW findings (not in baseline) drive the fail verdict.
67
67
  -> PREFLIGHT CHECKLIST: Before first coder delegation, answer "SAST baseline captured before first coder delegation? yes/no/disabled/error". If the answer is no, do not delegate to coder; run 5b-BASE first. If disabled or error, record the exact tool result.
68
68
  5b. the active swarm's coder agent - Implement (if designer scaffold produced, include it as INPUT).
69
- → REQUIRED: The coder Task dispatch MUST contain a literal `ACCEPTANCE:` line — resolve per ACCEPTANCE FIELD RESOLUTION in your system prompt (verbatim FR/SC text when fr_refs is non-empty, otherwise a one-line task-derived DONE restatement). A missing line is BLOCKED by ACCEPTANCE_FIELD_REQUIRED before the coder runs. Do NOT confuse the plan-task `acceptance` field with this per-dispatch header — both are required.
69
+ → REQUIRED: The coder Task dispatch MUST contain a literal `ACCEPTANCE:` line — resolve per ACCEPTANCE FIELD RESOLUTION in your system prompt (list the mapped FR/SC ids when fr_refs is non-empty — the delegation gate injects their verbatim spec.md text automatically — otherwise a one-line task-derived DONE restatement). A missing line is BLOCKED by ACCEPTANCE_FIELD_REQUIRED before the coder runs. Do NOT confuse the plan-task `acceptance` field with this per-dispatch header — both are required.
70
70
  → If this dispatch fails with `PLAN_CRITIC_GATE_VIOLATION`: the plan has no current critic-approved snapshot (commonly a plan approved before this mechanical gate existed). Do NOT retry the coder dispatch as-is — re-run MODE: CRITIC-GATE to get a fresh critic `APPROVED` verdict, then retry this step.
71
71
  5b-bis. **CODER OUTPUT VERIFICATION**: After the coder reports completion, do NOT accept the self-report alone. Run `diff` (step 5c) and inspect at least one of the modified files yourself to confirm the change exists. The coder may report DONE without having produced any diff. A 30-second read of the changed file(s) catches this failure mode. This is NOT a separate explorer dispatch — the existing `diff` tool at step 5c is the verification mechanism; the key discipline is checking that `diff` returns actual changes before proceeding, rather than forwarding the coder's self-report to the next gate.
72
72
  5c. Run `diff` tool. If `hasContractChanges` → the active swarm's explorer agent integration analysis. If COMPATIBILITY SIGNALS=INCOMPATIBLE or MIGRATION_SURFACE=yes → coder retry. If COMPATIBILITY SIGNALS=COMPATIBLE and MIGRATION_SURFACE=no → proceed.
@@ -21,8 +21,10 @@ than merely repeating.
21
21
 
22
22
  This is a real implementation workflow: it delegates to the coder, declares
23
23
  scope, and mutates source code through the normal EXECUTE path. It is distinct
24
- from full-auto (autonomous cross-phase oversight via the `critic_oversight`
25
- agent) and turbo (parallel lanes within a single phase). LOOP is a
24
+ from full-auto (a critic gate via the `critic_oversight` agent that
25
+ intercepts phase completions and high-risk actions for review full-auto
26
+ never plans, delegates, or executes; the architect retains ALL delegation
27
+ duty) and turbo (parallel lanes within a single phase). LOOP is a
26
28
  user-initiated, gated, sequential, compounding workflow.
27
29
 
28
30
  The two design rules that everything below serves:
@@ -135,7 +135,7 @@ There is no project where code ships without review, tests, and required documen
135
135
  If `phase_council` is enabled:
136
136
  1. Build a PHASE DOSSIER from all completed tasks in this phase, their evidence artifacts, changed-file summaries, and any drift/hallucination/mutation evidence.
137
137
  2. Dispatch the full 5-member council (`the active swarm's critic agent`, `the active swarm's reviewer agent`, `the active swarm's sme agent`, `the active swarm's test_engineer agent`, and `the active swarm's explorer agent`) in PARALLEL with phase-scoped context. Each member reviews the entire phase's work holistically and returns a `CouncilMemberVerdict` JSON object.
138
- → REQUIRED: The reviewer council member Task dispatch MUST contain a literal `ACCEPTANCE:` line — resolve per ACCEPTANCE FIELD RESOLUTION in your system prompt (phase-scoped: concatenate the verbatim FR/SC text for every task in this phase when fr_refs is non-empty, otherwise a one-line phase-derived DONE restatement). A missing line is BLOCKED by ACCEPTANCE_FIELD_REQUIRED. The other four members are not gated by this rule.
138
+ → REQUIRED: The reviewer council member Task dispatch MUST contain a literal `ACCEPTANCE:` line — resolve per ACCEPTANCE FIELD RESOLUTION in your system prompt (phase-scoped: concatenate the verbatim FR/SC text for every task in this phase when fr_refs is non-empty — the delegation gate does NOT auto-inject for multi-task phase/council dispatches, so paste the bodies yourself — otherwise a one-line phase-derived DONE restatement). A missing line is BLOCKED by ACCEPTANCE_FIELD_REQUIRED. The other four members are not gated by this rule.
139
139
  3. Collect all 5 verdict objects. Do NOT fabricate or substitute verdicts.
140
140
  4. Act on the verdict: APPROVE → proceed. CONCERNS with `success: false` + `reason: 'blocking_concerns_unresolved'` → HIGH/CRITICAL findings are blocking, no evidence written, must resolve requiredFixes and re-council. CONCERNS with `success: true` → only MEDIUM/LOW advisory findings, phase may proceed per `phaseConcernsAllowComplete` flag. REJECT → surface required fixes to the user before proceeding.
141
141
  5. YOU (the architect) call the `submit_phase_council_verdicts` tool with the phase number and the collected council verdicts to persist the phase-council evidence. The council members do NOT write files — they are read-only. Only the `submit_phase_council_verdicts` tool writes `.swarm/evidence/{phase}/phase-council.json` (with plan binding, member verdicts, and quorum metadata). Do this BEFORE calling `phase_complete`.
@@ -145,7 +145,7 @@ There is no project where code ships without review, tests, and required documen
145
145
  If enabled AND this is the LAST phase in the plan (all other phases have status 'complete' and no more phases remain):
146
146
  1. Build a PROJECT DOSSIER from the completed plan, all phase summaries, changed-file summaries, and all relevant evidence artifacts. This is the full 5-member council (NOT the General Council) running a completed-project review.
147
147
  2. Dispatch the full 5-member council (`the active swarm's critic agent`, `the active swarm's reviewer agent`, `the active swarm's sme agent`, `the active swarm's test_engineer agent`, and `the active swarm's explorer agent`) in PARALLEL with project-scoped context. Each member must review the entire completed body of work and return a `CouncilMemberVerdict` JSON object using `agent`, `verdict` (APPROVE|CONCERNS|REJECT), `confidence`, `findings[]`, `criteriaAssessed[]`, `criteriaUnmet[]`, and `durationMs`.
148
- → REQUIRED: The reviewer council member Task dispatch MUST contain a literal `ACCEPTANCE:` line — resolve per ACCEPTANCE FIELD RESOLUTION in your system prompt (project-scoped: concatenate the verbatim FR/SC text across all phases, otherwise a one-line project-derived DONE restatement). A missing line is BLOCKED by ACCEPTANCE_FIELD_REQUIRED. The other four members are not gated by this rule.
148
+ → REQUIRED: The reviewer council member Task dispatch MUST contain a literal `ACCEPTANCE:` line — resolve per ACCEPTANCE FIELD RESOLUTION in your system prompt (project-scoped: concatenate the verbatim FR/SC text across all phases — the delegation gate does NOT auto-inject for multi-task dispatches, so paste the bodies yourself — otherwise a one-line project-derived DONE restatement). A missing line is BLOCKED by ACCEPTANCE_FIELD_REQUIRED. The other four members are not gated by this rule.
149
149
  3. Collect the five returned verdict objects. Do NOT fabricate, infer, or substitute verdicts. If a member does not return valid JSON, re-dispatch that member.
150
150
  4. Call `write_final_council_evidence` with `phase`, `projectSummary`, `roundNumber`, and the collected `verdicts` array. This writes `.swarm/evidence/final-council.json` with plan binding, member verdicts, and quorum metadata.
151
151
  ⚠️ **GOTCHA**: `write_final_council_evidence` normalizes a CONCERNS verdict based on whether there are required fixes. CONCERNS with `requiredFixes > 0` → the tool writes NO evidence file (early-return `blocking_concerns_unresolved`) and `phase_complete` then blocks on the MISSING `final-council.json`. CONCERNS with zero required fixes → the tool writes a `concerns` verdict which is NON-blocking (advisory warning only). So: you MUST address required fixes from a CONCERNS verdict and re-council, or you will block on a missing evidence file. (Note: the **phase-level** council's `phaseConcernsAllowComplete` flag makes CONCERNS advisory at phase scope; the final council does not have that flag.)
@@ -0,0 +1,422 @@
1
+ // @bun
2
+ import {
3
+ getLanguageForExtension
4
+ } from "./index-7sy3aa9m.js";
5
+ import {
6
+ Query,
7
+ loadGrammar
8
+ } from "./index-5n69863d.js";
9
+ import"./index-4905hd2m.js";
10
+ import {
11
+ init_logger,
12
+ log
13
+ } from "./index-zgwm4ryv.js";
14
+ import"./index-a76rekgs.js";
15
+
16
+ // src/diff/ast-diff.ts
17
+ import { extname } from "path";
18
+ init_logger();
19
+ var QUERIES = {
20
+ javascript: `
21
+ (function_declaration name: (identifier) @func.name) @func.def
22
+ (class_declaration name: (identifier) @class.name) @class.def
23
+ (export_statement) @export
24
+ (import_statement) @import
25
+ (type_alias_declaration name: (type_identifier) @type.name) @type.def
26
+ `,
27
+ typescript: `
28
+ (function_declaration name: (identifier) @func.name) @func.def
29
+ (class_declaration name: (type_identifier) @class.name) @class.def
30
+ (export_statement) @export
31
+ (import_statement) @import
32
+ (type_alias_declaration name: (type_identifier) @type.name) @type.def
33
+ (interface_declaration name: (type_identifier) @interface.name) @interface.def
34
+ `,
35
+ python: `
36
+ (function_definition name: (identifier) @func.name) @func.def
37
+ (class_definition name: (identifier) @class.name) @class.def
38
+ (import_statement) @import
39
+ (expression_statement (assignment left: (identifier) @var.name)) @var.def
40
+ `,
41
+ go: `
42
+ (function_declaration name: (identifier) @func.name) @func.def
43
+ (type_declaration (type_spec name: (type_identifier) @type.name)) @type.def
44
+ (import_declaration) @import
45
+ `,
46
+ rust: `
47
+ (function_item name: (identifier) @func.name) @func.def
48
+ (struct_item name: (type_identifier) @struct.name) @struct.def
49
+ (impl_item type: (type_identifier) @impl.name) @impl.def
50
+ (use_declaration) @import
51
+ `,
52
+ java: `
53
+ (method_declaration name: (identifier) @func.name) @func.def
54
+ (class_declaration name: (identifier) @class.name) @class.def
55
+ (interface_declaration name: (identifier) @interface.name) @interface.def
56
+ (import_declaration) @import
57
+ `,
58
+ c: `
59
+ (function_definition declarator: (function_declarator declarator: (identifier) @func.name)) @func.def
60
+ (struct_specifier name: (type_identifier) @struct.name) @struct.def
61
+ (type_definition declarator: (type_identifier) @type.name) @type.def
62
+ (preproc_include) @import
63
+ `,
64
+ cpp: `
65
+ (function_definition declarator: (function_declarator declarator: (identifier) @func.name)) @func.def
66
+ (class_specifier name: (type_identifier) @class.name) @class.def
67
+ (struct_specifier name: (type_identifier) @struct.name) @struct.def
68
+ (preproc_include) @import
69
+ `,
70
+ csharp: `
71
+ (method_declaration name: (identifier) @func.name) @func.def
72
+ (class_declaration name: (identifier) @class.name) @class.def
73
+ (interface_declaration name: (identifier) @interface.name) @interface.def
74
+ (struct_declaration name: (identifier) @struct.name) @struct.def
75
+ (using_directive) @using
76
+ `,
77
+ ruby: `
78
+ (method name: (identifier) @func.name) @func.def
79
+ (class name: (constant) @class.name) @class.def
80
+ (module name: (constant) @module.name) @module.def
81
+ `,
82
+ php: `
83
+ (function_definition name: (name) @func.name) @func.def
84
+ (class_declaration name: (name) @class.name) @class.def
85
+ (interface_declaration name: (name) @interface.name) @interface.def
86
+ (namespace_use_declaration) @import
87
+ `,
88
+ swift: `
89
+ (function_declaration name: (identifier) @func.name) @func.def
90
+ (class_declaration name: (identifier) @class.name) @class.def
91
+ (struct_declaration name: (identifier) @struct.name) @struct.def
92
+ (protocol_declaration name: (identifier) @protocol.name) @protocol.def
93
+ (import_declaration) @import
94
+ `,
95
+ kotlin: `
96
+ (function_declaration name: (identifier) @func.name) @func.def
97
+ (class_declaration name: (identifier) @class.name) @class.def
98
+ (object_declaration name: (identifier) @object.name) @object.def
99
+ (import_header) @import
100
+ `,
101
+ dart: `
102
+ (function_signature name: (identifier) @func.name) @func.def
103
+ (class_definition name: (identifier) @class.name) @class.def
104
+ (mixin_declaration name: (identifier) @mixin.name) @mixin.def
105
+ (import_directive) @import
106
+ `,
107
+ css: `
108
+ (rule_set (selectors) @rule.selector) @rule.def
109
+ `,
110
+ bash: `
111
+ (function_definition name: (word) @command.name) @command.def
112
+ `,
113
+ powershell: `
114
+ (function_statement (function_name) @func.name) @func.def
115
+ `,
116
+ tsx: `
117
+ (function_declaration name: (identifier) @func.name) @func.def
118
+ (class_declaration name: (identifier) @class.name) @class.def
119
+ (export_statement) @export
120
+ (import_statement) @import
121
+ (type_alias_declaration name: (type_identifier) @type.name) @type.def
122
+ (interface_declaration name: (type_identifier) @interface.name) @interface.def
123
+ `
124
+ };
125
+ var AST_TIMEOUT_MS = 500;
126
+ async function computeASTDiff(filePath, oldContent, newContent) {
127
+ const startTime = Date.now();
128
+ const extension = extname(filePath).toLowerCase();
129
+ const language = getLanguageForExtension(extension);
130
+ if (!language) {
131
+ return {
132
+ filePath,
133
+ language: null,
134
+ changes: [],
135
+ durationMs: Date.now() - startTime,
136
+ usedAST: false
137
+ };
138
+ }
139
+ try {
140
+ let timeoutId;
141
+ const parser = await Promise.race([
142
+ loadGrammar(language.id),
143
+ new Promise((_, reject) => {
144
+ timeoutId = setTimeout(() => reject(new Error("AST_TIMEOUT")), AST_TIMEOUT_MS);
145
+ })
146
+ ]).finally(() => {
147
+ if (timeoutId)
148
+ clearTimeout(timeoutId);
149
+ });
150
+ const oldTree = parser.parse(oldContent);
151
+ const newTree = parser.parse(newContent);
152
+ if (!oldTree || !newTree) {
153
+ return {
154
+ filePath,
155
+ language: language.id,
156
+ changes: [],
157
+ durationMs: Date.now() - startTime,
158
+ usedAST: false,
159
+ error: "Failed to parse file"
160
+ };
161
+ }
162
+ const oldSymbols = extractSymbols(oldTree, language);
163
+ const newSymbols = extractSymbols(newTree, language);
164
+ const changes = compareSymbols(oldSymbols, newSymbols);
165
+ oldTree.delete();
166
+ newTree.delete();
167
+ return {
168
+ filePath,
169
+ language: language.id,
170
+ changes,
171
+ durationMs: Date.now() - startTime,
172
+ usedAST: true
173
+ };
174
+ } catch (error) {
175
+ const errorMsg = error instanceof Error ? error.message : "Unknown error";
176
+ if (errorMsg === "AST_TIMEOUT") {
177
+ log(`[ast-diff] Timeout for ${filePath}, falling back to raw diff`);
178
+ }
179
+ return {
180
+ filePath,
181
+ language: language.id,
182
+ changes: [],
183
+ durationMs: Date.now() - startTime,
184
+ usedAST: false,
185
+ error: errorMsg
186
+ };
187
+ }
188
+ }
189
+ function extractSymbols(tree, language) {
190
+ const symbols = [];
191
+ const queryStr = QUERIES[language.id];
192
+ if (!queryStr) {
193
+ return symbols;
194
+ }
195
+ try {
196
+ const lang = tree.language;
197
+ if (!lang) {
198
+ return symbols;
199
+ }
200
+ const query = new Query(lang, queryStr);
201
+ const matches = query.matches(tree.rootNode);
202
+ for (const match of matches) {
203
+ const symbol = parseMatch(match, language.id);
204
+ if (symbol) {
205
+ symbols.push(symbol);
206
+ }
207
+ }
208
+ const defEntries = symbols.filter((s) => s.category !== "export" && s.category !== "import");
209
+ if (defEntries.length > 0 && defEntries.length < symbols.length) {
210
+ const filtered = symbols.filter((symbol) => {
211
+ if (symbol.category !== "export" && symbol.category !== "import") {
212
+ return true;
213
+ }
214
+ const isDuplicate = defEntries.some((def) => symbol.lineStart === def.lineStart && symbol.lineEnd === def.lineEnd);
215
+ return !isDuplicate;
216
+ });
217
+ symbols.length = 0;
218
+ symbols.push(...filtered);
219
+ }
220
+ } catch {}
221
+ return symbols;
222
+ }
223
+ function parseMatch(match, languageId) {
224
+ const captures = match.captures;
225
+ const defCapture = captures.find((c) => c.name.endsWith(".def"));
226
+ const nameCapture = captures.find((c) => c.name.endsWith(".name"));
227
+ if (!defCapture) {
228
+ const exportCapture = captures.find((c) => c.name === "export");
229
+ const importCapture = captures.find((c) => c.name === "import");
230
+ const categoryCapture = exportCapture || importCapture;
231
+ if (!categoryCapture)
232
+ return null;
233
+ const node2 = categoryCapture.node;
234
+ const text = node2.text.trim();
235
+ const name = extractStatementName(text, categoryCapture.name);
236
+ return {
237
+ category: categoryCapture.name === "export" ? "export" : "import",
238
+ name,
239
+ lineStart: node2.startPosition.row + 1,
240
+ lineEnd: node2.endPosition.row + 1
241
+ };
242
+ }
243
+ const node = defCapture.node;
244
+ const nameNode = nameCapture?.node;
245
+ return {
246
+ category: inferCategory(captures[0]?.name || "other"),
247
+ name: nameNode?.text || "anonymous",
248
+ lineStart: node.startPosition.row + 1,
249
+ lineEnd: node.endPosition.row + 1,
250
+ signature: extractSignature(node, languageId)
251
+ };
252
+ }
253
+ function extractStatementName(text, captureType) {
254
+ if (captureType === "import") {
255
+ const fromMatch = text.match(/from\s+['"]([^'"]+)['"]/);
256
+ if (fromMatch)
257
+ return fromMatch[1];
258
+ const stringMatch = text.match(/['"]([^'"]+)['"]/);
259
+ if (stringMatch)
260
+ return stringMatch[1];
261
+ } else {
262
+ const namedExport = text.match(/export\s+(?:default\s+)?(?:function|class|const|let|var|type|interface)\s+(\w+)/);
263
+ if (namedExport)
264
+ return namedExport[1];
265
+ const anonymousDefault = text.match(/export\s+default\s+(?:function|class)\b/);
266
+ if (anonymousDefault)
267
+ return "default";
268
+ const braceExport = text.match(/export\s+\{([^}]+)\}/);
269
+ if (braceExport)
270
+ return braceExport[1].trim();
271
+ }
272
+ const tokens = text.split(/\s+/);
273
+ return tokens.length > 1 ? tokens.slice(0, 3).join(" ") : text.slice(0, 30);
274
+ }
275
+ function inferCategory(captureName) {
276
+ if (captureName.includes("func"))
277
+ return "function";
278
+ if (captureName.includes("class"))
279
+ return "class";
280
+ if (captureName.includes("type") || captureName.includes("interface") || captureName.includes("struct") || captureName.includes("protocol") || captureName.includes("mixin") || captureName.includes("object") || captureName.includes("module"))
281
+ return "type";
282
+ if (captureName.includes("export"))
283
+ return "export";
284
+ if (captureName.includes("import") || captureName.includes("use") || captureName.includes("using"))
285
+ return "import";
286
+ if (captureName.includes("var"))
287
+ return "variable";
288
+ if (captureName.includes("command"))
289
+ return "function";
290
+ if (captureName.includes("rule"))
291
+ return "type";
292
+ return "other";
293
+ }
294
+ var paramNodeTypes = {
295
+ javascript: ["formal_parameters"],
296
+ typescript: ["formal_parameters"],
297
+ tsx: ["formal_parameters"],
298
+ python: ["parameters"],
299
+ go: ["parameter_list"],
300
+ rust: ["parameters", "function_item"],
301
+ java: ["formal_parameters", "method_declaration"],
302
+ c: ["parameter_list"],
303
+ cpp: ["parameter_list"],
304
+ csharp: ["formal_parameters"],
305
+ ruby: ["parameters"],
306
+ php: ["formal_parameters", "parameter_list"],
307
+ swift: ["parameter_clause"],
308
+ kotlin: ["parameter_list"],
309
+ dart: ["parameter_list", "function_signature"],
310
+ css: [],
311
+ bash: ["command_position"],
312
+ powershell: ["parameter_list"]
313
+ };
314
+ function extractSignature(node, languageId) {
315
+ const nodeTypes = paramNodeTypes[languageId] || [];
316
+ for (const child of node.children) {
317
+ if (child && nodeTypes.includes(child.type)) {
318
+ return child.text;
319
+ }
320
+ }
321
+ if (languageId === "javascript" || languageId === "typescript" || languageId === "tsx") {
322
+ const paramsNode = node.children.find((c) => c !== null && c.type === "formal_parameters");
323
+ if (paramsNode) {
324
+ return paramsNode.text;
325
+ }
326
+ }
327
+ if (node.type === "class_declaration" || node.type === "class_definition" || node.type === "class") {
328
+ const classBodyNode = node.children.find((c) => c !== null && (c.type === "class_body" || c.type === "declaration_list"));
329
+ if (classBodyNode) {
330
+ return classBodyNode.text;
331
+ }
332
+ }
333
+ return;
334
+ }
335
+ function compareSymbols(oldSymbols, newSymbols) {
336
+ const changes = [];
337
+ const oldMap = new Map(oldSymbols.map((s) => [s.name, s]));
338
+ const newMap = new Map(newSymbols.map((s) => [s.name, s]));
339
+ const matchedOldSymbols = new Set;
340
+ for (const newSymbol of newSymbols) {
341
+ if (!oldMap.has(newSymbol.name)) {
342
+ const matchingOldSymbol = findRenamedSymbol(newSymbol, oldSymbols, matchedOldSymbols);
343
+ if (matchingOldSymbol) {
344
+ changes.push({
345
+ type: "renamed",
346
+ category: newSymbol.category,
347
+ name: newSymbol.name,
348
+ lineStart: newSymbol.lineStart,
349
+ lineEnd: newSymbol.lineEnd,
350
+ signature: newSymbol.signature,
351
+ renamedFrom: matchingOldSymbol.name
352
+ });
353
+ matchedOldSymbols.add(matchingOldSymbol);
354
+ } else {
355
+ changes.push({
356
+ type: "added",
357
+ category: newSymbol.category,
358
+ name: newSymbol.name,
359
+ lineStart: newSymbol.lineStart,
360
+ lineEnd: newSymbol.lineEnd,
361
+ signature: newSymbol.signature
362
+ });
363
+ }
364
+ } else {
365
+ const oldSymbol = oldMap.get(newSymbol.name);
366
+ matchedOldSymbols.add(oldSymbol);
367
+ if (oldSymbol.lineStart !== newSymbol.lineStart || oldSymbol.lineEnd !== newSymbol.lineEnd || oldSymbol.signature !== newSymbol.signature) {
368
+ changes.push({
369
+ type: "modified",
370
+ category: newSymbol.category,
371
+ name: newSymbol.name,
372
+ lineStart: newSymbol.lineStart,
373
+ lineEnd: newSymbol.lineEnd,
374
+ signature: newSymbol.signature
375
+ });
376
+ }
377
+ }
378
+ }
379
+ for (const oldSymbol of oldSymbols) {
380
+ if (!newMap.has(oldSymbol.name) && !matchedOldSymbols.has(oldSymbol)) {
381
+ changes.push({
382
+ type: "removed",
383
+ category: oldSymbol.category,
384
+ name: oldSymbol.name,
385
+ lineStart: oldSymbol.lineStart,
386
+ lineEnd: oldSymbol.lineEnd,
387
+ signature: oldSymbol.signature
388
+ });
389
+ }
390
+ }
391
+ return changes;
392
+ }
393
+ function findRenamedSymbol(newSymbol, oldSymbols, matchedOldSymbols) {
394
+ if (newSymbol.category !== "function" && newSymbol.category !== "type" && newSymbol.category !== "class") {
395
+ return null;
396
+ }
397
+ if (!newSymbol.signature) {
398
+ return null;
399
+ }
400
+ if (newSymbol.category === "function" && newSymbol.signature.replace(/\s/g, "") === "()") {
401
+ return null;
402
+ }
403
+ const lineCount = newSymbol.lineEnd - newSymbol.lineStart;
404
+ for (const oldSymbol of oldSymbols) {
405
+ if (matchedOldSymbols.has(oldSymbol) || oldSymbol.category !== newSymbol.category) {
406
+ continue;
407
+ }
408
+ if (oldSymbol.signature !== newSymbol.signature) {
409
+ continue;
410
+ }
411
+ const oldLineCount = oldSymbol.lineEnd - oldSymbol.lineStart;
412
+ const maxAllowedLines = Math.ceil(lineCount * 1.2);
413
+ if (oldLineCount > maxAllowedLines) {
414
+ continue;
415
+ }
416
+ return oldSymbol;
417
+ }
418
+ return null;
419
+ }
420
+ export {
421
+ computeASTDiff
422
+ };
@@ -12,14 +12,14 @@ import {
12
12
  shouldRunOnStartup,
13
13
  writeBackupArtifact,
14
14
  writeDoctorArtifact
15
- } from "./index-xah70t2t.js";
16
- import"./index-ee3x66a5.js";
17
- import"./index-zgwm4ryv.js";
18
- import"./index-we279je2.js";
15
+ } from "./index-zky3vt90.js";
16
+ import"./index-mpw32szm.js";
19
17
  import"./index-jqsfsqbx.js";
18
+ import"./index-z6xqpmqg.js";
20
19
  import"./index-zjygnfay.js";
21
20
  import"./index-bk5tah7q.js";
22
21
  import"./index-bpmtbmy9.js";
22
+ import"./index-zgwm4ryv.js";
23
23
  import"./index-a76rekgs.js";
24
24
  export {
25
25
  writeDoctorArtifact,
@@ -14,13 +14,13 @@ import {
14
14
  resolveWorktreeBaseDir,
15
15
  shortenWorktreePath,
16
16
  writeLaneProfileToDiskReal
17
- } from "./index-bkkxxwcd.js";
18
- import"./index-ee3x66a5.js";
19
- import"./index-4nt52yr9.js";
17
+ } from "./index-n48cwf1a.js";
20
18
  import"./index-4rhhvd1a.js";
21
- import"./index-zgwm4ryv.js";
22
19
  import"./index-jqsfsqbx.js";
20
+ import"./index-z6xqpmqg.js";
23
21
  import"./index-zjygnfay.js";
22
+ import"./index-4nt52yr9.js";
23
+ import"./index-zgwm4ryv.js";
24
24
  import"./index-a76rekgs.js";
25
25
  export {
26
26
  writeLaneProfileToDiskReal,
@@ -12,9 +12,9 @@ import"./index-ed5ykebp.js";
12
12
  import"./index-k31en0ja.js";
13
13
  import"./index-7g4c7s5r.js";
14
14
  import"./index-s2rcz51a.js";
15
+ import"./index-bpmtbmy9.js";
15
16
  import"./index-4nt52yr9.js";
16
17
  import"./index-zgwm4ryv.js";
17
- import"./index-bpmtbmy9.js";
18
18
  import"./index-a76rekgs.js";
19
19
  export {
20
20
  readCohortConfigFingerprint,
@@ -5,23 +5,23 @@ import {
5
5
  import {
6
6
  readEffectiveSpecSync
7
7
  } from "./index-9ss2m4rs.js";
8
+ import"./index-n832052r.js";
8
9
  import {
9
10
  readSwarmFileAsync,
10
11
  validateSwarmPath
11
- } from "./index-k46me75h.js";
12
- import"./index-ee3x66a5.js";
12
+ } from "./index-rn0eq85g.js";
13
+ import"./index-4rhhvd1a.js";
14
+ import"./index-z6xqpmqg.js";
15
+ import"./index-zjygnfay.js";
13
16
  import {
14
17
  invalidateCachedArtifact
15
18
  } from "./index-ed5ykebp.js";
16
- import"./index-n832052r.js";
19
+ import"./index-bpmtbmy9.js";
17
20
  import"./index-4nt52yr9.js";
18
- import"./index-4rhhvd1a.js";
19
21
  import {
20
22
  init_logger,
21
23
  warn
22
24
  } from "./index-zgwm4ryv.js";
23
- import"./index-zjygnfay.js";
24
- import"./index-bpmtbmy9.js";
25
25
  import"./index-a76rekgs.js";
26
26
 
27
27
  // src/hooks/curator-drift.ts
@@ -14,60 +14,61 @@ import {
14
14
  runCuratorInit,
15
15
  runCuratorPhase,
16
16
  writeCuratorSummary
17
- } from "./index-h7ye3bzp.js";
18
- import"./index-4905hd2m.js";
19
- import"./index-ebwznsfy.js";
20
- import"./index-y9h2vqf6.js";
21
- import"./index-rthq1a6w.js";
22
- import"./index-c8s9a3zh.js";
23
- import"./index-xah70t2t.js";
24
- import"./index-gtkk5rx7.js";
17
+ } from "./index-q7jv0c8e.js";
18
+ import"./index-7317fvce.js";
19
+ import"./index-zky3vt90.js";
20
+ import"./index-awzwmx8p.js";
25
21
  import"./index-134d35c1.js";
22
+ import"./index-b6e016tv.js";
23
+ import"./index-4q9vfav6.js";
26
24
  import"./index-k92cagmt.js";
27
25
  import"./index-y8552snf.js";
26
+ import"./index-crt7xw29.js";
27
+ import"./index-xmzmeknp.js";
28
+ import"./index-c8s9a3zh.js";
28
29
  import"./index-9ss2m4rs.js";
30
+ import"./index-0kqs2fbm.js";
29
31
  import"./index-74hpm6sh.js";
30
- import"./index-k1xsjzm3.js";
31
- import"./index-xfhe29z3.js";
32
- import"./index-vy11zjvh.js";
33
- import"./index-xmzmeknp.js";
34
- import"./index-82m5kwtd.js";
32
+ import"./index-91dz0zct.js";
33
+ import"./index-x10a9cz6.js";
34
+ import"./index-3fg8kx7n.js";
35
+ import"./index-q68a8h37.js";
36
+ import"./index-556ja8an.js";
37
+ import"./index-gdd4jt6b.js";
35
38
  import"./index-zsrtt42s.js";
36
- import"./index-qwm6vdyv.js";
37
- import"./index-2mb5y2w1.js";
38
- import"./index-bkkxxwcd.js";
39
- import"./index-7c4bxgdh.js";
39
+ import"./index-k3cxyk66.js";
40
+ import"./index-8aabbfhv.js";
41
+ import"./index-n48cwf1a.js";
40
42
  import"./index-8fwhhayc.js";
41
43
  import"./index-q1exe2b3.js";
42
- import"./index-ajfa2wmj.js";
43
- import"./index-k46me75h.js";
44
- import"./index-ee3x66a5.js";
45
- import"./index-9kf3mj08.js";
44
+ import"./index-7sy3aa9m.js";
45
+ import"./index-4905hd2m.js";
46
+ import"./index-qmfzfh7m.js";
47
+ import"./index-254xf5y6.js";
48
+ import"./index-gprxjmm7.js";
49
+ import"./index-n832052r.js";
50
+ import"./index-zgq25ze6.js";
51
+ import"./index-mpw32szm.js";
52
+ import"./index-rn0eq85g.js";
53
+ import"./index-4rhhvd1a.js";
54
+ import"./index-jqsfsqbx.js";
55
+ import"./index-z6xqpmqg.js";
56
+ import"./index-zjygnfay.js";
57
+ import"./index-cfwdm1dx.js";
46
58
  import"./index-tq5s07ta.js";
47
59
  import"./index-rtry5xyf.js";
48
- import"./index-j02ez59y.js";
60
+ import"./index-srd87kxc.js";
49
61
  import"./index-ae75rja9.js";
50
62
  import"./index-w7x7qxz2.js";
51
63
  import"./index-erfnw81g.js";
64
+ import"./index-bk5tah7q.js";
52
65
  import"./index-ed5ykebp.js";
53
- import"./index-ktazgjqw.js";
54
- import"./index-gprxjmm7.js";
55
- import"./index-n832052r.js";
56
- import"./index-9wmx9ca8.js";
57
- import"./index-myav90y6.js";
58
- import"./index-556ja8an.js";
59
66
  import"./index-k31en0ja.js";
60
67
  import"./index-7g4c7s5r.js";
61
68
  import"./index-s2rcz51a.js";
69
+ import"./index-bpmtbmy9.js";
62
70
  import"./index-4nt52yr9.js";
63
- import"./index-sdqtecsd.js";
64
- import"./index-4rhhvd1a.js";
65
71
  import"./index-zgwm4ryv.js";
66
- import"./index-we279je2.js";
67
- import"./index-jqsfsqbx.js";
68
- import"./index-zjygnfay.js";
69
- import"./index-bk5tah7q.js";
70
- import"./index-bpmtbmy9.js";
71
72
  import"./index-a76rekgs.js";
72
73
  export {
73
74
  writeCuratorSummary,