harnessed 5.0.3 → 5.0.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/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // package.json
2
2
  var package_default = {
3
- version: "5.0.3"};
3
+ version: "5.0.5"};
4
4
 
5
5
  // src/index.ts
6
6
  var VERSION = package_default.version;
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";AAAA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,OA4Gb,CAAA;;;ACzGO,IAAM,UAAU,eAAA,CAAI","file":"index.mjs","sourcesContent":["{\n \"name\": \"harnessed\",\n \"version\": \"5.0.3\",\n \"description\": \"AI coding harness package manager + composition orchestrator\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"author\": \"easyinplay\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/easyinplay/harnessed.git\"\n },\n \"homepage\": \"https://github.com/easyinplay/harnessed#readme\",\n \"bugs\": \"https://github.com/easyinplay/harnessed/issues\",\n \"keywords\": [\n \"claude-code\",\n \"ai-harness\",\n \"package-manager\",\n \"composition\",\n \"skill-pack\",\n \"mcp\",\n \"orchestrator\"\n ],\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"packageManager\": \"pnpm@10.12.0\",\n \"bin\": {\n \"harnessed\": \"./dist/cli.mjs\",\n \"harnessed-inject-state\": \"./bin/harnessed-inject-state.mjs\"\n },\n \"main\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"default\": \"./dist/index.mjs\"\n },\n \"./schemas\": {\n \"types\": \"./dist/schemas/index.d.ts\",\n \"import\": \"./dist/schemas/index.mjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"bin\",\n \"manifests\",\n \"messages\",\n \"workflows\",\n \"routing\",\n \"config-templates\",\n \"schemas\",\n \"README.md\",\n \"README-en.md\",\n \"README-zh.md\",\n \"LICENSE\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.md\"\n ],\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"build\": \"tsc --noEmit && tsup && node ./scripts/build-hooks.mjs\",\n \"build:hooks\": \"node ./scripts/build-hooks.mjs\",\n \"build:schema\": \"node ./scripts/build-schema.mjs\",\n \"validate:schema\": \"node ./scripts/validate-schema.mjs\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run --passWithNoTests\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage --passWithNoTests\",\n \"test:codex-live\": \"node ./scripts/codex-live/run.mjs\",\n \"bench\": \"vitest bench --run\",\n \"bench:runtime\": \"node scripts/benchmark-runtime.mjs\",\n \"test:runtime-channels\": \"node scripts/runtime-channel-smoke.mjs\",\n \"test:docs\": \"node --test tests/docs/install-channels.contract.mjs\",\n \"lint\": \"biome check .\",\n \"lint:fix\": \"biome check --write .\",\n \"format\": \"biome format --write .\",\n \"build:binary\": \"bun scripts/build-binary.mjs\"\n },\n \"dependencies\": {\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.142\",\n \"@clack/prompts\": \"^0.10.1\",\n \"@sinclair/typebox\": \"^0.34.49\",\n \"ajv\": \"^8.20.0\",\n \"ajv-errors\": \"^3.0.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"commander\": \"^13.0.0\",\n \"diff\": \"^9.0.0\",\n \"expr-eval\": \"^2.0.2\",\n \"picocolors\": \"^1.1.1\",\n \"proper-lockfile\": \"^4.1.2\",\n \"undici\": \"^8.12.1\",\n \"yaml\": \"^2.9.0\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.0.0\",\n \"@types/node\": \"^22.10.0\",\n \"@types/proper-lockfile\": \"^4.1.4\",\n \"@vitest/coverage-v8\": \"^4.0.0\",\n \"esbuild\": \"0.27.7\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.0\",\n \"vitest\": \"^4.0.0\"\n },\n \"pnpm\": {\n \"onlyBuiltDependencies\": [\n \"esbuild\"\n ]\n }\n}\n","// Main library entry — re-exports public APIs.\n// phase 1.1 batch 1: skeleton only; schema validator wired in batch 2 (T3+).\n\nimport pkg from '../package.json' with { type: 'json' }\n\nexport const VERSION = pkg.version\n"]}
1
+ {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";AAAA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,OA6Gb,CAAA;;;AC1GO,IAAM,UAAU,eAAA,CAAI","file":"index.mjs","sourcesContent":["{\n \"name\": \"harnessed\",\n \"version\": \"5.0.5\",\n \"description\": \"AI coding harness package manager + composition orchestrator\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"author\": \"easyinplay\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/easyinplay/harnessed.git\"\n },\n \"homepage\": \"https://github.com/easyinplay/harnessed#readme\",\n \"bugs\": \"https://github.com/easyinplay/harnessed/issues\",\n \"keywords\": [\n \"claude-code\",\n \"ai-harness\",\n \"package-manager\",\n \"composition\",\n \"skill-pack\",\n \"mcp\",\n \"orchestrator\"\n ],\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"packageManager\": \"pnpm@10.12.0\",\n \"bin\": {\n \"harnessed\": \"./dist/cli.mjs\",\n \"harnessed-inject-state\": \"./bin/harnessed-inject-state.mjs\"\n },\n \"main\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"default\": \"./dist/index.mjs\"\n },\n \"./schemas\": {\n \"types\": \"./dist/schemas/index.d.ts\",\n \"import\": \"./dist/schemas/index.mjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"bin\",\n \"manifests\",\n \"messages\",\n \"workflows\",\n \"routing\",\n \"config-templates\",\n \"schemas\",\n \"README.md\",\n \"README-en.md\",\n \"README-zh.md\",\n \"LICENSE\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.md\"\n ],\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"build\": \"tsc --noEmit && tsup && node ./scripts/build-hooks.mjs\",\n \"build:hooks\": \"node ./scripts/build-hooks.mjs\",\n \"build:schema\": \"node ./scripts/build-schema.mjs\",\n \"validate:schema\": \"node ./scripts/validate-schema.mjs\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run --passWithNoTests\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage --passWithNoTests\",\n \"test:codex-live\": \"node ./scripts/codex-live/run.mjs\",\n \"bench\": \"vitest bench --run\",\n \"bench:runtime\": \"node scripts/benchmark-runtime.mjs\",\n \"test:runtime-channels\": \"node scripts/runtime-channel-smoke.mjs\",\n \"test:docs\": \"node --test tests/docs/install-channels.contract.mjs\",\n \"lint\": \"biome check .\",\n \"lint:fix\": \"biome check --write .\",\n \"format\": \"biome format --write .\",\n \"build:binary\": \"bun scripts/build-binary.mjs\"\n },\n \"dependencies\": {\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.142\",\n \"@clack/prompts\": \"^0.10.1\",\n \"@sinclair/typebox\": \"^0.34.49\",\n \"ajv\": \"^8.20.0\",\n \"ajv-errors\": \"^3.0.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"commander\": \"^13.0.0\",\n \"diff\": \"^9.0.0\",\n \"expr-eval\": \"^2.0.2\",\n \"picocolors\": \"^1.1.1\",\n \"proper-lockfile\": \"^4.1.2\",\n \"smol-toml\": \"^1.9.1\",\n \"undici\": \"^8.12.1\",\n \"yaml\": \"^2.9.0\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.0.0\",\n \"@types/node\": \"^22.10.0\",\n \"@types/proper-lockfile\": \"^4.1.4\",\n \"@vitest/coverage-v8\": \"^4.0.0\",\n \"esbuild\": \"0.27.7\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.0\",\n \"vitest\": \"^4.0.0\"\n },\n \"pnpm\": {\n \"onlyBuiltDependencies\": [\n \"esbuild\"\n ]\n }\n}\n","// Main library entry — re-exports public APIs.\n// phase 1.1 batch 1: skeleton only; schema validator wired in batch 2 (T3+).\n\nimport pkg from '../package.json' with { type: 'json' }\n\nexport const VERSION = pkg.version\n"]}
@@ -0,0 +1,39 @@
1
+ apiVersion: harnessed/v1
2
+ kind: Manifest
3
+ metadata:
4
+ name: update-reminder
5
+ display_name: Harnessed Update Reminder
6
+ description: Cache-only SessionStart reminder for available harnessed updates.
7
+ upstream:
8
+ source: update-reminder
9
+ homepage: https://github.com/easyinplay/harnessed
10
+ repository: https://github.com/easyinplay/harnessed.git
11
+ license: Apache-2.0
12
+ notice: First-party harnessed update reminder.
13
+ spec:
14
+ type: cc-hook
15
+ component_type: command
16
+ category: meta
17
+ install_type: hook
18
+ install:
19
+ method: cc-hook-add
20
+ cmd: "node bin/harnessed-update-reminder.mjs"
21
+ hook_event: SessionStart
22
+ hook_command: "node bin/harnessed-update-reminder.mjs"
23
+ idempotent_check: "grep -q harnessed-update-reminder ~/.claude/settings.json"
24
+ verify:
25
+ cmd: "grep -q harnessed-update-reminder ~/.claude/settings.json"
26
+ timeout_ms: 5000
27
+ expected_exit_code: 0
28
+ uninstall:
29
+ cmd: "true"
30
+ upstream_health:
31
+ stability: stable
32
+ last_check: "2026-10-30"
33
+ last_known_good_version: "5.0.5"
34
+ fallback_action: warn
35
+ signed_by: easyinplay
36
+ platforms:
37
+ - linux
38
+ - darwin
39
+ - win32
@@ -29,13 +29,13 @@ spec:
29
29
  # pin 的 2.37.0 在 win32 上 /clear 恢复完全不工作)+ opt-in --autonomous
30
30
  # (省 per-tool 重注入 token)+ PLANNING_DISABLED=1 逃生口(v3.4.0)。
31
31
  git_ref: v3.4.1
32
- idempotent_check: "/plugin list | grep -q planning-with-files"
32
+ idempotent_check: "claude plugin list --json"
33
33
  marketplace_source: # ADR 0005 — third-party marketplace structured metadata
34
34
  source: github
35
35
  repo: OthmanAdi/planning-with-files
36
36
  verify:
37
37
  # Claude plugin payload verification remains a separate installer-channel follow-up.
38
- cmd: "/plugin list | grep -q planning-with-files"
38
+ cmd: "claude plugin list --json"
39
39
  timeout_ms: 5000
40
40
  uninstall:
41
41
  cmd: "/plugin uninstall planning-with-files@planning-with-files"
@@ -28,9 +28,9 @@ spec:
28
28
  # v6.1.1 Codex `hooks: {}` 修复(不再误注册 Claude SessionStart hook)。
29
29
  # Gemini CLI 支持上游移除(Google EOL)— harnessed 无 gemini 平台面,无涉。
30
30
  git_ref: v6.1.1
31
- idempotent_check: "/plugin list | grep -q superpowers"
31
+ idempotent_check: "claude plugin list --json"
32
32
  verify:
33
- cmd: "/plugin list | grep -q superpowers"
33
+ cmd: "claude plugin list --json"
34
34
  timeout_ms: 5000
35
35
  uninstall:
36
36
  cmd: "/plugin uninstall superpowers@superpowers-marketplace"
@@ -37,9 +37,10 @@ spec:
37
37
  const platform = process.env.HARNESSED_PLATFORM;
38
38
  const codex = platform ? platform === "codex" : Boolean(process.env.CODEX_HOME || process.env.CODEX_SESSION_ID);
39
39
  const codexHome = path.resolve(process.env.CODEX_HOME || path.join(home, ".codex"));
40
+ const claudeHome = path.resolve(process.env.CLAUDE_CONFIG_DIR || path.join(home, ".claude"));
40
41
  const roots = codex
41
42
  ? [path.join(home, ".agents", "skills", "webapp-testing"), path.join(codexHome, "skills", "webapp-testing")]
42
- : [".agents", ".codex", ".claude"].map(dir => path.join(home, dir, "skills", "webapp-testing"));
43
+ : [path.join(claudeHome, "skills", "webapp-testing")];
43
44
  const root = roots.find(dir => fs.existsSync(path.join(dir, "SKILL.md")));
44
45
  if (!root) throw new Error("webapp-testing SKILL.md is missing");
45
46
  for (const resource of ["SKILL.md", "scripts/with_server.py"]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harnessed",
3
- "version": "5.0.3",
3
+ "version": "5.0.5",
4
4
  "description": "AI coding harness package manager + composition orchestrator",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -90,6 +90,7 @@
90
90
  "expr-eval": "^2.0.2",
91
91
  "picocolors": "^1.1.1",
92
92
  "proper-lockfile": "^4.1.2",
93
+ "smol-toml": "^1.9.1",
93
94
  "undici": "^8.12.1",
94
95
  "yaml": "^2.9.0"
95
96
  },
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: harnessed-update
3
+ description: |
4
+ Preview, confirm and execute a deterministic harnessed update. Report partial
5
+ outcomes honestly; offer bounded agent repair only after a second confirmation.
6
+ trigger_phrases:
7
+ - "harnessed update"
8
+ - "update harnessed"
9
+ - "更新 harnessed"
10
+ ---
11
+
12
+ # harnessed-update
13
+
14
+ ## Overview
15
+
16
+ One interactive entry point for deterministic self-update, harnessed-owned asset
17
+ refresh and reviewed updates of already-installed third-party components.
18
+ The CLI is the source of truth, not an agent's interpretation of installer logs.
19
+
20
+ ## Process
21
+
22
+ 1. Run `harnessed update --all --dry-run --json` for a read-only preview. Capture
23
+ stdout, stderr and the exit code separately. Read exactly one JSON object from
24
+ stdout even on nonzero exit; stderr contains diagnostics, not result data.
25
+ Validate `schemaVersion=1`, `operation=update`, `mode`, `host` and `runtime`.
26
+ Missing or malformed JSON, `error` or `failed` preview components mean STOP.
27
+ A preview containing `unsupported` is still partial; show those limits.
28
+ 2. Show the proposed changes and ask for explicit confirmation via
29
+ {{ host.ask_user }}. Cancellation, silence or unavailable confirmation means
30
+ STOP without mutation. A delegated subagent without approval must return
31
+ `STATUS: NEEDS_CLARIFICATION` for the main session to ask the user.
32
+ 3. Only after confirmation, run `harnessed update --all --json` exactly once.
33
+ The CLI owns P1 self-update and verified absolute-path P2 continuation; do not
34
+ launch continuation yourself or refresh assets from the replaced runtime.
35
+ 4. Display `status`, `components`, `warnings` and `error`. For every component,
36
+ show `id`, `status`, `before`, `target`, `after`, `reasonCode`, `verified` and
37
+ `restartRequired`. Keep unknown versions as `null`, not inferred `current`.
38
+ 5. `unsupported` and `retained` mean `partial`, never all-success. `unsupported`
39
+ has no reviewed update path. `retained` means refresh failed but the previous
40
+ installation still verifies; it was not updated. `not-installed` remains
41
+ absent, not installed or updated. Preserve the CLI's top-level result.
42
+ 6. Any `restartRequired=true` means STOP and ask the user to restart
43
+ {{ host.native }} before further workflow work, even if the update completed.
44
+ `handoff-failed`, `invalid-continuation`, `error` or nonzero exit means STOP.
45
+ A failed or partial component is not success: preserve the result and
46
+ diagnostics, then continue only to the bounded repair proposal in step 7.
47
+
48
+ 7. If the applied result contains `failed`, `unsupported` or `retained`
49
+ reviewed third-party components, show a second proposal before any repair.
50
+ State that harnessed orchestrates upstream open-source components and that
51
+ repair may read installation state, run upstream installers or verification
52
+ commands, modify the listed skill/plugin/host targets, and invoke the
53
+ selected host agent. State that it does not grant plugin or MCP trust, read
54
+ credentials, expand the host root, or touch components outside the listed
55
+ scope.
56
+ 8. Ask for explicit confirmation bound to the exact component ids in the
57
+ proposal. If confirmed, run exactly once:
58
+ `harnessed update --all --repair --yes --json`.
59
+ `--yes` is the explicit authorization for this bounded repair operation;
60
+ it is not a general future permission. If declined, unavailable or
61
+ non-interactive without `--yes`, do not invoke an agent and preserve the
62
+ deterministic `partial` or `failed` result.
63
+ 9. Treat `agentRepair.status=completed` as advisory only. The CLI must report
64
+ `agentRepair.verified=true` after rerunning the deterministic verifier;
65
+ otherwise report `verification-failed` or `failed`. Never rewrite the
66
+ original component result or claim overall success from an agent response.
67
+
68
+ ## Boundary
69
+
70
+ Phase 79 provides the bounded repair path. Do not start agent repair without the second explicit confirmation. Do not
71
+ install missing third parties, infer update commands from manifests, read
72
+ credentials, grant trust, rewrite ownership or switch host roots. The repair
73
+ runner is bounded to the exact reviewed component list and must finish with a
74
+ deterministic verifier pass.
75
+
76
+ These STOP rules override the generic invoke loop below: do not respawn or retry
77
+ the deterministic update, use `checkpoint --force` or claim COMPLETE after a
78
+ partial, failed or restart-blocked result. The only allowed next action for a
79
+ partial or failed result is the second-confirmation repair path in step 7;
80
+ otherwise report the evidence and return control to the user.
81
+ Only a verified `complete` result with no restart requirement can complete the
82
+ workflow; preview `planned` is not an applied update.
83
+
84
+ ## How to invoke
85
+
86
+ !`harnessed checkpoint intent harnessed-update`
87
+
88
+ > The banner above (when present) means this invocation is REGISTERED with the engine (an intent marker) — not yet compliant: the steps below (prompt → spawn → checkpoint complete) resolve it, and a per-turn `<workflow-intent>` reminder persists until they run.
89
+
90
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
91
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
92
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
93
+ {{ host.native }} {{ host.spawn_subagent }} (keeps the session responsive + lets clarification round-trips reach the user).
94
+
95
+ Do NOT pipe to `harnessed run harnessed-update` — that is the CI/headless path ({{ host.harnessed_run_warning_note.execution_tail }}
96
+
97
+ 1. Bash: `harnessed prompt harnessed-update --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
98
+ 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
99
+ - on return, write the subagent's final output to a file and run `harnessed checkpoint complete harnessed-update --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
100
+ - if it blocks, run `harnessed checkpoint fail harnessed-update --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
101
+ - respawn ONLY while none of those three has fired. Any one of them means stop: re-scope the subtask, fix the blocker, or escalate to the user. Never respawn past a stop directive.
102
+ 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
103
+ 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete harnessed-update --result-file <path> --summary "<one-line>"`. Fail-CLOSED — it blocks unless every declared `artifacts_expected` file exists, the TDD boundary passes (non-empty evidence / both the red and green sides present / the test file was not deleted), and the result carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
104
+ 5. If the complete gate blocked: Bash `harnessed checkpoint fail harnessed-update --failing-tests <n>` to record the attempt. It prints `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP` once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope the subtask, fix the blocker, or escalate to the user.
105
+
106
+ <!-- harnessed-generated:v4.12.0 -->
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: harnessed-update
3
+ description: |
4
+ 预览、确认并执行确定性 harnessed 更新。如实展示 partial,
5
+ 只有在第二次确认后才提供有边界的 agent repair。
6
+ trigger_phrases:
7
+ - "harnessed update"
8
+ - "update harnessed"
9
+ - "更新 harnessed"
10
+ ---
11
+
12
+ # harnessed-update
13
+
14
+ ## 概述
15
+
16
+ 为确定性 self-update、harnessed 自有资产刷新及已安装第三方组件的经审查更新,
17
+ 提供统一交互入口。CLI 是结果的唯一依据,不得由 agent 解读安装日志后自行判定成功。
18
+
19
+ ## 执行流程
20
+
21
+ 1. 运行 `harnessed update --all --dry-run --json` 获取只读 preview。
22
+ 分别保留 stdout、stderr 与 exit code。即使 exit 非零,也读取 stdout 中唯一的
23
+ JSON 对象;stderr 是诊断,不是结果数据。验证 `schemaVersion=1`、
24
+ `operation=update`、`mode`、`host` 和 `runtime`。JSON 缺失、格式错误、`error`
25
+ 或 failed 预览组件均 STOP。含 `unsupported` 的 preview 仍为 partial,必须展示限制。
26
+ 2. 展示计划变更,通过 {{ host.ask_user }} 获得明确确认。
27
+ 取消、沉默或无法确认均 STOP,不得修改。被委派且尚无授权的 subagent 必须返回
28
+ `STATUS: NEEDS_CLARIFICATION`,由主 session 询问用户。
29
+ 3. 确认后仅运行一次 `harnessed update --all --json`。P1 self-update 与经验证的
30
+ absolute-path P2 continuation 均由 CLI 管理;不得自行启动 continuation,
31
+ 不得在被替换的 runtime 中刷新资产。
32
+ 4. 展示 `status`、`components`、`warnings` 和 `error`。逐组件展示 `id`、`status`、
33
+ `before`、`target`、`after`、`reasonCode`、`verified` 与 `restartRequired`。
34
+ 未知版本保留 `null`,不得推断为 `current`。
35
+ 5. `unsupported` 与 `retained` 表示 `partial`,不是全部成功。`unsupported` 没有经审查的
36
+ 更新路径。`retained` 表示刷新失败但旧安装仍通过验证,不是已更新。
37
+ `not-installed` 表示保持缺失,不是已安装或已更新。保留 CLI 的顶层结果。
38
+ 6. 任一 `restartRequired=true` 均 STOP,要求用户重启 {{ host.native }} 后再进行其他
39
+ workflow 工作,即使更新已经完成也不能继续旧 session。
40
+ `handoff-failed`、`invalid-continuation`、`error` 或 exit 非零均 STOP。
41
+ failed 或 partial 组件不代表成功:保留结果与诊断,然后只能继续第 7 步的有边界
42
+ repair proposal。
43
+
44
+ 7. 如果应用结果包含 `failed`、`unsupported` 或 `retained` 的已审查第三方组件,
45
+ 在任何 repair 前展示第二份 repair proposal。明确说明 harnessed 编排上游开源组件,
46
+ repair 可能读取安装状态、执行上游安装器或验证命令、修改列出的 skill/plugin/host
47
+ 目标,并启动选定的宿主 agent。明确说明它不会授予 plugin 或 MCP trust、读取凭据、
48
+ 扩大 host root,也不会触碰列表之外的组件。
49
+ 8. 要求用户确认 proposal 中的精确组件 id。确认后只运行一次:
50
+ `harnessed update --all --repair --yes --json`。
51
+ `--yes` 只代表本次有边界的 repair 已获得明确授权,不是未来永久授权。用户拒绝、无法确认,
52
+ 或 non-interactive 且没有 `--yes` 时,不得调用 agent,保留确定性 `partial` 或 `failed` 结果。
53
+ 9. `agentRepair.status=completed` 只能作为过程状态。CLI 必须在重新运行确定性 verifier 后报告
54
+ `agentRepair.verified=true`;否则报告 `verification-failed` 或 `failed`。不得根据 agent 回复
55
+ 改写原组件结果或声称整体成功。
56
+
57
+ ## 边界
58
+
59
+ Phase 79 提供有边界的 repair 路径。没有第二次明确确认不得启动 agent repair。不得安装缺失的第三方组件、从 manifest 推断更新
60
+ 命令、读取凭据、授予 trust、改写所有权或切换 host root。repair runner 只允许处理精确的已
61
+ 审查组件列表,并且必须以确定性 verifier 的结果结束。
62
+
63
+ 上述 STOP 规则优先于下方通用 invoke loop:对于 partial、failed 或 restart 阻塞结果,
64
+ 不得 respawn、重试确定性更新、使用 `checkpoint --force` 或宣称 COMPLETE。partial 或
65
+ failed 结果唯一允许的下一步是第 7 步的二次确认 repair;否则报告证据并将控制权交还用户。
66
+ 只有经验证的 `complete` 且无需 restart 时才能完成 workflow;
67
+ preview 的 `planned` 不代表已执行更新。
68
+
69
+ ## 如何调用
70
+
71
+ !`harnessed checkpoint intent harnessed-update`
72
+
73
+ > 上方 banner(如出现)表示本次调用已在引擎**登记**(intent 标记)——尚未合规:按下方步骤(prompt → spawn → checkpoint complete)完成即解除;在此之前每 turn 会持续注入 `<workflow-intent>` 提醒。
74
+
75
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
76
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
77
+ {{ host.native }} {{ host.spawn_subagent.zh_tool }} spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
78
+
79
+ **不要** pipe 到 `harnessed run harnessed-update` —— 那是 CI/headless 路径({{ host.harnessed_run_warning_note.execution_tail }}
80
+
81
+ 1. Bash: `harnessed prompt harnessed-update --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
82
+ 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
83
+ - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete harnessed-update --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
84
+ - 若被拦下,跑 `harnessed checkpoint fail harnessed-update --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
85
+ - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
86
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
87
+ 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete harnessed-update --result-file <path> --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
88
+ 5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail harnessed-update --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
89
+
90
+ <!-- harnessed-generated:v4.12.0 -->
@@ -0,0 +1,19 @@
1
+ schema_version: harnessed.workflow.v3
2
+ workflow: harnessed-update
3
+ description: |
4
+ Interactive deterministic update: preview, explicit confirmation, then
5
+ harnessed update --all --json. Report partial results honestly. When the
6
+ deterministic result retains or fails reviewed third-party components, show a
7
+ bounded repair proposal and require a second explicit confirmation before
8
+ harnessed update --all --repair --yes --json.
9
+
10
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
11
+ tools_available: []
12
+
13
+ phases:
14
+ - id: 01-update
15
+ name: Preview, confirm, repair and report the update
16
+ upstream: harnessed
17
+ capability: harnessed update --all --json
18
+ model: sonnet
19
+ max_iterations: 1
@@ -30,6 +30,32 @@ schema_version: harnessed.role-prompts.v1
30
30
 
31
31
  prompts:
32
32
 
33
+ harnessed-update:
34
+ primary_cap: ""
35
+ specialist: "Deterministic update coordinator"
36
+ responsibility: |
37
+ Run `harnessed update --all --dry-run --json` for a read-only preview.
38
+ Show the proposed changes and limits, then obtain explicit confirmation
39
+ through {{ host.ask_user }} before running `harnessed update --all --json`
40
+ exactly once. If delegated without confirmation, return
41
+ `STATUS: NEEDS_CLARIFICATION` so the main session can ask the user.
42
+ Display the deterministic results; never substitute agent judgement for
43
+ verification. Phase 79 handles failed, unsupported or retained reviewed
44
+ components: present a second repair proposal and require explicit confirmation bound
45
+ to its component ids before using --repair --yes --json.
46
+ checklist:
47
+ - "Read exactly one JSON object from stdout, including on nonzero exit; stderr is diagnostics. Validate schemaVersion=1, operation=update, mode, host and runtime; malformed or missing JSON means STOP."
48
+ - "Preview is not authorization: cancellation, silence or unavailable confirmation means STOP without mutation. Unsupported preview entries remain visible; error or failed preview components mean STOP."
49
+ - "Results: preserve status, components, warnings and error; show each id, status, before, target, after, reasonCode, verified and restartRequired. Unknown versions stay null, not current."
50
+ - "unsupported or retained means partial, never all-success: unsupported has no reviewed update path; retained means refresh failed but the previous installation still verifies. not-installed means left absent, not installed or updated."
51
+ - "Any restartRequired=true means STOP and ask the user to restart {{ host.native }} before further workflow work, even when the update completed. Do not continue in the old session."
52
+ - "handoff-failed, invalid-continuation, failed components, error or nonzero exit means STOP. Report that harnessed may have changed while closure did not complete; preserve evidence and do not retry."
53
+ - "Repair may invoke the selected host agent and run upstream installers or verification commands only after the second confirmation; it may modify only listed targets and never reads credentials, grants plugin or MCP trust, expands host roots, or touches unlisted components."
54
+ - "After repair, require agentRepair.verified=true from a deterministic verifier; never rewrite the original result or claim success from agent output."
55
+ - "STOP overrides generic invoke-loop respawn instructions. Never use checkpoint --force or claim COMPLETE to bypass a failed, partial or restart-blocked update."
56
+ severity: "complete / planned / partial / failed (partial is not all-success; restartRequired means STOP)"
57
+ description: "Preview, confirm and run a deterministic harnessed update; offer bounded repair only after a second confirmation."
58
+
33
59
  # ============================================================================
34
60
  # Super-master + 4 stage-master (orchestrators — short dispatcher prompts)
35
61
  # ============================================================================
@@ -20,6 +20,30 @@ schema_version: harnessed.role-prompts.v1
20
20
 
21
21
  prompts:
22
22
 
23
+ harnessed-update:
24
+ primary_cap: ""
25
+ specialist: "确定性更新协调者"
26
+ responsibility: |
27
+ 运行 `harnessed update --all --dry-run --json` 获取只读 preview。
28
+ 展示计划变更与限制,通过 {{ host.ask_user }} 获得用户明确确认后,
29
+ 仅运行一次 `harnessed update --all --json`。
30
+ 若被委派时尚无确认,返回 `STATUS: NEEDS_CLARIFICATION`,由主 session 询问用户。
31
+ 展示确定性 results,不得以 agent 判断替代验证。Phase 79 负责 failed、unsupported 或 retained
32
+ 的已审查组件:先展示第二份 repair proposal,再对其中的组件 id 获取明确确认后使用
33
+ --repair --yes --json。
34
+ checklist:
35
+ - "即使 exit 非零也读取 stdout 中唯一的 JSON 对象;stderr 仅为诊断。验证 schemaVersion=1、operation=update、mode、host 和 runtime;JSON 缺失或格式错误即 STOP。"
36
+ - "preview 不构成授权:取消、沉默或无法确认均 STOP,不得修改。unsupported 预览项必须展示;error 或 failed 预览组件即 STOP。"
37
+ - "results 保留 status、components、warnings 和 error;逐项展示 id、status、before、target、after、reasonCode、verified 和 restartRequired。未知版本保留 null,不可称为 current。"
38
+ - "unsupported 或 retained 表示 partial,不是全部成功:unsupported 没有经审查的更新路径;retained 表示刷新失败但旧安装仍通过验证。not-installed 表示保持缺失,不是已安装或已更新。"
39
+ - "任一 restartRequired=true 均 STOP,要求用户重启 {{ host.native }} 后再进行其他 workflow 工作,即使更新已经完成也不得在旧 session 继续。"
40
+ - "handoff-failed、invalid-continuation、failed 组件、error 或 exit 非零均 STOP。说明 harnessed 可能已经变更,但更新闭环尚未完成;保留证据,不得重试。"
41
+ - "第二次确认后 repair 才能启动选定的宿主 agent,执行上游安装器或验证命令;只允许修改列出的目标,不得读取凭据、授予 plugin 或 MCP trust、扩大 host root 或触碰列表之外的组件。"
42
+ - "repair 完成后必须由确定性 verifier 产生 agentRepair.verified=true;不得改写原结果或根据 agent 输出声称成功。"
43
+ - "STOP 优先于通用 invoke-loop 的 respawn 指令。不得使用 checkpoint --force 或宣称 COMPLETE 绕过 failed、partial 或 restart 阻塞。"
44
+ severity: "complete / planned / partial / failed (partial 不等于全部成功;restartRequired 必须 STOP)"
45
+ description: "预览、确认并执行确定性 harnessed 更新;仅在第二次确认后提供有边界的 repair。"
46
+
23
47
  # ============================================================================
24
48
  # Super-master + 4 stage-master (orchestrators — short dispatcher prompts)
25
49
  # ============================================================================
@@ -21,11 +21,23 @@ ready to tag a release:
21
21
 
22
22
  | check | passes when |
23
23
  | ----- | ----------- |
24
- | `changelog` | `## [Unreleased]` has entries (this release is documented) |
25
- | `version` | `package.json` has a valid semver |
24
+ | `changelog` | `## [Unreleased]` has entries, or a section exists for the valid target version |
25
+ | `version` | A static valid SemVer is discovered, or supplied with `--release-version <semver>` |
26
26
  | `git-clean` | the working tree has no uncommitted changes |
27
27
  | `tag-absent` | a `v<version>` tag does NOT already exist |
28
28
 
29
+ Version sources are `package.json.version`, `pyproject.toml [project].version`,
30
+ `pyproject.toml [tool.poetry].version`, and `Cargo.toml [package].version`.
31
+ `harnessed release-preflight --release-version <semver>` takes highest priority;
32
+ an invalid explicit value fails without falling back to manifests. Matching discovered
33
+ versions are accepted. Conflicting valid versions fail closed and require an explicit
34
+ override. No target version is inferred from git tags. Missing, dynamic,
35
+ workspace-inherited or malformed versions cannot supply a static target. If no valid
36
+ target can be determined, `version` fails and `tag-absent` is warn/not-run, never a check
37
+ against the literal tag `v`. Version-specific CHANGELOG sections are checked only for
38
+ a valid target; `[Unreleased]` remains independent. Root `harnessed --version` still
39
+ prints the harnessed CLI version, not the target release version.
40
+
29
41
  ## Process
30
42
 
31
43
  1. Run `harnessed release-preflight`.
@@ -20,11 +20,21 @@ trigger_phrases:
20
20
 
21
21
  | 检查项 | 通过条件 |
22
22
  | ----- | ----------- |
23
- | `changelog` | `## [Unreleased]` 下有实质性内容(本次发布已有文档) |
24
- | `version` | `package.json` 包含有效的 semver 版本号 |
23
+ | `changelog` | `## [Unreleased]` 下有实质性内容,或存在有效目标版本对应的章节 |
24
+ | `version` | 发现静态有效的 SemVer,或通过 `--release-version <semver>` 显式指定 |
25
25
  | `git-clean` | 工作区无未提交的改动 |
26
26
  | `tag-absent` | `v<version>` tag 尚不存在 |
27
27
 
28
+ 版本来源为 `package.json.version`、`pyproject.toml [project].version`、
29
+ `pyproject.toml [tool.poetry].version` 和 `Cargo.toml [package].version`。
30
+ `harnessed release-preflight --release-version <semver>` 优先级最高;显式值无效时
31
+ 直接失败,不回退到 manifest。发现的有效版本相同则允许,不同则 fail closed,必须
32
+ 显式 override。不从 git tag 推断目标版本。缺失、动态、workspace 继承或损坏的版本
33
+ 不能提供静态目标。如果无法确定有效目标,`version` 失败,`tag-absent` 标记为
34
+ warn/not-run,绝不检查字面量 tag `v`。只有有效目标版本才检查 CHANGELOG 的对应章节,
35
+ `[Unreleased]` 路径保持独立。根 `harnessed --version` 仍输出 harnessed CLI 自身版本,
36
+ 不是目标发布版本。
37
+
28
38
  ## Process
29
39
 
30
40
  1. 运行 `harnessed release-preflight`。
@@ -13,9 +13,15 @@ schema_version: harnessed.workflow.v3
13
13
  workflow: ship-preflight
14
14
  description: |
15
15
  Stage ⑤.a release-preflight gate — runs `harnessed release-preflight` (read-only:
16
- CHANGELOG [Unreleased] non-empty + package.json version + git working tree clean +
17
- v<version> tag absent). A failing gate BLOCKS shipping until the release is documented
18
- and the tree is clean. Nothing is pushed, published, or tagged here.
16
+ CHANGELOG [Unreleased] non-empty or valid version section + static SemVer from
17
+ package.json.version, pyproject.toml [project].version / [tool.poetry].version,
18
+ or Cargo.toml [package].version + git working tree clean + v<version> tag absent).
19
+ Use `harnessed release-preflight --release-version <semver>` to override manifests.
20
+ Equal discovered versions are accepted; conflicting valid versions fail closed and
21
+ require an explicit override. Missing, dynamic, workspace-inherited or malformed
22
+ versions fail when no static valid target can be determined; tag-absent is warn/not-run.
23
+ Git tags never determine the target version. A failing gate BLOCKS shipping.
24
+ Nothing is pushed, published, or tagged here.
19
25
 
20
26
  disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
21
27
  tools_available: [release-preflight]