opencode-swarm 7.154.3 → 7.155.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/cli/{coder-settlement-7c9h07f5.js → coder-settlement-2kdtysrg.js} +6 -6
  2. package/dist/cli/{config-doctor-8zjz6dej.js → config-doctor-s6p9aqfv.js} +2 -2
  3. package/dist/cli/{core-dn8bn81g.js → core-ev2ebc4v.js} +1 -1
  4. package/dist/cli/{curation-policy-2jkbybw7.js → curation-policy-jabphe51.js} +4 -4
  5. package/dist/cli/{curator-v12rhct2.js → curator-adp0dsv4.js} +27 -27
  6. package/dist/cli/{curator-llm-factory-mxdjw6kz.js → curator-llm-factory-kd8v16jj.js} +27 -27
  7. package/dist/cli/{evidence-summary-service-zzvvcaa9.js → evidence-summary-service-kpjpd86j.js} +9 -9
  8. package/dist/cli/{gate-evidence-16jkjre9.js → gate-evidence-etbcms2v.js} +4 -4
  9. package/dist/cli/{guardrail-explain-11fx66cx.js → guardrail-explain-wqb5h7kk.js} +28 -28
  10. package/dist/cli/{guardrail-log-ahvfn58c.js → guardrail-log-614g1pta.js} +3 -3
  11. package/dist/cli/{guardrail-reset-zp5xe0n5.js → guardrail-reset-0wdj53cp.js} +27 -27
  12. package/dist/cli/{hive-promoter-k6y06jj8.js → hive-promoter-b1wv52fs.js} +27 -27
  13. package/dist/cli/{index-vntggpez.js → index-0q8kywcf.js} +1 -1
  14. package/dist/cli/{index-g1bh7980.js → index-26cvxrym.js} +2 -2
  15. package/dist/cli/{index-m0fy8jra.js → index-2gfe61qp.js} +312 -216
  16. package/dist/cli/{index-y3kw1zpm.js → index-34wn2ztk.js} +4 -2
  17. package/dist/cli/{index-0f4b9ywa.js → index-6bqqzfbe.js} +1 -1
  18. package/dist/cli/{index-q0prhdds.js → index-79qymsxf.js} +1 -1
  19. package/dist/cli/{index-ed13peqr.js → index-85p1850w.js} +1 -1
  20. package/dist/cli/{index-zak50rve.js → index-aqg7c1z9.js} +1 -1
  21. package/dist/cli/{index-qxj63890.js → index-c590qxts.js} +1 -1
  22. package/dist/cli/{index-env8fk17.js → index-c9nabqzd.js} +1 -1
  23. package/dist/cli/{index-kck2gtxk.js → index-caqe8x14.js} +1 -1
  24. package/dist/cli/{index-n7nnz0jp.js → index-ctsct3hy.js} +6 -6
  25. package/dist/cli/{index-gbkdj7ay.js → index-dw2q720x.js} +2 -2
  26. package/dist/cli/{index-6vcrkz80.js → index-e90g4dsw.js} +4 -4
  27. package/dist/cli/{index-ymgsmjba.js → index-egnpzfe3.js} +4 -4
  28. package/dist/cli/{index-bhjkxasn.js → index-ew6fykvv.js} +1 -1
  29. package/dist/cli/{index-94e20w95.js → index-fjcm6wwf.js} +1 -1
  30. package/dist/cli/{index-d7r6y724.js → index-ketfp4rv.js} +3 -3
  31. package/dist/cli/{index-a6xjn2zt.js → index-kgdbtwfm.js} +5 -5
  32. package/dist/cli/{index-qdnmnq65.js → index-kyc2c7hq.js} +1 -1
  33. package/dist/cli/{index-wkagbmpt.js → index-mm7ase9k.js} +1 -1
  34. package/dist/cli/{index-s23q9v6t.js → index-qj9jrjvr.js} +5 -5
  35. package/dist/cli/{index-9nw6z98k.js → index-qzqpq75z.js} +29 -29
  36. package/dist/cli/{index-v6xkgxts.js → index-rb4t72we.js} +2 -2
  37. package/dist/cli/{index-7qky94rr.js → index-spbxf9vn.js} +1 -1
  38. package/dist/cli/{index-4n557t8w.js → index-t3xqpece.js} +3 -3
  39. package/dist/cli/{index-4dt91x6e.js → index-veajr5x7.js} +1 -1
  40. package/dist/cli/{index-7fyv62b2.js → index-wwv3cbv1.js} +4 -4
  41. package/dist/cli/{index-ckp0z9d4.js → index-x9tbe9v7.js} +2 -2
  42. package/dist/cli/{index-2rgm3hgq.js → index-xn23xnnk.js} +4 -4
  43. package/dist/cli/{index-s5p8ryar.js → index-zvp68qx6.js} +1 -1
  44. package/dist/cli/index.js +27 -27
  45. package/dist/cli/{knowledge-escalator-yew2fbxb.js → knowledge-escalator-z09aqvfe.js} +9 -9
  46. package/dist/cli/{knowledge-events-zfg423hp.js → knowledge-events-03f1rwm8.js} +7 -7
  47. package/dist/cli/{knowledge-link-ydv6shg2.js → knowledge-link-4frk38w8.js} +3 -3
  48. package/dist/cli/{knowledge-store-zcv9stzz.js → knowledge-store-sn28k13f.js} +4 -4
  49. package/dist/cli/{knowledge-validator-q68wx2bf.js → knowledge-validator-rwrt3yja.js} +6 -6
  50. package/dist/cli/{pending-delegations-yet1rza6.js → pending-delegations-qe16vfrj.js} +1 -1
  51. package/dist/cli/{pr-subscriptions-mp7fyh1r.js → pr-subscriptions-00evnffe.js} +2 -2
  52. package/dist/cli/{runner-s89ja08q.js → runner-k1rkbjm8.js} +4 -4
  53. package/dist/cli/{scan-cursor-38bzfhwf.js → scan-cursor-h3mfzjc9.js} +5 -5
  54. package/dist/cli/{schema-9hqyt4t6.js → schema-c37h5xw4.js} +1 -1
  55. package/dist/cli/{scope-persistence-dd9s9q2b.js → scope-persistence-35z42pj5.js} +5 -5
  56. package/dist/cli/{skill-generator-b28ezazm.js → skill-generator-60px2mvb.js} +11 -11
  57. package/dist/cli/{worktree-collision-ownership-zw65t2p9.js → worktree-collision-ownership-2pc20ypq.js} +3 -3
  58. package/dist/cli/{worktree-isolation-0ag393t0.js → worktree-isolation-w4yamc3b.js} +27 -27
  59. package/dist/commands/close.d.ts +2 -0
  60. package/dist/config/schema.d.ts +8 -0
  61. package/dist/hooks/repo-graph-injection.d.ts +40 -0
  62. package/dist/index.js +376 -356
  63. package/dist/memory/reflection-service.d.ts +8 -2
  64. package/dist/memory/schema.d.ts +4 -4
  65. package/dist/tools/repo-graph/indexed-storage.d.ts +136 -0
  66. package/dist/tools/repo-graph/query.d.ts +7 -0
  67. package/package.json +2 -1
@@ -1,7 +1,9 @@
1
+ import { queryNodeByFile, resolveGraphStorageMode } from '../tools/repo-graph/indexed-storage';
2
+ import type { RepoGraph } from '../tools/repo-graph/types';
1
3
  import { type MemoryConfig } from './config';
2
4
  import { type MemoryGateway, type RecordMemoryOutcomeInput } from './gateway';
3
- import { type ReflectionDigest } from './reflection';
4
- import type { MemoryOutcome, MemoryRecord } from './types';
5
+ import { type ReflectionAnchorStatus, type ReflectionDigest } from './reflection';
6
+ import type { MemoryAnchor, MemoryOutcome, MemoryRecord } from './types';
5
7
  interface OutcomeWriteThroughBase {
6
8
  record: MemoryRecord;
7
9
  eventId: string;
@@ -49,12 +51,16 @@ export declare const _test_exports: {
49
51
  isReflectionEligible: typeof isReflectionEligible;
50
52
  prepareWriteThroughEntry: typeof prepareWriteThroughEntry;
51
53
  sanitizeReflectionRecord: typeof sanitizeReflectionRecord;
54
+ createAnchorResolver: typeof createAnchorResolver;
52
55
  };
53
56
  export declare const _internals: {
54
57
  withReflectionLock: typeof withReflectionLock;
55
58
  serializeDigestArtifacts: typeof serializeDigestArtifacts;
56
59
  boundDigest: typeof boundDigest;
60
+ resolveGraphStorageMode: typeof resolveGraphStorageMode;
61
+ queryNodeByFile: typeof queryNodeByFile;
57
62
  };
63
+ declare function createAnchorResolver(directory: string, graph: RepoGraph | null): (anchor: MemoryAnchor) => ReflectionAnchorStatus;
58
64
  declare function withReflectionLock<T>(directory: string, fn: () => Promise<T>): Promise<T>;
59
65
  interface ReflectionArtifactPair {
60
66
  markdown: string;
@@ -10,8 +10,8 @@ export declare const MemoryScopeTypeSchema: z.ZodEnum<{
10
10
  project: "project";
11
11
  workspace: "workspace";
12
12
  run: "run";
13
- global_user: "global_user";
14
13
  repository: "repository";
14
+ global_user: "global_user";
15
15
  cohort: "cohort";
16
16
  }>;
17
17
  export declare const MemoryScopeRefSchema: z.ZodObject<{
@@ -20,8 +20,8 @@ export declare const MemoryScopeRefSchema: z.ZodObject<{
20
20
  project: "project";
21
21
  workspace: "workspace";
22
22
  run: "run";
23
- global_user: "global_user";
24
23
  repository: "repository";
24
+ global_user: "global_user";
25
25
  cohort: "cohort";
26
26
  }>;
27
27
  userId: z.ZodOptional<z.ZodString>;
@@ -77,8 +77,8 @@ export declare const MemoryRecordSchema: z.ZodObject<{
77
77
  project: "project";
78
78
  workspace: "workspace";
79
79
  run: "run";
80
- global_user: "global_user";
81
80
  repository: "repository";
81
+ global_user: "global_user";
82
82
  cohort: "cohort";
83
83
  }>;
84
84
  userId: z.ZodOptional<z.ZodString>;
@@ -171,8 +171,8 @@ export declare const MemoryProposalSchema: z.ZodObject<{
171
171
  project: "project";
172
172
  workspace: "workspace";
173
173
  run: "run";
174
- global_user: "global_user";
175
174
  repository: "repository";
175
+ global_user: "global_user";
176
176
  cohort: "cohort";
177
177
  }>;
178
178
  userId: z.ZodOptional<z.ZodString>;
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Derived SQLite index for the repo dependency graph (issue #1534).
3
+ *
4
+ * `.swarm/repo-graph.json` stays the single authoritative document in BOTH
5
+ * storage modes. When `repo_graph.storage === 'indexed'`, `saveGraph` also
6
+ * maintains `.swarm/repo-memory.sqlite`, a *derived accelerator* whose only job
7
+ * is to answer "give me the neighbourhood of these files" without parsing the
8
+ * whole JSON document. It returns an ordinary `RepoGraph` value that is fed to
9
+ * the existing, unmodified `getGraphNode` / `getLocalizationContext` /
10
+ * `getBlastRadius`, so no query logic is duplicated here.
11
+ *
12
+ * Every read verifies, before returning anything:
13
+ * (a) the persisted `graph_meta.workspace_root` realpath-matches the ACTIVE
14
+ * workspace (same trust boundary as `bindGraphToWorkspace`,
15
+ * `storage.ts:100-127`), and
16
+ * (b) `graph_meta.source_size` / `source_mtime_ms` equal a live stat of
17
+ * `repo-graph.json`.
18
+ * Any mismatch, absence, or error returns null and the caller uses its
19
+ * existing JSON path. The index is never a second source of truth.
20
+ *
21
+ * Runtime portability (AGENTS.md invariant 2): the SQLite driver is resolved
22
+ * ONLY through `src/db/sqlite-loader.ts`. The `import type` below is erased at
23
+ * build time, so this module contributes no `bun:` runtime resolution.
24
+ * `node:sqlite` is stricter than `bun:sqlite` about bound parameters, so every
25
+ * statement's placeholder count equals its argument count exactly and
26
+ * no-placeholder statements are issued as `db.run(sql)` with no array.
27
+ */
28
+ import type { GraphNode, RepoGraph } from './types';
29
+ /** Filename of the derived index inside `.swarm/`. */
30
+ export declare const REPO_MEMORY_FILENAME = "repo-memory.sqlite";
31
+ /**
32
+ * Validated absolute path to `.swarm/repo-memory.sqlite`.
33
+ * Mirrors `getGraphPath`: validateWorkspace → validateSwarmPath →
34
+ * validateSymlinkBoundary.
35
+ */
36
+ export declare function getRepoMemoryPath(workspace: string): string;
37
+ /**
38
+ * Close the cached connection for a workspace. Called by the `/swarm close`
39
+ * clean stage before unlinking the store (Windows holds a WAL-mode file open,
40
+ * so `unlink` would fail with EBUSY — same guard as
41
+ * `closeProjectDb`, `project-db.ts:232-234`) and from test teardown.
42
+ */
43
+ export declare function closeRepoMemory(workspace: string): void;
44
+ /**
45
+ * Close every cached connection. Test-teardown only: `/swarm close` uses the
46
+ * singular `closeRepoMemory` (src/commands/close.ts); this export has no
47
+ * other production caller.
48
+ */
49
+ export declare function closeAllRepoMemory(): void;
50
+ /**
51
+ * Delete the derived store and its WAL sidecars.
52
+ *
53
+ * The cached handle is closed FIRST on every delete path — a live WAL-mode
54
+ * connection keeps the file open and Windows `unlink` fails with EBUSY
55
+ * otherwise.
56
+ */
57
+ export declare function deleteRepoMemory(workspace: string): void;
58
+ /** Whether a SQLite driver is resolvable in this runtime. */
59
+ export declare function isIndexedStorageAvailable(): boolean;
60
+ /**
61
+ * Effective storage mode for a workspace.
62
+ *
63
+ * Config is the kill switch: flipping `repo_graph.storage` back to `'json'`
64
+ * stops every reader from consulting the index immediately, even while a valid
65
+ * store with a matching stamp is still on disk. Falls back to `'json'` on any
66
+ * config error and whenever no SQLite driver is available.
67
+ */
68
+ export declare function resolveGraphStorageMode(workspace: string): 'json' | 'indexed';
69
+ /**
70
+ * Test seam (invariant 7: DI over mock.module) so the driver-unavailable
71
+ * fallback of {@link resolveGraphStorageMode} is exercisable without patching
72
+ * the module graph. Tests swap and restore the property; production reads it
73
+ * unchanged.
74
+ */
75
+ export declare const _internals: {
76
+ isIndexedStorageAvailable: typeof isIndexedStorageAvailable;
77
+ };
78
+ /**
79
+ * Replace the whole index from `graph` in one transaction.
80
+ *
81
+ * `stamp` MUST be a stat of the TEMP FILE, taken inside the save lock
82
+ * immediately BEFORE this writer's rename publishes it — not a stat of
83
+ * `repo-graph.json` at any point. `rename(2)` leaves the inode's mtime and size
84
+ * untouched, so the temp-file stat identifies THIS writer's own bytes. Any stat
85
+ * of the published path instead describes whatever is at that path by then: a
86
+ * concurrent writer that failed the lock renames unlocked (the JSON write is
87
+ * never lock-gated), so a post-rename stat would let ITS bytes validate an index
88
+ * holding THIS writer's superseded content. See `saveGraph`.
89
+ *
90
+ * Returns false — never throws — on every failure; the JSON write is the
91
+ * durability point and has already succeeded.
92
+ */
93
+ export declare function syncIndexFromGraph(workspace: string, graph: RepoGraph, stamp: {
94
+ size: number;
95
+ mtimeMs: number;
96
+ ino: string;
97
+ }): Promise<boolean>;
98
+ /**
99
+ * Resolve a single file to its `GraphNode` using the index.
100
+ *
101
+ * Implements closure rule steps 1-2 in full, so an anchor whose `moduleName`
102
+ * diverges from `path.relative(root, filePath)` resolves exactly as it would
103
+ * through `getGraphNode` on the full graph. Returns null whenever the index is
104
+ * absent, stale, foreign, or unusable — the caller keeps its existing path.
105
+ */
106
+ export declare function queryNodeByFile(workspace: string, file: string): GraphNode | null;
107
+ /**
108
+ * Build a bounded subgraph covering `files` and their neighbourhood, suitable
109
+ * for feeding the unmodified `getLocalizationContext` / `getBlastRadius`.
110
+ *
111
+ * Closure rule (normative, from the approved plan):
112
+ * 1-2. resolve every requested file the way `getGraphNode` would;
113
+ * 3. `T` = the union of resolved targets across ALL requested files in this
114
+ * ONE call (`getBlastRadius` seeds `visited` with every target at once,
115
+ * query.ts:623-625, so per-file subgraphs merged afterwards would produce
116
+ * a different `totalDependents` and therefore a different `riskLevel`);
117
+ * `N = T ∪ R_1..R_D ∪ F_1`, where `R` is the reverse closure to depth `D`
118
+ * and `F_1` is the 1-hop forward set from the targets only
119
+ * (`getDependencies`, query.ts:398-406);
120
+ * 4. `E = { edge : source ∈ N AND target ∈ N }` — AND, not incidence. An OR
121
+ * rule would admit frontier edges whose counterpart node is absent, and
122
+ * `moduleNameForEdgePath` (query.ts:83-88) silently degrades to a
123
+ * different string for those, changing `importers` / `dependencies` /
124
+ * `directDependents`. No asset/kind filtering happens in SQL:
125
+ * `buildReverseIndex` and `collectExternallyUsedSymbols` re-apply
126
+ * `isAssetEdge` downstream, so over-inclusion is harmless while
127
+ * under-inclusion is fatal;
128
+ * 5. the returned `workspaceRoot` is the realpath-bound ACTIVE workspace,
129
+ * never the persisted `graph_meta.workspace_root`.
130
+ *
131
+ * `depth` is clamped to at least 1: `getLocalizationContext` calls
132
+ * `getImporters` unconditionally, which needs `R_1` even when it passes
133
+ * `maxDepth = 0` to `getBlastRadius`. Over-inclusion of nodes is safe (a
134
+ * `maxDepth = 0` blast radius early-returns, query.ts:613-621).
135
+ */
136
+ export declare function loadSubgraphForFiles(workspace: string, files: string[], depth: number): RepoGraph | null;
@@ -1,6 +1,13 @@
1
1
  import type { FreshnessProbe } from './freshness';
2
2
  import type { BlastRadiusResult, CallerReference, ContextPackResult, ContextPackSourceMode, DeadExportsResult, FileOntology, FileReference, GraphHealthResult, GraphNode, LocalizationBlock, PackageBoundarySummary, RepoGraph, SymbolReference } from './types';
3
3
  export declare function getGraphNode(graph: RepoGraph, input: string): GraphNode | undefined;
4
+ /**
5
+ * Drop every cached query index. Required after any in-place mutation of a
6
+ * graph's `nodes` or `edges` (see the {@link queryIndexCache} contract note),
7
+ * and retained as the test seam for index-staleness assertions. Reassigns a
8
+ * fresh `WeakMap` rather than deleting keys, so it invalidates graphs this
9
+ * module can no longer enumerate.
10
+ */
4
11
  export declare function resetQueryCache(): void;
5
12
  /**
6
13
  * @deprecated Graph age is not a content-freshness signal. Internal consumers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.154.3",
3
+ "version": "7.155.0",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -124,6 +124,7 @@
124
124
  "check:gate-portability": "bun run scripts/check-gate-portability.ts",
125
125
  "check:bare-spawn": "bun run scripts/check-bare-executable-spawn.ts",
126
126
  "check:error-channel-discard": "bun run scripts/check-error-channel-discard.ts",
127
+ "check:registry-citations": "bun run scripts/check-registry-citations.ts",
127
128
  "check:memory-recall": "bun run scripts/memory-recall-regression.ts"
128
129
  },
129
130
  "dependencies": {