@cortexmemory/cli 0.31.0 → 0.33.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 +19 -10
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +28 -1
- package/dist/commands/deploy.js.map +1 -1
- package/dist/utils/__tests__/config.test.js +123 -1
- package/dist/utils/__tests__/config.test.js.map +1 -1
- package/dist/utils/config.d.ts +38 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +169 -1
- package/dist/utils/config.js.map +1 -1
- package/package.json +5 -5
- package/templates/basic/package-lock.json +12 -12
- package/templates/basic/package.json +3 -3
- package/templates/vercel-ai-quickstart/app/api/chat-v6/route.ts +13 -48
- package/templates/vercel-ai-quickstart/lib/layer-tracking.ts +38 -209
- package/templates/vercel-ai-quickstart/package.json +8 -8
|
@@ -1,214 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { useState, useCallback } from "react";
|
|
4
|
-
|
|
5
|
-
// Layer types (defined locally to avoid import issues before npm install)
|
|
6
|
-
export type MemoryLayer =
|
|
7
|
-
| "memorySpace"
|
|
8
|
-
| "user"
|
|
9
|
-
| "agent"
|
|
10
|
-
| "conversation"
|
|
11
|
-
| "vector"
|
|
12
|
-
| "facts"
|
|
13
|
-
| "graph";
|
|
14
|
-
|
|
15
|
-
export type LayerStatus =
|
|
16
|
-
| "pending"
|
|
17
|
-
| "in_progress"
|
|
18
|
-
| "complete"
|
|
19
|
-
| "error"
|
|
20
|
-
| "skipped";
|
|
21
|
-
|
|
22
3
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* -
|
|
26
|
-
*
|
|
27
|
-
*
|
|
4
|
+
* Layer Tracking - Re-exports from @cortexmemory/vercel-ai-provider/react
|
|
5
|
+
*
|
|
6
|
+
* This file re-exports the layer tracking hook and utilities from the provider
|
|
7
|
+
* package, adding the "use client" directive for Next.js App Router compatibility.
|
|
8
|
+
*
|
|
9
|
+
* The provider package contains the full implementation including:
|
|
10
|
+
* - useLayerTracking() hook for state management
|
|
11
|
+
* - handleDataPart callback for automatic stream parsing
|
|
12
|
+
* - Type definitions for layers, states, and events
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { useLayerTracking } from '@/lib/layer-tracking';
|
|
17
|
+
* import { useChat } from '@ai-sdk/react';
|
|
18
|
+
*
|
|
19
|
+
* function ChatComponent() {
|
|
20
|
+
* const { layers, isOrchestrating, handleDataPart } = useLayerTracking();
|
|
21
|
+
* const { messages } = useChat({ onData: handleDataPart });
|
|
22
|
+
* // ...
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
28
25
|
*/
|
|
29
|
-
export type RevisionAction = "ADD" | "UPDATE" | "SUPERSEDE" | "NONE";
|
|
30
|
-
|
|
31
|
-
export interface LayerState {
|
|
32
|
-
status: LayerStatus;
|
|
33
|
-
latencyMs?: number;
|
|
34
|
-
data?: {
|
|
35
|
-
id?: string;
|
|
36
|
-
preview?: string;
|
|
37
|
-
metadata?: Record<string, unknown>;
|
|
38
|
-
};
|
|
39
|
-
startedAt?: number;
|
|
40
|
-
completedAt?: number;
|
|
41
|
-
/**
|
|
42
|
-
* Revision action taken (v0.24.0+)
|
|
43
|
-
* Only present for facts layer when belief revision is enabled
|
|
44
|
-
*/
|
|
45
|
-
revisionAction?: RevisionAction;
|
|
46
|
-
/**
|
|
47
|
-
* Facts that were superseded by this action (v0.24.0+)
|
|
48
|
-
* Only present when revisionAction is "SUPERSEDE"
|
|
49
|
-
*/
|
|
50
|
-
supersededFacts?: string[];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface LayerTrackingState {
|
|
54
|
-
layers: Record<string, LayerState>;
|
|
55
|
-
isOrchestrating: boolean;
|
|
56
|
-
orchestrationStartTime?: number;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const initialLayerState: LayerState = {
|
|
60
|
-
status: "pending",
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const allLayers: MemoryLayer[] = [
|
|
64
|
-
"memorySpace",
|
|
65
|
-
"user",
|
|
66
|
-
"agent",
|
|
67
|
-
"conversation",
|
|
68
|
-
"vector",
|
|
69
|
-
"facts",
|
|
70
|
-
"graph",
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
export function useLayerTracking() {
|
|
74
|
-
const [state, setState] = useState<LayerTrackingState>({
|
|
75
|
-
layers: Object.fromEntries(
|
|
76
|
-
allLayers.map((layer) => [layer, { ...initialLayerState }]),
|
|
77
|
-
),
|
|
78
|
-
isOrchestrating: false,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const startOrchestration = useCallback(() => {
|
|
82
|
-
const now = Date.now();
|
|
83
|
-
setState({
|
|
84
|
-
layers: Object.fromEntries(
|
|
85
|
-
allLayers.map((layer) => [
|
|
86
|
-
layer,
|
|
87
|
-
{ status: "pending" as LayerStatus, startedAt: now },
|
|
88
|
-
]),
|
|
89
|
-
),
|
|
90
|
-
isOrchestrating: true,
|
|
91
|
-
orchestrationStartTime: now,
|
|
92
|
-
});
|
|
93
|
-
}, []);
|
|
94
26
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
: undefined;
|
|
113
|
-
|
|
114
|
-
// Check if all layers are complete
|
|
115
|
-
const updatedLayers: Record<string, LayerState> = {
|
|
116
|
-
...prev.layers,
|
|
117
|
-
[layer]: {
|
|
118
|
-
...layerState,
|
|
119
|
-
status,
|
|
120
|
-
latencyMs,
|
|
121
|
-
data,
|
|
122
|
-
completedAt: status === "complete" ? now : layerState?.completedAt,
|
|
123
|
-
// Belief revision info (v0.24.0+)
|
|
124
|
-
revisionAction: revisionInfo?.action,
|
|
125
|
-
supersededFacts: revisionInfo?.supersededFacts,
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const isStillOrchestrating = Object.values(updatedLayers).some(
|
|
130
|
-
(l: LayerState) =>
|
|
131
|
-
l.status === "pending" || l.status === "in_progress",
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
return {
|
|
135
|
-
...prev,
|
|
136
|
-
layers: updatedLayers,
|
|
137
|
-
isOrchestrating: isStillOrchestrating,
|
|
138
|
-
};
|
|
139
|
-
});
|
|
140
|
-
},
|
|
141
|
-
[],
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
const resetLayers = useCallback(() => {
|
|
145
|
-
setState({
|
|
146
|
-
layers: Object.fromEntries(
|
|
147
|
-
allLayers.map((layer) => [layer, { ...initialLayerState }]),
|
|
148
|
-
),
|
|
149
|
-
isOrchestrating: false,
|
|
150
|
-
});
|
|
151
|
-
}, []);
|
|
152
|
-
|
|
153
|
-
return {
|
|
154
|
-
layers: state.layers,
|
|
155
|
-
isOrchestrating: state.isOrchestrating,
|
|
156
|
-
startOrchestration,
|
|
157
|
-
updateLayer,
|
|
158
|
-
resetLayers,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Generate sample data for layer previews (used in demos)
|
|
164
|
-
*/
|
|
165
|
-
export function generateSampleLayerData(
|
|
166
|
-
layer: MemoryLayer,
|
|
167
|
-
userMessage?: string,
|
|
168
|
-
): LayerState["data"] {
|
|
169
|
-
switch (layer) {
|
|
170
|
-
case "memorySpace":
|
|
171
|
-
return {
|
|
172
|
-
id: "quickstart-demo",
|
|
173
|
-
preview: "Memory space for demo",
|
|
174
|
-
metadata: { isolation: "full" },
|
|
175
|
-
};
|
|
176
|
-
case "user":
|
|
177
|
-
return {
|
|
178
|
-
id: "demo-user",
|
|
179
|
-
preview: "Demo User",
|
|
180
|
-
metadata: { memories: 5 },
|
|
181
|
-
};
|
|
182
|
-
case "agent":
|
|
183
|
-
return {
|
|
184
|
-
id: "quickstart-assistant",
|
|
185
|
-
preview: "Cortex Demo Assistant",
|
|
186
|
-
};
|
|
187
|
-
case "conversation":
|
|
188
|
-
return {
|
|
189
|
-
id: `conv-${Date.now()}`,
|
|
190
|
-
preview: userMessage?.slice(0, 50) || "New conversation",
|
|
191
|
-
metadata: { messages: 2 },
|
|
192
|
-
};
|
|
193
|
-
case "vector":
|
|
194
|
-
return {
|
|
195
|
-
id: `mem-${Date.now()}`,
|
|
196
|
-
preview: "Embedded content...",
|
|
197
|
-
metadata: { dimensions: 1536, importance: 75 },
|
|
198
|
-
};
|
|
199
|
-
case "facts":
|
|
200
|
-
return {
|
|
201
|
-
id: `fact-${Date.now()}`,
|
|
202
|
-
preview: "Extracted facts from conversation",
|
|
203
|
-
metadata: { count: 3, types: ["identity", "preference"] },
|
|
204
|
-
};
|
|
205
|
-
case "graph":
|
|
206
|
-
return {
|
|
207
|
-
id: `graph-sync-${Date.now()}`,
|
|
208
|
-
preview: "Entity relationships",
|
|
209
|
-
metadata: { nodes: 4, edges: 3 },
|
|
210
|
-
};
|
|
211
|
-
default:
|
|
212
|
-
return undefined;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
27
|
+
// Re-export everything from the provider's React module
|
|
28
|
+
export {
|
|
29
|
+
useLayerTracking,
|
|
30
|
+
generateSampleLayerData,
|
|
31
|
+
ALL_LAYERS,
|
|
32
|
+
} from "@cortexmemory/vercel-ai-provider/react";
|
|
33
|
+
|
|
34
|
+
// Re-export types
|
|
35
|
+
export type {
|
|
36
|
+
MemoryLayer,
|
|
37
|
+
LayerStatus,
|
|
38
|
+
RevisionAction,
|
|
39
|
+
LayerState,
|
|
40
|
+
LayerTrackingState,
|
|
41
|
+
LayerUpdateData,
|
|
42
|
+
UseLayerTrackingResult,
|
|
43
|
+
} from "@cortexmemory/vercel-ai-provider/react";
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
"convex:deploy": "convex deploy"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@ai-sdk/openai": "^3.0.
|
|
23
|
-
"@ai-sdk/react": "^3.0.
|
|
22
|
+
"@ai-sdk/openai": "^3.0.13",
|
|
23
|
+
"@ai-sdk/react": "^3.0.44",
|
|
24
24
|
"@anthropic-ai/sdk": "^0.71.2",
|
|
25
25
|
"@cortexmemory/sdk": "file:../../..",
|
|
26
26
|
"@cortexmemory/vercel-ai-provider": "file:..",
|
|
27
|
-
"ai": "^6.0.
|
|
28
|
-
"convex": "^1.31.
|
|
29
|
-
"framer-motion": "^12.
|
|
27
|
+
"ai": "^6.0.42",
|
|
28
|
+
"convex": "^1.31.5",
|
|
29
|
+
"framer-motion": "^12.27.5",
|
|
30
30
|
"neo4j-driver": "^6.0.1",
|
|
31
|
-
"next": "^16.1.
|
|
31
|
+
"next": "^16.1.4",
|
|
32
32
|
"openai": "^6.16.0",
|
|
33
33
|
"react": "^19.2.3",
|
|
34
34
|
"react-dom": "^19.2.3",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@tailwindcss/postcss": "^4.1.18",
|
|
39
39
|
"@types/jest": "^30.0.0",
|
|
40
|
-
"@types/node": "^25.0.
|
|
41
|
-
"@types/react": "^19.2.
|
|
40
|
+
"@types/node": "^25.0.9",
|
|
41
|
+
"@types/react": "^19.2.9",
|
|
42
42
|
"@types/react-dom": "^19.2.3",
|
|
43
43
|
"autoprefixer": "^10.4.23",
|
|
44
44
|
"jest": "^30.2.0",
|