opencode-swarm 7.88.3 → 7.89.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 (49) hide show
  1. package/dist/agents/agent-output-schema.d.ts +1 -1
  2. package/dist/agents/curator-agent.d.ts +1 -1
  3. package/dist/agents/explorer.d.ts +1 -0
  4. package/dist/cli/{config-doctor-jzbgpbdh.js → config-doctor-g04wdz19.js} +2 -2
  5. package/dist/cli/{explorer-gz70sm9b.js → explorer-h2fnj343.js} +4 -2
  6. package/dist/cli/{guardrail-explain-eqypvw60.js → guardrail-explain-hy0zz0p6.js} +8 -8
  7. package/dist/cli/{guardrail-log-c7egm5km.js → guardrail-log-m3285thy.js} +3 -3
  8. package/dist/cli/{index-0asbrmdx.js → index-123s7kjc.js} +88 -2
  9. package/dist/cli/{index-32axfg6h.js → index-1ccnwh54.js} +98 -25
  10. package/dist/cli/{index-ds057q5k.js → index-6k31ysgd.js} +2 -2
  11. package/dist/cli/{index-g00qm2gf.js → index-6tnmt41c.js} +1 -1
  12. package/dist/cli/{index-g6f4tt38.js → index-9w07ye9b.js} +906 -431
  13. package/dist/cli/{index-e8pk68cc.js → index-axwxkbdd.js} +166 -23
  14. package/dist/cli/{index-yhsmmv2z.js → index-bm4f0nme.js} +25 -1
  15. package/dist/cli/{index-819xp49y.js → index-bywt2171.js} +1 -1
  16. package/dist/cli/{index-0rt5aamg.js → index-dprk5c5f.js} +13 -9
  17. package/dist/cli/{index-vjsr9bqt.js → index-gg589mfw.js} +1 -1
  18. package/dist/cli/index.js +7 -7
  19. package/dist/cli/{knowledge-store-n4x6zyk7.js → knowledge-store-gsy6p46z.js} +1 -1
  20. package/dist/cli/{schema-vb6jkxgg.js → schema-t9th7frq.js} +1 -1
  21. package/dist/cli/{skill-generator-kz4q8e49.js → skill-generator-1hzfyhth.js} +2 -2
  22. package/dist/commands/index.d.ts +2 -0
  23. package/dist/commands/link.d.ts +19 -0
  24. package/dist/commands/memory.d.ts +1 -0
  25. package/dist/commands/registry.d.ts +31 -0
  26. package/dist/commands/unlink.d.ts +13 -0
  27. package/dist/config/agent-names.d.ts +2 -2
  28. package/dist/config/schema.d.ts +60 -0
  29. package/dist/hooks/curator-llm-factory.d.ts +1 -1
  30. package/dist/hooks/knowledge-events.d.ts +3 -3
  31. package/dist/hooks/knowledge-link.d.ts +82 -0
  32. package/dist/hooks/knowledge-validator.d.ts +1 -1
  33. package/dist/index.js +3177 -1765
  34. package/dist/knowledge/identity.d.ts +9 -0
  35. package/dist/memory/config.d.ts +35 -0
  36. package/dist/memory/consolidation-log.d.ts +29 -0
  37. package/dist/memory/consolidation.d.ts +124 -0
  38. package/dist/memory/decay.d.ts +24 -0
  39. package/dist/memory/gateway.d.ts +14 -2
  40. package/dist/memory/maintenance.d.ts +18 -0
  41. package/dist/memory/run-log.d.ts +8 -1
  42. package/dist/memory/schema.d.ts +3 -3
  43. package/dist/memory/scoring.d.ts +45 -0
  44. package/dist/memory/sentinel.d.ts +15 -0
  45. package/dist/services/memory-consolidation.d.ts +32 -0
  46. package/dist/services/skill-generator.d.ts +8 -1
  47. package/dist/session/worktree-link-suggestion.d.ts +27 -0
  48. package/dist/state.d.ts +4 -2
  49. package/package.json +1 -1
@@ -146,12 +146,12 @@ export type KnowledgeEventInput = KnowledgeEvent extends infer T ? T extends Kno
146
146
  } : never : never;
147
147
  /** Receipt event verbs that reference a single knowledge_id. */
148
148
  export declare const RECEIPT_EVENT_TYPES: ReadonlySet<string>;
149
- /** Returns `.swarm/knowledge-events.jsonl` for the given project directory. */
149
+ /** Returns the knowledge-events.jsonl path (link-aware via resolveKnowledgeStoreDir). */
150
150
  export declare function resolveKnowledgeEventsPath(directory: string): string;
151
- /** Returns `.swarm/knowledge-counter-baseline.json` for folded event counters. */
151
+ /** Returns the knowledge-counter-baseline.json path (link-aware). */
152
152
  export declare function resolveKnowledgeCounterBaselinePath(directory: string): string;
153
153
  export declare function resolveHiveEventsPath(): string;
154
- /** Returns `.swarm/knowledge-application.jsonl` for legacy v2 audit records. */
154
+ /** Returns the knowledge-application.jsonl path for legacy v2 audit records (link-aware). */
155
155
  export declare function resolveLegacyApplicationLogPath(directory: string): string;
156
156
  /** Generate a fresh trace id. One per retrieval; receipts reference it. */
157
157
  export declare function newTraceId(): string;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Knowledge "link" resolution for the opencode-swarm knowledge system.
3
+ *
4
+ * Problem: the swarm knowledge tier is rooted at `<directory>/.swarm/`, where
5
+ * `directory` is `ctx.directory`. When several swarms run in separate git
6
+ * worktrees of the same repository, each worktree has its own `.swarm/` and
7
+ * therefore its own isolated knowledge store — lessons one swarm learns are
8
+ * invisible to the others. The hive tier is the opposite extreme: global to
9
+ * EVERY project on the machine.
10
+ *
11
+ * A "link" ties multiple worktrees (or several deliberately "similar" repos)
12
+ * to one shared knowledge store that sits between the per-worktree swarm tier
13
+ * and the global hive tier. Membership is declared by an opt-in pointer file at
14
+ * `<directory>/.swarm/link.json`. When that pointer is active, the swarm
15
+ * knowledge *family* (store, events, rejected, retractions, counters,
16
+ * quarantine, unactionable) redirects from `<directory>/.swarm` to a shared
17
+ * link directory in the platform data dir — co-located with the hive store.
18
+ *
19
+ * Intentionally NOT redirected (stays per-worktree): `.knowledge-shown.json`
20
+ * (phase-keyed, session-local outcome bookkeeping), `plan.json`, evidence, and
21
+ * session state. Only id-keyed / append-only knowledge data is pooled.
22
+ *
23
+ * This module is self-contained (node builtins + the atomic-write helper only)
24
+ * so it can be imported by knowledge-store.ts, knowledge-events.ts, and
25
+ * knowledge-validator.ts without coupling to the heavily test-mocked store
26
+ * module and without import cycles.
27
+ */
28
+ /** On-disk pointer at `<directory>/.swarm/link.json`. */
29
+ export interface LinkPointer {
30
+ version: 1;
31
+ /** Path-safe identifier of the shared store (projectHash or sanitized name). */
32
+ linkId: string;
33
+ /** Human-friendly name when the link was created from an explicit name. */
34
+ name?: string;
35
+ /** ISO 8601 creation timestamp. */
36
+ createdAt: string;
37
+ /** How the link was established. */
38
+ source: 'manual' | 'auto';
39
+ }
40
+ export declare const LINK_POINTER_FILENAME = "link.json";
41
+ /** Root directory under which all shared link stores live: `<dataDir>/links`. */
42
+ export declare function resolveLinkBaseDir(): string;
43
+ /** Directory of the shared knowledge family for a given link id. */
44
+ export declare function resolveLinkDir(linkId: string): string;
45
+ /**
46
+ * Coerce an arbitrary user-supplied name into a single, path-safe directory
47
+ * segment. Returns null when nothing usable remains (caller falls back to the
48
+ * project hash). Lowercased for case-insensitive stability across worktrees.
49
+ */
50
+ export declare function sanitizeLinkId(name: string): string | null;
51
+ /** Read and validate the link pointer for a worktree. Null if absent/invalid. */
52
+ export declare function readLinkPointer(directory: string): LinkPointer | null;
53
+ /** Write the link pointer atomically and invalidate the resolution cache. */
54
+ export declare function writeLinkPointer(directory: string, pointer: LinkPointer): Promise<void>;
55
+ /** Remove the link pointer (idempotent) and invalidate the resolution cache. */
56
+ export declare function removeLinkPointer(directory: string): Promise<void>;
57
+ /**
58
+ * Resolve the directory that holds the swarm knowledge family for `directory`.
59
+ *
60
+ * Returns the shared link directory when an active pointer is present, otherwise
61
+ * the local `<directory>/.swarm`. Fail-open: any read/parse error degrades to the
62
+ * local directory, so a corrupt pointer never strands knowledge. Synchronous and
63
+ * cached so the hot retrieval path pays at most one tiny file read per TTL window.
64
+ *
65
+ * NOTE: when unlinked, the return value is byte-identical to the legacy
66
+ * `path.join(directory, '.swarm')`, so existing callers/tests are unaffected.
67
+ */
68
+ export declare function resolveKnowledgeStoreDir(directory: string): string;
69
+ /** Drop cached resolution(s). Pass a directory to invalidate one, omit for all. */
70
+ export declare function invalidateKnowledgeStoreDirCache(directory?: string): void;
71
+ /** True when the worktree currently redirects to a shared link store. */
72
+ export declare function isLinked(directory: string): boolean;
73
+ export declare const _internals: {
74
+ resolveKnowledgeStoreDir: typeof resolveKnowledgeStoreDir;
75
+ readLinkPointer: typeof readLinkPointer;
76
+ writeLinkPointer: typeof writeLinkPointer;
77
+ removeLinkPointer: typeof removeLinkPointer;
78
+ invalidateKnowledgeStoreDirCache: typeof invalidateKnowledgeStoreDirCache;
79
+ resolveLinkDir: typeof resolveLinkDir;
80
+ resolveLinkBaseDir: typeof resolveLinkBaseDir;
81
+ sanitizeLinkId: typeof sanitizeLinkId;
82
+ };
@@ -68,7 +68,7 @@ export interface ActionabilityResult {
68
68
  * quarantined rather than activated.
69
69
  */
70
70
  export declare function validateActionability(entry: Pick<KnowledgeEntryBase, 'forbidden_actions' | 'required_actions' | 'verification_checks' | 'verification_predicate' | 'applies_to_tools' | 'applies_to_agents'>): ActionabilityResult;
71
- /** Returns `.swarm/knowledge-unactionable.jsonl` for the given directory. */
71
+ /** Returns the knowledge-unactionable.jsonl path for the given directory (link-aware). */
72
72
  export declare function resolveUnactionablePath(directory: string): string;
73
73
  /** One quarantined-unactionable record. */
74
74
  export interface UnactionableRecord extends KnowledgeEntryBase {