@capyclaw/ppt-suite 2.5.67 → 2.5.69
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/composition.lock.json +3 -3
- package/contract/ppt-contract.json +1 -1
- package/dsh-suite.json +4 -4
- package/node_modules/@capyclaw/asset-service/src/index.mjs +92 -6
- package/node_modules/@capyclaw/document-workbench/src/session/context.mjs +17 -5
- package/node_modules/@capyclaw/editor-host/src/index.mjs +7 -2
- package/node_modules/@capyclaw/foundation/abi/loader.mjs +8 -1
- package/node_modules/@capyclaw/foundation/abi/spec.mjs +5 -2
- package/node_modules/@capyclaw/foundation/abi/version.mjs +63 -5
- package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +11 -10
- package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +8 -1
- package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +31 -3
- package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +12 -2
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +0 -81
- package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +13 -6
- package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +31 -15
- package/node_modules/@capyclaw/ppt-editor/contract/ppt-contract.json +1 -1
- package/node_modules/@capyclaw/ppt-skill-api/contract/ppt-contract.json +1 -1
- package/node_modules/@capyclaw/ppt-skill-api/skills/pptist-api/references/tool-contract.md +1 -1
- package/node_modules/@capyclaw/ppt-skill-proposal/contract/ppt-contract.json +1 -1
- package/node_modules/@capyclaw/ppt-workbench/contract/ppt-contract.json +1 -1
- package/node_modules/@capyclaw/ppt-workbench/package.json +1 -1
- package/node_modules/@capyclaw/ppt-workbench/server/contract.mjs +1 -1
- package/node_modules/@capyclaw/ppt-workbench/server/relay.mjs +18 -18
- package/node_modules/@capyclaw/ppt-workbench/server/routes/session.mjs +8 -1
- package/node_modules/@capyclaw/ppt-workbench/server/store/sessions.mjs +15 -4
- package/node_modules/@capyclaw/service-broker/lib/manifest.mjs +15 -2
- package/node_modules/@capyclaw/service-broker/lib/recovery.mjs +0 -50
- package/node_modules/@capyclaw/service-host/src/index.mjs +9 -1
- package/node_modules/@capyclaw/tool-host/src/descriptors.mjs +28 -4
- package/node_modules/@capyclaw/tool-host/src/index.mjs +32 -6
- package/package.json +4 -4
- package/node_modules/playwright-core/LICENSE +0 -202
- package/node_modules/playwright-core/NOTICE +0 -5
- package/node_modules/playwright-core/README.md +0 -3
- package/node_modules/playwright-core/ThirdPartyNotices.txt +0 -13
- package/node_modules/playwright-core/bin/install_media_pack.ps1 +0 -5
- package/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +0 -33
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +0 -42
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +0 -13
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +0 -24
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +0 -42
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +0 -12
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +0 -24
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +0 -48
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +0 -11
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +0 -23
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +0 -48
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +0 -11
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +0 -23
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +0 -48
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +0 -11
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +0 -24
- package/node_modules/playwright-core/browsers.json +0 -52
- package/node_modules/playwright-core/cli.js +0 -22
- package/node_modules/playwright-core/index.d.ts +0 -17
- package/node_modules/playwright-core/index.js +0 -17
- package/node_modules/playwright-core/index.mjs +0 -28
- package/node_modules/playwright-core/lib/bootstrap.js +0 -149
- package/node_modules/playwright-core/lib/coreBundle.js +0 -78041
- package/node_modules/playwright-core/lib/entry/cliDaemon.js +0 -5
- package/node_modules/playwright-core/lib/entry/dashboardApp.js +0 -3
- package/node_modules/playwright-core/lib/entry/mcp.js +0 -10
- package/node_modules/playwright-core/lib/entry/oopBrowserDownload.js +0 -3
- package/node_modules/playwright-core/lib/package.js +0 -50
- package/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/server/electron/loader.js +0 -123
- package/node_modules/playwright-core/lib/serverRegistry.js +0 -1939
- package/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +0 -65
- package/node_modules/playwright-core/lib/tools/cli-client/channelSessions.js +0 -141
- package/node_modules/playwright-core/lib/tools/cli-client/cli.js +0 -7
- package/node_modules/playwright-core/lib/tools/cli-client/help.json +0 -808
- package/node_modules/playwright-core/lib/tools/cli-client/minimist.js +0 -128
- package/node_modules/playwright-core/lib/tools/cli-client/output.js +0 -352
- package/node_modules/playwright-core/lib/tools/cli-client/program.js +0 -422
- package/node_modules/playwright-core/lib/tools/cli-client/registry.js +0 -180
- package/node_modules/playwright-core/lib/tools/cli-client/session.js +0 -261
- package/node_modules/playwright-core/lib/tools/dashboard/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/SKILL.md +0 -493
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/element-attributes.md +0 -23
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/playwright-tests.md +0 -39
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/pr-attachments.md +0 -60
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/request-mocking.md +0 -87
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/running-code.md +0 -245
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/session-management.md +0 -227
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/storage-state.md +0 -275
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/test-generation.md +0 -433
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/tracing.md +0 -139
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/video-recording.md +0 -216
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +0 -136
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +0 -144
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +0 -89
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +0 -69
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/typing.md +0 -173
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +0 -77
- package/node_modules/playwright-core/lib/tools/skills/playwright-trace/SKILL.md +0 -174
- package/node_modules/playwright-core/lib/tools/utils/extension.js +0 -112
- package/node_modules/playwright-core/lib/tools/utils/socketConnection.js +0 -108
- package/node_modules/playwright-core/lib/utilsBundle.js +0 -86078
- package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +0 -1890
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +0 -1
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +0 -32
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +0 -1
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +0 -1
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +0 -1
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-AwgwcYie.css +0 -1
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-hRvO4yU2.js +0 -12
- package/node_modules/playwright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +0 -1
- package/node_modules/playwright-core/lib/vite/dashboard/index.html +0 -29
- package/node_modules/playwright-core/lib/vite/dashboard/playwright-logo.svg +0 -24
- package/node_modules/playwright-core/lib/vite/htmlReport/index.html +0 -16
- package/node_modules/playwright-core/lib/vite/htmlReport/report.css +0 -2
- package/node_modules/playwright-core/lib/vite/htmlReport/report.js +0 -32
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +0 -1
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +0 -32
- package/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-BZpYJZ-P.css +0 -1
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-Cn0mmDuv.js +0 -129
- package/node_modules/playwright-core/lib/vite/recorder/index.html +0 -29
- package/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +0 -9
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +0 -32
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +0 -184
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +0 -7
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/index.html +0 -44
- package/node_modules/playwright-core/lib/vite/traceViewer/index.oNry3Hjv.js +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +0 -16
- package/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +0 -9
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +0 -10
- package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +0 -4
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CYwC_gH1.js +0 -5
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +0 -18
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +0 -1
- package/node_modules/playwright-core/lib/webp_codec.LICENSE +0 -173
- package/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
- package/node_modules/playwright-core/lib/xdg-open +0 -1267
- package/node_modules/playwright-core/package.json +0 -34
- package/node_modules/playwright-core/types/protocol.d.ts +0 -24776
- package/node_modules/playwright-core/types/structs.d.ts +0 -52
- package/node_modules/playwright-core/types/types.d.ts +0 -27167
|
@@ -22,12 +22,19 @@ function reply(id, result) {
|
|
|
22
22
|
|
|
23
23
|
export function createMcpHandler({
|
|
24
24
|
tools = [], callTool, serverInfo, instructions,
|
|
25
|
-
maxBodyBytes = 10 * 1024 * 1024, maxBatch = 100,
|
|
25
|
+
maxBodyBytes = 10 * 1024 * 1024, maxBatch = 100, listChanged = false,
|
|
26
26
|
} = {}) {
|
|
27
|
-
|
|
27
|
+
/* tools 可以是静态数组,或一个返回当前数组的函数(活引用)。活引用让
|
|
28
|
+
* tools/list 每次读到最新工具集——registry 动态增删工具后无需重建 handler。 */
|
|
29
|
+
const liveProvider = typeof tools === 'function' ? tools : null
|
|
30
|
+
if (!liveProvider && !Array.isArray(tools)) throw new Error('createMcpHandler: tools 必须是数组或返回数组的函数')
|
|
28
31
|
if (typeof callTool !== 'function') throw new Error('createMcpHandler: callTool 必须是函数')
|
|
29
32
|
|
|
30
|
-
const
|
|
33
|
+
const currentTools = () => {
|
|
34
|
+
const list = liveProvider ? liveProvider() : tools
|
|
35
|
+
return Array.isArray(list) ? list : []
|
|
36
|
+
}
|
|
37
|
+
const toolMapNow = () => new Map(currentTools().map((tool) => [tool.name, tool]))
|
|
31
38
|
|
|
32
39
|
return async function handle(req, res) {
|
|
33
40
|
/* 长工具调用(如截图)期间客户端可能超时断连;socket 的 'error' 事件
|
|
@@ -89,7 +96,7 @@ export function createMcpHandler({
|
|
|
89
96
|
if (method === 'initialize') {
|
|
90
97
|
const result = {
|
|
91
98
|
protocolVersion: String(params?.protocolVersion || DEFAULT_PROTOCOL),
|
|
92
|
-
capabilities: { tools: { listChanged:
|
|
99
|
+
capabilities: { tools: { listChanged: !!listChanged } },
|
|
93
100
|
serverInfo: serverInfo || { name: 'dsh-plugin', version: '0.0.0' },
|
|
94
101
|
}
|
|
95
102
|
if (typeof instructions === 'string' && instructions) result.instructions = instructions
|
|
@@ -101,13 +108,13 @@ export function createMcpHandler({
|
|
|
101
108
|
if (method === 'ping') return isNotification ? null : reply(id, {})
|
|
102
109
|
|
|
103
110
|
if (method === 'tools/list') {
|
|
104
|
-
return isNotification ? null : reply(id, { tools })
|
|
111
|
+
return isNotification ? null : reply(id, { tools: currentTools() })
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
if (method === 'tools/call') {
|
|
108
115
|
const name = params?.name
|
|
109
116
|
const args = params?.arguments && typeof params.arguments === 'object' ? params.arguments : {}
|
|
110
|
-
const tool =
|
|
117
|
+
const tool = toolMapNow().get(name)
|
|
111
118
|
if (!tool) {
|
|
112
119
|
if (isNotification) return null
|
|
113
120
|
return reply(id, {
|
|
@@ -14,24 +14,40 @@
|
|
|
14
14
|
* 返回恒为 {content:[...]}(object),因此 DSH 原生面 output.schema 用 object 恒满足。
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
export
|
|
17
|
+
/** 单个 text 块的默认上限:防 base64/大输出撑爆 LLM 上下文。image 块不受影响。 */
|
|
18
|
+
export const DEFAULT_MAX_TEXT_BYTES = 256 * 1024
|
|
19
|
+
|
|
20
|
+
function capText(text, max) {
|
|
21
|
+
if (!max || max <= 0 || typeof text !== 'string' || text.length <= max) return text
|
|
22
|
+
return `${text.slice(0, max)}\n…[truncated: original ${text.length} chars, limit ${max}]`
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function capContent(content, max) {
|
|
26
|
+
return content.map((block) => (
|
|
27
|
+
block && block.type === 'text' && typeof block.text === 'string'
|
|
28
|
+
? { ...block, text: capText(block.text, max) }
|
|
29
|
+
: block
|
|
30
|
+
))
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 把任意工具返回值归一为 MCP content 形态(并对超限 text 块截断+提示)。 */
|
|
34
|
+
export function normalizeToolResult(out, { maxTextBytes = DEFAULT_MAX_TEXT_BYTES } = {}) {
|
|
19
35
|
const isError = out && typeof out.isError === 'boolean' ? { isError: out.isError } : {}
|
|
36
|
+
let content
|
|
20
37
|
if (out && Array.isArray(out.content)) {
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
content = out.content
|
|
39
|
+
} else if (out && typeof out.text === 'string') {
|
|
40
|
+
content = [{ type: 'text', text: out.text }]
|
|
41
|
+
} else if (typeof out === 'string') {
|
|
42
|
+
content = [{ type: 'text', text: out }]
|
|
43
|
+
} else if (out === undefined || out === null) {
|
|
44
|
+
content = [{ type: 'text', text: '' }]
|
|
45
|
+
} else {
|
|
46
|
+
let text
|
|
47
|
+
try { text = JSON.stringify(out) } catch { text = String(out) }
|
|
48
|
+
content = [{ type: 'text', text: text ?? String(out) }]
|
|
31
49
|
}
|
|
32
|
-
|
|
33
|
-
try { text = JSON.stringify(out) } catch { text = String(out) }
|
|
34
|
-
return { content: [{ type: 'text', text: text ?? String(out) }] }
|
|
50
|
+
return { content: capContent(content, maxTextBytes), ...isError }
|
|
35
51
|
}
|
|
36
52
|
|
|
37
53
|
/** 从归一化结果提取纯文本(用于把失败内容拼成 Error.message)。 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# PPTist Workbench 工具契约
|
|
2
2
|
|
|
3
3
|
- contractVersion: `2.5.0`
|
|
4
|
-
- packageVersion: `2.5.
|
|
4
|
+
- packageVersion: `2.5.69`
|
|
5
5
|
- toolCount: 32
|
|
6
6
|
- features: `deck.manuscript`, `deck.contract`, `deck.read`, `deck.audit`, `deck.inspect`, `deck.task`, `deck.write`, `deck.compose`, `deck.recolor`, `deck.image`, `media.search`, `deck.screenshot`, `deck.present`, `deck.undo`, `deck.chart`, `deck.table`, `deck.notes`, `deck.shape`, `deck.line`, `deck.formula`, `deck.import`, `deck.export`
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capyclaw/ppt-workbench",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.69",
|
|
4
4
|
"description": "PPT 工作台运行时(headless 可用):32 个 ppt_* MCP 工具(导入/导出 PPTX + 图表/表格/公式/形状/线条/备注 + 契约探测);浏览器实时编辑器由可选成员包 @capyclaw/ppt-editor 提供。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./plugin.mjs",
|
|
@@ -10,7 +10,7 @@ import { createCapabilityReport } from './shared/tool-host.mjs'
|
|
|
10
10
|
export const CONTRACT_VERSION = '2.5.0'
|
|
11
11
|
|
|
12
12
|
/** 工作台包版本。 */
|
|
13
|
-
export const PACKAGE_VERSION = '2.5.
|
|
13
|
+
export const PACKAGE_VERSION = '2.5.69'
|
|
14
14
|
|
|
15
15
|
/** 生成模型可读的能力报告(`editorPath` 由 tool-host 从 editorUrl 推出:同源相对路径,不带端口)。 */
|
|
16
16
|
export function capabilityReport(args, editorUrl = '', runtime = {}) {
|
|
@@ -46,17 +46,15 @@ export { BASE_PATH }
|
|
|
46
46
|
/* 租约存活判定统一走共享 session/lease(OWNER_TTL 单一真源),不再本地硬编码秒数。 */
|
|
47
47
|
const liveOwner = (doc) => isOwnerLive(doc)
|
|
48
48
|
|
|
49
|
-
/*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
* 无头显示器渲染真像素;真实窗口到来即让位。fail-safe:解析不到 Chromium 自动禁用,
|
|
54
|
-
* 工具退回离线渲染(与改造前一致),绝不影响桥启动。语义在 plugin-kit/editor/shadow。 */
|
|
55
|
-
let shadowManager = null
|
|
56
|
-
let shadowTimer = null
|
|
49
|
+
/* 每实例状态一律挂 ctx,不用模块级变量——同进程多个 relay 实例(embedded+standalone、
|
|
50
|
+
* HMR 重载)共享模块级变量会互相覆盖 store/影子管理器。SessionStores 经门面 __stores
|
|
51
|
+
* 取回(ctx.store.__stores),影子管理器/定时器挂 ctx.shadowManager/ctx.shadowTimer。 */
|
|
52
|
+
const storesOf = (ctx) => ctx.store.__stores
|
|
57
53
|
|
|
58
54
|
function reconcileShadow(ctx) {
|
|
59
55
|
try {
|
|
56
|
+
const sessionStores = storesOf(ctx)
|
|
57
|
+
const shadowManager = ctx.shadowManager
|
|
60
58
|
if (!shadowManager || !sessionStores || !ctx.editorAssets) return
|
|
61
59
|
const keys = new Set([DEFAULT_SESSION, sessionStores.activeSession(), ...sessionStores.sessions()])
|
|
62
60
|
for (const sid of keys) {
|
|
@@ -95,8 +93,8 @@ export const startRelay = createWorkbench({
|
|
|
95
93
|
/* 每会话一份 deck:这里返回的是「门面」,真正的 store 在请求发生时才按会话
|
|
96
94
|
* 解析(见 store/sessions.mjs)。workspace 后端把文档键在 work 上,仍是单文档。 */
|
|
97
95
|
createStore: ({ hostDir, backend }) => {
|
|
98
|
-
|
|
99
|
-
return createSessionStoreFacade(
|
|
96
|
+
const stores = new SessionStores({ hostDir, backend })
|
|
97
|
+
return createSessionStoreFacade(stores)
|
|
100
98
|
},
|
|
101
99
|
|
|
102
100
|
createAssetStore: ({ hostDir }) => createFileAssetStore({ dir: path.join(hostDir, 'assets') }),
|
|
@@ -105,6 +103,7 @@ export const startRelay = createWorkbench({
|
|
|
105
103
|
* 塞进 SessionStores,deck 即落 SQLite 作品库;没有则保持文件后端(行为不变)。
|
|
106
104
|
* prepare 在 createStore 之后、首个请求之前运行,此时底座服务通常已就绪。 */
|
|
107
105
|
prepare: (ctx) => {
|
|
106
|
+
const sessionStores = storesOf(ctx)
|
|
108
107
|
if (sessionStores && typeof ctx.getWorkStore === 'function') sessionStores.setWorkStore(ctx.getWorkStore)
|
|
109
108
|
/* base64 闸:deck 落盘前把内联 data:image 抽进资产仓,只留 /assets/<sha> 引用。
|
|
110
109
|
* urlBase 与稿件 publicBase 同形(带挂载前缀),保证编辑器 <img> 能直接加载。 */
|
|
@@ -118,6 +117,7 @@ export const startRelay = createWorkbench({
|
|
|
118
117
|
},
|
|
119
118
|
|
|
120
119
|
routes: (ctx) => {
|
|
120
|
+
const sessionStores = storesOf(ctx)
|
|
121
121
|
const jsonP = createJsonPptApp(ctx.store)
|
|
122
122
|
ctx.jsonP = jsonP
|
|
123
123
|
/* F:会话模式锁的底座解析器(works.db 单一真源)。底座缺席 → 守卫跳过。 */
|
|
@@ -232,21 +232,21 @@ export const startRelay = createWorkbench({
|
|
|
232
232
|
* 解析不到 playwright-core / Chromium 时自动禁用,工具退回离线渲染。 */
|
|
233
233
|
const tuning = getTuning()
|
|
234
234
|
if (ctx.editorAssets && tuning.shadowDisplay !== false) {
|
|
235
|
-
shadowManager = createShadowManager({
|
|
235
|
+
ctx.shadowManager = createShadowManager({
|
|
236
236
|
log: (message) => console.log(message),
|
|
237
237
|
maxConcurrent: Number(tuning.shadowMaxConcurrent) || 4,
|
|
238
238
|
})
|
|
239
|
-
shadowTimer = setInterval(() => reconcileShadow(ctx), Number(tuning.shadowReconcileMs) || 5000)
|
|
240
|
-
shadowTimer.unref?.()
|
|
239
|
+
ctx.shadowTimer = setInterval(() => reconcileShadow(ctx), Number(tuning.shadowReconcileMs) || 5000)
|
|
240
|
+
ctx.shadowTimer.unref?.()
|
|
241
241
|
}
|
|
242
242
|
},
|
|
243
243
|
|
|
244
244
|
/* 停机回收:清对账定时器、关停所有影子 browser(不留孤儿进程)。 */
|
|
245
|
-
beforeStop: async () => {
|
|
246
|
-
if (shadowTimer) { clearInterval(shadowTimer); shadowTimer = null }
|
|
247
|
-
if (shadowManager) {
|
|
248
|
-
try { await shadowManager.dispose() } catch { /* ignore */ }
|
|
249
|
-
shadowManager = null
|
|
245
|
+
beforeStop: async (ctx) => {
|
|
246
|
+
if (ctx.shadowTimer) { clearInterval(ctx.shadowTimer); ctx.shadowTimer = null }
|
|
247
|
+
if (ctx.shadowManager) {
|
|
248
|
+
try { await ctx.shadowManager.dispose() } catch { /* ignore */ }
|
|
249
|
+
ctx.shadowManager = null
|
|
250
250
|
}
|
|
251
251
|
},
|
|
252
252
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* 「用户正在看的那个会话」。
|
|
7
7
|
*/
|
|
8
8
|
import { send, readBody } from '../http-utils.mjs'
|
|
9
|
+
import { normalizeSessionId } from '../store/sessions.mjs'
|
|
9
10
|
|
|
10
11
|
export function createSessionRoutes({ stores, basePath }) {
|
|
11
12
|
return [
|
|
@@ -21,7 +22,13 @@ export function createSessionRoutes({ stores, basePath }) {
|
|
|
21
22
|
} catch {
|
|
22
23
|
body = {}
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
/* 校验会话 id:空/非法直接 400,不再静默回落旧 active 假装激活成功。 */
|
|
26
|
+
const candidate = body.sessionId || body.session || req.sessionId || ''
|
|
27
|
+
if (!normalizeSessionId(candidate)) {
|
|
28
|
+
send(req, res, 400, { ok: false, error: 'sessionId 必填且需为合法会话 id' })
|
|
29
|
+
return true
|
|
30
|
+
}
|
|
31
|
+
const sid = stores.setActive(candidate)
|
|
25
32
|
send(req, res, 200, { ok: true, sessionId: sid, sessions: stores.sessions() })
|
|
26
33
|
return true
|
|
27
34
|
},
|
|
@@ -32,7 +32,7 @@ import fs from 'node:fs'
|
|
|
32
32
|
import os from 'node:os'
|
|
33
33
|
import path from 'node:path'
|
|
34
34
|
import { BridgeStore } from './index.mjs'
|
|
35
|
-
import { currentSession } from '../session-context.mjs'
|
|
35
|
+
import { currentSession, sessionContext } from '../session-context.mjs'
|
|
36
36
|
|
|
37
37
|
export const DEFAULT_SESSION = 'default'
|
|
38
38
|
export const DECK_FILE = 'deck.json'
|
|
@@ -280,6 +280,17 @@ function writeMarker(file, key) {
|
|
|
280
280
|
*/
|
|
281
281
|
export function createSessionStoreFacade(stores) {
|
|
282
282
|
const target = { __stores: stores }
|
|
283
|
+
/* 请求内钉住:首次访问解析一次当前会话的 store 并挂到会话上下文,整个请求复用。
|
|
284
|
+
* 否则每次属性访问都重解析 current(),一旦请求中途 active 被别的窗口 /activate
|
|
285
|
+
* 翻转(且 ALS 会话为空,如 MCP 工具),同一请求的后续写入会改向到另一个会话。 */
|
|
286
|
+
const resolveStore = () => {
|
|
287
|
+
const ctx = sessionContext()
|
|
288
|
+
if (ctx) {
|
|
289
|
+
if (!ctx.pinned) ctx.pinned = stores.current()
|
|
290
|
+
return ctx.pinned
|
|
291
|
+
}
|
|
292
|
+
return stores.current()
|
|
293
|
+
}
|
|
283
294
|
return new Proxy(target, {
|
|
284
295
|
get(t, prop, receiver) {
|
|
285
296
|
if (prop === '__stores') return stores
|
|
@@ -287,17 +298,17 @@ export function createSessionStoreFacade(stores) {
|
|
|
287
298
|
if (typeof prop === 'symbol' || prop === 'then' || prop === 'toJSON') {
|
|
288
299
|
return Reflect.get(t, prop, receiver)
|
|
289
300
|
}
|
|
290
|
-
const store =
|
|
301
|
+
const store = resolveStore()
|
|
291
302
|
const value = store[prop]
|
|
292
303
|
return typeof value === 'function' ? value.bind(store) : value
|
|
293
304
|
},
|
|
294
305
|
set(t, prop, value) {
|
|
295
306
|
if (prop === '__stores') return true
|
|
296
|
-
|
|
307
|
+
resolveStore()[prop] = value
|
|
297
308
|
return true
|
|
298
309
|
},
|
|
299
310
|
has(t, prop) {
|
|
300
|
-
return prop === '__stores' || prop in
|
|
311
|
+
return prop === '__stores' || prop in resolveStore()
|
|
301
312
|
},
|
|
302
313
|
})
|
|
303
314
|
}
|
|
@@ -39,12 +39,18 @@ export function findSuiteRoot(startDir = path.dirname(PKG_DIR)) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/** 读 JSON 并剥 UTF-8 BOM:带 BOM 的清单会让 JSON.parse 抛「Unexpected token」,
|
|
43
|
+
* 表现为 boot 永久失败且极难归因(文件看着完全正常)。统一在此剥掉。 */
|
|
44
|
+
function parseJsonFile(file) {
|
|
45
|
+
return JSON.parse(readFileSync(file, 'utf8').replace(/^\uFEFF/, ''))
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
/** 套件根判据:含 dsh-suite.json + services.json,且不是 broker 自带的 dsh-suite.json。 */
|
|
43
49
|
function isSuiteRoot(dir) {
|
|
44
50
|
const suiteFile = path.join(dir, 'dsh-suite.json')
|
|
45
51
|
if (!existsSync(suiteFile) || !existsSync(path.join(dir, 'services.json'))) return false
|
|
46
52
|
try {
|
|
47
|
-
const manifest =
|
|
53
|
+
const manifest = parseJsonFile(suiteFile)
|
|
48
54
|
return Boolean(manifest) && typeof manifest === 'object' && manifest.name !== 'dsh-service-broker-suite'
|
|
49
55
|
} catch {
|
|
50
56
|
return false
|
|
@@ -201,7 +207,7 @@ export function loadManifest(manifestPath) {
|
|
|
201
207
|
|
|
202
208
|
function loadFile(file) {
|
|
203
209
|
if (!existsSync(file)) return []
|
|
204
|
-
const raw =
|
|
210
|
+
const raw = parseJsonFile(file)
|
|
205
211
|
const services = Array.isArray(raw) ? raw : raw.services
|
|
206
212
|
if (!Array.isArray(services)) throw new Error(`manifest 格式非法(缺 services 数组): ${file}`)
|
|
207
213
|
const specErrors = validateServiceManifest(services, file)
|
|
@@ -245,5 +251,12 @@ function expandPackageDir(service, base) {
|
|
|
245
251
|
for (const key of ['url', 'cwd', 'logFile']) {
|
|
246
252
|
if (typeof out[key] === 'string') out[key] = String(out[key]).replaceAll('${PACKAGE_DIR}', base)
|
|
247
253
|
}
|
|
254
|
+
/* env 值同样展开 ${PACKAGE_DIR}:旧实现只展开 url/cwd/logFile,env 里引用
|
|
255
|
+
* ${PACKAGE_DIR} 的变量(如自定义数据目录/脚本路径)原样传给子进程 → 路径错。 */
|
|
256
|
+
for (const [key, value] of Object.entries(out.env)) {
|
|
257
|
+
if (typeof value === 'string' && value.includes('${PACKAGE_DIR}')) {
|
|
258
|
+
out.env[key] = value.replaceAll('${PACKAGE_DIR}', base)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
248
261
|
return out
|
|
249
262
|
}
|
|
@@ -273,53 +273,3 @@ export async function waitReceiptResolvable(receipt, ports, timeoutMs = 3000) {
|
|
|
273
273
|
await new Promise((resolve) => setTimeout(resolve, 200))
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
|
|
277
|
-
// Caller must serialize against starting a replacement broker and supply the
|
|
278
|
-
// identity captured when it spawned this broker. An absent PID alone is not a receipt.
|
|
279
|
-
export async function recoverServices(discovery, broker) {
|
|
280
|
-
const unresolved = [], stopped = []
|
|
281
|
-
if (!broker?.pid || !broker?.marker || !broker?.recoveryMarker || !absent(broker.pid)) return { stopped, unresolved: ['broker:not-confirmed-absent'] }
|
|
282
|
-
let discovered = {}
|
|
283
|
-
try { discovered = JSON.parse(fs.readFileSync(discovery, 'utf8'))?.services || {} } catch { /* discovery 缺失时只能依赖收据自身 */ }
|
|
284
|
-
let entries
|
|
285
|
-
try { entries = fs.readdirSync(receiptDir(discovery)) } catch (e) {
|
|
286
|
-
return { stopped, unresolved: [e.code === 'ENOENT' ? 'ownership:missing' : 'ownership:unreadable'] }
|
|
287
|
-
}
|
|
288
|
-
for (const name of entries) {
|
|
289
|
-
if (!name.endsWith('.json')) { unresolved.push(`ownership:${name}:unrecognized`); continue }
|
|
290
|
-
let r
|
|
291
|
-
try { r = JSON.parse(fs.readFileSync(path.join(receiptDir(discovery), name), 'utf8')) } catch { unresolved.push(`ownership:${name}:unreadable`); continue }
|
|
292
|
-
if (!r || `${r.id}.json` !== name || !/^[a-z0-9][a-z0-9._-]*$/i.test(r.id) || r.brokerPid !== broker.pid || r.brokerMarker !== broker.recoveryMarker || r.state !== 'spawned' || !Number.isSafeInteger(r.pid) || r.pid <= 0 || !r.identity) {
|
|
293
|
-
unresolved.push(`ownership:${name}:unverified`); continue
|
|
294
|
-
}
|
|
295
|
-
if (!absent(broker.pid)) { unresolved.push('broker:not-confirmed-absent'); break }
|
|
296
|
-
if (absent(r.pid)) {
|
|
297
|
-
// Dead root: only a receipt whose declared ports are all free can be
|
|
298
|
-
// resolved; any listener may be an unverified descendant.
|
|
299
|
-
if (await waitReceiptResolvable(r, discovered[r.id]?.ports)) {
|
|
300
|
-
removeReceipt(discovery, r.id)
|
|
301
|
-
stopped.push(r.id)
|
|
302
|
-
} else unresolved.push(`service:${r.id}:already-exited-descendants-unverified`)
|
|
303
|
-
continue
|
|
304
|
-
}
|
|
305
|
-
if (!absent(r.pid)) {
|
|
306
|
-
if (marker(r.pid) !== r.identity) { unresolved.push(`service:${r.id}:identity-unverified`); continue }
|
|
307
|
-
if (process.platform === 'win32') {
|
|
308
|
-
const result = spawnSync('taskkill', ['/PID', String(r.pid), '/F'], { stdio: 'ignore', timeout: 10000, windowsHide: true })
|
|
309
|
-
if (result.status !== 0 && !absent(r.pid)) { unresolved.push(`service:${r.id}:stop-failed`); continue }
|
|
310
|
-
} else {
|
|
311
|
-
try { process.kill(r.pid, 'SIGTERM') } catch (e) { if (e.code !== 'ESRCH') { unresolved.push(`service:${r.id}:stop-failed`); continue } }
|
|
312
|
-
}
|
|
313
|
-
for (let i = 0; i < 50 && !absent(r.pid); i++) await new Promise(resolve => setTimeout(resolve, 100))
|
|
314
|
-
if (!absent(r.pid)) { unresolved.push(`service:${r.id}:still-running`); continue }
|
|
315
|
-
}
|
|
316
|
-
// Root exit alone does not prove its descendants exited. It is safe to
|
|
317
|
-
// resolve once none of the declared ports is still listening; otherwise
|
|
318
|
-
// keep the receipt as evidence (fail closed).
|
|
319
|
-
if (await waitReceiptResolvable(r, discovered[r.id]?.ports)) {
|
|
320
|
-
removeReceipt(discovery, r.id)
|
|
321
|
-
stopped.push(r.id)
|
|
322
|
-
} else unresolved.push(`service:${r.id}:descendants-unverified`)
|
|
323
|
-
}
|
|
324
|
-
return { stopped, unresolved }
|
|
325
|
-
}
|
|
@@ -211,7 +211,15 @@ export function createServiceApp(options = {}) {
|
|
|
211
211
|
if (req.method !== 'GET' && req.method !== 'HEAD') return false
|
|
212
212
|
if (cleanPrefix && u.pathname !== cleanPrefix && !u.pathname.startsWith(cleanPrefix + '/')) return false
|
|
213
213
|
const relRaw = cleanPrefix ? u.pathname.slice(cleanPrefix.length) : u.pathname
|
|
214
|
-
|
|
214
|
+
let rel
|
|
215
|
+
try {
|
|
216
|
+
rel = relRaw === '' || relRaw === '/' ? index : decodeURIComponent(relRaw.replace(/^\/+/, ''))
|
|
217
|
+
} catch {
|
|
218
|
+
/* 畸形百分号编码 → URIError,不包会冒成 500;客户端错误回 400。 */
|
|
219
|
+
res.writeHead(400, { 'content-type': 'text/plain; charset=utf-8' })
|
|
220
|
+
res.end(req.method === 'HEAD' ? undefined : 'malformed path encoding')
|
|
221
|
+
return true
|
|
222
|
+
}
|
|
215
223
|
let file = null
|
|
216
224
|
let type = mimeFor(rel)
|
|
217
225
|
if (files) {
|
|
@@ -28,6 +28,22 @@ function anyTypeMatches(patterns, type) {
|
|
|
28
28
|
return (patterns || []).some((p) => typeMatches(p, type))
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/** 双向通配匹配:声明侧或查询侧任一带 `/*` 通配都要能命中。
|
|
32
|
+
* 旧实现只把声明当 pattern、查询当 type,查询侧通配(conductor 问「谁产出
|
|
33
|
+
* artifact:image/*」)永远不命中具体类型。 */
|
|
34
|
+
function typesOverlap(declPatterns, queryType) {
|
|
35
|
+
return (declPatterns || []).some((p) => typeMatches(p, queryType) || typeMatches(queryType, p))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** 深冻结:描述符的 produces/consumes/surface/provides 等嵌套结构也要不可变,
|
|
39
|
+
* 否则注册后仍能被外部改写,注册表的「单一真源」失真。 */
|
|
40
|
+
function deepFreeze(value) {
|
|
41
|
+
if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value
|
|
42
|
+
Object.freeze(value)
|
|
43
|
+
for (const key of Object.keys(value)) deepFreeze(value[key])
|
|
44
|
+
return value
|
|
45
|
+
}
|
|
46
|
+
|
|
31
47
|
/** 最小结构兜底:name/suite/controlMode/kind 必须在场且合法。深度校验走注入的 validate。 */
|
|
32
48
|
function structuralCheck(descriptor) {
|
|
33
49
|
const errors = []
|
|
@@ -48,7 +64,7 @@ export function createDescriptorRegistry({ validate } = {}) {
|
|
|
48
64
|
/** @type {Map<string, {descriptor:object, suite:string, baseUrl:string, registeredAt:number}>} */
|
|
49
65
|
const entries = new Map()
|
|
50
66
|
|
|
51
|
-
function register(descriptor, { suite, baseUrl = '' } = {}) {
|
|
67
|
+
function register(descriptor, { suite, baseUrl = '', force = false } = {}) {
|
|
52
68
|
const merged = { ...descriptor, suite: descriptor?.suite || suite }
|
|
53
69
|
const errors = structuralCheck(merged)
|
|
54
70
|
if (errors.length) {
|
|
@@ -64,8 +80,16 @@ export function createDescriptorRegistry({ validate } = {}) {
|
|
|
64
80
|
throw err
|
|
65
81
|
}
|
|
66
82
|
}
|
|
83
|
+
/* owner 校验:同名描述符已属另一套件时拒绝静默覆盖(防跨套件抢占);
|
|
84
|
+
* 同套件热重载刷新放行,确需跨套件替换须显式 force。 */
|
|
85
|
+
const existing = entries.get(merged.name)
|
|
86
|
+
if (existing && existing.suite !== merged.suite && !force) {
|
|
87
|
+
const err = new Error(`能力描述符 ${merged.name} 已属套件 ${existing.suite},套件 ${merged.suite} 不能覆盖(如确需替换请传 force)`)
|
|
88
|
+
err.code = 'DESCRIPTOR_OWNER_CONFLICT'
|
|
89
|
+
throw err
|
|
90
|
+
}
|
|
67
91
|
const entry = Object.freeze({
|
|
68
|
-
descriptor:
|
|
92
|
+
descriptor: deepFreeze({ ...merged }),
|
|
69
93
|
suite: merged.suite,
|
|
70
94
|
baseUrl: String(baseUrl || ''),
|
|
71
95
|
registeredAt: Date.now(),
|
|
@@ -92,8 +116,8 @@ export function createDescriptorRegistry({ validate } = {}) {
|
|
|
92
116
|
if (query.suite && entry.suite !== query.suite) continue
|
|
93
117
|
if (query.controlMode && d.controlMode !== query.controlMode) continue
|
|
94
118
|
if (query.kind && d.kind !== query.kind) continue
|
|
95
|
-
if (query.produces && !
|
|
96
|
-
if (query.consumes && !
|
|
119
|
+
if (query.produces && !typesOverlap(d.produces, query.produces)) continue
|
|
120
|
+
if (query.consumes && !typesOverlap(d.consumes, query.consumes)) continue
|
|
97
121
|
out.push(entry)
|
|
98
122
|
}
|
|
99
123
|
return out
|
|
@@ -166,7 +166,28 @@ export function createRegistry(capabilities, { enabled = null, ports = null, rep
|
|
|
166
166
|
}),
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
/* 动态增删工具:配合 MCP 活引用(tools/list 读 registry.TOOLS),注册/注销后
|
|
170
|
+
* 客户端重新 list 即见最新工具集,无需重建 handler。旧 registry 是纯静态,
|
|
171
|
+
* 套件热重载/能力开关无法反映到工具面。 */
|
|
172
|
+
function registerTool(tool, capabilityId = '') {
|
|
173
|
+
if (!tool || typeof tool.name !== 'string' || !tool.name) throw new Error('registerTool 需要 tool.name')
|
|
174
|
+
if (typeof tool.handler !== 'function') throw new Error(`工具 ${tool.name} 需要 handler`)
|
|
175
|
+
if (TOOL_IMPL[tool.name]) throw new Error(`工具已存在: ${tool.name}`)
|
|
176
|
+
TOOLS.push({ name: tool.name, description: tool.description || '', inputSchema: tool.inputSchema || { type: 'object', properties: {} } })
|
|
177
|
+
TOOL_META[tool.name] = { kind: tool.kind || 'write', since: tool.since || '1.0.0', capability: capabilityId }
|
|
178
|
+
TOOL_IMPL[tool.name] = (args) => tool.handler(args || {}, ctx)
|
|
179
|
+
return true
|
|
180
|
+
}
|
|
181
|
+
function unregisterTool(name) {
|
|
182
|
+
const index = TOOLS.findIndex((tool) => tool.name === name)
|
|
183
|
+
if (index < 0) return false
|
|
184
|
+
TOOLS.splice(index, 1)
|
|
185
|
+
delete TOOL_IMPL[name]
|
|
186
|
+
delete TOOL_META[name]
|
|
187
|
+
return true
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return { TOOLS, TOOL_IMPL, TOOL_META, FEATURES, CAPABILITIES, ctx, registerTool, unregisterTool }
|
|
170
191
|
}
|
|
171
192
|
|
|
172
193
|
/** 与 MCP 工具面解耦:调用前统一校验。 */
|
|
@@ -199,21 +220,26 @@ export function createToolDispatcher({ tools, callTool }) {
|
|
|
199
220
|
* { tools, callTool }(旧 relay 形态)
|
|
200
221
|
* @param {{ registry?: object, tools?: Array, toolImpl?: object, callTool?: Function, serverInfo?: object, instructions?: string }} options
|
|
201
222
|
*/
|
|
202
|
-
export function createMcpHandler({ registry, tools, toolImpl, callTool, serverInfo, instructions } = {}) {
|
|
203
|
-
|
|
223
|
+
export function createMcpHandler({ registry, tools, toolImpl, callTool, serverInfo, instructions, listChanged } = {}) {
|
|
224
|
+
/* registry 形态走活引用:tools/list 每次读 registry.TOOLS,callTool 读 registry.TOOL_IMPL,
|
|
225
|
+
* 于是 registerTool/unregisterTool 的动态增删立刻可见,无需重建 handler。 */
|
|
226
|
+
const useRegistry = !tools && !!registry
|
|
204
227
|
const impl = toolImpl || registry?.TOOL_IMPL || null
|
|
205
|
-
|
|
228
|
+
const staticList = tools || null
|
|
229
|
+
if (!useRegistry && (!Array.isArray(staticList) || !staticList.length)) throw new Error('createMcpHandler: 没有工具可暴露')
|
|
206
230
|
if (!impl && typeof callTool !== 'function') throw new Error('createMcpHandler: 需要 toolImpl 或 callTool')
|
|
207
231
|
return createKitMcpHandler({
|
|
208
|
-
tools:
|
|
232
|
+
tools: useRegistry ? () => registry.TOOLS : staticList,
|
|
209
233
|
callTool: (name, args, context) => {
|
|
210
234
|
if (typeof callTool === 'function' && !impl) return callTool(name, args, context)
|
|
211
|
-
const
|
|
235
|
+
const source = useRegistry ? registry.TOOL_IMPL : impl
|
|
236
|
+
const fn = source[name]
|
|
212
237
|
if (!fn) throw new Error(`未知工具: ${name}`)
|
|
213
238
|
return fn(args, context)
|
|
214
239
|
},
|
|
215
240
|
serverInfo: serverInfo || { name: 'dsh-tool-host', version: '0.1.0' },
|
|
216
241
|
instructions,
|
|
242
|
+
listChanged,
|
|
217
243
|
})
|
|
218
244
|
}
|
|
219
245
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capyclaw/ppt-suite",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.69",
|
|
4
4
|
"description": "PPT 工作台套件:workbench + 2 个独立 skill 包 + 文档工作台框架 + 底层 kit + 服务中间件(broker)与技能服务;公共基建(os / toolHost / serviceHost / assets / serviceBroker / editorHost)由 @capyclaw/core 统一提供,需同一 profile 启用它。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.mjs",
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
"@capyclaw/ppt-editor": "^1.1.0",
|
|
25
25
|
"@capyclaw/ppt-skill-api": "^2.3.4",
|
|
26
26
|
"@capyclaw/ppt-skill-proposal": "^2.4.0",
|
|
27
|
-
"@capyclaw/ppt-workbench": "^2.5.
|
|
27
|
+
"@capyclaw/ppt-workbench": "^2.5.69",
|
|
28
28
|
"@capyclaw/service-broker": "^0.2.25",
|
|
29
29
|
"@capyclaw/service-host": "^0.1.5",
|
|
30
30
|
"@capyclaw/skills-service": "^0.2.2",
|
|
31
|
-
"@capyclaw/tool-host": "^0.2.0"
|
|
31
|
+
"@capyclaw/tool-host": "^0.2.0",
|
|
32
|
+
"playwright": "^1.64.1"
|
|
32
33
|
},
|
|
33
34
|
"dsh": {
|
|
34
35
|
"bundle": {
|
|
@@ -92,7 +93,6 @@
|
|
|
92
93
|
"jszip",
|
|
93
94
|
"lie",
|
|
94
95
|
"pako",
|
|
95
|
-
"playwright-core",
|
|
96
96
|
"pptxgenjs",
|
|
97
97
|
"process-nextick-args",
|
|
98
98
|
"queue",
|