suemo 0.0.9 → 0.1.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/package.json +3 -2
- package/skills/suemo/SKILL.md +1 -1
- package/skills/suemo/references/agents-snippet.md +1 -1
- package/skills/suemo/references/cli-reference.md +1 -1
- package/skills/suemo/references/core-workflow.md +1 -1
- package/skills/suemo/references/manual-test-plan.md +1 -1
- package/skills/suemo/references/mcp-reference.md +1 -1
- package/skills/suemo/references/schema-retention-longevity.md +1 -1
- package/skills/suemo/references/sync-local-vps.md +1 -1
- package/src/cli/commands/believe.ts +5 -5
- package/src/cli/commands/consolidate.ts +5 -5
- package/src/cli/commands/doctor.ts +5 -5
- package/src/cli/commands/export-import.ts +5 -5
- package/src/cli/commands/goal.ts +5 -5
- package/src/cli/commands/health.ts +5 -5
- package/src/cli/commands/init.ts +10 -15
- package/src/cli/commands/observe.ts +6 -6
- package/src/cli/commands/query.ts +6 -6
- package/src/cli/commands/recall.ts +5 -5
- package/src/cli/commands/serve.ts +4 -4
- package/src/cli/commands/skill.ts +3 -3
- package/src/cli/commands/sync.ts +5 -5
- package/src/cli/commands/timeline.ts +5 -5
- package/src/cli/commands/wander.ts +5 -5
- package/src/cli/index.ts +16 -16
- package/src/cli/shared.ts +2 -2
- package/src/cognitive/consolidate.ts +4 -4
- package/src/cognitive/contradiction.ts +2 -2
- package/src/cognitive/health.ts +3 -3
- package/src/config.ts +1 -1
- package/src/db/client.ts +2 -2
- package/src/db/preflight.ts +1 -1
- package/src/db/schema.ts +2 -2
- package/src/embedding/index.ts +3 -3
- package/src/embedding/openai-compatible.ts +18 -18
- package/src/env.d.ts +10 -0
- package/src/goal.ts +4 -4
- package/src/index.ts +2 -2
- package/src/mcp/dispatch.ts +13 -13
- package/src/mcp/server.ts +8 -8
- package/src/mcp/stdio.ts +4 -4
- package/src/mcp/tools.ts +2 -2
- package/src/memory/episode.ts +3 -3
- package/src/memory/read.ts +6 -6
- package/src/memory/write.ts +8 -8
- package/src/skill/catalog.ts +8 -4
- package/src/sync.ts +3 -3
- package/tsconfig.json +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "suemo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Persistent semantic memory for AI agents — backed by SurrealDB.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Umar Alfarouk",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"start": "bun run src/cli/index.ts",
|
|
40
40
|
"ssot:check": "bun run scripts/ssot.ts check",
|
|
41
41
|
"ssot:sync": "bun run scripts/ssot.ts sync",
|
|
42
|
-
"
|
|
42
|
+
"fmt": "dprint fmt",
|
|
43
|
+
"check": "bun run fmt && bun tsc --noEmit && bun run ssot:check",
|
|
43
44
|
"sync": "bun run ssot:sync"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
package/skills/suemo/SKILL.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit, resolveScopeLabel } from '@/src/cli/shared.ts'
|
|
2
|
+
import { loadConfig } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { getLogger } from '@/src/logger.ts'
|
|
5
|
+
import { believe } from '@/src/memory/write.ts'
|
|
6
6
|
|
|
7
7
|
const log = getLogger(['suemo', 'cli', 'believe'])
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit, resolveScopeLabel } from '@/src/cli/shared.ts'
|
|
2
|
+
import { consolidate } from '@/src/cognitive/consolidate.ts'
|
|
3
|
+
import { loadConfig } from '@/src/config.ts'
|
|
4
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
5
|
+
import { getLogger } from '@/src/logger.ts'
|
|
6
6
|
|
|
7
7
|
const log = getLogger(['suemo', 'cli', 'consolidate'])
|
|
8
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { app, initCliCommand, resolveOutputModeOrExit } from '@/src/cli/shared.ts'
|
|
2
|
+
import { loadConfig } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { checkCompatibility } from '@/src/db/preflight.ts'
|
|
5
|
+
import { getLogger } from '@/src/logger.ts'
|
|
1
6
|
import type { Surreal } from 'surrealdb'
|
|
2
|
-
import { loadConfig } from '../../config.ts'
|
|
3
|
-
import { connect, disconnect } from '../../db/client.ts'
|
|
4
|
-
import { checkCompatibility } from '../../db/preflight.ts'
|
|
5
|
-
import { getLogger } from '../../logger.ts'
|
|
6
|
-
import { app, initCliCommand, resolveOutputModeOrExit } from '../shared.ts'
|
|
7
7
|
|
|
8
8
|
const log = getLogger(['suemo', 'cli', 'doctor'])
|
|
9
9
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit, resolveScopeLabel } from '@/src/cli/shared.ts'
|
|
2
|
+
import { loadConfig } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { getLogger } from '@/src/logger.ts'
|
|
5
|
+
import type { MemoryNode, Relation } from '@/src/types.ts'
|
|
1
6
|
import { createReadStream } from 'node:fs'
|
|
2
7
|
import { createInterface } from 'node:readline'
|
|
3
|
-
import { loadConfig } from '../../config.ts'
|
|
4
|
-
import { connect, disconnect } from '../../db/client.ts'
|
|
5
|
-
import { getLogger } from '../../logger.ts'
|
|
6
|
-
import type { MemoryNode, Relation } from '../../types.ts'
|
|
7
|
-
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit, resolveScopeLabel } from '../shared.ts'
|
|
8
8
|
|
|
9
9
|
const log = getLogger(['suemo', 'cli', 'export-import'])
|
|
10
10
|
|
package/src/cli/commands/goal.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit, resolveScopeLabel } from '@/src/cli/shared.ts'
|
|
2
|
+
import { loadConfig } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { goalList, goalResolve, goalSet } from '@/src/goal.ts'
|
|
5
|
+
import { getLogger } from '@/src/logger.ts'
|
|
1
6
|
import type { Surreal } from 'surrealdb'
|
|
2
|
-
import { loadConfig } from '../../config.ts'
|
|
3
|
-
import { connect, disconnect } from '../../db/client.ts'
|
|
4
|
-
import { goalList, goalResolve, goalSet } from '../../goal.ts'
|
|
5
|
-
import { getLogger } from '../../logger.ts'
|
|
6
|
-
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit, resolveScopeLabel } from '../shared.ts'
|
|
7
7
|
|
|
8
8
|
const log = getLogger(['suemo', 'cli', 'goal'])
|
|
9
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit } from '@/src/cli/shared.ts'
|
|
2
|
+
import { healthReport, suemoStats, vitals } from '@/src/cognitive/health.ts'
|
|
3
|
+
import { loadConfig } from '@/src/config.ts'
|
|
4
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
5
|
+
import { getLogger } from '@/src/logger.ts'
|
|
1
6
|
import type { Surreal } from 'surrealdb'
|
|
2
|
-
import { healthReport, suemoStats, vitals } from '../../cognitive/health.ts'
|
|
3
|
-
import { loadConfig } from '../../config.ts'
|
|
4
|
-
import { connect, disconnect } from '../../db/client.ts'
|
|
5
|
-
import { getLogger } from '../../logger.ts'
|
|
6
|
-
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit } from '../shared.ts'
|
|
7
7
|
|
|
8
8
|
const log = getLogger(['suemo', 'cli', 'health'])
|
|
9
9
|
|
package/src/cli/commands/init.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
import packageJson from '@/package.json' with { type: 'json' }
|
|
2
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit } from '@/src/cli/shared.ts'
|
|
3
|
+
import { loadConfig } from '@/src/config.ts'
|
|
4
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
5
|
+
import { checkCompatibility } from '@/src/db/preflight.ts'
|
|
6
|
+
import { runSchema } from '@/src/db/schema.ts'
|
|
7
|
+
import { getLogger } from '@/src/logger.ts'
|
|
1
8
|
import { confirm } from '@crustjs/prompts'
|
|
2
9
|
import { spawnSync } from 'node:child_process'
|
|
3
10
|
import { randomBytes } from 'node:crypto'
|
|
4
11
|
import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
5
12
|
import { tmpdir } from 'node:os'
|
|
6
13
|
import { basename, dirname, join, resolve as resolvePath } from 'node:path'
|
|
7
|
-
import { fileURLToPath } from 'node:url'
|
|
8
|
-
import packageJson from '../../../package.json' with { type: 'json' }
|
|
9
|
-
import { loadConfig } from '../../config.ts'
|
|
10
|
-
import { connect, disconnect } from '../../db/client.ts'
|
|
11
|
-
import { checkCompatibility } from '../../db/preflight.ts'
|
|
12
|
-
import { runSchema } from '../../db/schema.ts'
|
|
13
|
-
import { getLogger } from '../../logger.ts'
|
|
14
|
-
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit } from '../shared.ts'
|
|
15
14
|
|
|
16
|
-
import template from '
|
|
15
|
+
import template from '@/src/config.template' with { type: 'text' }
|
|
16
|
+
import FASTEMBED_SCRIPT_TEXT from '@/src/embedding/fastembed-server.py' with { type: 'text' }
|
|
17
17
|
|
|
18
18
|
interface InitFlags {
|
|
19
19
|
debug?: boolean | undefined
|
|
@@ -393,11 +393,6 @@ function extractEnvValue(content: string, key: string): string | null {
|
|
|
393
393
|
return match[1].trim()
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
function readFastembedScriptSource(): string {
|
|
397
|
-
const path = fileURLToPath(new URL('../embedding/fastembed-server.py', import.meta.url))
|
|
398
|
-
return readFileSync(path, 'utf-8')
|
|
399
|
-
}
|
|
400
|
-
|
|
401
396
|
function buildSurrealActions(
|
|
402
397
|
profile: '2gb' | '6gb',
|
|
403
398
|
existingPassword: string | null,
|
|
@@ -882,7 +877,7 @@ const initFastembedCmd = init.sub('fastembed')
|
|
|
882
877
|
requireCommands(['pacman', 'systemctl', 'install', 'chown', 'id'])
|
|
883
878
|
requireArchPackages(['python-fastembed', 'python-fastapi', 'uvicorn'])
|
|
884
879
|
|
|
885
|
-
const scriptContent =
|
|
880
|
+
const scriptContent = FASTEMBED_SCRIPT_TEXT
|
|
886
881
|
const actions = buildFastembedActions(scriptContent)
|
|
887
882
|
const dryRun = Boolean(flags['dry-run'])
|
|
888
883
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit, resolveScopeLabel } from '@/src/cli/shared.ts'
|
|
2
|
+
import { loadConfig } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { getLogger } from '@/src/logger.ts'
|
|
5
|
+
import { observe } from '@/src/memory/write.ts'
|
|
6
|
+
import { MemoryKindSchema } from '@/src/types.ts'
|
|
7
7
|
|
|
8
8
|
const log = getLogger(['suemo', 'cli', 'observe'])
|
|
9
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit, resolveScopeLabel } from '@/src/cli/shared.ts'
|
|
2
|
+
import { loadConfig } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { getLogger } from '@/src/logger.ts'
|
|
5
|
+
import { query } from '@/src/memory/read.ts'
|
|
6
|
+
import type { MemoryNode } from '@/src/types.ts'
|
|
7
7
|
|
|
8
8
|
const log = getLogger(['suemo', 'cli', 'query'])
|
|
9
9
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit } from '@/src/cli/shared.ts'
|
|
2
|
+
import { loadConfig } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { getLogger } from '@/src/logger.ts'
|
|
5
|
+
import { recall } from '@/src/memory/read.ts'
|
|
6
6
|
|
|
7
7
|
const log = getLogger(['suemo', 'cli', 'recall'])
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { app, initCliCommand, resolveOutputModeOrExit } from '@/src/cli/shared.ts'
|
|
2
|
+
import { inferProjectScope, loadConfig, resolveSyncConfig } from '@/src/config.ts'
|
|
3
|
+
import { getLogger } from '@/src/logger.ts'
|
|
4
|
+
import { startMcpServer, startMcpStdioServer } from '@/src/mcp/server.ts'
|
|
5
5
|
|
|
6
6
|
const log = getLogger(['suemo', 'cli', 'serve'])
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import packageJson from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import packageJson from '@/package.json' with { type: 'json' }
|
|
2
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit } from '@/src/cli/shared.ts'
|
|
3
|
+
import { listSkillReferences, readSkillDoc, readSkillReference, skillFilePath } from '@/src/skill/catalog.ts'
|
|
4
4
|
|
|
5
5
|
export const skillCmd = app.sub('skill')
|
|
6
6
|
.meta({ description: 'Print latest suemo skill or a specific reference file' })
|
package/src/cli/commands/sync.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit } from '@/src/cli/shared.ts'
|
|
2
|
+
import { loadConfig, resolveSyncConfig, type SurrealTarget } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { getLogger } from '@/src/logger.ts'
|
|
5
|
+
import { syncTo } from '@/src/sync.ts'
|
|
6
6
|
|
|
7
7
|
const log = getLogger(['suemo', 'cli', 'sync'])
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit, resolveScopeLabel } from '@/src/cli/shared.ts'
|
|
2
|
+
import { loadConfig } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { getLogger } from '@/src/logger.ts'
|
|
5
|
+
import { timeline } from '@/src/memory/read.ts'
|
|
6
6
|
|
|
7
7
|
const log = getLogger(['suemo', 'cli', 'timeline'])
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { app, initCliCommand, printCliJson, resolveOutputModeOrExit, resolveScopeLabel } from '@/src/cli/shared.ts'
|
|
2
|
+
import { loadConfig } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { getLogger } from '@/src/logger.ts'
|
|
5
|
+
import { wander } from '@/src/memory/read.ts'
|
|
6
6
|
|
|
7
7
|
const log = getLogger(['suemo', 'cli', 'wander'])
|
|
8
8
|
|
package/src/cli/index.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
import { believeCmd } from '@/src/cli/commands/believe.ts'
|
|
4
|
+
import { consolidateCmd } from '@/src/cli/commands/consolidate.ts'
|
|
5
|
+
import { doctorCmd } from '@/src/cli/commands/doctor.ts'
|
|
6
|
+
import { exportCmd, importCmd } from '@/src/cli/commands/export-import.ts'
|
|
7
|
+
import { goalCmd } from '@/src/cli/commands/goal.ts'
|
|
8
|
+
import { healthCmd } from '@/src/cli/commands/health.ts'
|
|
9
|
+
import { initCmd } from '@/src/cli/commands/init.ts'
|
|
10
|
+
import { observeCmd } from '@/src/cli/commands/observe.ts'
|
|
11
|
+
import { queryCmd } from '@/src/cli/commands/query.ts'
|
|
12
|
+
import { recallCmd } from '@/src/cli/commands/recall.ts'
|
|
13
|
+
import { serveCmd } from '@/src/cli/commands/serve.ts'
|
|
14
|
+
import { skillCmd } from '@/src/cli/commands/skill.ts'
|
|
15
|
+
import { syncCmd } from '@/src/cli/commands/sync.ts'
|
|
16
|
+
import { timelineCmd } from '@/src/cli/commands/timeline.ts'
|
|
17
|
+
import { wanderCmd } from '@/src/cli/commands/wander.ts'
|
|
18
|
+
import { app } from '@/src/cli/shared.ts'
|
|
3
19
|
import { helpPlugin, versionPlugin } from '@crustjs/plugins'
|
|
4
|
-
import { believeCmd } from './commands/believe.ts'
|
|
5
|
-
import { consolidateCmd } from './commands/consolidate.ts'
|
|
6
|
-
import { doctorCmd } from './commands/doctor.ts'
|
|
7
|
-
import { exportCmd, importCmd } from './commands/export-import.ts'
|
|
8
|
-
import { goalCmd } from './commands/goal.ts'
|
|
9
|
-
import { healthCmd } from './commands/health.ts'
|
|
10
|
-
import { initCmd } from './commands/init.ts'
|
|
11
|
-
import { observeCmd } from './commands/observe.ts'
|
|
12
|
-
import { queryCmd } from './commands/query.ts'
|
|
13
|
-
import { recallCmd } from './commands/recall.ts'
|
|
14
|
-
import { serveCmd } from './commands/serve.ts'
|
|
15
|
-
import { skillCmd } from './commands/skill.ts'
|
|
16
|
-
import { syncCmd } from './commands/sync.ts'
|
|
17
|
-
import { timelineCmd } from './commands/timeline.ts'
|
|
18
|
-
import { wanderCmd } from './commands/wander.ts'
|
|
19
|
-
import { app } from './shared.ts'
|
|
20
20
|
|
|
21
21
|
import packageJson from '@/package.json' with { type: 'json' }
|
|
22
22
|
|
package/src/cli/shared.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/cli/shared.ts — single shared root, holds inheritable flags
|
|
2
|
+
import { inferProjectScope, type SuemoConfig } from '@/src/config.ts'
|
|
3
|
+
import { getLogger, initLogger } from '@/src/logger.ts'
|
|
2
4
|
import { Crust } from '@crustjs/core'
|
|
3
|
-
import { inferProjectScope, type SuemoConfig } from '../config.ts'
|
|
4
|
-
import { getLogger, initLogger } from '../logger.ts'
|
|
5
5
|
|
|
6
6
|
const cliLog = getLogger(['suemo', 'cli'])
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { LLMConfig, SuemoConfig } from '@/src/config.ts'
|
|
2
|
+
import { getEmbedding } from '@/src/embedding/index.ts'
|
|
3
|
+
import { getLogger } from '@/src/logger.ts'
|
|
4
|
+
import type { ConsolidationRun, MemoryNode } from '@/src/types.ts'
|
|
1
5
|
import type { Surreal } from 'surrealdb'
|
|
2
|
-
import type { LLMConfig, SuemoConfig } from '../config.ts'
|
|
3
|
-
import { getEmbedding } from '../embedding/index.ts'
|
|
4
|
-
import { getLogger } from '../logger.ts'
|
|
5
|
-
import type { ConsolidationRun, MemoryNode } from '../types.ts'
|
|
6
6
|
|
|
7
7
|
const log = getLogger(['suemo', 'cognitive', 'consolidate'])
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { getLogger } from '@/src/logger.ts'
|
|
2
|
+
import type { MemoryNode } from '@/src/types.ts'
|
|
1
3
|
import type { Surreal } from 'surrealdb'
|
|
2
|
-
import { getLogger } from '../logger.ts'
|
|
3
|
-
import type { MemoryNode } from '../types.ts'
|
|
4
4
|
|
|
5
5
|
const log = getLogger(['suemo', 'cognitive', 'contradiction'])
|
|
6
6
|
|
package/src/cognitive/health.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { checkCompatibility } from '@/src/db/preflight.ts'
|
|
2
|
+
import { getLogger } from '@/src/logger.ts'
|
|
3
|
+
import type { ConsolidationRun, HealthReport, SuemoStats } from '@/src/types.ts'
|
|
1
4
|
import type { Surreal } from 'surrealdb'
|
|
2
|
-
import { checkCompatibility } from '../db/preflight.ts'
|
|
3
|
-
import { getLogger } from '../logger.ts'
|
|
4
|
-
import type { ConsolidationRun, HealthReport, SuemoStats } from '../types.ts'
|
|
5
5
|
|
|
6
6
|
const log = getLogger(['suemo', 'cognitive', 'health'])
|
|
7
7
|
|
package/src/config.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { getLogger } from '@/src/logger.ts'
|
|
1
2
|
import { createHash } from 'node:crypto'
|
|
2
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
3
4
|
import { basename, dirname, join, resolve } from 'node:path'
|
|
4
5
|
import { pathToFileURL } from 'node:url'
|
|
5
|
-
import { getLogger } from './logger.ts'
|
|
6
6
|
|
|
7
7
|
// ── Config shape ──────────────────────────────────────────────────────────────
|
|
8
8
|
|
package/src/db/client.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SDK v2: requires @surrealdb/node for WebSocket support in Bun/Node runtimes.
|
|
2
2
|
// createRemoteEngines() handles ws://, wss://, http://, https:// connections.
|
|
3
3
|
// createNodeEngines() patches in the Node.js WebSocket implementation.
|
|
4
|
+
import type { SurrealTarget } from '@/src/config.ts'
|
|
5
|
+
import { getLogger } from '@/src/logger.ts'
|
|
4
6
|
import { createNodeEngines } from '@surrealdb/node'
|
|
5
7
|
import { createRemoteEngines, Surreal } from 'surrealdb'
|
|
6
|
-
import type { SurrealTarget } from '../config.ts'
|
|
7
|
-
import { getLogger } from '../logger.ts'
|
|
8
8
|
|
|
9
9
|
const log = getLogger(['suemo', 'db', 'client'])
|
|
10
10
|
|
package/src/db/preflight.ts
CHANGED
package/src/db/schema.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { getLogger } from '@/src/logger.ts'
|
|
1
2
|
import { Surreal } from 'surrealdb'
|
|
2
|
-
import { getLogger } from '../logger.ts'
|
|
3
3
|
|
|
4
|
-
import SCHEMA from '
|
|
4
|
+
import SCHEMA from '@/src/db/schema.surql' with { type: 'text' }
|
|
5
5
|
|
|
6
6
|
const log = getLogger(['suemo', 'db', 'schema'])
|
|
7
7
|
|
package/src/embedding/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { EmbeddingProvider } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { EmbeddingProvider } from '@/src/config.ts'
|
|
2
|
+
import { embedText } from '@/src/embedding/openai-compatible.ts'
|
|
3
|
+
import { getLogger } from '@/src/logger.ts'
|
|
4
4
|
|
|
5
5
|
const log = getLogger(['suemo', 'embedding'])
|
|
6
6
|
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
// src/embedding/openai_compatible.ts
|
|
2
|
-
import { getLogger } from
|
|
2
|
+
import { getLogger } from '@/src/logger.ts'
|
|
3
3
|
|
|
4
|
-
const log = getLogger([
|
|
4
|
+
const log = getLogger(['suemo', 'embedding', 'openai-compatible'])
|
|
5
5
|
|
|
6
6
|
export interface OpenAICompatibleEmbeddingConfig {
|
|
7
|
-
url: string
|
|
8
|
-
model: string
|
|
9
|
-
dimension: number
|
|
10
|
-
apiKey?: string
|
|
7
|
+
url: string // e.g. http://127.0.0.1:8080/v1/embeddings
|
|
8
|
+
model: string
|
|
9
|
+
dimension: number
|
|
10
|
+
apiKey?: string
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export async function embedText(
|
|
14
14
|
text: string,
|
|
15
15
|
config: OpenAICompatibleEmbeddingConfig,
|
|
16
16
|
): Promise<number[]> {
|
|
17
|
-
log.debug(
|
|
17
|
+
log.debug('embedText()', { textPreview: text.slice(0, 60) })
|
|
18
18
|
|
|
19
19
|
const res = await fetch(config.url, {
|
|
20
|
-
method:
|
|
20
|
+
method: 'POST',
|
|
21
21
|
headers: {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
'Authorization': `Bearer ${config.apiKey ?? 'local'}`,
|
|
24
24
|
},
|
|
25
25
|
body: JSON.stringify({ input: text, model: config.model }),
|
|
26
|
-
})
|
|
26
|
+
})
|
|
27
27
|
|
|
28
28
|
if (!res.ok) {
|
|
29
|
-
throw new Error(`Embedding server error ${res.status}: ${await res.text()}`)
|
|
29
|
+
throw new Error(`Embedding server error ${res.status}: ${await res.text()}`)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const json = await res.json() as {
|
|
33
|
-
data: { embedding: number[]; index: number }[]
|
|
34
|
-
}
|
|
33
|
+
data: { embedding: number[]; index: number }[]
|
|
34
|
+
}
|
|
35
35
|
|
|
36
|
-
const vec = json.data[0]?.embedding
|
|
37
|
-
if (!vec) throw new Error(
|
|
36
|
+
const vec = json.data[0]?.embedding
|
|
37
|
+
if (!vec) throw new Error('Embedding server returned empty data')
|
|
38
38
|
if (vec.length !== config.dimension) {
|
|
39
|
-
throw new Error(`Dimension mismatch: expected ${config.dimension}, got ${vec.length}`)
|
|
39
|
+
throw new Error(`Dimension mismatch: expected ${config.dimension}, got ${vec.length}`)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
return vec
|
|
42
|
+
return vec
|
|
43
43
|
}
|
package/src/env.d.ts
CHANGED
package/src/goal.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { SuemoConfig } from '@/src/config.ts'
|
|
2
|
+
import { getLogger } from '@/src/logger.ts'
|
|
3
|
+
import { invalidate, observe } from '@/src/memory/write.ts'
|
|
4
|
+
import type { MemoryNode } from '@/src/types.ts'
|
|
1
5
|
import type { Surreal } from 'surrealdb'
|
|
2
|
-
import type { SuemoConfig } from './config.ts'
|
|
3
|
-
import { getLogger } from './logger.ts'
|
|
4
|
-
import { invalidate, observe } from './memory/write.ts'
|
|
5
|
-
import type { MemoryNode } from './types.ts'
|
|
6
6
|
|
|
7
7
|
const log = getLogger(['suemo', 'goal'])
|
|
8
8
|
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts — public API surface
|
|
2
|
-
export { defineConfig, inferProjectIdentity, inferProjectScope, loadConfig, resolveSyncConfig } from '
|
|
2
|
+
export { defineConfig, inferProjectIdentity, inferProjectScope, loadConfig, resolveSyncConfig } from '@/src/config.ts'
|
|
3
3
|
export type {
|
|
4
4
|
AuthConfig,
|
|
5
5
|
ConsolidationConfig,
|
|
@@ -16,4 +16,4 @@ export type {
|
|
|
16
16
|
SyncAutoConfig,
|
|
17
17
|
SyncConfig,
|
|
18
18
|
SyncDirectionConfig,
|
|
19
|
-
} from '
|
|
19
|
+
} from '@/src/config.ts'
|
package/src/mcp/dispatch.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { episodeEnd, episodeStart, getSessionContext, setSessionContext } from '../memory/episode.ts'
|
|
10
|
-
import { context, query, recall, timeline, wander } from '../memory/read.ts'
|
|
1
|
+
import { consolidate } from '@/src/cognitive/consolidate.ts'
|
|
2
|
+
import { healthReport, suemoStats, vitals } from '@/src/cognitive/health.ts'
|
|
3
|
+
import { inferProjectScope } from '@/src/config.ts'
|
|
4
|
+
import type { SuemoConfig } from '@/src/config.ts'
|
|
5
|
+
import { goalList, goalResolve, goalSet } from '@/src/goal.ts'
|
|
6
|
+
import { getLogger } from '@/src/logger.ts'
|
|
7
|
+
import { episodeEnd, episodeStart, getSessionContext, setSessionContext } from '@/src/memory/episode.ts'
|
|
8
|
+
import { context, query, recall, timeline, wander } from '@/src/memory/read.ts'
|
|
11
9
|
import {
|
|
12
10
|
believe,
|
|
13
11
|
capturePrompt,
|
|
@@ -16,9 +14,11 @@ import {
|
|
|
16
14
|
suggestTopicKey,
|
|
17
15
|
updateMemoryById,
|
|
18
16
|
upsertByKey,
|
|
19
|
-
} from '
|
|
20
|
-
import { listSkillReferences, readSkillDoc, readSkillReference } from '
|
|
21
|
-
import { ObserveInputSchema, QueryInputSchema } from '
|
|
17
|
+
} from '@/src/memory/write.ts'
|
|
18
|
+
import { listSkillReferences, readSkillDoc, readSkillReference } from '@/src/skill/catalog.ts'
|
|
19
|
+
import { ObserveInputSchema, QueryInputSchema } from '@/src/types.ts'
|
|
20
|
+
import type { Surreal } from 'surrealdb'
|
|
21
|
+
import { z } from 'zod'
|
|
22
22
|
|
|
23
23
|
const log = getLogger(['suemo', 'mcp', 'dispatch'])
|
|
24
24
|
|
package/src/mcp/server.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// src/mcp/server.ts
|
|
2
|
+
import { inferProjectScope, resolveSyncConfig, type SuemoConfig } from '@/src/config.ts'
|
|
3
|
+
import { connect, disconnect } from '@/src/db/client.ts'
|
|
4
|
+
import { checkCompatibility, requireCompatibility } from '@/src/db/preflight.ts'
|
|
5
|
+
import { runSchema } from '@/src/db/schema.ts'
|
|
6
|
+
import { getLogger } from '@/src/logger.ts'
|
|
7
|
+
import { runStdioServer } from '@/src/mcp/stdio.ts'
|
|
8
|
+
import { buildMcpRouter } from '@/src/mcp/tools.ts'
|
|
9
|
+
import { syncTo } from '@/src/sync.ts'
|
|
2
10
|
import { Elysia } from 'elysia'
|
|
3
|
-
import { inferProjectScope, resolveSyncConfig, type SuemoConfig } from '../config.ts'
|
|
4
|
-
import { connect, disconnect } from '../db/client.ts'
|
|
5
|
-
import { checkCompatibility, requireCompatibility } from '../db/preflight.ts'
|
|
6
|
-
import { runSchema } from '../db/schema.ts'
|
|
7
|
-
import { getLogger } from '../logger.ts'
|
|
8
|
-
import { syncTo } from '../sync.ts'
|
|
9
|
-
import { runStdioServer } from './stdio.ts'
|
|
10
|
-
import { buildMcpRouter } from './tools.ts'
|
|
11
11
|
|
|
12
12
|
const log = getLogger(['suemo', 'mcp'])
|
|
13
13
|
|
package/src/mcp/stdio.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { SuemoConfig } from '@/src/config.ts'
|
|
2
|
+
import { getLogger } from '@/src/logger.ts'
|
|
3
|
+
import { handleToolCall } from '@/src/mcp/dispatch.ts'
|
|
1
4
|
import { createInterface } from 'node:readline'
|
|
2
5
|
import type { Surreal } from 'surrealdb'
|
|
3
|
-
import type { SuemoConfig } from '../config.ts'
|
|
4
|
-
import { getLogger } from '../logger.ts'
|
|
5
|
-
import { handleToolCall } from './dispatch.ts'
|
|
6
6
|
|
|
7
|
-
import packageJson from '
|
|
7
|
+
import packageJson from '@/package.json' with { type: 'json' }
|
|
8
8
|
|
|
9
9
|
const log = getLogger(['suemo', 'mcp', 'stdio'])
|
|
10
10
|
|
package/src/mcp/tools.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/mcp/tools.ts
|
|
2
2
|
// HTTP transport adapter for MCP calls.
|
|
3
3
|
|
|
4
|
+
import type { SuemoConfig } from '@/src/config.ts'
|
|
5
|
+
import { handleToolCall } from '@/src/mcp/dispatch.ts'
|
|
4
6
|
import type { Elysia } from 'elysia'
|
|
5
7
|
import type { Surreal } from 'surrealdb'
|
|
6
|
-
import type { SuemoConfig } from '../config.ts'
|
|
7
|
-
import { handleToolCall } from './dispatch.ts'
|
|
8
8
|
|
|
9
9
|
interface McpRouterOptions {
|
|
10
10
|
onMutation?: (tool: string) => Promise<void>
|
package/src/memory/episode.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { incrementWriteStats } from '@/src/cognitive/health.ts'
|
|
2
|
+
import { getLogger } from '@/src/logger.ts'
|
|
3
|
+
import { type Episode, type EpisodeSummaryFields, EpisodeSummaryFieldsSchema } from '@/src/types.ts'
|
|
1
4
|
import type { Surreal } from 'surrealdb'
|
|
2
|
-
import { incrementWriteStats } from '../cognitive/health.ts'
|
|
3
|
-
import { getLogger } from '../logger.ts'
|
|
4
|
-
import { type Episode, type EpisodeSummaryFields, EpisodeSummaryFieldsSchema } from '../types.ts'
|
|
5
5
|
|
|
6
6
|
const log = getLogger(['suemo', 'memory', 'episode'])
|
|
7
7
|
|
package/src/memory/read.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { incrementQueryStats } from '@/src/cognitive/health.ts'
|
|
2
|
+
import type { SuemoConfig } from '@/src/config.ts'
|
|
3
|
+
import { getEmbedding } from '@/src/embedding/index.ts'
|
|
4
|
+
import { getLogger } from '@/src/logger.ts'
|
|
5
|
+
import type { Episode, MemoryNode, QueryInput, SuemoStats } from '@/src/types.ts'
|
|
6
|
+
import { QueryInputSchema } from '@/src/types.ts'
|
|
1
7
|
import type { Surreal } from 'surrealdb'
|
|
2
|
-
import { incrementQueryStats } from '../cognitive/health.ts'
|
|
3
|
-
import type { SuemoConfig } from '../config.ts'
|
|
4
|
-
import { getEmbedding } from '../embedding/index.ts'
|
|
5
|
-
import { getLogger } from '../logger.ts'
|
|
6
|
-
import type { Episode, MemoryNode, QueryInput, SuemoStats } from '../types.ts'
|
|
7
|
-
import { QueryInputSchema } from '../types.ts'
|
|
8
8
|
|
|
9
9
|
const log = getLogger(['suemo', 'memory', 'read'])
|
|
10
10
|
|
package/src/memory/write.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { detectContradiction } from '@/src/cognitive/contradiction.ts'
|
|
2
|
+
import { incrementWriteStats } from '@/src/cognitive/health.ts'
|
|
3
|
+
import type { SuemoConfig } from '@/src/config.ts'
|
|
4
|
+
import { getEmbedding } from '@/src/embedding/index.ts'
|
|
5
|
+
import { getLogger } from '@/src/logger.ts'
|
|
6
|
+
import { attachToEpisode } from '@/src/memory/episode.ts'
|
|
7
|
+
import type { MemoryKind, MemoryNode, ObserveInput } from '@/src/types.ts'
|
|
8
|
+
import { MemoryKindSchema, ObserveInputSchema } from '@/src/types.ts'
|
|
1
9
|
import type { Surreal } from 'surrealdb'
|
|
2
|
-
import { detectContradiction } from '../cognitive/contradiction.ts'
|
|
3
|
-
import { incrementWriteStats } from '../cognitive/health.ts'
|
|
4
|
-
import type { SuemoConfig } from '../config.ts'
|
|
5
|
-
import { getEmbedding } from '../embedding/index.ts'
|
|
6
|
-
import { getLogger } from '../logger.ts'
|
|
7
|
-
import type { MemoryKind, MemoryNode, ObserveInput } from '../types.ts'
|
|
8
|
-
import { MemoryKindSchema, ObserveInputSchema } from '../types.ts'
|
|
9
|
-
import { attachToEpisode } from './episode.ts'
|
|
10
10
|
|
|
11
11
|
const log = getLogger(['suemo', 'memory', 'write'])
|
|
12
12
|
|
package/src/skill/catalog.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { readdirSync, readFileSync } from 'node:fs'
|
|
2
|
-
import { basename } from 'node:path'
|
|
2
|
+
import { basename, dirname } from 'node:path'
|
|
3
3
|
import { fileURLToPath } from 'node:url'
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const PROJECT_ROOT = dirname(
|
|
6
|
+
fileURLToPath(import.meta.resolve('@/package.json')),
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
import SKILL_FILE_PATH from '@/skills/suemo/SKILL.md' with { type: 'text' }
|
|
10
|
+
const SKILL_REFERENCES_DIR = `${PROJECT_ROOT}/skills/suemo/references/`
|
|
7
11
|
|
|
8
12
|
export function skillFilePath(): string {
|
|
9
13
|
return SKILL_FILE_PATH
|
|
@@ -25,7 +29,7 @@ export function skillReferencePath(reference: string): string | null {
|
|
|
25
29
|
if (!cleaned) return null
|
|
26
30
|
const available = new Set(listSkillReferences())
|
|
27
31
|
if (!available.has(cleaned)) return null
|
|
28
|
-
return fileURLToPath(new URL(
|
|
32
|
+
return fileURLToPath(new URL(`${PROJECT_ROOT}/skills/suemo/references/${cleaned}.md`, import.meta.url))
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
export function readSkillReference(reference: string): { name: string; path: string; content: string } | null {
|
package/src/sync.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { SurrealTarget } from '@/src/config.ts'
|
|
2
|
+
import { getLogger } from '@/src/logger.ts'
|
|
3
|
+
import type { SyncResult } from '@/src/types.ts'
|
|
1
4
|
import { createNodeEngines } from '@surrealdb/node'
|
|
2
5
|
import { createHash } from 'node:crypto'
|
|
3
6
|
import { createRemoteEngines, Surreal } from 'surrealdb'
|
|
4
|
-
import type { SurrealTarget } from './config.ts'
|
|
5
|
-
import { getLogger } from './logger.ts'
|
|
6
|
-
import type { SyncResult } from './types.ts'
|
|
7
7
|
|
|
8
8
|
const log = getLogger(['suemo', 'sync'])
|
|
9
9
|
|