convex-supermemory 0.0.1
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.
- package/LICENSE +201 -0
- package/README.md +306 -0
- package/dist/client/_generated/_ignore.d.ts +1 -0
- package/dist/client/_generated/_ignore.d.ts.map +1 -0
- package/dist/client/_generated/_ignore.js +3 -0
- package/dist/client/_generated/_ignore.js.map +1 -0
- package/dist/client/index.d.ts +188 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +177 -0
- package/dist/client/index.js.map +1 -0
- package/dist/component/_generated/api.d.ts +34 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +152 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +133 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +80 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +4 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/lib.d.ts +128 -0
- package/dist/component/lib.d.ts.map +1 -0
- package/dist/component/lib.js +196 -0
- package/dist/component/lib.js.map +1 -0
- package/dist/component/schema.d.ts +56 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +33 -0
- package/dist/component/schema.js.map +1 -0
- package/package.json +106 -0
- package/src/client/_generated/_ignore.ts +1 -0
- package/src/client/index.ts +289 -0
- package/src/client/setup.test.ts +26 -0
- package/src/component/_generated/api.ts +50 -0
- package/src/component/_generated/component.ts +232 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +169 -0
- package/src/component/convex.config.ts +5 -0
- package/src/component/lib.test.ts +127 -0
- package/src/component/lib.ts +224 -0
- package/src/component/schema.ts +43 -0
- package/src/component/setup.test.ts +11 -0
- package/src/test.ts +18 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
2
|
+
import type { ComponentApi } from "../component/_generated/component.js";
|
|
3
|
+
export type SupermemoryOptions = {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
};
|
|
7
|
+
export type AddMemoryArgs = {
|
|
8
|
+
containerTag: string;
|
|
9
|
+
content: string;
|
|
10
|
+
isStatic?: boolean;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
12
|
+
forgetAfter?: number;
|
|
13
|
+
forgetReason?: string;
|
|
14
|
+
};
|
|
15
|
+
export type AddDocumentArgs = {
|
|
16
|
+
containerTag: string;
|
|
17
|
+
content: string;
|
|
18
|
+
customId?: string;
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
export type SearchArgs = {
|
|
22
|
+
containerTag: string;
|
|
23
|
+
query: string;
|
|
24
|
+
limit?: number;
|
|
25
|
+
rerank?: boolean;
|
|
26
|
+
includeFullDocs?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type SearchResult = {
|
|
29
|
+
documentId: string;
|
|
30
|
+
title: string | null;
|
|
31
|
+
score: number;
|
|
32
|
+
summary: string | null;
|
|
33
|
+
content: string | null;
|
|
34
|
+
chunks: Array<{
|
|
35
|
+
content: string;
|
|
36
|
+
score: number;
|
|
37
|
+
position: number;
|
|
38
|
+
isRelevant: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
export type SearchResponse = {
|
|
42
|
+
results: SearchResult[];
|
|
43
|
+
total: number;
|
|
44
|
+
timing?: number;
|
|
45
|
+
};
|
|
46
|
+
export declare class Supermemory {
|
|
47
|
+
private component;
|
|
48
|
+
private options;
|
|
49
|
+
constructor(component: ComponentApi, options: SupermemoryOptions);
|
|
50
|
+
private baseUrl;
|
|
51
|
+
private headers;
|
|
52
|
+
/** Store a single fact/memory directly (fast path — no chunking pipeline). */
|
|
53
|
+
addMemory(ctx: GenericActionCtx<GenericDataModel>, args: AddMemoryArgs): Promise<{
|
|
54
|
+
memoryId: string;
|
|
55
|
+
}>;
|
|
56
|
+
/** Mark a memory as forgotten. Supermemory may forget it asynchronously. */
|
|
57
|
+
forgetMemory(ctx: GenericActionCtx<GenericDataModel>, args: {
|
|
58
|
+
containerTag: string;
|
|
59
|
+
memoryId: string;
|
|
60
|
+
}): Promise<{
|
|
61
|
+
forgotten: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Ingest a larger piece of content (a document, page, or conversation) through
|
|
65
|
+
* Supermemory's extraction/chunking pipeline. Use `getDocument`/`refreshDocument`
|
|
66
|
+
* to poll processing status.
|
|
67
|
+
*/
|
|
68
|
+
addDocument(ctx: GenericActionCtx<GenericDataModel>, args: AddDocumentArgs): Promise<{
|
|
69
|
+
documentId: string;
|
|
70
|
+
status: string;
|
|
71
|
+
}>;
|
|
72
|
+
/** Refresh a document's processing status, title, and summary from Supermemory. */
|
|
73
|
+
refreshDocument(ctx: GenericActionCtx<GenericDataModel>, args: {
|
|
74
|
+
documentId: string;
|
|
75
|
+
}): Promise<void>;
|
|
76
|
+
deleteDocument(ctx: GenericActionCtx<GenericDataModel>, args: {
|
|
77
|
+
documentId: string;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
/** Semantic search over a container's document chunks. Always live — not cached locally. */
|
|
80
|
+
search(args: SearchArgs): Promise<SearchResponse>;
|
|
81
|
+
getMemory(ctx: RunQueryCtx, args: {
|
|
82
|
+
memoryId: string;
|
|
83
|
+
}): Promise<{
|
|
84
|
+
_creationTime: number;
|
|
85
|
+
_id: string;
|
|
86
|
+
containerTag: string;
|
|
87
|
+
content: string;
|
|
88
|
+
createdAt: number;
|
|
89
|
+
forgetAfter?: number;
|
|
90
|
+
forgetReason?: string;
|
|
91
|
+
forgotten: boolean;
|
|
92
|
+
isStatic: boolean;
|
|
93
|
+
memoryId: string;
|
|
94
|
+
metadata?: string;
|
|
95
|
+
updatedAt: number;
|
|
96
|
+
} | null>;
|
|
97
|
+
listMemories(ctx: RunQueryCtx, args: {
|
|
98
|
+
containerTag: string;
|
|
99
|
+
limit?: number;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
_creationTime: number;
|
|
102
|
+
_id: string;
|
|
103
|
+
containerTag: string;
|
|
104
|
+
content: string;
|
|
105
|
+
createdAt: number;
|
|
106
|
+
forgetAfter?: number;
|
|
107
|
+
forgetReason?: string;
|
|
108
|
+
forgotten: boolean;
|
|
109
|
+
isStatic: boolean;
|
|
110
|
+
memoryId: string;
|
|
111
|
+
metadata?: string;
|
|
112
|
+
updatedAt: number;
|
|
113
|
+
}[]>;
|
|
114
|
+
getDocument(ctx: RunQueryCtx, args: {
|
|
115
|
+
documentId: string;
|
|
116
|
+
}): Promise<{
|
|
117
|
+
_creationTime: number;
|
|
118
|
+
_id: string;
|
|
119
|
+
containerTag: string;
|
|
120
|
+
content?: string;
|
|
121
|
+
createdAt: number;
|
|
122
|
+
customId?: string;
|
|
123
|
+
documentId: string;
|
|
124
|
+
metadata?: string;
|
|
125
|
+
status: "unknown" | "queued" | "extracting" | "chunking" | "embedding" | "indexing" | "done" | "failed";
|
|
126
|
+
summary?: string;
|
|
127
|
+
title?: string;
|
|
128
|
+
updatedAt: number;
|
|
129
|
+
} | null>;
|
|
130
|
+
listDocuments(ctx: RunQueryCtx, args: {
|
|
131
|
+
containerTag: string;
|
|
132
|
+
limit?: number;
|
|
133
|
+
}): Promise<{
|
|
134
|
+
_creationTime: number;
|
|
135
|
+
_id: string;
|
|
136
|
+
containerTag: string;
|
|
137
|
+
content?: string;
|
|
138
|
+
createdAt: number;
|
|
139
|
+
customId?: string;
|
|
140
|
+
documentId: string;
|
|
141
|
+
metadata?: string;
|
|
142
|
+
status: "unknown" | "queued" | "extracting" | "chunking" | "embedding" | "indexing" | "done" | "failed";
|
|
143
|
+
summary?: string;
|
|
144
|
+
title?: string;
|
|
145
|
+
updatedAt: number;
|
|
146
|
+
}[]>;
|
|
147
|
+
getStats(ctx: RunQueryCtx): Promise<{
|
|
148
|
+
documents: number;
|
|
149
|
+
memories: number;
|
|
150
|
+
}>;
|
|
151
|
+
listRecentMemories(ctx: RunQueryCtx, args?: {
|
|
152
|
+
limit?: number;
|
|
153
|
+
}): Promise<{
|
|
154
|
+
_creationTime: number;
|
|
155
|
+
_id: string;
|
|
156
|
+
containerTag: string;
|
|
157
|
+
content: string;
|
|
158
|
+
createdAt: number;
|
|
159
|
+
forgetAfter?: number;
|
|
160
|
+
forgetReason?: string;
|
|
161
|
+
forgotten: boolean;
|
|
162
|
+
isStatic: boolean;
|
|
163
|
+
memoryId: string;
|
|
164
|
+
metadata?: string;
|
|
165
|
+
updatedAt: number;
|
|
166
|
+
}[]>;
|
|
167
|
+
listRecentDocuments(ctx: RunQueryCtx, args?: {
|
|
168
|
+
limit?: number;
|
|
169
|
+
}): Promise<{
|
|
170
|
+
_creationTime: number;
|
|
171
|
+
_id: string;
|
|
172
|
+
containerTag: string;
|
|
173
|
+
content?: string;
|
|
174
|
+
createdAt: number;
|
|
175
|
+
customId?: string;
|
|
176
|
+
documentId: string;
|
|
177
|
+
metadata?: string;
|
|
178
|
+
status: "unknown" | "queued" | "extracting" | "chunking" | "embedding" | "indexing" | "done" | "failed";
|
|
179
|
+
summary?: string;
|
|
180
|
+
title?: string;
|
|
181
|
+
updatedAt: number;
|
|
182
|
+
}[]>;
|
|
183
|
+
}
|
|
184
|
+
type RunQueryCtx = {
|
|
185
|
+
runQuery: GenericActionCtx<GenericDataModel>["runQuery"];
|
|
186
|
+
};
|
|
187
|
+
export {};
|
|
188
|
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ai";
|
|
2
|
+
export class Supermemory {
|
|
3
|
+
component;
|
|
4
|
+
options;
|
|
5
|
+
constructor(component, options) {
|
|
6
|
+
this.component = component;
|
|
7
|
+
this.options = options;
|
|
8
|
+
}
|
|
9
|
+
baseUrl() {
|
|
10
|
+
return this.options.baseUrl ?? SUPERMEMORY_API_BASE;
|
|
11
|
+
}
|
|
12
|
+
headers() {
|
|
13
|
+
return {
|
|
14
|
+
Authorization: `Bearer ${this.options.apiKey}`,
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** Store a single fact/memory directly (fast path — no chunking pipeline). */
|
|
19
|
+
async addMemory(ctx, args) {
|
|
20
|
+
const res = await fetch(`${this.baseUrl()}/v4/memories`, {
|
|
21
|
+
method: "POST",
|
|
22
|
+
headers: this.headers(),
|
|
23
|
+
body: JSON.stringify({
|
|
24
|
+
containerTag: args.containerTag,
|
|
25
|
+
memories: [
|
|
26
|
+
{
|
|
27
|
+
content: args.content,
|
|
28
|
+
isStatic: args.isStatic ?? false,
|
|
29
|
+
metadata: args.metadata,
|
|
30
|
+
forgetAfter: args.forgetAfter
|
|
31
|
+
? new Date(args.forgetAfter).toISOString()
|
|
32
|
+
: undefined,
|
|
33
|
+
forgetReason: args.forgetReason,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
if (!res.ok) {
|
|
39
|
+
throw new Error(`Failed to add Supermemory memory: ${res.status} ${await res.text()}`);
|
|
40
|
+
}
|
|
41
|
+
const json = (await res.json());
|
|
42
|
+
const memory = json.memories[0];
|
|
43
|
+
await ctx.runMutation(this.component.lib.recordMemory, {
|
|
44
|
+
memoryId: memory.id,
|
|
45
|
+
containerTag: args.containerTag,
|
|
46
|
+
content: args.content,
|
|
47
|
+
isStatic: args.isStatic ?? false,
|
|
48
|
+
metadata: args.metadata ? JSON.stringify(args.metadata) : undefined,
|
|
49
|
+
forgetAfter: args.forgetAfter,
|
|
50
|
+
forgetReason: args.forgetReason,
|
|
51
|
+
});
|
|
52
|
+
return { memoryId: memory.id };
|
|
53
|
+
}
|
|
54
|
+
/** Mark a memory as forgotten. Supermemory may forget it asynchronously. */
|
|
55
|
+
async forgetMemory(ctx, args) {
|
|
56
|
+
const res = await fetch(`${this.baseUrl()}/v4/memories`, {
|
|
57
|
+
method: "DELETE",
|
|
58
|
+
headers: this.headers(),
|
|
59
|
+
// containerTag is required by Supermemory to scope the delete —
|
|
60
|
+
// omitting it makes this a 400, not a silent no-op.
|
|
61
|
+
body: JSON.stringify({ id: args.memoryId, containerTag: args.containerTag }),
|
|
62
|
+
});
|
|
63
|
+
if (!res.ok) {
|
|
64
|
+
throw new Error(`Failed to forget Supermemory memory: ${res.status} ${await res.text()}`);
|
|
65
|
+
}
|
|
66
|
+
const json = (await res.json());
|
|
67
|
+
if (json.forgotten) {
|
|
68
|
+
await ctx.runMutation(this.component.lib.markMemoryForgotten, { memoryId: args.memoryId });
|
|
69
|
+
}
|
|
70
|
+
return { forgotten: json.forgotten };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Ingest a larger piece of content (a document, page, or conversation) through
|
|
74
|
+
* Supermemory's extraction/chunking pipeline. Use `getDocument`/`refreshDocument`
|
|
75
|
+
* to poll processing status.
|
|
76
|
+
*/
|
|
77
|
+
async addDocument(ctx, args) {
|
|
78
|
+
const res = await fetch(`${this.baseUrl()}/v3/documents`, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: this.headers(),
|
|
81
|
+
body: JSON.stringify({
|
|
82
|
+
content: args.content,
|
|
83
|
+
containerTag: args.containerTag,
|
|
84
|
+
customId: args.customId,
|
|
85
|
+
metadata: args.metadata,
|
|
86
|
+
}),
|
|
87
|
+
});
|
|
88
|
+
if (!res.ok) {
|
|
89
|
+
throw new Error(`Failed to add Supermemory document: ${res.status} ${await res.text()}`);
|
|
90
|
+
}
|
|
91
|
+
const json = (await res.json());
|
|
92
|
+
await ctx.runMutation(this.component.lib.recordDocument, {
|
|
93
|
+
documentId: json.id,
|
|
94
|
+
containerTag: args.containerTag,
|
|
95
|
+
content: args.content,
|
|
96
|
+
customId: args.customId,
|
|
97
|
+
metadata: args.metadata ? JSON.stringify(args.metadata) : undefined,
|
|
98
|
+
status: json.status ?? "queued",
|
|
99
|
+
});
|
|
100
|
+
return { documentId: json.id, status: json.status };
|
|
101
|
+
}
|
|
102
|
+
/** Refresh a document's processing status, title, and summary from Supermemory. */
|
|
103
|
+
async refreshDocument(ctx, args) {
|
|
104
|
+
const res = await fetch(`${this.baseUrl()}/v3/documents/${encodeURIComponent(args.documentId)}`, {
|
|
105
|
+
headers: this.headers(),
|
|
106
|
+
});
|
|
107
|
+
if (!res.ok) {
|
|
108
|
+
throw new Error(`Failed to fetch Supermemory document: ${res.status} ${await res.text()}`);
|
|
109
|
+
}
|
|
110
|
+
const json = (await res.json());
|
|
111
|
+
const existing = await ctx.runQuery(this.component.lib.getDocument, { documentId: args.documentId });
|
|
112
|
+
await ctx.runMutation(this.component.lib.recordDocument, {
|
|
113
|
+
documentId: json.id,
|
|
114
|
+
containerTag: existing?.containerTag ?? "",
|
|
115
|
+
content: json.content ?? existing?.content,
|
|
116
|
+
customId: existing?.customId,
|
|
117
|
+
metadata: json.metadata ? JSON.stringify(json.metadata) : existing?.metadata,
|
|
118
|
+
status: json.status,
|
|
119
|
+
title: json.title ?? undefined,
|
|
120
|
+
summary: json.summary ?? undefined,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async deleteDocument(ctx, args) {
|
|
124
|
+
const res = await fetch(`${this.baseUrl()}/v3/documents/${encodeURIComponent(args.documentId)}`, {
|
|
125
|
+
method: "DELETE",
|
|
126
|
+
headers: this.headers(),
|
|
127
|
+
});
|
|
128
|
+
if (!res.ok && res.status !== 204) {
|
|
129
|
+
throw new Error(`Failed to delete Supermemory document: ${res.status} ${await res.text()}`);
|
|
130
|
+
}
|
|
131
|
+
await ctx.runMutation(this.component.lib.deleteDocument, { documentId: args.documentId });
|
|
132
|
+
}
|
|
133
|
+
/** Semantic search over a container's document chunks. Always live — not cached locally. */
|
|
134
|
+
async search(args) {
|
|
135
|
+
const res = await fetch(`${this.baseUrl()}/v3/search`, {
|
|
136
|
+
method: "POST",
|
|
137
|
+
headers: this.headers(),
|
|
138
|
+
body: JSON.stringify({
|
|
139
|
+
q: args.query,
|
|
140
|
+
// Supermemory's /v3/search schema documents singular `containerTag` as
|
|
141
|
+
// valid, but the only worked example in their own docs uses the plural
|
|
142
|
+
// `containerTags` array — and in practice singular reliably returns
|
|
143
|
+
// zero matches even against fully-indexed content. Use the array form.
|
|
144
|
+
containerTags: [args.containerTag],
|
|
145
|
+
limit: args.limit ?? 10,
|
|
146
|
+
rerank: args.rerank ?? false,
|
|
147
|
+
includeFullDocs: args.includeFullDocs ?? false,
|
|
148
|
+
}),
|
|
149
|
+
});
|
|
150
|
+
if (!res.ok) {
|
|
151
|
+
throw new Error(`Failed to search Supermemory: ${res.status} ${await res.text()}`);
|
|
152
|
+
}
|
|
153
|
+
return (await res.json());
|
|
154
|
+
}
|
|
155
|
+
async getMemory(ctx, args) {
|
|
156
|
+
return await ctx.runQuery(this.component.lib.getMemory, args);
|
|
157
|
+
}
|
|
158
|
+
async listMemories(ctx, args) {
|
|
159
|
+
return await ctx.runQuery(this.component.lib.listMemories, args);
|
|
160
|
+
}
|
|
161
|
+
async getDocument(ctx, args) {
|
|
162
|
+
return await ctx.runQuery(this.component.lib.getDocument, args);
|
|
163
|
+
}
|
|
164
|
+
async listDocuments(ctx, args) {
|
|
165
|
+
return await ctx.runQuery(this.component.lib.listDocuments, args);
|
|
166
|
+
}
|
|
167
|
+
async getStats(ctx) {
|
|
168
|
+
return await ctx.runQuery(this.component.lib.getStats, {});
|
|
169
|
+
}
|
|
170
|
+
async listRecentMemories(ctx, args = {}) {
|
|
171
|
+
return await ctx.runQuery(this.component.lib.listRecentMemories, args);
|
|
172
|
+
}
|
|
173
|
+
async listRecentDocuments(ctx, args = {}) {
|
|
174
|
+
return await ctx.runQuery(this.component.lib.listRecentDocuments, args);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAGA,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AA8C1D,MAAM,OAAO,WAAW;IAEZ;IACA;IAFV,YACU,SAAuB,EACvB,OAA2B;QAD3B,cAAS,GAAT,SAAS,CAAc;QACvB,YAAO,GAAP,OAAO,CAAoB;IAClC,CAAC;IAEI,OAAO;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,oBAAoB,CAAC;IACtD,CAAC;IAEO,OAAO;QACb,OAAO;YACL,aAAa,EAAE,UAAU,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YAC9C,cAAc,EAAE,kBAAkB;SACnC,CAAC;IACJ,CAAC;IAED,8EAA8E;IAC9E,KAAK,CAAC,SAAS,CACb,GAAuC,EACvC,IAAmB;QAEnB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE;YACvD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YACvB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,QAAQ,EAAE;oBACR;wBACE,OAAO,EAAE,IAAI,CAAC,OAAO;wBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,KAAK;wBAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ;wBACvB,WAAW,EAAE,IAAI,CAAC,WAAW;4BAC3B,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE;4BAC1C,CAAC,CAAC,SAAS;wBACb,YAAY,E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AAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,GAAgB,EAAE,IAA8C;QAClF,OAAO,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,GAAgB;QAC7B,OAAO,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,GAAgB,EAAE,OAA2B,EAAE;QACtE,OAAO,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,GAAgB,EAAE,OAA2B,EAAE;QACvE,OAAO,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated `api` utility.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type * as lib from "../lib.js";
|
|
10
|
+
import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
|
|
11
|
+
declare const fullApi: ApiFromModules<{
|
|
12
|
+
lib: typeof lib;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```js
|
|
19
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
|
|
23
|
+
/**
|
|
24
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
25
|
+
*
|
|
26
|
+
* Usage:
|
|
27
|
+
* ```js
|
|
28
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
|
|
32
|
+
export declare const components: {};
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,GAAG,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAM,OAAO,EAAE,cAAc,CAAC;IAC5B,GAAG,EAAE,OAAO,GAAG,CAAC;CACjB,CAAiB,CAAC;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,SAAS,CACzB,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CACjB,CAAC;AAElB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,CAC9B,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CACnB,CAAC;AAElB,eAAO,MAAM,UAAU,EAAqC,EAAE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Generated `api` utility.
|
|
4
|
+
*
|
|
5
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
+
*
|
|
7
|
+
* To regenerate, run `npx convex dev`.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { anyApi, componentsGeneric } from "convex/server";
|
|
11
|
+
const fullApi = anyApi;
|
|
12
|
+
/**
|
|
13
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* ```js
|
|
17
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const api = anyApi;
|
|
21
|
+
/**
|
|
22
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
23
|
+
*
|
|
24
|
+
* Usage:
|
|
25
|
+
* ```js
|
|
26
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export const internal = anyApi;
|
|
30
|
+
export const components = componentsGeneric();
|
|
31
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AASH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAER,MAAa,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAa,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAGjB,MAAa,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAmB,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated `ComponentApi` utility.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { FunctionReference } from "convex/server";
|
|
10
|
+
/**
|
|
11
|
+
* A utility for referencing a Convex component's exposed API.
|
|
12
|
+
*
|
|
13
|
+
* Useful when expecting a parameter like `components.myComponent`.
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```ts
|
|
16
|
+
* async function myFunction(ctx: QueryCtx, component: ComponentApi) {
|
|
17
|
+
* return ctx.runQuery(component.someFile.someQuery, { ...args });
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type ComponentApi<Name extends string | undefined = string | undefined> = {
|
|
22
|
+
lib: {
|
|
23
|
+
deleteDocument: FunctionReference<"mutation", "internal", {
|
|
24
|
+
documentId: string;
|
|
25
|
+
}, null, Name>;
|
|
26
|
+
getDocument: FunctionReference<"query", "internal", {
|
|
27
|
+
documentId: string;
|
|
28
|
+
}, null | {
|
|
29
|
+
_creationTime: number;
|
|
30
|
+
_id: string;
|
|
31
|
+
containerTag: string;
|
|
32
|
+
content?: string;
|
|
33
|
+
createdAt: number;
|
|
34
|
+
customId?: string;
|
|
35
|
+
documentId: string;
|
|
36
|
+
metadata?: string;
|
|
37
|
+
status: "unknown" | "queued" | "extracting" | "chunking" | "embedding" | "indexing" | "done" | "failed";
|
|
38
|
+
summary?: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
updatedAt: number;
|
|
41
|
+
}, Name>;
|
|
42
|
+
getMemory: FunctionReference<"query", "internal", {
|
|
43
|
+
memoryId: string;
|
|
44
|
+
}, null | {
|
|
45
|
+
_creationTime: number;
|
|
46
|
+
_id: string;
|
|
47
|
+
containerTag: string;
|
|
48
|
+
content: string;
|
|
49
|
+
createdAt: number;
|
|
50
|
+
forgetAfter?: number;
|
|
51
|
+
forgetReason?: string;
|
|
52
|
+
forgotten: boolean;
|
|
53
|
+
isStatic: boolean;
|
|
54
|
+
memoryId: string;
|
|
55
|
+
metadata?: string;
|
|
56
|
+
updatedAt: number;
|
|
57
|
+
}, Name>;
|
|
58
|
+
getStats: FunctionReference<"query", "internal", {}, {
|
|
59
|
+
documents: number;
|
|
60
|
+
memories: number;
|
|
61
|
+
}, Name>;
|
|
62
|
+
listDocuments: FunctionReference<"query", "internal", {
|
|
63
|
+
containerTag: string;
|
|
64
|
+
limit?: number;
|
|
65
|
+
}, Array<{
|
|
66
|
+
_creationTime: number;
|
|
67
|
+
_id: string;
|
|
68
|
+
containerTag: string;
|
|
69
|
+
content?: string;
|
|
70
|
+
createdAt: number;
|
|
71
|
+
customId?: string;
|
|
72
|
+
documentId: string;
|
|
73
|
+
metadata?: string;
|
|
74
|
+
status: "unknown" | "queued" | "extracting" | "chunking" | "embedding" | "indexing" | "done" | "failed";
|
|
75
|
+
summary?: string;
|
|
76
|
+
title?: string;
|
|
77
|
+
updatedAt: number;
|
|
78
|
+
}>, Name>;
|
|
79
|
+
listMemories: FunctionReference<"query", "internal", {
|
|
80
|
+
containerTag: string;
|
|
81
|
+
limit?: number;
|
|
82
|
+
}, Array<{
|
|
83
|
+
_creationTime: number;
|
|
84
|
+
_id: string;
|
|
85
|
+
containerTag: string;
|
|
86
|
+
content: string;
|
|
87
|
+
createdAt: number;
|
|
88
|
+
forgetAfter?: number;
|
|
89
|
+
forgetReason?: string;
|
|
90
|
+
forgotten: boolean;
|
|
91
|
+
isStatic: boolean;
|
|
92
|
+
memoryId: string;
|
|
93
|
+
metadata?: string;
|
|
94
|
+
updatedAt: number;
|
|
95
|
+
}>, Name>;
|
|
96
|
+
listRecentDocuments: FunctionReference<"query", "internal", {
|
|
97
|
+
limit?: number;
|
|
98
|
+
}, Array<{
|
|
99
|
+
_creationTime: number;
|
|
100
|
+
_id: string;
|
|
101
|
+
containerTag: string;
|
|
102
|
+
content?: string;
|
|
103
|
+
createdAt: number;
|
|
104
|
+
customId?: string;
|
|
105
|
+
documentId: string;
|
|
106
|
+
metadata?: string;
|
|
107
|
+
status: "unknown" | "queued" | "extracting" | "chunking" | "embedding" | "indexing" | "done" | "failed";
|
|
108
|
+
summary?: string;
|
|
109
|
+
title?: string;
|
|
110
|
+
updatedAt: number;
|
|
111
|
+
}>, Name>;
|
|
112
|
+
listRecentMemories: FunctionReference<"query", "internal", {
|
|
113
|
+
limit?: number;
|
|
114
|
+
}, Array<{
|
|
115
|
+
_creationTime: number;
|
|
116
|
+
_id: string;
|
|
117
|
+
containerTag: string;
|
|
118
|
+
content: string;
|
|
119
|
+
createdAt: number;
|
|
120
|
+
forgetAfter?: number;
|
|
121
|
+
forgetReason?: string;
|
|
122
|
+
forgotten: boolean;
|
|
123
|
+
isStatic: boolean;
|
|
124
|
+
memoryId: string;
|
|
125
|
+
metadata?: string;
|
|
126
|
+
updatedAt: number;
|
|
127
|
+
}>, Name>;
|
|
128
|
+
markMemoryForgotten: FunctionReference<"mutation", "internal", {
|
|
129
|
+
memoryId: string;
|
|
130
|
+
}, null, Name>;
|
|
131
|
+
recordDocument: FunctionReference<"mutation", "internal", {
|
|
132
|
+
containerTag: string;
|
|
133
|
+
content?: string;
|
|
134
|
+
customId?: string;
|
|
135
|
+
documentId: string;
|
|
136
|
+
metadata?: string;
|
|
137
|
+
status: "unknown" | "queued" | "extracting" | "chunking" | "embedding" | "indexing" | "done" | "failed";
|
|
138
|
+
summary?: string;
|
|
139
|
+
title?: string;
|
|
140
|
+
}, string, Name>;
|
|
141
|
+
recordMemory: FunctionReference<"mutation", "internal", {
|
|
142
|
+
containerTag: string;
|
|
143
|
+
content: string;
|
|
144
|
+
forgetAfter?: number;
|
|
145
|
+
forgetReason?: string;
|
|
146
|
+
isStatic: boolean;
|
|
147
|
+
memoryId: string;
|
|
148
|
+
metadata?: string;
|
|
149
|
+
}, string, Name>;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],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|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}
|