@supermemory/eve 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 (52) hide show
  1. package/README.md +176 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +1 -0
  4. package/dist/lib/add-document.d.ts +14 -0
  5. package/dist/lib/add-document.js +11 -0
  6. package/dist/lib/auto-search.d.ts +8 -0
  7. package/dist/lib/auto-search.js +73 -0
  8. package/dist/lib/capture-conversation.d.ts +4 -0
  9. package/dist/lib/capture-conversation.js +63 -0
  10. package/dist/lib/client.d.ts +2 -0
  11. package/dist/lib/client.js +4 -0
  12. package/dist/lib/container-tags.d.ts +5 -0
  13. package/dist/lib/container-tags.js +14 -0
  14. package/dist/lib/dependencies.d.ts +6 -0
  15. package/dist/lib/dependencies.js +1 -0
  16. package/dist/lib/documents.d.ts +49 -0
  17. package/dist/lib/documents.js +64 -0
  18. package/dist/lib/extract-source.d.ts +11 -0
  19. package/dist/lib/extract-source.js +65 -0
  20. package/dist/lib/forget-matching.d.ts +31 -0
  21. package/dist/lib/forget-matching.js +43 -0
  22. package/dist/lib/forget-memory.d.ts +7 -0
  23. package/dist/lib/forget-memory.js +7 -0
  24. package/dist/lib/messages.d.ts +7 -0
  25. package/dist/lib/messages.js +40 -0
  26. package/dist/lib/profile-context.d.ts +9 -0
  27. package/dist/lib/profile-context.js +198 -0
  28. package/dist/lib/remember.d.ts +11 -0
  29. package/dist/lib/remember.js +35 -0
  30. package/dist/lib/search-context.d.ts +11 -0
  31. package/dist/lib/search-context.js +24 -0
  32. package/dist/options.d.ts +36 -0
  33. package/dist/options.js +51 -0
  34. package/dist/provider.d.ts +3 -0
  35. package/dist/provider.js +73 -0
  36. package/dist/tools/extract.d.ts +18 -0
  37. package/dist/tools/extract.js +27 -0
  38. package/dist/tools/forget-matching.d.ts +58 -0
  39. package/dist/tools/forget-matching.js +47 -0
  40. package/dist/tools/forget.d.ts +10 -0
  41. package/dist/tools/forget.js +25 -0
  42. package/dist/tools/index.d.ts +302 -0
  43. package/dist/tools/index.js +18 -0
  44. package/dist/tools/read-document.d.ts +96 -0
  45. package/dist/tools/read-document.js +28 -0
  46. package/dist/tools/read-session.d.ts +94 -0
  47. package/dist/tools/read-session.js +25 -0
  48. package/dist/tools/remember.d.ts +18 -0
  49. package/dist/tools/remember.js +26 -0
  50. package/dist/tools/search.d.ts +12 -0
  51. package/dist/tools/search.js +29 -0
  52. package/package.json +50 -0
@@ -0,0 +1,58 @@
1
+ import type { SupermemoryDependencies } from "../lib/dependencies.js";
2
+ export declare function createForgetMatchingTool(dependencies: SupermemoryDependencies): import("eve/tools").ToolDefinition<{
3
+ query?: string | undefined;
4
+ dryRun: boolean;
5
+ ids?: string[] | undefined;
6
+ threshold?: number | undefined;
7
+ maxForget?: number | undefined;
8
+ reason?: string | undefined;
9
+ }, {
10
+ dryRun: true;
11
+ count: number;
12
+ forgetBatchId: null;
13
+ summary: string;
14
+ candidates: {
15
+ id: string;
16
+ memory: string;
17
+ score: number;
18
+ }[];
19
+ } | {
20
+ dryRun: false;
21
+ count: number;
22
+ forgetBatchId: string | null;
23
+ summary: string;
24
+ forgotten: {
25
+ id: string;
26
+ memory: string;
27
+ score: number;
28
+ }[];
29
+ }> & {
30
+ execute(input: {
31
+ query?: string | undefined;
32
+ dryRun: boolean;
33
+ ids?: string[] | undefined;
34
+ threshold?: number | undefined;
35
+ maxForget?: number | undefined;
36
+ reason?: string | undefined;
37
+ }, ctx: import("eve/tools").ToolContext): Promise<{
38
+ dryRun: true;
39
+ count: number;
40
+ forgetBatchId: null;
41
+ summary: string;
42
+ candidates: {
43
+ id: string;
44
+ memory: string;
45
+ score: number;
46
+ }[];
47
+ } | {
48
+ dryRun: false;
49
+ count: number;
50
+ forgetBatchId: string | null;
51
+ summary: string;
52
+ forgotten: {
53
+ id: string;
54
+ memory: string;
55
+ score: number;
56
+ }[];
57
+ }>;
58
+ };
@@ -0,0 +1,47 @@
1
+ import { defineTool } from "eve/tools";
2
+ import { z } from "zod";
3
+ import { forgetMatchingMemories } from "../lib/forget-matching.js";
4
+ export function createForgetMatchingTool(dependencies) {
5
+ return defineTool({
6
+ description: "Forget every stored memory within a broad user-defined boundary. Use whenever the user wants to forget, delete, remove, or erase all, everything, or anything about a topic, person, project, or category. First call this tool with dryRun true and a precise query describing the complete boundary; this only previews the matching memories. Show the candidate count and enough candidate detail with ask_question so the user can choose whether to proceed. Their answer to ask_question is the confirmation boundary. When the user confirms, call this tool again with dryRun false and exactly the candidates[].id values returned by that preview, then report the finalized count. This removes derived memories; source documents remain available.",
7
+ inputSchema: z.object({
8
+ query: z
9
+ .string()
10
+ .trim()
11
+ .max(2_000)
12
+ .optional()
13
+ .describe("For dryRun true: a specific natural-language description of everything the user wants forgotten."),
14
+ dryRun: z
15
+ .boolean()
16
+ .default(true)
17
+ .describe("Use true to preview without changing anything. Use false only after the user confirms the exact IDs from that preview."),
18
+ ids: z
19
+ .array(z.string().trim().min(1).max(200))
20
+ .max(500)
21
+ .optional()
22
+ .describe("For dryRun false: the exact candidates[].id values returned by the preceding dry-run call."),
23
+ threshold: z
24
+ .number()
25
+ .min(0)
26
+ .max(1)
27
+ .optional()
28
+ .describe("Optional similarity floor from 0 to 1. Higher values narrow the preview."),
29
+ maxForget: z
30
+ .number()
31
+ .int()
32
+ .min(1)
33
+ .max(500)
34
+ .optional()
35
+ .describe("Optional maximum number of matching memories in the preview, up to 500."),
36
+ reason: z
37
+ .string()
38
+ .trim()
39
+ .max(500)
40
+ .optional()
41
+ .describe("An optional short reason recorded when memories are forgotten."),
42
+ }),
43
+ execute(input, ctx) {
44
+ return forgetMatchingMemories(input, ctx, dependencies);
45
+ },
46
+ });
47
+ }
@@ -0,0 +1,10 @@
1
+ import type { SupermemoryDependencies } from "../lib/dependencies.js";
2
+ export declare function createForgetTool(dependencies: SupermemoryDependencies): import("eve/tools").ToolDefinition<{
3
+ memoryId: string;
4
+ reason?: string | undefined;
5
+ }, import("supermemory/resources/memories.mjs").MemoryForgetResponse> & {
6
+ execute(input: {
7
+ memoryId: string;
8
+ reason?: string | undefined;
9
+ }, ctx: import("eve/tools").ToolContext): import("supermemory").APIPromise<import("supermemory/resources/memories.mjs").MemoryForgetResponse>;
10
+ };
@@ -0,0 +1,25 @@
1
+ import { defineTool } from "eve/tools";
2
+ import { z } from "zod";
3
+ import { forgetMemory } from "../lib/forget-memory.js";
4
+ export function createForgetTool(dependencies) {
5
+ return defineTool({
6
+ description: "Forget one specific stored memory. Use when the user says forget that, delete this from memory, remove what you know about this, do not retain this, or corrects a fact whose old version must be removed, and one unambiguous stored memory represents what they want deleted. First call search with scope memories unless the exact memory result is already available. Identify the result containing the memory field and pass its exact results[].id as memoryId. When the user identifies several specific memories, call this tool once for each exact ID. Use forget_matching when the request covers all, everything, anything about, or another broad topic, person, project, or category.",
7
+ inputSchema: z.object({
8
+ memoryId: z
9
+ .string()
10
+ .trim()
11
+ .min(1)
12
+ .max(200)
13
+ .describe("The exact results[].id from a search result containing a memory field."),
14
+ reason: z
15
+ .string()
16
+ .trim()
17
+ .max(500)
18
+ .optional()
19
+ .describe("An optional short reason recorded with the forgotten memory."),
20
+ }),
21
+ execute(input, ctx) {
22
+ return forgetMemory(input, ctx, dependencies);
23
+ },
24
+ });
25
+ }
@@ -0,0 +1,302 @@
1
+ import type { SupermemoryDependencies } from "../lib/dependencies.js";
2
+ export declare function createSupermemoryTools(dependencies: SupermemoryDependencies): {
3
+ search: import("eve/tools").ToolDefinition<{
4
+ query: string;
5
+ scope: "all" | "conversations" | "documents" | "memories";
6
+ customId?: string | undefined;
7
+ }, import("supermemory/resources/search.mjs").SearchMemoriesResponse> & {
8
+ execute(input: {
9
+ query: string;
10
+ scope: "all" | "conversations" | "documents" | "memories";
11
+ customId?: string | undefined;
12
+ }, ctx: import("eve/tools").ToolContext): Promise<import("supermemory/resources/search.mjs").SearchMemoriesResponse>;
13
+ };
14
+ read_session: import("eve/tools").ToolDefinition<{
15
+ documentId: string;
16
+ offset: number;
17
+ }, {
18
+ id: string;
19
+ customId: string | null;
20
+ connectionId: string | null;
21
+ title: string | null;
22
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
23
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
24
+ taskType: "memory" | "superrag";
25
+ metadata: string | number | boolean | unknown[] | {
26
+ [key: string]: unknown;
27
+ } | null;
28
+ summary: string | null;
29
+ source: string | null;
30
+ url: string | null | undefined;
31
+ filepath: string | null;
32
+ createdAt: string;
33
+ updatedAt: string;
34
+ content: null;
35
+ offset: number;
36
+ nextOffset: null;
37
+ totalCharacters: number | null;
38
+ } | {
39
+ content: string;
40
+ offset: number;
41
+ nextOffset: number | null;
42
+ totalCharacters: number;
43
+ id: string;
44
+ customId: string | null;
45
+ connectionId: string | null;
46
+ title: string | null;
47
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
48
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
49
+ taskType: "memory" | "superrag";
50
+ metadata: string | number | boolean | unknown[] | {
51
+ [key: string]: unknown;
52
+ } | null;
53
+ summary: string | null;
54
+ source: string | null;
55
+ url: string | null | undefined;
56
+ filepath: string | null;
57
+ createdAt: string;
58
+ updatedAt: string;
59
+ }> & {
60
+ execute(input: {
61
+ documentId: string;
62
+ offset: number;
63
+ }, ctx: import("eve/tools").ToolContext): Promise<{
64
+ id: string;
65
+ customId: string | null;
66
+ connectionId: string | null;
67
+ title: string | null;
68
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
69
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
70
+ taskType: "memory" | "superrag";
71
+ metadata: string | number | boolean | unknown[] | {
72
+ [key: string]: unknown;
73
+ } | null;
74
+ summary: string | null;
75
+ source: string | null;
76
+ url: string | null | undefined;
77
+ filepath: string | null;
78
+ createdAt: string;
79
+ updatedAt: string;
80
+ content: null;
81
+ offset: number;
82
+ nextOffset: null;
83
+ totalCharacters: number | null;
84
+ } | {
85
+ content: string;
86
+ offset: number;
87
+ nextOffset: number | null;
88
+ totalCharacters: number;
89
+ id: string;
90
+ customId: string | null;
91
+ connectionId: string | null;
92
+ title: string | null;
93
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
94
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
95
+ taskType: "memory" | "superrag";
96
+ metadata: string | number | boolean | unknown[] | {
97
+ [key: string]: unknown;
98
+ } | null;
99
+ summary: string | null;
100
+ source: string | null;
101
+ url: string | null | undefined;
102
+ filepath: string | null;
103
+ createdAt: string;
104
+ updatedAt: string;
105
+ }>;
106
+ };
107
+ read_document: import("eve/tools").ToolDefinition<{
108
+ container: "agent_context" | "agent_extraction";
109
+ documentId: string;
110
+ offset: number;
111
+ }, {
112
+ id: string;
113
+ customId: string | null;
114
+ connectionId: string | null;
115
+ title: string | null;
116
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
117
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
118
+ taskType: "memory" | "superrag";
119
+ metadata: string | number | boolean | unknown[] | {
120
+ [key: string]: unknown;
121
+ } | null;
122
+ summary: string | null;
123
+ source: string | null;
124
+ url: string | null | undefined;
125
+ filepath: string | null;
126
+ createdAt: string;
127
+ updatedAt: string;
128
+ content: null;
129
+ offset: number;
130
+ nextOffset: null;
131
+ totalCharacters: number | null;
132
+ } | {
133
+ content: string;
134
+ offset: number;
135
+ nextOffset: number | null;
136
+ totalCharacters: number;
137
+ id: string;
138
+ customId: string | null;
139
+ connectionId: string | null;
140
+ title: string | null;
141
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
142
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
143
+ taskType: "memory" | "superrag";
144
+ metadata: string | number | boolean | unknown[] | {
145
+ [key: string]: unknown;
146
+ } | null;
147
+ summary: string | null;
148
+ source: string | null;
149
+ url: string | null | undefined;
150
+ filepath: string | null;
151
+ createdAt: string;
152
+ updatedAt: string;
153
+ }> & {
154
+ execute(input: {
155
+ container: "agent_context" | "agent_extraction";
156
+ documentId: string;
157
+ offset: number;
158
+ }, ctx: import("eve/tools").ToolContext): Promise<{
159
+ id: string;
160
+ customId: string | null;
161
+ connectionId: string | null;
162
+ title: string | null;
163
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
164
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
165
+ taskType: "memory" | "superrag";
166
+ metadata: string | number | boolean | unknown[] | {
167
+ [key: string]: unknown;
168
+ } | null;
169
+ summary: string | null;
170
+ source: string | null;
171
+ url: string | null | undefined;
172
+ filepath: string | null;
173
+ createdAt: string;
174
+ updatedAt: string;
175
+ content: null;
176
+ offset: number;
177
+ nextOffset: null;
178
+ totalCharacters: number | null;
179
+ } | {
180
+ content: string;
181
+ offset: number;
182
+ nextOffset: number | null;
183
+ totalCharacters: number;
184
+ id: string;
185
+ customId: string | null;
186
+ connectionId: string | null;
187
+ title: string | null;
188
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
189
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
190
+ taskType: "memory" | "superrag";
191
+ metadata: string | number | boolean | unknown[] | {
192
+ [key: string]: unknown;
193
+ } | null;
194
+ summary: string | null;
195
+ source: string | null;
196
+ url: string | null | undefined;
197
+ filepath: string | null;
198
+ createdAt: string;
199
+ updatedAt: string;
200
+ }>;
201
+ };
202
+ remember: import("eve/tools").ToolDefinition<{
203
+ memory: string;
204
+ sourceDocumentId?: string | undefined;
205
+ }, {
206
+ documentId: string;
207
+ status: string;
208
+ sourceDocumentId: string | null;
209
+ }> & {
210
+ execute(input: {
211
+ memory: string;
212
+ sourceDocumentId?: string | undefined;
213
+ }, ctx: import("eve/tools").ToolContext): Promise<{
214
+ documentId: string;
215
+ status: string;
216
+ sourceDocumentId: string | null;
217
+ }>;
218
+ };
219
+ extract: import("eve/tools").ToolDefinition<{
220
+ kind: "file" | "text" | "url";
221
+ value: string;
222
+ title?: string | undefined;
223
+ }, {
224
+ documentId: string;
225
+ status: string;
226
+ }> & {
227
+ execute(input: {
228
+ kind: "file" | "text" | "url";
229
+ value: string;
230
+ title?: string | undefined;
231
+ }, ctx: import("eve/tools").ToolContext): Promise<{
232
+ documentId: string;
233
+ status: string;
234
+ }>;
235
+ };
236
+ forget: import("eve/tools").ToolDefinition<{
237
+ memoryId: string;
238
+ reason?: string | undefined;
239
+ }, import("supermemory/resources/memories.mjs").MemoryForgetResponse> & {
240
+ execute(input: {
241
+ memoryId: string;
242
+ reason?: string | undefined;
243
+ }, ctx: import("eve/tools").ToolContext): import("supermemory").APIPromise<import("supermemory/resources/memories.mjs").MemoryForgetResponse>;
244
+ };
245
+ forget_matching: import("eve/tools").ToolDefinition<{
246
+ query?: string | undefined;
247
+ dryRun: boolean;
248
+ ids?: string[] | undefined;
249
+ threshold?: number | undefined;
250
+ maxForget?: number | undefined;
251
+ reason?: string | undefined;
252
+ }, {
253
+ dryRun: true;
254
+ count: number;
255
+ forgetBatchId: null;
256
+ summary: string;
257
+ candidates: {
258
+ id: string;
259
+ memory: string;
260
+ score: number;
261
+ }[];
262
+ } | {
263
+ dryRun: false;
264
+ count: number;
265
+ forgetBatchId: string | null;
266
+ summary: string;
267
+ forgotten: {
268
+ id: string;
269
+ memory: string;
270
+ score: number;
271
+ }[];
272
+ }> & {
273
+ execute(input: {
274
+ query?: string | undefined;
275
+ dryRun: boolean;
276
+ ids?: string[] | undefined;
277
+ threshold?: number | undefined;
278
+ maxForget?: number | undefined;
279
+ reason?: string | undefined;
280
+ }, ctx: import("eve/tools").ToolContext): Promise<{
281
+ dryRun: true;
282
+ count: number;
283
+ forgetBatchId: null;
284
+ summary: string;
285
+ candidates: {
286
+ id: string;
287
+ memory: string;
288
+ score: number;
289
+ }[];
290
+ } | {
291
+ dryRun: false;
292
+ count: number;
293
+ forgetBatchId: string | null;
294
+ summary: string;
295
+ forgotten: {
296
+ id: string;
297
+ memory: string;
298
+ score: number;
299
+ }[];
300
+ }>;
301
+ };
302
+ };
@@ -0,0 +1,18 @@
1
+ import { createExtractTool } from "./extract.js";
2
+ import { createForgetTool } from "./forget.js";
3
+ import { createForgetMatchingTool } from "./forget-matching.js";
4
+ import { createReadDocumentTool } from "./read-document.js";
5
+ import { createReadSessionTool } from "./read-session.js";
6
+ import { createRememberTool } from "./remember.js";
7
+ import { createSearchTool } from "./search.js";
8
+ export function createSupermemoryTools(dependencies) {
9
+ return {
10
+ search: createSearchTool(dependencies),
11
+ read_session: createReadSessionTool(dependencies),
12
+ read_document: createReadDocumentTool(dependencies),
13
+ remember: createRememberTool(dependencies),
14
+ extract: createExtractTool(dependencies),
15
+ forget: createForgetTool(dependencies),
16
+ forget_matching: createForgetMatchingTool(dependencies),
17
+ };
18
+ }
@@ -0,0 +1,96 @@
1
+ import type { SupermemoryDependencies } from "../lib/dependencies.js";
2
+ export declare function createReadDocumentTool(dependencies: SupermemoryDependencies): import("eve/tools").ToolDefinition<{
3
+ container: "agent_context" | "agent_extraction";
4
+ documentId: string;
5
+ offset: number;
6
+ }, {
7
+ id: string;
8
+ customId: string | null;
9
+ connectionId: string | null;
10
+ title: string | null;
11
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
12
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
13
+ taskType: "memory" | "superrag";
14
+ metadata: string | number | boolean | unknown[] | {
15
+ [key: string]: unknown;
16
+ } | null;
17
+ summary: string | null;
18
+ source: string | null;
19
+ url: string | null | undefined;
20
+ filepath: string | null;
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ content: null;
24
+ offset: number;
25
+ nextOffset: null;
26
+ totalCharacters: number | null;
27
+ } | {
28
+ content: string;
29
+ offset: number;
30
+ nextOffset: number | null;
31
+ totalCharacters: number;
32
+ id: string;
33
+ customId: string | null;
34
+ connectionId: string | null;
35
+ title: string | null;
36
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
37
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
38
+ taskType: "memory" | "superrag";
39
+ metadata: string | number | boolean | unknown[] | {
40
+ [key: string]: unknown;
41
+ } | null;
42
+ summary: string | null;
43
+ source: string | null;
44
+ url: string | null | undefined;
45
+ filepath: string | null;
46
+ createdAt: string;
47
+ updatedAt: string;
48
+ }> & {
49
+ execute(input: {
50
+ container: "agent_context" | "agent_extraction";
51
+ documentId: string;
52
+ offset: number;
53
+ }, ctx: import("eve/tools").ToolContext): Promise<{
54
+ id: string;
55
+ customId: string | null;
56
+ connectionId: string | null;
57
+ title: string | null;
58
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
59
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
60
+ taskType: "memory" | "superrag";
61
+ metadata: string | number | boolean | unknown[] | {
62
+ [key: string]: unknown;
63
+ } | null;
64
+ summary: string | null;
65
+ source: string | null;
66
+ url: string | null | undefined;
67
+ filepath: string | null;
68
+ createdAt: string;
69
+ updatedAt: string;
70
+ content: null;
71
+ offset: number;
72
+ nextOffset: null;
73
+ totalCharacters: number | null;
74
+ } | {
75
+ content: string;
76
+ offset: number;
77
+ nextOffset: number | null;
78
+ totalCharacters: number;
79
+ id: string;
80
+ customId: string | null;
81
+ connectionId: string | null;
82
+ title: string | null;
83
+ type: "audio" | "github_markdown" | "google_doc" | "google_sheet" | "google_slide" | "image" | "notion_doc" | "onedrive" | "pdf" | "text" | "tweet" | "video" | "webpage";
84
+ status: "chunking" | "done" | "embedding" | "extracting" | "failed" | "indexing" | "queued" | "unknown";
85
+ taskType: "memory" | "superrag";
86
+ metadata: string | number | boolean | unknown[] | {
87
+ [key: string]: unknown;
88
+ } | null;
89
+ summary: string | null;
90
+ source: string | null;
91
+ url: string | null | undefined;
92
+ filepath: string | null;
93
+ createdAt: string;
94
+ updatedAt: string;
95
+ }>;
96
+ };
@@ -0,0 +1,28 @@
1
+ import { defineTool } from "eve/tools";
2
+ import { z } from "zod";
3
+ import { DOCUMENT_CONTAINERS, readStoredDocument } from "../lib/documents.js";
4
+ export function createReadDocumentTool(dependencies) {
5
+ return defineTool({
6
+ description: "Read a stored or extracted source document. Use after search identifies a document whenever answering the user requires its original wording, evidence, surrounding content, or details beyond the search result. Also use after extract to inspect the processed source before relying on it. For a search result, pass its exact results[].documents[].id with container agent_context. For an extracted source, pass the returned documentId with container agent_extraction. Start with offset 0 and continue with the returned nextOffset whenever more content is needed.",
7
+ inputSchema: z.object({
8
+ container: z
9
+ .enum(DOCUMENT_CONTAINERS)
10
+ .describe("Use agent_context for persistent context and indexed documents. Use agent_extraction for a file, URL, or text source created by extraction."),
11
+ documentId: z
12
+ .string()
13
+ .trim()
14
+ .min(1)
15
+ .max(200)
16
+ .describe("The exact results[].documents[].id returned by search, or the documentId returned by extraction."),
17
+ offset: z
18
+ .number()
19
+ .int()
20
+ .nonnegative()
21
+ .default(0)
22
+ .describe("The exact nextOffset returned by the previous read, or zero."),
23
+ }),
24
+ execute({ container, documentId, offset }, ctx) {
25
+ return readStoredDocument(documentId, offset, container, ctx, dependencies);
26
+ },
27
+ });
28
+ }