suemo 0.0.2 → 0.0.3
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 +90 -17
- package/package.json +1 -1
- package/src/cli/commands/export-import.ts +26 -1
- package/src/cli/commands/health.ts +18 -1
- package/src/cli/commands/observe.ts +1 -0
- package/src/cli/commands/serve.ts +11 -1
- package/src/cli/commands/sync.ts +31 -6
- package/src/cognitive/health.ts +61 -1
- package/src/config.template.ts +22 -0
- package/src/config.ts +83 -2
- package/src/db/schema.surql +19 -1
- package/src/index.ts +5 -1
- package/src/mcp/dispatch.ts +105 -7
- package/src/mcp/server.ts +126 -3
- package/src/mcp/stdio.ts +75 -4
- package/src/mcp/tools.ts +6 -2
- package/src/memory/episode.ts +92 -0
- package/src/memory/read.ts +2 -0
- package/src/memory/write.ts +199 -2
- package/src/sync.ts +310 -66
- package/src/types.ts +30 -5
package/src/types.ts
CHANGED
|
@@ -32,12 +32,14 @@ export const MemoryNodeSchema = z.object({
|
|
|
32
32
|
summary: z.string().nullable(),
|
|
33
33
|
tags: z.array(z.string()),
|
|
34
34
|
scope: z.string().nullable(),
|
|
35
|
+
topic_key: z.string().nullable(),
|
|
35
36
|
embedding: z.array(z.number()),
|
|
36
37
|
confidence: z.number().min(0).max(1),
|
|
37
38
|
salience: z.number().min(0).max(1),
|
|
38
39
|
valid_from: z.iso.datetime(),
|
|
39
40
|
valid_until: z.iso.datetime().nullable(),
|
|
40
41
|
source: z.string().nullable(),
|
|
42
|
+
prompt_source: z.union([z.string(), z.object({ tb: z.string(), id: z.string() })]).nullable(),
|
|
41
43
|
created_at: z.iso.datetime(),
|
|
42
44
|
updated_at: z.iso.datetime(),
|
|
43
45
|
consolidated: z.boolean(),
|
|
@@ -58,6 +60,7 @@ export const RelationSchema = z.object({
|
|
|
58
60
|
valid_from: z.iso.datetime(),
|
|
59
61
|
valid_until: z.iso.datetime().nullable(),
|
|
60
62
|
created_at: z.iso.datetime(),
|
|
63
|
+
updated_at: z.iso.datetime(),
|
|
61
64
|
})
|
|
62
65
|
export type Relation = z.infer<typeof RelationSchema>
|
|
63
66
|
|
|
@@ -68,7 +71,8 @@ export const EpisodeSchema = z.object({
|
|
|
68
71
|
started_at: z.iso.datetime(),
|
|
69
72
|
ended_at: z.iso.datetime().nullable(),
|
|
70
73
|
summary: z.string().nullable(),
|
|
71
|
-
|
|
74
|
+
context: z.record(z.string(), z.unknown()).nullable(),
|
|
75
|
+
memory_ids: z.array(z.union([z.string(), z.object({ tb: z.string(), id: z.string() })])),
|
|
72
76
|
})
|
|
73
77
|
export type Episode = z.infer<typeof EpisodeSchema>
|
|
74
78
|
|
|
@@ -91,13 +95,27 @@ export type ConsolidationRun = z.infer<typeof ConsolidationRunSchema>
|
|
|
91
95
|
// from input — this is the intended behavior for all optional fields here.
|
|
92
96
|
export const ObserveInputSchema = z.object({
|
|
93
97
|
content: z.string().min(1),
|
|
94
|
-
kind: MemoryKindSchema.default('observation')
|
|
95
|
-
tags: z.array(z.string()).default([])
|
|
98
|
+
kind: MemoryKindSchema.default('observation'),
|
|
99
|
+
tags: z.array(z.string()).default([]),
|
|
96
100
|
scope: z.string().optional(),
|
|
97
101
|
source: z.string().optional(),
|
|
98
|
-
confidence: z.number().min(0).max(1).default(1.0)
|
|
102
|
+
confidence: z.number().min(0).max(1).default(1.0),
|
|
103
|
+
sessionId: z.string().optional(),
|
|
104
|
+
})
|
|
105
|
+
export type ObserveInput = z.input<typeof ObserveInputSchema>
|
|
106
|
+
|
|
107
|
+
export const SuemoStatsSchema = z.object({
|
|
108
|
+
totalNodes: z.number(),
|
|
109
|
+
activeNodes: z.number(),
|
|
110
|
+
nodesByKind: z.record(z.string(), z.number()),
|
|
111
|
+
relations: z.number(),
|
|
112
|
+
consolidationRuns: z.number(),
|
|
113
|
+
lastWrite: z.iso.datetime().nullable(),
|
|
114
|
+
lastQuery: z.iso.datetime().nullable(),
|
|
115
|
+
totalWrites: z.number(),
|
|
116
|
+
totalQueries: z.number(),
|
|
99
117
|
})
|
|
100
|
-
export type
|
|
118
|
+
export type SuemoStats = z.infer<typeof SuemoStatsSchema>
|
|
101
119
|
|
|
102
120
|
// ── query() input ─────────────────────────────────────────────────────────────
|
|
103
121
|
export const QueryInputSchema = z.object({
|
|
@@ -140,5 +158,12 @@ export const SyncResultSchema = z.object({
|
|
|
140
158
|
skipped: z.number(),
|
|
141
159
|
errors: z.number(),
|
|
142
160
|
cursor: z.iso.datetime(),
|
|
161
|
+
push_cursor: z.iso.datetime().optional(),
|
|
162
|
+
pull_cursor: z.iso.datetime().optional(),
|
|
163
|
+
integrity: z.object({
|
|
164
|
+
sourceCount: z.number(),
|
|
165
|
+
destCount: z.number(),
|
|
166
|
+
match: z.boolean(),
|
|
167
|
+
}).optional(),
|
|
143
168
|
})
|
|
144
169
|
export type SyncResult = z.infer<typeof SyncResultSchema>
|