opencode-harnmem 0.0.0-stage → 0.1.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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -2
  3. package/index.js +512 -0
  4. package/lib/engine.mjs +72 -0
  5. package/lib/format.mjs +119 -0
  6. package/lib/settings.mjs +131 -0
  7. package/package.json +23 -3
  8. package/vendor/core/assets.d.ts +52 -0
  9. package/vendor/core/assets.d.ts.map +1 -0
  10. package/vendor/core/assets.js +227 -0
  11. package/vendor/core/assets.js.map +1 -0
  12. package/vendor/core/config.d.ts +36 -0
  13. package/vendor/core/config.d.ts.map +1 -0
  14. package/vendor/core/config.js +134 -0
  15. package/vendor/core/config.js.map +1 -0
  16. package/vendor/core/consolidate.d.ts +14 -0
  17. package/vendor/core/consolidate.d.ts.map +1 -0
  18. package/vendor/core/consolidate.js +237 -0
  19. package/vendor/core/consolidate.js.map +1 -0
  20. package/vendor/core/data/synonyms.en.txt +61 -0
  21. package/vendor/core/data/synonyms.zh.txt +157 -0
  22. package/vendor/core/extract.d.ts +49 -0
  23. package/vendor/core/extract.d.ts.map +1 -0
  24. package/vendor/core/extract.js +179 -0
  25. package/vendor/core/extract.js.map +1 -0
  26. package/vendor/core/frontmatter.d.ts +31 -0
  27. package/vendor/core/frontmatter.d.ts.map +1 -0
  28. package/vendor/core/frontmatter.js +372 -0
  29. package/vendor/core/frontmatter.js.map +1 -0
  30. package/vendor/core/harnmem.d.ts +87 -0
  31. package/vendor/core/harnmem.d.ts.map +1 -0
  32. package/vendor/core/harnmem.js +918 -0
  33. package/vendor/core/harnmem.js.map +1 -0
  34. package/vendor/core/hot-context.d.ts +28 -0
  35. package/vendor/core/hot-context.d.ts.map +1 -0
  36. package/vendor/core/hot-context.js +179 -0
  37. package/vendor/core/hot-context.js.map +1 -0
  38. package/vendor/core/index.d.ts +16 -0
  39. package/vendor/core/index.d.ts.map +1 -0
  40. package/vendor/core/index.js +10 -0
  41. package/vendor/core/index.js.map +1 -0
  42. package/vendor/core/indexer.d.ts +107 -0
  43. package/vendor/core/indexer.d.ts.map +1 -0
  44. package/vendor/core/indexer.js +282 -0
  45. package/vendor/core/indexer.js.map +1 -0
  46. package/vendor/core/inspect.d.ts +278 -0
  47. package/vendor/core/inspect.d.ts.map +1 -0
  48. package/vendor/core/inspect.js +643 -0
  49. package/vendor/core/inspect.js.map +1 -0
  50. package/vendor/core/lifecycle.d.ts +50 -0
  51. package/vendor/core/lifecycle.d.ts.map +1 -0
  52. package/vendor/core/lifecycle.js +249 -0
  53. package/vendor/core/lifecycle.js.map +1 -0
  54. package/vendor/core/project.d.ts +41 -0
  55. package/vendor/core/project.d.ts.map +1 -0
  56. package/vendor/core/project.js +197 -0
  57. package/vendor/core/project.js.map +1 -0
  58. package/vendor/core/prompts/README.md +96 -0
  59. package/vendor/core/prompts/consolidate-digest.md +31 -0
  60. package/vendor/core/prompts/extract.md +80 -0
  61. package/vendor/core/prompts/migrate.md +96 -0
  62. package/vendor/core/prompts/synonyms.md +43 -0
  63. package/vendor/core/prompts/write-policy.md +12 -0
  64. package/vendor/core/retrieval.d.ts +95 -0
  65. package/vendor/core/retrieval.d.ts.map +1 -0
  66. package/vendor/core/retrieval.js +569 -0
  67. package/vendor/core/retrieval.js.map +1 -0
  68. package/vendor/core/store.d.ts +145 -0
  69. package/vendor/core/store.d.ts.map +1 -0
  70. package/vendor/core/store.js +511 -0
  71. package/vendor/core/store.js.map +1 -0
  72. package/vendor/core/suggest.d.ts +128 -0
  73. package/vendor/core/suggest.d.ts.map +1 -0
  74. package/vendor/core/suggest.js +384 -0
  75. package/vendor/core/suggest.js.map +1 -0
  76. package/vendor/core/text.d.ts +80 -0
  77. package/vendor/core/text.d.ts.map +1 -0
  78. package/vendor/core/text.js +253 -0
  79. package/vendor/core/text.js.map +1 -0
  80. package/vendor/core/types.d.ts +453 -0
  81. package/vendor/core/types.d.ts.map +1 -0
  82. package/vendor/core/types.js +14 -0
  83. package/vendor/core/types.js.map +1 -0
  84. package/vendor/core/util.d.ts +38 -0
  85. package/vendor/core/util.d.ts.map +1 -0
  86. package/vendor/core/util.js +248 -0
  87. package/vendor/core/util.js.map +1 -0
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Tokenize text into index terms. CJK runs become character bigrams plus the
3
+ * boundary unigrams (so single-character queries still match).
4
+ *
5
+ * `query: true` drops those boundary unigrams from multi-character runs: they
6
+ * are artifacts of the bigram window (e.g. the trailing character of a longer
7
+ * query phrase), and as query terms they matched unrelated documents through
8
+ * one shared character (S6 abstain false positives). A genuinely
9
+ * single-character query is kept.
10
+ */
11
+ export declare function tokenize(text: string, opts?: {
12
+ stopwords?: boolean;
13
+ query?: boolean;
14
+ }): string[];
15
+ /** Token counts for a text field. */
16
+ export declare function termFreq(text: string): Map<string, number>;
17
+ export interface FieldConfig {
18
+ title: number;
19
+ description: number;
20
+ tags: number;
21
+ entities: number;
22
+ body: number;
23
+ }
24
+ export declare const DEFAULT_FIELDS: FieldConfig;
25
+ /** Weighted term frequencies and weighted document length for BM25F. */
26
+ export declare function weightedTerms(fields: {
27
+ title: string;
28
+ description: string;
29
+ tags: string[];
30
+ entities: string[];
31
+ body: string;
32
+ }, weights?: FieldConfig): {
33
+ tf: Map<string, number>;
34
+ len: number;
35
+ };
36
+ export interface Bm25Doc {
37
+ /** weighted term frequency by term */
38
+ tf: Map<string, number>;
39
+ /** weighted document length */
40
+ len: number;
41
+ /** precomputed for convenience */
42
+ id: string;
43
+ }
44
+ export interface Bm25Params {
45
+ k1: number;
46
+ b: number;
47
+ }
48
+ export declare const DEFAULT_BM25: Bm25Params;
49
+ export declare function idf(nDocs: number, df: number): number;
50
+ /**
51
+ * Score a single doc for a set of unique query terms using precomputed postings.
52
+ * `postings` maps term -> Map<docIdx, weighted tf> (built by the indexer).
53
+ */
54
+ export declare function bm25fScore(queryTerms: string[], docIdx: number, postings: Map<string, Map<number, number>>, docLens: number[], avgLen: number, params?: Bm25Params): number;
55
+ /** First meaningful paragraph of a markdown body, trimmed for a snippet. */
56
+ export declare function extractSnippet(body: string, maxChars?: number): string;
57
+ /** Cos similarity between two token-count vectors (used by MMR). */
58
+ export declare function cosineTokens(a: Map<string, number>, b: Map<string, number>): number;
59
+ /**
60
+ * Query token expansion via the built-in synonym table (zero LLM).
61
+ *
62
+ * Two guards keep expansion from *hurting* precision:
63
+ * - single-character CJK query tokens are boundary artifacts of the bigram
64
+ * tokenizer (for example one character of a longer word), not real
65
+ * concepts; they are not expanded.
66
+ * - a synonym phrase is re-tokenized, but single-character CJK tokens of that
67
+ * phrase are dropped. Without this, expanding a two-character query term
68
+ * injected stray characters that matched every album/note record (S6
69
+ * abstain false positives).
70
+ */
71
+ export declare function expandQueryTerms(terms: string[], synonyms: Map<string, string[]>): string[];
72
+ /**
73
+ * Parse simple Chinese/English time expressions into a [from, to] window.
74
+ * Rules only; unknown expressions return null (caller falls back to text search).
75
+ */
76
+ export declare function parseTimeExpression(query: string, now: number): {
77
+ from: number;
78
+ to: number;
79
+ } | null;
80
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAClD,MAAM,EAAE,CAsBV;AAED,qCAAqC;AACrC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAM1D;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM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AAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAcnF;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAc3F;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA6BnG"}
@@ -0,0 +1,253 @@
1
+ /**
2
+ * Text processing: CJK bigram tokenizer + weighted BM25F scoring primitives.
3
+ * Pure JS, zero dependencies. See docs/design/03-retrieval.md.
4
+ */
5
+ import { normalizeNewlines } from "./util.js";
6
+ const CJK_RE = /[\u4e00-\u9fff]+|[A-Za-z0-9_]+/g;
7
+ const CJK_CHAR_RE = /[\u4e00-\u9fff]/;
8
+ const STOPWORDS = new Set([
9
+ "的",
10
+ "了",
11
+ "是",
12
+ "在",
13
+ "和",
14
+ "中",
15
+ "我",
16
+ "你",
17
+ "他",
18
+ "她",
19
+ "好",
20
+ "the",
21
+ "a",
22
+ "an",
23
+ "of",
24
+ "to",
25
+ "is",
26
+ "are",
27
+ "and",
28
+ "or",
29
+ "in",
30
+ "on",
31
+ "for",
32
+ "with",
33
+ "this",
34
+ "that",
35
+ ]);
36
+ /**
37
+ * Tokenize text into index terms. CJK runs become character bigrams plus the
38
+ * boundary unigrams (so single-character queries still match).
39
+ *
40
+ * `query: true` drops those boundary unigrams from multi-character runs: they
41
+ * are artifacts of the bigram window (e.g. the trailing character of a longer
42
+ * query phrase), and as query terms they matched unrelated documents through
43
+ * one shared character (S6 abstain false positives). A genuinely
44
+ * single-character query is kept.
45
+ */
46
+ export function tokenize(text, opts = {}) {
47
+ if (!text)
48
+ return [];
49
+ const out = [];
50
+ const input = normalizeNewlines(text).normalize("NFKC");
51
+ CJK_RE.lastIndex = 0;
52
+ let m;
53
+ while ((m = CJK_RE.exec(input))) {
54
+ const t = m[0];
55
+ if (CJK_CHAR_RE.test(t)) {
56
+ if (t.length === 1) {
57
+ if (!opts.stopwords || !STOPWORDS.has(t))
58
+ out.push(t);
59
+ continue;
60
+ }
61
+ for (let i = 0; i < t.length - 1; i++)
62
+ out.push(t.slice(i, i + 2));
63
+ if (!opts.query)
64
+ out.push(t[0], t[t.length - 1]);
65
+ }
66
+ else {
67
+ const lower = t.toLowerCase();
68
+ if (opts.stopwords && STOPWORDS.has(lower))
69
+ continue;
70
+ if (lower.length >= 2 || /^\d+$/.test(lower))
71
+ out.push(lower);
72
+ }
73
+ }
74
+ return out;
75
+ }
76
+ /** Token counts for a text field. */
77
+ export function termFreq(text) {
78
+ const tf = new Map();
79
+ for (const token of tokenize(text, { stopwords: true })) {
80
+ tf.set(token, (tf.get(token) ?? 0) + 1);
81
+ }
82
+ return tf;
83
+ }
84
+ export const DEFAULT_FIELDS = {
85
+ title: 3.0,
86
+ description: 2.0,
87
+ tags: 2.5,
88
+ entities: 2.0,
89
+ body: 1.0,
90
+ };
91
+ /** Weighted term frequencies and weighted document length for BM25F. */
92
+ export function weightedTerms(fields, weights = DEFAULT_FIELDS) {
93
+ const tf = new Map();
94
+ let len = 0;
95
+ const add = (text, weight) => {
96
+ const counts = termFreq(text);
97
+ let count = 0;
98
+ for (const [term, n] of counts) {
99
+ tf.set(term, (tf.get(term) ?? 0) + n * weight);
100
+ count += n;
101
+ }
102
+ len += count * weight;
103
+ };
104
+ add(fields.title, weights.title);
105
+ add(fields.description, weights.description);
106
+ add(fields.tags.join(" "), weights.tags);
107
+ add(fields.entities.join(" "), weights.entities);
108
+ add(fields.body.slice(0, 8192), weights.body);
109
+ return { tf, len };
110
+ }
111
+ export const DEFAULT_BM25 = { k1: 1.2, b: 0.75 };
112
+ export function idf(nDocs, df) {
113
+ return Math.log(1 + (nDocs - df + 0.5) / (df + 0.5));
114
+ }
115
+ /**
116
+ * Score a single doc for a set of unique query terms using precomputed postings.
117
+ * `postings` maps term -> Map<docIdx, weighted tf> (built by the indexer).
118
+ */
119
+ export function bm25fScore(queryTerms, docIdx, postings, docLens, avgLen, params = DEFAULT_BM25) {
120
+ const nDocs = docLens.length;
121
+ let score = 0;
122
+ const { k1, b } = params;
123
+ const docLen = docLens[docIdx] ?? avgLen;
124
+ for (const term of queryTerms) {
125
+ const posting = postings.get(term);
126
+ if (!posting)
127
+ continue;
128
+ const wTf = posting.get(docIdx);
129
+ if (!wTf)
130
+ continue;
131
+ const df = posting.size;
132
+ const norm = k1 * (1 - b + (b * docLen) / (avgLen || 1));
133
+ score += idf(nDocs, df) * ((wTf * (k1 + 1)) / (wTf + norm));
134
+ }
135
+ return score;
136
+ }
137
+ /** First meaningful paragraph of a markdown body, trimmed for a snippet. */
138
+ export function extractSnippet(body, maxChars = 400) {
139
+ const lines = normalizeNewlines(body).split("\n");
140
+ const parts = [];
141
+ for (const line of lines) {
142
+ const trimmed = line.trim();
143
+ if (!trimmed) {
144
+ if (parts.length > 0)
145
+ break;
146
+ continue;
147
+ }
148
+ if (trimmed.startsWith("#"))
149
+ continue;
150
+ if (trimmed.startsWith("---"))
151
+ continue;
152
+ parts.push(trimmed);
153
+ if (parts.join(" ").length >= maxChars)
154
+ break;
155
+ }
156
+ const text = parts.join(" ").replace(/\s+/g, " ").trim();
157
+ if (text.length <= maxChars)
158
+ return text;
159
+ return `${text.slice(0, maxChars - 1)}…`;
160
+ }
161
+ /** Cos similarity between two token-count vectors (used by MMR). */
162
+ export function cosineTokens(a, b) {
163
+ if (a.size === 0 || b.size === 0)
164
+ return 0;
165
+ let dot = 0;
166
+ let na = 0;
167
+ let nb = 0;
168
+ for (const [, v] of a)
169
+ na += v * v;
170
+ for (const [, v] of b)
171
+ nb += v * v;
172
+ const [small, big] = a.size <= b.size ? [a, b] : [b, a];
173
+ for (const [k, v] of small) {
174
+ const other = big.get(k);
175
+ if (other)
176
+ dot += v * other;
177
+ }
178
+ const denom = Math.sqrt(na) * Math.sqrt(nb);
179
+ return denom === 0 ? 0 : dot / denom;
180
+ }
181
+ const CJK_RUN = /^[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]+$/;
182
+ /**
183
+ * Query token expansion via the built-in synonym table (zero LLM).
184
+ *
185
+ * Two guards keep expansion from *hurting* precision:
186
+ * - single-character CJK query tokens are boundary artifacts of the bigram
187
+ * tokenizer (for example one character of a longer word), not real
188
+ * concepts; they are not expanded.
189
+ * - a synonym phrase is re-tokenized, but single-character CJK tokens of that
190
+ * phrase are dropped. Without this, expanding a two-character query term
191
+ * injected stray characters that matched every album/note record (S6
192
+ * abstain false positives).
193
+ */
194
+ export function expandQueryTerms(terms, synonyms) {
195
+ const out = new Set(terms);
196
+ for (const term of terms) {
197
+ if (CJK_RUN.test(term) && term.length === 1)
198
+ continue;
199
+ const syns = synonyms.get(term);
200
+ if (!syns)
201
+ continue;
202
+ for (const syn of syns) {
203
+ for (const t of tokenize(syn)) {
204
+ if (CJK_RUN.test(t) && t.length === 1)
205
+ continue;
206
+ out.add(t);
207
+ }
208
+ }
209
+ }
210
+ return [...out];
211
+ }
212
+ /**
213
+ * Parse simple Chinese/English time expressions into a [from, to] window.
214
+ * Rules only; unknown expressions return null (caller falls back to text search).
215
+ */
216
+ export function parseTimeExpression(query, now) {
217
+ const text = query.trim();
218
+ const day = 86400000;
219
+ const startOfDay = (ts) => {
220
+ const d = new Date(ts);
221
+ d.setHours(0, 0, 0, 0);
222
+ return d.getTime();
223
+ };
224
+ const today = startOfDay(now);
225
+ if (/今天/.test(text))
226
+ return { from: today, to: now };
227
+ if (/昨天|昨日/.test(text))
228
+ return { from: today - day, to: today - 1 };
229
+ if (/前天/.test(text))
230
+ return { from: today - 2 * day, to: today - day - 1 };
231
+ if (/本周|这周|这礼拜/.test(text))
232
+ return { from: today - 6 * day, to: now };
233
+ if (/上周|上礼拜/.test(text))
234
+ return { from: today - 13 * day, to: today - 7 * day };
235
+ if (/本月|这个月/.test(text))
236
+ return { from: today - 29 * day, to: now };
237
+ if (/上个月|上月/.test(text))
238
+ return { from: today - 59 * day, to: today - 30 * day };
239
+ if (/今年/.test(text)) {
240
+ const d = new Date(now);
241
+ const from = new Date(d.getFullYear(), 0, 1).getTime();
242
+ return { from, to: now };
243
+ }
244
+ const lastN = /最近\s*(\d+)\s*(天|日|周|个月)/.exec(text);
245
+ if (lastN) {
246
+ const n = Number(lastN[1]);
247
+ const unit = lastN[2] ?? "";
248
+ const mult = unit.includes("周") ? 7 * day : unit.includes("月") ? 30 * day : day;
249
+ return { from: now - n * mult, to: now };
250
+ }
251
+ return null;
252
+ }
253
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,GAAG,iCAAiC,CAAC;AACjD,MAAM,WAAW,GAAG,iBAAiB,CAAC;AACtC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,KAAK;IACL,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CACtB,IAAY,EACZ,OAAiD,EAAE;IAEnD,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,MAAM,GA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