@saccolabs/pi-claude-cli 0.4.11 → 0.4.12
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 +1 -1
- package/package.json +1 -1
- package/src/thinking-config.ts +21 -36
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ Requires the `claude` binary on your login-shell PATH (`npm install -g @anthropi
|
|
|
48
48
|
- Native tool execution: the CLI runs its own tools; guards are injected as Claude Code PreToolUse hooks via `PI_CLAUDE_CLI_SETTINGS`
|
|
49
49
|
- Reports account rate-limit state (window, reset, overage) to the front-end
|
|
50
50
|
on the `claude-rate-limit` status key — never mixed into turn content
|
|
51
|
-
- Configurable thinking effort across the full ladder (low to max) for
|
|
51
|
+
- Configurable thinking effort across the full ladder (low to max), mapped 1:1 for every model: the level the host asks for is the level the CLI gets
|
|
52
52
|
- Cross-platform subprocess management (Windows, macOS, Linux)
|
|
53
53
|
- Inactivity timeout and process registry for cleanup
|
|
54
54
|
|
package/package.json
CHANGED
package/src/thinking-config.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Thinking effort configuration for mapping pi's ThinkingLevel to Claude CLI --effort flags.
|
|
3
3
|
*
|
|
4
4
|
* Maps pi's reasoning levels (minimal/low/medium/high/xhigh/max) to the CLI's effort
|
|
5
|
-
* levels (low/medium/high/xhigh/max).
|
|
6
|
-
*
|
|
5
|
+
* levels (low/medium/high/xhigh/max). Every model passes through 1:1 apart from
|
|
6
|
+
* `minimal`, which the CLI has no rung for and which floors at `low`.
|
|
7
7
|
*
|
|
8
8
|
* IMPORTANT: The CLI does NOT support --thinking-budget. Only --effort is supported.
|
|
9
9
|
*/
|
|
@@ -14,12 +14,23 @@ import type { ThinkingLevel, ThinkingBudgets } from "@earendil-works/pi-ai";
|
|
|
14
14
|
export type CliEffortLevel = "low" | "medium" | "high" | "xhigh" | "max";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* pi ThinkingLevel -> CLI effort, 1:1 for every rung the CLI has.
|
|
18
|
+
*
|
|
19
|
+
* The CLI accepts the full ladder (low/medium/high/xhigh/max) on every current
|
|
20
|
+
* model — verified with claude-fable-5 and claude-sonnet-5, and on 2026-08-27
|
|
21
|
+
* with claude-opus-5, where `--effort high`, `xhigh` and `max` were each
|
|
22
|
+
* accepted and recorded distinctly in the session transcript's `effort` field.
|
|
23
|
+
*
|
|
24
|
+
* Opus used to be shifted up a rung here (medium→high, high→max) to compensate
|
|
25
|
+
* for a cap that no longer exists. That made `high` unrequestable on opus and
|
|
26
|
+
* was not a private detail: Claude Code skills size their own sub-agent fan-out
|
|
27
|
+
* from this flag, so a host asking for `high` silently got the widest tier the
|
|
28
|
+
* skill offered. See https://github.com/agustinsacco/pi-claude-cli/issues/22.
|
|
29
|
+
*
|
|
30
|
+
* `minimal` has no CLI rung and floors at `low`. That is a floor, not a shift:
|
|
31
|
+
* it maps down, and no level maps above what the host asked for.
|
|
21
32
|
*/
|
|
22
|
-
const
|
|
33
|
+
const EFFORT_MAP: Record<ThinkingLevel, CliEffortLevel> = {
|
|
23
34
|
minimal: "low",
|
|
24
35
|
low: "low",
|
|
25
36
|
medium: "medium",
|
|
@@ -28,30 +39,6 @@ const STANDARD_EFFORT_MAP: Record<ThinkingLevel, CliEffortLevel> = {
|
|
|
28
39
|
max: "max",
|
|
29
40
|
};
|
|
30
41
|
|
|
31
|
-
/**
|
|
32
|
-
* Opus model mapping: shifted up for elevated reasoning.
|
|
33
|
-
* Opus models get max capability at high/xhigh/max levels.
|
|
34
|
-
*/
|
|
35
|
-
const OPUS_EFFORT_MAP: Record<ThinkingLevel, CliEffortLevel> = {
|
|
36
|
-
minimal: "low",
|
|
37
|
-
low: "low",
|
|
38
|
-
medium: "high", // shifted: standard high
|
|
39
|
-
high: "max", // shifted: maximum capability
|
|
40
|
-
xhigh: "max", // Opus gets max
|
|
41
|
-
max: "max",
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Detect whether a model ID refers to an Opus model.
|
|
46
|
-
* Uses includes('opus') for forward-compatibility with future Opus versions.
|
|
47
|
-
*
|
|
48
|
-
* @param modelId - The model identifier string
|
|
49
|
-
* @returns true if the model is an Opus variant
|
|
50
|
-
*/
|
|
51
|
-
export function isOpusModel(modelId: string): boolean {
|
|
52
|
-
return modelId.includes("opus");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
42
|
/**
|
|
56
43
|
* Map pi's ThinkingLevel to a CLI effort string.
|
|
57
44
|
*
|
|
@@ -61,13 +48,13 @@ export function isOpusModel(modelId: string): boolean {
|
|
|
61
48
|
* not token budgets.
|
|
62
49
|
*
|
|
63
50
|
* @param reasoning - Pi's thinking level (undefined = omit flag)
|
|
64
|
-
* @param
|
|
51
|
+
* @param _modelId - Unused; kept so callers need not change. Every model maps alike.
|
|
65
52
|
* @param thinkingBudgets - Custom budgets (logged as unsupported, not applied)
|
|
66
53
|
* @returns CLI effort level string, or undefined if flag should be omitted
|
|
67
54
|
*/
|
|
68
55
|
export function mapThinkingEffort(
|
|
69
56
|
reasoning?: ThinkingLevel,
|
|
70
|
-
|
|
57
|
+
_modelId?: string,
|
|
71
58
|
thinkingBudgets?: ThinkingBudgets,
|
|
72
59
|
): CliEffortLevel | undefined {
|
|
73
60
|
if (reasoning === undefined) {
|
|
@@ -81,7 +68,5 @@ export function mapThinkingEffort(
|
|
|
81
68
|
);
|
|
82
69
|
}
|
|
83
70
|
|
|
84
|
-
|
|
85
|
-
const map = isOpus ? OPUS_EFFORT_MAP : STANDARD_EFFORT_MAP;
|
|
86
|
-
return map[reasoning];
|
|
71
|
+
return EFFORT_MAP[reasoning];
|
|
87
72
|
}
|