dsh-mesh-node 0.0.6 → 0.0.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/package.json +1 -1
- package/src/core/config.js +30 -0
package/package.json
CHANGED
package/src/core/config.js
CHANGED
|
@@ -84,6 +84,18 @@ export const DEFAULT_ALLOW = [
|
|
|
84
84
|
'delegate_gc'
|
|
85
85
|
]
|
|
86
86
|
|
|
87
|
+
/** 文件/检索工具(v7.1 加入默认 ACL;老默认列表会自动升级,自定义列表保持不动) */
|
|
88
|
+
export const FILE_TRANSFER_TOOLS = [
|
|
89
|
+
'file_read_chunk',
|
|
90
|
+
'file_write_chunk',
|
|
91
|
+
'file_hash',
|
|
92
|
+
'transfer_usage',
|
|
93
|
+
'find_files',
|
|
94
|
+
'search_text',
|
|
95
|
+
'tool_inventory'
|
|
96
|
+
]
|
|
97
|
+
const PREVIOUS_DEFAULT_ALLOW = DEFAULT_ALLOW.filter((name) => !FILE_TRANSFER_TOOLS.includes(name))
|
|
98
|
+
|
|
87
99
|
/**
|
|
88
100
|
* Host bridge instances this node knows about. `dsh0`/`dsh1` mirror the
|
|
89
101
|
* two-DSH-per-machine convention (profile `~/.dsh0` / `~/.dsh1` on ports
|
|
@@ -385,6 +397,24 @@ function migrateConfig(raw) {
|
|
|
385
397
|
raw.version = 7
|
|
386
398
|
notes.push('config version 6 -> 7 (repair tooling)')
|
|
387
399
|
}
|
|
400
|
+
// v7.1: 文件/检索工具加入默认 ACL。老默认列表自动补齐;即便 ACL 被小幅自定义过,
|
|
401
|
+
// 只要仍是正常节点 ACL(含 mesh_self + fs_read),也补上这 7 个工具——否则跨机传文件/
|
|
402
|
+
// 检索会一直 E_DENIED,用户又得手工改 ACL(2026-11-09 教训)。
|
|
403
|
+
const allowNow = Array.isArray(raw?.acl?.allow) ? raw.acl.allow : []
|
|
404
|
+
if (allowNow.includes('mesh_self') && allowNow.includes('fs_read')) {
|
|
405
|
+
const next = new Set(allowNow)
|
|
406
|
+
let added = 0
|
|
407
|
+
for (const name of FILE_TRANSFER_TOOLS) {
|
|
408
|
+
if (!next.has(name)) {
|
|
409
|
+
next.add(name)
|
|
410
|
+
added += 1
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (added > 0) {
|
|
414
|
+
raw.acl = { ...(raw.acl || {}), allow: [...next] }
|
|
415
|
+
notes.push(`acl.allow: + ${added} file/search tool(s) (default allow-list upgrade)`)
|
|
416
|
+
}
|
|
417
|
+
}
|
|
388
418
|
return notes
|
|
389
419
|
}
|
|
390
420
|
|