@theokit/sdk-memory 0.7.3 → 0.7.4

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.
@@ -1,84 +1,6 @@
1
- import type { MemoryIndex } from "./index/memory-index.js";
2
- import type { MemoryRoot } from "./store/markdown-store.js";
3
1
  /**
4
- * Memory tools (`memory_search` + `memory_get`) — ADR D5 of
5
- * memory-system-peer-project-parity. Tool schemas mirror peer-project
6
- * (`reference/peer-project/extensions/memory-core/src/tools.ts:228-475`).
7
- *
8
- * Each tool is exposed as a `MemoryTool` (name + description + JSON schema +
9
- * async execute). The agent-loop integration wires them via the existing
10
- * `ResolvedTool` interface in `tool-dispatch.ts`.
11
- *
12
- * Iter 64 (Stage 3 source-move #21): hybrid copy from sdk-core's
13
- * `internal/memory/tools.ts`. sdk-core retains its copy for v1.x
14
- * memory-tools back-compat; sdk-memory ships the canonical copy.
15
- * Dependency chain (all resolved):
16
- * - `@theokit/sdk/errors` for `ConfigurationError` (public)
17
- * - sibling `./index-manager-contract.js` for `MemorySearchHit`
18
- * (moved iter 47 — note: sdk-core copy imports from
19
- * `./index-manager.js`; sdk-memory uses the contract leaf
20
- * directly since the canonical type lives there)
21
- * - sibling `./memory-index.js` for `MemoryIndex` (moved iter 50)
22
- * - sibling `./markdown-store.js` for `memoryDir` (moved iter 56)
23
- * - sibling `./reader.js` for `readMemoryFileBounded` (moved iter 55)
24
- *
25
- * @internal
2
+ * Memory tools (`memory_search` + `memory_get`) — re-exported from `@theokit/sdk`, not
3
+ * reimplemented here (#1069).
26
4
  */
27
- export interface MemoryToolJson {
28
- name: string;
29
- description: string;
30
- inputSchema: Record<string, unknown>;
31
- }
32
- /**
33
- * A memory tool ready to hand to the agent loop: the JSON-serialisable
34
- * description an LLM sees, plus the `execute` that runs it. `execute` resolves
35
- * to a JSON string — the tool layer does no further encoding.
36
- */
37
- export interface MemoryTool extends MemoryToolJson {
38
- execute(input: Record<string, unknown>): Promise<string>;
39
- }
40
- /** Options for {@link createMemorySearchTool}. */
41
- export interface MemorySearchToolOptions {
42
- index: MemoryIndex;
43
- /** Cap on the JSON response size (EC-10 of edge-case review). Default 16384. */
44
- maxTotalChars?: number;
45
- }
46
- /**
47
- * Build the `memory_search` tool over an index that is already open. The tool
48
- * never opens or syncs anything: if `index.sync()` has not run, the search runs
49
- * against whatever the index last recorded, and a freshly created index returns
50
- * no hits.
51
- *
52
- * The tool accepts `query` (required), `maxResults` (default 10), `minScore`,
53
- * and `corpus`, where `corpus` maps to the index's source filter: `memory`,
54
- * `sessions`, `wiki`, or `all` (the default, which applies no filter). An
55
- * unrecognised `corpus` value is treated as `all` rather than rejected.
56
- *
57
- * `execute` returns `{"hits": [...], "truncated": bool}`. Hits are dropped from
58
- * the tail once their estimated size would exceed `maxTotalChars`, except that
59
- * the first hit is always kept even when it alone exceeds the cap.
60
- *
61
- * Use this for recall by meaning across the whole corpus, and
62
- * {@link createMemoryGetTool} when the model already knows the file and wants
63
- * exact lines.
64
- */
65
- export declare function createMemorySearchTool(opts: MemorySearchToolOptions): MemoryTool;
66
- /** Options for {@link createMemoryGetTool}. `cwd` is the workspace root, not the memory directory. */
67
- export interface MemoryGetToolOptions {
68
- /** The RESOLVED memory root the tool may read inside — not a cwd (#463). */
69
- root: MemoryRoot;
70
- }
71
- /**
72
- * Build the `memory_get` tool, which reads an exact excerpt from a file under
73
- * `<cwd>/.theokit/memory`. Needs no index and no embedding runtime — it is
74
- * plain file reading, so it works in a workspace where search is not configured.
75
- *
76
- * The tool accepts `path` (required, relative to the memory root), `from`
77
- * (1-indexed, default 1) and `lines` (default 200). A `path` whose resolved
78
- * location falls outside the memory root is rejected with a
79
- * `ConfigurationError` carrying the code `memory_path_escapes_root`. A path that
80
- * stays inside but does not exist is not caught here: the underlying read
81
- * rejects with the filesystem error.
82
- */
83
- export declare function createMemoryGetTool(opts: MemoryGetToolOptions): MemoryTool;
5
+ export { createMemoryGetTool, createMemorySearchTool, type MemoryGetToolOptions, type MemorySearchToolOptions, type MemoryTool, type MemoryToolJson, } from "@theokit/sdk/internal/memory-store";
84
6
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/internal/tools.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1D;AAiCD,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,WAAW,CAAC;IACnB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,uBAAuB,GAAG,UAAU,CAqBhF;AAED,sGAAsG;AACtG,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,UAAU,CA4B1E"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/internal/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EACf,KAAK,cAAc,GACpB,MAAM,oCAAoC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk-memory",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "Memory subsystem for @theokit/sdk — MemoryProvider impls (markdown file store today; LanceDB + embeddings + circuit breaker next iters). Consumes the kernel-facing port from sdk-core.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/usetheokit/theokit-sdk#readme",
@@ -41,7 +41,7 @@
41
41
  "better-sqlite3": "^12.0.0",
42
42
  "sqlite-vec": ">=0.1.0",
43
43
  "@lancedb/lancedb": ">=0.20.0",
44
- "@theokit/sdk": "^9.0.0"
44
+ "@theokit/sdk": "^9.1.0"
45
45
  },
46
46
  "peerDependenciesMeta": {
47
47
  "better-sqlite3": {
@@ -61,7 +61,7 @@
61
61
  "@types/better-sqlite3": "^7.6.13",
62
62
  "better-sqlite3": "^12.10.0",
63
63
  "sqlite-vec": "^0.1.6",
64
- "@theokit/sdk": "9.0.0"
64
+ "@theokit/sdk": "9.1.0"
65
65
  },
66
66
  "publishConfig": {
67
67
  "provenance": true,