@supermemory/eve 0.1.0 → 0.1.2
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/README.md +27 -2
- package/dist/index.d.ts +1 -1
- package/dist/lib/capture-conversation.js +2 -1
- package/dist/lib/client.d.ts +2 -1
- package/dist/lib/client.js +13 -2
- package/dist/lib/dependencies.d.ts +1 -1
- package/dist/lib/documents.js +2 -1
- package/dist/lib/extract-source.js +2 -1
- package/dist/lib/forget-matching.js +2 -1
- package/dist/lib/forget-memory.d.ts +1 -1
- package/dist/lib/forget-memory.js +3 -2
- package/dist/lib/remember.js +3 -2
- package/dist/lib/search-context.js +2 -1
- package/dist/options.d.ts +3 -2
- package/dist/options.js +5 -1
- package/dist/provider.js +6 -5
- package/dist/tools/forget.d.ts +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -9,10 +9,21 @@ gives Eve tools to search, remember, extract, and forget.
|
|
|
9
9
|
|
|
10
10
|
## Add memory to Eve
|
|
11
11
|
|
|
12
|
+
From an Eve project, add the provider from Eve's integration registry:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
eve add memory/supermemory
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or install it yourself:
|
|
19
|
+
|
|
12
20
|
```bash
|
|
13
21
|
npm install @supermemory/eve
|
|
14
22
|
```
|
|
15
23
|
|
|
24
|
+
The provider supports Eve 0.47.3 and newer 0.x releases. Set `SUPERMEMORY_API_KEY` from the
|
|
25
|
+
[Supermemory console](https://console.supermemory.ai).
|
|
26
|
+
|
|
16
27
|
Create a memory slot in the consuming Eve agent. `supermemory(...)` configures the provider;
|
|
17
28
|
`defineMemory(...)` binds it to an Eve-managed scope.
|
|
18
29
|
|
|
@@ -26,12 +37,15 @@ export default defineMemory({
|
|
|
26
37
|
namespace: "your-company-agent-v1",
|
|
27
38
|
description: "Recall and manage durable context for the current user.",
|
|
28
39
|
provider: supermemory({
|
|
29
|
-
apiKey: process.env.SUPERMEMORY_API_KEY!,
|
|
40
|
+
apiKey: () => process.env.SUPERMEMORY_API_KEY!,
|
|
30
41
|
}),
|
|
31
42
|
scope: byPrincipal,
|
|
32
43
|
});
|
|
33
44
|
```
|
|
34
45
|
|
|
46
|
+
Pass `apiKey` as a function so the key is read when the agent runs, not when `eve build` loads the
|
|
47
|
+
slot. A plain string also works, but then the key must be set in the build environment too.
|
|
48
|
+
|
|
35
49
|
Pick a namespace for the agent and keep it stable. If it changes, Eve sees a different memory space.
|
|
36
50
|
`description` is added to the tool descriptions the model sees, so keep it short and say what this
|
|
37
51
|
memory is for.
|
|
@@ -120,7 +134,7 @@ export default defineMemory({
|
|
|
120
134
|
namespace: "your-company-agent-v1",
|
|
121
135
|
description: "Recall and manage durable context for the current user.",
|
|
122
136
|
provider: supermemory({
|
|
123
|
-
apiKey: process.env.SUPERMEMORY_API_KEY!,
|
|
137
|
+
apiKey: () => process.env.SUPERMEMORY_API_KEY!,
|
|
124
138
|
containerTagPrefix: "eve_agent",
|
|
125
139
|
autoSearch: {
|
|
126
140
|
enabled: true,
|
|
@@ -174,3 +188,14 @@ npm run typecheck
|
|
|
174
188
|
npm run build
|
|
175
189
|
npm pack --dry-run
|
|
176
190
|
```
|
|
191
|
+
|
|
192
|
+
### Publishing
|
|
193
|
+
|
|
194
|
+
Pushes to `main` run the release workflow. After checks and a packaged-import smoke test pass,
|
|
195
|
+
the workflow publishes the version in `package.json` if it is not already on npm. Bump the
|
|
196
|
+
package version and update `package-lock.json` to ship a new release; no Git tag is required.
|
|
197
|
+
Publishing uses npm trusted publishing with GitHub Actions OIDC; no `NPM_TOKEN` secret is needed.
|
|
198
|
+
In the npm package's trusted publisher settings, select GitHub Actions, set the organization to
|
|
199
|
+
`supermemoryai`, the repository to `eve-supermemory`, and the workflow filename to `release.yml`.
|
|
200
|
+
Leave the environment name empty and allow direct `npm publish`. The release job uses a
|
|
201
|
+
GitHub-hosted runner because npm trusted publishing does not support self-hosted runners.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { SupermemoryOptions } from "./options.js";
|
|
1
|
+
export type { SupermemoryApiKey, SupermemoryOptions } from "./options.js";
|
|
2
2
|
export { supermemory as default, supermemory } from "./provider.js";
|
|
@@ -37,7 +37,8 @@ export async function captureCompletedTurn(context, dependencies, capture) {
|
|
|
37
37
|
const entityContext = entityContextForTurn(turn, capture.entityContext);
|
|
38
38
|
const sourceId = `conv_${context.session.id}`;
|
|
39
39
|
try {
|
|
40
|
-
await
|
|
40
|
+
const client = await dependencies.getClient();
|
|
41
|
+
await addDocument(client, {
|
|
41
42
|
containerTag: dependencies.containerTags.context,
|
|
42
43
|
content,
|
|
43
44
|
customId: sourceId,
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import Supermemory from "supermemory";
|
|
2
|
-
|
|
2
|
+
import type { SupermemoryApiKey } from "../options.js";
|
|
3
|
+
export declare function createSupermemoryClientFactory(apiKey: SupermemoryApiKey): () => Promise<Supermemory>;
|
package/dist/lib/client.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import Supermemory from "supermemory";
|
|
2
|
-
export function
|
|
3
|
-
|
|
2
|
+
export function createSupermemoryClientFactory(apiKey) {
|
|
3
|
+
if (typeof apiKey === "string") {
|
|
4
|
+
const client = new Supermemory({ apiKey });
|
|
5
|
+
return async () => client;
|
|
6
|
+
}
|
|
7
|
+
const resolveApiKey = apiKey;
|
|
8
|
+
return async () => {
|
|
9
|
+
const resolvedApiKey = await resolveApiKey();
|
|
10
|
+
if (!resolvedApiKey) {
|
|
11
|
+
throw new Error("The Supermemory API key resolver returned an empty value.");
|
|
12
|
+
}
|
|
13
|
+
return new Supermemory({ apiKey: resolvedApiKey });
|
|
14
|
+
};
|
|
4
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type Supermemory from "supermemory";
|
|
2
2
|
import type { ContainerTags } from "./container-tags.js";
|
|
3
3
|
export interface SupermemoryDependencies {
|
|
4
|
-
readonly
|
|
4
|
+
readonly getClient: () => Promise<Supermemory>;
|
|
5
5
|
readonly containerTags: ContainerTags;
|
|
6
6
|
}
|
package/dist/lib/documents.js
CHANGED
|
@@ -31,7 +31,8 @@ export async function readStoredDocument(documentId, offset, container, ctx, dep
|
|
|
31
31
|
const containerTag = container === "agent_extraction"
|
|
32
32
|
? dependencies.containerTags.extraction
|
|
33
33
|
: dependencies.containerTags.context;
|
|
34
|
-
const
|
|
34
|
+
const client = await dependencies.getClient();
|
|
35
|
+
const document = await accessibleDocument(client, documentId, containerTag, ctx.abortSignal);
|
|
35
36
|
const details = {
|
|
36
37
|
id: document.id,
|
|
37
38
|
customId: document.customId,
|
|
@@ -31,7 +31,8 @@ async function sandboxAttachment(inputPath, ctx) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
export async function extractSource(input, ctx, dependencies) {
|
|
34
|
-
const
|
|
34
|
+
const client = await dependencies.getClient();
|
|
35
|
+
const { containerTags } = dependencies;
|
|
35
36
|
const metadata = extractionMetadata(input, ctx);
|
|
36
37
|
if (input.kind === "file") {
|
|
37
38
|
const { file, filepath } = await sandboxAttachment(input.value, ctx);
|
|
@@ -28,7 +28,8 @@ export async function forgetMatchingMemories(input, ctx, dependencies) {
|
|
|
28
28
|
if (!input.dryRun && !input.ids?.length) {
|
|
29
29
|
throw new Error("Finalizing requires the exact candidate IDs returned by a dry-run preview.");
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
const client = await dependencies.getClient();
|
|
32
|
+
return forgetMatchingResponseSchema.parse(await client.post("/v4/memories/forget-matching", {
|
|
32
33
|
body: {
|
|
33
34
|
...(query ? { query } : {}),
|
|
34
35
|
containerTag: dependencies.containerTags.context,
|
|
@@ -4,4 +4,4 @@ export type ForgetMemoryInput = {
|
|
|
4
4
|
memoryId: string;
|
|
5
5
|
reason?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare function forgetMemory(input: ForgetMemoryInput, ctx: ToolContext, dependencies: SupermemoryDependencies):
|
|
7
|
+
export declare function forgetMemory(input: ForgetMemoryInput, ctx: ToolContext, dependencies: SupermemoryDependencies): Promise<import("supermemory/resources/memories.mjs").MemoryForgetResponse>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export function forgetMemory(input, ctx, dependencies) {
|
|
2
|
-
|
|
1
|
+
export async function forgetMemory(input, ctx, dependencies) {
|
|
2
|
+
const client = await dependencies.getClient();
|
|
3
|
+
return client.memories.forget({
|
|
3
4
|
containerTag: dependencies.containerTags.context,
|
|
4
5
|
id: input.memoryId,
|
|
5
6
|
...(input.reason ? { reason: input.reason } : {}),
|
package/dist/lib/remember.js
CHANGED
|
@@ -5,14 +5,15 @@ export async function rememberContext(input, ctx, dependencies) {
|
|
|
5
5
|
const conversationId = `conv_${ctx.session.id}`;
|
|
6
6
|
const requestedSourceDocumentId = input.sourceDocumentId?.trim();
|
|
7
7
|
let sourceDocumentId;
|
|
8
|
+
const client = await dependencies.getClient();
|
|
8
9
|
if (requestedSourceDocumentId) {
|
|
9
|
-
const source = await accessibleDocument(
|
|
10
|
+
const source = await accessibleDocument(client, requestedSourceDocumentId, dependencies.containerTags.extraction, ctx.abortSignal);
|
|
10
11
|
if (source.status !== "done") {
|
|
11
12
|
throw new Error("The source document is still processing. Read it again before remembering its contents.");
|
|
12
13
|
}
|
|
13
14
|
sourceDocumentId = source.id;
|
|
14
15
|
}
|
|
15
|
-
const result = await addDocument(
|
|
16
|
+
const result = await addDocument(client, {
|
|
16
17
|
containerTag: dependencies.containerTags.context,
|
|
17
18
|
content: input.memory,
|
|
18
19
|
customId: sourceId,
|
|
@@ -13,7 +13,8 @@ export async function searchStoredContext(input, options, dependencies) {
|
|
|
13
13
|
if (input.customId) {
|
|
14
14
|
filters.push({ key: "source_id", value: input.customId });
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const client = await dependencies.getClient();
|
|
17
|
+
return client.search({
|
|
17
18
|
q: input.query,
|
|
18
19
|
containerTag: dependencies.containerTags.context,
|
|
19
20
|
searchMode: SEARCH_MODE_BY_SCOPE[input.scope],
|
package/dist/options.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export type SupermemoryApiKey = string | (() => string | Promise<string>);
|
|
1
2
|
export type SupermemoryMetadataValue = string | number | boolean | readonly string[];
|
|
2
3
|
export interface SupermemoryOptions {
|
|
3
|
-
readonly apiKey:
|
|
4
|
+
readonly apiKey: SupermemoryApiKey;
|
|
4
5
|
readonly containerTagPrefix?: string;
|
|
5
6
|
readonly autoSearch?: {
|
|
6
7
|
readonly enabled?: boolean;
|
|
@@ -17,7 +18,7 @@ export interface SupermemoryOptions {
|
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
export interface SupermemoryConfig {
|
|
20
|
-
readonly apiKey:
|
|
21
|
+
readonly apiKey: SupermemoryApiKey;
|
|
21
22
|
readonly containerTagPrefix: string;
|
|
22
23
|
readonly autoSearch: {
|
|
23
24
|
readonly enabled: boolean;
|
package/dist/options.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
const metadataValue = z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]);
|
|
3
|
+
const apiKey = z.union([
|
|
4
|
+
z.string().min(1),
|
|
5
|
+
z.custom((value) => typeof value === "function"),
|
|
6
|
+
]);
|
|
3
7
|
function isTimeZone(value) {
|
|
4
8
|
try {
|
|
5
9
|
new Intl.DateTimeFormat("en-US", { timeZone: value });
|
|
@@ -10,7 +14,7 @@ function isTimeZone(value) {
|
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
const optionsSchema = z.object({
|
|
13
|
-
apiKey
|
|
17
|
+
apiKey,
|
|
14
18
|
containerTagPrefix: z
|
|
15
19
|
.string()
|
|
16
20
|
.min(1)
|
package/dist/provider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineMemoryProvider, } from "eve/memory";
|
|
2
2
|
import { EMPTY_AUTO_SEARCH_CONTEXT, loadAutoSearchContext } from "./lib/auto-search.js";
|
|
3
3
|
import { captureCompletedTurn } from "./lib/capture-conversation.js";
|
|
4
|
-
import {
|
|
4
|
+
import { createSupermemoryClientFactory } from "./lib/client.js";
|
|
5
5
|
import { resolveContainerTags } from "./lib/container-tags.js";
|
|
6
6
|
import { loadProfileContext } from "./lib/profile-context.js";
|
|
7
7
|
import { resolveOptions } from "./options.js";
|
|
@@ -13,18 +13,19 @@ function errorMessage(error) {
|
|
|
13
13
|
}
|
|
14
14
|
export function supermemory(options) {
|
|
15
15
|
const config = resolveOptions(options);
|
|
16
|
-
const
|
|
16
|
+
const getClient = createSupermemoryClientFactory(config.apiKey);
|
|
17
17
|
const dependencies = (scopeKey) => ({
|
|
18
|
-
|
|
18
|
+
getClient,
|
|
19
19
|
containerTags: resolveContainerTags(scopeKey, config.containerTagPrefix),
|
|
20
20
|
});
|
|
21
21
|
const recall = async (context) => {
|
|
22
22
|
const messages = [];
|
|
23
23
|
try {
|
|
24
|
+
const memory = dependencies(context.memory.scope.key);
|
|
24
25
|
const content = await loadProfileContext({
|
|
25
26
|
abortSignal: context.abortSignal,
|
|
26
|
-
client,
|
|
27
|
-
containerTag:
|
|
27
|
+
client: await memory.getClient(),
|
|
28
|
+
containerTag: memory.containerTags.context,
|
|
28
29
|
timeZone: config.profileContext.timeZone,
|
|
29
30
|
});
|
|
30
31
|
messages.push({ content, id: PROFILE_CONTEXT_ID });
|
package/dist/tools/forget.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export declare function createForgetTool(dependencies: SupermemoryDependencies):
|
|
|
6
6
|
execute(input: {
|
|
7
7
|
memoryId: string;
|
|
8
8
|
reason?: string | undefined;
|
|
9
|
-
}, ctx: import("eve/tools").ToolContext):
|
|
9
|
+
}, ctx: import("eve/tools").ToolContext): Promise<import("supermemory/resources/memories.mjs").MemoryForgetResponse>;
|
|
10
10
|
};
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -240,7 +240,7 @@ export declare function createSupermemoryTools(dependencies: SupermemoryDependen
|
|
|
240
240
|
execute(input: {
|
|
241
241
|
memoryId: string;
|
|
242
242
|
reason?: string | undefined;
|
|
243
|
-
}, ctx: import("eve/tools").ToolContext):
|
|
243
|
+
}, ctx: import("eve/tools").ToolContext): Promise<import("supermemory/resources/memories.mjs").MemoryForgetResponse>;
|
|
244
244
|
};
|
|
245
245
|
forget_matching: import("eve/tools").ToolDefinition<{
|
|
246
246
|
query?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supermemory/eve",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Durable user context, retrieval, extraction, remembering, and forgetting for Eve agents.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/supermemoryai/eve-supermemory.git"
|
|
8
|
+
},
|
|
5
9
|
"type": "module",
|
|
6
10
|
"files": [
|
|
7
11
|
"dist"
|
|
@@ -35,11 +39,11 @@
|
|
|
35
39
|
"devDependencies": {
|
|
36
40
|
"@biomejs/biome": "2.5.7",
|
|
37
41
|
"@types/node": "24.x",
|
|
38
|
-
"eve": "0.
|
|
42
|
+
"eve": "0.66.1",
|
|
39
43
|
"typescript": "7.0.2"
|
|
40
44
|
},
|
|
41
45
|
"peerDependencies": {
|
|
42
|
-
"eve": "
|
|
46
|
+
"eve": ">=0.47.3 <1"
|
|
43
47
|
},
|
|
44
48
|
"publishConfig": {
|
|
45
49
|
"access": "public"
|