dsh-context-domains 0.3.1 → 0.3.2

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/lib/http.js CHANGED
@@ -3,6 +3,7 @@
3
3
  import { randomUUID } from 'node:crypto'
4
4
  import { domainCounts, requestedMembers, selectionFor, unassigned } from './resolve.js'
5
5
  import { estimateTokens } from './config.js'
6
+ import { VERSION } from './version.js'
6
7
  import { readCatalogAll, readSkills, readTools, suggestDomains } from './catalog.js'
7
8
 
8
9
  const PREFIX = '/context-domains/api'
@@ -180,7 +181,7 @@ export function registerHttp(ctx, deps) {
180
181
  async 'GET /health'(_req, res) {
181
182
  ok(res, {
182
183
  plugin: 'context-domains',
183
- version: '0.1.0',
184
+ version: VERSION,
184
185
  stateFile: store.file,
185
186
  config,
186
187
  domains: store.document().domains.length,
package/lib/version.js ADDED
@@ -0,0 +1,16 @@
1
+ // 插件自报版本:只从 package.json 读,绝不手写常量。
2
+ // 之前 /health 里写死 '0.1.0',发到 0.3.x 之后它仍报 0.1.0,排障时先被骗一次。
3
+ import { readFileSync } from 'node:fs'
4
+ import { fileURLToPath } from 'node:url'
5
+
6
+ function readVersion() {
7
+ try {
8
+ const file = fileURLToPath(new URL('../package.json', import.meta.url))
9
+ const parsed = JSON.parse(readFileSync(file, 'utf8'))
10
+ return typeof parsed.version === 'string' ? parsed.version : '0.0.0'
11
+ } catch {
12
+ return '0.0.0'
13
+ }
14
+ }
15
+
16
+ export const VERSION = readVersion()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-context-domains",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "DSH 上下文领域:把一个领域里的 skill 与 tool 归成一块,在会话顶部一键整块开关,设置页里维护领域成员",
5
5
  "type": "module",
6
6
  "main": "index.js",