@rezti/dsh-rez-task-handoff 0.1.0-beta.2 → 0.1.0-beta.5
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/README.md +14 -10
- package/module/index.mjs +22 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# Jarvis 跨会话任务交接(模拟版 0.1.0-beta.
|
|
1
|
+
# Jarvis 跨会话任务交接(模拟版 0.1.0-beta.5)
|
|
2
2
|
|
|
3
3
|
适用目标:DeepSeek Harness 桌面版,宿主 0.2.1-rc.5,Aurabot 1.1.24,desktop profile。只接受成功、失败、超时、需要确认四种模拟任务。没有 HA、摄像头、真实设备、系统命令或任意任务执行入口。不依赖或改动 RezSuite。
|
|
4
4
|
|
|
5
5
|
## 从 npm 下载并检查
|
|
6
6
|
|
|
7
|
-
这是通过 npm 分发的 **Aurabot
|
|
7
|
+
这是通过 npm 分发的 **Aurabot 用户模块**。先下载并解包,再核对目标机。
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
cd "$(mktemp -d)"
|
|
11
|
-
npm pack @rezti/dsh-rez-task-handoff@0.1.0-beta.
|
|
12
|
-
tar -xzf rezti-dsh-rez-task-handoff-0.1.0-beta.
|
|
11
|
+
npm pack @rezti/dsh-rez-task-handoff@0.1.0-beta.5 --ignore-scripts --registry https://registry.npmjs.org
|
|
12
|
+
tar -xzf rezti-dsh-rez-task-handoff-0.1.0-beta.5.tgz
|
|
13
13
|
node package/inspect.mjs
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -17,8 +17,8 @@ node package/inspect.mjs
|
|
|
17
17
|
|
|
18
18
|
## 接口与取舍
|
|
19
19
|
|
|
20
|
-
- [Aurabot 1.1.24 用户模块 API](https://github.com/aureth-labs/dsh-aurabot-qq/blob/v1.1.24/src/modules/API.md)
|
|
21
|
-
- 从 1.1.24 源码验证,Aurabot 在 QQ agent 的 `agent.ctx.tools` 上挂模块工具。“纯聊天”档不挂模块工具,需要已有的支持工具档位。本模块同时核对配置的主人、原私聊 ID
|
|
20
|
+
- [Aurabot 1.1.24 用户模块 API](https://github.com/aureth-labs/dsh-aurabot-qq/blob/v1.1.24/src/modules/API.md) 提供 `tool`、`defineTool`、`prompt`、`rule`、`settings`、`config`、`isOwner`、`dataDir`、`every` 和卸载回调。用户模块目录与插件安装目录分离,升级保留。本扩展检测到其他 Aurabot 版本会停用,待核对再放开。
|
|
21
|
+
- 从 1.1.24 源码验证,Aurabot 在 QQ agent 的 `agent.ctx.tools` 上挂模块工具。“纯聊天”档不挂模块工具,需要已有的支持工具档位。本模块同时核对配置的主人、原私聊 ID、实际执行会话和最新入站消息的可信标记。核对来源时跳过 DSH 的运行时上下文和 rc.5 的时间快照,以免把它们当成新的用户输入。主人私聊的普通消息可查状态,提交须明确发送「让 Jarvis 做交接测试 success」或指定其他模拟模式。群聊、其他私聊、后台轮、DSH 直接输入、回传轮都不能触发。
|
|
22
22
|
- DSH 0.2.1-rc.5 发行包已验证 `agents.get`、`Agent.followup`、`session/event`、`ToolRuntime.restrict/guard` 与 `exec.concludeTurn()`。用固定的完整会话 ID 定位已打开的 Jarvis。用唯一输入消息 ID 关联 `user/message` 与对应 `turn/end`,且只有模拟工具的结果可成为任务结果。`whenIdle()` 只用于清理;它不是具体任务的完成回执。测试运行时实际装载了同版本 AgentLoop。
|
|
23
23
|
- 回传使用原 QQ Agent 的原生 follow-up。Aurabot 的聊天中枢会监听原会话事件并发送普通回复。以 `hub.sessions()`、`chatOfSession()` 做最后校验,映射变更、Agent 不在、主人静音时先等;通知最多等待十分钟。本机发布代码与真实核心的隔离测试证明这条路径成立。Aurabot 的 hub 映射和自动转发是版本相关的实现,未宣称跨版本稳定。没有采用 `api.think`:它会走后台会话。
|
|
24
24
|
- [dsh-peer-bus](https://github.com/ybh1291747665/dsh-peer-bus) 和 [dsh-cross-session-agent](https://github.com/dd2673/dsh-cross-session-agent) 有成熟的会话间寻址、投递思路,但不能直接提供这里要求的 Aurabot 主人私聊作用域、模拟业务结果与原 QQ 回传闭环。这里复用原生 follow-up,不另造通信协议或引入跨进程桥。
|
|
@@ -31,16 +31,16 @@ node package/inspect.mjs
|
|
|
31
31
|
- 执行:`running`、`completed`、`failed`、`timed_out`、`needs_confirmation`、`interrupted`。只有同一模拟任务的工具结果和匹配的正常轮次结束才算完成。确认须由同一主人在原私聊发出完整的 `确认交接 <任务 ID>`,十分钟内有效。此确认仅用于模拟流程。
|
|
32
32
|
- 回传:待投递、已提交原会话、原会话已生成回复、结果不明、关闭回传或过期。正常回复链路没有供模块使用的 QQ 发送回执;**生成回复不代表 QQ 已发送,更不代表对方已读**。结果不明不自动补发。可在主人私聊询问「查交接 <任务 ID>」;这是最小的取回方式,不冒险另外发一条重复通知。
|
|
33
33
|
- 同一模型输入重试提交复用任务 ID;同一模拟步骤持久化领取后只能执行一次;通知先写入投递记录再提交。进程或模块中断后,未结束的任务记为中断,不自动重跑;已提交/结果不明的通知不重发。已经排入 DSH inbox 的消息属于 DSH,无法撤回。暂不支持跨进程、冷 Jarvis 自动恢复、真实 QQ 回执或 OneBot 入口去重保证。
|
|
34
|
-
- Jarvis
|
|
34
|
+
- Jarvis 试验轮只向模型呈现一个无害模拟工具。使用 DSH 的临时限制屏蔽继承的工具,并在 Jarvis 的请求组装阶段过滤会话直接注册的工具。执行守卫拒绝所有其他工具调用。对于从预设继承的 PTC,试验轮用 `presentAs('native')` 临时以原生方式呈现工具。轮次结束后撤销临时限制。无法启用隔离时,任务会在投递前失败。回传轮也临时禁用工具调用。部署时请使用**专用的 Jarvis 测试会话,不配置真实设备工具或自动任务**。
|
|
35
35
|
|
|
36
36
|
## 安装与回滚
|
|
37
37
|
|
|
38
38
|
1. 在目标机运行只读脚本;确认运行中的 desktop 宿主、Aurabot 已激活、主人 QQ 私聊支持模块工具。检查是否已有专用 Jarvis 测试会话和准确 ID。若主人使用“纯聊天”档,先停在这里:不升级现有权限。可在另一步加入受信的显式主人私聊命令入口。
|
|
39
39
|
2. 确认扩展面板显示的用户模块目录。默认是 `~/.dsh/plugins-data/aurabot/modules/`,以面板实际目录为准。检查没有同名模块。把解包所得的 `package/module/` 复制到用户模块目录,命名为 `rez-task-handoff`,确保其中直接包含 `index.mjs` 和 `ledger.mjs`。此动作会触发 Aurabot 热加载;通常无需重启。模块设置默认未启用。请在 Aurabot 的扩展面板确认模块加载,不使用 DSH 的 `plugin add`。
|
|
40
|
-
3. 在 Aurabot
|
|
40
|
+
3. 在 Aurabot 扩展面板填写 Jarvis 完整会话 ID,先只勾选模拟交接。扩展沿用大肥鱼的主人 QQ 设置,升级前保留的同名扩展字段会被忽略。保持目标会话可用。启用后,提交模拟任务将调用配置中的模型,可能产生普通模型用量。开启自动回传后才能在 QQ 收到主动通知。
|
|
41
41
|
4. 回滚:先关闭模块内启用与回传开关,等待测试轮结束,再从扩展面板停用模块,并将 `modules/rez-task-handoff/` 移出扫描目录。只影响这个模块,不覆盖大肥鱼、RezSuite 或桌面应用。账本位于 Aurabot 数据目录下的 `modules-data/rez-task-handoff/tasks.json`,可备份留查;卸载不删除它。已提交到 DSH 或网关的消息不能从模块撤回。
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
升级时,等当前测试和回传结束,停用扩展并将旧目录移出扫描目录,再按相同的模块目录名放入新版。对安装目录中的 `index.mjs` 执行 `touch` 后重新加载,避免压缩包保留的相同修改时间触发 Aurabot 复用旧缓存。账本格式兼容。需要回滚时,按同样方法换回旧目录。查询支持完整任务编号或显示的 8 位短编号,发生短编号冲突时需提供完整编号。
|
|
44
44
|
|
|
45
45
|
## 测试与实机验收
|
|
46
46
|
|
|
@@ -50,7 +50,7 @@ node package/inspect.mjs
|
|
|
50
50
|
node --test test/module.test.mjs
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
原生组合测试:将上游 **v1.1.24**
|
|
53
|
+
原生组合测试:将上游 **v1.1.24** 源码解包到临时目录。在另一临时目录安装 npm 上明确锁定的 `@deepseek-ai/dsh-agent-loop-testkit@0.2.1-rc.5`、`@deepseek-ai/dsh-agent-loop@0.2.1-rc.5`、`@deepseek-ai/dsh-tools@0.2.1-rc.5` 和 `@deepseek-ai/dsh-time-context@0.2.1-rc.5`。测试加载真实模块 API、DSH AgentLoop、时间快照插件和 Aurabot hub,只替换模型和网关,在临时目录写模拟数据。
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
56
|
HANDOFF_DSH_FIXTURE=/绝对路径/临时运行时 \
|
|
@@ -60,4 +60,8 @@ HANDOFF_REAL_DELAY=1 node --test test/native.test.mjs
|
|
|
60
60
|
|
|
61
61
|
2026-11-04 beta.2 结果为 11 项单元测试、1 项原生组合测试通过。Aurabot 从临时用户模块目录加载扩展。两条各约 20 秒的任务(成功和失败)约 42 秒完成,等待期间原会话能继续聊天,后续输出各发送一次到模拟 OneBot。Jarvis 从 PTC 预设继承的工具呈现方式在任务结束后恢复。单元测试覆盖超时、确认、目标丢失、源会话更换、权限隔离、重复提交、模块重启恢复、短编号查询,以及含糊的重试不入队。beta.2 尚未在目标 Mac mini 和真实 QQ 上验证,也未模拟整机断电。Aurabot 面板自身的模拟会话没有真实主人私聊映射。
|
|
62
62
|
|
|
63
|
+
2026-11-04 beta.4 回归测试使用 rc.5 的真实时间快照插件。beta.2 在同一条主人私聊消息后插入时间快照时,返回「交接只接受已授权的主人 QQ 私聊消息」。beta.4 包含 beta.3 的修复,并用 Aurabot 当前主人设置完成授权。测试验证主人私聊可以入队并从原会话回传,桌面输入无法借用前一条 QQ 消息的授权。更换主人时,旧账号的工具调用被拒绝,未开始的旧任务中断。
|
|
64
|
+
|
|
65
|
+
beta.5 的组合测试在 Jarvis 会话直接注册额外的测试工具,复现了 beta.4 在入队后拒绝投递。更新后,发给 Jarvis 模型的工具列表只含模拟工具。即使模拟模型尝试调用隐藏的工具,执行守卫也会拒绝,测试工具没有被执行。轮次结束后原工具列表恢复,模拟结果按原任务编号回到原 QQ 会话。真实 QQ 和目标 Mac mini 待复测。
|
|
66
|
+
|
|
63
67
|
实机顺序:主人私聊发送「让 Jarvis 做交接测试 success」→ 拿到编号 → 立即再聊一句 → 等结果;接着连续发两条(等各自收到编号,避免上游合并为一轮),再分别测 failure、timeout、confirmation。最后用同一任务 ID 查询状态,并验证非主人和群聊不会产生任务。断电/重启测试先把相关工作保存,确认测试实例处于安全状态后单独做。
|
package/module/index.mjs
CHANGED
|
@@ -32,6 +32,7 @@ export function setupHandoff(api, { now = Date.now, delay = sleep, demoMs = 20_0
|
|
|
32
32
|
const agents = ctx?.get?.('agents')
|
|
33
33
|
const registry = ctx?.get?.('tools')
|
|
34
34
|
if (api.version !== VERSION || api.apiVersion !== 1 ||
|
|
35
|
+
typeof api.config !== 'function' || typeof api.isOwner !== 'function' ||
|
|
35
36
|
typeof hub?.sessions !== 'function' || typeof hub?.chatOfSession !== 'function' ||
|
|
36
37
|
typeof ctx?.on !== 'function' || typeof agents?.get !== 'function' ||
|
|
37
38
|
typeof registry?.schemas !== 'function') {
|
|
@@ -48,7 +49,7 @@ export function setupHandoff(api, { now = Date.now, delay = sleep, demoMs = 20_0
|
|
|
48
49
|
|
|
49
50
|
function config() {
|
|
50
51
|
const s = api.settings()
|
|
51
|
-
const owner = String(
|
|
52
|
+
const owner = String(api.config()?.ownerQQ ?? '').trim()
|
|
52
53
|
const target = String(s.jarvisSessionId ?? '').trim()
|
|
53
54
|
if (disposed || broken || s.enabled !== true || !ownerPattern.test(owner) ||
|
|
54
55
|
!idPattern.test(target) || !api.isOwner(owner)) return
|
|
@@ -98,8 +99,11 @@ export function setupHandoff(api, { now = Date.now, delay = sleep, demoMs = 20_0
|
|
|
98
99
|
const e = session.eventAt(seq)
|
|
99
100
|
if (e?.type === 'turn/start' || e?.type === 'turn/end') break
|
|
100
101
|
if (e?.type !== 'user/message') continue
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
const source = e.data?.source
|
|
103
|
+
// DSH rc.5 inserts its clock snapshot after the real QQ message.
|
|
104
|
+
if (source?.kind === 'runtime-context' ||
|
|
105
|
+
(source?.kind === 'time-context' && source.form === 'snapshot')) continue
|
|
106
|
+
if (source?.kind !== 'aurabot') return
|
|
103
107
|
for (const block of e.data.content ?? []) {
|
|
104
108
|
if (block?.type !== 'text' || typeof block.text !== 'string' || !block.text.startsWith(STAMP)) continue
|
|
105
109
|
const permit = permits.get(block.text)
|
|
@@ -237,7 +241,8 @@ export function setupHandoff(api, { now = Date.now, delay = sleep, demoMs = 20_0
|
|
|
237
241
|
let isolationError = 'Jarvis 工具隔离接口不可用,请使用专用的标准会话。'
|
|
238
242
|
try {
|
|
239
243
|
if (typeof tools?.guard !== 'function' || typeof tools?.register !== 'function' ||
|
|
240
|
-
typeof tools?.restrict !== 'function' || typeof agent.
|
|
244
|
+
typeof tools?.restrict !== 'function' || typeof agent.ctx?.on !== 'function' ||
|
|
245
|
+
typeof agent.whenIdle !== 'function') {
|
|
241
246
|
throw new Error('Jarvis 的工具隔离接口不可用。')
|
|
242
247
|
}
|
|
243
248
|
if (registry.schemas(agent).some(t => t.name === 'run_code')) {
|
|
@@ -251,7 +256,8 @@ export function setupHandoff(api, { now = Date.now, delay = sleep, demoMs = 20_0
|
|
|
251
256
|
name: MOCK,
|
|
252
257
|
description: '执行当前交接的唯一无害模拟步骤。无须参数;不可执行系统或设备操作。',
|
|
253
258
|
async execute(_args, exec) {
|
|
254
|
-
|
|
259
|
+
const c = config()
|
|
260
|
+
if (!c || c.chatId !== task.sourceChatId || c.target !== run.target || active !== run ||
|
|
255
261
|
exactId(exec?.agent) !== run.target || run.turn === undefined) {
|
|
256
262
|
return { ok: false, message: '没有可执行的交接。' }
|
|
257
263
|
}
|
|
@@ -276,11 +282,17 @@ export function setupHandoff(api, { now = Date.now, delay = sleep, demoMs = 20_0
|
|
|
276
282
|
return { ok: true, message: run.outcome[1] }
|
|
277
283
|
},
|
|
278
284
|
})))
|
|
285
|
+
// restrict() masks inherited tools. Own registrations also need a wire-level
|
|
286
|
+
// filter, while the execution guard denies calls that ignore that filter.
|
|
287
|
+
run.offs.push(agent.ctx.on('system-prompt/assemble', async (_assembly, context, next) => {
|
|
288
|
+
const prepared = await next()
|
|
289
|
+
if (context.scope !== agent) return prepared
|
|
290
|
+
const schemas = prepared.tools.filter(tool => tool.name === MOCK)
|
|
291
|
+
if (schemas.length !== 1) throw new Error('Jarvis 模拟工具未进入模型请求。')
|
|
292
|
+
return { ...prepared, tools: schemas }
|
|
293
|
+
}, { prepend: true }))
|
|
279
294
|
const remaining = registry.schemas(agent).map(t => t.name)
|
|
280
|
-
if (remaining.
|
|
281
|
-
isolationError = 'Jarvis 仍有额外工具,模拟任务未投递。请使用专用的标准会话。'
|
|
282
|
-
throw new Error(isolationError)
|
|
283
|
-
}
|
|
295
|
+
if (!remaining.includes(MOCK) || remaining.includes('run_code')) throw new Error(isolationError)
|
|
284
296
|
changed(tasks => {
|
|
285
297
|
const t = tasks.find(t => t.id === task.id)
|
|
286
298
|
t.run = { messageId: run.messageId, deadline: run.deadline }
|
|
@@ -441,12 +453,11 @@ export function setupHandoff(api, { now = Date.now, delay = sleep, demoMs = 20_0
|
|
|
441
453
|
export default {
|
|
442
454
|
id: ID,
|
|
443
455
|
name: 'Jarvis 跨会话交接(模拟)',
|
|
444
|
-
version: '0.1.0-beta.
|
|
456
|
+
version: '0.1.0-beta.5',
|
|
445
457
|
api: 1,
|
|
446
458
|
description: '把主人私聊的模拟任务交给指定 Jarvis 会话并回传结果。',
|
|
447
459
|
settings: [
|
|
448
460
|
{ key: 'enabled', label: '启用模拟交接', type: 'switch' },
|
|
449
|
-
{ key: 'ownerQQ', label: '主人 QQ 号(须与大肥鱼设置一致)', type: 'text' },
|
|
450
461
|
{ key: 'jarvisSessionId', label: 'Jarvis 会话 ID', type: 'text' },
|
|
451
462
|
{ key: 'notify', label: '允许回到原 QQ 会话主动通知', type: 'switch' },
|
|
452
463
|
],
|
package/package.json
CHANGED