suemo 0.1.10 → 0.1.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suemo",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Persistent semantic memory for AI agents — backed by SurrealDB.",
5
5
  "author": {
6
6
  "name": "Umar Alfarouk",
@@ -49,9 +49,8 @@
49
49
  "@crustjs/plugins": "^0.0.20",
50
50
  "@crustjs/prompts": "^0.0.10",
51
51
  "@crustjs/style": "^0.0.6",
52
- "@logtape/file": "^2.0.5",
53
52
  "@logtape/logtape": "^2.0.5",
54
- "@mdrv/surreal-node": "^3.0.3",
53
+ "@mdrv/surrealdb-node": "^3.0.3",
55
54
  "elysia": "^1.4.28",
56
55
  "surrealdb": "^2.0.3",
57
56
  "zod": "^4.3.6"
@@ -1018,6 +1018,34 @@ function writeConfig(force: boolean, outputPath?: string): 'written' | 'skipped'
1018
1018
  return 'written'
1019
1019
  }
1020
1020
 
1021
+ function writePackageJson(configDir: string): boolean {
1022
+ const pkgPath = join(configDir, 'package.json')
1023
+ const existingPkg = existsSync(pkgPath)
1024
+ if (existingPkg) {
1025
+ try {
1026
+ const content = JSON.parse(readFileSync(pkgPath, 'utf-8'))
1027
+ if (content.dependencies?.suemo) return false
1028
+ } catch { /* overwrite malformed */ }
1029
+ }
1030
+ const pkg = JSON.stringify(
1031
+ {
1032
+ name: 'suemo-user-config',
1033
+ private: true,
1034
+ type: 'module',
1035
+ dependencies: { suemo: 'link:suemo' },
1036
+ },
1037
+ null,
1038
+ '\t',
1039
+ )
1040
+ writeFileSync(pkgPath, `${pkg}\n`, 'utf-8')
1041
+ return true
1042
+ }
1043
+
1044
+ function runBunInstall(configDir: string): boolean {
1045
+ const result = spawnSync('bun', ['install'], { cwd: configDir, stdio: 'inherit' })
1046
+ return (result.status ?? 1) === 0
1047
+ }
1048
+
1021
1049
  function configOutputPath(flags: InitFlags): string | undefined {
1022
1050
  const fromFlag = flags.config?.trim()
1023
1051
  if (fromFlag) return fromFlag
@@ -1105,7 +1133,23 @@ const initConfigCmd = init.sub('config')
1105
1133
  json: outputMode === 'json',
1106
1134
  quiet: flags.quiet,
1107
1135
  })
1108
- writeConfig(Boolean(flags.force), configOutputPath(flags))
1136
+ const configPath = configOutputPath(flags)
1137
+ const result = writeConfig(Boolean(flags.force), configPath)
1138
+ if (result === 'written') {
1139
+ const home = process.env.HOME ?? process.env.USERPROFILE
1140
+ if (home) {
1141
+ const configDir = resolvePath(home, '.suemo')
1142
+ const pkgWritten = writePackageJson(configDir)
1143
+ if (pkgWritten) {
1144
+ const installOk = runBunInstall(configDir)
1145
+ if (installOk) {
1146
+ console.log('✓ package.json created and dependencies installed in ~/.suemo/')
1147
+ } else {
1148
+ console.error('⚠ bun install failed in ~/.suemo/ — config imports from "suemo" may not resolve')
1149
+ }
1150
+ }
1151
+ }
1152
+ }
1109
1153
  })
1110
1154
 
1111
1155
  const initSchemaCmd = init.sub('schema')
@@ -1,6 +1,4 @@
1
- import { defineConfig } from 'suemo'
2
-
3
- export default defineConfig({
1
+ export default {
4
2
  main: {
5
3
  projectDir: '.ua',
6
4
  },
@@ -58,4 +56,4 @@ export default defineConfig({
58
56
  minWriteIntervalSeconds: 30,
59
57
  },
60
58
  },
61
- })
59
+ }
package/src/db/client.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // createNodeEngines() patches in the Node.js WebSocket implementation.
4
4
  import type { SurrealTarget } from '@/src/config.ts'
5
5
  import { getLogger } from '@/src/logger.ts'
6
- import { createNodeEngines } from '@mdrv/surreal-node'
6
+ import { createNodeEngines } from '@mdrv/surrealdb-node'
7
7
  import { createRemoteEngines, Surreal } from 'surrealdb'
8
8
 
9
9
  const log = getLogger(['suemo', 'db', 'client'])
package/src/logger.ts CHANGED
@@ -1,8 +1,20 @@
1
1
  // src/logger.ts
2
2
  // Call initLogger() once in cli/index.ts and mcp/server.ts before anything else.
3
3
 
4
- import { getFileSink } from '@logtape/file'
5
4
  import { configure, getConsoleSink, getLogger, type Sink } from '@logtape/logtape'
5
+ import { mkdirSync, openSync, writeSync } from 'node:fs'
6
+ import { dirname } from 'node:path'
7
+
8
+ function createFileSink(path: string): Sink {
9
+ mkdirSync(dirname(path), { recursive: true })
10
+ const fd = openSync(path, 'a')
11
+ return (record) => {
12
+ const formatted = `${new Date(record.timestamp).toISOString()} [${record.level}] ${record.category.join('·')}: ${
13
+ record.message.join('')
14
+ }\n`
15
+ writeSync(fd, formatted)
16
+ }
17
+ }
6
18
 
7
19
  export { getLogger }
8
20
 
@@ -53,7 +65,7 @@ export async function initLogger(options: {
53
65
  sinks['noop'] = noopSink as ReturnType<typeof getConsoleSink>
54
66
 
55
67
  if (options.logFile) {
56
- sinks['file'] = getFileSink(options.logFile)
68
+ sinks['file'] = createFileSink(options.logFile)
57
69
  }
58
70
 
59
71
  await configure({
@@ -1,5 +1,5 @@
1
1
  /**
2
- * suemo OpenCode plugin (v0.1.10)
2
+ * suemo OpenCode plugin (v0.1.12)
3
3
  *
4
4
  * Purpose:
5
5
  * - Inject strict, always-on suemo memory workflow instructions.
@@ -12,7 +12,7 @@
12
12
  import type { Plugin } from '@opencode-ai/plugin'
13
13
 
14
14
  const SERVICE = 'suemo-plugin'
15
- const PLUGIN_VERSION = '0.1.10'
15
+ const PLUGIN_VERSION = '0.1.12'
16
16
  const PROTOCOL_MARKER = 'Suemo Persistent Memory — Protocol'
17
17
 
18
18
  interface SystemTransformOutput {
@@ -38,7 +38,7 @@ interface PluginLogExtra {
38
38
  [key: string]: unknown
39
39
  }
40
40
 
41
- const MEMORY_INSTRUCTIONS = `## Suemo Persistent Memory — Protocol (v0.1.10)
41
+ const MEMORY_INSTRUCTIONS = `## Suemo Persistent Memory — Protocol (v0.1.12)
42
42
 
43
43
  You have access to suemo persistent memory tools (commonly prefixed as \`suemo_*\`).
44
44
 
package/src/sync.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { SurrealTarget } from '@/src/config.ts'
2
2
  import { getLogger } from '@/src/logger.ts'
3
3
  import type { SyncResult } from '@/src/types.ts'
4
- import { createNodeEngines } from '@mdrv/surreal-node'
4
+ import { createNodeEngines } from '@mdrv/surrealdb-node'
5
5
  import { createHash } from 'node:crypto'
6
6
  import { createRemoteEngines, Surreal } from 'surrealdb'
7
7