@capyclaw/browser-suite 0.2.38 → 0.2.39
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 +23 -23
- package/contract/browser-contract.json +1 -1
- package/dsh-suite.json +26 -16
- package/node_modules/@capyclaw/asset-service/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/asset-service/package.json +1 -1
- package/node_modules/@capyclaw/asset-service/src/index.mjs +4 -3
- package/node_modules/@capyclaw/browser-skill-api/contract/browser-contract.json +1 -1
- package/node_modules/@capyclaw/browser-skill-api/package.json +1 -1
- package/node_modules/@capyclaw/browser-skill-api/skills/browser-api/references/tool-contract.md +1 -1
- package/node_modules/@capyclaw/browser-skill-browser/contract/browser-contract.json +1 -1
- package/node_modules/@capyclaw/browser-skill-browser/package.json +1 -1
- package/node_modules/@capyclaw/browser-skill-ops/contract/browser-contract.json +1 -1
- package/node_modules/@capyclaw/browser-skill-ops/package.json +1 -1
- package/node_modules/@capyclaw/browser-workbench/contract/browser-contract.json +1 -1
- package/node_modules/@capyclaw/browser-workbench/package.json +7 -7
- package/node_modules/@capyclaw/browser-workbench/plugin.mjs +13 -1
- package/node_modules/@capyclaw/browser-workbench/server/activate-log.mjs +66 -0
- package/node_modules/@capyclaw/browser-workbench/server/contract.mjs +1 -1
- package/node_modules/@capyclaw/browser-workbench/server/embedded-host.mjs +13 -1
- package/node_modules/@capyclaw/browser-workbench/server/engine.mjs +11 -4
- package/node_modules/@capyclaw/browser-workbench/server/routes/api.mjs +2 -2
- package/node_modules/@capyclaw/browser-workbench/server/shared/SHARED_MANIFEST.json +4 -4
- package/node_modules/@capyclaw/browser-workbench/ui/app.js +87 -10
- package/node_modules/@capyclaw/document-workbench/package.json +6 -3
- package/node_modules/@capyclaw/document-workbench/src/client/index.mjs +56 -3
- package/node_modules/@capyclaw/document-workbench/src/client/visibility.mjs +112 -0
- package/node_modules/@capyclaw/document-workbench/src/model/manifest.mjs +6 -4
- package/node_modules/@capyclaw/document-workbench/src/model/ops.mjs +7 -2
- package/node_modules/@capyclaw/document-workbench/src/session/index.mjs +8 -0
- package/node_modules/@capyclaw/document-workbench/src/store/file-backend.mjs +17 -10
- package/node_modules/@capyclaw/document-workbench/src/store/projection.mjs +39 -0
- package/node_modules/@capyclaw/document-workbench/src/testing/index.mjs +14 -11
- package/node_modules/@capyclaw/foundation/abi/assets.mjs +26 -0
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +3 -1
- package/node_modules/@capyclaw/foundation/abi/index.mjs +15 -0
- package/node_modules/@capyclaw/foundation/abi/visibility.mjs +90 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +21 -4
- package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +5 -1
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +5 -2
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +4 -0
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +13 -3
- package/node_modules/@capyclaw/foundation/package.json +1 -1
- package/node_modules/@capyclaw/plugin-kit/package.json +3 -1
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +5 -2
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat.mjs +26 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/static.mjs +79 -0
- package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +13 -5
- package/node_modules/@capyclaw/portal/package.json +1 -1
- package/node_modules/@capyclaw/service-broker/README.md +1 -1
- package/node_modules/@capyclaw/service-broker/lib/host.mjs +11 -6
- package/node_modules/@capyclaw/service-broker/lib/skills-client.mjs +13 -5
- package/node_modules/@capyclaw/service-broker/package.json +1 -1
- package/node_modules/@capyclaw/service-host/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/service-host/package.json +1 -1
- package/node_modules/@capyclaw/service-host/src/index.mjs +13 -22
- package/node_modules/@capyclaw/tool-host/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/tool-host/lib/host.mjs +15 -4
- package/node_modules/@capyclaw/tool-host/package.json +1 -1
- package/node_modules/@capyclaw/tool-host/src/index.mjs +19 -5
- package/node_modules/@capyclaw/tool-host/src/mode-gate.mjs +71 -3
- package/package.json +12 -12
|
@@ -19,6 +19,7 @@ import crypto from 'node:crypto'
|
|
|
19
19
|
import { listen, send, sendText, readBody } from '@capyclaw/plugin-kit/service/http'
|
|
20
20
|
import { createServiceApi } from '@capyclaw/plugin-kit/service/api'
|
|
21
21
|
import { isLoopbackOrigin as sharedIsLoopbackOrigin, mimeFor } from '@capyclaw/plugin-kit/util/http'
|
|
22
|
+
import { safeJoin, cleanStaticPrefix, staticPrefixHit, staticRelRaw, decodeStaticRel, staticFileHit, staticHitNameType, staticBaseHeaders } from '@capyclaw/plugin-kit/service/static'
|
|
22
23
|
import { tuning } from './tuning.mjs'
|
|
23
24
|
|
|
24
25
|
function slugOf(id) {
|
|
@@ -133,11 +134,7 @@ async function probeExisting(origin, healthPath, id) {
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
const target = path.resolve(root, `.${path.sep}${rel}`)
|
|
138
|
-
const base = path.resolve(root)
|
|
139
|
-
return target === base || target.startsWith(base + path.sep) ? target : null
|
|
140
|
-
}
|
|
137
|
+
/* safeJoin 已收敛到 @capyclaw/plugin-kit/service/static(P2-13a 静态公共核心)。 */
|
|
141
138
|
|
|
142
139
|
/**
|
|
143
140
|
* @param {{
|
|
@@ -204,17 +201,17 @@ export function createServiceApp(options = {}) {
|
|
|
204
201
|
})
|
|
205
202
|
},
|
|
206
203
|
|
|
207
|
-
/** 静态目录挂载。files 可给显式映射:{ '/': ['index.html','text/html'] }。
|
|
204
|
+
/** 静态目录挂载。files 可给显式映射:{ '/': ['index.html','text/html'] }。
|
|
205
|
+
* 路径/头部计算走 @capyclaw/plugin-kit/service/static 公共核心(P2-13a);
|
|
206
|
+
* 本宿主保留自己的响应政策:畸形编码回 400、content-type 取 mimeFor(请求 rel)、每次读盘。 */
|
|
208
207
|
static(prefix, dir, { files = null, index = 'index.html' } = {}) {
|
|
209
|
-
const cleanPrefix = prefix
|
|
208
|
+
const cleanPrefix = cleanStaticPrefix(prefix)
|
|
210
209
|
return app.use((req, res, u) => {
|
|
211
210
|
if (req.method !== 'GET' && req.method !== 'HEAD') return false
|
|
212
|
-
if (
|
|
213
|
-
const relRaw =
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
rel = relRaw === '' || relRaw === '/' ? index : decodeURIComponent(relRaw.replace(/^\/+/, ''))
|
|
217
|
-
} catch {
|
|
211
|
+
if (!staticPrefixHit(u.pathname, cleanPrefix)) return false
|
|
212
|
+
const relRaw = staticRelRaw(u.pathname, cleanPrefix)
|
|
213
|
+
const rel = decodeStaticRel(relRaw, index)
|
|
214
|
+
if (rel === null) {
|
|
218
215
|
/* 畸形百分号编码 → URIError,不包会冒成 500;客户端错误回 400。 */
|
|
219
216
|
res.writeHead(400, { 'content-type': 'text/plain; charset=utf-8' })
|
|
220
217
|
res.end(req.method === 'HEAD' ? undefined : 'malformed path encoding')
|
|
@@ -223,9 +220,9 @@ export function createServiceApp(options = {}) {
|
|
|
223
220
|
let file = null
|
|
224
221
|
let type = mimeFor(rel)
|
|
225
222
|
if (files) {
|
|
226
|
-
const hit = files
|
|
223
|
+
const hit = staticFileHit(files, relRaw)
|
|
227
224
|
if (!hit) return false
|
|
228
|
-
const [name, explicitType] =
|
|
225
|
+
const [name, explicitType] = staticHitNameType(hit)
|
|
229
226
|
file = safeJoin(dir, name)
|
|
230
227
|
type = explicitType || type
|
|
231
228
|
} else {
|
|
@@ -234,13 +231,7 @@ export function createServiceApp(options = {}) {
|
|
|
234
231
|
if (!file) return false
|
|
235
232
|
try {
|
|
236
233
|
const data = fs.readFileSync(file)
|
|
237
|
-
res.writeHead(200,
|
|
238
|
-
'content-type': type,
|
|
239
|
-
'content-length': data.length,
|
|
240
|
-
'x-content-type-options': 'nosniff',
|
|
241
|
-
'referrer-policy': 'no-referrer',
|
|
242
|
-
'cache-control': 'no-cache',
|
|
243
|
-
})
|
|
234
|
+
res.writeHead(200, staticBaseHeaders(type, data.length))
|
|
244
235
|
res.end(req.method === 'HEAD' ? undefined : data)
|
|
245
236
|
return true
|
|
246
237
|
} catch {
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* 同时落地“会话模式锁”这一基础设施能力:
|
|
5
5
|
* · 把 work-store 惰性解析器注入 toolHost(模式锁的存储真源);
|
|
6
6
|
* · 给 DSH tools 服务挂全局 guard(异领域调用硬拒兜底);
|
|
7
|
-
* · 注册框架核心工具 mode_lock / mode_status
|
|
7
|
+
* · 注册框架核心工具 mode_lock / mode_status(无领域,恒可见)——显式锁定入口;
|
|
8
|
+
* · 给 DSH systemPrompt 挂动态感知 section(锁定即告知模型主区工作台与交付路径)。
|
|
8
9
|
* 核心工具与 guard 的注册统一走 modeGate.install(tools)(幂等):apply 时 best-effort 挂一次,
|
|
9
10
|
* 若那一刻 tools 服务尚未就绪,首个套件注册(registerWithDsh / bridge host)会再调 install 补上,
|
|
10
|
-
*
|
|
11
|
+
* 故不依赖加载顺序。感知闸同理走 modeGate.installPrompt(systemPrompt)。
|
|
12
|
+
* 所有经 toolHost.registerWithDsh / bridge host 注册的领域能力自动受锁约束,套件零接线。
|
|
11
13
|
*/
|
|
12
14
|
import { defineDriver } from '@capyclaw/foundation/abi'
|
|
13
15
|
import { createToolHost } from '../src/index.mjs'
|
|
@@ -23,12 +25,21 @@ export const { name, inject, apply } = defineDriver({
|
|
|
23
25
|
const service = createToolHost({ ...config, getWorkStore: () => safeGet(ctx, 'workStore') })
|
|
24
26
|
const dispose = ctx.provide('toolHost', service)
|
|
25
27
|
|
|
26
|
-
/* 模式锁兜底闸 + 核心锁定工具(幂等)。tools 缺席则降级:稍后套件注册时经 install 补挂。
|
|
28
|
+
/* 模式锁兜底闸 + 核心锁定工具(幂等)。tools 缺席则降级:稍后套件注册时经 install 补挂。
|
|
29
|
+
* install 返回引用计数 disposer,必须随 driver 卸载释放,否则核心工具/guard 永驻。 */
|
|
27
30
|
const tools = safeGet(ctx, 'tools')
|
|
28
|
-
|
|
31
|
+
const gateDispose = (tools && typeof tools.register === 'function') ? service.modeGate.install(tools) : null
|
|
32
|
+
|
|
33
|
+
/* 感知闸(幂等):锁定会话的系统提示里注入主区工作台感知。systemPrompt 缺席则降级,
|
|
34
|
+
* 稍后套件注册时经 installPrompt 补挂。disposer 同样必须随 driver 卸载释放。 */
|
|
35
|
+
const systemPrompt = safeGet(ctx, 'systemPrompt')
|
|
36
|
+
const promptDispose = (systemPrompt && typeof systemPrompt.section === 'function')
|
|
37
|
+
? service.modeGate.installPrompt(systemPrompt) : null
|
|
29
38
|
|
|
30
39
|
console.log('[tool-host] ready (mode-gate enabled)')
|
|
31
40
|
return () => {
|
|
41
|
+
if (typeof promptDispose === 'function') promptDispose()
|
|
42
|
+
if (typeof gateDispose === 'function') gateDispose()
|
|
32
43
|
if (typeof dispose === 'function') dispose()
|
|
33
44
|
}
|
|
34
45
|
},
|
|
@@ -358,9 +358,21 @@ export function buildInstructions({
|
|
|
358
358
|
*/
|
|
359
359
|
export function registerWithDsh(ctx, registry, { namespace = '', domain = '', modeGate = null } = {}) {
|
|
360
360
|
if (!ctx?.tools?.register) throw new Error('registerWithDsh: 当前 DSH 没有 ctx.tools.register')
|
|
361
|
-
/* 领域工具一旦注册即声明给模式锁,并挂全局 guard 兜底(幂等)。
|
|
362
|
-
|
|
361
|
+
/* 领域工具一旦注册即声明给模式锁,并挂全局 guard 兜底(幂等)。
|
|
362
|
+
* install 的引用计数 disposer 必须随本次注册一起释放(旧写法丢弃⇒核心工具/guard 泄漏)。 */
|
|
363
|
+
const gateDispose = modeGate ? modeGate.install(ctx.tools) : null
|
|
363
364
|
const disposers = []
|
|
365
|
+
if (typeof gateDispose === 'function') disposers.push(gateDispose)
|
|
366
|
+
/* 感知闸补挂(幂等):driver apply 那一刻 systemPrompt 可能尚未就绪,套件注册时再挂一次。
|
|
367
|
+
* 引用计数 disposer 随本次注册一起释放。cordis 服务缺席时访问可能抛错,try 包裹降级。 */
|
|
368
|
+
if (modeGate && typeof modeGate.installPrompt === 'function') {
|
|
369
|
+
let systemPrompt = null
|
|
370
|
+
try { systemPrompt = ctx.systemPrompt } catch { systemPrompt = null }
|
|
371
|
+
if (systemPrompt && typeof systemPrompt.section === 'function') {
|
|
372
|
+
const promptDispose = modeGate.installPrompt(systemPrompt)
|
|
373
|
+
if (typeof promptDispose === 'function') disposers.push(promptDispose)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
364
376
|
try {
|
|
365
377
|
for (const tool of registry?.TOOLS || []) {
|
|
366
378
|
const impl = registry.TOOL_IMPL?.[tool.name]
|
|
@@ -420,8 +432,10 @@ export function createToolHost(config = {}) {
|
|
|
420
432
|
// (driver 注入 () => safeGet(ctx,'workStore'));底座缺席则降级为恒可见、不拒。
|
|
421
433
|
const modeGate = createModeGate({ getWorkStore: config.getWorkStore })
|
|
422
434
|
return {
|
|
423
|
-
|
|
424
|
-
version
|
|
435
|
+
// M12 对齐:自报以 package.json 为权威——dsh.apiVersion=1.1.0(对外契约,
|
|
436
|
+
// 消费者 assertServiceApi 只断言 major 1),version=0.3.1。旧自报 1.2.0/0.3.0 是漂移。
|
|
437
|
+
api: createServiceApi('toolHost', '1.1.0', ['dsl', 'registry', 'validate', 'contract', 'mcp', 'instructions', 'native-tools', 'descriptors', 'mode-gate']),
|
|
438
|
+
version: '0.3.1',
|
|
425
439
|
defineTool,
|
|
426
440
|
defineCapability,
|
|
427
441
|
createRegistry: (capabilities, options = {}) => createRegistry(capabilities, { ...config, ...options }),
|
|
@@ -429,7 +443,7 @@ export function createToolHost(config = {}) {
|
|
|
429
443
|
createToolDispatcher,
|
|
430
444
|
createCapabilityReport,
|
|
431
445
|
buildInstructions,
|
|
432
|
-
// 服务级注册自动带会话模式锁(when 可见性 + guard 硬拒 + 调用者会话 ALS),套件零接线。
|
|
446
|
+
// 服务级注册自动带会话模式锁(when 可见性 + guard 硬拒 + 感知提示 + 调用者会话 ALS),套件零接线。
|
|
433
447
|
registerWithDsh: (ctx, registry, options = {}) => registerWithDsh(ctx, registry, { modeGate, ...options }),
|
|
434
448
|
validateToolArguments,
|
|
435
449
|
modeGate,
|
|
@@ -5,11 +5,15 @@
|
|
|
5
5
|
* 该领域的工具;其余已注册能力(browser_* 等)从工具声明里消失,且即便被强行
|
|
6
6
|
* 调用也在分发层硬拒。所有经 tool-host 注册的能力自动受此约束。
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* 三道原生闸在此全部落地:
|
|
9
9
|
* · when(可见性):registerWithDsh / bridge host 给每个领域工具挂 whenFor(name),
|
|
10
10
|
* DSH 每步 resolve() 求值,false 同时从声明与分发中排除该工具。
|
|
11
11
|
* · guard(分发硬拒,兜底):install(tools) 挂一个全局 ToolGuard,异领域调用返回
|
|
12
12
|
* denial。单调不可翻回,兜住任何绕过 when 的路径。
|
|
13
|
+
* · awareness(模型感知):installPrompt(systemPrompt) 注册一个动态提示 section,
|
|
14
|
+
* 每次组装按会话读锁状态,锁定即告知模型「主区工作台是唯一交付界面、用本领域
|
|
15
|
+
* 工具、勿用文件工具绕过」。缺了这道闸,when/guard 只挡得住领域工具,模型仍会
|
|
16
|
+
* 用无 domain 的内置文件工具(write/pwsh/office_*)绕过主区(2026-11-23 根因)。
|
|
13
17
|
*
|
|
14
18
|
* 领域来源:TOOL_META.domain(defineTool/defineCapability/createRegistry 声明)。
|
|
15
19
|
* 存储真源:work-store.getSessionMode(sid)(终生固化,无 unlock)。
|
|
@@ -28,6 +32,10 @@ export function createModeGate({ getWorkStore } = {}) {
|
|
|
28
32
|
const guardDisposers = []
|
|
29
33
|
let coreToolsRegistered = false
|
|
30
34
|
const coreDisposers = []
|
|
35
|
+
let installRefs = 0 // 安装方引用计数(见 install 注释)
|
|
36
|
+
let promptInstalled = false // 感知闸:动态提示 section 是否已注册
|
|
37
|
+
const promptDisposers = []
|
|
38
|
+
let promptRefs = 0 // 感知闸安装方引用计数(与 install 同语义)
|
|
31
39
|
|
|
32
40
|
function store() {
|
|
33
41
|
try { return typeof getWorkStore === 'function' ? getWorkStore() : null } catch { return null }
|
|
@@ -153,7 +161,10 @@ export function createModeGate({ getWorkStore } = {}) {
|
|
|
153
161
|
}
|
|
154
162
|
|
|
155
163
|
/** 把 guard + 核心锁定工具挂到 DSH tools 服务(幂等)。每个套件在 tools 就绪时都会调用,
|
|
156
|
-
* 故核心工具注册不依赖 tool-host driver apply 那一刻 tools 是否已就绪(加载顺序鲁棒)。返回 disposer。
|
|
164
|
+
* 故核心工具注册不依赖 tool-host driver apply 那一刻 tools 是否已就绪(加载顺序鲁棒)。返回 disposer。
|
|
165
|
+
* 引用计数:多个安装方(driver apply / 各套件 registerWithDsh)共享同一份核心注册,
|
|
166
|
+
* 任一安装方卸载只减引用;最后一个释放才真正摘 guard + 核心工具,避免「丢 disposer」泄漏
|
|
167
|
+
* 与「先卸载者拆掉幸存者底座」两种事故。 */
|
|
157
168
|
function install(tools) {
|
|
158
169
|
if (!tools) return () => {}
|
|
159
170
|
if (!guardInstalled && typeof tools.guard === 'function') {
|
|
@@ -174,7 +185,13 @@ export function createModeGate({ getWorkStore } = {}) {
|
|
|
174
185
|
}
|
|
175
186
|
coreToolsRegistered = true
|
|
176
187
|
}
|
|
188
|
+
installRefs++
|
|
189
|
+
let released = false
|
|
177
190
|
return () => {
|
|
191
|
+
if (released) return
|
|
192
|
+
released = true
|
|
193
|
+
installRefs--
|
|
194
|
+
if (installRefs > 0) return
|
|
178
195
|
for (const dispose of guardDisposers.splice(0)) {
|
|
179
196
|
try { dispose() } catch { /* 忽略重复释放 */ }
|
|
180
197
|
}
|
|
@@ -186,6 +203,57 @@ export function createModeGate({ getWorkStore } = {}) {
|
|
|
186
203
|
}
|
|
187
204
|
}
|
|
188
205
|
|
|
206
|
+
/**
|
|
207
|
+
* 感知闸文本:锁定会话里注入系统提示,让模型知道主区工作台的存在与唯一交付地位。
|
|
208
|
+
* 只约束「工作台内容任务」的交付路径,不禁止为修插件/查资料等元任务读文件。
|
|
209
|
+
*/
|
|
210
|
+
function awarenessText(kind) {
|
|
211
|
+
return `【会话工作模式锁】本会话已锁定为「${kind}」工作模式:GUI 主区界面就是「${kind}」工作台,它是本会话工作台内容任务的指定交付界面。\n`
|
|
212
|
+
+ `- 用户要求创作/编辑文档、稿件等工作台内容时,必须用 ${kind}_* 专用工具直接读写主区工作台(先加载 ${kind} 相关 skill),让用户在主区实时看到结果。\n`
|
|
213
|
+
+ `- 不得改用 write/pwsh/office_* 等通用文件工具生成独立文件来绕过主区交付;其他领域的工具与技能不适用于本会话。\n`
|
|
214
|
+
+ `- 锁终生固化、不可解锁;确需其他领域,请提示用户新开会话。锁状态可用 mode_status 查询。`
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* 感知闸:把锁状态作为动态系统提示 section 挂到 DSH systemPrompt 服务(幂等)。
|
|
219
|
+
* text 回调每次 assemble 求值(DSH 每步组装提示时调用),按 context.agent.session.id
|
|
220
|
+
* 读锁:锁定 → 注入感知文本;未锁定/无会话 → 返回 ''(空 section 自动消失,零开销)。
|
|
221
|
+
* 锁可在会话中途被认领(墙上点选),回调动态读取故无需监听 agent 生命周期。
|
|
222
|
+
* 引用计数与 install(tools) 同语义:driver apply 与各套件 registerWithDsh 共享一份注册。
|
|
223
|
+
* 底座缺席(无 systemPrompt / 不支持 section)→ 降级为仅 when/guard 生效。
|
|
224
|
+
* @returns {() => void} 引用计数 disposer
|
|
225
|
+
*/
|
|
226
|
+
function installPrompt(systemPrompt) {
|
|
227
|
+
if (!systemPrompt || typeof systemPrompt.section !== 'function') return () => {}
|
|
228
|
+
if (!promptInstalled) {
|
|
229
|
+
try {
|
|
230
|
+
const dispose = systemPrompt.section({
|
|
231
|
+
name: 'capyclaw:session-mode-lock',
|
|
232
|
+
order: 900,
|
|
233
|
+
interpolate: false,
|
|
234
|
+
text: (context) => {
|
|
235
|
+
const kind = modeOf(context?.agent?.session?.id)
|
|
236
|
+
return kind ? awarenessText(kind) : ''
|
|
237
|
+
},
|
|
238
|
+
})
|
|
239
|
+
if (typeof dispose === 'function') promptDisposers.push(dispose)
|
|
240
|
+
promptInstalled = true
|
|
241
|
+
} catch { /* 底座不支持 section 时降级:仅 when/guard 生效 */ }
|
|
242
|
+
}
|
|
243
|
+
promptRefs++
|
|
244
|
+
let released = false
|
|
245
|
+
return () => {
|
|
246
|
+
if (released) return
|
|
247
|
+
released = true
|
|
248
|
+
promptRefs--
|
|
249
|
+
if (promptRefs > 0) return
|
|
250
|
+
for (const dispose of promptDisposers.splice(0)) {
|
|
251
|
+
try { dispose() } catch { /* 忽略重复释放 */ }
|
|
252
|
+
}
|
|
253
|
+
promptInstalled = false
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
189
257
|
/**
|
|
190
258
|
* 能力发现面过滤:锁定会话里剔除异领域描述符(conductor_discover 自动受约束)。
|
|
191
259
|
* 无 domain 的描述符(编排/核心基建)保留。未锁定 → 原样返回。
|
|
@@ -200,5 +268,5 @@ export function createModeGate({ getWorkStore } = {}) {
|
|
|
200
268
|
})
|
|
201
269
|
}
|
|
202
270
|
|
|
203
|
-
return { declareTools, domainOf, modeOf, isVisible, whenFor, guard, install, filterEntries }
|
|
271
|
+
return { declareTools, domainOf, modeOf, isVisible, whenFor, guard, install, installPrompt, filterEntries }
|
|
204
272
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capyclaw/browser-suite",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.39",
|
|
4
4
|
"description": "浏览器操控宿主内嵌工作台(挂在 dsh 的 /capyclaw/browser,路由与端口由基建决定;Playwright 引擎、有头可见、登录态持久化)+ 3 个独立 skill 包 + 服务中间件(broker);公共基建(os / toolHost / serviceHost / assets / serviceBroker)由 @capyclaw/core 统一提供,需同一 profile 启用它。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.mjs",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@capyclaw/asset-service": "^0.1.
|
|
20
|
-
"@capyclaw/browser-skill-api": "^0.2.
|
|
21
|
-
"@capyclaw/browser-skill-browser": "^0.2.
|
|
22
|
-
"@capyclaw/browser-skill-ops": "^0.2.
|
|
23
|
-
"@capyclaw/browser-workbench": "^0.1.
|
|
24
|
-
"@capyclaw/document-workbench": "^0.2.
|
|
25
|
-
"@capyclaw/foundation": "^0.1.
|
|
26
|
-
"@capyclaw/plugin-kit": "^0.2.
|
|
27
|
-
"@capyclaw/service-broker": "^0.2.
|
|
28
|
-
"@capyclaw/service-host": "^0.1.
|
|
29
|
-
"@capyclaw/tool-host": "^0.3.
|
|
19
|
+
"@capyclaw/asset-service": "^0.1.6",
|
|
20
|
+
"@capyclaw/browser-skill-api": "^0.2.5",
|
|
21
|
+
"@capyclaw/browser-skill-browser": "^0.2.5",
|
|
22
|
+
"@capyclaw/browser-skill-ops": "^0.2.5",
|
|
23
|
+
"@capyclaw/browser-workbench": "^0.1.21",
|
|
24
|
+
"@capyclaw/document-workbench": "^0.2.4",
|
|
25
|
+
"@capyclaw/foundation": "^0.1.11",
|
|
26
|
+
"@capyclaw/plugin-kit": "^0.2.8",
|
|
27
|
+
"@capyclaw/service-broker": "^0.2.27",
|
|
28
|
+
"@capyclaw/service-host": "^0.1.7",
|
|
29
|
+
"@capyclaw/tool-host": "^0.3.2"
|
|
30
30
|
},
|
|
31
31
|
"dsh": {
|
|
32
32
|
"bundle": {
|