dsh-task-ledger 0.1.5 → 0.1.8

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.
@@ -2,14 +2,25 @@ import { spawn } from "node:child_process";
2
2
  import { fileURLToPath } from "node:url";
3
3
  import { IdentityMissingError } from "../errors.js";
4
4
  /**
5
- * 内嵌 skill 入口的默认路径:dist/host/repositories/runner.js → 包根 skill/scripts/progress
6
- * (比原 host/script.js 深一层 ⇒ 相对路径多一级 `../`)。
5
+ * 内嵌 skill 的平台入口:dist/host/repositories/runner.js → 包根 skill/scripts(比原
6
+ * host/script.js 深一层 ⇒ 相对路径多一级 `../`)。
7
+ *
8
+ * POSIX:`scripts/progress` 这个薄 shell 包装,按平台 exec `scripts/bin/ledger-<os>-<arch>`
9
+ * (自带运行时的静态二进制)——所以本插件不需要系统装任何运行时。
10
+ *
11
+ * Windows:不能起这个包装。CreateProcessW 不执行无扩展名的 sh 脚本,还会按扩展名补
12
+ * `.exe` 去找 `scripts/progress.exe`,结果就是 spawn ENOENT(issue #1)⇒ 直接起
13
+ * `scripts/bin/` 下的静态二进制。Windows 资产目前只有 amd64 一份,Intel 与 ARM64 都能跑。
7
14
  *
8
- * 这是个薄 shell 包装,按平台 exec `skill/scripts/bin/ledger-<os>-<arch>`(自带运行时的
9
- * 静态二进制)——所以本插件不需要系统装任何运行时。
10
15
  * 构建时 scripts/copy-skill.mjs 把 packages/skill 的运行时拷到 packages/plugin/skill/。
11
16
  */
12
- const DEFAULT_SCRIPT_PATH = fileURLToPath(new URL("../../../skill/scripts/progress", import.meta.url));
17
+ function defaultScriptPath() {
18
+ if (process.platform === "win32") {
19
+ return fileURLToPath(new URL("../../../skill/scripts/bin/ledger-windows-amd64.exe", import.meta.url));
20
+ }
21
+ return fileURLToPath(new URL("../../../skill/scripts/progress", import.meta.url));
22
+ }
23
+ const DEFAULT_SCRIPT_PATH = defaultScriptPath();
13
24
  /** 单次脚本调用超时上限(ms)。实测单仓 5 万行全量 1.2s,10s 是宽松上限。 */
14
25
  const DEFAULT_TIMEOUT_MS = 10_000;
15
26
  /** 脚本绝对路径(界面上要写给用户复制的命令用;别在别处再拼一份)。 */
@@ -2,7 +2,7 @@
2
2
  * 数据面路由薄壳:只做协议(参数解析 + JSON 响应 + 错误转 500),
3
3
  * 一行业务逻辑都不多写——全部调 service(2026-10-17 定稿)。
4
4
  * 宿主事实(handler = 原始 Node req/res、发头后不抛错、重复 path 注册直接 throw)
5
- * 见 external/host-webserver.md。
5
+ * 见 docs/dependencies/host-webserver.md。
6
6
  *
7
7
  * 2026-10-28 收敛:界面只有 8 个统计卡 + 在办列表 ⇒ 只注册 `/workspaces` 与 `/board/snapshot`。
8
8
  * 详情 / 历史 / 筛选项 / 趋势 / 写动作的端点与实现已删除(要接回按 skill 方法重写,不复用旧直读逻辑)。
@@ -10,7 +10,7 @@
10
10
  import type { IncomingMessage, ServerResponse } from "node:http";
11
11
  import { type AgentDefaultModelLike, type AgentPresetsLike, type AgentsLike, type SessionTitleLike } from "./services/continue.service.js";
12
12
  import type { RegistryWorkspace } from "./types.js";
13
- /** 宿主 webServer.register 的最小面(WebRoute 形状见 external/host-webserver.md)。 */
13
+ /** 宿主 webServer.register 的最小面(WebRoute 形状见 docs/dependencies/host-webserver.md)。 */
14
14
  export interface WebServerLike {
15
15
  register(route: {
16
16
  kind: "exact" | "prefix";
@@ -18,7 +18,7 @@ export interface WebServerLike {
18
18
  handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
19
19
  }): unknown;
20
20
  }
21
- /** 宿主 workspaceRegistry 的最小面(事实见 external/dsh-workspace-registry.md)。 */
21
+ /** 宿主 workspaceRegistry 的最小面(事实见 docs/dependencies/dsh-workspace-registry.md)。 */
22
22
  export interface WorkspaceRegistryLike {
23
23
  list(): readonly RegistryWorkspace[];
24
24
  }
@@ -80,9 +80,11 @@ function sendWriteFailure(res, error) {
80
80
  }
81
81
  sendFailure(res, error);
82
82
  }
83
- /** 界面上给用户复制到终端的 init 命令(有工作区就带上 --repo,否则脚本找不到台账)。 */
83
+ /** 界面上给用户复制到终端的 init 命令(有工作区就带上 --repo,否则脚本找不到台账)。
84
+ * Windows 上 scriptPath() 已经是 bin 下的 exe,不能加 `sh ` 前缀。 */
84
85
  function initCommandOf(repoPath) {
85
- const head = `sh "${scriptPath()}" init`;
86
+ const entry = scriptPath();
87
+ const head = process.platform === "win32" ? `"${entry}" init` : `sh "${entry}" init`;
86
88
  return repoPath === "" ? head : `${head} --repo "${repoPath}"`;
87
89
  }
88
90
  /** 换身份请求体 → 动作参数(名字 / uuid 的合法性由 skill 再判一次,这里只挡形状)。 */
@@ -5,7 +5,7 @@
5
5
  * (`dsh-client-ui-conversation` `contract/input.d.ts:165`,经 `SessionInputResolver.for(actx)` 取),
6
6
  * 根级 client 插件拿不到某个会话的 `actx`;按 id 取的 `input.shell()` 是包内部件。
7
7
  * 且任务↔会话之间没有绑定字段 ⇒「往哪个会话塞」本身没有答案。链路事实见
8
- * `docs/design/external/dsh-session-handoff.md`,兄弟插件实证 `dsh-task-dispatch-table/src/dispatch.ts:519/562/627`。
8
+ * `docs/dependencies/dsh-session-handoff.md`,兄弟插件实证 `dsh-task-dispatch-table/src/dispatch.ts:519/562/627`。
9
9
  *
10
10
  * 三条硬约束(宿主 rc 线的坑,缺一条就是"会话建了但没法干活"):
11
11
  * 1. `setup` 里必须 `agentPresets.mount()` —— 不挂 preset 的 agent 落到空的全局层,fs / bash 全无;
@@ -5,7 +5,7 @@
5
5
  * (`dsh-client-ui-conversation` `contract/input.d.ts:165`,经 `SessionInputResolver.for(actx)` 取),
6
6
  * 根级 client 插件拿不到某个会话的 `actx`;按 id 取的 `input.shell()` 是包内部件。
7
7
  * 且任务↔会话之间没有绑定字段 ⇒「往哪个会话塞」本身没有答案。链路事实见
8
- * `docs/design/external/dsh-session-handoff.md`,兄弟插件实证 `dsh-task-dispatch-table/src/dispatch.ts:519/562/627`。
8
+ * `docs/dependencies/dsh-session-handoff.md`,兄弟插件实证 `dsh-task-dispatch-table/src/dispatch.ts:519/562/627`。
9
9
  *
10
10
  * 三条硬约束(宿主 rc 线的坑,缺一条就是"会话建了但没法干活"):
11
11
  * 1. `setup` 里必须 `agentPresets.mount()` —— 不挂 preset 的 agent 落到空的全局层,fs / bash 全无;
@@ -20,8 +20,7 @@ export interface SkillsRegistry {
20
20
  * 组装注册体:读内嵌 SKILL.md → 取 name / description → 正文里的脚本路径占位符
21
21
  * 替换为绝对路径。
22
22
  *
23
- * 相对资源解析的二选一(external/dsh-skill-registration.md §三)**未拍板**;
24
- * 最小闭环选「插值绝对路径」——resourceBase 的消费者呈现未验证,不押注。
25
- * 拍板后如改走 resourceBase,只动本函数,调用方无感。
23
+ * 相对资源解析见 docs/dependencies/dsh-skill-registration.md:本实现选「插值绝对路径」,
24
+ * resourceBase 的消费者呈现未验证,不押注。若改走 resourceBase,只动本函数,调用方无感。
26
25
  */
27
26
  export declare function buildSkillRegistration(skillDir?: string): SkillRegistration;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 内嵌 skill 的注册体组装(任务 2「skill 注册最小闭环」)。
3
- * 宿主事实(0.2.0-rc.2 npm pack 亲验):external/dsh-skill-registration.md。
3
+ * 宿主事实(0.2.0-rc.2 npm pack 亲验):docs/dependencies/dsh-skill-registration.md。
4
4
  */
5
5
  import { readFileSync } from "node:fs";
6
6
  import { fileURLToPath } from "node:url";
@@ -31,9 +31,8 @@ function parseFrontmatter(text) {
31
31
  * 组装注册体:读内嵌 SKILL.md → 取 name / description → 正文里的脚本路径占位符
32
32
  * 替换为绝对路径。
33
33
  *
34
- * 相对资源解析的二选一(external/dsh-skill-registration.md §三)**未拍板**;
35
- * 最小闭环选「插值绝对路径」——resourceBase 的消费者呈现未验证,不押注。
36
- * 拍板后如改走 resourceBase,只动本函数,调用方无感。
34
+ * 相对资源解析见 docs/dependencies/dsh-skill-registration.md:本实现选「插值绝对路径」,
35
+ * resourceBase 的消费者呈现未验证,不押注。若改走 resourceBase,只动本函数,调用方无感。
37
36
  */
38
37
  export function buildSkillRegistration(skillDir = SKILL_DIR) {
39
38
  const text = readFileSync(`${skillDir}/SKILL.md`, "utf-8");
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * 后端方法共享类型。
3
3
  * 宿主能力(workspaceRegistry / webServer 等)的结构面在 index.ts 与 routes.ts 本地声明——
4
- * 不 import 官方包(参考插件同款纪律:宿主 rc 接口会无声变,结构化声明 + external/ 文档坐标
5
- * 比绑死官方类型更稳)。
4
+ * 不 import 官方包(参考插件同款纪律:宿主 rc 接口会无声变,结构化声明 + `docs/dependencies/`
5
+ * 下的已核实事实比绑死官方类型更稳)。
6
6
  */
7
7
  import type { DegradedInfo } from "./errors.js";
8
8
  /** 一个可看的台账:机器级清单里的一条(已去掉隐藏)。 */
@@ -16,7 +16,7 @@ export interface LedgerWorkspace {
16
16
  }
17
17
  /**
18
18
  * 宿主 `workspaceRegistry.list()` 条目的最小面(结构声明;事实与坐标见
19
- * external/dsh-workspace-registry.md)。它现在只承担「替台账清单补登记」一件事。
19
+ * docs/dependencies/dsh-workspace-registry.md)。它现在只承担「替台账清单补登记」一件事。
20
20
  */
21
21
  export interface RegistryWorkspace {
22
22
  readonly id: string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 后端方法共享类型。
3
3
  * 宿主能力(workspaceRegistry / webServer 等)的结构面在 index.ts 与 routes.ts 本地声明——
4
- * 不 import 官方包(参考插件同款纪律:宿主 rc 接口会无声变,结构化声明 + external/ 文档坐标
5
- * 比绑死官方类型更稳)。
4
+ * 不 import 官方包(参考插件同款纪律:宿主 rc 接口会无声变,结构化声明 + `docs/dependencies/`
5
+ * 下的已核实事实比绑死官方类型更稳)。
6
6
  */
7
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-task-ledger",
3
- "version": "0.1.5",
3
+ "version": "0.1.8",
4
4
  "description": "Tasks are created, claimed, advanced and closed by the agent and written straight into a plain-text ledger in the workspace, so the owner, the current state and the next step are always on record. It is not limited to development work — research, documentation, presentations and video production all fit. No cloud service is involved: everything is managed locally. Single-user and multi-user both work, with Git synchronisation, and every action is on record. The control panel summarises in-flight, overdue and stalled work with weekly trends.",
5
5
  "icon": "./assets/icon.svg",
6
6
  "keywords": [
@@ -65,6 +65,6 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@deepseek-ai/schemastery": "^3.18.5",
68
- "dsh-plugin-core": "^0.35.3"
68
+ "dsh-plugin-core": "^0.35.7"
69
69
  }
70
70
  }
package/skill/SKILL.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: task-ledger
3
3
  description: 本地任务台账,跨会话记录在办任务的归属、进度与起止。当用户要登记一件新的事(新建任务 / 建个坑 / 这活我领了)、记录已有任务的进展(接着做 / 记一条进展 / 这轮先记下)、查看任务状态或历史(现在该做什么 / 这活谁在做 / 上周做过什么)、给任务结案 / 取消作废 / 退回(做完了 / 验收通过 / 取消 / 作废 / 退回待认领)、删除建错的或垃圾任务(只认「删除」二字)、整理标签或检查台账一致性时加载;同一件事做了多轮、用户始终没提记账时也加载,问一句要不要建台账(只提醒一次,无需就忽略)。
4
- version: 1.3.57
4
+ version: 1.3.58
5
5
  allowed-tools: Read,Edit,Bash,Grep
6
6
  ---
7
7
 
@@ -319,6 +319,7 @@ allowed-tools: Read,Edit,Bash,Grep
319
319
  - **不需要安装任何东西**(不装解释器、不装运行时、不往 PATH 里加命令):直接执行上面那条绝对路径即可。
320
320
  - 若报 `Permission denied`(某些安装环节会丢可执行位),前面加 `sh `:`sh <本 SKILL.md 所在目录>/scripts/progress <子命令> …`。
321
321
  - **交给用户的命令必须是这个绝对路径**,不许简写成 `progress` —— 用户机器的 PATH 里没有这个命令,简写后用户一跑就是 `command not found`。
322
+ - **Windows 上直接跑 `scripts/bin/ledger-windows-amd64.exe`**:`scripts/progress` 是无扩展名的 sh 包装,CreateProcessW 不会执行它(还会按扩展名补 `.exe` 去找 → 报找不到)。同一目录下的 exe 参数完全一致;Git Bash / WSL 里仍可用 `scripts/progress`。
322
323
 
323
324
  - 定位项目:`--repo <工作区根>`(**直接含有 `ledger/` 的那个目录**)给了就校验后用;不给就从当前目录逐级向上找。当前目录已经在这个工作区里时不要带 `--repo`,只有要操作别的工作区才带。`ledger/` 本身、以及它下面的任何子目录都不是根,指过去会被直接拒绝(判据只看位置,不看目录里有哪些文件 —— 项目根自带 `pool.json`、`history/`、`worklog/` 都不影响)。
324
325
  - `--no-sync`(放在子命令**前**):用户明确要求「先别同步」时才用;之后自己 `git add ledger && commit && push`。
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "task-ledger",
3
- "version": "1.3.57",
3
+ "version": "1.3.58",
4
4
  "description": "Task-ledger skill for coding agents: per-workspace progress tracking (ledger/pool.json + owners/<hash>.json shards + owners.json index, history, worklog) driven by a CLI script. Standalone install for CodeBuddy and other agents; also bundled inside the dsh-task-ledger DSH plugin.",
5
5
  "keywords": [
6
6
  "skill",