opencode-swarm 7.116.1 → 7.117.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 (33) hide show
  1. package/dist/cli/{curator-yxmtp8py.js → curator-fr2m5hna.js} +7 -7
  2. package/dist/cli/{curator-llm-factory-9qn52fnv.js → curator-llm-factory-m0kvna8n.js} +7 -7
  3. package/dist/cli/{guardrail-explain-xvyz2eag.js → guardrail-explain-xjgk822d.js} +8 -8
  4. package/dist/cli/{hive-promoter-ykqc60w1.js → hive-promoter-zpk5jmx0.js} +7 -7
  5. package/dist/cli/{index-34g1mv3c.js → index-4f4zv8pb.js} +28 -6
  6. package/dist/cli/{index-wegc6xwr.js → index-af94ke83.js} +3 -3
  7. package/dist/cli/{index-5h7d37nf.js → index-aws8yhwq.js} +3 -3
  8. package/dist/cli/{index-t5f01hnz.js → index-c9m5skgs.js} +2 -2
  9. package/dist/cli/{index-g4p13g8t.js → index-dc3j6jmk.js} +4 -3
  10. package/dist/cli/{index-wxkf3089.js → index-hskmya46.js} +3 -3
  11. package/dist/cli/{index-efdyjgeh.js → index-n3sm9ewn.js} +1 -1
  12. package/dist/cli/{index-p9jf8gt8.js → index-pgtqxat4.js} +8 -8
  13. package/dist/cli/{index-7kcpkm4y.js → index-vkdr12ek.js} +1473 -867
  14. package/dist/cli/index.js +7 -7
  15. package/dist/cli/{knowledge-escalator-tthw6c9q.js → knowledge-escalator-bmk725p4.js} +4 -4
  16. package/dist/cli/{knowledge-events-hrbmwxxj.js → knowledge-events-px14n75v.js} +2 -2
  17. package/dist/cli/{knowledge-store-5cns5sns.js → knowledge-store-z9znvtn2.js} +2 -2
  18. package/dist/cli/{knowledge-validator-xre0s774.js → knowledge-validator-7r5t821g.js} +3 -3
  19. package/dist/cli/{skill-generator-22nk6c6a.js → skill-generator-4d3w8sqt.js} +5 -5
  20. package/dist/commands/link.d.ts +7 -4
  21. package/dist/commands/unlink.d.ts +12 -5
  22. package/dist/hooks/knowledge-events.d.ts +2 -0
  23. package/dist/hooks/knowledge-link.d.ts +31 -4
  24. package/dist/index.js +211 -203
  25. package/dist/knowledge/cohort-identity.d.ts +103 -0
  26. package/dist/knowledge/config-fingerprint.d.ts +57 -0
  27. package/dist/knowledge/family-manifest.d.ts +50 -0
  28. package/dist/knowledge/family-migration.d.ts +109 -0
  29. package/dist/knowledge/identity.d.ts +12 -2
  30. package/dist/knowledge/index.d.ts +1 -0
  31. package/dist/services/knowledge-diagnostics.d.ts +27 -0
  32. package/dist/services/status-service.d.ts +13 -0
  33. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-7kcpkm4y.js";
10
+ } from "./index-vkdr12ek.js";
11
11
  import"./index-nprawcc0.js";
12
12
  import"./index-8j5d3ytd.js";
13
13
  import"./index-c8s9a3zh.js";
@@ -19,13 +19,13 @@ import"./index-xdsd2hma.js";
19
19
  import"./index-scww5b77.js";
20
20
  import"./index-4905hd2m.js";
21
21
  import"./index-5bcrp3bc.js";
22
- import"./index-wxkf3089.js";
23
- import"./index-t5f01hnz.js";
24
- import"./index-wegc6xwr.js";
25
- import"./index-g4p13g8t.js";
26
- import"./index-5h7d37nf.js";
22
+ import"./index-hskmya46.js";
23
+ import"./index-c9m5skgs.js";
24
+ import"./index-af94ke83.js";
25
+ import"./index-dc3j6jmk.js";
26
+ import"./index-aws8yhwq.js";
27
27
  import"./index-bfwt3abw.js";
28
- import"./index-34g1mv3c.js";
28
+ import"./index-4f4zv8pb.js";
29
29
  import"./index-vxv732ex.js";
30
30
  import"./index-8fwhhayc.js";
31
31
  import"./index-q1exe2b3.js";
@@ -8,11 +8,11 @@ import {
8
8
  maybeEscalateOnViolation,
9
9
  maybeQuarantineOnContradiction,
10
10
  readRecentEscalations
11
- } from "./index-wegc6xwr.js";
12
- import"./index-g4p13g8t.js";
13
- import"./index-5h7d37nf.js";
11
+ } from "./index-af94ke83.js";
12
+ import"./index-dc3j6jmk.js";
13
+ import"./index-aws8yhwq.js";
14
14
  import"./index-bfwt3abw.js";
15
- import"./index-34g1mv3c.js";
15
+ import"./index-4f4zv8pb.js";
16
16
  import"./index-zgwm4ryv.js";
17
17
  import"./index-0pfqcjp6.js";
18
18
  import"./index-42cx6g2h.js";
@@ -25,8 +25,8 @@ import {
25
25
  resolveKnowledgeCounterBaselinePath,
26
26
  resolveKnowledgeEventsPath,
27
27
  resolveLegacyApplicationLogPath
28
- } from "./index-g4p13g8t.js";
29
- import"./index-34g1mv3c.js";
28
+ } from "./index-dc3j6jmk.js";
29
+ import"./index-4f4zv8pb.js";
30
30
  import"./index-zgwm4ryv.js";
31
31
  import"./index-0pfqcjp6.js";
32
32
  import"./index-42cx6g2h.js";
@@ -34,9 +34,9 @@ import {
34
34
  transactFile,
35
35
  transactKnowledge,
36
36
  wordBigrams
37
- } from "./index-5h7d37nf.js";
37
+ } from "./index-aws8yhwq.js";
38
38
  import"./index-bfwt3abw.js";
39
- import"./index-34g1mv3c.js";
39
+ import"./index-4f4zv8pb.js";
40
40
  import"./index-zgwm4ryv.js";
41
41
  import"./index-0pfqcjp6.js";
42
42
  import"./index-42cx6g2h.js";
@@ -23,10 +23,10 @@ import {
23
23
  validateLesson,
24
24
  validateSkillCandidatePath,
25
25
  validateSkillPath
26
- } from "./index-t5f01hnz.js";
27
- import"./index-5h7d37nf.js";
26
+ } from "./index-c9m5skgs.js";
27
+ import"./index-aws8yhwq.js";
28
28
  import"./index-bfwt3abw.js";
29
- import"./index-34g1mv3c.js";
29
+ import"./index-4f4zv8pb.js";
30
30
  import"./index-zgwm4ryv.js";
31
31
  import"./index-0pfqcjp6.js";
32
32
  import"./index-42cx6g2h.js";
@@ -33,12 +33,12 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-wxkf3089.js";
37
- import"./index-t5f01hnz.js";
38
- import"./index-g4p13g8t.js";
39
- import"./index-5h7d37nf.js";
36
+ } from "./index-hskmya46.js";
37
+ import"./index-c9m5skgs.js";
38
+ import"./index-dc3j6jmk.js";
39
+ import"./index-aws8yhwq.js";
40
40
  import"./index-bfwt3abw.js";
41
- import"./index-34g1mv3c.js";
41
+ import"./index-4f4zv8pb.js";
42
42
  import"./index-zgwm4ryv.js";
43
43
  import"./index-0pfqcjp6.js";
44
44
  import"./index-42cx6g2h.js";
@@ -7,13 +7,16 @@
7
7
  * keeping an isolated `.swarm/knowledge.jsonl`.
8
8
  *
9
9
  * Usage:
10
- * - /swarm link — link using the project hash (ties all worktrees
11
- * of the same repo to one shared store).
10
+ * - /swarm link — link using the canonical cohort id (ties all
11
+ * worktrees of the same repo to one shared store).
12
12
  * - /swarm link <name> — link using an explicit shared name (use the same
13
13
  * name in each worktree/repo to tie them together).
14
14
  * - /swarm link status — show the current link state for this worktree.
15
15
  *
16
- * On link, this worktree's existing local lessons are merged (deduplicated) into
17
- * the shared store so nothing already learned is lost.
16
+ * On link, this worktree's existing local knowledge *family* (store, events,
17
+ * rejected, retractions, counters, quarantine, unactionable, application-legacy)
18
+ * is migrated into the shared store per the family manifest, with each member
19
+ * merged according to its strategy (issue #1846). The pointer is flipped only
20
+ * after the migration commits.
18
21
  */
19
22
  export declare function handleLinkCommand(directory: string, args: string[]): Promise<string>;
@@ -2,12 +2,19 @@
2
2
  * Handles the `/swarm unlink` command.
3
3
  *
4
4
  * Stops sharing this worktree's swarm knowledge with its link store and returns
5
- * it to a local `.swarm/knowledge.jsonl`. By default the shared lessons are
6
- * copied back into the local store (deduplicated) so the worktree keeps the
7
- * pooled knowledge it had access to; pass `--no-copy` to skip the copy-back.
5
+ * it to a local `.swarm/knowledge.jsonl`. By default the shared knowledge
6
+ * *family* (store, events, rejected, retractions, counters, quarantine,
7
+ * unactionable, application-legacy) is copied back into the local store per the
8
+ * family manifest so the worktree keeps the pooled knowledge it had access to;
9
+ * pass `--no-copy` to skip the copy-back.
10
+ *
11
+ * The copy-back is transactional (issue #1846): it reads the shared family
12
+ * under the shared-store lock and writes the local family atomically, so a
13
+ * concurrent append in a peer worktree cannot be lost. The shared cohort is
14
+ * never deleted or truncated.
8
15
  *
9
16
  * Usage:
10
- * - /swarm unlink — unlink and copy shared lessons back to local.
11
- * - /swarm unlink --no-copy — unlink without copying shared lessons back.
17
+ * - /swarm unlink — unlink and copy the shared family back to local.
18
+ * - /swarm unlink --no-copy — unlink without copying the shared family back.
12
19
  */
13
20
  export declare function handleUnlinkCommand(directory: string, args: string[]): Promise<string>;
@@ -267,6 +267,7 @@ export interface CounterRollup {
267
267
  }
268
268
  /** Cap on retained per-entry violation timestamps. */
269
269
  export declare const MAX_VIOLATION_TIMESTAMPS = 10;
270
+ declare function mergeRollupInto(target: CounterRollup, source: CounterRollup): void;
270
271
  declare function readCounterBaseline(directory: string): Promise<Map<string, CounterRollup>>;
271
272
  /**
272
273
  * Recompute per-entry counters deterministically from the immutable event log,
@@ -362,5 +363,6 @@ export declare const _internals: {
362
363
  appendHiveKnowledgeEvent: typeof appendHiveKnowledgeEvent;
363
364
  recordHiveKnowledgeEvent: typeof recordHiveKnowledgeEvent;
364
365
  readHiveKnowledgeEvents: typeof readHiveKnowledgeEvents;
366
+ mergeRollupInto: typeof mergeRollupInto;
365
367
  };
366
368
  export {};
@@ -27,7 +27,8 @@
27
27
  */
28
28
  /** On-disk pointer at `<directory>/.swarm/link.json`. */
29
29
  export interface LinkPointer {
30
- version: 1;
30
+ /** Pointer schema version. v1 pointers stay valid; v2 carries cohort metadata. */
31
+ version: 1 | 2;
31
32
  /** Path-safe identifier of the shared store (projectHash or sanitized name). */
32
33
  linkId: string;
33
34
  /** Human-friendly name when the link was created from an explicit name. */
@@ -36,6 +37,16 @@ export interface LinkPointer {
36
37
  createdAt: string;
37
38
  /** How the link was established. */
38
39
  source: 'manual' | 'auto';
40
+ /** Canonical cohort id from `resolveCohortId` (issue #1846). */
41
+ cohortId?: string;
42
+ /** How the cohort id was derived. */
43
+ identitySource?: 'remote' | 'git-common-dir' | 'path';
44
+ /** True when the cohort id is machine-local (git-common-dir/path fallback). */
45
+ degraded?: boolean;
46
+ /** Deterministic hash of cohort-relevant config (issue #1846 §4). */
47
+ configFingerprint?: string;
48
+ /** Monotonic generation counter, bumped on each link/unlink. Aids cache invalidation. */
49
+ generation?: number;
39
50
  }
40
51
  export interface LinkedLocalKnowledgeStatus {
41
52
  linked: boolean;
@@ -55,7 +66,13 @@ export declare function resolveLinkDir(linkId: string): string;
55
66
  * project hash). Lowercased for case-insensitive stability across worktrees.
56
67
  */
57
68
  export declare function sanitizeLinkId(name: string): string | null;
58
- /** Read and validate the link pointer for a worktree. Null if absent/invalid. */
69
+ /**
70
+ * Read and validate the link pointer for a worktree. Null if absent/invalid.
71
+ *
72
+ * Schema-version aware (issue #1846): reads `version` from disk rather than
73
+ * hard-stamping `1`, validates it is a known version, and preserves v2 cohort
74
+ * metadata fields when present. Unknown fields are ignored (forward-compat).
75
+ */
59
76
  export declare function readLinkPointer(directory: string): LinkPointer | null;
60
77
  export declare function getLinkedLocalKnowledgeStatus(directory: string): LinkedLocalKnowledgeStatus;
61
78
  /** Write the link pointer atomically and invalidate the resolution cache. */
@@ -67,8 +84,18 @@ export declare function removeLinkPointer(directory: string): Promise<void>;
67
84
  *
68
85
  * Returns the shared link directory when an active pointer is present, otherwise
69
86
  * the local `<directory>/.swarm`. Fail-open: any read/parse error degrades to the
70
- * local directory, so a corrupt pointer never strands knowledge. Synchronous and
71
- * cached so the hot retrieval path pays at most one tiny file read per TTL window.
87
+ * local directory, so a corrupt pointer never strands knowledge. Synchronous
88
+ * and cached; on a cache hit a cheap `stat` of the pointer file revalidates
89
+ * cross-process changes so the hot retrieval path stays fast while still
90
+ * observing link/unlink without waiting for the TTL to expire.
91
+ *
92
+ * Cross-process revalidation (issue #1846 §2): on a cache hit we additionally
93
+ * `stat` the pointer file and compare `mtimeMs:ctimeMs:size` to the cached
94
+ * fingerprint. A change (another process wrote/removed the pointer) invalidates
95
+ * the entry, so a stale process observes link/unlink without waiting for the
96
+ * TTL to expire. The TTL remains a backstop. The per-call `stat` is negligible
97
+ * (the pointer is tiny and almost never changes) and is the cost of correct
98
+ * cross-process link/unlink observation.
72
99
  *
73
100
  * NOTE: when unlinked, the return value is byte-identical to the legacy
74
101
  * `path.join(directory, '.swarm')`, so existing callers/tests are unaffected.