@fish-under-sea/dsh-visual-companion 0.1.6 → 0.1.7
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/bin/visual-companion.mjs +1 -1
- package/lib/index.js +16 -2
- package/package.json +1 -1
package/bin/visual-companion.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* DSH 视觉伴侣(visual companion)—— 单文件、零依赖、Node
|
|
3
|
+
* DSH 视觉伴侣(visual companion)—— 单文件、零依赖、Node `^22.19.0 || >=24.0.0`(与 package.json 的 engines 一致)
|
|
4
4
|
*
|
|
5
5
|
* 用途:头脑风暴时把原型 / 线框 / 并排对比渲染到浏览器(DSH 里用 sidebar_open 开在右侧栏),
|
|
6
6
|
* 用户在页面上点选 A/B/C,点击事件落到 events.jsonl,模型下一轮读它。
|
package/lib/index.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* @module @fish-under-sea/dsh-visual-companion
|
|
22
22
|
*/
|
|
23
23
|
import { spawn } from 'node:child_process'
|
|
24
|
-
import { mkdirSync, watch } from 'node:fs'
|
|
24
|
+
import { mkdirSync, readFileSync, watch } from 'node:fs'
|
|
25
25
|
import { mkdir, readFile } from 'node:fs/promises'
|
|
26
26
|
import { basename, join } from 'node:path'
|
|
27
27
|
import { fileURLToPath } from 'node:url'
|
|
@@ -30,6 +30,20 @@ import { createUserMessage } from '@deepseek-ai/dsh-llm'
|
|
|
30
30
|
import { defineTool } from '@deepseek-ai/dsh-tools'
|
|
31
31
|
import z from '@deepseek-ai/schemastery'
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* 包版本:**从 package.json 现读**,不在代码里写死。
|
|
35
|
+
*
|
|
36
|
+
* 曾经这里写死 `v0.1.2`,之后连升三个版本它一次都没跟上 —— 用户拿加载日志去对版本时
|
|
37
|
+
* 会被指向错误的版本号。读不到就退化成 `unknown`(只是日志,不该因为读文件失败而影响加载)。
|
|
38
|
+
*/
|
|
39
|
+
const VERSION = (() => {
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version ?? 'unknown'
|
|
42
|
+
} catch {
|
|
43
|
+
return 'unknown'
|
|
44
|
+
}
|
|
45
|
+
})()
|
|
46
|
+
|
|
33
47
|
import { companionMessage } from './message.js'
|
|
34
48
|
|
|
35
49
|
export { companionMessage }
|
|
@@ -332,5 +346,5 @@ export function apply(ctx, config) {
|
|
|
332
346
|
const watchDir = clean(config?.watchDir)
|
|
333
347
|
// 目标会话不在这里钉死:由 pending.json 自带(伴侣服务用 --session 写入)。
|
|
334
348
|
if (watchDir !== '') arm(ctx, watchDir, null)
|
|
335
|
-
ctx.logger?.info?.(`visual-companion: 已加载(
|
|
349
|
+
ctx.logger?.info?.(`visual-companion: 已加载(v${VERSION})${watchDir === '' ? ',未自动绑定' : `,自动绑定 ${watchDir}`}`)
|
|
336
350
|
}
|