@zenera/neo 1.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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +178 -0
  3. package/dist/agent.d.ts +66 -0
  4. package/dist/agent.js +97 -0
  5. package/dist/architecture.d.ts +74 -0
  6. package/dist/architecture.js +105 -0
  7. package/dist/embedding.d.ts +60 -0
  8. package/dist/embedding.js +21 -0
  9. package/dist/embeddings/gemini.d.ts +24 -0
  10. package/dist/embeddings/gemini.js +71 -0
  11. package/dist/embeddings/index.d.ts +4 -0
  12. package/dist/embeddings/index.js +4 -0
  13. package/dist/embeddings/openai.d.ts +18 -0
  14. package/dist/embeddings/openai.js +27 -0
  15. package/dist/embeddings/openrouter.d.ts +21 -0
  16. package/dist/embeddings/openrouter.js +54 -0
  17. package/dist/events.d.ts +144 -0
  18. package/dist/events.js +110 -0
  19. package/dist/ids.d.ts +14 -0
  20. package/dist/ids.js +33 -0
  21. package/dist/index.d.ts +25 -0
  22. package/dist/index.js +25 -0
  23. package/dist/inspect/client.d.ts +2 -0
  24. package/dist/inspect/client.js +1326 -0
  25. package/dist/inspect/css.d.ts +2 -0
  26. package/dist/inspect/css.js +164 -0
  27. package/dist/inspect/index.d.ts +9 -0
  28. package/dist/inspect/index.js +12 -0
  29. package/dist/inspect/page.d.ts +3 -0
  30. package/dist/inspect/page.js +93 -0
  31. package/dist/inspect/report.d.ts +54 -0
  32. package/dist/inspect/report.js +62 -0
  33. package/dist/kernel.d.ts +178 -0
  34. package/dist/kernel.js +929 -0
  35. package/dist/memory-stores/factory.d.ts +15 -0
  36. package/dist/memory-stores/factory.js +29 -0
  37. package/dist/memory-stores/file.d.ts +37 -0
  38. package/dist/memory-stores/file.js +174 -0
  39. package/dist/memory-stores/in-memory.d.ts +17 -0
  40. package/dist/memory-stores/in-memory.js +80 -0
  41. package/dist/memory-stores/index.d.ts +4 -0
  42. package/dist/memory-stores/index.js +5 -0
  43. package/dist/memory.d.ts +115 -0
  44. package/dist/memory.js +213 -0
  45. package/dist/model.d.ts +25 -0
  46. package/dist/model.js +2 -0
  47. package/dist/models/anthropic.d.ts +36 -0
  48. package/dist/models/anthropic.js +293 -0
  49. package/dist/models/factory.d.ts +202 -0
  50. package/dist/models/factory.js +533 -0
  51. package/dist/models/gemini.d.ts +45 -0
  52. package/dist/models/gemini.js +368 -0
  53. package/dist/models/index.d.ts +7 -0
  54. package/dist/models/index.js +7 -0
  55. package/dist/models/openai-chat.d.ts +19 -0
  56. package/dist/models/openai-chat.js +203 -0
  57. package/dist/models/openai-responses.d.ts +31 -0
  58. package/dist/models/openai-responses.js +258 -0
  59. package/dist/models/openrouter.d.ts +44 -0
  60. package/dist/models/openrouter.js +230 -0
  61. package/dist/payload-stores/factory.d.ts +15 -0
  62. package/dist/payload-stores/factory.js +30 -0
  63. package/dist/payload-stores/file.d.ts +29 -0
  64. package/dist/payload-stores/file.js +112 -0
  65. package/dist/payload-stores/in-memory.d.ts +17 -0
  66. package/dist/payload-stores/in-memory.js +40 -0
  67. package/dist/payload-stores/index.d.ts +4 -0
  68. package/dist/payload-stores/index.js +5 -0
  69. package/dist/payload.d.ts +89 -0
  70. package/dist/payload.js +181 -0
  71. package/dist/project/config.d.ts +302 -0
  72. package/dist/project/config.js +290 -0
  73. package/dist/project/index.d.ts +4 -0
  74. package/dist/project/index.js +4 -0
  75. package/dist/project/load.d.ts +142 -0
  76. package/dist/project/load.js +430 -0
  77. package/dist/project/refs.d.ts +23 -0
  78. package/dist/project/refs.js +70 -0
  79. package/dist/prompt.d.ts +66 -0
  80. package/dist/prompt.js +62 -0
  81. package/dist/runner.d.ts +103 -0
  82. package/dist/runner.js +537 -0
  83. package/dist/services.d.ts +23 -0
  84. package/dist/services.js +44 -0
  85. package/dist/skill-providers/factory.d.ts +16 -0
  86. package/dist/skill-providers/factory.js +26 -0
  87. package/dist/skill-providers/file.d.ts +44 -0
  88. package/dist/skill-providers/file.js +209 -0
  89. package/dist/skill-providers/index.d.ts +4 -0
  90. package/dist/skill-providers/index.js +5 -0
  91. package/dist/skill-providers/static.d.ts +13 -0
  92. package/dist/skill-providers/static.js +47 -0
  93. package/dist/skills.d.ts +102 -0
  94. package/dist/skills.js +232 -0
  95. package/dist/state.d.ts +86 -0
  96. package/dist/state.js +49 -0
  97. package/dist/tools/exa.d.ts +23 -0
  98. package/dist/tools/exa.js +389 -0
  99. package/dist/tools/index.d.ts +4 -0
  100. package/dist/tools/index.js +6 -0
  101. package/dist/tools/sandbox.d.ts +172 -0
  102. package/dist/tools/sandbox.js +602 -0
  103. package/dist/tools/workspace.d.ts +53 -0
  104. package/dist/tools/workspace.js +1034 -0
  105. package/dist/trajectory.d.ts +213 -0
  106. package/dist/trajectory.js +232 -0
  107. package/dist/types.d.ts +195 -0
  108. package/dist/types.js +134 -0
  109. package/package.json +98 -0
@@ -0,0 +1,15 @@
1
+ import type { MemoryStore } from '../memory.ts';
2
+ import { type FileMemoryStoreOptions } from './file.ts';
3
+ export interface MemoryMemoryStoreSpec {
4
+ kind: 'memory';
5
+ id?: string;
6
+ }
7
+ export interface FileMemoryStoreSpec extends FileMemoryStoreOptions {
8
+ kind: 'file';
9
+ }
10
+ /** Grows a member per backend (`pgvector`, `redis`, …). */
11
+ export type MemoryStoreSpec = MemoryMemoryStoreSpec | FileMemoryStoreSpec;
12
+ /** Shorthand: `mem`, `memory`, `file:./.data/memory`. */
13
+ export type MemoryStoreRef = MemoryStoreSpec | string;
14
+ export declare function createMemoryStore(ref: MemoryStoreRef): MemoryStore;
15
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { FileMemoryStore } from "./file.js";
2
+ import { InMemoryMemoryStore } from "./in-memory.js";
3
+ export function createMemoryStore(ref) {
4
+ const spec = typeof ref === 'string' ? parseRef(ref) : ref;
5
+ switch (spec.kind) {
6
+ case 'memory':
7
+ return new InMemoryMemoryStore(spec.id);
8
+ case 'file':
9
+ return new FileMemoryStore(spec);
10
+ default:
11
+ throw new TypeError(`unknown memory store kind: ${spec.kind}`);
12
+ }
13
+ }
14
+ function parseRef(ref) {
15
+ if (ref === 'mem' || ref === 'memory') {
16
+ return { kind: 'memory' };
17
+ }
18
+ const colon = ref.indexOf(':');
19
+ const scheme = colon < 0 ? ref : ref.slice(0, colon);
20
+ const rest = colon < 0 ? '' : ref.slice(colon + 1);
21
+ if (scheme === 'file') {
22
+ if (!rest) {
23
+ throw new TypeError(`missing directory in "${ref}" (expected file:<dir>)`);
24
+ }
25
+ return { kind: 'file', dir: rest };
26
+ }
27
+ throw new TypeError(`unknown memory store ref: "${ref}"`);
28
+ }
29
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1,37 @@
1
+ import { type MemoryDraft, type MemoryHit, type MemoryPatch, type MemoryQuery, type MemoryRecord, type MemoryStore } from '../memory.ts';
2
+ export interface FileMemoryStoreOptions {
3
+ /** root directory; created on demand */
4
+ dir: string;
5
+ /** logical store id agents bind to; defaults to `file` */
6
+ id?: string;
7
+ }
8
+ /**
9
+ * One JSON file per record, under one directory per scope:
10
+ *
11
+ * ```
12
+ * <dir>/<scope>/scope.json the unescaped scope name, for humans
13
+ * <dir>/<scope>/records/<id>.json
14
+ * <dir>/<scope>/ops/<opId>.json idempotency ledger
15
+ * ```
16
+ *
17
+ * A file per record (rather than one appended log) keeps writes atomic and
18
+ * deletes cheap without a compaction step. Search reads the whole scope and
19
+ * ranks in process, which is exactly the trade this backend makes: no server,
20
+ * no index, fine up to a few thousand records per scope.
21
+ *
22
+ * There is no cross-process lock. Concurrent writers to the *same* record can
23
+ * lose an update; `expectedRevision` narrows that window, and a deployment
24
+ * that needs real isolation should use a database-backed store.
25
+ */
26
+ export declare class FileMemoryStore implements MemoryStore {
27
+ #private;
28
+ readonly id: string;
29
+ constructor(opts: FileMemoryStoreOptions | string);
30
+ get dir(): string;
31
+ search(scope: string, q: MemoryQuery): Promise<MemoryHit[]>;
32
+ get(scope: string, id: string): Promise<MemoryRecord | undefined>;
33
+ write(scope: string, rec: MemoryDraft, opId: string): Promise<MemoryRecord>;
34
+ update(scope: string, id: string, patch: MemoryPatch, opId: string): Promise<MemoryRecord>;
35
+ delete(scope: string, id: string, opId: string): Promise<void>;
36
+ }
37
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1,174 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { mkdir, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises';
3
+ import { join, resolve } from 'node:path';
4
+ import { rankMemories, } from "../memory.js";
5
+ // ---------------------------------------------------------------------------
6
+ // Filesystem-backed memory store
7
+ // ---------------------------------------------------------------------------
8
+ /**
9
+ * Record ids and op ids reach this store from model-authored tool arguments
10
+ * (`memory_update`, `memory_delete`), so they are validated before becoming
11
+ * path segments. Dots are excluded outright, which makes `.` and `..`
12
+ * unrepresentable.
13
+ */
14
+ const SAFE_ID = /^[A-Za-z0-9_-]+$/;
15
+ /**
16
+ * One JSON file per record, under one directory per scope:
17
+ *
18
+ * ```
19
+ * <dir>/<scope>/scope.json the unescaped scope name, for humans
20
+ * <dir>/<scope>/records/<id>.json
21
+ * <dir>/<scope>/ops/<opId>.json idempotency ledger
22
+ * ```
23
+ *
24
+ * A file per record (rather than one appended log) keeps writes atomic and
25
+ * deletes cheap without a compaction step. Search reads the whole scope and
26
+ * ranks in process, which is exactly the trade this backend makes: no server,
27
+ * no index, fine up to a few thousand records per scope.
28
+ *
29
+ * There is no cross-process lock. Concurrent writers to the *same* record can
30
+ * lose an update; `expectedRevision` narrows that window, and a deployment
31
+ * that needs real isolation should use a database-backed store.
32
+ */
33
+ export class FileMemoryStore {
34
+ id;
35
+ #dir;
36
+ constructor(opts) {
37
+ const o = typeof opts === 'string' ? { dir: opts } : opts;
38
+ this.#dir = resolve(o.dir);
39
+ this.id = o.id ?? 'file';
40
+ }
41
+ get dir() {
42
+ return this.#dir;
43
+ }
44
+ async search(scope, q) {
45
+ return rankMemories(await this.#all(scope), q);
46
+ }
47
+ async get(scope, id) {
48
+ return this.#readJson(this.#recordPath(scope, id));
49
+ }
50
+ async write(scope, rec, opId) {
51
+ const known = await this.#readOp(scope, opId);
52
+ if (known) {
53
+ const existing = await this.get(scope, known);
54
+ if (existing) {
55
+ return existing;
56
+ }
57
+ }
58
+ const now = new Date().toISOString();
59
+ const record = {
60
+ id: randomUUID(),
61
+ scope,
62
+ kind: rec.kind ?? 'fact',
63
+ text: rec.text,
64
+ metadata: rec.metadata,
65
+ createdAt: now,
66
+ updatedAt: now,
67
+ revision: 1,
68
+ };
69
+ await this.#writeRecord(record);
70
+ await this.#writeOp(scope, opId, record.id);
71
+ return record;
72
+ }
73
+ async update(scope, id, patch, opId) {
74
+ const cur = await this.get(scope, id);
75
+ if (!cur) {
76
+ throw new Error(`memory record not found: ${scope}/${id}`);
77
+ }
78
+ if ((await this.#readOp(scope, opId)) === id) {
79
+ return cur;
80
+ }
81
+ if (patch.expectedRevision !== undefined && patch.expectedRevision !== cur.revision) {
82
+ throw new Error(`memory conflict on ${scope}/${id}: expected revision ` +
83
+ `${patch.expectedRevision}, found ${cur.revision}`);
84
+ }
85
+ const next = {
86
+ ...cur,
87
+ kind: patch.kind ?? cur.kind,
88
+ text: patch.text ?? cur.text,
89
+ metadata: patch.metadata ?? cur.metadata,
90
+ updatedAt: new Date().toISOString(),
91
+ revision: cur.revision + 1,
92
+ };
93
+ await this.#writeRecord(next);
94
+ await this.#writeOp(scope, opId, id);
95
+ return next;
96
+ }
97
+ async delete(scope, id, opId) {
98
+ await rm(this.#recordPath(scope, id), { force: true });
99
+ await this.#writeOp(scope, opId, id);
100
+ }
101
+ // --- layout -----------------------------------------------------------
102
+ /**
103
+ * Percent-encoding is reversible and, with dots escaped too, cannot
104
+ * produce a traversal segment out of a scope like `../etc`.
105
+ */
106
+ #scopeDir(scope) {
107
+ return join(this.#dir, encodeURIComponent(scope).replace(/\./g, '%2E'));
108
+ }
109
+ #recordPath(scope, id) {
110
+ return join(this.#scopeDir(scope), 'records', `${safeId(id, 'record id')}.json`);
111
+ }
112
+ #opPath(scope, opId) {
113
+ return join(this.#scopeDir(scope), 'ops', `${safeId(opId, 'op id')}.json`);
114
+ }
115
+ // --- io ---------------------------------------------------------------
116
+ async #all(scope) {
117
+ const dir = join(this.#scopeDir(scope), 'records');
118
+ let names;
119
+ try {
120
+ names = await readdir(dir);
121
+ }
122
+ catch (err) {
123
+ if (err.code === 'ENOENT') {
124
+ return [];
125
+ }
126
+ throw err;
127
+ }
128
+ const records = await Promise.all(names
129
+ .filter((n) => n.endsWith('.json'))
130
+ .map((n) => this.#readJson(join(dir, n))));
131
+ return records.filter((r) => r !== undefined);
132
+ }
133
+ async #readOp(scope, opId) {
134
+ const op = await this.#readJson(this.#opPath(scope, opId));
135
+ return op?.recordId;
136
+ }
137
+ async #writeOp(scope, opId, recordId) {
138
+ await writeJson(this.#opPath(scope, opId), { recordId });
139
+ }
140
+ async #writeRecord(record) {
141
+ await writeJson(join(this.#scopeDir(record.scope), 'scope.json'), { scope: record.scope });
142
+ await writeJson(this.#recordPath(record.scope, record.id), record);
143
+ }
144
+ async #readJson(path) {
145
+ try {
146
+ return JSON.parse(await readFile(path, 'utf8'));
147
+ }
148
+ catch (err) {
149
+ if (err.code === 'ENOENT') {
150
+ return undefined;
151
+ }
152
+ throw err;
153
+ }
154
+ }
155
+ }
156
+ function safeId(value, what) {
157
+ if (!SAFE_ID.test(value)) {
158
+ throw new Error(`invalid ${what}: ${JSON.stringify(value)}`);
159
+ }
160
+ return value;
161
+ }
162
+ async function writeJson(path, value) {
163
+ await mkdir(join(path, '..'), { recursive: true });
164
+ const tmp = `${path}.${process.pid}.${randomUUID()}.tmp`;
165
+ await writeFile(tmp, JSON.stringify(value), 'utf8');
166
+ try {
167
+ await rename(tmp, path);
168
+ }
169
+ catch (err) {
170
+ await rm(tmp, { force: true });
171
+ throw err;
172
+ }
173
+ }
174
+ //# sourceMappingURL=file.js.map
@@ -0,0 +1,17 @@
1
+ import { type MemoryDraft, type MemoryHit, type MemoryPatch, type MemoryQuery, type MemoryRecord, type MemoryStore } from '../memory.ts';
2
+ /**
3
+ * Reference implementation: scoped maps plus token-overlap scoring. Good enough
4
+ * for tests and local runs; production deployments swap in a vector store
5
+ * without touching the kernel.
6
+ */
7
+ export declare class InMemoryMemoryStore implements MemoryStore {
8
+ #private;
9
+ readonly id: string;
10
+ constructor(id?: string);
11
+ search(scope: string, q: MemoryQuery): Promise<MemoryHit[]>;
12
+ get(scope: string, id: string): Promise<MemoryRecord | undefined>;
13
+ write(scope: string, rec: MemoryDraft, opId: string): Promise<MemoryRecord>;
14
+ update(scope: string, id: string, patch: MemoryPatch, opId: string): Promise<MemoryRecord>;
15
+ delete(scope: string, id: string, opId: string): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=in-memory.d.ts.map
@@ -0,0 +1,80 @@
1
+ import { rankMemories, } from "../memory.js";
2
+ /**
3
+ * Reference implementation: scoped maps plus token-overlap scoring. Good enough
4
+ * for tests and local runs; production deployments swap in a vector store
5
+ * without touching the kernel.
6
+ */
7
+ export class InMemoryMemoryStore {
8
+ id;
9
+ #scopes = new Map();
10
+ /** opId → record id, so a replayed op returns the original result */
11
+ #ops = new Map();
12
+ #seq = 0;
13
+ constructor(id = 'mem') {
14
+ this.id = id;
15
+ }
16
+ async search(scope, q) {
17
+ return rankMemories(this.#space(scope).values(), q);
18
+ }
19
+ async get(scope, id) {
20
+ return this.#space(scope).get(id);
21
+ }
22
+ async write(scope, rec, opId) {
23
+ const known = this.#ops.get(opId);
24
+ if (known) {
25
+ const existing = this.#space(scope).get(known);
26
+ if (existing) {
27
+ return existing;
28
+ }
29
+ }
30
+ const now = new Date().toISOString();
31
+ const record = {
32
+ id: `m${++this.#seq}`,
33
+ scope,
34
+ kind: rec.kind ?? 'fact',
35
+ text: rec.text,
36
+ metadata: rec.metadata,
37
+ createdAt: now,
38
+ updatedAt: now,
39
+ revision: 1,
40
+ };
41
+ this.#space(scope).set(record.id, record);
42
+ this.#ops.set(opId, record.id);
43
+ return record;
44
+ }
45
+ async update(scope, id, patch, opId) {
46
+ const space = this.#space(scope);
47
+ const cur = space.get(id);
48
+ if (!cur) {
49
+ throw new Error(`memory record not found: ${scope}/${id}`);
50
+ }
51
+ if (this.#ops.get(opId) === id) {
52
+ return cur;
53
+ }
54
+ if (patch.expectedRevision !== undefined && patch.expectedRevision !== cur.revision) {
55
+ throw new Error(`memory conflict on ${scope}/${id}: expected revision ` +
56
+ `${patch.expectedRevision}, found ${cur.revision}`);
57
+ }
58
+ const next = {
59
+ ...cur,
60
+ kind: patch.kind ?? cur.kind,
61
+ text: patch.text ?? cur.text,
62
+ metadata: patch.metadata ?? cur.metadata,
63
+ updatedAt: new Date().toISOString(),
64
+ revision: cur.revision + 1,
65
+ };
66
+ space.set(id, next);
67
+ this.#ops.set(opId, id);
68
+ return next;
69
+ }
70
+ async delete(scope, id, opId) {
71
+ this.#space(scope).delete(id);
72
+ this.#ops.set(opId, id);
73
+ }
74
+ #space(scope) {
75
+ const s = this.#scopes.get(scope) ?? new Map();
76
+ this.#scopes.set(scope, s);
77
+ return s;
78
+ }
79
+ }
80
+ //# sourceMappingURL=in-memory.js.map
@@ -0,0 +1,4 @@
1
+ export * from './factory.ts';
2
+ export * from './file.ts';
3
+ export * from './in-memory.ts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ // Backends for the `MemoryStore` contract in `../memory.ts`.
2
+ export * from "./factory.js";
3
+ export * from "./file.js";
4
+ export * from "./in-memory.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,115 @@
1
+ import { type AnyTool } from './types.ts';
2
+ export interface MemoryRecord {
3
+ id: string;
4
+ /** memory space this record belongs to */
5
+ scope: string;
6
+ /** app-defined: 'fact' | 'preference' | 'episode' | … */
7
+ kind: string;
8
+ text: string;
9
+ metadata?: Record<string, unknown>;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ /** optimistic-concurrency token */
13
+ revision: number;
14
+ }
15
+ export interface MemoryDraft {
16
+ kind?: string;
17
+ text: string;
18
+ metadata?: Record<string, unknown>;
19
+ }
20
+ export interface MemoryPatch {
21
+ kind?: string;
22
+ text?: string;
23
+ metadata?: Record<string, unknown>;
24
+ /** when given, the update fails unless the stored revision matches */
25
+ expectedRevision?: number;
26
+ }
27
+ export interface MemoryQuery {
28
+ /** semantic query; omitted ⇒ pure filter listing */
29
+ text?: string;
30
+ filter?: Record<string, unknown>;
31
+ kind?: string;
32
+ limit?: number;
33
+ minScore?: number;
34
+ }
35
+ export interface MemoryHit {
36
+ record: MemoryRecord;
37
+ /** 0..1, backend-normalized */
38
+ score: number;
39
+ }
40
+ /**
41
+ * Embedding generation is the store's business, not the kernel's: a pgvector
42
+ * implementation embeds inside `write`/`search`, the in-memory one below falls
43
+ * back to token overlap. The kernel never sees vectors.
44
+ */
45
+ export interface MemoryStore {
46
+ readonly id: string;
47
+ search(scope: string, q: MemoryQuery): Promise<MemoryHit[]>;
48
+ get(scope: string, id: string): Promise<MemoryRecord | undefined>;
49
+ /** `opId` makes writes idempotent under retry/replay */
50
+ write(scope: string, rec: MemoryDraft, opId: string): Promise<MemoryRecord>;
51
+ update(scope: string, id: string, patch: MemoryPatch, opId: string): Promise<MemoryRecord>;
52
+ delete(scope: string, id: string, opId: string): Promise<void>;
53
+ }
54
+ export interface MemoryBinding<TCtx = unknown> {
55
+ /** MemoryStore id */
56
+ store: string;
57
+ /** namespace; default `agent:${agent.name}`. A function is resolved per run. */
58
+ scope?: string | ((ctx: TCtx) => string);
59
+ access: 'read' | 'read-write';
60
+ /** inject top-k matches before an LLM call */
61
+ autoRecall?: {
62
+ query: 'last_user_input' | 'none';
63
+ limit: number;
64
+ };
65
+ }
66
+ /** A binding with its scope already resolved against the run context. */
67
+ export interface ResolvedBinding {
68
+ store: string;
69
+ scope: string;
70
+ access: 'read' | 'read-write';
71
+ autoRecall?: {
72
+ query: 'last_user_input' | 'none';
73
+ limit: number;
74
+ };
75
+ }
76
+ export interface MemoryRecallSpec {
77
+ kind: 'recall';
78
+ store: string;
79
+ scope: string;
80
+ query: MemoryQuery;
81
+ hits: {
82
+ id: string;
83
+ score: number;
84
+ revision: number;
85
+ }[];
86
+ /** the rendered block the model actually saw */
87
+ content: string;
88
+ }
89
+ export interface MemoryOpSpec {
90
+ kind: 'op';
91
+ op: 'write' | 'update' | 'delete';
92
+ store: string;
93
+ scope: string;
94
+ /** sha256(runId, callId) — deterministic, so replay re-issues the same write */
95
+ opId: string;
96
+ recordId: string;
97
+ revision: number;
98
+ before?: string;
99
+ after?: string;
100
+ }
101
+ export declare function memoryOpId(runId: string, callId: string): string;
102
+ export declare function renderMemories(hits: MemoryHit[]): string;
103
+ /**
104
+ * Filtering plus token-overlap scoring, shared by the backends that have no
105
+ * embeddings of their own. A vector store ignores this and ranks in the
106
+ * database instead — the kernel only ever sees `MemoryHit[]`.
107
+ */
108
+ export declare function rankMemories(records: Iterable<MemoryRecord>, q: MemoryQuery): MemoryHit[];
109
+ /**
110
+ * Memory is reachable both explicitly (these tools) and implicitly (auto-recall
111
+ * in the runner). Both land in the trajectory; only the explicit path is
112
+ * visible to the model as a tool.
113
+ */
114
+ export declare function memoryTools<TCtx>(bindings: ResolvedBinding[]): AnyTool<TCtx>[];
115
+ //# sourceMappingURL=memory.d.ts.map