@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,113 @@
1
+ import type { ArtifactWriter } from "./ArtifactWriter.js";
2
+ /**
3
+ * The three sources `resolve()` tries, in order (plan §5.1).
4
+ */
5
+ export type IdentitySource = "declared" | "remote" | "path";
6
+ /**
7
+ * The outcome of resolving a repository identity.
8
+ */
9
+ export interface ResolvedIdentity {
10
+ /** The repository-scoped id every Team scope is keyed on. */
11
+ repoId: string;
12
+ /** Which source produced `repoId`. */
13
+ source: IdentitySource;
14
+ /**
15
+ * A short, non-secret description of how the id was derived,
16
+ * surfaced by `kevin_project show`. Never contains a credential
17
+ * or an absolute path.
18
+ */
19
+ evidence: string;
20
+ /** The v0.7.0 project scope, always returned regardless of source. */
21
+ projectId: string;
22
+ }
23
+ /**
24
+ * Read the first `url = …` value inside `[remote "<name>"]` of a
25
+ * `.git/config`-style INI text.
26
+ *
27
+ * Line-oriented reader, not an INI library: tracks the current
28
+ * `[section "sub"]` header, tolerates tabs, spaces around `=`,
29
+ * CRLF, and comment lines. Returns `null` on anything unrecognised
30
+ * and never throws — on any input, including binary.
31
+ */
32
+ export declare function parseGitConfigRemote(text: string, name?: string): string | null;
33
+ /**
34
+ * Fold the URL shapes git accepts into one canonical string.
35
+ *
36
+ * Steps, in order (K8-005):
37
+ * 1. strip a trailing `.git`;
38
+ * 2. strip a `scheme://` prefix;
39
+ * 3. strip everything up to and including the last `@` in the
40
+ * authority (userinfo and embedded credentials — a token must
41
+ * never reach a hash that lands in a committed file, D8-04);
42
+ * 4. strip a numeric port (`:8443`, `:443`, …) so the same repo
43
+ * served over different transports folds to one id;
44
+ * 5. rewrite the scp-style `host:path` separator to `host/path`;
45
+ * 6. strip a trailing `/`;
46
+ * 7. lowercase the whole result.
47
+ *
48
+ * Returns `null` when the result contains no `/` (e.g. a local
49
+ * path remote) — the caller falls through to the path source.
50
+ */
51
+ export declare function normalizeRemote(url: string): string | null;
52
+ /**
53
+ * Derive a repository id from a normalized remote (K8-006).
54
+ *
55
+ * The domain prefix means a repo id can never collide with a memory
56
+ * fingerprint computed over the same string, and it leaves room to
57
+ * version the derivation later.
58
+ */
59
+ export declare function computeRepoId(normalized: string): string;
60
+ /**
61
+ * Resolve the repository identity for `cwd`, trying the three
62
+ * sources in order (plan §5.1):
63
+ *
64
+ * 1. `declared` — `.kevin/project.json` → `id` (validated as
65
+ * exactly 16 lowercase hex characters; anything else is ignored
66
+ * and falls through, because a hand-edited garbage id in a
67
+ * committed file would otherwise scope a whole team's corpus
68
+ * onto a typo);
69
+ * 2. `remote` — `.git/config` → `[remote "origin"] url`,
70
+ * normalized and hashed;
71
+ * 3. `path` — `fingerprint(cwd)`, the v0.7.0 behaviour.
72
+ *
73
+ * Never throws: a directory that is not a git repository, an
74
+ * unreadable `.git/config`, and a malformed `project.json` all fall
75
+ * through to source 3. `projectId` is always returned alongside
76
+ * `repoId`, regardless of which source won.
77
+ */
78
+ export declare function resolve(cwd: string): ResolvedIdentity;
79
+ /**
80
+ * The outcome of `initProjectFile` (K8-008).
81
+ */
82
+ export interface InitProjectResult {
83
+ /** Whether the file was written. */
84
+ ok: boolean;
85
+ /** The absolute path the file was written to, or refused. */
86
+ path: string;
87
+ /** Human-readable refusal reason when `ok` is false. */
88
+ reason?: string;
89
+ /** The pinned id when the file was written. */
90
+ id?: string;
91
+ /** The ISO-8601 Z timestamp written into the file. */
92
+ createdAt?: string;
93
+ }
94
+ /**
95
+ * Write `.kevin/project.json` pinning the repository identity (K8-008
96
+ * / plan §5.8). The id comes from the current `resolve(cwd)` — so `init`
97
+ * in a repository with a remote *pins* the remote-derived id, which is
98
+ * the point: it survives the organisation renaming the repo (a remote
99
+ * URL change would otherwise silently re-scope the corpus).
100
+ *
101
+ * The file is `{"id": "<16 hex>", "created_at": "<ISO-8601 Z>",
102
+ * "generator": "opencode-kevin/0.8.0"}` with sorted keys and a
103
+ * terminating newline (deterministic bytes, the codec discipline of
104
+ * plan §7.3). `init` refuses when the file already exists: overwriting
105
+ * it re-scopes a team's corpus, and that is `rekey`'s job (K8-009),
106
+ * with a confirmation.
107
+ *
108
+ * NOTE (K8-019): the write goes through `ArtifactWriter` in whole-file
109
+ * mode — `.kevin/project.json` is a Kevin-owned file, and D8-08 leaves
110
+ * no scenario in which a second raw write path is acceptable (asserted
111
+ * by tests/unit/single_write_path.test.ts).
112
+ */
113
+ export declare function initProjectFile(cwd: string, writer: ArtifactWriter): InitProjectResult;
@@ -0,0 +1,266 @@
1
+ import { mkdirSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { fingerprint, fnv1a64 } from "./fingerprint.js";
4
+ // ============================================================
5
+ // Kevin 0.8.0 — RepoIdentity (K8-005/K8-006 / plan §5.1, D8-04)
6
+ // ============================================================
7
+ // Repository-derived identity that survives a clone. Two clones
8
+ // of the same remote must agree on one `repo_id` even though
9
+ // `process.cwd()` differs.
10
+ //
11
+ // This file deliberately contains no process-launching calls (D8-01)
12
+ // and no `new URL()` — the scp-style `git@host:path` form that git
13
+ // accepts and roughly half of all clones use rejects URL parsing
14
+ // (K8-005).
15
+ // ============================================================
16
+ // Comment lines git accepts inside a config section: `#` and `;`.
17
+ const COMMENT_RE = /^[#;]/;
18
+ // A declared id must be exactly 16 lowercase hex characters (K8-006).
19
+ const DECLARED_ID_RE = /^[0-9a-f]{16}$/;
20
+ const PROJECT_JSON_PATH = join(".kevin", "project.json");
21
+ const GIT_CONFIG_PATH = join(".git", "config");
22
+ /**
23
+ * Read the first `url = …` value inside `[remote "<name>"]` of a
24
+ * `.git/config`-style INI text.
25
+ *
26
+ * Line-oriented reader, not an INI library: tracks the current
27
+ * `[section "sub"]` header, tolerates tabs, spaces around `=`,
28
+ * CRLF, and comment lines. Returns `null` on anything unrecognised
29
+ * and never throws — on any input, including binary.
30
+ */
31
+ export function parseGitConfigRemote(text, name = "origin") {
32
+ // Never throw on any input, including binary and huge strings.
33
+ if (typeof text !== "string" || text.length === 0)
34
+ return null;
35
+ const lines = text.split(/\r\n|\n|\r/);
36
+ let currentSection = null;
37
+ let currentSub = null;
38
+ for (const raw of lines) {
39
+ const line = raw.trim();
40
+ if (line.length === 0)
41
+ continue;
42
+ if (COMMENT_RE.test(line))
43
+ continue;
44
+ // Section header: `[section "sub"]` or `[section]`.
45
+ if (line.startsWith("[")) {
46
+ const header = line.slice(1, line.indexOf("]"));
47
+ if (header === null)
48
+ return null;
49
+ const q = header.indexOf('"');
50
+ if (q === -1) {
51
+ currentSection = header.trim();
52
+ currentSub = null;
53
+ }
54
+ else {
55
+ currentSection = header.slice(0, q).trim();
56
+ const sub = header.slice(q + 1, header.lastIndexOf('"'));
57
+ currentSub = sub;
58
+ }
59
+ continue;
60
+ }
61
+ if (currentSection !== "remote")
62
+ continue;
63
+ const eq = line.indexOf("=");
64
+ if (eq === -1)
65
+ return null;
66
+ const key = line.slice(0, eq).trim();
67
+ const value = line.slice(eq + 1).trim();
68
+ if (key !== "url")
69
+ continue;
70
+ if (currentSub === name)
71
+ return value;
72
+ }
73
+ return null;
74
+ }
75
+ /**
76
+ * Fold the URL shapes git accepts into one canonical string.
77
+ *
78
+ * Steps, in order (K8-005):
79
+ * 1. strip a trailing `.git`;
80
+ * 2. strip a `scheme://` prefix;
81
+ * 3. strip everything up to and including the last `@` in the
82
+ * authority (userinfo and embedded credentials — a token must
83
+ * never reach a hash that lands in a committed file, D8-04);
84
+ * 4. strip a numeric port (`:8443`, `:443`, …) so the same repo
85
+ * served over different transports folds to one id;
86
+ * 5. rewrite the scp-style `host:path` separator to `host/path`;
87
+ * 6. strip a trailing `/`;
88
+ * 7. lowercase the whole result.
89
+ *
90
+ * Returns `null` when the result contains no `/` (e.g. a local
91
+ * path remote) — the caller falls through to the path source.
92
+ */
93
+ export function normalizeRemote(url) {
94
+ if (typeof url !== "string" || url.length === 0)
95
+ return null;
96
+ // 1. Strip a trailing `.git` (case-insensitive for file names
97
+ // like `App.GIT`; hosts are lowercased later anyway).
98
+ let s = url.replace(/\.git$/i, "");
99
+ // 2. Strip a `scheme://` prefix — any scheme, including
100
+ // `ssh://`, `https://`, `git://`, `file://`. A `file://`
101
+ // remote collapses to a local path and will fall through.
102
+ s = s.replace(/^[a-z][a-z0-9+.-]*:\/\//i, "");
103
+ // 3. Strip userinfo: everything up to and including the last
104
+ // `@` in the authority. `https://user:token@host/…` and
105
+ // `ssh://git@host/…` both lose the credential half here,
106
+ // before anything else can retain a copy.
107
+ const at = s.lastIndexOf("@");
108
+ if (at !== -1)
109
+ s = s.slice(at + 1);
110
+ // 4. Strip a numeric port: `https://host:8443/org/repo`, `host:8443/
111
+ // org/repo` and `host/org/repo` are the same repository served
112
+ // over different transports — they must fold to one id or the
113
+ // team silently splits by transport form. The scp-style
114
+ // `host:path` form (path not starting with digits) is rewritten
115
+ // by the step below.
116
+ s = s.replace(/^([^/]+):(\d+)(\/|$)/, "$1$3");
117
+ // 5. scp-style `host:path` → `host/path`. The first `:` that
118
+ // remains is the separator; everything after it is the path.
119
+ // After step 3 there is no userinfo `:` left to confuse it.
120
+ const colon = s.indexOf(":");
121
+ if (colon !== -1) {
122
+ s = `${s.slice(0, colon)}/${s.slice(colon + 1)}`;
123
+ }
124
+ // 6. Strip a trailing `/`.
125
+ s = s.replace(/\/+$/, "");
126
+ // 7. Lowercase.
127
+ s = s.toLowerCase();
128
+ if (s.length === 0)
129
+ return null;
130
+ // Anything without a `/` is a bare host or a bare local name,
131
+ // not a remote repository path — the caller falls through.
132
+ if (!s.includes("/"))
133
+ return null;
134
+ // A leading `/` means the remote is a local filesystem path
135
+ // (e.g. `/srv/git/bare.git` or a `file://` remote) — plan §5.1's
136
+ // fifth fixture — and the caller falls through to source 3.
137
+ if (s.startsWith("/"))
138
+ return null;
139
+ return s;
140
+ }
141
+ /**
142
+ * Derive a repository id from a normalized remote (K8-006).
143
+ *
144
+ * The domain prefix means a repo id can never collide with a memory
145
+ * fingerprint computed over the same string, and it leaves room to
146
+ * version the derivation later.
147
+ */
148
+ export function computeRepoId(normalized) {
149
+ return fnv1a64(`okf:repo:v1\u0000${normalized}`);
150
+ }
151
+ /**
152
+ * Resolve the repository identity for `cwd`, trying the three
153
+ * sources in order (plan §5.1):
154
+ *
155
+ * 1. `declared` — `.kevin/project.json` → `id` (validated as
156
+ * exactly 16 lowercase hex characters; anything else is ignored
157
+ * and falls through, because a hand-edited garbage id in a
158
+ * committed file would otherwise scope a whole team's corpus
159
+ * onto a typo);
160
+ * 2. `remote` — `.git/config` → `[remote "origin"] url`,
161
+ * normalized and hashed;
162
+ * 3. `path` — `fingerprint(cwd)`, the v0.7.0 behaviour.
163
+ *
164
+ * Never throws: a directory that is not a git repository, an
165
+ * unreadable `.git/config`, and a malformed `project.json` all fall
166
+ * through to source 3. `projectId` is always returned alongside
167
+ * `repoId`, regardless of which source won.
168
+ */
169
+ export function resolve(cwd) {
170
+ const projectId = fingerprint(cwd);
171
+ // 1. Declared.
172
+ try {
173
+ const raw = readFileSync(join(cwd, PROJECT_JSON_PATH), "utf8");
174
+ const parsed = JSON.parse(raw);
175
+ if (typeof parsed.id === "string" && DECLARED_ID_RE.test(parsed.id)) {
176
+ return {
177
+ repoId: parsed.id,
178
+ source: "declared",
179
+ evidence: ".kevin/project.json#id",
180
+ projectId,
181
+ };
182
+ }
183
+ }
184
+ catch {
185
+ // Missing, unreadable, or malformed — fall through.
186
+ }
187
+ // 2. Remote.
188
+ try {
189
+ const config = readFileSync(join(cwd, GIT_CONFIG_PATH), "utf8");
190
+ const url = parseGitConfigRemote(config);
191
+ const normalized = url === null ? null : normalizeRemote(url);
192
+ if (normalized !== null) {
193
+ return {
194
+ repoId: computeRepoId(normalized),
195
+ source: "remote",
196
+ evidence: `remote:${normalized}`,
197
+ projectId,
198
+ };
199
+ }
200
+ }
201
+ catch {
202
+ // Unreadable or missing — fall through.
203
+ }
204
+ // 3. Path — the v0.7.0 behaviour, preserved exactly.
205
+ return { repoId: projectId, source: "path", evidence: "cwd", projectId };
206
+ }
207
+ /**
208
+ * Write `.kevin/project.json` pinning the repository identity (K8-008
209
+ * / plan §5.8). The id comes from the current `resolve(cwd)` — so `init`
210
+ * in a repository with a remote *pins* the remote-derived id, which is
211
+ * the point: it survives the organisation renaming the repo (a remote
212
+ * URL change would otherwise silently re-scope the corpus).
213
+ *
214
+ * The file is `{"id": "<16 hex>", "created_at": "<ISO-8601 Z>",
215
+ * "generator": "opencode-kevin/0.8.0"}` with sorted keys and a
216
+ * terminating newline (deterministic bytes, the codec discipline of
217
+ * plan §7.3). `init` refuses when the file already exists: overwriting
218
+ * it re-scopes a team's corpus, and that is `rekey`'s job (K8-009),
219
+ * with a confirmation.
220
+ *
221
+ * NOTE (K8-019): the write goes through `ArtifactWriter` in whole-file
222
+ * mode — `.kevin/project.json` is a Kevin-owned file, and D8-08 leaves
223
+ * no scenario in which a second raw write path is acceptable (asserted
224
+ * by tests/unit/single_write_path.test.ts).
225
+ */
226
+ export function initProjectFile(cwd, writer) {
227
+ const path = join(cwd, PROJECT_JSON_PATH);
228
+ try {
229
+ readFileSync(path, "utf8");
230
+ return {
231
+ ok: false,
232
+ path,
233
+ reason: `.kevin/project.json already exists — overwriting it would re-scope the corpus; use "kevin_project rekey" instead`,
234
+ };
235
+ }
236
+ catch {
237
+ // Absent or unreadable — proceed.
238
+ }
239
+ const id = resolve(cwd).repoId;
240
+ const createdAt = new Date().toISOString();
241
+ const payload = `${JSON.stringify({
242
+ created_at: createdAt,
243
+ generator: "opencode-kevin/0.8.0",
244
+ id,
245
+ })}\n`;
246
+ try {
247
+ mkdirSync(join(cwd, ".kevin"), { recursive: true });
248
+ const outcome = writer.write({ path, mode: "whole", content: payload });
249
+ if (outcome !== "written") {
250
+ return {
251
+ ok: false,
252
+ path,
253
+ reason: `could not write .kevin/project.json: ${outcome}`,
254
+ };
255
+ }
256
+ return { ok: true, path, id, createdAt };
257
+ }
258
+ catch (err) {
259
+ return {
260
+ ok: false,
261
+ path,
262
+ reason: `could not write .kevin/project.json: ${err?.message ?? "unknown error"}`,
263
+ };
264
+ }
265
+ }
266
+ //# sourceMappingURL=RepoIdentity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RepoIdentity.js","sourceRoot":"","sources":["../../plugin/RepoIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAExD,+DAA+D;AAC/D,gEAAgE;AAChE,+DAA+D;AAC/D,gEAAgE;AAChE,6DAA6D;AAC7D,2BAA2B;AAC3B,EAAE;AACF,qEAAqE;AACrE,mEAAmE;AACnE,iEAAiE;AACjE,YAAY;AACZ,+DAA+D;AAE/D,kEAAkE;AAClE,MAAM,UAAU,GAAG,OAAO,CAAC;AAE3B,sEAAsE;AACtE,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAExC,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AACzD,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAyB/C;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAC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conflicts_detected: "Conflictos detectados",
51
51
  error_lessons_suppressed: "Lecciones de error suprimidas",
52
+ // v0.8.0 (K8-003 / plan §8.16) — the K8 metric keys need their own
53
+ // Spanish labels; the audit regression forbids raw-key fallback for any
54
+ // key in METRIC_KEYS.
55
+ shared_entries_total: "Entradas compartidas (totales)",
56
+ shared_entries_imported: "Entradas compartidas importadas",
57
+ shared_entries_exported: "Entradas compartidas exportadas",
58
+ okf_merge_folds: "Fusiones OKF (folds)",
59
+ rekey_events: "Re-keys de repositorio",
60
+ injections_from_shared: "Inyecciones desde la capa compartida",
52
61
  };
53
62
  function originLabel(origin) {
54
63
  if (origin === "reflector")
@@ -1 +1 @@
1
- {"version":3,"file":"Retrospective.js","sourceRoot":"","sources":["../../plugin/Retrospective.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAkCnC,yEAAyE;AACzE,yEAAyE;AACzE,MAAM,CAAC,MAAM,iBAAiB,GAA2B;IACxD,0BAA0B,EAAE,gCAAgC;IAC5D,0BAA0B,EAAE,gCAAgC;IAC5D,qBAAqB,EAAE,uBAAuB;IAC9C,sBAAsB,EAAE,uBAAuB;IAC/C,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,kBAAkB;IAClC,sEAAsE;IACtE,0DAA0D;IAC1D,gBAAgB,EAAE,qBAAqB;IACvC,oBAAoB,EAAE,uBAAuB;IAC7C,sBAAsB,EAAE,wBAAwB;IAChD,qBAAqB,EAAE,8BAA8B;IACrD,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,kBAAkB;IAChC,mBAAmB,EAAE,oBAAoB;IACzC,kEAAkE;IAClE,kEAAkE;IAClE,uCAAuC;IACvC,uBAAuB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AC9B,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC1B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;gBAC5D,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;gBAC5C,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,KAAK,EAAE,CAAC,CAAC;YACpC,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChB,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACD"}
@@ -0,0 +1,159 @@
1
+ import type { ArtifactWriter, WriteOutcome, WritePlan, WriteRequest } from "./ArtifactWriter.js";
2
+ import { type ParseResult } from "./okf.js";
3
+ export interface ImportReport {
4
+ path: string;
5
+ /** null when the file does not exist. */
6
+ fileHash: string | null;
7
+ parsed: number;
8
+ folded: number;
9
+ rejected: number;
10
+ /** rows inserted or updated in shared_entries. */
11
+ imported: number;
12
+ /** shared memories retired by an incoming tombstone. */
13
+ tombstoned: number;
14
+ /** true when fileHash matches the last okf_imports row. */
15
+ skipped: boolean;
16
+ }
17
+ /**
18
+ * A planned (or applied) export (K8-020 / plan §5.5). The refusal is
19
+ * carried by the write plan itself — `outcome: "refused"` with both
20
+ * hashes audited — so a refused plan is indistinguishable from a
21
+ * written one until `outcome` is read.
22
+ */
23
+ export interface ExportPlan {
24
+ path: string;
25
+ /** The whole-mode write request; applying re-plans through the single write funnel. */
26
+ request: WriteRequest;
27
+ /** The pure preview from planning time — diff and outcome, nothing written. */
28
+ write: WritePlan;
29
+ /** Entry ids in the merged corpus absent from the current file. */
30
+ entriesAdded: number;
31
+ /** Set by applyExport: the outcome of the actual write. */
32
+ applied?: WriteOutcome;
33
+ }
34
+ export declare class SharedLayer {
35
+ private readonly store;
36
+ private readonly repoId;
37
+ private readonly projectId;
38
+ private readonly version;
39
+ private readonly writer;
40
+ constructor(deps: {
41
+ store: StoreLike;
42
+ repoId: string;
43
+ projectId: string;
44
+ version: string;
45
+ writer: ArtifactWriter;
46
+ });
47
+ /**
48
+ * The single whole-file (mode `whole`) construction site in
49
+ * SharedLayer (K8-019 / K8-020, D8-08, asserted by
50
+ * tests/unit/single_write_path.test.ts): the OKF file is written
51
+ * through the ArtifactWriter's write funnel like every other file
52
+ * Kevin owns — there is no second write path.
53
+ */
54
+ private wholeRequest;
55
+ /**
56
+ * Pure export planner (K8-020 / plan §5.5): reads the current file
57
+ * and merges the given local memories' projections into the corpus,
58
+ * producing a {@link WritePlan} — but writes nothing. Refusals are
59
+ * audited like any other write: `after === before`, both hashes
60
+ * recorded (D6-04). The refusal ladder, in the order the code
61
+ * evaluates it — file-side refusals first (not_okf, version_ahead,
62
+ * repo_mismatch), then candidate-side refusals in the loop order
63
+ * (line_too_long, below_floor, not_curated, unknown_entry), then
64
+ * too_many_entries and finally parse_damaged.
65
+ */
66
+ planExport(memoryIds: string[], path: string): ExportPlan;
67
+ /**
68
+ * Tombstone-append planner (K8-020 / D8-09): emits one `tombstone`
69
+ * line per entry id, never deletes a line. The identifying triple is
70
+ * reconstructed from the local projection (a memory with
71
+ * `shared_entry_id`) so the line still passes parse's
72
+ * tamper-evident entry_id check; an id with no local projection is
73
+ * refused rather than emitting an invalid line.
74
+ */
75
+ planTombstone(entryIds: string[], path: string): ExportPlan;
76
+ /**
77
+ * v0.8.0 (BUG-003) — heal a stale `#repo` header after a rekey.
78
+ * Rekey changes the scope the file is written under; a stale first
79
+ * line would make every later planExport/planTombstone refuse with
80
+ * repo_mismatch forever. Only the header line is replaced; the entry
81
+ * bytes, line endings and trailing newline are preserved. The write
82
+ * goes through the single funnel (D8-08). Returns true when the
83
+ * header was rewritten. Never throws: a missing or unreadable file
84
+ * is nothing to heal.
85
+ */
86
+ healHeader(path: string, newRepoId: string): boolean;
87
+ /**
88
+ * Apply a previously planned export: the write goes through the
89
+ * single write funnel (re-planning against the file's current state),
90
+ * and the outcome is recorded on the returned plan (K8-020).
91
+ */
92
+ applyExport(plan: ExportPlan): ExportPlan;
93
+ /** Refusal plans are audited with both hashes (after === before). */
94
+ private refused;
95
+ /**
96
+ * Convert the requested local memories into OKF candidates and run
97
+ * the candidate-side refusals — line_too_long, below_floor,
98
+ * not_curated — in plan §5.5 order.
99
+ */
100
+ private candidateEntries;
101
+ private setting;
102
+ private readWithFlag;
103
+ /**
104
+ * Read and parse the shared file. Total: a missing or unreadable
105
+ * file yields an empty ParseResult, never a throw (D8-14).
106
+ */
107
+ read(path: string): ParseResult;
108
+ /**
109
+ * Idempotent and cheap to call (K8-016 / plan §5.5): hash the file
110
+ * first and return `{ skipped: true }` when the hash matches the
111
+ * most recent `okf_imports` row for this repo_id — the session.idle
112
+ * path costs one readFileSync plus one hash on an unchanged
113
+ * repository. A missing file is not an error: it returns
114
+ * `fileHash: null`, `parsed: 0`, and still writes an audit row.
115
+ */
116
+ import(path: string): ImportReport;
117
+ private writeImportRow;
118
+ /**
119
+ * Project every imported entry into memories (K8-017 / plan §5.5,
120
+ * D8-10): a shared memory IS a memory, so getRelevant(), rankScore(),
121
+ * the five gates, truth_penalty, ConflictDetector and every audit
122
+ * rollup keep working unchanged.
123
+ *
124
+ * - assert entries: inserted once, never updated — re-importing an
125
+ * unchanged file must not create duplicates, bump evidence_count or
126
+ * move updated_at. `fingerprint` is deliberately left NULL: it is a
127
+ * different identity dimension (plan §3.3) and conflating it with
128
+ * `shared_entry_id` would make the v0.4.0 supersede path fire on
129
+ * unrelated entries (K8-017 acceptance).
130
+ * - tombstone entries: the ONE place in this codebase where the shared
131
+ * layer may write memories.status. This is NOT a v0.7.0 Principle 24
132
+ * violation: that principle forbids *contradiction* — a fuzzy
133
+ * inference — from writing status, and a tombstone is the opposite:
134
+ * an explicit, committed, human-reviewed decision that arrived
135
+ * through a pull request (D8-09, plan §5.5).
136
+ *
137
+ * Returns the number of memories archived by tombstones.
138
+ */
139
+ private projectEntries;
140
+ /**
141
+ * Upsert every entry into shared_entries keyed on (repo_id,
142
+ * entry_id) — the UNIQUE index from migration 009 makes this an
143
+ * upsert rather than an append. `confidence` is the DERIVED value
144
+ * (deriveConfidence), never a transported float (plan §5.3).
145
+ * Returns the number of rows inserted or updated.
146
+ */
147
+ private upsertEntries;
148
+ }
149
+ /**
150
+ * The Store surface SharedLayer needs. Kept structural so tests can
151
+ * use the real Store without importing plugin internals.
152
+ */
153
+ export interface StoreLike {
154
+ prepare(sql: string): {
155
+ get(...params: unknown[]): unknown;
156
+ all(...params: unknown[]): unknown[];
157
+ run(...params: unknown[]): void;
158
+ };
159
+ }