@akagilnc/pi-workflow-roles 0.1.2107 → 0.1.2114
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.md +5 -5
- package/README.zh-CN.md +5 -5
- package/dist/engine-detour-tool.js +1 -1
- package/dist/engine-detour.js +14 -1
- package/dist/engine-labor-fallback.js +1 -1
- package/dist/public-cli/main.js +127 -82
- package/package.json +16 -2
- package/src/collector-role.ts +9 -1
- package/src/doctor-role.ts +5 -1
- package/src/engine-detour-tool.ts +2 -2
- package/src/engine-detour.ts +17 -1
- package/src/engine-labor-fallback.ts +1 -1
- package/src/merger-role.ts +9 -1
- package/src/public-cli/cli.ts +44 -25
- package/src/public-cli/coder-run.ts +16 -3
- package/src/public-cli/collector-run.ts +17 -3
- package/src/public-cli/config.ts +18 -13
- package/src/public-cli/doctor-run.ts +17 -3
- package/src/public-cli/fixer-run.ts +17 -3
- package/src/public-cli/invocation.ts +10 -5
- package/src/public-cli/judge-run.ts +2 -9
- package/src/public-cli/merger-run.ts +15 -3
- package/src/public-cli/option-definitions.ts +2 -2
- package/src/public-cli/reviewer-run.ts +2 -9
- package/src/public-cli/run-lifecycle.ts +1 -1
- package/src/role-runtime.ts +3 -6
- package/src/worker-role.ts +16 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ pi install npm:@akagilnc/pi-workflow-roles
|
|
|
11
11
|
export PATH="$HOME/.pi/agent/npm/node_modules/.bin:$PATH"
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Update with `pi update npm:@akagilnc/pi-workflow-roles`—never a second global `npm install -g`. Inspect with `ak-role roles` and `ak-role help <role>`; set per-seat model defaults with `ak-role config set judge openai-codex/gpt-5.6-sol:high`; set or clear a persistent labor engine (
|
|
14
|
+
Update with `pi update npm:@akagilnc/pi-workflow-roles`—never a second global `npm install -g`. Inspect with `ak-role roles` and `ak-role help <role>`; set per-seat model defaults with `ak-role config set judge openai-codex/gpt-5.6-sol:high`; set or clear a persistent labor engine (callable roles) with `ak-role config set-engine <seat> <name>` / `ak-role config unset-engine <seat>`.
|
|
15
15
|
|
|
16
16
|
## Reading results
|
|
17
17
|
|
|
@@ -31,16 +31,16 @@ Every run also prepares Navigator advice in the same Terminal. Configure it like
|
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
ak-role config set navigator openai-codex/gpt-5.6-luna:medium
|
|
34
|
-
# persistent labor engine (
|
|
34
|
+
# persistent labor engine (callable roles; not navigator); one-shot override remains --engine
|
|
35
35
|
ak-role config set-engine judge opus
|
|
36
36
|
ak-role config unset-engine judge
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
`config set` stores the seat model default; `config set-engine` / `unset-engine` store or clear the persistent labor-engine name on
|
|
39
|
+
`config set` stores the seat model default; `config set-engine` / `unset-engine` store or clear the persistent labor-engine name on callable roles (same seats as `--engine`; navigator refused — no independent activation). Usage and refusal text are owned by `ak-role config` in the public CLI.
|
|
40
40
|
|
|
41
41
|
Receipts are typed, so callers compose roles without parsing prose; ordering and stopping stay caller-owned. Programmatic consumers derive contracts from the exported schemas in `src/package-contracts/`, not from this guide.
|
|
42
42
|
|
|
43
|
-
When a
|
|
43
|
+
When a labor-engine detour fails and the seat continues the labor on the main road, the typed receipt may carry a mechanical `engineLaborFallback` field: `{ engine, failure, laborBy: "seat" }`. It appears only after a real detour failure that fell back to seat labor (including package-owned idle timeout on the detour tool)—not on detour success or caller cancel. First failure wins for the activation; model-forged `engineLaborFallback` keys are stripped unless the package latch recorded one. Sole producer: `src/engine-labor-fallback.ts`; decision record: [ADR 0071](docs/adr/0071-engine-detour-failure-seat-fallback-declaration.md). This README only projects that contract.
|
|
44
44
|
|
|
45
45
|
## Call the roles
|
|
46
46
|
|
|
@@ -121,7 +121,7 @@ Generated from `src/public-cli/option-definitions.ts`. Prefer `ak-role help <com
|
|
|
121
121
|
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
122
122
|
| `--model` | — | `provider/model` | no | no | option | — | Override the effective seat model for this invocation (before or after the command). |
|
|
123
123
|
| `--thinking` | — | `level` | no | no | option | — | Override thinking level: off\|minimal\|low\|medium\|high\|xhigh\|max. |
|
|
124
|
-
| `--engine` | — | `name` | no | no | option | — | Optional
|
|
124
|
+
| `--engine` | — | `name` | no | no | option | — | Optional labor engine for this invocation (owner pool-directive name; packaged notes attached when present; any role). |
|
|
125
125
|
| `--help` | `-h` | — | no | no | option | — | Show public CLI help and exit. |
|
|
126
126
|
|
|
127
127
|
### `judge`
|
package/README.zh-CN.md
CHANGED
|
@@ -11,7 +11,7 @@ pi install npm:@akagilnc/pi-workflow-roles
|
|
|
11
11
|
export PATH="$HOME/.pi/agent/npm/node_modules/.bin:$PATH"
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
更新用 `pi update npm:@akagilnc/pi-workflow-roles`——勿另起全局 `npm install -g`。查看能力:`ak-role roles`、`ak-role help <role>`;设席位模型默认:`ak-role config set judge openai-codex/gpt-5.6-sol:high
|
|
14
|
+
更新用 `pi update npm:@akagilnc/pi-workflow-roles`——勿另起全局 `npm install -g`。查看能力:`ak-role roles`、`ak-role help <role>`;设席位模型默认:`ak-role config set judge openai-codex/gpt-5.6-sol:high`;设或清持久劳务引擎(可调用角色):`ak-role config set-engine <seat> <name>` / `ak-role config unset-engine <seat>`。
|
|
15
15
|
|
|
16
16
|
## 读结果
|
|
17
17
|
|
|
@@ -31,16 +31,16 @@ ak-role judge --attach ./plan.md "Review this plan." > result.txt
|
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
ak-role config set navigator openai-codex/gpt-5.6-luna:medium
|
|
34
|
-
#
|
|
34
|
+
# 持久劳务引擎(可调用角色;不含 navigator);一次性覆盖仍用 --engine
|
|
35
35
|
ak-role config set-engine judge opus
|
|
36
36
|
ak-role config unset-engine judge
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
`config set` 存席位模型默认;`config set-engine` / `unset-engine`
|
|
39
|
+
`config set` 存席位模型默认;`config set-engine` / `unset-engine` 在可调用角色上写入或清除持久劳务引擎名(与 `--engine` 同轴;拒收 navigator——无独立 activation)。用法与拒绝文案以公开 CLI 的 `ak-role config` 为准。
|
|
40
40
|
|
|
41
41
|
回执是 typed 的,调用者不必解析散文即可组合角色;顺序与停止归调用者。编程消费者从 `src/package-contracts/` 导出推导契约,不从本文。
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
当劳务引擎绕行失败、座席回到主路继续劳务时,typed 回执可带机械字段 `engineLaborFallback`:`{ engine, failure, laborBy: "seat" }`。仅在真实绕行失败并座席顶班后出现(含 detour 工具命中 package-owned idle 超时)——成功绕行或调用方 cancel 不出现。同一次 activation 内先到先得;无包内 latch 时剥离模型伪造的 `engineLaborFallback` 键。唯一构造点:`src/engine-labor-fallback.ts`;决策记录:[ADR 0071](docs/adr/0071-engine-detour-failure-seat-fallback-declaration.md)。本文只投影该契约。
|
|
44
44
|
|
|
45
45
|
## 调用百官
|
|
46
46
|
|
|
@@ -150,7 +150,7 @@ Codex fast 档:开启:`echo "fast_mode = on" > ~/.pi-codex-fast`;关闭:
|
|
|
150
150
|
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
151
151
|
| `--model` | — | `provider/model` | 否 | 否 | option | — | 覆盖本调用有效席位模型(可置于子命令前或后)。 |
|
|
152
152
|
| `--thinking` | — | `level` | 否 | 否 | option | — | 覆盖 thinking 档位:off\|minimal\|low\|medium\|high\|xhigh\|max。 |
|
|
153
|
-
| `--engine` | — | `name` | 否 | 否 | option | — |
|
|
153
|
+
| `--engine` | — | `name` | 否 | 否 | option | — | 本调用可选劳动引擎(池令名字;有包内调法笔记则附卷;全部角色可用)。 |
|
|
154
154
|
| `--help` | `-h` | — | 否 | 否 | option | — | 显示公开 CLI 帮助并退出。 |
|
|
155
155
|
|
|
156
156
|
### `judge`
|
|
@@ -114,7 +114,7 @@ export function createEngineDetourToolDefinition(input) {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
|
-
* Register the engine-generic detour tool once for this process when
|
|
117
|
+
* Register the engine-generic detour tool once for this process when any role has
|
|
118
118
|
* an engine activation signal. Returns whether registration occurred.
|
|
119
119
|
* Once-latch is activation-scoped via the returned reset handle.
|
|
120
120
|
*/
|
package/dist/engine-detour.js
CHANGED
|
@@ -6,8 +6,21 @@
|
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
/** Package-owned detour tool name (settlement whitelist + session principal). */
|
|
8
8
|
export const ENGINE_DETOUR_TOOL_NAME = "ak_engine_detour";
|
|
9
|
-
/** Env presence/name signal injected by public
|
|
9
|
+
/** Env presence/name signal injected by public role runs (registration gate only). */
|
|
10
10
|
export const AK_ROLE_ENGINE_ENV = "AK_ROLE_ENGINE";
|
|
11
|
+
/**
|
|
12
|
+
* Sole AK_ROLE_ENGINE write seam for public role child env (#391 E2).
|
|
13
|
+
* Delete ambient inheritance first; own-key undefined mask survives process.env re-merge.
|
|
14
|
+
*/
|
|
15
|
+
export function applyEngineChildEnv(childEnv, engine) {
|
|
16
|
+
delete childEnv[AK_ROLE_ENGINE_ENV];
|
|
17
|
+
if (engine !== undefined && engine.trim() !== "") {
|
|
18
|
+
childEnv[AK_ROLE_ENGINE_ENV] = engine.trim();
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
childEnv[AK_ROLE_ENGINE_ENV] = undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
11
24
|
export const ENGINE_DETOUR_EMPTY_STDOUT_DIAGNOSTIC = "engine detour produced empty stdout";
|
|
12
25
|
export const ENGINE_DETOUR_ALREADY_USED_DIAGNOSTIC = "engine detour already used in this activation";
|
|
13
26
|
function abortReasonError(signal) {
|
|
@@ -46,7 +46,7 @@ export function withEngineLaborFallbackField(receipt, field) {
|
|
|
46
46
|
const { engineLaborFallback: _forged, ...rest } = receipt;
|
|
47
47
|
return rest;
|
|
48
48
|
}
|
|
49
|
-
/** Install the activation-scoped latch (
|
|
49
|
+
/** Install the activation-scoped latch (any role session_start with engine). */
|
|
50
50
|
export function installActivationEngineLaborFallbackLatch(latch) {
|
|
51
51
|
activationLatch = latch;
|
|
52
52
|
}
|