@foxden-app/foxclaw 0.11.0 → 0.12.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.
@@ -403,6 +403,11 @@ export class BridgeStore {
403
403
  const current = this.getChatSettings(chatId);
404
404
  this.setChatSettings(chatId, current?.model ?? null, effort);
405
405
  }
406
+ /** Persist an adapter-advertised reasoning id without imposing Codex's vocabulary. */
407
+ setChatEngineEffort(chatId, effort) {
408
+ const current = this.getChatSettings(chatId);
409
+ this.writeChatSettings(chatId, current?.model ?? null, effort, current?.locale ?? null, current?.accessPreset ?? null, current?.collaborationMode ?? null, current?.serviceTier ?? null, current?.activeTurnMessageMode ?? null, current?.activeBackendId ?? null);
410
+ }
406
411
  setChatLocale(chatId, locale) {
407
412
  const current = this.getChatSettings(chatId);
408
413
  this.writeChatSettings(chatId, current?.model ?? null, current?.reasoningEffort ?? null, locale, current?.accessPreset ?? null, current?.collaborationMode ?? null, current?.serviceTier ?? null, current?.activeTurnMessageMode ?? null, current?.activeBackendId ?? null);
@@ -748,12 +753,12 @@ export class BridgeStore {
748
753
  `).run(Date.now(), Date.now(), scopeId);
749
754
  return Number(result.changes ?? 0);
750
755
  }
751
- requeueInterruptedQueuedTurnInputs() {
756
+ requeueInterruptedQueuedTurnInputs(scopeId) {
752
757
  const result = this.db.prepare(`
753
758
  UPDATE queued_turn_inputs
754
759
  SET status = 'queued', error = NULL, updated_at = ?, resolved_at = NULL
755
- WHERE status = 'processing'
756
- `).run(Date.now());
760
+ WHERE status = 'processing'${scopeId ? ' AND scope_id = ?' : ''}
761
+ `).run(Date.now(), ...(scopeId ? [scopeId] : []));
757
762
  return Number(result.changes ?? 0);
758
763
  }
759
764
  savePendingAttachmentBatch(record) {
package/dist/types.d.ts CHANGED
@@ -403,7 +403,7 @@ export interface RuntimeStatus {
403
403
  activeTurns: number;
404
404
  runtimeKind?: 'default' | 'isolated';
405
405
  currentAuth?: string | null;
406
- defaultBackend?: 'codex' | 'antigravity';
406
+ defaultBackend?: 'codex' | 'antigravity' | 'dsh';
407
407
  codexHome?: string | null;
408
408
  antigravityHome?: string | null;
409
409
  codexAppServer?: RuntimeStatus['codexAppServer'];
package/docs/dsh.md ADDED
@@ -0,0 +1,83 @@
1
+ # DeepSeek Harness backend
2
+
3
+ FoxClaw launches DSH's shipped `acp` profile and reuses Telegram progress, tool status, final answers, queueing, and interruption. Models and reasoning levels come from the current DSH session. Bindings and settings are stored separately for each bot, chat, and topic.
4
+
5
+ ## Existing bot
6
+
7
+ Add to FoxClaw's `.env`:
8
+
9
+ ```dotenv
10
+ DSH_ENABLED=true
11
+ DSH_SOURCE_DIR=/absolute/path/to/deepseek-harness
12
+ ```
13
+
14
+ Prepare DSH dependencies and its platform native addon first. Source mode runs `apps/cli/src/bin.ts` with FoxClaw's Node and resolves `tsx` from the DSH repository. For Linux development, run `pnpm install` and `pnpm run build:native-system` inside DSH; follow DSH's installation instructions for other platforms.
15
+
16
+ For an installed CLI, replace `DSH_SOURCE_DIR` with `DSH_CLI_BIN=/absolute/path/to/dsh`. A `.js`, `.mjs`, or `.cjs` entry point also works. Source mode takes precedence when both are set.
17
+
18
+ Restart FoxClaw, then send `/backend dsh` and `/setup` to your Codex or Antigravity bot. Switching back restores the previous backend's session and settings. Interrupt an active turn before switching backends.
19
+
20
+ ## Dedicated bot
21
+
22
+ ```dotenv
23
+ CODEX_BOT_TOKENS=
24
+ DSH_BOT_TOKEN=123456:your-independent-bot-token
25
+ DSH_SOURCE_DIR=/absolute/path/to/deepseek-harness
26
+ TG_ALLOWED_USER_ID=123456789
27
+ DEFAULT_CWD=/absolute/path/to/workspace
28
+ ```
29
+
30
+ `DSH_BOT_TOKEN` enables DSH automatically and must differ from other backend tokens. Standalone DSH requires neither Codex nor Antigravity. Run `foxclaw doctor` and start the service normally. DSH currently connects through Telegram; Weixin uses the existing backends.
31
+
32
+ ## Configuration and controls
33
+
34
+ | Setting | Default / purpose |
35
+ | --- | --- |
36
+ | `DSH_HOME` | Existing DSH home, normally `~/.dsh`; credentials, profiles, and persisted sessions |
37
+ | `DSH_PROFILE` | `acp`; custom profiles must expose ACP, model controls, and `permissionPresets` |
38
+ | `DSH_PATCHES` | JSON array, e.g. `["/absolute/path/to/patch.yml"]`, applied in order |
39
+ | `DSH_STARTUP_TIMEOUT_MS` | `60000`; startup timeout, including first profile initialization |
40
+ | `DEFAULT_SANDBOX_MODE` | Initial access: `read-only`, `workspace-write`, or `danger-full-access` |
41
+
42
+ Provider credentials remain managed by DSH. Provider environment variables such as `DEEPSEEK_API_KEY` can be placed in FoxClaw's `.env` and are inherited by DSH. Codex/AGY account rotation and auth synchronization are not used by this backend.
43
+
44
+ | Control | Purpose |
45
+ | --- | --- |
46
+ | `/setup` | Models, reasoning, permissions, queue/interrupt mode, sessions, and plugin configuration |
47
+ | `/models`, `/model <provider/model>` | Native model selection; `/model default` restores the session's initial model |
48
+ | `/effort`, `/effort <level>` | Reasoning choices advertised by the current model; changing models resets reasoning to the new model's default |
49
+ | `/permissions read-only\|default\|full-access` | Read-only, workspace-write, or full-access, also available as buttons |
50
+ | `/threads`, `/open <session ID>` | List and resume persisted DSH sessions |
51
+ | `/new [directory]` | New session with an optional working directory |
52
+ | `/active queue\|steer`, `/queue`, `/steer <message>`, `/interrupt` | Queueing, interruption, and takeover |
53
+ | `/plugins` | Profile dependencies and configured patch paths |
54
+
55
+ The bundled `foxclaw-permissions` plugin applies native DSH permission presets to root agents; children inherit according to DSH's rules. Native approval requests become Allow once / Reject buttons. Interrupting or stopping cancels pending approvals. Access changes require an idle turn.
56
+
57
+ ## Plugins and limitations
58
+
59
+ `/plugins` shows explicit profile dependencies and configured patches, rather than a complete inventory of active built-in plugins. Install/remove packages with DSH's own command, using the same `DSH_HOME` and profile, then restart FoxClaw:
60
+
61
+ ```bash
62
+ dsh plugin --profile acp add <package>
63
+ dsh plugin --profile acp remove <package>
64
+ ```
65
+
66
+ In source mode, run `node --import tsx/esm apps/cli/src/bin.ts plugin --profile acp ...` inside the DSH repository. There are currently no chat buttons for installing/removing packages.
67
+
68
+ Progress follows committed ACP messages and tool events, rather than raw model token streaming. Images are sent natively when advertised by ACP; other attachments are passed as local paths. The current DSH ACP surface does not expose transcript replay, forks, renaming, or Agent/Plan switching, so those Codex-specific controls are omitted.
69
+
70
+ ACP reports context occupancy rather than per-turn input/output/cache token consumption. The DSH status page explicitly marks those counts as unavailable.
71
+
72
+ ## Development verification
73
+
74
+ Ordinary tests use a keyless ACP subprocess fixture. To exercise the actual source CLI with DSH's bundled control-surface fixture:
75
+
76
+ ```bash
77
+ FOXCLAW_DSH_TEST_SOURCE_DIR=/absolute/path/to/deepseek-harness \
78
+ DSH_TELEMETRY_DISABLED=1 node --test --import tsx src/dsh/source.integration.test.ts
79
+ ```
80
+
81
+ This uses temporary DSH home/session directories and verifies model/reasoning selection, native permission logs, resume, tools, and cancellation without paid model calls. It is skipped when the source path is unset.
82
+
83
+ Run `npm run build` first and add `FOXCLAW_DSH_TEST_BUILT=1` to verify the compiled backend and packaged permission plugin.
package/docs/zh/dsh.md ADDED
@@ -0,0 +1,83 @@
1
+ # DeepSeek Harness 后端
2
+
3
+ FoxClaw 直接启动 DSH 的 `acp` profile,复用 Telegram 的任务进度、工具状态、最终回答、排队和中断功能。模型与推理档位读取 DSH 当前会话提供的选项;每个 Bot、聊天和话题分别保存会话与设置。
4
+
5
+ ## 接入现有 Bot
6
+
7
+ 在 FoxClaw 的 `.env` 中增加:
8
+
9
+ ```dotenv
10
+ DSH_ENABLED=true
11
+ DSH_SOURCE_DIR=/absolute/path/to/deepseek-harness
12
+ ```
13
+
14
+ DSH 源码目录需已安装依赖并准备好本机 native addon。源码模式使用 FoxClaw 的 Node 启动 `apps/cli/src/bin.ts`,从 DSH 目录加载 `tsx`。Linux 开发环境可先在 DSH 仓库执行 `pnpm install` 和 `pnpm run build:native-system`,其他平台按 DSH 自身安装说明准备。
15
+
16
+ 如果使用已安装的 CLI,则用 `DSH_CLI_BIN=/absolute/path/to/dsh` 替代 `DSH_SOURCE_DIR`;也支持 CLI 的 `.js`、`.mjs` 或 `.cjs` 入口。两项同时设置时优先源码目录。
17
+
18
+ 重启 FoxClaw 后,在现有 Codex 或 Antigravity Bot 中发送 `/backend dsh`,再发送 `/setup`。切回原后端后,原后端的会话和设置会恢复。正在执行任务时,先 `/interrupt` 再切换后端。
19
+
20
+ ## 独立 DSH Bot
21
+
22
+ ```dotenv
23
+ CODEX_BOT_TOKENS=
24
+ DSH_BOT_TOKEN=123456:your-independent-bot-token
25
+ DSH_SOURCE_DIR=/absolute/path/to/deepseek-harness
26
+ TG_ALLOWED_USER_ID=123456789
27
+ DEFAULT_CWD=/absolute/path/to/workspace
28
+ ```
29
+
30
+ `DSH_BOT_TOKEN` 自动启用 DSH,必须与其他后端的 Bot token 不同。独立 DSH 模式无需 Codex 或 Antigravity;执行 `foxclaw doctor` 检查,再正常启动服务。当前 DSH 接入范围是 Telegram,微信仍使用已有后端。
31
+
32
+ ## 配置与操作
33
+
34
+ | 配置 | 默认值 / 用途 |
35
+ | --- | --- |
36
+ | `DSH_HOME` | DSH 原有 home,通常 `~/.dsh`;复用其凭据、profile 和持久会话 |
37
+ | `DSH_PROFILE` | `acp`;自定义 profile 必须提供 ACP、模型控制和 `permissionPresets` 服务 |
38
+ | `DSH_PATCHES` | JSON 数组,如 `["/absolute/path/to/patch.yml"]`;按顺序传入 DSH |
39
+ | `DSH_STARTUP_TIMEOUT_MS` | `60000`;首次初始化 profile 的最长等待时间 |
40
+ | `DEFAULT_SANDBOX_MODE` | 初始权限,支持 `read-only`、`workspace-write`、`danger-full-access` |
41
+
42
+ Provider 与 API key 沿用 DSH 配置。使用环境变量的 provider,可将相应变量(如 `DEEPSEEK_API_KEY`)加入 FoxClaw `.env`,DSH 子进程会继承。这里不使用 Codex/AGY 的账号轮转或认证同步。
43
+
44
+ | 操作 | 用途 |
45
+ | --- | --- |
46
+ | `/setup` | 模型、推理档位、权限、排队/中断接管、会话与插件配置面板 |
47
+ | `/models`、`/model <provider/model>` | 选择 DSH 模型;`/model default` 恢复会话初始模型 |
48
+ | `/effort`、`/effort <档位>` | 使用当前模型提供的推理档位;切换模型会重置为该模型默认档位 |
49
+ | `/permissions read-only|default|full-access` | 只读、工作区写入、完全访问;也可从面板选择 |
50
+ | `/threads`、`/open <会话 ID>` | 列出并恢复 DSH 持久会话 |
51
+ | `/new [目录]` | 新会话,可指定工作目录 |
52
+ | `/active queue|steer`、`/queue`、`/steer <消息>`、`/interrupt` | 排队、中断接管与取消 |
53
+ | `/plugins` | 查看 profile 显式插件依赖和额外 patch 路径 |
54
+
55
+ 权限通过随桥加载的 `foxclaw-permissions` 插件设置 DSH 原生 preset,作用于根 Agent,子 Agent 按 DSH 自身规则继承。DSH 发出的工具审批会显示“允许本次 / 拒绝”按钮,中断或退出时取消等待中的审批。任务执行中不能修改权限。
56
+
57
+ ## 插件与支持边界
58
+
59
+ `/plugins` 展示 profile 的显式依赖和配置 patch,并非所有运行中的内置插件清单。安装或移除沿用 DSH 命令,使用与 FoxClaw 一致的 `DSH_HOME` 和 profile,完成后重启 FoxClaw:
60
+
61
+ ```bash
62
+ dsh plugin --profile acp add <package>
63
+ dsh plugin --profile acp remove <package>
64
+ ```
65
+
66
+ 源码模式下,可用 `node --import tsx/esm apps/cli/src/bin.ts plugin --profile acp ...` 在 DSH 仓库执行。FoxClaw 目前不提供聊天内安装/移除插件按钮。
67
+
68
+ 进度来自 ACP 的已提交消息和工具事件,不是模型原始 token 流。图片在 ACP 声明支持时原生发送,其余附件传入本地路径。DSH 当前 ACP 未提供历史消息回放、会话分叉、重命名、Agent/Plan 切换等接口;对应 Codex 专用按钮不会出现在 DSH 面板。
69
+
70
+ ACP 当前仅报告上下文占用,不提供逐轮输入、输出及缓存 token 消耗;DSH 状态页会明确说明统计未提供。
71
+
72
+ ## 开发验证
73
+
74
+ 普通 DSH 测试使用不需要 API key 的 ACP 子进程 fixture。真实源码联调使用 DSH 自带的控制面 fixture,不调用付费模型:
75
+
76
+ ```bash
77
+ FOXCLAW_DSH_TEST_SOURCE_DIR=/absolute/path/to/deepseek-harness \
78
+ DSH_TELEMETRY_DISABLED=1 node --test --import tsx src/dsh/source.integration.test.ts
79
+ ```
80
+
81
+ 联调使用临时 home 和会话目录,验证模型/推理设置、原生权限日志、恢复、工具事件和取消。未配置源码路径时跳过此项。
82
+
83
+ 先执行 `npm run build`,再追加 `FOXCLAW_DSH_TEST_BUILT=1` 可验证编译后的后端和随包发布的权限插件。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxden-app/foxclaw",
3
- "version": "0.11.0",
4
- "description": "Foxden local execution claw for controlling Codex, OpenCode, and Antigravity from trusted chat interfaces.",
3
+ "version": "0.12.0",
4
+ "description": "Foxden local execution claw for controlling Codex, OpenCode, Antigravity, and DeepSeek Harness from trusted chat interfaces.",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "bin": {
@@ -55,6 +55,7 @@
55
55
  "prepack": "npm run build"
56
56
  },
57
57
  "dependencies": {
58
+ "@agentclientprotocol/sdk": "1.4.0",
58
59
  "@opencode-ai/sdk": "1.18.15",
59
60
  "dotenv": "^16.6.1",
60
61
  "qrcode-terminal": "^0.12.0"