@jmtrin/opencode-kevin 0.7.0 → 0.8.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 (52) hide show
  1. package/README.md +198 -9
  2. package/dist/migrations/009_v08_team.sql +100 -0
  3. package/dist/plugin/ArtifactWriter.d.ts +28 -0
  4. package/dist/plugin/ArtifactWriter.js +35 -2
  5. package/dist/plugin/ArtifactWriter.js.map +1 -1
  6. package/dist/plugin/ContextInjector.d.ts +9 -0
  7. package/dist/plugin/ContextInjector.js +14 -3
  8. package/dist/plugin/ContextInjector.js.map +1 -1
  9. package/dist/plugin/Curator.d.ts +22 -2
  10. package/dist/plugin/Curator.js +56 -14
  11. package/dist/plugin/Curator.js.map +1 -1
  12. package/dist/plugin/InjectionLedger.d.ts +6 -0
  13. package/dist/plugin/InjectionLedger.js +6 -0
  14. package/dist/plugin/InjectionLedger.js.map +1 -1
  15. package/dist/plugin/Materializer.d.ts +4 -5
  16. package/dist/plugin/Materializer.js +9 -6
  17. package/dist/plugin/Materializer.js.map +1 -1
  18. package/dist/plugin/MemoryService.d.ts +34 -5
  19. package/dist/plugin/MemoryService.js +215 -7
  20. package/dist/plugin/MemoryService.js.map +1 -1
  21. package/dist/plugin/Migrate.js +33 -3
  22. package/dist/plugin/Migrate.js.map +1 -1
  23. package/dist/plugin/RepoIdentity.d.ts +113 -0
  24. package/dist/plugin/RepoIdentity.js +266 -0
  25. package/dist/plugin/RepoIdentity.js.map +1 -0
  26. package/dist/plugin/Retrospective.js +9 -0
  27. package/dist/plugin/Retrospective.js.map +1 -1
  28. package/dist/plugin/SharedLayer.d.ts +159 -0
  29. package/dist/plugin/SharedLayer.js +463 -0
  30. package/dist/plugin/SharedLayer.js.map +1 -0
  31. package/dist/plugin/index.d.ts +30 -1
  32. package/dist/plugin/index.js +458 -10
  33. package/dist/plugin/index.js.map +1 -1
  34. package/dist/plugin/kevin_approve.js +7 -4
  35. package/dist/plugin/kevin_approve.js.map +1 -1
  36. package/dist/plugin/kevin_audit.d.ts +19 -1
  37. package/dist/plugin/kevin_audit.js +95 -3
  38. package/dist/plugin/kevin_audit.js.map +1 -1
  39. package/dist/plugin/metrics.d.ts +1 -1
  40. package/dist/plugin/metrics.js +9 -0
  41. package/dist/plugin/metrics.js.map +1 -1
  42. package/dist/plugin/okf-export.d.ts +2 -2
  43. package/dist/plugin/okf-export.js +15 -7
  44. package/dist/plugin/okf-export.js.map +1 -1
  45. package/dist/plugin/okf.d.ts +107 -0
  46. package/dist/plugin/okf.js +304 -0
  47. package/dist/plugin/okf.js.map +1 -0
  48. package/dist/plugin/replay-types.d.ts +29 -287
  49. package/dist/plugin/replay-types.js +145 -53
  50. package/dist/plugin/replay-types.js.map +1 -1
  51. package/migrations/009_v08_team.sql +100 -0
  52. package/package.json +2 -3
@@ -0,0 +1,107 @@
1
+ /** OKF v2 format version marker, written on the first header line. */
2
+ export declare const OKF_VERSION = 2;
3
+ /** A single canonicalized entry line may not exceed this many bytes. */
4
+ export declare const MAX_LINE_BYTES = 4096;
5
+ /** A serialized corpus may not exceed this many entries. */
6
+ export declare const MAX_ENTRIES = 2000;
7
+ export type OkfOp = "assert" | "tombstone";
8
+ /**
9
+ * A v2 entry. The field set is plan §5.3/§5.4: the two integer
10
+ * counters (`evidence`, `recurrence`) are transported and
11
+ * `confidence` is DERIVED at read time — the file contains no
12
+ * floats at all, so two machines computing a confidence slightly
13
+ * differently still emit byte-identical lines.
14
+ */
15
+ export interface OkfEntry {
16
+ entry_id: string;
17
+ type: "decision" | "rule" | "pattern" | "solution";
18
+ statement: string;
19
+ scope: string | null;
20
+ evidence: number;
21
+ recurrence: number;
22
+ origin: string;
23
+ author_hash: string | null;
24
+ op: OkfOp;
25
+ created_at: string;
26
+ supersedes: string | null;
27
+ }
28
+ /**
29
+ * Canonical JSON of an entry: keys in alphabetical order, no space
30
+ * argument, integers only (no float is ever written — plan §5.3).
31
+ * The object is constructed explicitly so the source object's
32
+ * insertion order can never leak into the bytes.
33
+ */
34
+ export declare function canonicalize(e: OkfEntry): string;
35
+ /**
36
+ * Emit the v2 file: three `#` header lines, then every entry sorted
37
+ * ascending by `entry_id`, one per line, LF endings, exactly one
38
+ * terminating newline. Entries over MAX_LINE_BYTES (measured in
39
+ * BYTES — a Japanese statement passes a `.length` check and fails a
40
+ * byte check) and corpora over MAX_ENTRIES are refused, not
41
+ * truncated (plan §5.3, physical rules).
42
+ */
43
+ export declare function serialize(entries: OkfEntry[], repoId: string, version: string): string;
44
+ /**
45
+ * Group both corpora by `entry_id`, fold each group through `join()`,
46
+ * and return the result sorted ascending by `entry_id`. Order of the
47
+ * inputs does not matter: join() is commutative, and the fold order is
48
+ * the only place input order could leak in — it cannot, by algebra.
49
+ */
50
+ export declare function merge(a: OkfEntry[], b: OkfEntry[]): OkfEntry[];
51
+ /**
52
+ * Derived, never serialized — reuses the v0.4.0 two-sided confidence
53
+ * formula verbatim (plan §5.4). A lesson that keeps recurring is
54
+ * DEMOTED rather than merely un-promoted; shared and local memories
55
+ * are repriced identically by the same formula.
56
+ */
57
+ export declare function deriveConfidence(e: OkfEntry): number;
58
+ export interface RejectedLine {
59
+ line: number;
60
+ reason: string;
61
+ }
62
+ export interface ParseResult {
63
+ version: number;
64
+ repoId: string | null;
65
+ /** Folded via join() and sorted ascending by entry_id. */
66
+ entries: OkfEntry[];
67
+ /** parse never throws; bad lines are reported. */
68
+ rejected: RejectedLine[];
69
+ /** Duplicate entry_ids collapsed by join(). */
70
+ folded: number;
71
+ }
72
+ /**
73
+ * v0.8.0 (K8-013 / plan §5.4, D8-13) — the field lattice. Every field
74
+ * resolves through a max, a min, or an absorbing boolean OR over a
75
+ * totally ordered set; there is no "prefer the newer" anywhere.
76
+ * Precondition: `a.entry_id === b.entry_id`.
77
+ */
78
+ export declare function join(a: OkfEntry, b: OkfEntry): OkfEntry;
79
+ /**
80
+ * parse() is a TOTAL function — it never throws, on any input,
81
+ * including binary (D8-14). The file is expected to arrive damaged:
82
+ * a conflict resolution leaves `<<<<<<< HEAD` markers, an editor
83
+ * truncates the last line, a merge tool mangles an encoding. Every
84
+ * unusable line becomes a `RejectedLine`; the good entries survive.
85
+ *
86
+ * Reason taxonomy (closed): not_okf, version_ahead, bad_json,
87
+ * missing_field, wrong_type, id_mismatch, unknown_op, line_too_long,
88
+ * corpus_too_large.
89
+ */
90
+ export declare function parse(text: string): ParseResult;
91
+ /**
92
+ * Compute the identity of an OKF entry: `fnv1a64("okf:v2\0" + type +
93
+ * "\0" + statement + "\0" + (scope ?? ""))`.
94
+ *
95
+ * D8-05 — deliberately NOT `fingerprint()`:
96
+ * - it salts with `project_id`, so every clone would produce a
97
+ * different id for the same rule, the shared file would accumulate
98
+ * one entry per developer per rule, and the merge fold would never
99
+ * once fire;
100
+ * - it runs `normalize()`, which lowercases and rewrites
101
+ * `path.ext:line:col` — both destructive for a curated statement,
102
+ * where casing and file paths carry meaning.
103
+ *
104
+ * NUL separators keep (`rule`, "ab", "c") distinct from
105
+ * ("rule", "a", "bc") — plain concatenation could never.
106
+ */
107
+ export declare function computeEntryId(type: string, statement: string, scope?: string | null): string;
@@ -0,0 +1,304 @@
1
+ // ============================================================
2
+ // Kevin 0.8.0 — OKF v2 codec (F2, K8-010 … K8-015)
3
+ // ============================================================
4
+ // The Open Kevin Format: the committed, shareable artifact of the
5
+ // shared layer (plan §3.3). Everything in this module is a pure
6
+ // function — no database, no filesystem, no clock. The format is
7
+ // the release: if `join()` is not a semilattice then silent git
8
+ // merges, order-independent imports and correct both-sides
9
+ // conflict resolution all evaporate.
10
+ //
11
+ // Entry ids are deliberately the THIRD fingerprint identity
12
+ // dimension in the codebase (v0.7.0's Principle 26; plan §3.3's
13
+ // table). The first is `fingerprint()` (error text, salted with
14
+ // `project_id`, normalized) and the second is the convention /
15
+ // decision fingerprints of v0.7.0 (derived from the normalized
16
+ // statement). This one is unsalted and un-normalized, and it is
17
+ // the ONLY cross-machine-stable dimension in the schema.
18
+ // ============================================================
19
+ import { computeConfidence } from "./confidence.js";
20
+ import { fnv1a64 } from "./fingerprint.js";
21
+ /** OKF v2 format version marker, written on the first header line. */
22
+ export const OKF_VERSION = 2;
23
+ /** A single canonicalized entry line may not exceed this many bytes. */
24
+ export const MAX_LINE_BYTES = 4096;
25
+ /** A serialized corpus may not exceed this many entries. */
26
+ export const MAX_ENTRIES = 2000;
27
+ const OKF_KEY_ORDER = [
28
+ "author_hash",
29
+ "created_at",
30
+ "entry_id",
31
+ "evidence",
32
+ "op",
33
+ "origin",
34
+ "recurrence",
35
+ "scope",
36
+ "statement",
37
+ "supersedes",
38
+ "type",
39
+ ];
40
+ /**
41
+ * Canonical JSON of an entry: keys in alphabetical order, no space
42
+ * argument, integers only (no float is ever written — plan §5.3).
43
+ * The object is constructed explicitly so the source object's
44
+ * insertion order can never leak into the bytes.
45
+ */
46
+ export function canonicalize(e) {
47
+ const ordered = {};
48
+ for (const key of OKF_KEY_ORDER) {
49
+ ordered[key] = e[key];
50
+ }
51
+ return JSON.stringify(ordered);
52
+ }
53
+ /**
54
+ * Emit the v2 file: three `#` header lines, then every entry sorted
55
+ * ascending by `entry_id`, one per line, LF endings, exactly one
56
+ * terminating newline. Entries over MAX_LINE_BYTES (measured in
57
+ * BYTES — a Japanese statement passes a `.length` check and fails a
58
+ * byte check) and corpora over MAX_ENTRIES are refused, not
59
+ * truncated (plan §5.3, physical rules).
60
+ */
61
+ export function serialize(entries, repoId, version) {
62
+ if (entries.length > MAX_ENTRIES) {
63
+ throw new Error(`okf: corpus of ${entries.length} entries exceeds MAX_ENTRIES (${MAX_ENTRIES})`);
64
+ }
65
+ const sorted = [...entries].sort((a, b) => a.entry_id < b.entry_id ? -1 : a.entry_id > b.entry_id ? 1 : 0);
66
+ const lines = [
67
+ `#okf ${OKF_VERSION}`,
68
+ `#repo ${repoId}`,
69
+ `#generated-by opencode-kevin/${version}`,
70
+ ];
71
+ for (const e of sorted) {
72
+ const line = canonicalize(e);
73
+ if (Buffer.byteLength(line, "utf8") > MAX_LINE_BYTES) {
74
+ throw new Error(`okf: entry ${e.entry_id} canonicalizes to ${Buffer.byteLength(line, "utf8")} bytes, over MAX_LINE_BYTES (${MAX_LINE_BYTES})`);
75
+ }
76
+ lines.push(line);
77
+ }
78
+ return `${lines.join("\n")}\n`;
79
+ }
80
+ /**
81
+ * Group both corpora by `entry_id`, fold each group through `join()`,
82
+ * and return the result sorted ascending by `entry_id`. Order of the
83
+ * inputs does not matter: join() is commutative, and the fold order is
84
+ * the only place input order could leak in — it cannot, by algebra.
85
+ */
86
+ export function merge(a, b) {
87
+ const byId = new Map();
88
+ for (const e of [...a, ...b]) {
89
+ const existing = byId.get(e.entry_id);
90
+ byId.set(e.entry_id, existing ? join(existing, e) : e);
91
+ }
92
+ return [...byId.values()].sort((x, y) => x.entry_id < y.entry_id ? -1 : x.entry_id > y.entry_id ? 1 : 0);
93
+ }
94
+ /**
95
+ * Derived, never serialized — reuses the v0.4.0 two-sided confidence
96
+ * formula verbatim (plan §5.4). A lesson that keeps recurring is
97
+ * DEMOTED rather than merely un-promoted; shared and local memories
98
+ * are repriced identically by the same formula.
99
+ */
100
+ export function deriveConfidence(e) {
101
+ return computeConfidence(e.evidence, e.recurrence);
102
+ }
103
+ const OKF_TYPES = new Set(["decision", "rule", "pattern", "solution"]);
104
+ function pickMin(a, b) {
105
+ if (a === null)
106
+ return b;
107
+ if (b === null)
108
+ return a;
109
+ return a <= b ? a : b;
110
+ }
111
+ /**
112
+ * v0.8.0 (K8-013 / plan §5.4, D8-13) — the field lattice. Every field
113
+ * resolves through a max, a min, or an absorbing boolean OR over a
114
+ * totally ordered set; there is no "prefer the newer" anywhere.
115
+ * Precondition: `a.entry_id === b.entry_id`.
116
+ */
117
+ export function join(a, b) {
118
+ return {
119
+ entry_id: a.entry_id,
120
+ // Equal by construction unless a hash collision — resolve by
121
+ // lexicographic min so the function stays total and deterministic.
122
+ type: a.type <= b.type ? a.type : b.type,
123
+ statement: a.statement <= b.statement ? a.statement : b.statement,
124
+ scope: pickMin(a.scope, b.scope),
125
+ evidence: Math.max(a.evidence, b.evidence),
126
+ recurrence: Math.max(a.recurrence, b.recurrence),
127
+ origin: a.origin <= b.origin ? a.origin : b.origin,
128
+ author_hash: pickMin(a.author_hash, b.author_hash),
129
+ // Tombstone absorbs: no undelete, no timestamp tiebreak (D8-09).
130
+ op: a.op === "tombstone" || b.op === "tombstone" ? "tombstone" : "assert",
131
+ // Birthday semantics: min is the only choice stable under replay.
132
+ created_at: a.created_at <= b.created_at ? a.created_at : b.created_at,
133
+ supersedes: pickMin(a.supersedes, b.supersedes),
134
+ };
135
+ }
136
+ /**
137
+ * parse() is a TOTAL function — it never throws, on any input,
138
+ * including binary (D8-14). The file is expected to arrive damaged:
139
+ * a conflict resolution leaves `<<<<<<< HEAD` markers, an editor
140
+ * truncates the last line, a merge tool mangles an encoding. Every
141
+ * unusable line becomes a `RejectedLine`; the good entries survive.
142
+ *
143
+ * Reason taxonomy (closed): not_okf, version_ahead, bad_json,
144
+ * missing_field, wrong_type, id_mismatch, unknown_op, line_too_long,
145
+ * corpus_too_large.
146
+ */
147
+ export function parse(text) {
148
+ const rejected = [];
149
+ const reject = (line, reason) => {
150
+ rejected.push({ line, reason });
151
+ };
152
+ // A UTF-8 BOM breaks the `#okf ` prefix check; strip it first.
153
+ const body = text.replace(/^\uFEFF/, "");
154
+ const lines = body.split(/\r\n|\r|\n/);
155
+ let version = 0;
156
+ let repoId = null;
157
+ if (!(lines[0]?.startsWith("#okf ") ?? false)) {
158
+ reject(1, "not_okf");
159
+ return { version, repoId, entries: [], rejected, folded: 0 };
160
+ }
161
+ const declared = Number(lines[0].slice(5));
162
+ version = Number.isInteger(declared) && declared >= 0 ? declared : 0;
163
+ if (version > OKF_VERSION) {
164
+ // Guessing at a future format's semantics is how corpora get
165
+ // corrupted — refuse the whole file, never a best-effort parse.
166
+ return {
167
+ version,
168
+ repoId: null,
169
+ entries: [],
170
+ rejected: [{ line: 1, reason: "version_ahead" }],
171
+ folded: 0,
172
+ };
173
+ }
174
+ if (lines[1]?.startsWith("#repo ")) {
175
+ repoId = lines[1].slice(6) || null;
176
+ }
177
+ const byId = new Map();
178
+ let folded = 0;
179
+ let accepted = 0;
180
+ for (let i = 2; i < lines.length; i++) {
181
+ const line = lines[i];
182
+ if (line === "")
183
+ continue; // trailing newline / blank lines
184
+ if (line.startsWith("#"))
185
+ continue; // header/comment lines
186
+ const lineNo = i + 1;
187
+ if (Buffer.byteLength(line, "utf8") > MAX_LINE_BYTES) {
188
+ reject(lineNo, "line_too_long");
189
+ continue;
190
+ }
191
+ let raw;
192
+ try {
193
+ raw = JSON.parse(line);
194
+ }
195
+ catch {
196
+ reject(lineNo, "bad_json");
197
+ continue;
198
+ }
199
+ if (typeof raw !== "object" || raw === null) {
200
+ reject(lineNo, "bad_json");
201
+ continue;
202
+ }
203
+ const o = raw;
204
+ const missing = (k) => o[k] === undefined;
205
+ const wrong = (k, ok) => !missing(k) && !ok(o[k]);
206
+ const stringField = (k) => !wrong(k, (v) => typeof v === "string");
207
+ const nullableString = (k) => !wrong(k, (v) => v === null || typeof v === "string");
208
+ const intField = (k) => !wrong(k, (v) => typeof v === "number" && Number.isInteger(v) && v >= 0);
209
+ if (missing("entry_id"))
210
+ reject(lineNo, "missing_field");
211
+ else if (!stringField("entry_id"))
212
+ reject(lineNo, "wrong_type");
213
+ else if (missing("type"))
214
+ reject(lineNo, "missing_field");
215
+ else if (typeof o.type !== "string" || !OKF_TYPES.has(o.type))
216
+ reject(lineNo, "wrong_type");
217
+ else if (missing("statement"))
218
+ reject(lineNo, "missing_field");
219
+ else if (!stringField("statement"))
220
+ reject(lineNo, "wrong_type");
221
+ else if (!nullableString("scope"))
222
+ reject(lineNo, "wrong_type");
223
+ else if (missing("evidence"))
224
+ reject(lineNo, "missing_field");
225
+ else if (!intField("evidence"))
226
+ reject(lineNo, "wrong_type");
227
+ else if (missing("recurrence"))
228
+ reject(lineNo, "missing_field");
229
+ else if (!intField("recurrence"))
230
+ reject(lineNo, "wrong_type");
231
+ else if (missing("origin"))
232
+ reject(lineNo, "missing_field");
233
+ else if (!stringField("origin"))
234
+ reject(lineNo, "wrong_type");
235
+ else if (!nullableString("author_hash"))
236
+ reject(lineNo, "wrong_type");
237
+ else if (missing("op"))
238
+ reject(lineNo, "missing_field");
239
+ else if (o.op !== "assert" && o.op !== "tombstone")
240
+ reject(lineNo, "unknown_op");
241
+ else if (missing("created_at"))
242
+ reject(lineNo, "missing_field");
243
+ else if (!stringField("created_at"))
244
+ reject(lineNo, "wrong_type");
245
+ else if (!nullableString("supersedes"))
246
+ reject(lineNo, "wrong_type");
247
+ else {
248
+ // The tamper-evident check: a hand-edited statement without
249
+ // an updated entry_id is caught here, not silently ranked.
250
+ const recomputed = computeEntryId(o.type, o.statement, (o.scope ?? null));
251
+ if (recomputed !== o.entry_id) {
252
+ reject(lineNo, "id_mismatch");
253
+ continue;
254
+ }
255
+ const e = {
256
+ entry_id: o.entry_id,
257
+ type: o.type,
258
+ statement: o.statement,
259
+ scope: (o.scope ?? null),
260
+ evidence: o.evidence,
261
+ recurrence: o.recurrence,
262
+ origin: o.origin,
263
+ author_hash: (o.author_hash ?? null),
264
+ op: o.op,
265
+ created_at: o.created_at,
266
+ supersedes: (o.supersedes ?? null),
267
+ };
268
+ const existing = byId.get(e.entry_id);
269
+ if (existing) {
270
+ byId.set(e.entry_id, join(existing, e));
271
+ folded++;
272
+ continue;
273
+ }
274
+ if (accepted >= MAX_ENTRIES) {
275
+ reject(lineNo, "corpus_too_large");
276
+ continue;
277
+ }
278
+ byId.set(e.entry_id, e);
279
+ accepted++;
280
+ }
281
+ }
282
+ const entries = [...byId.values()].sort((a, b) => a.entry_id < b.entry_id ? -1 : a.entry_id > b.entry_id ? 1 : 0);
283
+ return { version, repoId, entries, rejected, folded };
284
+ }
285
+ /**
286
+ * Compute the identity of an OKF entry: `fnv1a64("okf:v2\0" + type +
287
+ * "\0" + statement + "\0" + (scope ?? ""))`.
288
+ *
289
+ * D8-05 — deliberately NOT `fingerprint()`:
290
+ * - it salts with `project_id`, so every clone would produce a
291
+ * different id for the same rule, the shared file would accumulate
292
+ * one entry per developer per rule, and the merge fold would never
293
+ * once fire;
294
+ * - it runs `normalize()`, which lowercases and rewrites
295
+ * `path.ext:line:col` — both destructive for a curated statement,
296
+ * where casing and file paths carry meaning.
297
+ *
298
+ * NUL separators keep (`rule`, "ab", "c") distinct from
299
+ * ("rule", "a", "bc") — plain concatenation could never.
300
+ */
301
+ export function computeEntryId(type, statement, scope) {
302
+ return fnv1a64(`okf:v2\u0000${type}\u0000${statement}\u0000${scope ?? ""}`);
303
+ }
304
+ //# sourceMappingURL=okf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"okf.js","sourceRoot":"","sources":["../../plugin/okf.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,mDAAmD;AACnD,+DAA+D;AAC/D,kEAAkE;AAClE,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,2DAA2D;AAC3D,qCAAqC;AACrC,EAAE;AACF,4DAA4D;AAC5D,gEAAgE;AAChE,gEAAgE;AAChE,+DAA+D;AAC/D,+DAA+D;AAC/D,gEAAgE;AAChE,yDAAyD;AACzD,+DAA+D;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,sEAAsE;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B,wEAAwE;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC;AAyBhC,MAAM,aAAa,GAAG;IACrB,aAAa;IACb,YAAY;IACZ,UAAU;IACV,UAAU;IACV,IAAI;IACJ,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,WAAW;IACX,YAAY;IACZ,MAAM;CACG,CAAC;AAEX;;;;;GAK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