opencode-swarm 7.154.2 → 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 (79) hide show
  1. package/dist/cli/{coder-settlement-xqs49g07.js → coder-settlement-2kdtysrg.js} +7 -7
  2. package/dist/cli/{config-doctor-69eebk90.js → config-doctor-s6p9aqfv.js} +2 -2
  3. package/dist/cli/{core-dyp14hcb.js → core-ev2ebc4v.js} +1 -1
  4. package/dist/cli/{curation-policy-jm9jsxtt.js → curation-policy-jabphe51.js} +4 -4
  5. package/dist/cli/{curator-he8n9z9n.js → curator-adp0dsv4.js} +28 -28
  6. package/dist/cli/{curator-drift-h57z6tm3.js → curator-drift-g6w4ga1q.js} +1 -1
  7. package/dist/cli/{curator-llm-factory-5tq9c4v5.js → curator-llm-factory-kd8v16jj.js} +28 -28
  8. package/dist/cli/{evidence-summary-service-05s5y8d6.js → evidence-summary-service-kpjpd86j.js} +10 -10
  9. package/dist/cli/{gate-evidence-3ptr9af3.js → gate-evidence-etbcms2v.js} +5 -5
  10. package/dist/cli/{guardrail-explain-tebk344k.js → guardrail-explain-wqb5h7kk.js} +29 -29
  11. package/dist/cli/{guardrail-log-x3gz3x17.js → guardrail-log-614g1pta.js} +3 -3
  12. package/dist/cli/{guardrail-reset-716pdyf5.js → guardrail-reset-0wdj53cp.js} +28 -28
  13. package/dist/cli/{hive-promoter-nvwpj2t9.js → hive-promoter-b1wv52fs.js} +28 -28
  14. package/dist/cli/{index-4xqa0sgz.js → index-0q8kywcf.js} +2 -2
  15. package/dist/cli/{index-8v69hfpt.js → index-26cvxrym.js} +3 -3
  16. package/dist/cli/{index-bxvkn0ye.js → index-2gfe61qp.js} +345 -221
  17. package/dist/cli/{index-57t97rtr.js → index-34wn2ztk.js} +5 -2
  18. package/dist/cli/{index-kemxyzc0.js → index-6bqqzfbe.js} +2 -2
  19. package/dist/cli/{index-dm9tc6qb.js → index-79qymsxf.js} +1 -1
  20. package/dist/cli/{index-r0dactw2.js → index-85p1850w.js} +1 -1
  21. package/dist/cli/{index-14bz2t7b.js → index-aqg7c1z9.js} +1 -1
  22. package/dist/cli/{index-xq2v52tt.js → index-c590qxts.js} +1 -1
  23. package/dist/cli/{index-fv9ddfta.js → index-c9nabqzd.js} +1 -1
  24. package/dist/cli/{index-nh4axsxc.js → index-caqe8x14.js} +2 -2
  25. package/dist/cli/{index-n0gqre56.js → index-ctsct3hy.js} +6 -6
  26. package/dist/cli/{index-4cgee5vh.js → index-dtn0pne5.js} +20 -1
  27. package/dist/cli/{index-ynvw5kxc.js → index-dw2q720x.js} +2 -2
  28. package/dist/cli/{index-xt6jx41g.js → index-e90g4dsw.js} +4 -4
  29. package/dist/cli/{index-9avdncr2.js → index-egnpzfe3.js} +5 -5
  30. package/dist/cli/{index-j6q3k628.js → index-ew6fykvv.js} +1 -1
  31. package/dist/cli/{index-6rns7b2m.js → index-fjcm6wwf.js} +2 -2
  32. package/dist/cli/{index-mnxtkt8s.js → index-ketfp4rv.js} +3 -3
  33. package/dist/cli/{index-f6qmar4k.js → index-kgdbtwfm.js} +5 -5
  34. package/dist/cli/{index-399e8aze.js → index-kyc2c7hq.js} +1 -1
  35. package/dist/cli/{index-07n87ctw.js → index-mm7ase9k.js} +1 -1
  36. package/dist/cli/{index-p7ey2w90.js → index-qj9jrjvr.js} +6 -6
  37. package/dist/cli/{index-v2ryvr8k.js → index-qzqpq75z.js} +30 -30
  38. package/dist/cli/{index-v9585wjc.js → index-rb4t72we.js} +2 -2
  39. package/dist/cli/{index-2w6vy9a9.js → index-spbxf9vn.js} +1 -1
  40. package/dist/cli/{index-6qwp46k0.js → index-t3xqpece.js} +3 -3
  41. package/dist/cli/{index-pj2nycpg.js → index-veajr5x7.js} +1 -1
  42. package/dist/cli/{index-vhhdj49x.js → index-wwv3cbv1.js} +8 -9
  43. package/dist/cli/{index-7tw116n6.js → index-x9tbe9v7.js} +2 -2
  44. package/dist/cli/{index-6rcx6vr6.js → index-xn23xnnk.js} +4 -4
  45. package/dist/cli/{index-dsqat5pg.js → index-zvp68qx6.js} +1 -1
  46. package/dist/cli/index.js +28 -28
  47. package/dist/cli/{knowledge-escalator-s0tye368.js → knowledge-escalator-z09aqvfe.js} +10 -10
  48. package/dist/cli/{knowledge-events-eyy9yf6b.js → knowledge-events-03f1rwm8.js} +8 -8
  49. package/dist/cli/{knowledge-link-rb11f06y.js → knowledge-link-4frk38w8.js} +3 -3
  50. package/dist/cli/{knowledge-store-zjq5mz2d.js → knowledge-store-sn28k13f.js} +4 -4
  51. package/dist/cli/{knowledge-validator-yw5qqqpd.js → knowledge-validator-rwrt3yja.js} +6 -6
  52. package/dist/cli/{pending-delegations-rdzjq3nw.js → pending-delegations-qe16vfrj.js} +2 -2
  53. package/dist/cli/{pr-subscriptions-2f5fne6z.js → pr-subscriptions-00evnffe.js} +3 -3
  54. package/dist/cli/{runner-yaqrj388.js → runner-k1rkbjm8.js} +4 -4
  55. package/dist/cli/{scan-cursor-8f0s883y.js → scan-cursor-h3mfzjc9.js} +5 -5
  56. package/dist/cli/{schema-2xw94dh3.js → schema-c37h5xw4.js} +1 -1
  57. package/dist/cli/{scope-persistence-tap2q94x.js → scope-persistence-35z42pj5.js} +5 -5
  58. package/dist/cli/{skill-generator-2xbfryqb.js → skill-generator-60px2mvb.js} +12 -12
  59. package/dist/cli/{worktree-collision-ownership-5gwey8ms.js → worktree-collision-ownership-2pc20ypq.js} +4 -4
  60. package/dist/cli/{worktree-isolation-xsy14t5a.js → worktree-isolation-w4yamc3b.js} +28 -28
  61. package/dist/commands/close.d.ts +2 -0
  62. package/dist/config/schema.d.ts +8 -0
  63. package/dist/hooks/final-context-accounting.d.ts +60 -0
  64. package/dist/hooks/index.d.ts +1 -0
  65. package/dist/hooks/knowledge-injector.d.ts +1 -1
  66. package/dist/hooks/repo-graph-injection.d.ts +40 -0
  67. package/dist/hooks/system-enhancer.d.ts +13 -0
  68. package/dist/hooks/utils.d.ts +11 -0
  69. package/dist/index.js +414 -389
  70. package/dist/memory/reflection-service.d.ts +8 -2
  71. package/dist/memory/schema.d.ts +4 -4
  72. package/dist/services/compaction-service.d.ts +9 -3
  73. package/dist/services/context-budget-service.d.ts +7 -3
  74. package/dist/services/injection-budget.d.ts +103 -26
  75. package/dist/state.d.ts +69 -0
  76. package/dist/summaries/summarizer.d.ts +34 -3
  77. package/dist/tools/repo-graph/indexed-storage.d.ts +136 -0
  78. package/dist/tools/repo-graph/query.d.ts +7 -0
  79. package/package.json +3 -1
@@ -8,6 +8,7 @@ export { createDelegationGateHook, outputLooksLikeBackgroundRunning, } from './d
8
8
  export { createDelegationSanitizerHook } from './delegation-sanitizer';
9
9
  export { createDelegationTrackerHook } from './delegation-tracker';
10
10
  export { extractCurrentPhase, extractCurrentPhaseFromPlan, extractCurrentTask, extractCurrentTaskFromPlan, extractDecisions, extractIncompleteTasks, extractIncompleteTasksFromPlan, extractPatterns, } from './extractors';
11
+ export { createFinalContextAccountingStep } from './final-context-accounting';
11
12
  export { createFullAutoInterceptHook } from './full-auto-intercept';
12
13
  export { checkFileAuthority, createGuardrailsHooks, DEFAULT_AGENT_AUTHORITY_RULES, } from './guardrails';
13
14
  export { classifyMessage, classifyMessages, containsPlanContent, getCompletedToolOutputs, getToolNames, getToolParts, isDuplicateToolRead, isStaleError, isToolResult, MessagePriority, type MessagePriorityType, type MessageWithParts, } from './message-priority';
@@ -99,7 +99,7 @@ export declare function matchesDelegateScope(entry: Pick<RankedEntry, 'applies_t
99
99
  /** Inserts the knowledge block just before the last user message (recency position). */
100
100
  declare function injectKnowledgeMessage(output: {
101
101
  messages?: MessageWithParts[];
102
- }, text: string): void;
102
+ }, text: string, sessionId?: string): void;
103
103
  /**
104
104
  * Creates a knowledge injection hook that injects relevant knowledge into the
105
105
  * architect's message context at phase start. Supports caching for re-injection
@@ -16,25 +16,65 @@
16
16
  * bounded workspace probe gates use of the graph. Uncertified graphs and
17
17
  * complete drift above the configured refresh cap are suppressed;
18
18
  * inconclusive probes remain usable as freshness-unknown, without mutation.
19
+ *
20
+ * Storage modes (issue #1534): when `options.storage === 'indexed'`, the two
21
+ * FILE-SCOPED block builders may, on a full-graph LRU miss, serve a bounded
22
+ * subgraph read from `.swarm/repo-memory.sqlite` instead of parsing the whole
23
+ * JSON document. The kill switch, the stat gate and the freshness probe all
24
+ * run first and are unchanged, and the LRU hit — the common case — never
25
+ * touches SQLite. Whole-graph consumers (`buildLaneOrientationBlock`,
26
+ * `semantic-diff-injection`) always get the full JSON graph.
19
27
  */
20
28
  import { loadPluginConfigWithMetaAsync } from '../config/loader';
21
29
  import { type FreshnessOptions, probeFreshness, type RepoGraph } from '../tools/repo-graph';
30
+ import { loadSubgraphForFiles } from '../tools/repo-graph/indexed-storage';
22
31
  export interface RepoGraphInjectionOptions extends FreshnessOptions {
23
32
  enabled?: boolean;
24
33
  refreshCap?: number;
34
+ /**
35
+ * Resolved `repo_graph.storage` mode (issue #1534). Passed in by the caller
36
+ * — this module deliberately never reads config synchronously (see the
37
+ * `loadPluginConfigWithMetaAsync` note on `_internals`), so the mode rides
38
+ * in beside `enabled` / `refreshCap`. Anything other than `'indexed'`
39
+ * (including `undefined`) keeps every path on the JSON document.
40
+ */
41
+ storage?: 'json' | 'indexed';
25
42
  }
26
43
  export declare const _internals: {
27
44
  probeFreshness: typeof probeFreshness;
28
45
  cacheSize: () => number;
46
+ subgraphCacheSize: () => number;
29
47
  renderLaneOrientationBlock: typeof renderLaneOrientationBlock;
30
48
  orientationFreshnessLine: typeof orientationFreshnessLine;
31
49
  loadPluginConfigWithMetaAsync: typeof loadPluginConfigWithMetaAsync;
50
+ loadSubgraphForFiles: typeof loadSubgraphForFiles;
51
+ subgraphCacheKey: typeof subgraphCacheKey;
32
52
  };
53
+ /**
54
+ * Cache key for a subgraph request. The graph artifact's `{mtimeMs, size, ino}`
55
+ * is part of the key, so a graph change invalidates every cached subgraph for
56
+ * that directory without an explicit sweep — the identical invalidation
57
+ * contract the full-graph LRU uses. Files are sorted because the closure is a
58
+ * set union and is order-independent; the caller's own array order (which does
59
+ * drive `BlastRadiusResult.target` and the rendered target list) is never read
60
+ * from this key. NUL is the separator because it is the one character that
61
+ * cannot appear in a path component, so no two distinct requests can collide
62
+ * by concatenation.
63
+ */
64
+ declare function subgraphCacheKey(directoryKey: string, stat: {
65
+ mtimeMs: number;
66
+ size: number;
67
+ ino: number;
68
+ }, files: readonly string[], depth: number): string;
33
69
  /**
34
70
  * Load the repo graph for `directory`, using a bounded per-directory cache that
35
71
  * invalidates on file mtime/size change and a shared content-freshness gate.
36
72
  * Returns null if no graph exists or its workspace alignment is unsafe.
37
73
  *
74
+ * Always returns the WHOLE graph — `semantic-diff-injection` and
75
+ * `buildLaneOrientationBlock` are whole-graph consumers and must never receive
76
+ * a bounded subgraph.
77
+ *
38
78
  * Exported only for tests; production callers use the buildXxxBlock helpers below.
39
79
  */
40
80
  export declare function getCachedGraph(directory: string, options?: RepoGraphInjectionOptions): Promise<RepoGraph | null>;
@@ -6,6 +6,7 @@
6
6
  * Reads plan.md and injects phase context into the system prompt.
7
7
  */
8
8
  import type { PluginConfig } from '../config';
9
+ import type { RuntimePlan } from '../config/plan-schema';
9
10
  /**
10
11
  * Build the [spec-drift] advisory injected into the model's system prompt
11
12
  * after every loadPlan whenever spec staleness is detected (issue #853
@@ -29,6 +30,9 @@ export declare function buildSpecDriftAdvisory(args: {
29
30
  source: string;
30
31
  };
31
32
  }): string;
33
+ declare function maybeAppendSpecDriftAdvisory(output: {
34
+ system: string[];
35
+ }, directory: string, plan: RuntimePlan | null, sessionId?: string): void;
32
36
  /**
33
37
  * Build a retrospective injection string for the architect system message.
34
38
  * Tier 1: direct phase-scoped lookup for same-plan previous phase.
@@ -51,3 +55,12 @@ export type ArchitectMode = 'DISCOVER' | 'PLAN' | 'EXECUTE' | 'PHASE-WRAP' | 'UN
51
55
  * @returns The current architect mode based on plan state
52
56
  */
53
57
  export declare function detectArchitectMode(directory: string, cache?: Map<string, Promise<string | null>>): Promise<ArchitectMode>;
58
+ /**
59
+ * Tier-0 test seam (knowledge-injector precedent): exposes the spec-drift
60
+ * advisory helper so the #2107 §2 attribution test can drive its direct
61
+ * output.system push and assert the ledger emission is recorded exactly once.
62
+ */
63
+ export declare const _test_exports: {
64
+ maybeAppendSpecDriftAdvisory: typeof maybeAppendSpecDriftAdvisory;
65
+ };
66
+ export {};
@@ -77,5 +77,16 @@ export declare function composeBlockingHandlers<I, O>(...fns: Array<HookHandler<
77
77
  */
78
78
  export declare function validateSwarmPath(directory: string, filename: string): string;
79
79
  export declare function readSwarmFileAsync(directory: string, filename: string, cache?: Map<string, Promise<string | null>>): Promise<string | null>;
80
+ /**
81
+ * Estimate tokens from a character count using the canonical heuristic.
82
+ * This is the single sanctioned numeric form (issue #2107 §1).
83
+ */
84
+ export declare function estimateTokensFromCharCount(chars: number): number;
85
+ /**
86
+ * Inverse of the canonical estimator: the character budget that corresponds to a
87
+ * token budget. Floor, so the result never overruns the token budget when converted
88
+ * back with `estimateTokensFromCharCount`.
89
+ */
90
+ export declare function estimateCharsForTokens(tokens: number): number;
80
91
  export declare function estimateTokens(text: string): number;
81
92
  export {};