@linxin666/dsh-client-ui-task-board-ssh 0.4.20 → 0.4.21
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.i18n.yaml +2 -2
- package/README.md +13 -2
- package/README.zh.md +13 -2
- package/lib/client.js +9 -3
- package/lib/index.js +1071 -89
- package/lib/types/core/contract.d.ts +8 -0
- package/lib/types/core/target.d.ts +6 -0
- package/lib/types/core/task-record.d.ts +11 -0
- package/lib/types/host/board.d.ts +4 -0
- package/lib/types/host/engine.d.ts +145 -0
- package/lib/types/host/extension.d.ts +2 -0
- package/lib/types/host/inspect.d.ts +99 -0
- package/lib/types/host/remote.d.ts +17 -0
- package/lib/types/host/tools.d.ts +5 -3
- package/package.json +1 -1
- package/src/core/contract.ts +5 -0
- package/src/core/ledger.ts +5 -0
- package/src/core/target.ts +10 -3
- package/src/core/task-record.ts +8 -0
- package/src/host/board.ts +4 -0
- package/src/host/engine.ts +430 -6
- package/src/host/extension.ts +6 -0
- package/src/host/inspect.ts +264 -0
- package/src/host/remote.ts +28 -0
- package/src/host/tools.ts +250 -60
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: b2180415091d66a7b6a62e3c99fb7fe07cb5b2ba
|
|
6
|
+
README.zh.md: 46dfb7b7e1a9363c27006950506f6229b7527414
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A task-board provider extension that runs a pinned card as a headless agent sess
|
|
|
9
9
|
- Registers the `ssh` provider extension with the task board and takes over the cards pinned to a remote target at the board's single launch gate, so the native run button, a schedule and `task_board_run` all take the same path.
|
|
10
10
|
- Starts dsh, Claude Code, Codex or a custom command on the host through one POSIX `sh` launcher, detached with `setsid nohup` (falling back to `nohup` on hosts without `setsid`, such as macOS), so a run outlives the SSH connection and the local host.
|
|
11
11
|
- Keeps the run account in the card's own payload and the output in a remote file read back by bounded byte-offset pages, so a log replays from its start at any time.
|
|
12
|
-
- Adds
|
|
12
|
+
- Adds model-visible tools (`task_board_ssh` as the one surface, plus the older `task_board_ssh_target`, `task_board_ssh_status`, `task_board_ssh_follow_up` kept as a compatibility layer) and one task-detail seat holding the target form, the run state, the log viewer, the follow-up box and cancel.
|
|
13
13
|
- Offers the same target choice in the create dialog's Run Mode section, so a card can be created already pinned to a host. The choice starts as no target at all: such a card is created untargeted and its detail seat sets the target afterwards, exactly as before.
|
|
14
14
|
- Cancelling a run from the task-detail seat stops the remote process and puts the card back in the to-do column, with no verdict written.
|
|
15
15
|
|
|
@@ -59,9 +59,20 @@ A card's target is chosen in the create dialog's Run Mode section, or on its det
|
|
|
59
59
|
- `agent`: `dsh`, `claude`, `codex` or `custom`; a custom agent needs a start command template carrying `{prompt_file}` and optionally a resume template.
|
|
60
60
|
- `workspace`: `in-place` with a remote path, or `git` with a repository URL and an optional base branch, or `git` with the id of a local workspace.
|
|
61
61
|
|
|
62
|
+
### Agent surface
|
|
63
|
+
|
|
64
|
+
`task_board_ssh` takes `action: create | bind | read | run | status | log | followup`. One call, `{action:"create", title, prompt, host, workspacePath, run:true, wait:true}`, creates the card with its target, checks it, starts the run and blocks until it settles.
|
|
65
|
+
|
|
66
|
+
- Target choice: `mode` `direct` starts a headless agent on the host and keeps no local session (self-contained jobs); `proxy` runs a local session that drives the host (work that needs local context). `workspaceKind` `in-place` works inside the existing remote directory `workspacePath`; `git` makes a per-run worktree on branch `dsh-task/<runId>` from `repositoryUrl` or the local `workspaceId`. `agent` is `dsh` (default), `claude`, `codex` or `custom` (needs `agentCommand`).
|
|
67
|
+
- Preflight on `create` and `bind` (skip with `preflight:false`), before anything is saved: `host-unreachable` (alias unknown to dsh-ssh or the host did not answer), `agent-missing` (not a supported agent name, or its program is not on the host PATH), `path-missing` (an in-place directory is never created), `permission-required` (the directory is not writable by the ssh user). A refused `create` leaves no card. `run-active` refuses a second run while one is in flight. `invalid-target` lists the other malformed fields.
|
|
68
|
+
- Run handle: `task_board_run` and `action:"run"` answer `executionId`, `runId`, `logPath`, `target`, `estimatedDurationMs` (median of earlier successful runs, else 180000) and a note naming the call that blocks. The settled board execution takes that `executionId`.
|
|
69
|
+
- `status` has one shape for a running and a settled run: `phase` (never missing), `exitCode`, `result`, `summary`, `error` (`code`, `message`, `retryHint`, failures only), `durationMs`, `remoteSessionId`, `lastActivityAt`, and while running `lastActivity` (the agent's last tool call). `wait:true` with `timeoutMs` (default 120000, at most 600000) blocks until the run settles; a timeout answers `timedOut:true` and the run keeps going.
|
|
70
|
+
- `log` filters on the host: `system` events other than `init`, `rate_limit_event` and stream deltas are dropped and lines are cut at 2000 bytes. Reads are `tail` N lines (default 40) or `since` a cursor (`nextSince`), at most 64 KB per reply (`maxBytes` up to 128 KB); `stats` (`rawBytes`, `filteredLines`, `filteredBytes`) comes with every reply and `statsOnly:true` returns it alone; `raw:true` skips the filter.
|
|
71
|
+
- A succeeded run's conclusion is the execution `summary`; `error` carries failures, with `errorCode` and `retryHint`. `task_board_get` and `task_board_list` show a `remote` summary (host, agent, mode, `canFollowUp`) for these cards, and never report `permissionPending` for a direct card, which the local permission gate does not govern.
|
|
72
|
+
|
|
62
73
|
### Extension settings
|
|
63
74
|
|
|
64
|
-
- `enabled`: the master switch; off withdraws the detail seat, the card badge, the create dialog's row, the
|
|
75
|
+
- `enabled`: the master switch; off withdraws the detail seat, the card badge, the create dialog's row, the four tools and the launch interceptor, and stops polling every run it follows.
|
|
65
76
|
- `defaultMode`, `defaultAgent` and `defaultHost`: what a card opens with before anyone pins a target.
|
|
66
77
|
- `perHostCap`: how many runs one host executes at once, from 1 to 16, default 2; the rest wait in submission order.
|
|
67
78
|
- `agentCommands`: per-agent command templates that replace the built-in command line.
|
package/README.zh.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- 向任务看板登记 `ssh` 提供方扩展,并在看板唯一的启动闸口接管钉住了远端目标的卡片,因此原生运行按钮、定时调度与 `task_board_run` 走同一条路径。
|
|
10
10
|
- 通过一个 POSIX `sh` 启动器在主机上运行 dsh、Claude Code、Codex 或自定义命令,优先用 `setsid nohup` 脱离(主机无 `setsid` 如 macOS 时回退到 `nohup`),使一次运行活过 SSH 连接与本机。
|
|
11
11
|
- 运行的账目留在卡片自己的载荷里,输出留在远端文件里按有界字节偏移分页读回,因此日志随时可以从头回放。
|
|
12
|
-
-
|
|
12
|
+
- 新增模型可见工具(统一入口 `task_board_ssh`,以及作为兼容层保留的 `task_board_ssh_target`、`task_board_ssh_status`、`task_board_ssh_follow_up`)与一个任务详情席位,席位上放目标表单、运行状态、日志视图、追问框与取消。
|
|
13
13
|
- 新建弹窗的「运行方式」区块里也提供同一套目标选择,卡片可以在建出来之前就钉住主机。默认是不指定:这样的卡片建出来时不带目标,建好后仍由详情席位设置,与以前完全一样。
|
|
14
14
|
- 从任务详情席位取消一次运行会停掉远端进程并把卡片放回待办列,不写任何结论。
|
|
15
15
|
|
|
@@ -59,9 +59,20 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-task-board-ssh
|
|
|
59
59
|
- `agent`:`dsh`、`claude`、`codex` 或 `custom`;自定义 agent 需要一条带 `{prompt_file}` 的启动命令模板,可选一条续跑模板。
|
|
60
60
|
- `workspace`:`in-place` 配一个远端路径,或 `git` 配仓库地址与可选起始分支,或 `git` 配一个本机工作区标识。
|
|
61
61
|
|
|
62
|
+
### Agent 入口
|
|
63
|
+
|
|
64
|
+
`task_board_ssh` 的 `action` 取 `create | bind | read | run | status | log | followup`。一次调用 `{action:"create", title, prompt, host, workspacePath, run:true, wait:true}` 即可带目标建卡、预检、启动并阻塞到结束。
|
|
65
|
+
|
|
66
|
+
- 目标怎么选:`mode` 为 `direct` 时在主机上起无头 agent、不留本地会话(自包含任务);`proxy` 由本地会话驱动主机(需要本地上下文的工作)。`workspaceKind` 为 `in-place` 时直接在已存在的远端目录 `workspacePath` 里干活;`git` 按次建工作树、分支 `dsh-task/<runId>`,来源是 `repositoryUrl` 或本机 `workspaceId`。`agent` 取 `dsh`(默认)、`claude`、`codex` 或 `custom`(需 `agentCommand`)。
|
|
67
|
+
- `create` 与 `bind` 在保存任何东西之前先预检(`preflight:false` 可跳过):`host-unreachable`(别名 dsh-ssh 不认识或主机无应答)、`agent-missing`(不是受支持的 agent 名,或其程序不在主机 PATH 上)、`path-missing`(in-place 目录从不自动创建)、`permission-required`(ssh 用户对目录无写权限)。被拒绝的 `create` 不留卡片。`run-active` 在已有运行进行中时拒绝再次运行。其余字段不合法时返回 `invalid-target` 并逐项列出。
|
|
68
|
+
- 运行句柄:`task_board_run` 与 `action:"run"` 返回 `executionId`、`runId`、`logPath`、`target`、`estimatedDurationMs`(同卡以往成功运行的中位数,否则 180000)和一条指明阻塞调用的提示;结束后的看板执行记录沿用这个 `executionId`。
|
|
69
|
+
- `status` 对运行中与已结束的运行返回同一种结构:`phase`(永不缺失)、`exitCode`、`result`、`summary`、`error`(`code`、`message`、`retryHint`,仅失败时有值)、`durationMs`、`remoteSessionId`、`lastActivityAt`,运行中另有 `lastActivity`(agent 最后一次工具调用)。`wait:true` 配合 `timeoutMs`(默认 120000,上限 600000)阻塞到运行结束;超时返回 `timedOut:true`,运行不受影响。
|
|
70
|
+
- `log` 在主机侧过滤:丢弃 `init` 以外的 `system` 事件、`rate_limit_event` 与流式增量,单行截断到 2000 字节。读取方式是 `tail` 末尾 N 行(默认 40)或 `since` 游标(`nextSince`),单次至多 64 KB(`maxBytes` 最大 128 KB);每次回复都带 `stats`(`rawBytes`、`filteredLines`、`filteredBytes`),`statsOnly:true` 只回统计;`raw:true` 跳过过滤。
|
|
71
|
+
- 成功运行的结论写入执行记录的 `summary`;`error` 只承载失败,并附 `errorCode` 与 `retryHint`。`task_board_get` 与 `task_board_list` 对这类卡片给出 `remote` 摘要(主机、agent、模式、`canFollowUp`),且对 direct 卡不再报告 `permissionPending`(本地权限闸不管它)。
|
|
72
|
+
|
|
62
73
|
### 扩展设置
|
|
63
74
|
|
|
64
|
-
- `enabled
|
|
75
|
+
- `enabled`:总开关;关闭即撤下详情席位、卡片徽标、新建弹窗里的那一行、四个工具与启动拦截器,并停掉对所有在跟运行的轮询。
|
|
65
76
|
- `defaultMode`、`defaultAgent` 与 `defaultHost`:卡片在还没钉目标时打开的默认值。
|
|
66
77
|
- `perHostCap`:一台主机同时跑几张卡,1 到 16,默认 2;超出的按提交顺序排队。
|
|
67
78
|
- `agentCommands`:按 agent 覆写的命令模板,替换内置命令行。
|
package/lib/client.js
CHANGED
|
@@ -1633,7 +1633,10 @@ window.__ModuleLoader__.load({
|
|
|
1633
1633
|
"branch",
|
|
1634
1634
|
"summary",
|
|
1635
1635
|
"error",
|
|
1636
|
-
"followUps"
|
|
1636
|
+
"followUps",
|
|
1637
|
+
"executionId",
|
|
1638
|
+
"lastActivityAt",
|
|
1639
|
+
"errorCode"
|
|
1637
1640
|
], "", issues);
|
|
1638
1641
|
if ((typeof value.runId === "string" && value.runId !== "." && value.runId !== ".." && /^[A-Za-z0-9._-]{1,128}$/.test(value.runId) ? value.runId : void 0) === void 0) issues.add("runId", "must be 1-128 characters of letters, digits, dots, underscores or hyphens");
|
|
1639
1642
|
if (!oneOf(value.phase, [
|
|
@@ -1649,7 +1652,8 @@ window.__ModuleLoader__.load({
|
|
|
1649
1652
|
"finishedAt",
|
|
1650
1653
|
"exitCode",
|
|
1651
1654
|
"bytes",
|
|
1652
|
-
"followUps"
|
|
1655
|
+
"followUps",
|
|
1656
|
+
"lastActivityAt"
|
|
1653
1657
|
]) {
|
|
1654
1658
|
if (value[key] === void 0) continue;
|
|
1655
1659
|
if (typeof value[key] !== "number" || !Number.isFinite(value[key])) issues.add(key, "must be a finite number");
|
|
@@ -1658,7 +1662,9 @@ window.__ModuleLoader__.load({
|
|
|
1658
1662
|
"sessionId",
|
|
1659
1663
|
"branch",
|
|
1660
1664
|
"summary",
|
|
1661
|
-
"error"
|
|
1665
|
+
"error",
|
|
1666
|
+
"executionId",
|
|
1667
|
+
"errorCode"
|
|
1662
1668
|
]) {
|
|
1663
1669
|
if (value[key] === void 0) continue;
|
|
1664
1670
|
readText$1(value[key], key, issues);
|