pikiclaw 0.3.74 → 0.3.75
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.
|
@@ -45,7 +45,7 @@ import { encodePathAsDirName, getHome, whichSync } from '../../core/platform.js'
|
|
|
45
45
|
import { createRetainedLogSink } from '../../core/logging.js';
|
|
46
46
|
import { stripAnsiEscapes } from '../../core/utils.js';
|
|
47
47
|
import { AGENT_STREAM_HARD_KILL_GRACE_MS, CLAUDE_TUI_STALL_QUIET_MS, CLAUDE_TUI_STALL_PENDING_TOOL_MS, CLAUDE_TUI_STALL_PTY_DEAD_MS, CLAUDE_TUI_STOP_HOLD_QUIET_TTL_MS, } from '../../core/constants.js';
|
|
48
|
-
import { claudeParse, createClaudeStreamState, claudeContextWindowFromModel, claudeEffectiveContextWindow, registerClaudeBackgroundAgentLaunch, pendingClaudeBackgroundAgentCount, registerClaudeBackgroundBashLaunch, pendingClaudeBackgroundBashCount, extractClaudeBackgroundTaskId, extractClaudeWorkflowRunId, } from './claude.js';
|
|
48
|
+
import { claudeParse, createClaudeStreamState, claudeContextWindowFromModel, claudeEffectiveContextWindow, registerClaudeBackgroundAgentLaunch, pendingClaudeBackgroundAgentCount, registerClaudeBackgroundBashLaunch, pendingClaudeBackgroundBashCount, extractClaudeBackgroundTaskId, extractClaudeWorkflowRunId, claudeEffortAndWorkflowArgs, } from './claude.js';
|
|
49
49
|
// ---------------------------------------------------------------------------
|
|
50
50
|
// Stall diagnostics (capture-only)
|
|
51
51
|
// ---------------------------------------------------------------------------
|
|
@@ -1002,8 +1002,9 @@ export async function doClaudeTuiStream(opts) {
|
|
|
1002
1002
|
claudeArgs.push('--model', model);
|
|
1003
1003
|
if (opts.claudePermissionMode)
|
|
1004
1004
|
claudeArgs.push('--permission-mode', opts.claudePermissionMode);
|
|
1005
|
-
|
|
1006
|
-
|
|
1005
|
+
// Effort + Workflow gate — same source of truth as the `claude -p` driver, so
|
|
1006
|
+
// the TUI path drops the Workflow tool unless orchestration was opted in.
|
|
1007
|
+
claudeArgs.push(...claudeEffortAndWorkflowArgs(opts));
|
|
1007
1008
|
if (opts.claudeAppendSystemPrompt)
|
|
1008
1009
|
claudeArgs.push('--append-system-prompt', opts.claudeAppendSystemPrompt);
|
|
1009
1010
|
if (opts.mcpConfigPath)
|
|
@@ -42,6 +42,29 @@ function claudeUsesStreamJsonInput(o) {
|
|
|
42
42
|
return !!o.attachments?.length || !!o.onSteerReady;
|
|
43
43
|
}
|
|
44
44
|
const CLAUDE_STEER_IDLE_CLOSE_MS = 1200;
|
|
45
|
+
/**
|
|
46
|
+
* Effort + multi-agent-Workflow gate args, shared by BOTH Claude spawn paths
|
|
47
|
+
* (`claude -p` in claudeCmd below and the PTY/TUI driver in claude-tui.ts).
|
|
48
|
+
* Kept in one place so the gate can never drift between them — the omission
|
|
49
|
+
* that once left the Workflow tool always-on under the TUI driver.
|
|
50
|
+
*
|
|
51
|
+
* "ultra" is a synthetic picker rung (max depth + Workflow orchestration), never
|
|
52
|
+
* a real --effort value — translate it to `max` so a stray "ultra" can't reach
|
|
53
|
+
* and break the CLI, and treat it as an implicit workflow opt-in. The Workflow
|
|
54
|
+
* tool ships in the default toolset and triggers on a bare "workflow" keyword;
|
|
55
|
+
* under the bypassPermissions mode pikiclaw runs by default that could auto-spawn
|
|
56
|
+
* a fleet of sub-agents, so drop it entirely unless orchestration was explicitly
|
|
57
|
+
* enabled (the workflow flag or the "ultra" rung).
|
|
58
|
+
*/
|
|
59
|
+
export function claudeEffortAndWorkflowArgs(o) {
|
|
60
|
+
const args = [];
|
|
61
|
+
const ultraEffort = o.thinkingEffort === 'ultra';
|
|
62
|
+
if (o.thinkingEffort)
|
|
63
|
+
args.push('--effort', ultraEffort ? 'max' : o.thinkingEffort);
|
|
64
|
+
if (!o.claudeWorkflowEnabled && !ultraEffort)
|
|
65
|
+
args.push('--disallowed-tools', 'Workflow');
|
|
66
|
+
return args;
|
|
67
|
+
}
|
|
45
68
|
// ---------------------------------------------------------------------------
|
|
46
69
|
// Command & parser
|
|
47
70
|
// ---------------------------------------------------------------------------
|
|
@@ -70,21 +93,9 @@ function claudeCmd(o) {
|
|
|
70
93
|
if (o.attachments?.length)
|
|
71
94
|
o._stdinOverride = buildClaudeUserMessage(o.prompt, o.attachments);
|
|
72
95
|
}
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
// break — the CLI, and so it never suppresses the Workflow tool below.
|
|
77
|
-
const ultraEffort = o.thinkingEffort === 'ultra';
|
|
78
|
-
if (o.thinkingEffort)
|
|
79
|
-
args.push('--effort', ultraEffort ? 'max' : o.thinkingEffort);
|
|
80
|
-
// Multi-agent Workflow gate. The Workflow tool is always present in the
|
|
81
|
-
// toolset and triggers on a bare "workflow" keyword — combined with the
|
|
82
|
-
// bypassPermissions mode pikiclaw runs by default, that means an offhand
|
|
83
|
-
// mention could auto-spawn a fleet of sub-agents. Unless orchestration is
|
|
84
|
-
// explicitly enabled, drop the tool entirely so it can't fire at all. When
|
|
85
|
-
// enabled, the bot injects a standing opt-in directive via the system prompt.
|
|
86
|
-
if (!o.claudeWorkflowEnabled && !ultraEffort)
|
|
87
|
-
args.push('--disallowed-tools', 'Workflow');
|
|
96
|
+
// Effort + Workflow gate — shared with the TUI driver (claude-tui.ts) so the
|
|
97
|
+
// two spawn paths can never drift. See claudeEffortAndWorkflowArgs.
|
|
98
|
+
args.push(...claudeEffortAndWorkflowArgs(o));
|
|
88
99
|
if (o.claudeAppendSystemPrompt)
|
|
89
100
|
args.push('--append-system-prompt', o.claudeAppendSystemPrompt);
|
|
90
101
|
if (o.mcpConfigPath)
|
package/package.json
CHANGED