taskflow-hosts 0.1.8 → 0.2.1
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 +27 -12
- package/dist/child-env.d.ts +6 -0
- package/dist/child-env.d.ts.map +1 -0
- package/dist/child-env.js +43 -0
- package/dist/child-env.js.map +1 -0
- package/dist/claude-runner.d.ts +27 -15
- package/dist/claude-runner.d.ts.map +1 -1
- package/dist/claude-runner.js +163 -31
- package/dist/claude-runner.js.map +1 -1
- package/dist/codex-runner.d.ts +8 -1
- package/dist/codex-runner.d.ts.map +1 -1
- package/dist/codex-runner.js +85 -20
- package/dist/codex-runner.js.map +1 -1
- package/dist/grok-runner.d.ts +133 -0
- package/dist/grok-runner.d.ts.map +1 -0
- package/dist/grok-runner.js +350 -0
- package/dist/grok-runner.js.map +1 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/opencode-runner.d.ts +16 -0
- package/dist/opencode-runner.d.ts.map +1 -1
- package/dist/opencode-runner.js +82 -13
- package/dist/opencode-runner.js.map +1 -1
- package/package.json +22 -9
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
> Shared host-runner collection for [taskflow](https://github.com/heggria/taskflow).
|
|
4
4
|
|
|
5
5
|
This package holds the `SubagentRunner` implementations for taskflow's non-pi
|
|
6
|
-
hosts — **codex**, **claude**, and **
|
|
7
|
-
(`buildCodexArgs` / `buildClaudeArgs` / `buildOpencodeArgs`
|
|
8
|
-
parsers. It is the **single place** host
|
|
9
|
-
`<host>-runner.ts` here.
|
|
6
|
+
hosts — **codex**, **claude**, **opencode**, and **grok** — plus their pure argv
|
|
7
|
+
builders (`buildCodexArgs` / `buildClaudeArgs` / `buildOpencodeArgs` /
|
|
8
|
+
`buildGrokArgs`) and event-stream parsers. It is the **single place** host
|
|
9
|
+
runners live; a new host adds a `<host>-runner.ts` here.
|
|
10
10
|
|
|
11
11
|
## Why a separate package
|
|
12
12
|
|
|
@@ -17,21 +17,21 @@ Each host has two halves:
|
|
|
17
17
|
permission/model helpers.
|
|
18
18
|
2. **The delivery** — the per-host MCP server + bin + plugin scaffold, which is
|
|
19
19
|
that host ecosystem's install target (`codex plugin add`, `claude plugin
|
|
20
|
-
install`, OpenCode config).
|
|
20
|
+
install`, OpenCode config, `grok plugin install`).
|
|
21
21
|
|
|
22
22
|
Half #1 is nearly identical in *shape* across hosts and changes for the same
|
|
23
23
|
reasons (a `taskflow-core` contract change, or a host CLI flag change). Half #2
|
|
24
24
|
is genuinely host-specific (different install mechanisms, different plugin
|
|
25
25
|
manifests). So #1 is collected here; #2 stays in `codex-taskflow` /
|
|
26
|
-
`claude-taskflow` / `opencode-taskflow`, which import their
|
|
27
|
-
package.
|
|
26
|
+
`claude-taskflow` / `opencode-taskflow` / `grok-taskflow`, which import their
|
|
27
|
+
runner from this package.
|
|
28
28
|
|
|
29
29
|
## Install
|
|
30
30
|
|
|
31
31
|
You usually don't install this directly — install the host delivery package:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npm install -g codex-taskflow # or claude-taskflow / opencode-taskflow
|
|
34
|
+
npm install -g codex-taskflow # or claude-taskflow / opencode-taskflow / grok-taskflow
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
For code-level use:
|
|
@@ -45,22 +45,37 @@ npm install taskflow-hosts
|
|
|
45
45
|
```ts
|
|
46
46
|
// one host, tree-shaken:
|
|
47
47
|
import { codexSubagentRunner, buildCodexArgs } from "taskflow-hosts/codex";
|
|
48
|
+
import { grokSubagentRunner, buildGrokArgs } from "taskflow-hosts/grok";
|
|
48
49
|
|
|
49
50
|
// or the barrel:
|
|
50
|
-
import {
|
|
51
|
+
import {
|
|
52
|
+
claudeSubagentRunner,
|
|
53
|
+
opencodeSubagentRunner,
|
|
54
|
+
grokSubagentRunner,
|
|
55
|
+
} from "taskflow-hosts";
|
|
51
56
|
```
|
|
52
57
|
|
|
53
58
|
Each runner export includes: the `SubagentRunner` (`codexSubagentRunner` / …),
|
|
54
59
|
the `runXxxAgentTask` function, the pure `buildXxxArgs` builder, the
|
|
55
60
|
`foldXxxEventLine` parser + `newXxxAccumulator`, and the permission/model
|
|
56
|
-
helpers (`sandboxForTools`, `permissionArgsForTools
|
|
57
|
-
`resolveXxxModel`, `xxxBin`).
|
|
61
|
+
helpers (`sandboxForTools`, `permissionArgsForTools` / `permissionArgsForGrokTools`,
|
|
62
|
+
`isReadOnlyPhase`, `resolveXxxModel`, `xxxBin`).
|
|
63
|
+
|
|
64
|
+
## Hosts
|
|
65
|
+
|
|
66
|
+
| Host | CLI spawn | Delivery package |
|
|
67
|
+
|------|-----------|------------------|
|
|
68
|
+
| Codex | `codex exec --json` | `codex-taskflow` |
|
|
69
|
+
| Claude Code | `claude -p --output-format stream-json` | `claude-taskflow` |
|
|
70
|
+
| OpenCode | `opencode run --format json` | `opencode-taskflow` |
|
|
71
|
+
| Grok Build | `grok -p --output-format streaming-json` | `grok-taskflow` |
|
|
58
72
|
|
|
59
73
|
## Adding a host
|
|
60
74
|
|
|
61
75
|
1. Add `<host>-runner.ts` in `src/` (model it on an existing one — a pure
|
|
62
76
|
`buildXxxArgs` + the event parser + a `SubagentRunner` export).
|
|
63
|
-
2. Add an export entry in `src/index.ts
|
|
77
|
+
2. Add an export entry in `src/index.ts` (watch for name collisions on shared
|
|
78
|
+
helper names like `permissionArgsForTools`).
|
|
64
79
|
3. Add `*-runner.test.ts` (event-stream parser) + `*-args.test.ts` (argv
|
|
65
80
|
contract — CI-locked) in `test/`.
|
|
66
81
|
4. The host's *delivery* (MCP server/bin + plugin scaffold) goes in a
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CHILD_ENV_ALLOWLIST_ENV = "PI_TASKFLOW_CHILD_ENV_ALLOW";
|
|
2
|
+
/** Build a least-privilege child environment. Provider credentials and
|
|
3
|
+
* host-specific configuration are retained explicitly; unrelated parent
|
|
4
|
+
* secrets are never inherited by an adversarial subagent. */
|
|
5
|
+
export declare function filteredChildEnv(source: NodeJS.ProcessEnv, exactKeys: readonly string[], prefixes: readonly string[]): NodeJS.ProcessEnv;
|
|
6
|
+
//# sourceMappingURL=child-env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child-env.d.ts","sourceRoot":"","sources":["../src/child-env.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AAUrE;;6DAE6D;AAC7D,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,MAAM,CAAC,UAAU,EACzB,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,QAAQ,EAAE,SAAS,MAAM,EAAE,GACzB,MAAM,CAAC,UAAU,CAoBnB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const BASE_ENV_KEYS = new Set([
|
|
2
|
+
"PATH", "HOME", "USER", "LOGNAME", "SHELL", "TERM",
|
|
3
|
+
"TMPDIR", "TMP", "TEMP", "LANG", "LC_ALL", "TZ",
|
|
4
|
+
"SYSTEMROOT", "WINDIR", "COMSPEC", "PATHEXT", "USERPROFILE",
|
|
5
|
+
"HOMEDRIVE", "HOMEPATH", "APPDATA", "LOCALAPPDATA",
|
|
6
|
+
"XDG_CONFIG_HOME", "XDG_CACHE_HOME", "XDG_DATA_HOME", "XDG_STATE_HOME", "XDG_RUNTIME_DIR",
|
|
7
|
+
"HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY",
|
|
8
|
+
"SSL_CERT_FILE", "SSL_CERT_DIR", "NODE_EXTRA_CA_CERTS",
|
|
9
|
+
]);
|
|
10
|
+
export const CHILD_ENV_ALLOWLIST_ENV = "PI_TASKFLOW_CHILD_ENV_ALLOW";
|
|
11
|
+
// Host-principal controls are never delegable through the generic child env
|
|
12
|
+
// allowlist. A subagent may receive task credentials, but it must not mint the
|
|
13
|
+
// host's cwd-bridge authority for a nested Taskflow invocation.
|
|
14
|
+
const HOST_ONLY_ENV_KEYS = new Set([
|
|
15
|
+
"TASKFLOW_CWD_BRIDGE_MODE",
|
|
16
|
+
"TASKFLOW_WORKSPACE_RECONCILE_MODE",
|
|
17
|
+
]);
|
|
18
|
+
/** Build a least-privilege child environment. Provider credentials and
|
|
19
|
+
* host-specific configuration are retained explicitly; unrelated parent
|
|
20
|
+
* secrets are never inherited by an adversarial subagent. */
|
|
21
|
+
export function filteredChildEnv(source, exactKeys, prefixes) {
|
|
22
|
+
const exact = new Set(exactKeys.map((key) => key.toUpperCase()));
|
|
23
|
+
for (const key of source[CHILD_ENV_ALLOWLIST_ENV]?.split(",") ?? []) {
|
|
24
|
+
if (key.trim())
|
|
25
|
+
exact.add(key.trim().toUpperCase());
|
|
26
|
+
}
|
|
27
|
+
const normalizedPrefixes = prefixes.map((prefix) => prefix.toUpperCase());
|
|
28
|
+
const filtered = {};
|
|
29
|
+
for (const [key, value] of Object.entries(source)) {
|
|
30
|
+
if (value === undefined)
|
|
31
|
+
continue;
|
|
32
|
+
const normalized = key.toUpperCase();
|
|
33
|
+
if (HOST_ONLY_ENV_KEYS.has(normalized))
|
|
34
|
+
continue;
|
|
35
|
+
if (BASE_ENV_KEYS.has(normalized) ||
|
|
36
|
+
exact.has(normalized) ||
|
|
37
|
+
normalizedPrefixes.some((prefix) => normalized.startsWith(prefix))) {
|
|
38
|
+
filtered[key] = value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return filtered;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=child-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child-env.js","sourceRoot":"","sources":["../src/child-env.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM;IAClD,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,M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C;QACnD,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC;YAAE,SAAS;QACjD,IACC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC;YAC7B,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC;YACrB,kBAAkB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EACjE,CAAC;YACF,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACvB,CAAC;IACF,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
|
package/dist/claude-runner.d.ts
CHANGED
|
@@ -24,16 +24,19 @@
|
|
|
24
24
|
* - failure = result.is_error, a stream-level error, or a non-zero exit
|
|
25
25
|
*
|
|
26
26
|
* Permission mapping (the codex `sandboxForTools` analogue): Claude Code has no
|
|
27
|
-
* OS-level sandbox in -p mode — a tool call is either whitelisted or denied.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* OS-level sandbox in -p mode — a tool call is either whitelisted or denied.
|
|
28
|
+
* Read-only and unspecified tool sets get an explicit read-only allowlist.
|
|
29
|
+
* Known mutating tools fail closed unless the user explicitly opts into
|
|
30
|
+
* narrowly-scoped unsandboxed execution with PI_TASKFLOW_CLAUDE_UNSAFE_BYPASS=1;
|
|
31
|
+
* unknown tool names always fail closed.
|
|
32
32
|
*
|
|
33
33
|
* Process handling (idle watchdog, abort, signal-kill detection, stderr cap,
|
|
34
34
|
* error sanitization) mirrors the pi/codex runners so behavior is uniform.
|
|
35
35
|
*/
|
|
36
36
|
import { type AgentConfig, type LiveUpdate, type RunOptions, type RunResult, type SubagentRunner, type UsageStats } from "taskflow-core";
|
|
37
|
+
/** Explicit user-level acknowledgement required before Claude may run tools
|
|
38
|
+
* without an OS sandbox or interactive permission prompts. */
|
|
39
|
+
export declare const CLAUDE_UNSAFE_BYPASS_ENV = "PI_TASKFLOW_CLAUDE_UNSAFE_BYPASS";
|
|
37
40
|
/** Accumulated state folded from a claude stream-json event stream. */
|
|
38
41
|
export interface ClaudeAccumulator {
|
|
39
42
|
usage: UsageStats;
|
|
@@ -45,6 +48,7 @@ export interface ClaudeAccumulator {
|
|
|
45
48
|
fatalError?: string;
|
|
46
49
|
/** True once the authoritative `result` event has been folded. */
|
|
47
50
|
sawResult: boolean;
|
|
51
|
+
terminalSeen?: boolean;
|
|
48
52
|
}
|
|
49
53
|
export declare function newClaudeAccumulator(model?: string): ClaudeAccumulator;
|
|
50
54
|
/**
|
|
@@ -57,15 +61,20 @@ export declare function foldClaudeEventLine(acc: ClaudeAccumulator, line: string
|
|
|
57
61
|
/** Override the claude binary (tests / unusual installs). */
|
|
58
62
|
export declare function claudeBin(): string;
|
|
59
63
|
/**
|
|
60
|
-
* Map a phase's tool whitelist to
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* WITHOUT an OS sandbox backstop). No whitelist → bypass (the engine's
|
|
66
|
-
* default-capable agent).
|
|
64
|
+
* Map a phase's tool whitelist to Claude permission flags. Unspecified and
|
|
65
|
+
* known read-only tool sets are always restricted to the read-only allowlist.
|
|
66
|
+
* Known mutating tools need an explicit caller acknowledgement; unknown tools
|
|
67
|
+
* are never accepted. This
|
|
68
|
+
* function never reads process.env so argv construction remains pure.
|
|
67
69
|
*/
|
|
68
|
-
export declare function permissionArgsForTools(tools: string[] | undefined): string[];
|
|
70
|
+
export declare function permissionArgsForTools(tools: string[] | undefined, allowUnsafeBypass?: boolean): string[];
|
|
71
|
+
/** Resolve the explicit process-level opt-in. Only the exact value `1` is
|
|
72
|
+
* accepted so an inherited or accidentally truthy value cannot enable it. */
|
|
73
|
+
export declare function claudeUnsafeBypassEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
74
|
+
/** Resolve a least-privilege environment for the Claude child process.
|
|
75
|
+
* Provider-specific credentials are retained so API-key, Bedrock, Vertex, and
|
|
76
|
+
* Foundry authentication continue to work; unrelated secrets are omitted. */
|
|
77
|
+
export declare function claudeChildEnv(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
69
78
|
/** Resolve a modelRoles/pi model id for `claude --model`, or `undefined` to let
|
|
70
79
|
* claude fall back to its own default. Claude model ids are FLAT (aliases like
|
|
71
80
|
* "sonnet"/"haiku" or full ids like "claude-sonnet-4-6"), so — same rule as
|
|
@@ -79,14 +88,17 @@ export interface ClaudeArgsCtx {
|
|
|
79
88
|
/** Already-resolved model (opts.model ?? agent.model). */
|
|
80
89
|
model?: string;
|
|
81
90
|
tools?: string[];
|
|
91
|
+
/** Explicit acknowledgement for unsandboxed known mutating tools. */
|
|
92
|
+
allowUnsafeBypass?: boolean;
|
|
82
93
|
}
|
|
83
94
|
/**
|
|
84
95
|
* Build the full `claude -p` argv from a phase's resolved context — PURE
|
|
85
96
|
* (no process.env, no spawn). Extracted from `runClaudeAgentTask` so the host's
|
|
86
97
|
* CLI flag contract is unit-testable in CI without a live claude session.
|
|
87
98
|
*
|
|
88
|
-
* claude -p --output-format stream-json --verbose --strict-mcp-config
|
|
89
|
-
*
|
|
99
|
+
* claude -p --output-format stream-json --verbose --safe-mode --strict-mcp-config
|
|
100
|
+
* --setting-sources "" --settings '{"disableAllHooks":true}'
|
|
101
|
+
* [--permission-mode bypassPermissions | --tools ... --allowedTools ...]
|
|
90
102
|
* [--model m] [--append-system-prompt ...] <task>
|
|
91
103
|
*/
|
|
92
104
|
export declare function buildClaudeArgs(ctx: ClaudeArgsCtx): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-runner.d.ts","sourceRoot":"","sources":["../src/claude-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH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EzF;AAED;;;;0DAI0D;AAC1D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAKhF;AAED,kFAAkF;AAClF,MAAM,WAAW,aAAa;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,EAAE,CAmB5D;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACvC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,WAAW,EAAE,EACrB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,EAChB,cAAc,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,SAAS,CAAC,CAgDpB;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,cAAc,CAAC,WAAW,CAE5D,CAAC"}
|
package/dist/claude-runner.js
CHANGED
|
@@ -24,22 +24,94 @@
|
|
|
24
24
|
* - failure = result.is_error, a stream-level error, or a non-zero exit
|
|
25
25
|
*
|
|
26
26
|
* Permission mapping (the codex `sandboxForTools` analogue): Claude Code has no
|
|
27
|
-
* OS-level sandbox in -p mode — a tool call is either whitelisted or denied.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* OS-level sandbox in -p mode — a tool call is either whitelisted or denied.
|
|
28
|
+
* Read-only and unspecified tool sets get an explicit read-only allowlist.
|
|
29
|
+
* Known mutating tools fail closed unless the user explicitly opts into
|
|
30
|
+
* narrowly-scoped unsandboxed execution with PI_TASKFLOW_CLAUDE_UNSAFE_BYPASS=1;
|
|
31
|
+
* unknown tool names always fail closed.
|
|
32
32
|
*
|
|
33
33
|
* Process handling (idle watchdog, abort, signal-kill detection, stderr cap,
|
|
34
34
|
* error sanitization) mirrors the pi/codex runners so behavior is uniform.
|
|
35
35
|
*/
|
|
36
|
-
import { runSubagentProcess, num, unknownAgentResult, } from "taskflow-core";
|
|
36
|
+
import { runSubagentProcess, sanitizeErrorMessage, num, unknownAgentResult, } from "taskflow-core";
|
|
37
37
|
import { emptyUsage } from "taskflow-core";
|
|
38
|
+
import { filteredChildEnv } from "./child-env.js";
|
|
38
39
|
/** The Claude tools a read-only phase may use. `Bash` is excluded — Claude has
|
|
39
40
|
* no read-only shell (unlike codex's read-only OS sandbox, which still allows
|
|
40
41
|
* read-only commands), so a listed-tools phase without write/edit/bash gets
|
|
41
42
|
* file reads + search + web only. */
|
|
42
43
|
const READ_ONLY_TOOLS = ["Read", "Grep", "Glob", "WebFetch", "WebSearch"];
|
|
44
|
+
const READ_ONLY_TOOL_MAP = {
|
|
45
|
+
read: "Read",
|
|
46
|
+
grep: "Grep",
|
|
47
|
+
glob: "Glob",
|
|
48
|
+
find: "Glob",
|
|
49
|
+
ls: "Glob",
|
|
50
|
+
webfetch: "WebFetch",
|
|
51
|
+
web_fetch: "WebFetch",
|
|
52
|
+
websearch: "WebSearch",
|
|
53
|
+
web_search: "WebSearch",
|
|
54
|
+
};
|
|
55
|
+
const MUTATING_TOOL_MAP = {
|
|
56
|
+
write: "Write",
|
|
57
|
+
edit: "Edit",
|
|
58
|
+
bash: "Bash",
|
|
59
|
+
apply_patch: "Edit",
|
|
60
|
+
};
|
|
61
|
+
/** Environment inherited by the Claude process. Keep platform/runtime settings,
|
|
62
|
+
* proxy/CA configuration, and credentials for Claude's supported providers;
|
|
63
|
+
* drop unrelated application secrets (for example OPENAI_API_KEY, npm tokens,
|
|
64
|
+
* database passwords) from the default child boundary. */
|
|
65
|
+
const CLAUDE_ENV_KEYS = new Set([
|
|
66
|
+
"ALL_PROXY",
|
|
67
|
+
"APPDATA",
|
|
68
|
+
"COLORTERM",
|
|
69
|
+
"COMSPEC",
|
|
70
|
+
"FORCE_COLOR",
|
|
71
|
+
"HOME",
|
|
72
|
+
"HOMEDRIVE",
|
|
73
|
+
"HOMEPATH",
|
|
74
|
+
"HTTP_PROXY",
|
|
75
|
+
"HTTPS_PROXY",
|
|
76
|
+
"LANG",
|
|
77
|
+
"LC_ALL",
|
|
78
|
+
"LC_CTYPE",
|
|
79
|
+
"LOCALAPPDATA",
|
|
80
|
+
"LOGNAME",
|
|
81
|
+
"NODE_EXTRA_CA_CERTS",
|
|
82
|
+
"NO_COLOR",
|
|
83
|
+
"NO_PROXY",
|
|
84
|
+
"PATH",
|
|
85
|
+
"PATHEXT",
|
|
86
|
+
"SHELL",
|
|
87
|
+
"SSL_CERT_DIR",
|
|
88
|
+
"SSL_CERT_FILE",
|
|
89
|
+
"SYSTEMROOT",
|
|
90
|
+
"TEMP",
|
|
91
|
+
"TERM",
|
|
92
|
+
"TMP",
|
|
93
|
+
"TMPDIR",
|
|
94
|
+
"USER",
|
|
95
|
+
"USERPROFILE",
|
|
96
|
+
"WINDIR",
|
|
97
|
+
"XDG_CACHE_HOME",
|
|
98
|
+
"XDG_CONFIG_HOME",
|
|
99
|
+
"XDG_DATA_HOME",
|
|
100
|
+
"XDG_STATE_HOME",
|
|
101
|
+
]);
|
|
102
|
+
const CLAUDE_ENV_PREFIXES = [
|
|
103
|
+
"ANTHROPIC_",
|
|
104
|
+
"AWS_",
|
|
105
|
+
"AZURE_",
|
|
106
|
+
"CLAUDE_CODE_",
|
|
107
|
+
"CLOUD_ML_",
|
|
108
|
+
"GCLOUD_",
|
|
109
|
+
"GOOGLE_",
|
|
110
|
+
"VERTEX_",
|
|
111
|
+
];
|
|
112
|
+
/** Explicit user-level acknowledgement required before Claude may run tools
|
|
113
|
+
* without an OS sandbox or interactive permission prompts. */
|
|
114
|
+
export const CLAUDE_UNSAFE_BYPASS_ENV = "PI_TASKFLOW_CLAUDE_UNSAFE_BYPASS";
|
|
43
115
|
export function newClaudeAccumulator(model) {
|
|
44
116
|
return { usage: emptyUsage(), model, finalText: "", lastActivity: "", sawResult: false };
|
|
45
117
|
}
|
|
@@ -132,6 +204,7 @@ export function foldClaudeEventLine(acc, line) {
|
|
|
132
204
|
}
|
|
133
205
|
else if (event.type === "result") {
|
|
134
206
|
acc.sawResult = true;
|
|
207
|
+
acc.terminalSeen = true;
|
|
135
208
|
const u = event.usage;
|
|
136
209
|
if (u) {
|
|
137
210
|
const prev = acc.usage.contextTokens;
|
|
@@ -166,22 +239,48 @@ export function claudeBin() {
|
|
|
166
239
|
return process.env.PI_TASKFLOW_CLAUDE_BIN || "claude";
|
|
167
240
|
}
|
|
168
241
|
/**
|
|
169
|
-
* Map a phase's tool whitelist to
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* WITHOUT an OS sandbox backstop). No whitelist → bypass (the engine's
|
|
175
|
-
* default-capable agent).
|
|
242
|
+
* Map a phase's tool whitelist to Claude permission flags. Unspecified and
|
|
243
|
+
* known read-only tool sets are always restricted to the read-only allowlist.
|
|
244
|
+
* Known mutating tools need an explicit caller acknowledgement; unknown tools
|
|
245
|
+
* are never accepted. This
|
|
246
|
+
* function never reads process.env so argv construction remains pure.
|
|
176
247
|
*/
|
|
177
|
-
export function permissionArgsForTools(tools) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
248
|
+
export function permissionArgsForTools(tools, allowUnsafeBypass = false) {
|
|
249
|
+
const requestedNames = tools?.map((t) => t.trim().toLowerCase()) ?? [];
|
|
250
|
+
const unknown = requestedNames.find((t) => !READ_ONLY_TOOL_MAP[t] && !MUTATING_TOOL_MAP[t]);
|
|
251
|
+
if (unknown) {
|
|
252
|
+
throw new Error(`Claude tool '${unknown}' cannot be mapped to a built-in tool and is denied. ` +
|
|
253
|
+
"Use read, grep, glob, find, ls, webfetch, websearch, write, edit, bash, or apply_patch.");
|
|
254
|
+
}
|
|
255
|
+
const requestsUnsafeAccess = requestedNames.some((t) => Boolean(MUTATING_TOOL_MAP[t]));
|
|
256
|
+
if (requestsUnsafeAccess) {
|
|
257
|
+
if (allowUnsafeBypass) {
|
|
258
|
+
const available = [...new Set(requestedNames.map((t) => READ_ONLY_TOOL_MAP[t] ?? MUTATING_TOOL_MAP[t]))];
|
|
259
|
+
return ["--tools", available.join(","), "--permission-mode", "bypassPermissions"];
|
|
260
|
+
}
|
|
261
|
+
throw new Error(`Claude tools [${tools.join(", ")}] require unsandboxed permissions. ` +
|
|
262
|
+
`Claude Code has no OS sandbox in non-interactive mode. ` +
|
|
263
|
+
`Set ${CLAUDE_UNSAFE_BYPASS_ENV}=1 to explicitly allow this execution.`);
|
|
264
|
+
}
|
|
265
|
+
const allowed = requestedNames.length > 0
|
|
266
|
+
? [...new Set(requestedNames.map((t) => READ_ONLY_TOOL_MAP[t]).filter(Boolean))]
|
|
267
|
+
: READ_ONLY_TOOLS;
|
|
268
|
+
const toolList = allowed.join(",");
|
|
269
|
+
// --tools limits which built-ins exist; --allowedTools only pre-approves
|
|
270
|
+
// them. Use both, and isolate disk settings/hooks below, so a project policy
|
|
271
|
+
// cannot silently restore mutating tools in non-interactive mode.
|
|
272
|
+
return ["--tools", toolList, "--allowedTools", toolList];
|
|
273
|
+
}
|
|
274
|
+
/** Resolve the explicit process-level opt-in. Only the exact value `1` is
|
|
275
|
+
* accepted so an inherited or accidentally truthy value cannot enable it. */
|
|
276
|
+
export function claudeUnsafeBypassEnabled(env = process.env) {
|
|
277
|
+
return env[CLAUDE_UNSAFE_BYPASS_ENV] === "1";
|
|
278
|
+
}
|
|
279
|
+
/** Resolve a least-privilege environment for the Claude child process.
|
|
280
|
+
* Provider-specific credentials are retained so API-key, Bedrock, Vertex, and
|
|
281
|
+
* Foundry authentication continue to work; unrelated secrets are omitted. */
|
|
282
|
+
export function claudeChildEnv(source = process.env) {
|
|
283
|
+
return filteredChildEnv(source, [...CLAUDE_ENV_KEYS], CLAUDE_ENV_PREFIXES);
|
|
185
284
|
}
|
|
186
285
|
/** Resolve a modelRoles/pi model id for `claude --model`, or `undefined` to let
|
|
187
286
|
* claude fall back to its own default. Claude model ids are FLAT (aliases like
|
|
@@ -202,14 +301,26 @@ export function resolveClaudeModel(model) {
|
|
|
202
301
|
* (no process.env, no spawn). Extracted from `runClaudeAgentTask` so the host's
|
|
203
302
|
* CLI flag contract is unit-testable in CI without a live claude session.
|
|
204
303
|
*
|
|
205
|
-
* claude -p --output-format stream-json --verbose --strict-mcp-config
|
|
206
|
-
*
|
|
304
|
+
* claude -p --output-format stream-json --verbose --safe-mode --strict-mcp-config
|
|
305
|
+
* --setting-sources "" --settings '{"disableAllHooks":true}'
|
|
306
|
+
* [--permission-mode bypassPermissions | --tools ... --allowedTools ...]
|
|
207
307
|
* [--model m] [--append-system-prompt ...] <task>
|
|
208
308
|
*/
|
|
209
309
|
export function buildClaudeArgs(ctx) {
|
|
210
310
|
const claudeModel = resolveClaudeModel(ctx.model);
|
|
211
|
-
const args = [
|
|
212
|
-
|
|
311
|
+
const args = [
|
|
312
|
+
"-p",
|
|
313
|
+
"--output-format",
|
|
314
|
+
"stream-json",
|
|
315
|
+
"--verbose",
|
|
316
|
+
"--safe-mode",
|
|
317
|
+
"--strict-mcp-config",
|
|
318
|
+
"--setting-sources",
|
|
319
|
+
"",
|
|
320
|
+
"--settings",
|
|
321
|
+
JSON.stringify({ disableAllHooks: true }),
|
|
322
|
+
];
|
|
323
|
+
args.push(...permissionArgsForTools(ctx.tools, ctx.allowUnsafeBypass));
|
|
213
324
|
if (claudeModel)
|
|
214
325
|
args.push("--model", claudeModel);
|
|
215
326
|
if (ctx.systemPrompt.trim())
|
|
@@ -229,12 +340,30 @@ export async function runClaudeAgentTask(defaultCwd, agents, agentName, task, op
|
|
|
229
340
|
const model = opts.model ?? agent.model;
|
|
230
341
|
const tools = opts.tools ?? agent.tools;
|
|
231
342
|
void globalThinking; // claude -p has no thinking-level flag; reserved.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
343
|
+
let args;
|
|
344
|
+
try {
|
|
345
|
+
args = buildClaudeArgs({
|
|
346
|
+
systemPrompt: agent.systemPrompt,
|
|
347
|
+
task,
|
|
348
|
+
model,
|
|
349
|
+
tools,
|
|
350
|
+
allowUnsafeBypass: claudeUnsafeBypassEnabled(),
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
const message = sanitizeErrorMessage(error instanceof Error ? error.message : String(error));
|
|
355
|
+
return {
|
|
356
|
+
agent: agentName,
|
|
357
|
+
task,
|
|
358
|
+
exitCode: 1,
|
|
359
|
+
output: "",
|
|
360
|
+
stderr: message,
|
|
361
|
+
usage: emptyUsage(),
|
|
362
|
+
model,
|
|
363
|
+
errorMessage: message,
|
|
364
|
+
stopReason: "permission_denied",
|
|
365
|
+
};
|
|
366
|
+
}
|
|
238
367
|
return runSubagentProcess({
|
|
239
368
|
agent: agentName,
|
|
240
369
|
task,
|
|
@@ -245,8 +374,11 @@ export async function runClaudeAgentTask(defaultCwd, agents, agentName, task, op
|
|
|
245
374
|
idleTimeoutMs: opts.idleTimeoutMs,
|
|
246
375
|
signal: opts.signal,
|
|
247
376
|
onLive: opts.onLive,
|
|
377
|
+
env: claudeChildEnv(),
|
|
248
378
|
acc: newClaudeAccumulator(model),
|
|
249
379
|
foldLine: foldClaudeEventLine,
|
|
380
|
+
requireTerminalEvent: true,
|
|
381
|
+
terminalEventLabel: "Claude result",
|
|
250
382
|
});
|
|
251
383
|
}
|
|
252
384
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-runner.js","sourceRoot":"","sources":["../src/claude-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH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C,CAAC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,oBAAoB,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7F,OAAO;YACN,KAAK,EAAE,SAAS;YAChB,IAAI;YACJ,QAAQ,EAAE,CAAC;YACX,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,UAAU,EAAE;YACnB,KAAK;YACL,YAAY,EAAE,OAAO;YACrB,UAAU,EAAE,mBAAmB;SAC/B,CAAC;IACH,CAAC;IAED,OAAO,kBAAkB,CAAC;QACzB,KAAK,EAAE,SAAS;QAChB,IAAI;QACJ,KAAK;QACL,GAAG,EAAE,SAAS,EAAE;QAChB,IAAI;QACJ,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,UAAU;QAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,GAAG,EAAE,cAAc,EAAE;QACrB,GAAG,EAAE,oBAAoB,CAAC,KAAK,CAAC;QAChC,QAAQ,EAAE,mBAAmB;QAC7B,oBAAoB,EAAE,IAAI;QAC1B,kBAAkB,EAAE,eAAe;KACnC,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgC;IAChE,OAAO,EAAE,kBAAkB;CAC3B,CAAC"}
|
package/dist/codex-runner.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export interface CodexAccumulator {
|
|
|
38
38
|
lastActivity: string;
|
|
39
39
|
/** Set when a fatal (non-benign) error item is seen. */
|
|
40
40
|
fatalError?: string;
|
|
41
|
+
terminalSeen?: boolean;
|
|
41
42
|
}
|
|
42
43
|
export declare function newCodexAccumulator(model?: string): CodexAccumulator;
|
|
43
44
|
/**
|
|
@@ -49,6 +50,7 @@ export declare function newCodexAccumulator(model?: string): CodexAccumulator;
|
|
|
49
50
|
export declare function foldCodexEventLine(acc: CodexAccumulator, line: string): LiveUpdate | null;
|
|
50
51
|
/** Override the codex binary (tests / unusual installs). */
|
|
51
52
|
export declare function codexBin(): string;
|
|
53
|
+
export declare function codexChildEnv(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
52
54
|
/**
|
|
53
55
|
* Map a phase's tool whitelist to a codex sandbox mode. Codex has no per-tool
|
|
54
56
|
* whitelist; it has sandbox policies. The conservative mapping: a phase that
|
|
@@ -63,12 +65,16 @@ export declare function sandboxForTools(tools: string[] | undefined): "read-only
|
|
|
63
65
|
* placeholder ({{...}}) is dropped. Exported so the model-id contract is
|
|
64
66
|
* unit-testable without a live codex session. */
|
|
65
67
|
export declare function resolveCodexModel(model: string | undefined): string | undefined;
|
|
68
|
+
/** Map Taskflow/Pi thinking levels to Codex's model_reasoning_effort config. */
|
|
69
|
+
export declare function resolveCodexThinking(thinking: string | undefined): string | undefined;
|
|
66
70
|
/** Context for {@link buildCodexArgs} — the pure inputs to argv construction. */
|
|
67
71
|
export interface CodexArgsCtx {
|
|
68
72
|
systemPrompt: string;
|
|
69
73
|
task: string;
|
|
70
74
|
/** Already-resolved model (opts.model ?? agent.model). */
|
|
71
75
|
model?: string;
|
|
76
|
+
/** Already-resolved thinking level (opts.thinking ?? agent.thinking ?? global). */
|
|
77
|
+
thinking?: string;
|
|
72
78
|
tools?: string[];
|
|
73
79
|
cwd?: string;
|
|
74
80
|
}
|
|
@@ -77,7 +83,8 @@ export interface CodexArgsCtx {
|
|
|
77
83
|
* (no process.env, no spawn). Extracted from `runCodexAgentTask` so the host's
|
|
78
84
|
* CLI flag contract is unit-testable in CI without a live codex session.
|
|
79
85
|
*
|
|
80
|
-
* codex exec --json --skip-git-repo-check -s <sandbox>
|
|
86
|
+
* codex exec --json --skip-git-repo-check -s <sandbox>
|
|
87
|
+
* [-m model] [-c model_reasoning_effort=level] [-C cwd] <prompt>
|
|
81
88
|
*/
|
|
82
89
|
export declare function buildCodexArgs(ctx: CodexArgsCtx): string[];
|
|
83
90
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-runner.d.ts","sourceRoot":"","sources":["../src/codex-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"codex-runner.d.ts","sourceRoot":"","sources":["../src/codex-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAKN,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,MAAM,eAAe,CAAC;AAevB,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAEpE;AAOD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA4DzF;AAED,4DAA4D;AAC5D,wBAAgB,QAAQ,IAAI,MAAM,CAEjC;AAED,wBAAgB,aAAa,CAAC,MAAM,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAAC,UAAU,CAExF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EA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