@dsh-ray/assistant-web-owner 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +336 -2
- package/bin/dsh-autonomy-doctor.js +33 -0
- package/bin/dsh-web-owner-setup.js +33 -0
- package/cordis.patch.yml +6 -0
- package/lib/autonomy-grants.d.ts +295 -0
- package/lib/autonomy-grants.d.ts.map +1 -0
- package/lib/autonomy-grants.js +1218 -0
- package/lib/autonomy-grants.js.map +1 -0
- package/lib/autonomy.d.ts +46 -0
- package/lib/autonomy.d.ts.map +1 -0
- package/lib/autonomy.js +323 -0
- package/lib/autonomy.js.map +1 -0
- package/lib/client.d.ts +58 -0
- package/lib/client.d.ts.map +1 -0
- package/lib/client.js +20016 -0
- package/lib/client.js.map +1 -0
- package/lib/doctor.d.ts +63 -0
- package/lib/doctor.d.ts.map +1 -0
- package/lib/doctor.js +745 -0
- package/lib/doctor.js.map +1 -0
- package/lib/goal-admission.d.ts +94 -0
- package/lib/goal-admission.d.ts.map +1 -0
- package/lib/goal-admission.js +556 -0
- package/lib/goal-admission.js.map +1 -0
- package/lib/goal-setup.d.ts +15 -0
- package/lib/goal-setup.d.ts.map +1 -0
- package/lib/goal-setup.js +145 -0
- package/lib/goal-setup.js.map +1 -0
- package/lib/host-dsh.d.ts +18 -0
- package/lib/host-dsh.d.ts.map +1 -0
- package/lib/host-dsh.js +220 -0
- package/lib/host-dsh.js.map +1 -0
- package/lib/index.d.ts +65 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +319 -0
- package/lib/index.js.map +1 -0
- package/lib/native-client.d.ts +18 -0
- package/lib/native-client.d.ts.map +1 -0
- package/lib/native-client.js +57 -0
- package/lib/native-client.js.map +1 -0
- package/lib/notices.d.ts +15 -0
- package/lib/notices.d.ts.map +1 -0
- package/lib/notices.js +17 -0
- package/lib/notices.js.map +1 -0
- package/lib/repair-setup.d.ts +50 -0
- package/lib/repair-setup.d.ts.map +1 -0
- package/lib/repair-setup.js +192 -0
- package/lib/repair-setup.js.map +1 -0
- package/lib/settings-route.d.ts +7 -0
- package/lib/settings-route.d.ts.map +1 -0
- package/lib/settings-route.js +38 -0
- package/lib/settings-route.js.map +1 -0
- package/lib/setup.d.ts +24 -0
- package/lib/setup.d.ts.map +1 -0
- package/lib/setup.js +601 -0
- package/lib/setup.js.map +1 -0
- package/lib/typert.d.ts +213 -0
- package/lib/typert.d.ts.map +1 -0
- package/lib/typert.js +71 -0
- package/lib/typert.js.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +2 -0
- package/lib/version.js.map +1 -0
- package/package.json +187 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-ray contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,337 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dsh-ray/assistant-web-owner
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
将现有 DSH Web 聊天接到一个已配对的 Delivery owner,让原生用户文本回合能够使用 `assistant-goals` 等依赖可信人类回合的能力。沿用原生 `SessionController`、Typert、Goal UI 和 AgentLoop。
|
|
4
|
+
|
|
5
|
+
## 安装与配置
|
|
6
|
+
|
|
7
|
+
兼容基线见仓库[兼容性基线](../../docs/compatibility.md)(DSH peer 范围 `>=0.2.2-rc.5 <0.3.0`)。这是可独立安装的可选实验性 bundle。本地源码安装可使用现有安装器的显式 Web 场景;默认 `core` 不会自动启用它:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
./scripts/install/install-local.sh --scenario web --workspace /absolute/workspace --yes --no-service
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
该入口安装 core、Delivery、Goals 和 Web owner;先通过本地 `dsh-web-owner-setup` 初始化 owner 与完整 profile 配置,再探测真实 Host 激活。它复用有效 Delivery 数据库路径,固定 principal 为 `web/<profile>/local/operator`。不配置飞书或常驻服务,不会自行更改全局模型/权限选择;模型设置和验证仍沿现有安装器选项。完整目标执行、独立验收和隔离配置并未因此自动完成。
|
|
14
|
+
|
|
15
|
+
单独使用 CLI 时先安装这些 bundle,停止目标 Host,再运行 `dsh-web-owner-setup --profile web --workspace /absolute/workspace`。它保留 YAML 标签、自定义配置和 Policy 规则;重复运行保留 owner ID/version、已有绑定和任务。修改过的受管规则或不同 owner/scope 会拒绝覆盖。新增精确 owner 的外部 ingest/capability 规则只提供能力可达性,现有 deny、原生 sandbox 和审批约束仍生效。
|
|
16
|
+
|
|
17
|
+
Web principal 必须是 `channel: web`,其 account、tenant、user 由可信本地安装者固定。安装器使用 `ensurePrincipalLocally()`:只在空库初始化,或原样保留完全匹配的 active owner,不替换其他 owner、不复活已撤权身份。已有 Lark 或不同 owner 使用同一数据库时会拒绝,可为独立部署选择另一个 `DSH_HOME`。高级离线交接 API `pairPrincipalLocally()` 仍保留其原本的显式交接语义;本安装器不调用它。当前不支持跨渠道 owner 别名或多用户 Web 身份映射。
|
|
18
|
+
|
|
19
|
+
本 bundle patch 先禁用上游 `session-controller` 行,再插入 `dsh-ray-assistant-web-owner`。在该 bundle 后追加完整配置 patch:
|
|
20
|
+
|
|
21
|
+
```yaml
|
|
22
|
+
- id: dsh-ray-assistant-web-owner
|
|
23
|
+
name: '@dsh-ray/assistant-web-owner'
|
|
24
|
+
config:
|
|
25
|
+
principal: { account: local, tenant: local, user: operator }
|
|
26
|
+
workspace: /absolute/workspace
|
|
27
|
+
preset: standard
|
|
28
|
+
maxExecutionMs: 300000
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
安装后用 `dsh --profile <测试配置> --dump-config` 检查:只有本 bundle 的 Controller 激活,owner 和作用域与本地配对一致。卸载 bundle 会移除本层禁用 patch,恢复原 Controller;Delivery 的持久 Session 归属保护仍生效。
|
|
32
|
+
|
|
33
|
+
`workspace` 必须是绝对路径,`preset` 必须与实际原生 preset 一致。`maxExecutionMs` 为每次 Agent 激活的最大时间,范围 1–300000 毫秒,默认 300000。原生 factory 的冷加载也使用这一取消期限。空闲 Agent 清理后释放 Session 给 Delivery/Automations;未证明完成清理的执行保持 unknown。
|
|
34
|
+
|
|
35
|
+
原生 Goal 仍为 `active` 且 `armed` 时,即使 Agent 暂时 idle,也会保留它和原 Session lease,等待宿主 GoalRoundDriver 完成保存并续跑。目标终态或 disarm 后再释放;执行期限、撤权和卸载仍优先生效,不因新目标轮重置。缺少 GoalRoundDriver 时最多保持到原执行期限,此检查不另行调度任务。
|
|
36
|
+
|
|
37
|
+
Policy 至少需要显式允许该 `web/account/tenant/user` 的 `ingest`,以及该 principal、workspace、preset 下需要的 Agent `reply`、工具执行和 Goals/Memory 操作。配对不会自动放宽 Policy。
|
|
38
|
+
|
|
39
|
+
### 渠道无关 Web-owner 自主授权(`--autonomy-setup`)
|
|
40
|
+
|
|
41
|
+
完成 Web owner 配对并启动一次会话认领 owner 身份后,停止目标 Host,可直接通过 CLI 或在「文鳐」控制台向导一键生成与渠道解耦的有限自主授权(也可以只传任意自主子模块开关,会自动触发 `--autonomy-setup`):
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
dsh-web-owner-setup --dsh-home "$DSH_HOME" --profile web \
|
|
45
|
+
--autonomy-setup --enable-memory-learning --enable-dreaming --enable-growth \
|
|
46
|
+
--usage-learning --work-item-experiences --budget-tier conservative --dry-run --json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
常用参数与安全边界:
|
|
50
|
+
|
|
51
|
+
- **模块开关**:`--enable-memory-learning` / `--disable-memory-learning`、`--enable-dreaming` / `--pause-dreaming`(保持 `enabled: true, retired: true` 安全休眠并保留 owner 想法流转权限)/ `--retire-dreaming` / `--disable-dreaming`、`--enable-growth` / `--disable-growth`、`--usage-learning`、`--work-item-experiences` / `--no-work-item-experiences`。
|
|
52
|
+
- **模型与预算档位**:`--model-provider`、`--model-id`、`--reasoning-effort`(缺省回退至 `agent-default-model`,缺失模型路由或 ACP provider 未启用时 fail-closed 拒绝);`--budget-tier <conservative|balanced>`(默认 `conservative`:`10/2/5/1440`;`balanced`:`25/6/15/1440`)、`--daily-budget <n>`(正整数覆盖)与 `--lease-days <1..365>`(默认 `30`),可选 `--dry-run`、`--json`。
|
|
53
|
+
- **三权分立与不变量**:`compileWebOwnerAutonomyGrants` / `applyWebOwnerAutonomySetup` 绑定当前激活的 Web `ownerRoutes` 权威收据(`ownerRouteAuthorityHash`),分别签发相互独立的提取(`assistant-memory-learning`)、复核(`assistant-verifier`)与采用(`personal-memory`)三权 `authorityId` 及精确加密摘要,并将 `assistantPolicy` 规则(含 `assistant-growth-usage`、`usage-*`、`growth_*`、`verified-workflows` 与 dreaming owner 动作)按 `id` 幂等合并;完整保留既有自定义策略、`!!js` 表达式与 `allowUnbudgetedExecution: false`,拒绝未限定至 `$DSH_HOME` 的数据库路径。按需仅加载所启用且在目标 profile 存在的子系统配置,不强依赖未安装的可选插件,也绝不将配置授权成功等同于真实模型质量或长期普通使用效果达标。
|
|
54
|
+
|
|
55
|
+
## 当前行为与限制
|
|
56
|
+
|
|
57
|
+
- 启动时在 owner 已证明后解析或注册配置 workspace;配置路径必须是实际路径(`realpath`),避免 Delivery scope key 漂移。原生界面使用该 workspaceId,Controller 保留工作区与会话关联;直接调用可省略位置或提供相同 cwd。其他 workspaceId、不同 cwd/preset 或外部 Session ID 均拒绝。同一请求不能同时提供 cwd 和 workspaceId。
|
|
58
|
+
- 文本先以确切 Inbox 原子领取,再通过原生 `source.kind=user`、requestId、内容和实际 inserted/claimed 消息对象建立一次性证明。只复制来源标签或重发相同文本不能获得第二次准入。
|
|
59
|
+
- Session 列表、搜索、历史、控制流、技能目录及 `api-session/*` 广播过滤非 owner 会话;原生 Goal RPC 的 Agent lookup 使用同一受限入口。
|
|
60
|
+
- 空闲释放只回收内存 Agent,保留已持久化的会话和界面选择;再次输入沿原生恢复路径执行。不会把原生 `session/disposed` 当作持久会话删除。
|
|
61
|
+
- 忙时拒绝新的输入,当前不支持输入图片、fork、子 Agent 历史地址或任意宿主路径打开。排队/steer 的完整交互、附件的一次性准入与长期跨日运行仍待完成。
|
|
62
|
+
- 中断的 native Inbox 不转成普通 Delivery 消息重放,包括尚未调用原生 prompt 的崩溃窗口。已有 Session/Goal/业务记录保留。
|
|
63
|
+
|
|
64
|
+
Web Session Controller 的 Host 与 browser 两半都从当前 DSH 安装解析。本包通过只含一个精确源码入口的内存 Loader 子树,将原生包的 client 元数据与已有 owner-scoped Host 包装绑定:浏览器加载该 Host 自带的 Session client,而非构建时复制的旧版本。子树不启动未过滤的上游 Host Controller,不写 profile 或 node_modules,随 owner Fiber 卸载;无法解析当前 Host 的公开 Loader/Controller 契约时拒绝启动,不回退到旧客户端。本包自己的 browser 产物只实现主动提醒,不再复制 Session RPC、提交队列或 UI 状态。
|
|
65
|
+
|
|
66
|
+
当 Delivery 接受了同一 owner Session 的主动提醒时,输入框上方会显示“主动提醒”区域。该区域通过严格 Typert `deliveryNotices.list(sessionId)` 读取,并在每次读取结束后约两秒发起下一次读取;切换会话、断开连接、撤权或读取失败会清空旧内容。当提醒因 Delivery `attentionAttachOverCap` 转为纯文本附件时,`DeliveryNotice.attachment` 会经严格 schema 透传只读 UTF-8 附件(`kind: 'text'`、`name`、`mediaType: 'text/plain' | 'text/markdown'`、`text`、`sha256`),前端仅以纯文本 `<pre>` 有界预览(至多 16,384 字符,不解释 HTML)或安全文件名 `Blob` 下载完整 UTF-8 原文。提醒与附件均保持独立于聊天记录,不会伪装成用户或模型消息,也不会触发模型、创建 Session 或改变提醒状态。Host 每次读取重新校验固定 Web owner 能力、owner lineage 和期限;提醒只会在 Delivery 已通过实时背景 `send` Policy 后被接受,不属于该主人的 Session 请求会被拒绝。
|
|
67
|
+
|
|
68
|
+
E3a-W 增加了严格 Typert `deliveryNotices.ack(sessionId, ids, status)`:列表成功渲染后对未 ack 的提醒写 `delivered`,点击提醒摘要时写 `read`(展开/下载附件操作本身不会误触发 `read` ack)。Host 重新校验绑定 Session、owner/route/Policy/期限、native-notice metadata、附件摘要与 outbox 归属,整批校验后才写 receipt;foreign session、非 notice、越界/畸形 id、过期、撤权漂移、附件摘要失效或 withdrawn notice 整批拒绝且零写入。
|
|
69
|
+
|
|
70
|
+
### notice ack 已知边界(E3a-W)
|
|
71
|
+
|
|
72
|
+
- **R2 点击语义**:UI 的“点击确认”只是把 owner 的 viewed 动作映射为 `status=read`,不宣称用户已阅读正文、理解内容或完成任何任务;提醒文本仍只用于显示,不进入模型上下文。
|
|
73
|
+
- **R3 不进 E3a deliveryState**:Web notice adapter 未声明 `readReceipts`,所以 Web 的 ack receipt 不会让 Evaluation 进入 classifier v2 的 read/ignored/missed 投影;它只影响 Delivery outbox 的 accepted/delivered/read 状态。Evaluation 的 E3a deliveryState 仍只由显式声明 coverage 的通道事实驱动。
|
|
74
|
+
- **R5 top-100 边界**:ack 在绑定内最多扫描最近 100 条 outbox;client 的 list 只展示最近 50 条未读。更早/已滚出窗口的 notice id 无法 ack,按整批拒绝处理,避免绕过大范围查询。
|
|
75
|
+
- **R7 delivered 是 owner 客户端自报**:delivered 只表示绑定 owner Session 的客户端成功 list/渲染并提交 ack,不是飞书/Web provider 的送达证明;信任边界是已绑定 Session + Host 重校验,不是网络回执。read 同理只是点击自报。
|
|
76
|
+
- **R8 ack 失败静默重试**:delivered ack 失败不会显示错误,下一次 list 轮询会重试未标记的 id;read 点击失败静默丢弃且不自动重试。重复 delivered ack 由 Host 幂等处理;迟到 lower-rank ack 不写 receipt、不回退状态。
|
|
77
|
+
|
|
78
|
+
## 权限与数据
|
|
79
|
+
|
|
80
|
+
运行时不创建监听端口、凭证或浏览器认证,复用已有的已认证单 owner Web 控制面。离线 setup CLI 调用本机 `dsh --dump-config` 读取配置,不执行任意 YAML JS;写入目标 profile patch、Delivery owner 数据库和所选工作区目录,使用安装锁与原子文件替换。配对与 YAML 不能跨库原子提交,写文件失败可能留下尚未启用的首次身份;同身份重试不会轮换权限。CLI 不读取凭证存储、不发模型请求,也无安装生命周期脚本。
|
|
81
|
+
|
|
82
|
+
运行时通过宿主服务驱动 Agent 已有的文件、网络、子进程、凭证和浏览器能力,仍受 Policy 与原生审批约束。
|
|
83
|
+
|
|
84
|
+
Delivery 保存 Web owner/binding、Inbox 文本、内容摘要、尝试与租约;原生 Session 保存实际对话。返回的固定 capability 只给受信 Host 配置使用,并非对同进程插件或同 UID 进程的 OS 隔离边界。
|
|
85
|
+
|
|
86
|
+
单元与组合测试覆盖实际 AgentLoop、SessionController、Typert Gateway、双事件订阅、SQLite、业务 Goal 及空闲后恢复。另有独立浏览器命令 `CI=true pnpm test:web-owner`:全新临时 profile 安装、真实认证/HTTP/WS、原生审批、Goal 落库、Host 重启后新浏览器上下文恢复同一会话,详见仓库 `scripts/e2e/README.md`。模型仍为确定性 adapter;这些证据不证明真实模型收益、可信目标达成或长期自治。该命令需要本地 DSH 与 Chromium,不包含在普通 `pnpm check` 中。
|
|
87
|
+
|
|
88
|
+
可选的 `CI=true pnpm test:web-owner:real` 使用现有 Codex subscription 登录,验证真实模型生成程序、原生目标续跑、独立步骤/整体回执以及最终释放。它有精确工具范围和模型调用/时间上限,属于有引导的小任务实验,不证明长期自治、生产 token/费用硬预算或 OS 隔离;前置条件与证据边界见同一浏览器说明。
|
|
89
|
+
|
|
90
|
+
## 有限离线执行安装
|
|
91
|
+
|
|
92
|
+
仓库安装器 `--scenario autonomy` 接通同一套有界 Web owner setup。隔离后端仅支持 `linux-native`;Docker 隔离后端已彻底移除,`--isolation-image` 不再接受,显式 `--isolation-backend docker` 会明确拒绝。普通 Web setup 不加载 Isolation;显式选择 autonomy 时需安装匹配版本的 Isolation、Actions 和 Keychain。
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
# Linux:固定当前安装包版本的官方 tag,准备独立工具链后执行真实 native probe
|
|
96
|
+
./scripts/install/install-local.sh --scenario autonomy --workspace /absolute/workspace --yes --no-service
|
|
97
|
+
|
|
98
|
+
# 本地开发:只使用此仓库的 committed HEAD,不包含未提交的工作区修改
|
|
99
|
+
./scripts/install/install-local.sh --scenario autonomy --isolation-backend linux-native \
|
|
100
|
+
--isolation-source-repository /absolute/repository --workspace /absolute/workspace --yes --no-service
|
|
101
|
+
|
|
102
|
+
# 已有 Docker isolation 的 profile 不会被就地改写;必须先显式迁移为 linux-native
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
| 参数 | 默认值 | 边界 |
|
|
106
|
+
| --- | --- | --- |
|
|
107
|
+
| `--isolation-backend` | `linux-native`(唯一支持值) | native 需要非 root Linux、受支持的 user namespace、已委派的 cgroup v1 四控制器或统一 cgroup v2 子树及原生探测通过;不自动安装系统前提 |
|
|
108
|
+
| `--isolation-source-repository` | 无 | native 可选的规范绝对仓库路径;冻结 committed HEAD,版本固定取本安装包 package.json;省略时只读取固定官方同版本 tag |
|
|
109
|
+
| `--isolation-max-runs` | `20` | 有限 grant 最大次数(1–10000) |
|
|
110
|
+
| `--isolation-lease-minutes` | `60` | grant 原始期限(1–10080 分钟);setup CLI 对应 `--isolation-lease-ms` |
|
|
111
|
+
| `--isolation-runtime-minutes` | `10` | 累计保留运行时预算(1–1440 分钟);setup CLI 对应 `--isolation-runtime-ms` |
|
|
112
|
+
|
|
113
|
+
`dsh-web-owner-setup` 同样只接受 linux-native backend/source 选择,Docker image 选项已移除;程序化输入为 `isolation: { backend: 'linux-native', source?: { kind: 'official-tag' } | { kind: 'local-head', repository }, maxRuns, leaseMs, maxTotalDurationMs }`。纯 profile materializer 接受的是已解析 `linux: { runtime, cgroupRoots }`,不解析 Git、不下载、不配对、不产生授权。
|
|
114
|
+
|
|
115
|
+
setup 在 profile 锁内先静态验证合并配置、受管 grant、backend 与路径,再冻结来源、准备/读取工具链、发现 cgroup 根并执行真实 native probe;这些资源失败发生在 owner 配对与 grant/patch 写入之前。runtime 位于真实 `DSH_HOME/rsi-linux-runtimes/<profile>/runtime`,不得与 Isolation stateRoot 重叠;其 source/lock/tree/收据身份由共享资源 API 核对。native 资源通过后才初始化 owner 并原子写入有限 grant。相同配置重放只读取已有 native 收据,不重新构建、不延长 grant、不重置持久用量、不更换 revision,也不替换或复活 owner;source/descriptor/backend/grant 漂移拒绝并要求明确迁移。已存在的 Docker profile 不会被静默改写,setup 会以明确迁移错误拒绝。
|
|
116
|
+
|
|
117
|
+
`dsh-autonomy-doctor` 只校验持久 linux-native runtime 并执行 native probe。它不调用 freeze/prepare、不下载、不配对、不写授权或续期,不激活第二个 Host;通过仅是当前资源、owner 与有限 grant 的诊断快照,不证明模型、Goal 独立验收或外部 Actions 已配置。同一入口还提供只读的普通使用学习就绪快照(`--readiness`,见下文)。
|
|
118
|
+
|
|
119
|
+
Isolation、Actions、Keychain、Skills 与 Proactive 的可变状态路径均规范化到真实 `DSH_HOME` 内,Skills 的嵌套比较/留出 `stateRoot` 也受同一约束;已有祖先 symlink 逃逸拒绝。旧 Skills/Proactive published-default SQLite 或 sidecar 若已有数据,不静默切换位置,必须先停 Host 并显式离线迁移。setup 在失败前可能创建工作区/资源目录,owner 数据库与 patch 不能跨库原子提交。
|
|
120
|
+
|
|
121
|
+
native 资源准备会使用固定官方 Git tag/官方工具链下载、Git/归档/Node/pnpm 子进程和 Home 内私有 staging;不调用 Lark 完整准备、不改 Control Plane、不启服务、不配置外部凭据。未知清理状态的探测目录保留排查。有限 Goal admission 可沿用持久 native descriptor 配置独立 `isolated-runner` 验收,见下节;普通 native probe 通过本身不证明 held-out 验收、完整自治或长期自治。具体安装前提见[安装说明](../../scripts/install/README.md)。
|
|
122
|
+
|
|
123
|
+
## 有限 Goal admission(实验性)
|
|
124
|
+
|
|
125
|
+
在已完成 `autonomy` 安装后(linux-native backend),可用一次离线 setup 把**一个已有、空闲的 Web owner Session**配置为固定 DeepSeek 路由、有限 Goals 预算、独立隔离验收条件和可选 wake route。先停止目标 Host;准备工作区之外、当前用户所有且权限为 `0600` 的 JSON 任务文件。不要把 API key 写进文件,`apiKeyEnv` 只是 credential reference。
|
|
126
|
+
|
|
127
|
+
admission 只复制该 profile 已持久化的 `runtime` 与 `cgroupRoots`,在原 `isolated-runner` authority 中明确设置 `backend: linux-native`,不混入任何 image/dockerPath 字段。它不重新 freeze/prepare、不发现 cgroup、不下载或迁移 backend;编译通过不表示真实 Linux 执行已成功。Docker authority 已随后端一并移除。
|
|
128
|
+
|
|
129
|
+
admission 沿用已有 owner/session/scope 围栏、grant 的原绝对 `expiresAt`、任务的有限验证次数/累计时限/单次时限/输出上限与私有测试用例。native descriptor 与 cgroup 值进入独立 authority digest;同 owner/任务重放保持相同配置,不续期、不重置原 Isolation 或 Verifier 用量。已配置 authority 后发生 runtime/cgroup/验证预算漂移会拒绝覆盖;owner/scope 不匹配、grant 过期或持久预算不可用也拒绝。实际验收仍通过既有 Goals 可信 producer、成功且 quiescent 的 accepted artifact 与 Verifier 私有 held-out 进程结果;模型报告、普通工具退出或 setup 成功都不能代替它。
|
|
130
|
+
|
|
131
|
+
先用正式 setup 入口列出当前 owner 的真实空闲 Session;它只读取匹配当前 Web principal、workspace 和 preset 的 Delivery binding,绝不创建或伪造原生 Session。新 profile 需要先从原生 Web UI 打开一次,让 DSH 创建 Session。`--session-id` 可显式选择;省略时只有一个合法空闲 binding 才会自动选择,多个候选会原样列出并拒绝继续。
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
# 已完成 autonomy 安装;Host 停止后执行
|
|
135
|
+
chmod 600 /private/goal-admission.json
|
|
136
|
+
dsh-web-owner-setup --profile web --workspace /absolute/workspace --list-goal-sessions
|
|
137
|
+
dsh-web-owner-setup --profile web --workspace /absolute/workspace \
|
|
138
|
+
--goal-admission /private/goal-admission.json
|
|
139
|
+
|
|
140
|
+
# 应用 patch 后才重启目标 Host
|
|
141
|
+
dsh --profile web --no-open
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
重启后,在已有 Session 的模型选择器中选择 `deepseek-goal-metered` 下与任务一致的模型,再发送原始 objective。CLI 只配置默认路由;已有 Session 和用户 settings 保存的模型选择仍会保留,不会自动迁移到新模型。
|
|
145
|
+
|
|
146
|
+
可用任务文件如下。每个字段都是有限值;未知字段、成本上限字段、明文凭据、模型别名和任意 endpoint 都会拒绝。
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"version": 1,
|
|
151
|
+
"objective": "Create a shell program that reads two integers and prints their sum",
|
|
152
|
+
"model": "deepseek-v4-flash",
|
|
153
|
+
"apiKeyEnv": "DEEPSEEK_API_KEY",
|
|
154
|
+
"maxGoalRounds": 3,
|
|
155
|
+
"stepMaxDurationMs": 60000,
|
|
156
|
+
"executionBudget": {
|
|
157
|
+
"modelCalls": 6,
|
|
158
|
+
"toolCalls": 3,
|
|
159
|
+
"inputTokens": 2100000,
|
|
160
|
+
"outputTokens": 6000,
|
|
161
|
+
"durationMs": 240000,
|
|
162
|
+
"maxOutputTokensPerCall": 1024
|
|
163
|
+
},
|
|
164
|
+
"verification": {
|
|
165
|
+
"artifactPath": "answer.sh",
|
|
166
|
+
"command": "/bin/sh /workspace/artifact < /workspace/input",
|
|
167
|
+
"maxRuns": 12,
|
|
168
|
+
"maxTotalDurationMs": 240000,
|
|
169
|
+
"maxDurationMs": 20000,
|
|
170
|
+
"maxOutputBytes": 4096,
|
|
171
|
+
"cases": [
|
|
172
|
+
{ "stdin": "19 23", "expectedStdout": "42", "expectedExitCode": 0 },
|
|
173
|
+
{ "stdin": "-8 5", "expectedStdout": "-3", "expectedExitCode": 0 }
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
"wake": { "maxDelayMs": 60000, "runTimeoutMs": 90000, "maxRuns": 3 }
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
该 v1 格式保留固定 `deepseek-v4-flash` 或 `deepseek-v4-pro` 路径,endpoint 不可配置。每次目标模型调用会保守预留至少 `2,097,152` 输入 tokens;当前没有 USD 硬预算,任务不得添加 `costUsdMicros`。
|
|
181
|
+
|
|
182
|
+
v2 可使用安装器已经配置且实际出现在 `agent-default-model` 的任意精确 provider/model,例如 `custom-gateway` / `configured-model-id`。它不会写入 provider、endpoint 或 secret 配置:`route` 必须与已配置默认 route 完全相等,且 calls budget 的唯一 `routes` 项必须与它相同。启用后台唤醒时,setup 同时将 Delivery 的默认 provider/model 和输出上限设为这条已授权线路,保证恢复使用相同线路;运行时仍逐次检查预算。
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"version": 2,
|
|
187
|
+
"objective": "Verify the generated artifact",
|
|
188
|
+
"route": { "provider": "custom-gateway", "model": "configured-model-id" },
|
|
189
|
+
"maxGoalRounds": 2,
|
|
190
|
+
"stepMaxDurationMs": 60000,
|
|
191
|
+
"executionBudget": {
|
|
192
|
+
"mode": "calls", "modelCalls": 3, "toolCalls": 3,
|
|
193
|
+
"durationMs": 120000, "maxOutputTokensPerCall": 8192,
|
|
194
|
+
"routes": [{ "provider": "custom-gateway", "model": "configured-model-id" }]
|
|
195
|
+
},
|
|
196
|
+
"verification": { "artifactPath": "result.txt", "command": "node verify.mjs", "maxRuns": 4, "maxTotalDurationMs": 100000, "maxDurationMs": 20000, "maxOutputBytes": 4096, "cases": [{ "stdin": "one\n", "expectedStdout": "one\n", "expectedExitCode": 0 }] }
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
v2 的硬限制是模型请求数、工具请求数、总时长和每次输出上限;若 adapter 提供 usage,会作为记录使用,但不是 token 或 USD 硬限制。重复相同 admission 不改变 patch 字节、不会续期 Isolation grant、不会重置已用次数或扩大预算。与本次任务要求冲突的已有受管配置或同 ID 条目会拒绝,而不是被覆盖。
|
|
201
|
+
|
|
202
|
+
### 验收后仓库交付
|
|
203
|
+
|
|
204
|
+
v2 任务可增加 `repositoryDelivery`,继续使用同一个 `--goal-admission` 命令。字段为 `repository`(例如 `owner/project`)、`baseBranch`、`branch`、`paths`、`credentialHandle`、`expiresAt`(明确的 Unix 毫秒到期时间)、`maxActions`、`maxTotalBytes` 和 `openPullRequest`,另可显式设置 `acceptance: "goal-step"` 允许独立步骤验收后的中间提交。省略时为 `goal-outcome`,继续要求整体验收;CLI 会显示实际模式。当前 `paths` 只允许包含本任务的 `verification.artifactPath`,因为只有该文件具备配置的独立验收。目标分支必须已存在,PR 基准分支必须与它不同。
|
|
205
|
+
|
|
206
|
+
`credentialHandle` 引用已配置在 Keychain 中的凭据;该 handle 必须使用可静态读取的无标签配置,允许 `dsh-ray-assistant-actions` 消费者与 `github.commit` 用途,且 `maxLeaseMs` 不小于 30,000。任务文件不接受 token,也不会创建或修改 handle。`expiresAt` 必须覆盖配置时刻后的整个目标执行预算并额外预留 60 秒交付时间,同时不超过当前隔离授权期限;重复设置不会续期。`maxActions` 同时计入仓库读取与提交、PR 操作:仅提交至少 2 次,创建 PR 至少 3 次;额外调查需要更多次数。
|
|
207
|
+
|
|
208
|
+
设置命令从已有主人和空闲 Session 派生 Actions grant、owner route、有限调度预算及精确 Policy 规则,包含后台提交与原会话通知;无需用户填写内部身份、路由或规则 ID。未提供 `wake` 时自动配置至多一次后台运行;已有合法 `wake` 配置继续使用。已有同 ID 配置冲突会拒绝整次配置,而不会覆盖。正式 CLI 在取得配置锁后及写入前重读有效配置,发现下层凭据或插件配置变化时拒绝;多文件配置与数据库仍不构成一个跨进程原子事务。所需 Actions、Keychain、Goals、Automations 与 Delivery 必须来自匹配的安装集合。
|
|
209
|
+
|
|
210
|
+
重启 Host 后,在原会话提交与配置一致的目标,并说明需要交付到已授权仓库。模型可查询可用授权、读取目标分支 head、修复隔离产物并登记交付;独立步骤和整体验收通过后由后台提交准确产物、按授权创建 PR,并主动显示最终结果。步骤模式允许原目标保持 active 或 paused。可选 `repositoryDelivery.outcome` 将整体验收绑定到实际提交的 CI/评审新鲜回读;省略时仍使用本地隔离产物条件。设置命令只证明配置和当前身份匹配;凭据是否可用、远端仓库访问和真实 GitHub 提交仍须实际运行验证。本机端到端测试的 GitHub 传输是明确替身,不能视为真实 GitHub 认证成功。
|
|
211
|
+
|
|
212
|
+
外置 `external-unix-v1` broker 部署使用 `externalGrantId` 替代 `credentialHandle`,并预先安装 operator 签发的精确 grant projection。CLI 核对 owner、Session、仓库、路径、期限、限额与 admission route,不签发 grant、不复制凭据。外置模式的 `events` 仅包含下面的次数和时间字段,省略 `credentialHandle`;事件轮询通过 Actions 的 broker 观察接口执行。配置要求既有 grant 的 `maxActions ≥ 3 + 12 × maxGoalRounds + 4 × maxPolls`、`maxCostUnits ≥ 3 + 18 × maxGoalRounds + 6 × maxPolls`,不会自动扩额或续期。这是最低容量预检;运行时实际调用仍共享 broker 的有限账本。
|
|
213
|
+
|
|
214
|
+
需要仓库整体验收时,在 `repositoryDelivery` 中设置 `acceptance: "goal-step"`、`openPullRequest: true`,并增加:
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
"outcome": {
|
|
218
|
+
"requiredChecks": [{ "name": "tests", "appId": 12345 }],
|
|
219
|
+
"reviewerIds": [67890], "minApprovals": 1,
|
|
220
|
+
"timeoutMs": 10000, "freshnessMs": 30000
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
上述名称和数字应替换为目标仓库实际要求的 check 名称、GitHub App ID 和 reviewer ID。每次验收重新读取 checks、reviews、PR 和 branch,要求同一提交 head、全部指定 checks 成功及足够当前评审通过;pending 或截断结果不能完成目标。至少配置 `maxActions: 7`(读取初始 head、commit、PR、四次验收读取),重试与后续事件需要额外有限次数。总目标时长还须覆盖步骤执行、本地验收和 `outcome.timeoutMs`。
|
|
225
|
+
|
|
226
|
+
直接提交后等待 CI 时,设置 `openPullRequest: false`、`acceptance: "goal-step"`,并使用以下 outcome;不需要 PR 或审查账号:
|
|
227
|
+
|
|
228
|
+
```json
|
|
229
|
+
"outcome": {
|
|
230
|
+
"mode": "commit",
|
|
231
|
+
"requiredChecks": [{ "name": "verify", "appId": 15368 }],
|
|
232
|
+
"timeoutMs": 10000, "freshnessMs": 30000
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
检查名称和 app ID 须对应目标仓库实际 check-run。此模式拒绝 reviewer 字段及 PR 授权混用,独立验收只读取本目标最新成功交付收据的提交 SHA,并复核当前分支仍指向它。单次交付及验收至少需要 4 次 Actions 操作;配置事件时为 `2 + 6 × maxGoalRounds`,外部 broker 另加 `2 × maxPolls`,对应 cost units 相同。外部授权 inspect kinds 为 `repository`、`branch`、`file`、`commit-checks`,操作仅 `commit` 与 `inspect`。省略 outcome.mode 保留原 PR 验收模式。
|
|
237
|
+
|
|
238
|
+
需要等待 CI/评审变化时,同一 `repositoryDelivery` 可显式增加 `events`:
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
"events": {
|
|
242
|
+
"credentialHandle": "github-observe",
|
|
243
|
+
"maxPolls": 180, "maxFires": 4,
|
|
244
|
+
"pollIntervalMs": 2000, "requestTimeoutMs": 10000
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
须安装匹配版本的 EventTriggers,且上述 Keychain handle 已允许 `dsh-ray-event-triggers` / `github.observe`。CLI 创建绑定当前 owner、仓库及分支的正式来源、有限无模型 observer 和 Goals 等待权限;Goals 向模型公开当前授权范围内的来源 ID。设置不会验证远端连通性。`maxPolls` 必须大于 `maxFires`,`maxGoalRounds` 至少为 2;`maxActions` 须覆盖 `3 + 12 × maxGoalRounds`(每轮最多三次四读验收),显式 wake 的 `maxRuns` 至少为 `maxFires + 1`。不足时拒绝配置,不自动扩额。观察期限沿用明确的 `repositoryDelivery.expiresAt`,重复设置不续期。完整真实 GitHub 生命周期仍须实际验证。
|
|
249
|
+
|
|
250
|
+
每个验收 profile 的验证窗口为 `verification.maxDurationMs × verification.cases.length`,必须小于 `stepMaxDurationMs`。未配置仓库 outcome 时两个 profile 都使用该窗口;因此 `executionBudget.durationMs` 必须严格大于 `stepMaxDurationMs + 2 × 验证窗口`,以覆盖 native round、step 验收和 whole-goal 验收。setup 会拒绝不足的明确预算,不会自动扩大时长或权限。
|
|
251
|
+
|
|
252
|
+
该精确 Session 仅用于核验 owner 和可选 wake route;生成的 profiles 绑定 owner、scope 和 objective。setup 只写入并复核本地配置、已有 owner snapshot 与持久 grant;它不发 DeepSeek 请求、不创建 Goal、不证明凭据可用、网络连通、模型质量、隔离验收成功或完整 WP17/长期自治已经完成。grant 已过期、撤销、耗尽,owner/version 改变,或 Session 有 pending/dispatched/unknown lease 时必须先按正常运维流程处理,不能靠重跑此命令续权。
|
|
253
|
+
|
|
254
|
+
发布文件同时包含 `dsh-autonomy-doctor --profile web`。此 CLI 读取有效 profile 和当前 Delivery owner、Isolation grant/累计预算快照,再对持久 linux-native runtime 运行独立探测,最后复核配置/授权没有失效;不会开启第二个 Host、配对 owner、迁移数据库、续期 grant 或重置预算。使用 SQLite 只读连接,不读取凭据/业务产物,也不请求模型。缺失或不支持的 schema、owner 版本改变、撤销、过期、耗尽和配置不一致都失败。当前支持已审查的 Delivery schema 24–31、Isolation schema 7/8/9 和安装器的单一受管 grant;要求匹配本批源码的 Isolation diagnostics API,缺失该 API 时明确要求升级,不回退到忽略持久授权的探测。安装或升级时应使用同一套件版本的 Web owner 与 Isolation,以保持此诊断接口一致。
|
|
255
|
+
|
|
256
|
+
结果只说明有限隔离检查,不能替代动态 Policy、实时资源准入、模型硬预算、Goal 验收或外部 Actions 检查。该 CLI 的临时探测使用现有 Isolation 资源边界和清理规则;未知清理保留证据,不消耗业务 grant。
|
|
257
|
+
|
|
258
|
+
### 只读自治就绪快照(`--readiness`)
|
|
259
|
+
|
|
260
|
+
`dsh-autonomy-doctor --readiness [--profile <name>] [--dsh-home <absolute>]` 只读取组合后的有效 profile(`dsh --dump-config`),输出确定性文本和最终一行可解析 JSON(协议 `dsh-ray/autonomy-readiness/v1`)。它不激活 Host、不请求模型、不写状态、不读数据库,也不读取凭据内容。检查环:
|
|
261
|
+
|
|
262
|
+
| 环节 | 就绪条件(静态) | 未就绪时的典型原因 |
|
|
263
|
+
| --- | --- | --- |
|
|
264
|
+
| `bundles` | personal-assistant、WorkItems、Delivery、Evaluation、Verifier、event-triggers、Memory learning、Growth Driver、Proactive、Control Plane 均已安装且 loader 行未禁用 | 缺包、行 disabled |
|
|
265
|
+
| `work-items-observe-intake` | `enabled: true`、`mode: observe`、`intakeLedger.enabled: true` | 未启用、active 模式、intake 关闭 |
|
|
266
|
+
| `intake-evaluator` | WorkItems `intakeLedger.evaluation.enabled` 与 Proactive `intakeEvaluation.enabled/provider/model/rules` 合法 | 生产者关闭、模型/规则缺失或非法 |
|
|
267
|
+
| `delivery-natural-feedback` | Delivery 已加载(自然反馈解析随包提供);同时报告 WorkItems 报告反馈/续办开关 | Delivery 缺失 |
|
|
268
|
+
| `background-learning` | Memory `workItemExperiences` 且两份签名 grant 同开、Growth `enabled+usageLearning.enabled+workItemFailures`、Evaluation `notificationOutcomesEnabled` | 授权未扩权、驱动关闭 |
|
|
269
|
+
| `revision-adoption` | Control Plane `revisionCapabilities` 及 `creationCapabilities`/`revisionVerifications`/`sourceJobs.revision` 前置 | 未配置(需要 owner 密钥,预设/doctor 不生成) |
|
|
270
|
+
| `event-poller` | event-triggers 已加载且 `pollerEnabled: true`(trigger 数量一并报告) | 轮询关闭、包缺失 |
|
|
271
|
+
| `ptc-presentation`(可选,不计入退出码) | Growth `toolPresentation` 为 `native` 时 ready;为 `ptc` 时标 `not-verified` | PTC 仍需运行时/审批/Policy,静态无法证明 |
|
|
272
|
+
| `dreaming`(可选,不计入退出码) | 未安装/禁用/安全休眠时 ready;已启用时要求 `retired!=true`、完整 `scope`、`$DSH_HOME` `databasePath`、`provider`/`model` 与有限预算 | 启用状态下缺项、retired=true 或 `databasePath` 泄漏至全局 `~/.dsh` |
|
|
273
|
+
| `proactive-opportunities`(可选,不计入退出码) | `assistant-proactive` 与 `assistant-goals` 数据库均严格位于 `$DSH_HOME` 内且已声明 `profiles.preparation` 含完整模型/预算;汇总 `goals` 等待与执行预算声明 | `databasePath` 泄漏至全局 `~/.dsh` 或 preparation 缺项 |
|
|
274
|
+
| `autonomy-subsystems`(可选,不计入退出码) | `work-items`、`memory-learning`、`growth-driver.usageLearning` 状态路径不越界且不指向全局 `~/.dsh`;汇总 admit/settlement/verdictGate/attention 等标志 | 任一状态路径越界或泄漏至全局 `~/.dsh` |
|
|
275
|
+
|
|
276
|
+
必需环节全部 ready 时退出码 0;任一 not-ready 时退出码 1(fail-closed),但 doctor 本身不会因缺服务或配置不符而崩溃:解析失败、dump 失败都降级为一条 not-ready 原因。JSON 每环包含 `id`、`required`、`status`(`ready`/`not-ready`/`not-verified`)、`summary`、`reasons[{code,message}]` 与 `details`,顶层 `runtime.observed` 恒为 `false`。因此它只能证明“配置声明就绪”,不能证明运行时注册、模型调用、Policy 或外部送达;这些仍需真实 Host 与一次真实使用验收。
|
|
277
|
+
|
|
278
|
+
要为这份目标配置启用原生策略建议,可在私有 admission JSON 中增加 `"strategy": { "maxRunsPerGoal": 4 }`。setup 写入有界策略配置及精确 owner/workspace/preset 的 `goal_strategy`/`delegate` 规则;启用 wake 时同样覆盖该目标的后台路径。父子模型调用共用原来的 `executionBudget`,不会增加预算或延长隔离授权。省略该字段保持默认关闭。重新启动 Host 后生效;策略建议仍需原有独立验收,不能直接作为目标完成依据。
|
|
279
|
+
|
|
280
|
+
### 有限 repair admission
|
|
281
|
+
|
|
282
|
+
当 profile 启用了 Isolation 时,repair setup 会为 Skills 写入依赖该服务的
|
|
283
|
+
Cordis `inject`,并保留已有注入配置。Host 崩溃后,隔离控制器可能需要等待旧的
|
|
284
|
+
30 秒租约自然到期;在隔离服务就绪前,修复流程保持等待,避免提前恢复后随
|
|
285
|
+
Host 启动失败而中断。未启用 Isolation 的独立 Skills 安装不因此新增依赖。
|
|
286
|
+
|
|
287
|
+
停止目标 Host 后,在已安装并完成普通 owner setup 的目标 profile 上运行:
|
|
288
|
+
|
|
289
|
+
```sh
|
|
290
|
+
dsh-web-owner-setup --profile web --workspace /absolute/workspace \
|
|
291
|
+
--repair-admission /private/repair-admission.json
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
admission 文件必须是 workspace 外部的 canonical、owner-only(`0600`)普通 JSON 文件,大小不超过 1 MiB。顶层**只**能有 `repairProfiles`、`externalHoldouts` 与 `ownerRouteId`:
|
|
295
|
+
|
|
296
|
+
```json
|
|
297
|
+
{
|
|
298
|
+
"ownerRouteId": "existing-owner-route-id",
|
|
299
|
+
"externalHoldouts": [{ "...": "complete Skills external-holdout profile" }],
|
|
300
|
+
"repairProfiles": [{
|
|
301
|
+
"id": "repair-profile-id",
|
|
302
|
+
"scope": {
|
|
303
|
+
"principalId": "web/web/local/operator",
|
|
304
|
+
"principalRecordId": "current-owner-record-id",
|
|
305
|
+
"principalVersion": 1,
|
|
306
|
+
"workspace": "/absolute/workspace",
|
|
307
|
+
"preset": "standard"
|
|
308
|
+
},
|
|
309
|
+
"skillName": "saved-skill", "taskFamilyId": "family-id", "description": "bounded repair",
|
|
310
|
+
"externalHoldoutProfileId": "holdout-id", "provider": "traex-agent", "model": "model-selector",
|
|
311
|
+
"allowedTools": ["read", "write"], "maxGoalRounds": 1, "maxModelCalls": 4,
|
|
312
|
+
"maxToolCalls": 8, "maxOutputTokens": 4096, "maxDurationMs": 300000,
|
|
313
|
+
"canaryRuns": 1, "maxCanaryRuns": 2, "maxIterations": 1
|
|
314
|
+
}]
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
`externalHoldouts` 中每项必须是完整的已发布 Skills external-holdout profile,不能用上例的占位对象。每个 repair profile 只能使用上述字段;可选 `followupProfileIds` 和 `bindings` 也必须符合 Skills contract。`scope.principalId` 必须为 `web/<profile>/local/operator`,其 record id/version、workspace 与 preset 必须精确匹配当前 owner 和命令参数。`allowedTools` 至少一个,自动修复仅支持 `read`、`write`、`edit`、`read_image` 四类原生文件工具;所有文件访问都限定在该 repair profile 的 workspace 内,拒绝越界路径及其下的符号链接。其他工具不能通过自动修复 profile 授权。
|
|
319
|
+
|
|
320
|
+
命令只读核验 account 精确等于 `--profile` 的 current owner lineage、已有 owner route、Goals 有限 calls execution budget(model calls、tool calls、时长和每次输出上限)及其精确 provider/model route、Skills prospective holdouts 和 Verifier profiles,然后原子合并有限 profiles/holdouts 并保留已有配置键。每个 profile 的 `maxModelCalls`、`maxToolCalls`、`maxDurationMs` 与 `maxOutputTokens` 都不得超过既有 Goals budget 的对应值。已有 TraeX calls budget 即可;该流程不要求 DeepSeek budget bundle。写入前会重新读取有效配置和 owner lineage,任一变化都会拒绝提交;重复完全相同的 admission 不改变 patch 字节。它不创建 Goal、Session、owner、credential、grant 或无限权限。配置成功不是 repair 验收、canary 成功、模型质量或自主改进成功的证据。
|
|
321
|
+
|
|
322
|
+
后台修复使用 `background` initiator,普通 owner 的 `external` 规则不适用。除已有的 Goals 创建/观察/执行和文件工具权限外,还需在 profile 的 `assistantPolicy.rules` 中授予当前 owner 的只读目标反馈权限;`--repair-admission` 不会自动扩大 Policy。规则中的 preset、workspace 和 principal 必须替换成实际值:
|
|
323
|
+
|
|
324
|
+
```yaml
|
|
325
|
+
- id: repair-background-goal-context
|
|
326
|
+
effect: allow
|
|
327
|
+
subject:
|
|
328
|
+
kind: agent
|
|
329
|
+
id: standard
|
|
330
|
+
workspace: /absolute/workspace
|
|
331
|
+
principal: web/web/local/operator
|
|
332
|
+
actions: [snapshot]
|
|
333
|
+
resource: { kind: goal, id: business-context }
|
|
334
|
+
context: { initiators: [background] }
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
缺少该权限时,新的修复或未完成目标的恢复会在模型调用前拒绝;只有 `read` / `write` 工具的修复仍通过系统上下文取得步骤和整个目标的独立验收反馈。修改配置后重启目标 Host,再授权有限修复。
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const sqliteWarningFiltered = Symbol.for('dsh-ray.sqlite-warning-filtered')
|
|
3
|
+
if (!Reflect.get(process.emitWarning, sqliteWarningFiltered)) {
|
|
4
|
+
const originalEmitWarning = process.emitWarning
|
|
5
|
+
const filteredEmitWarning = function emitWarning(warning, ...rest) {
|
|
6
|
+
const first = rest[0]
|
|
7
|
+
let warningType
|
|
8
|
+
if (typeof warning === 'object' && warning !== null && typeof warning.name === 'string') {
|
|
9
|
+
warningType = warning.name
|
|
10
|
+
} else if (typeof first === 'string') {
|
|
11
|
+
warningType = first
|
|
12
|
+
} else if (first !== null && typeof first === 'object' && typeof first.type === 'string') {
|
|
13
|
+
warningType = first.type
|
|
14
|
+
}
|
|
15
|
+
const warningMessage = typeof warning === 'object' && warning !== null && typeof warning.message === 'string'
|
|
16
|
+
? warning.message
|
|
17
|
+
: String(warning ?? '')
|
|
18
|
+
if (warningType === 'ExperimentalWarning' && warningMessage.includes('SQLite is an experimental feature')) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
return Reflect.apply(originalEmitWarning, this ?? process, [warning, ...rest])
|
|
22
|
+
}
|
|
23
|
+
Reflect.set(filteredEmitWarning, sqliteWarningFiltered, true)
|
|
24
|
+
process.emitWarning = filteredEmitWarning
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const { runAutonomyDoctor } = await import('../lib/doctor.js')
|
|
29
|
+
await runAutonomyDoctor()
|
|
30
|
+
} catch (error) {
|
|
31
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`)
|
|
32
|
+
process.exitCode = 1
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const sqliteWarningFiltered = Symbol.for('dsh-ray.sqlite-warning-filtered')
|
|
3
|
+
if (!Reflect.get(process.emitWarning, sqliteWarningFiltered)) {
|
|
4
|
+
const originalEmitWarning = process.emitWarning
|
|
5
|
+
const filteredEmitWarning = function emitWarning(warning, ...rest) {
|
|
6
|
+
const first = rest[0]
|
|
7
|
+
let warningType
|
|
8
|
+
if (typeof warning === 'object' && warning !== null && typeof warning.name === 'string') {
|
|
9
|
+
warningType = warning.name
|
|
10
|
+
} else if (typeof first === 'string') {
|
|
11
|
+
warningType = first
|
|
12
|
+
} else if (first !== null && typeof first === 'object' && typeof first.type === 'string') {
|
|
13
|
+
warningType = first.type
|
|
14
|
+
}
|
|
15
|
+
const warningMessage = typeof warning === 'object' && warning !== null && typeof warning.message === 'string'
|
|
16
|
+
? warning.message
|
|
17
|
+
: String(warning ?? '')
|
|
18
|
+
if (warningType === 'ExperimentalWarning' && warningMessage.includes('SQLite is an experimental feature')) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
return Reflect.apply(originalEmitWarning, this ?? process, [warning, ...rest])
|
|
22
|
+
}
|
|
23
|
+
Reflect.set(filteredEmitWarning, sqliteWarningFiltered, true)
|
|
24
|
+
process.emitWarning = filteredEmitWarning
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const { runWebOwnerSetup } = await import('../lib/setup.js')
|
|
29
|
+
await runWebOwnerSetup()
|
|
30
|
+
} catch (error) {
|
|
31
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`)
|
|
32
|
+
process.exitCode = 1
|
|
33
|
+
}
|