@cortexmemory/cli 0.27.3 → 0.28.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.
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +18 -6
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +191 -80
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.js +3 -2
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +12 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/app-template-sync.d.ts.map +1 -1
- package/dist/utils/app-template-sync.js +35 -13
- package/dist/utils/app-template-sync.js.map +1 -1
- package/dist/utils/init/quickstart-setup.d.ts.map +1 -1
- package/dist/utils/init/quickstart-setup.js.map +1 -1
- package/package.json +4 -4
- package/templates/basic/.env.local.example +23 -0
- package/templates/basic/README.md +181 -56
- package/templates/basic/package-lock.json +2180 -406
- package/templates/basic/package.json +23 -5
- package/templates/basic/src/__tests__/chat.test.ts +340 -0
- package/templates/basic/src/__tests__/cortex.test.ts +260 -0
- package/templates/basic/src/__tests__/display.test.ts +455 -0
- package/templates/basic/src/__tests__/e2e/fact-extraction.test.ts +498 -0
- package/templates/basic/src/__tests__/e2e/memory-flow.test.ts +355 -0
- package/templates/basic/src/__tests__/e2e/server-e2e.test.ts +414 -0
- package/templates/basic/src/__tests__/helpers/test-utils.ts +345 -0
- package/templates/basic/src/__tests__/integration/chat-flow.test.ts +422 -0
- package/templates/basic/src/__tests__/integration/server.test.ts +441 -0
- package/templates/basic/src/__tests__/llm.test.ts +344 -0
- package/templates/basic/src/chat.ts +300 -0
- package/templates/basic/src/cortex.ts +203 -0
- package/templates/basic/src/display.ts +425 -0
- package/templates/basic/src/index.ts +194 -64
- package/templates/basic/src/llm.ts +214 -0
- package/templates/basic/src/server.ts +280 -0
- package/templates/basic/vitest.config.ts +33 -0
- package/templates/basic/vitest.e2e.config.ts +28 -0
- package/templates/basic/vitest.integration.config.ts +25 -0
- package/templates/vercel-ai-quickstart/app/api/auth/check/route.ts +1 -1
- package/templates/vercel-ai-quickstart/app/api/auth/login/route.ts +61 -19
- package/templates/vercel-ai-quickstart/app/api/auth/register/route.ts +14 -18
- package/templates/vercel-ai-quickstart/app/api/auth/setup/route.ts +4 -7
- package/templates/vercel-ai-quickstart/app/api/chat/route.ts +95 -23
- package/templates/vercel-ai-quickstart/app/api/chat-v6/route.ts +339 -0
- package/templates/vercel-ai-quickstart/app/api/conversations/route.ts +16 -16
- package/templates/vercel-ai-quickstart/app/globals.css +24 -9
- package/templates/vercel-ai-quickstart/app/page.tsx +41 -15
- package/templates/vercel-ai-quickstart/components/AdminSetup.tsx +3 -1
- package/templates/vercel-ai-quickstart/components/AuthProvider.tsx +6 -6
- package/templates/vercel-ai-quickstart/components/ChatHistorySidebar.tsx +19 -8
- package/templates/vercel-ai-quickstart/components/ChatInterface.tsx +46 -16
- package/templates/vercel-ai-quickstart/components/LoginScreen.tsx +10 -5
- package/templates/vercel-ai-quickstart/jest.config.js +8 -1
- package/templates/vercel-ai-quickstart/lib/agents/memory-agent.ts +165 -0
- package/templates/vercel-ai-quickstart/lib/password.ts +5 -5
- package/templates/vercel-ai-quickstart/lib/versions.ts +60 -0
- package/templates/vercel-ai-quickstart/next.config.js +10 -2
- package/templates/vercel-ai-quickstart/package.json +23 -12
- package/templates/vercel-ai-quickstart/test-api.mjs +303 -0
- package/templates/vercel-ai-quickstart/tests/e2e/chat-memory-flow.test.ts +483 -0
- package/templates/vercel-ai-quickstart/tests/helpers/mock-cortex.ts +40 -40
- package/templates/vercel-ai-quickstart/tests/integration/auth.test.ts +8 -8
- package/templates/vercel-ai-quickstart/tests/integration/conversations.test.ts +12 -8
- package/templates/vercel-ai-quickstart/tests/unit/password.test.ts +4 -1
|
@@ -31,7 +31,7 @@ import { POST as loginPost } from "../../app/api/auth/login/route";
|
|
|
31
31
|
function createRequest(
|
|
32
32
|
method: string,
|
|
33
33
|
body?: Record<string, unknown>,
|
|
34
|
-
url: string = "http://localhost:3000"
|
|
34
|
+
url: string = "http://localhost:3000",
|
|
35
35
|
): Request {
|
|
36
36
|
const init: RequestInit = { method };
|
|
37
37
|
if (body) {
|
|
@@ -76,7 +76,7 @@ describe("Auth API Routes", () => {
|
|
|
76
76
|
seedTestData.mutable(
|
|
77
77
|
"quickstart-config",
|
|
78
78
|
"admin_password_hash",
|
|
79
|
-
"somehash:value"
|
|
79
|
+
"somehash:value",
|
|
80
80
|
);
|
|
81
81
|
|
|
82
82
|
const response = await checkGet();
|
|
@@ -91,7 +91,7 @@ describe("Auth API Routes", () => {
|
|
|
91
91
|
|
|
92
92
|
expect(mockCortex.mutable.get).toHaveBeenCalledWith(
|
|
93
93
|
"quickstart-config",
|
|
94
|
-
"admin_password_hash"
|
|
94
|
+
"admin_password_hash",
|
|
95
95
|
);
|
|
96
96
|
});
|
|
97
97
|
});
|
|
@@ -133,7 +133,7 @@ describe("Auth API Routes", () => {
|
|
|
133
133
|
seedTestData.mutable(
|
|
134
134
|
"quickstart-config",
|
|
135
135
|
"admin_password_hash",
|
|
136
|
-
"existing:hash"
|
|
136
|
+
"existing:hash",
|
|
137
137
|
);
|
|
138
138
|
|
|
139
139
|
const request = createRequest("POST", { password: "newpassword" });
|
|
@@ -157,7 +157,7 @@ describe("Auth API Routes", () => {
|
|
|
157
157
|
expect(mockCortex.mutable.set).toHaveBeenCalledWith(
|
|
158
158
|
"quickstart-config",
|
|
159
159
|
"admin_password_hash",
|
|
160
|
-
expect.stringContaining(":") // salt:hash format
|
|
160
|
+
expect.stringContaining(":"), // salt:hash format
|
|
161
161
|
);
|
|
162
162
|
});
|
|
163
163
|
});
|
|
@@ -262,7 +262,7 @@ describe("Auth API Routes", () => {
|
|
|
262
262
|
passwordHash: expect.stringContaining(":"),
|
|
263
263
|
createdAt: expect.any(Number),
|
|
264
264
|
lastLoginAt: expect.any(Number),
|
|
265
|
-
})
|
|
265
|
+
}),
|
|
266
266
|
);
|
|
267
267
|
});
|
|
268
268
|
|
|
@@ -288,7 +288,7 @@ describe("Auth API Routes", () => {
|
|
|
288
288
|
|
|
289
289
|
expect(status).toBe(200);
|
|
290
290
|
expect((data.user as { displayName: string }).displayName).toBe(
|
|
291
|
-
"testuser"
|
|
291
|
+
"testuser",
|
|
292
292
|
);
|
|
293
293
|
});
|
|
294
294
|
|
|
@@ -448,7 +448,7 @@ describe("Auth API Routes", () => {
|
|
|
448
448
|
|
|
449
449
|
expect(status).toBe(200);
|
|
450
450
|
expect((data.user as { displayName: string }).displayName).toBe(
|
|
451
|
-
"testuser"
|
|
451
|
+
"testuser",
|
|
452
452
|
);
|
|
453
453
|
});
|
|
454
454
|
});
|
|
@@ -33,7 +33,7 @@ function createRequest(
|
|
|
33
33
|
options: {
|
|
34
34
|
body?: Record<string, unknown>;
|
|
35
35
|
searchParams?: Record<string, string>;
|
|
36
|
-
} = {}
|
|
36
|
+
} = {},
|
|
37
37
|
): Request {
|
|
38
38
|
const url = new URL("http://localhost:3000/api/conversations");
|
|
39
39
|
|
|
@@ -102,8 +102,12 @@ describe("Conversations API Routes", () => {
|
|
|
102
102
|
|
|
103
103
|
expect(status).toBe(200);
|
|
104
104
|
expect(data.conversation).toBeDefined();
|
|
105
|
-
expect((data.conversation as { id: string }).id).toBe(
|
|
106
|
-
|
|
105
|
+
expect((data.conversation as { id: string }).id).toBe(
|
|
106
|
+
"conv-with-messages",
|
|
107
|
+
);
|
|
108
|
+
expect((data.conversation as { title: string }).title).toBe(
|
|
109
|
+
"Test Conversation",
|
|
110
|
+
);
|
|
107
111
|
expect(data.messages).toBeDefined();
|
|
108
112
|
expect((data.messages as unknown[]).length).toBe(2);
|
|
109
113
|
});
|
|
@@ -235,7 +239,7 @@ describe("Conversations API Routes", () => {
|
|
|
235
239
|
expect.objectContaining({
|
|
236
240
|
memorySpaceId: "quickstart-demo",
|
|
237
241
|
userId: "testuser",
|
|
238
|
-
})
|
|
242
|
+
}),
|
|
239
243
|
);
|
|
240
244
|
});
|
|
241
245
|
});
|
|
@@ -304,7 +308,7 @@ describe("Conversations API Routes", () => {
|
|
|
304
308
|
expect(mockCortex.conversations.create).toHaveBeenCalledWith(
|
|
305
309
|
expect.objectContaining({
|
|
306
310
|
memorySpaceId: "custom-space",
|
|
307
|
-
})
|
|
311
|
+
}),
|
|
308
312
|
);
|
|
309
313
|
});
|
|
310
314
|
|
|
@@ -317,7 +321,7 @@ describe("Conversations API Routes", () => {
|
|
|
317
321
|
expect(mockCortex.conversations.create).toHaveBeenCalledWith(
|
|
318
322
|
expect.objectContaining({
|
|
319
323
|
memorySpaceId: "quickstart-demo",
|
|
320
|
-
})
|
|
324
|
+
}),
|
|
321
325
|
);
|
|
322
326
|
});
|
|
323
327
|
|
|
@@ -330,7 +334,7 @@ describe("Conversations API Routes", () => {
|
|
|
330
334
|
expect(mockCortex.conversations.create).toHaveBeenCalledWith(
|
|
331
335
|
expect.objectContaining({
|
|
332
336
|
type: "user-agent",
|
|
333
|
-
})
|
|
337
|
+
}),
|
|
334
338
|
);
|
|
335
339
|
});
|
|
336
340
|
|
|
@@ -346,7 +350,7 @@ describe("Conversations API Routes", () => {
|
|
|
346
350
|
userId: "testuser",
|
|
347
351
|
agentId: "quickstart-assistant",
|
|
348
352
|
},
|
|
349
|
-
})
|
|
353
|
+
}),
|
|
350
354
|
);
|
|
351
355
|
});
|
|
352
356
|
|
|
@@ -137,7 +137,10 @@ describe("Password Utilities", () => {
|
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
it("should return false for invalid base64 in salt", async () => {
|
|
140
|
-
const result = await verifyPassword(
|
|
140
|
+
const result = await verifyPassword(
|
|
141
|
+
"password",
|
|
142
|
+
"!!!invalid!!!:validhash",
|
|
143
|
+
);
|
|
141
144
|
|
|
142
145
|
expect(result).toBe(false);
|
|
143
146
|
});
|