@0xmaxma/claude-gateway 1.7.8 → 1.7.10

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 (125) hide show
  1. package/README.md +11 -3
  2. package/dist/agent/dreaming/accept.d.ts.map +1 -1
  3. package/dist/agent/dreaming/accept.js +4 -1
  4. package/dist/agent/dreaming/accept.js.map +1 -1
  5. package/dist/agent/dreaming/config.d.ts.map +1 -1
  6. package/dist/agent/dreaming/config.js +2 -0
  7. package/dist/agent/dreaming/config.js.map +1 -1
  8. package/dist/agent/dreaming/reviewer.d.ts.map +1 -1
  9. package/dist/agent/dreaming/reviewer.js +9 -2
  10. package/dist/agent/dreaming/reviewer.js.map +1 -1
  11. package/dist/agent/dreaming/staleness.d.ts +7 -1
  12. package/dist/agent/dreaming/staleness.d.ts.map +1 -1
  13. package/dist/agent/dreaming/staleness.js +17 -2
  14. package/dist/agent/dreaming/staleness.js.map +1 -1
  15. package/dist/agent/dreaming/types.d.ts +17 -1
  16. package/dist/agent/dreaming/types.d.ts.map +1 -1
  17. package/dist/agent/knowledge/archive-db.d.ts +43 -0
  18. package/dist/agent/knowledge/archive-db.d.ts.map +1 -1
  19. package/dist/agent/knowledge/archive-db.js +130 -0
  20. package/dist/agent/knowledge/archive-db.js.map +1 -1
  21. package/dist/agent/knowledge/config.d.ts +3 -1
  22. package/dist/agent/knowledge/config.d.ts.map +1 -1
  23. package/dist/agent/knowledge/config.js +30 -1
  24. package/dist/agent/knowledge/config.js.map +1 -1
  25. package/dist/agent/knowledge/index.d.ts +11 -4
  26. package/dist/agent/knowledge/index.d.ts.map +1 -1
  27. package/dist/agent/knowledge/index.js +22 -1
  28. package/dist/agent/knowledge/index.js.map +1 -1
  29. package/dist/agent/knowledge/indexer.d.ts +0 -7
  30. package/dist/agent/knowledge/indexer.d.ts.map +1 -1
  31. package/dist/agent/knowledge/indexer.js +34 -7
  32. package/dist/agent/knowledge/indexer.js.map +1 -1
  33. package/dist/agent/knowledge/lifecycle.d.ts +20 -4
  34. package/dist/agent/knowledge/lifecycle.d.ts.map +1 -1
  35. package/dist/agent/knowledge/lifecycle.js +33 -4
  36. package/dist/agent/knowledge/lifecycle.js.map +1 -1
  37. package/dist/agent/knowledge/reflection.d.ts +114 -0
  38. package/dist/agent/knowledge/reflection.d.ts.map +1 -0
  39. package/dist/agent/knowledge/reflection.js +447 -0
  40. package/dist/agent/knowledge/reflection.js.map +1 -0
  41. package/dist/agent/knowledge/shared-dedup.d.ts +85 -0
  42. package/dist/agent/knowledge/shared-dedup.d.ts.map +1 -0
  43. package/dist/agent/knowledge/shared-dedup.js +187 -0
  44. package/dist/agent/knowledge/shared-dedup.js.map +1 -0
  45. package/dist/agent/knowledge/shared-promote.d.ts +82 -7
  46. package/dist/agent/knowledge/shared-promote.d.ts.map +1 -1
  47. package/dist/agent/knowledge/shared-promote.js +244 -11
  48. package/dist/agent/knowledge/shared-promote.js.map +1 -1
  49. package/dist/agent/knowledge/shared-staleness.d.ts +51 -0
  50. package/dist/agent/knowledge/shared-staleness.d.ts.map +1 -0
  51. package/dist/agent/knowledge/shared-staleness.js +149 -0
  52. package/dist/agent/knowledge/shared-staleness.js.map +1 -0
  53. package/dist/agent/knowledge/shared-writer.d.ts +19 -0
  54. package/dist/agent/knowledge/shared-writer.d.ts.map +1 -1
  55. package/dist/agent/knowledge/shared-writer.js +42 -0
  56. package/dist/agent/knowledge/shared-writer.js.map +1 -1
  57. package/dist/agent/knowledge/types.d.ts +24 -0
  58. package/dist/agent/knowledge/types.d.ts.map +1 -1
  59. package/dist/agent/runner.d.ts +7 -0
  60. package/dist/agent/runner.d.ts.map +1 -1
  61. package/dist/agent/runner.js +106 -16
  62. package/dist/agent/runner.js.map +1 -1
  63. package/dist/agent/workspace-loader.d.ts +17 -2
  64. package/dist/agent/workspace-loader.d.ts.map +1 -1
  65. package/dist/agent/workspace-loader.js +17 -1
  66. package/dist/agent/workspace-loader.js.map +1 -1
  67. package/dist/api/gateway-router.d.ts.map +1 -1
  68. package/dist/api/gateway-router.js +2 -1
  69. package/dist/api/gateway-router.js.map +1 -1
  70. package/dist/api/line-webhook-router.d.ts.map +1 -1
  71. package/dist/api/line-webhook-router.js +7 -15
  72. package/dist/api/line-webhook-router.js.map +1 -1
  73. package/dist/api/slack-client.d.ts +25 -2
  74. package/dist/api/slack-client.d.ts.map +1 -1
  75. package/dist/api/slack-client.js +102 -0
  76. package/dist/api/slack-client.js.map +1 -1
  77. package/dist/api/slack-webhook-router.d.ts +15 -1
  78. package/dist/api/slack-webhook-router.d.ts.map +1 -1
  79. package/dist/api/slack-webhook-router.js +128 -1
  80. package/dist/api/slack-webhook-router.js.map +1 -1
  81. package/dist/apps/compose-generator.js +7 -4
  82. package/dist/apps/compose-generator.js.map +1 -1
  83. package/dist/apps/installer.d.ts +86 -0
  84. package/dist/apps/installer.d.ts.map +1 -1
  85. package/dist/apps/installer.js +440 -52
  86. package/dist/apps/installer.js.map +1 -1
  87. package/dist/index.js +37 -1
  88. package/dist/index.js.map +1 -1
  89. package/dist/session/compactor.d.ts +32 -2
  90. package/dist/session/compactor.d.ts.map +1 -1
  91. package/dist/session/compactor.js +134 -19
  92. package/dist/session/compactor.js.map +1 -1
  93. package/dist/session/process.d.ts +20 -3
  94. package/dist/session/process.d.ts.map +1 -1
  95. package/dist/session/process.js +120 -5
  96. package/dist/session/process.js.map +1 -1
  97. package/dist/shared/image-sniff.d.ts +15 -0
  98. package/dist/shared/image-sniff.d.ts.map +1 -0
  99. package/dist/shared/image-sniff.js +29 -0
  100. package/dist/shared/image-sniff.js.map +1 -0
  101. package/dist/shell/claude-pty-shell.js +146 -27
  102. package/dist/shell/claude-pty-shell.js.map +1 -1
  103. package/dist/shell/draft-phantom.d.ts +49 -0
  104. package/dist/shell/draft-phantom.d.ts.map +1 -0
  105. package/dist/shell/draft-phantom.js +59 -0
  106. package/dist/shell/draft-phantom.js.map +1 -0
  107. package/dist/shell/submit-diag.d.ts +67 -0
  108. package/dist/shell/submit-diag.d.ts.map +1 -0
  109. package/dist/shell/submit-diag.js +69 -0
  110. package/dist/shell/submit-diag.js.map +1 -0
  111. package/dist/types.d.ts +25 -0
  112. package/dist/types.d.ts.map +1 -1
  113. package/mcp/tools/discord/module.ts +24 -17
  114. package/mcp/tools/memory/archive-reader.test.ts +25 -1
  115. package/mcp/tools/memory/archive-reader.ts +70 -12
  116. package/mcp/tools/memory/archive-writer.test.ts +168 -0
  117. package/mcp/tools/memory/archive-writer.ts +137 -0
  118. package/mcp/tools/memory/module.test.ts +187 -0
  119. package/mcp/tools/memory/module.ts +192 -6
  120. package/mcp/tools/shared/limits.ts +14 -0
  121. package/mcp/tools/slack/module.ts +66 -4
  122. package/mcp/tools/telegram/module.ts +11 -3
  123. package/mcp/tools/telegram/receiver-server.ts +10 -3
  124. package/mcp/tools/telegram/typing.ts +178 -34
  125. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflection.js","sourceRoot":"","sources":["../../../src/agent/knowledge/reflection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CH,oDAUC;AAWD,kDAQC;AAOD,gDAEC;AASD,kDA2BC;AAtHD,6CAAyC;AACzC,uCAA+C;AAC/C,qCAAwD;AACxD,mDAAiD;AACjD,yDAA+F;AAC/F,iCAAyE;AACzE,2CAA6B;AAC7B,qDAA8D;AAC9D,yDAAiF;AAGjF,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACnC;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,KAAM,CAAC;AACrC,MAAM,aAAa,GAA2B,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE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tE,uEAAuE;YACvE,sEAAsE;YACtE,iEAAiE;YACjE,qCAAqC;YACrC,EAAE;YACF,wEAAwE;YACxE,0EAA0E;YAC1E,yEAAyE;YACzE,4EAA4E;YAC5E,uEAAuE;YACvE,+DAA+D;YAC/D,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC1D,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC;YAC5C,MAAM,WAAW,GAAG,kBAAkB,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;YACpE,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC3B,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;oBAC5D,iBAAiB;gBACnB,CAAC,CAAC,CAAC;gBACH,QAAQ,EAAE,CAAC;YACb,CAAC,EAAE,KAAK,CAAC,CAAC;YACV,IAAI,OAAQ,IAAI,CAAC,KAAwB,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;gBAC9D,IAAI,CAAC,KAAwB,CAAC,KAAK,EAAE,CAAC;YACzC,CAAC;QACH,CAAC,CAAC;QACF,QAAQ,EAAE,CAAC;IACb,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,KAAK;YAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;CACF;AAtLD,0DAsLC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Node-native near-duplicate search over the shared vault's `kb.sqlite`
3
+ * (planning-64 K3 follow-up / issue #386).
4
+ *
5
+ * The shared vault is indexed with the SAME `ArchiveDB` schema the per-agent
6
+ * archive uses (`indexSharedArchive` in `indexer.ts` calls
7
+ * `ArchiveDB.forPath(sharedDbPath(cfg), ...)`), so `ArchiveDB.searchSimilar`
8
+ * works against it unmodified. This exists because the MCP tools'
9
+ * `findSimilarSharedNotes` (`mcp/tools/memory/archive-reader.ts`) runs under
10
+ * Bun (`bun:sqlite`) and cannot be imported from here — the Node gateway
11
+ * process (`node:sqlite`). Same on-disk file, two bindings; keep both in sync.
12
+ */
13
+ import type { ResolvedKnowledgeSharedCfg } from './types';
14
+ export interface SimilarSharedNote {
15
+ /** The note's freeform name (its filename under notes/, minus `.md`). */
16
+ name: string;
17
+ snippet: string;
18
+ }
19
+ /**
20
+ * FTS term budget for a near-dup lookup. `searchSimilar` truncates the seed to
21
+ * this many terms, so the budget has to be split deliberately between the note
22
+ * name and its content (`buildSeedText`) — a long freeform name used to consume
23
+ * all 12 terms and the promoted fact itself never reached the query (issue #398).
24
+ */
25
+ export declare const SEED_TERM_BUDGET = 16;
26
+ /**
27
+ * Find shared notes whose content overlaps `seedText`. Read-only; returns []
28
+ * when the shared index doesn't exist yet or the seed has no usable tokens.
29
+ */
30
+ export declare function findSimilarSharedNotes(cfg: ResolvedKnowledgeSharedCfg, seedText: string, maxResults?: number, maxTerms?: number): SimilarSharedNote[];
31
+ /** Normalized, stopword-free, deduped content tokens of a text. */
32
+ export declare function significantTokens(text: string): Set<string>;
33
+ /**
34
+ * How much of `seed` the `candidate` already covers, in [0, 1]. Containment
35
+ * (not Jaccard) on purpose: a short new fact merging into a long established
36
+ * note is a legitimate near-duplicate, and Jaccard would punish it for the
37
+ * candidate's length alone.
38
+ *
39
+ * Note the asymmetry in the inputs: `seed` is the truncated query text
40
+ * (`buildSeedText`), while `candidate` should be a full note body. The score is
41
+ * therefore "how much of the QUERY this note already says" — the candidate is
42
+ * never penalised for saying more.
43
+ */
44
+ export declare function containmentScore(seed: string, candidate: string): number;
45
+ /**
46
+ * Minimum containment for an UNATTENDED merge. Deliberately strict: creating a
47
+ * separate note when two really were duplicates is a tidy-up cost, while merging
48
+ * two unrelated facts destroys both (the reader can no longer tell which note
49
+ * the fact belongs to). Errors are pushed to the recoverable side.
50
+ *
51
+ * Read this against what the seed actually IS. Callers score against
52
+ * `buildSeedText`'s output, which is capped at `SEED_TERM_BUDGET` significant
53
+ * tokens (a minority from the name, the rest from the fact) — so the bar is "half
54
+ * of the fact's first ~11 topic words are already in this note", not "half of the
55
+ * whole fact". That is looser than the bare number reads, and deliberately so:
56
+ * the cap is what keeps the FTS query itself affordable, and the same truncation
57
+ * has to apply on both sides for the score to mean anything.
58
+ */
59
+ export declare const MIN_MERGE_CONTAINMENT = 0.5;
60
+ /**
61
+ * Minimum containment for emitting a `[[wikilink]]` to a note (issue #386 part
62
+ * B's graph edges). Lower than the merge bar on purpose — the two operations
63
+ * make different claims. A merge asserts "these are the same fact" and destroys
64
+ * the distinction between them; a link only asserts "these are related" and is
65
+ * additive, so the same evidence buys a link long before it buys a merge.
66
+ */
67
+ export declare const MIN_RELATED_CONTAINMENT = 0.25;
68
+ /**
69
+ * Candidates that clear `minContainment` against the seed, best first.
70
+ *
71
+ * `resolveText` decides WHAT the candidate is scored against. It defaults to the
72
+ * FTS snippet, but callers that can read the note should pass its full body: a
73
+ * snippet is one 500-char chunk, so an established note that a recurring topic
74
+ * has merged into for months spreads the seed's tokens across several chunks and
75
+ * scores far below its true containment — turning the bar into "much stricter
76
+ * than 0.5" for exactly the notes that most need to match (issue #398 review).
77
+ */
78
+ export declare function filterNearDuplicates(seedText: string, candidates: SimilarSharedNote[], minContainment?: number, resolveText?: (c: SimilarSharedNote) => string): SimilarSharedNote[];
79
+ /**
80
+ * Balanced FTS seed for a promotion lookup: the name gets a minority share of
81
+ * `SEED_TERM_BUDGET` and the promoted fact gets the rest, so a long freeform
82
+ * `reason` can no longer starve the content out of the query (issue #398).
83
+ */
84
+ export declare function buildSeedText(name: string, content: string, budget?: number): string;
85
+ //# sourceMappingURL=shared-dedup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-dedup.d.ts","sourceRoot":"","sources":["../../../src/agent/knowledge/shared-dedup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,0BAA0B,EAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,SAAI,EACd,QAAQ,SAAmB,GAC1B,iBAAiB,EAAE,CASrB;AA0BD,mEAAmE;AACnE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAQ3D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAOxE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,iBAAiB,EAAE,EAC/B,cAAc,SAAwB,EACtC,WAAW,GAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,MAAyB,GAC/D,iBAAiB,EAAE,CAMrB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAmB,GAAG,MAAM,CAK9F"}
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ /**
3
+ * Node-native near-duplicate search over the shared vault's `kb.sqlite`
4
+ * (planning-64 K3 follow-up / issue #386).
5
+ *
6
+ * The shared vault is indexed with the SAME `ArchiveDB` schema the per-agent
7
+ * archive uses (`indexSharedArchive` in `indexer.ts` calls
8
+ * `ArchiveDB.forPath(sharedDbPath(cfg), ...)`), so `ArchiveDB.searchSimilar`
9
+ * works against it unmodified. This exists because the MCP tools'
10
+ * `findSimilarSharedNotes` (`mcp/tools/memory/archive-reader.ts`) runs under
11
+ * Bun (`bun:sqlite`) and cannot be imported from here — the Node gateway
12
+ * process (`node:sqlite`). Same on-disk file, two bindings; keep both in sync.
13
+ */
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ var desc = Object.getOwnPropertyDescriptor(m, k);
17
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
+ desc = { enumerable: true, get: function() { return m[k]; } };
19
+ }
20
+ Object.defineProperty(o, k2, desc);
21
+ }) : (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ }));
25
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
27
+ }) : function(o, v) {
28
+ o["default"] = v;
29
+ });
30
+ var __importStar = (this && this.__importStar) || (function () {
31
+ var ownKeys = function(o) {
32
+ ownKeys = Object.getOwnPropertyNames || function (o) {
33
+ var ar = [];
34
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
+ return ar;
36
+ };
37
+ return ownKeys(o);
38
+ };
39
+ return function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
+ __setModuleDefault(result, mod);
44
+ return result;
45
+ };
46
+ })();
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.MIN_RELATED_CONTAINMENT = exports.MIN_MERGE_CONTAINMENT = exports.SEED_TERM_BUDGET = void 0;
49
+ exports.findSimilarSharedNotes = findSimilarSharedNotes;
50
+ exports.significantTokens = significantTokens;
51
+ exports.containmentScore = containmentScore;
52
+ exports.filterNearDuplicates = filterNearDuplicates;
53
+ exports.buildSeedText = buildSeedText;
54
+ const fs = __importStar(require("fs"));
55
+ const path = __importStar(require("path"));
56
+ const archive_db_1 = require("./archive-db");
57
+ const config_1 = require("./config");
58
+ /**
59
+ * FTS term budget for a near-dup lookup. `searchSimilar` truncates the seed to
60
+ * this many terms, so the budget has to be split deliberately between the note
61
+ * name and its content (`buildSeedText`) — a long freeform name used to consume
62
+ * all 12 terms and the promoted fact itself never reached the query (issue #398).
63
+ */
64
+ exports.SEED_TERM_BUDGET = 16;
65
+ /**
66
+ * Find shared notes whose content overlaps `seedText`. Read-only; returns []
67
+ * when the shared index doesn't exist yet or the seed has no usable tokens.
68
+ */
69
+ function findSimilarSharedNotes(cfg, seedText, maxResults = 3, maxTerms = exports.SEED_TERM_BUDGET) {
70
+ const dbPath = (0, config_1.sharedDbPath)(cfg);
71
+ if (!fs.existsSync(dbPath))
72
+ return [];
73
+ const db = archive_db_1.ArchiveDB.forPath(dbPath);
74
+ const hits = db.searchSimilar(seedText, maxResults, maxTerms);
75
+ return hits.map((h) => ({
76
+ name: path.basename(h.path, '.md'),
77
+ snippet: h.text.length > 500 ? `${h.text.slice(0, 500)}…` : h.text,
78
+ }));
79
+ }
80
+ // ── Near-duplicate gate (issue #398) ────────────────────────────────────────
81
+ //
82
+ // FTS above is RECALL only: `searchSimilar` ORs the seed's tokens, so a single
83
+ // shared word is enough to return a hit. Auto-promotion used to treat any hit
84
+ // as a near-duplicate and merge into it unattended, which fused unrelated notes
85
+ // together (a live vault had 39 of 48 chunks matching a typical seed). Recall
86
+ // stays loose — a real near-dup rarely repeats every word — and the PRECISION
87
+ // bar below decides what may actually be merged.
88
+ //
89
+ // The bar is deterministic token containment rather than a BM25 cutoff: BM25 is
90
+ // corpus-relative, so a threshold tuned on one vault silently changes meaning as
91
+ // the vault grows. Containment ("how much of the seed does this note already
92
+ // say?") is stable, explainable, and testable offline.
93
+ /** Tokens carried by markdown/prose scaffolding rather than by the fact itself. */
94
+ const STOPWORDS = new Set([
95
+ 'a', 'an', 'and', 'are', 'as', 'at', 'be', 'because', 'been', 'but', 'by', 'for', 'from', 'had', 'has', 'have', 'he', 'her', 'his',
96
+ 'how', 'i', 'if', 'in', 'into', 'is', 'it', 'its', 'me', 'my', 'need', 'needs', 'new', 'not', 'of', 'on', 'or', 'our', 'she', 'so',
97
+ 'that', 'the', 'their', 'them', 'then', 'there', 'these', 'they', 'this', 'to', 'up', 'use', 'used', 'user', 'was', 'we',
98
+ 'were', 'what', 'when', 'where', 'which', 'while', 'who', 'why', 'will', 'with', 'would', 'you', 'your',
99
+ // markdown / memory-file scaffolding: present in almost every promoted line
100
+ 'md', 'memory', 'index', 'entry', 'note', 'notes', 'pointer', 'pointers', 'add', 'added', 'insert', 'section', 'file', 'files',
101
+ ]);
102
+ /** Normalized, stopword-free, deduped content tokens of a text. */
103
+ function significantTokens(text) {
104
+ const out = new Set();
105
+ for (const raw of text.toLowerCase().split(/[^\p{L}\p{N}_]+/u)) {
106
+ if (raw.length < 3)
107
+ continue; // 1-2 char fragments carry no topic signal
108
+ if (STOPWORDS.has(raw))
109
+ continue;
110
+ out.add(raw);
111
+ }
112
+ return out;
113
+ }
114
+ /**
115
+ * How much of `seed` the `candidate` already covers, in [0, 1]. Containment
116
+ * (not Jaccard) on purpose: a short new fact merging into a long established
117
+ * note is a legitimate near-duplicate, and Jaccard would punish it for the
118
+ * candidate's length alone.
119
+ *
120
+ * Note the asymmetry in the inputs: `seed` is the truncated query text
121
+ * (`buildSeedText`), while `candidate` should be a full note body. The score is
122
+ * therefore "how much of the QUERY this note already says" — the candidate is
123
+ * never penalised for saying more.
124
+ */
125
+ function containmentScore(seed, candidate) {
126
+ const a = significantTokens(seed);
127
+ if (a.size === 0)
128
+ return 0;
129
+ const b = significantTokens(candidate);
130
+ let hit = 0;
131
+ for (const t of a)
132
+ if (b.has(t))
133
+ hit++;
134
+ return hit / a.size;
135
+ }
136
+ /**
137
+ * Minimum containment for an UNATTENDED merge. Deliberately strict: creating a
138
+ * separate note when two really were duplicates is a tidy-up cost, while merging
139
+ * two unrelated facts destroys both (the reader can no longer tell which note
140
+ * the fact belongs to). Errors are pushed to the recoverable side.
141
+ *
142
+ * Read this against what the seed actually IS. Callers score against
143
+ * `buildSeedText`'s output, which is capped at `SEED_TERM_BUDGET` significant
144
+ * tokens (a minority from the name, the rest from the fact) — so the bar is "half
145
+ * of the fact's first ~11 topic words are already in this note", not "half of the
146
+ * whole fact". That is looser than the bare number reads, and deliberately so:
147
+ * the cap is what keeps the FTS query itself affordable, and the same truncation
148
+ * has to apply on both sides for the score to mean anything.
149
+ */
150
+ exports.MIN_MERGE_CONTAINMENT = 0.5;
151
+ /**
152
+ * Minimum containment for emitting a `[[wikilink]]` to a note (issue #386 part
153
+ * B's graph edges). Lower than the merge bar on purpose — the two operations
154
+ * make different claims. A merge asserts "these are the same fact" and destroys
155
+ * the distinction between them; a link only asserts "these are related" and is
156
+ * additive, so the same evidence buys a link long before it buys a merge.
157
+ */
158
+ exports.MIN_RELATED_CONTAINMENT = 0.25;
159
+ /**
160
+ * Candidates that clear `minContainment` against the seed, best first.
161
+ *
162
+ * `resolveText` decides WHAT the candidate is scored against. It defaults to the
163
+ * FTS snippet, but callers that can read the note should pass its full body: a
164
+ * snippet is one 500-char chunk, so an established note that a recurring topic
165
+ * has merged into for months spreads the seed's tokens across several chunks and
166
+ * scores far below its true containment — turning the bar into "much stricter
167
+ * than 0.5" for exactly the notes that most need to match (issue #398 review).
168
+ */
169
+ function filterNearDuplicates(seedText, candidates, minContainment = exports.MIN_MERGE_CONTAINMENT, resolveText = (c) => c.snippet) {
170
+ return candidates
171
+ .map((c) => ({ c, score: containmentScore(seedText, resolveText(c)) }))
172
+ .filter((x) => x.score >= minContainment)
173
+ .sort((x, y) => y.score - x.score)
174
+ .map((x) => x.c);
175
+ }
176
+ /**
177
+ * Balanced FTS seed for a promotion lookup: the name gets a minority share of
178
+ * `SEED_TERM_BUDGET` and the promoted fact gets the rest, so a long freeform
179
+ * `reason` can no longer starve the content out of the query (issue #398).
180
+ */
181
+ function buildSeedText(name, content, budget = exports.SEED_TERM_BUDGET) {
182
+ const nameBudget = Math.max(1, Math.floor(budget / 3));
183
+ const nameTokens = [...significantTokens(name)].slice(0, nameBudget);
184
+ const contentTokens = [...significantTokens(content)].filter((t) => !nameTokens.includes(t));
185
+ return [...nameTokens, ...contentTokens].slice(0, budget).join(' ');
186
+ }
187
+ //# sourceMappingURL=shared-dedup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-dedup.js","sourceRoot":"","sources":["../../../src/agent/knowledge/shared-dedup.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BH,wDAcC;AA2BD,8CAQC;AAaD,4CAOC;AAqCD,oDAWC;AAOD,sCAKC;AAzJD,uCAAyB;AACzB,2CAA6B;AAC7B,6CAAyC;AACzC,qCAAwC;AASxC;;;;;GAKG;AACU,QAAA,gBAAgB,GAAG,EAAE,CAAC;AAEnC;;;GAGG;AACH,SAAgB,sBAAsB,CACpC,GAA+B,EAC/B,QAAgB,EAChB,UAAU,GAAG,CAAC,EACd,QAAQ,GAAG,wBAAgB;IAE3B,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,GAAG,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IACtC,MAAM,EAAE,GAAG,sBAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC9D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;Q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,UAAU,EAAE,GAAG,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC"}
@@ -1,18 +1,93 @@
1
+ import { writeSharedNote } from './shared-writer';
1
2
  import type { KnowledgeSharedConfig } from './types';
3
+ /**
4
+ * Merge a newly-promoted fact into a note's existing content, rather than
5
+ * blindly overwriting it. Deterministic append (no extra LLM call — dreaming
6
+ * already spent its budget proposing the fact); a no-op if the addition is
7
+ * already present verbatim. `relatedNames` (issue #386 part B) adds
8
+ * `[[wikilink]]`s to OTHER near-duplicate notes found alongside the merge
9
+ * target, so the existing (previously unpopulated) `/knowledge/graph`
10
+ * dashboard gets real edges — `wiki.ts` already resolves `[[links]]` into
11
+ * graph edges, no parser change needed.
12
+ */
13
+ export declare function mergeIntoNote(existing: string, addition: string, relatedNames?: string[]): string;
14
+ /**
15
+ * Write only if the result stays within the same size cap the manual
16
+ * `memory_shared_create`/`_update` tools enforce. Unlike those tools, dreaming
17
+ * has no one to show a "content too large" error to — a note a recurring topic
18
+ * keeps merging into over months has no natural stopping point otherwise, so
19
+ * once a merge would cross the cap the note is left as-is (best-effort: a
20
+ * skipped promotion never fails the local dream, same as any other error here).
21
+ */
22
+ export declare function writeCapped(cfg: Parameters<typeof writeSharedNote>[0], name: string, content: string, relatedNames?: string[]): boolean;
23
+ /**
24
+ * True when the content is nothing but `MEMORY.md` index pointers.
25
+ *
26
+ * The memory-tiering convention writes a fact to its own file AND a one-line
27
+ * pointer into the `MEMORY.md` index. Both land as durable `add`s, so both used
28
+ * to be promoted — and the pointer's links resolve only inside the promoting
29
+ * agent's own workspace, making it dead weight in a shared vault (issue #398:
30
+ * 30 of 40 live notes were pointer-only, with all 32 link targets dangling).
31
+ *
32
+ * The trailing hook text is deliberately NOT rescued into a note of its own: an
33
+ * index hook is written to be read next to the file it points at, so promoting
34
+ * it alone would put a decontextualized fragment in front of every other agent.
35
+ * A dream that proposes the fact itself as prose still promotes normally — only
36
+ * navigation scaffolding is dropped.
37
+ */
38
+ export declare function isIndexPointerOnly(content: string): boolean;
39
+ /**
40
+ * True when a note name reads as an instruction for editing a file rather than
41
+ * as the name of a fact ("insert after cron config, before the pty_shell
42
+ * section"). `reason` is prompted as free-form justification (`reviewer.ts`) but
43
+ * issue #386 repurposed it as the shared note's identity, so such strings became
44
+ * note names that no future occurrence of the same fact can ever match.
45
+ *
46
+ * Two signals are required — an imperative edit verb AND a positional/file
47
+ * anchor — because either alone is common in legitimate names ("Add-on billing
48
+ * is per seat", "the section header is user-visible").
49
+ */
50
+ export declare function isInstructionShapedName(name: string): boolean;
51
+ /**
52
+ * A note name derived from the fact itself — the fallback when the proposal has
53
+ * no `topic` and its `reason` reads as an editing instruction.
54
+ *
55
+ * Dropping such a promotion outright (the first cut of issue #398) silently lost
56
+ * genuine facts whose reason merely happened to start with an edit verb, e.g.
57
+ * "Update the deploy section after the API change". Naming from the content
58
+ * keeps the fact; only content with nothing nameable in it is given up on.
59
+ */
60
+ export declare function deriveNameFromContent(content: string): string | undefined;
2
61
  /**
3
62
  * Build the per-agent→shared promotion function used after the dreaming applier
4
63
  * writes an `add` to local memory (K3↔K4). Returns `undefined` when the shared
5
64
  * KB is disabled or in `propose` (dry-run) mode — callers then skip promotion.
6
65
  *
7
- * A durable add is written to the shared vault under a **content-hashed**
8
- * filename so two proposals whose reasons slug to the same name (or a recurring
9
- * nightly reason) can't silently overwrite each other, and identical content
10
- * maps to the same file (idempotent). Extracted here so both the nightly
11
- * auto-applier (src/index.ts) and the manual dashboard accept endpoint share one
12
- * implementation.
66
+ * Note identity is the proposal's `reason` (issue #386) — the SAME freeform
67
+ * namespace `memory_shared_create`/`_update` use, not a content hash. A
68
+ * content-hashed name (the pre-#386 scheme) meant the same recurring fact,
69
+ * reworded slightly by the reviewer each night, hashed differently and was
70
+ * written as a brand-new note every time — this is what created the
71
+ * near-duplicate pileup #386 reports. Naming by `reason` instead means the
72
+ * same recurring fact maps to the same note name across nights, landing as an
73
+ * update. A `reason` that doesn't collide by name is also checked against the
74
+ * shared vault's near-dup search before creating, and merged into the closest
75
+ * match instead of creating a disconnected duplicate when one is found.
76
+ *
77
+ * Concurrency note: the name-collision check, read, and write below are not one
78
+ * atomic operation, so two agents dreaming at the same moment and promoting
79
+ * under the exact same `reason` can race — `shared-writer.ts` already documents
80
+ * that same-file races resolve to last-write-wins, never corruption, and other
81
+ * read-modify-write callers (e.g. `memory_shared_update`) have this same
82
+ * property. Naming by `reason` instead of a content hash makes same-name
83
+ * collisions between different agents more likely than the pre-#386 scheme, but
84
+ * it's the same accepted tradeoff, not a new class of risk.
13
85
  */
14
- export declare function makeSharedPromoter(agentId: string, agentCfg: KnowledgeSharedConfig | undefined, globalCfg: KnowledgeSharedConfig | undefined): ((p: {
86
+ export declare function makeSharedPromoter(agentId: string, agentCfg: KnowledgeSharedConfig | undefined, globalCfg: KnowledgeSharedConfig | undefined, logger?: {
87
+ info: (msg: string, data?: Record<string, unknown>) => void;
88
+ }): ((p: {
15
89
  reason: string;
16
90
  content?: string;
91
+ topic?: string;
17
92
  }) => void) | undefined;
18
93
  //# sourceMappingURL=shared-promote.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-promote.d.ts","sourceRoot":"","sources":["../../../src/agent/knowledge/shared-promote.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,qBAAqB,GAAG,SAAS,EAC3C,SAAS,EAAE,qBAAqB,GAAG,SAAS,GAC3C,CAAC,CAAC,CAAC,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,CAAC,GAAG,SAAS,CAQjE"}
1
+ {"version":3,"file":"shared-promote.d.ts","sourceRoot":"","sources":["../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