@herbertgao/pi-extensions 2026.11.14 → 2026.11.16

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +7 -7
  3. package/THIRD_PARTY_NOTICES.md +3 -3
  4. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +6 -0
  5. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +3 -2
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.md +3 -2
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +5 -0
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +9 -0
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +32 -2
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +26 -21
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/table-copy.ts +753 -0
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/fullscreen-detect.ts +11 -0
  13. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  14. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +6 -0
  15. package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
  16. package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
  17. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +5 -5
  18. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/audit.md +8 -1
  19. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/audit.native.md +8 -1
  20. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/craft-floor.md +3 -3
  21. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique.md +8 -6
  22. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/finish-reviewer.md +2 -2
  23. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/doctor.md +5 -1
  24. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/init.md +2 -0
  25. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live.md +1 -1
  26. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +8 -9
  27. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/polish.md +1 -1
  28. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
  29. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
  30. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +55 -32
  31. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  32. package/node_modules/@herbertgao/pi-subagents/README.md +18 -16
  33. package/node_modules/@herbertgao/pi-subagents/docs/workflows.md +1 -1
  34. package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
  35. package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +18 -5
  36. package/node_modules/@herbertgao/pi-subagents/src/agent-types.ts +88 -0
  37. package/node_modules/@herbertgao/pi-subagents/src/index.ts +16 -92
  38. package/node_modules/@herbertgao/pi-subagents/src/mention-clone.ts +6 -2
  39. package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +18 -2
  40. package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +25 -3
  41. package/node_modules/pi-commandcode-provider/CHANGELOG.md +20 -0
  42. package/node_modules/pi-commandcode-provider/README.md +1 -1
  43. package/node_modules/pi-commandcode-provider/index.ts +2 -1
  44. package/node_modules/pi-commandcode-provider/package.json +1 -1
  45. package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +9 -2
  46. package/node_modules/pi-commandcode-provider/src/pricing.ts +5 -1
  47. package/node_modules/pi-commandcode-provider/src/responses-compat.ts +24 -1
  48. package/node_modules/pi-commandcode-provider/src/responses-stream.ts +99 -6
  49. package/node_modules/pi-provider-qoder/dist/index.js +50 -10
  50. package/node_modules/pi-provider-qoder/package.json +1 -1
  51. package/package.json +6 -6
@@ -54,11 +54,13 @@ import {
54
54
  steerAgent,
55
55
  } from "./agent-runner.js"
56
56
  import {
57
- BUILTIN_TOOL_NAMES,
57
+ formatAgentTypeList,
58
58
  getAgentConfig,
59
59
  getAvailableTypes,
60
60
  getConfig,
61
61
  getFallbackSubagent,
62
+ getModelLabelFromConfig,
63
+ getToolDescriptionMode,
62
64
  isDefaultsDisabled,
63
65
  NO_FALLBACK,
64
66
  registerAgents,
@@ -66,6 +68,7 @@ import {
66
68
  resolveType,
67
69
  setDefaultsDisabled,
68
70
  setFallbackSubagent,
71
+ setToolDescriptionMode,
69
72
  } from "./agent-types.js"
70
73
  import { inChildSessionContext } from "./child-context.js"
71
74
  import { CompletionOutbox, NOTIFICATION_HOLD_MS } from "./completion-outbox.js"
@@ -140,7 +143,6 @@ import {
140
143
  partialOutputSuffix,
141
144
  } from "./status-note.js"
142
145
  import {
143
- type AgentConfig,
144
146
  type AgentInvocation,
145
147
  type AgentMentionMode,
146
148
  type AgentRecord,
@@ -475,43 +477,6 @@ function buildNotificationDetails(
475
477
  }
476
478
  }
477
479
 
478
- /**
479
- * Format an agent's tool scope for the Agent tool description.
480
- *
481
- * This suffix describes BUILT-IN scope only — extension tools are resolved when
482
- * the agent runs (extensions can register asynchronously), so they cannot be
483
- * enumerated while the description is being built. That is why an agent with
484
- * `tools: "*, ext:mcp/search"` renders "*" and always has.
485
- *
486
- * Two distinctions matter, both of them capability claims the orchestrator acts on:
487
- *
488
- * - absent vs empty. `builtinToolNames: undefined` means the agent never narrowed
489
- * its tools (the shipped defaults); `[]` is what `tools: none` and an `ext:`-only
490
- * `tools:` parse to, and the runtime really does hand those agents no built-ins.
491
- * Rendering both "*" tells the orchestrator a tool-less agent can run `bash`.
492
- * - empty-with-extensions vs empty-without. Zero built-ins does NOT imply zero
493
- * tools: `tools: none` alongside `extensions:` still surfaces every extension
494
- * tool (see test/fixtures/.pi/agents/tools-none.md, which expects three). Calling
495
- * that "none" understates the agent instead of overstating it — better, but still
496
- * wrong, and it would route work away from the only agent able to do it. "none"
497
- * is therefore reserved for agents that genuinely can call nothing: `isolated`
498
- * agents and those with `extensions: false`.
499
- */
500
- export function formatToolsSuffix(cfg: AgentConfig | undefined): string {
501
- const tools = cfg?.builtinToolNames
502
- if (!tools) return "*"
503
- if (tools.length === 0) {
504
- // `isolated` overrides extensions to false in the runner, so both mean the
505
- // agent has no extension tools either — and then it truly has nothing.
506
- const noExtensionTools = cfg?.isolated === true || cfg?.extensions === false
507
- return noExtensionTools ? "none" : "no built-ins, extension tools only"
508
- }
509
- const isFullSet =
510
- tools.length === BUILTIN_TOOL_NAMES.length &&
511
- BUILTIN_TOOL_NAMES.every((t) => tools.includes(t))
512
- return isFullSet ? "*" : tools.join(", ")
513
- }
514
-
515
480
  /** CLI flag that runs a workflow script at session start. */
516
481
  export const WORKFLOW_FILE_FLAG = "subagents-workflow-file"
517
482
 
@@ -1817,17 +1782,6 @@ export default function (pi: ExtensionAPI) {
1817
1782
  reloadCustomAgents() // re-register with new setting
1818
1783
  }
1819
1784
 
1820
- // ---- Agent tool description mode ----
1821
- // "full" (default) keeps the rich Claude Code-style description; "compact"
1822
- // swaps in a ~75% smaller one for small/local models (#91). Read once at
1823
- // tool registration — flipping it applies on the next pi session.
1824
- let toolDescriptionMode: ToolDescriptionMode = "full"
1825
- function getToolDescriptionMode(): ToolDescriptionMode {
1826
- return toolDescriptionMode
1827
- }
1828
- function setToolDescriptionMode(mode: ToolDescriptionMode): void {
1829
- toolDescriptionMode = mode
1830
- }
1831
1785
  let workflowToolExposure: WorkflowToolExposureMode = "inline"
1832
1786
  function getWorkflowToolExposure(): WorkflowToolExposureMode {
1833
1787
  return workflowToolExposure
@@ -2018,44 +1972,10 @@ export default function (pi: ExtensionAPI) {
2018
1972
  pi.on("agent_end", () => outbox.onAgentEnd())
2019
1973
  pi.on("agent_settled", () => outbox.onAgentEnd())
2020
1974
 
2021
- /** Build the full type list text dynamically from available agents only. */
2022
- const buildTypeListText = () => {
2023
- const available = getAvailableTypes()
2024
-
2025
- return available
2026
- .map((name) => {
2027
- const cfg = getAgentConfig(name)
2028
- const modelSuffix = cfg?.model
2029
- ? ` (${getModelLabelFromConfig(cfg.model)})`
2030
- : ""
2031
- const toolsSuffix = ` (Tools: ${formatToolsSuffix(cfg)})`
2032
- return `- ${name}: ${cfg?.description ?? name}${modelSuffix}${toolsSuffix}`
2033
- })
2034
- .join("\n")
2035
- }
2036
-
2037
- /** First sentence of an agent description — for the compact type list. */
2038
- const firstSentence = (text: string): string => {
2039
- const match = text.match(/^.*?[.!?](?=\s|$)/s)
2040
- return (match ? match[0] : text).replace(/\s+/g, " ").trim()
2041
- }
2042
-
2043
- /** Compact type list: one line per agent, first sentence only. */
1975
+ const buildTypeListText = () =>
1976
+ formatAgentTypeList(getAvailableTypes(), getAgentConfig, false)
2044
1977
  const buildCompactTypeListText = () =>
2045
- getAvailableTypes()
2046
- .map((name) => {
2047
- const cfg = getAgentConfig(name)
2048
- return `- ${name}: ${firstSentence(cfg?.description ?? name)} (Tools: ${formatToolsSuffix(cfg)})`
2049
- })
2050
- .join("\n")
2051
-
2052
- /** Derive a short model label from a model string. */
2053
- function getModelLabelFromConfig(model: string): string {
2054
- // Strip provider prefix (e.g. "anthropic/claude-sonnet-4-6" → "claude-sonnet-4-6")
2055
- const name = model.includes("/") ? model.split("/").pop()! : model
2056
- // Strip trailing date suffix (e.g. "claude-haiku-4-5-20251001" → "claude-haiku-4-5")
2057
- return name.replace(/-\d{8}$/, "")
2058
- }
1978
+ formatAgentTypeList(getAvailableTypes(), getAgentConfig, true)
2059
1979
 
2060
1980
  // Apply persisted settings on startup and emit `subagents:settings_loaded`.
2061
1981
  // Global + project merged; missing → defaults; corrupt file emits a warning
@@ -2520,8 +2440,9 @@ Terse command-style prompts produce shallow, generic work.
2520
2440
  // and picks up the widget, fleet row, transcript, join batching and
2521
2441
  // completion notification unchanged. Only the prompt, the turn budget and
2522
2442
  // run_in_background carry over from the call: like a live resume, it
2523
- // ignores `subagent_type`, model and the rest, and runs under the agent
2524
- // type's current definition.
2443
+ // ignores `subagent_type`, model, thinking and the rest. It runs under the
2444
+ // agent type's current prompt and tools, on the model and thinking level
2445
+ // its own session recorded (#462) — see the model resolution below.
2525
2446
  // `schedule` is left to its own branch, which refuses the combination.
2526
2447
  const saved =
2527
2448
  callParams.resume !== undefined &&
@@ -2606,8 +2527,11 @@ Terse command-style prompts produce shallow, generic work.
2606
2527
  )
2607
2528
 
2608
2529
  // Resolve model from agent config first; tool-call params only fill gaps.
2609
- let model = ctx.model
2610
- if (resolvedConfig.modelInput) {
2530
+ // A reopen resolves none: runAgent leaves the model and thinking level to
2531
+ // the reopened session, which restores the ones the agent ran with. The
2532
+ // agent file and the parent would both override them (#462).
2533
+ let model = reopenOptions ? undefined : ctx.model
2534
+ if (resolvedConfig.modelInput && !reopenOptions) {
2611
2535
  const resolved = resolveModel(
2612
2536
  resolvedConfig.modelInput,
2613
2537
  ctx.modelRegistry,
@@ -2635,7 +2559,7 @@ Terse command-style prompts produce shallow, generic work.
2635
2559
  if (scopeVerdict.kind === "warn")
2636
2560
  ctx.ui.notify(scopeVerdict.message, "warning")
2637
2561
 
2638
- const thinking = resolvedConfig.thinking
2562
+ const thinking = reopenOptions ? undefined : resolvedConfig.thinking
2639
2563
  const inheritContext = resolvedConfig.inheritContext
2640
2564
  const runInBackground = resolvedConfig.runInBackground
2641
2565
  const isolated = resolvedConfig.isolated
@@ -64,6 +64,7 @@ import {
64
64
  } from "@earendil-works/pi-coding-agent"
65
65
  import { runInChildSessionContext } from "./child-context.js"
66
66
  import { agentMentionReminder } from "./mention.js"
67
+ import { withoutCwdSection } from "./prompts.js"
67
68
  import type { SubagentType } from "./types.js"
68
69
 
69
70
  export interface MentionCloneOptions {
@@ -152,8 +153,11 @@ export async function runMentionClone(
152
153
  // The live system prompt, not the one the clone would build from cwd and
153
154
  // agentDir — extensions contribute to it per turn. Everything the loader
154
155
  // would add on top (AGENTS.md, skills, APPEND_SYSTEM.md) is already in the
155
- // rendered prompt, so it is suppressed, as agent-runner does.
156
- const systemPrompt = ctx.getSystemPrompt()
156
+ // rendered prompt, so it is suppressed, as agent-runner does. The `cwd`
157
+ // section cannot be suppressed — pi renders it after any prompt — so the
158
+ // parent's copy is removed instead. Extension sections stay: the clone
159
+ // loads no extensions to render them again.
160
+ const systemPrompt = withoutCwdSection(ctx.getSystemPrompt(), ctx.cwd)
157
161
  const loader = new DefaultResourceLoader({
158
162
  cwd: ctx.cwd,
159
163
  agentDir: getAgentDir(),
@@ -10,8 +10,10 @@ import { Type } from "typebox"
10
10
  import { abortable } from "./abortable.js"
11
11
  import {
12
12
  buildAgentRegistry,
13
+ formatAgentTypeList,
13
14
  getAgentConfigIn,
14
15
  getAvailableTypesIn,
16
+ getToolDescriptionMode,
15
17
  resolveEnabledTypeIn,
16
18
  resolveTypeIn,
17
19
  } from "./agent-types.js"
@@ -196,12 +198,26 @@ export function createNestedSubagentTools(
196
198
  )
197
199
  }
198
200
 
201
+ const registry = loadRegistry()
202
+ const available = availableIn(registry)
203
+ // Same list as the main session's Agent tool (#457); a "custom" description
204
+ // is written for the main session, so it counts as full here.
205
+ const typeList =
206
+ available.length > 0
207
+ ? formatAgentTypeList(
208
+ available,
209
+ (name) => getAgentConfigIn(registry, name),
210
+ getToolDescriptionMode() === "compact",
211
+ )
212
+ : "none"
213
+
199
214
  const agentTool = defineTool({
200
215
  name: NESTED_TOOL_NAMES[0],
201
216
  label: "Agent",
202
217
  description:
203
218
  "Launch a child-safe nested subagent for bounded delegated work. " +
204
- "Only use agent types allowed by this parent agent; nesting is depth-limited. " +
219
+ "Only use agent types allowed by this parent agent; nesting is depth-limited.\n\n" +
220
+ `Available agent types and the tools they have access to:\n${typeList}\n\n` +
205
221
  // Overrides the main session's inherited Agent guideline ("you will be
206
222
  // notified on completion"), which does not hold for nested children.
207
223
  "A background nested agent does NOT notify you when it finishes: collect each one with get_subagent_result (wait: true) before you end your turn, or it is stopped and its work is lost.",
@@ -213,7 +229,7 @@ export function createNestedSubagentTools(
213
229
  description: "Short 3-5 word task description.",
214
230
  }),
215
231
  subagent_type: Type.String({
216
- description: `Allowed nested agent type. Available: ${availableIn(loadRegistry()).join(", ") || "none"}.`,
232
+ description: `Allowed nested agent type. Available: ${available.join(", ") || "none"}.`,
217
233
  }),
218
234
  model: Type.Optional(
219
235
  Type.String({ description: "Optional provider/model override." }),
@@ -189,9 +189,7 @@ ${envBlock}`
189
189
  * @param cwd The cwd the parent's prompt was rendered with.
190
190
  */
191
191
  export function inheritableParentPrompt(rendered: string, cwd: string): string {
192
- const cwdAt = rendered.lastIndexOf(
193
- `\n\n<cwd>\n${cwd.replace(/\\/g, "/")}\n</cwd>`,
194
- )
192
+ const cwdAt = rendered.lastIndexOf(cwdSection(cwd))
195
193
  if (cwdAt < 0) return rendered
196
194
  const head = rendered.slice(0, cwdAt)
197
195
  if (!head.endsWith("\n</skills>")) return head
@@ -199,6 +197,30 @@ export function inheritableParentPrompt(rendered: string, cwd: string): string {
199
197
  return skillsAt < 0 ? head : head.slice(0, skillsAt)
200
198
  }
201
199
 
200
+ /**
201
+ * The parent's rendered system prompt without its `cwd` section, for a session that
202
+ * renders its own `cwd` after the prompt it is given and adds nothing else.
203
+ *
204
+ * Everything else is kept, including sections after `cwd` (extension sections present
205
+ * while the parent's turn runs). A prompt without the section (for example, a forced
206
+ * prompt) is returned unchanged.
207
+ *
208
+ * @param rendered The parent's `ctx.getSystemPrompt()`.
209
+ * @param cwd The cwd the parent's prompt was rendered with.
210
+ */
211
+ export function withoutCwdSection(rendered: string, cwd: string): string {
212
+ const section = cwdSection(cwd)
213
+ const at = rendered.lastIndexOf(section)
214
+ return at < 0
215
+ ? rendered
216
+ : rendered.slice(0, at) + rendered.slice(at + section.length)
217
+ }
218
+
219
+ /** The `cwd` section as pi renders it after the preceding section. */
220
+ function cwdSection(cwd: string): string {
221
+ return `\n\n<cwd>\n${cwd.replace(/\\/g, "/")}\n</cwd>`
222
+ }
223
+
202
224
  /** Fallback base prompt when parent system prompt is unavailable in append mode. */
203
225
  const genericBase = `# Role
204
226
  You are a general-purpose coding agent for complex, multi-step tasks.
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.6 - 2026-11-17
4
+
5
+ - Show the `zai-org/GLM-5.3` thinking that the Provider API returns only as plaintext `encrypted_content` on the completed reasoning item. The model streams no reasoning delta, and the host keeps that field solely as a replay signature, so the chain of thought arrived and was never displayed. The Responses stream adapter now turns that content into reasoning text for this model only, and skips it when the item already carries a canonical summary or streamed deltas. Other models keep the field invisible because it holds real ciphertext there. ([#221](https://github.com/patlux/pi-commandcode-provider/issues/221), [#225](https://github.com/patlux/pi-commandcode-provider/pull/225))
6
+
7
+ ### Contributors
8
+
9
+ - @ThomasByr — reported the missing `zai-org/GLM-5.3` thinking with a clear reproduction ([#221](https://github.com/patlux/pi-commandcode-provider/issues/221)).
10
+ - @pierreraby — isolated the wire behaviour with bounded live captures, added the per-model stream repair with regression tests ([#225](https://github.com/patlux/pi-commandcode-provider/pull/225)), and prepared this release.
11
+
12
+ ## 0.8.5 - 2026-11-17
13
+
14
+ - Add reviewed display pricing for the two Provider API additions: `Qwen/Qwen4-Max` at $1.50 input / $4.50 output / $0.075 cache read / $1.875 cache write per million tokens, and `tencent/hy4-flash` at $0.07 / $0.281 / $0.003 with no cache-write charge. Both values come from the official pricing page rows `qwen-4-max` and `tencent/hy4-flash`, publish no long-context tier, and carry no promotion. ([#220](https://github.com/patlux/pi-commandcode-provider/pull/220))
15
+ - Refresh the capability snapshot to `command-code@1.89.2`: advertise image input, reasoning and selectable efforts for `Qwen/Qwen4-Max` (`off`, `low`, `high`, `xhigh`) and `tencent/hy4-flash` (`off`, `high`). Add text-only reasoning for `recursive/flint-v1.0:free`, with no selectable effort metadata. All three retain the default 65,536-token output limit, capped by context size, and use Responses when advertised by the API. Add Flint's reviewed zero display prices while its undated free tier lasts, and refresh the 101-model API and pricing snapshots to 2026-11-17. No model left the API; existing prices, endpoint routing rules and model-specific output limits are unchanged. ([#223](https://github.com/patlux/pi-commandcode-provider/pull/223))
16
+ - Pin the GitHub Actions used by the catalog maintenance and memory-benchmark workflows to immutable commit SHAs. The version comments stay in place, and no trigger, permission, input or script changes. ([#222](https://github.com/patlux/pi-commandcode-provider/pull/222))
17
+
18
+ ### Contributors
19
+
20
+ - @sandexzx — refreshed the reviewed pricing snapshot for `Qwen/Qwen4-Max` and `tencent/hy4-flash` ([#220](https://github.com/patlux/pi-commandcode-provider/pull/220)).
21
+ - @pierreraby — refreshed the capability catalog and Flint pricing with regression tests ([#223](https://github.com/patlux/pi-commandcode-provider/pull/223)), pinned the maintenance workflow actions ([#222](https://github.com/patlux/pi-commandcode-provider/pull/222)), and prepared this release.
22
+
3
23
  ## 0.8.4 - 2026-11-15
4
24
 
5
25
  - Stop handing revoked or rotated API keys back on refresh. `refreshToken` used to return the stored key unchanged with a new ten-year expiry. On Oh My Pi, that let OMP keep selecting a dead `/login` credential over a valid one, and every request failed with `401 Invalid 'Authorization' header or token`. Refresh now checks the key against `whoami` first, and a `401` there fails the refresh with the message `401 invalid_token`. OMP forces a refresh after a `401`; when the refresh fails with that message, it signs the credential out and uses the next stored one. A network error or 5xx response from `whoami` fails the refresh with its own error, which OMP treats as temporary and does not sign out. pi refreshes only on expiry, so it runs the new check only then. ([#217](https://github.com/patlux/pi-commandcode-provider/pull/217))
@@ -180,7 +180,7 @@ The following environment variables are intended for tests, local mocks, and com
180
180
 
181
181
  ## Image input
182
182
 
183
- The provider advertises image input only for models marked with the `image` input modality in the official Command Code CLI model catalog. The capability snapshot currently follows `command-code@1.89.1`; unknown models default to text-only until their upstream metadata is reviewed. A daily GitHub Actions job synchronizes the CLI version, image capabilities, reasoning flags, reasoning efforts, and model-specific output limits with the latest published CLI package, also dropping manual effort overrides that upstream has published itself, and opens or updates a reviewable pull request when they change. Pricing remains manually reviewed because temporary promotions and long-context tiers require explicit review.
183
+ The provider advertises image input only for models marked with the `image` input modality in the official Command Code CLI model catalog. The capability snapshot currently follows `command-code@1.89.2`; unknown models default to text-only until their upstream metadata is reviewed. A daily GitHub Actions job synchronizes the CLI version, image capabilities, reasoning flags, reasoning efforts, and model-specific output limits with the latest published CLI package, also dropping manual effort overrides that upstream has published itself, and opens or updates a reviewable pull request when they change. Pricing remains manually reviewed because temporary promotions and long-context tiers require explicit review.
184
184
 
185
185
  For vision-capable models, Pi's native provider adapters forward image blocks from user messages and tool results using the documented OpenAI or Anthropic message schema. Unknown and text-only models remain marked text-only in Pi.
186
186
 
@@ -47,7 +47,7 @@ import { normalizeCommandCodeMessage } from "./src/overflow.ts"
47
47
  import { MODEL_COSTS, ZERO_MODEL_COST } from "./src/pricing.ts"
48
48
  import { registerCommandCodeQuota } from "./src/quota-command.ts"
49
49
  import { normalizeCommandCodeResponsesResponse } from "./src/responses-stream.ts"
50
- import { withResponsesWireRepairs } from "./src/responses-compat.ts"
50
+ import { modelWireTraits, withResponsesWireRepairs } from "./src/responses-compat.ts"
51
51
  import { createCommandCodeRuntime } from "./src/runtime.ts"
52
52
  import {
53
53
  compatForEndpoint,
@@ -365,6 +365,7 @@ export default async function (pi: ExtensionAPI) {
365
365
  (warning) => {
366
366
  streamWarning = warning
367
367
  },
368
+ modelWireTraits(model.id),
368
369
  )
369
370
  },
370
371
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-commandcode-provider",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "pi custom provider for Command Code API (commandcode.ai)",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -1,4 +1,4 @@
1
- export const COMMAND_CODE_CLI_VERSION = "1.89.1"
1
+ export const COMMAND_CODE_CLI_VERSION = "1.89.2"
2
2
 
3
3
  export type CommandCodeInputType = "text" | "image"
4
4
  export type CommandCodeReasoningEffort =
@@ -11,7 +11,7 @@ export type CommandCodeReasoningEffort =
11
11
  | "max"
12
12
 
13
13
  /**
14
- * Generated from command-code@1.89.1 by `npm run sync:commandcode-catalog`.
14
+ * Generated from command-code@1.89.2 by `npm run sync:commandcode-catalog`.
15
15
  * Do not edit manually.
16
16
  */
17
17
  export const MODEL_INPUT_MODALITIES: Readonly<Record<string, readonly CommandCodeInputType[]>> = {
@@ -79,9 +79,11 @@ export const MODEL_INPUT_MODALITIES: Readonly<Record<string, readonly CommandCod
79
79
  "Qwen/Qwen3.8-Max-0902": ["text", "image"],
80
80
  "Qwen/Qwen3.8-Max-Prime": ["text", "image"],
81
81
  "Qwen/Qwen3.8-Omni-Flash": ["text", "image"],
82
+ "Qwen/Qwen4-Max": ["text", "image"],
82
83
  "sakana/fugu-ultra": ["text", "image"],
83
84
  "stepfun/Step-3.7-Flash": ["text", "image"],
84
85
  "stepfun/Step-5-Preview": ["text", "image"],
86
+ "tencent/hy4-flash": ["text", "image"],
85
87
  "thinkingmachines/inkling": ["text", "image"],
86
88
  "thinkingmachines/inkling-2-small:free": ["text", "image"],
87
89
  "thinkingmachines/inkling-small": ["text", "image"],
@@ -166,12 +168,15 @@ export const MODEL_REASONING: Readonly<Record<string, true>> = {
166
168
  "Qwen/Qwen3.8-Max-0902": true,
167
169
  "Qwen/Qwen3.8-Max-Prime": true,
168
170
  "Qwen/Qwen3.8-Omni-Flash": true,
171
+ "Qwen/Qwen4-Max": true,
172
+ "recursive/flint-v1.0:free": true,
169
173
  "sakana/fugu-ultra": true,
170
174
  "stealth/glyph-cluster:free": true,
171
175
  "stepfun/Step-3.5-Flash": true,
172
176
  "stepfun/Step-3.7-Flash": true,
173
177
  "stepfun/Step-5-Preview": true,
174
178
  "tencent/hy3-paid": true,
179
+ "tencent/hy4-flash": true,
175
180
  "tencent/hy4-preview": true,
176
181
  "thinkingmachines/inkling": true,
177
182
  "thinkingmachines/inkling-2-small:free": true,
@@ -246,9 +251,11 @@ export const MODEL_EFFORTS: Readonly<Record<string, readonly CommandCodeReasonin
246
251
  "Qwen/Qwen3.8-Max-0902": ["low", "medium", "xhigh"],
247
252
  "Qwen/Qwen3.8-Max-Prime": ["low", "medium", "xhigh"],
248
253
  "Qwen/Qwen3.8-Omni-Flash": ["low", "medium", "xhigh"],
254
+ "Qwen/Qwen4-Max": ["off", "low", "high", "xhigh"],
249
255
  "sakana/fugu-ultra": ["high", "xhigh"],
250
256
  "stealth/glyph-cluster:free": ["low", "medium", "high", "xhigh"],
251
257
  "stepfun/Step-5-Preview": ["low", "medium", "high"],
258
+ "tencent/hy4-flash": ["off", "high"],
252
259
  "tencent/hy4-preview": ["low", "medium", "high"],
253
260
  "thinkingmachines/inkling-2-small:free": ["low", "medium", "high", "max"],
254
261
  "xai/grok-4.5": ["low", "medium", "high"],
@@ -20,7 +20,7 @@ export interface TemporaryPricing {
20
20
  }
21
21
 
22
22
  export const PRICING_SOURCE_URL = "https://commandcode.ai/docs/resources/pricing-limits"
23
- export const PRICING_LAST_VERIFIED = "2026-11-13"
23
+ export const PRICING_LAST_VERIFIED = "2026-11-17"
24
24
 
25
25
  export const ZERO_MODEL_COST: CommandCodeModelCost = {
26
26
  input: 0,
@@ -39,6 +39,8 @@ export const ZERO_MODEL_COST: CommandCodeModelCost = {
39
39
  */
40
40
  export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
41
41
  // Free models
42
+ // Free while the free tier lasts; no fixed expiry is published.
43
+ "recursive/flint-v1.0:free": { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
42
44
  // Free while the stealth preview lasts; no fixed expiry is published.
43
45
  "stealth/glyph-cluster:free": { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
44
46
  // Free while the free tier lasts; no fixed expiry is published.
@@ -55,6 +57,7 @@ export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
55
57
  "inclusionai/ling-3.1-flash": { input: 0.3, output: 0.9, cacheRead: 0.06, cacheWrite: 0 },
56
58
  "mistral/mistral-large-4": { input: 1.36, output: 4.18, cacheRead: 0.14, cacheWrite: 0 },
57
59
  "tencent/hy3-paid": { input: 0.14, output: 0.58, cacheRead: 0.035, cacheWrite: 0 },
60
+ "tencent/hy4-flash": { input: 0.07, output: 0.281, cacheRead: 0.003, cacheWrite: 0 },
58
61
  "tencent/hy4-preview": { input: 0.834, output: 2.501, cacheRead: 0.042, cacheWrite: 0 },
59
62
  "moonshotai/Kimi-K3.1-Pro": { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 0 },
60
63
  "moonshotai/Kimi-K3": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 0 },
@@ -123,6 +126,7 @@ export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
123
126
  cacheRead: 0.048,
124
127
  cacheWrite: 0,
125
128
  },
129
+ "Qwen/Qwen4-Max": { input: 1.5, output: 4.5, cacheRead: 0.075, cacheWrite: 1.875 },
126
130
  "Qwen/Qwen3.8-Max-Prime": { input: 4, output: 12, cacheRead: 0.5, cacheWrite: 5 },
127
131
  "Qwen/Qwen3.8-Max": { input: 2, output: 6, cacheRead: 0.25, cacheWrite: 2.5 },
128
132
  "Qwen/Qwen3.8-Max-0902": { input: 2, output: 6, cacheRead: 0.25, cacheWrite: 0 },
@@ -30,7 +30,30 @@
30
30
  * would turn a model-specific 400 into a failure for every backend.
31
31
  */
32
32
 
33
- /** Model ID -> repairs to apply. Keep it evidence-driven and short. */
33
+ /** Per-model wire behaviour that needs a matching response-side adaptation. */
34
+ export interface ModelWireTraits {
35
+ /**
36
+ * The model returns its chain of thought as plaintext `encrypted_content` on
37
+ * the completed reasoning item and streams no reasoning delta, so the stream
38
+ * adapter must turn it into reasoning text.
39
+ */
40
+ plaintextReasoningContent: boolean
41
+ }
42
+
43
+ /**
44
+ * Model gate for the plaintext reasoning-item repair. An entry is only added
45
+ * once a live request shows the shape, because the same field holds real
46
+ * ciphertext for other providers and must stay invisible there.
47
+ */
48
+ export const PLAINTEXT_REASONING_CONTENT_MODELS: Readonly<Set<string>> = new Set([
49
+ "zai-org/GLM-5.3",
50
+ ])
51
+
52
+ /** Returns the wire traits of a model, defaulting to none. */
53
+ export function modelWireTraits(modelId: string): ModelWireTraits {
54
+ return { plaintextReasoningContent: PLAINTEXT_REASONING_CONTENT_MODELS.has(modelId) }
55
+ }
56
+ /** Model ID -> request-body repairs to apply. Keep it evidence-driven and short. */
34
57
  export interface ResponsesWireRepair {
35
58
  /** Needs an explicit `type: "message"` on role-carrying input items. */
36
59
  messageItemType?: boolean
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Normalizes Command Code's non-standard Responses reasoning deltas.
2
+ * Normalizes Command Code's non-standard Responses reasoning frames.
3
3
  *
4
4
  * Command Code emits `response.reasoning.delta` while a reasoning item is still
5
5
  * streaming, but pi-ai 1.0.3 only understands the canonical
@@ -7,11 +7,19 @@
7
7
  * and the reasoning text only appears at `response.output_item.done`. Rewriting
8
8
  * the frame in flight restores incremental thinking without touching any other
9
9
  * Responses event.
10
+ *
11
+ * Some models stream no reasoning delta at all and report the whole chain of
12
+ * thought as plaintext `encrypted_content` on the completed reasoning item.
13
+ * pi-ai keeps that field only as a replay signature and never renders it, so
14
+ * `plaintextReasoningContent` turns it into the canonical delta just before the
15
+ * item completes. The option is opt-in per model: for OpenAI models the same
16
+ * field holds real ciphertext and must stay invisible.
10
17
  */
11
18
 
12
19
  const SSE_MIME_TYPE = "text/event-stream"
13
20
  const REASONING_DELTA_EVENT = "response.reasoning.delta"
14
21
  const REASONING_TEXT_DELTA_EVENT = "response.reasoning_text.delta"
22
+ const OUTPUT_ITEM_DONE_EVENT = "response.output_item.done"
15
23
 
16
24
  function isRecord(value: unknown): value is Record<string, unknown> {
17
25
  return typeof value === "object" && value !== null && !Array.isArray(value)
@@ -129,6 +137,71 @@ function stripBom(content: string): string {
129
137
  return content.startsWith("\uFEFF") ? content.slice(1) : content
130
138
  }
131
139
 
140
+ /** Parses the JSON data of a complete frame, or returns undefined. */
141
+ function readDataPayload(frame: string): Record<string, unknown> | undefined {
142
+ const lines = splitSseLines(frame)
143
+ const dataValues: string[] = []
144
+ for (let index = 0; index < lines.length; index += 1) {
145
+ const content = index === 0 ? stripBom(lines[index].content) : lines[index].content
146
+ const parsed = parseSseField(content)
147
+ if (parsed?.field === "data") dataValues.push(parsed.value)
148
+ }
149
+ if (dataValues.length === 0) return undefined
150
+ let payload: unknown
151
+ try {
152
+ payload = JSON.parse(dataValues.join("\n"))
153
+ } catch {
154
+ return undefined
155
+ }
156
+ return isRecord(payload) ? payload : undefined
157
+ }
158
+
159
+ /** Returns the output index of a frame payload, or undefined when unusable. */
160
+ function outputIndexOf(payload: Record<string, unknown>): number | undefined {
161
+ const index = payload.output_index
162
+ if (!Number.isInteger(index) || (index as number) < 0) return undefined
163
+ return index as number
164
+ }
165
+
166
+ /**
167
+ * Returns the plaintext reasoning text an item carries when it has no canonical
168
+ * summary or content, or undefined when the item must stay untouched.
169
+ */
170
+ function plaintextReasoningText(item: Record<string, unknown>): string | undefined {
171
+ if (item.type !== "reasoning") return undefined
172
+ if (Array.isArray(item.summary) && item.summary.length > 0) return undefined
173
+ if (Array.isArray(item.content) && item.content.length > 0) return undefined
174
+ const text = item.encrypted_content
175
+ if (typeof text !== "string" || text.length === 0) return undefined
176
+ return text
177
+ }
178
+
179
+ /**
180
+ * Returns a canonical reasoning-text delta frame for a completed reasoning item
181
+ * whose whole chain of thought is plaintext `encrypted_content`, or undefined.
182
+ * The output index is recorded in `seen` so a later frame cannot repeat it.
183
+ */
184
+ function injectPlaintextReasoningText(frame: string, seen: Set<number>): string | undefined {
185
+ const payload = readDataPayload(frame)
186
+ if (payload?.type !== OUTPUT_ITEM_DONE_EVENT) return undefined
187
+ if (!isRecord(payload.item)) return undefined
188
+ const outputIndex = outputIndexOf(payload)
189
+ if (outputIndex === undefined || seen.has(outputIndex)) return undefined
190
+ const text = plaintextReasoningText(payload.item)
191
+ if (text === undefined) return undefined
192
+
193
+ const delta: Record<string, unknown> = {
194
+ type: REASONING_TEXT_DELTA_EVENT,
195
+ output_index: outputIndex,
196
+ content_index: 0,
197
+ delta: text,
198
+ }
199
+ if (typeof payload.item.id === "string") delta.item_id = payload.item.id
200
+ seen.add(outputIndex)
201
+ const eol = frame.includes("\r\n") ? "\r\n" : "\n"
202
+ return `event: ${REASONING_TEXT_DELTA_EVENT}${eol}data: ${JSON.stringify(delta)}${eol}${eol}`
203
+ }
204
+
132
205
  /** Stateful splitter that emits one normalized frame per SSE event. */
133
206
  class ResponsesSseNormalizer {
134
207
  private readonly decoder = new TextDecoder("utf-8", { ignoreBOM: true })
@@ -137,11 +210,16 @@ class ResponsesSseNormalizer {
137
210
  private scanIndex = 0
138
211
  private lineStart = 0
139
212
  private warned = false
213
+ /** Output indexes that already carried reasoning text, to avoid duplicates. */
214
+ private readonly reasoningTextIndexes = new Set<number>()
140
215
 
141
- constructor(private readonly onWarning?: (message: string) => void) {}
216
+ constructor(
217
+ private readonly onWarning?: (message: string) => void,
218
+ private readonly plaintextReasoningContent = false,
219
+ ) {}
142
220
 
143
221
  private normalize(frame: string): string {
144
- return normalizeResponsesSseFrame(frame, () => {
222
+ const normalized = normalizeResponsesSseFrame(frame, () => {
145
223
  if (this.warned) return
146
224
  this.warned = true
147
225
  try {
@@ -152,6 +230,16 @@ class ResponsesSseNormalizer {
152
230
  // Diagnostics must not interrupt a usable response stream.
153
231
  }
154
232
  })
233
+ if (!this.plaintextReasoningContent) return normalized
234
+ const payload = readDataPayload(normalized)
235
+ if (payload?.type === REASONING_TEXT_DELTA_EVENT) {
236
+ const index = payload.output_index
237
+ if (Number.isInteger(index) && (index as number) >= 0) {
238
+ this.reasoningTextIndexes.add(index as number)
239
+ }
240
+ }
241
+ const injected = injectPlaintextReasoningText(normalized, this.reasoningTextIndexes)
242
+ return injected === undefined ? normalized : injected + normalized
155
243
  }
156
244
 
157
245
  push(text: string, emit: (frame: string) => void, flush: boolean): void {
@@ -217,19 +305,24 @@ class ResponsesSseNormalizer {
217
305
  }
218
306
 
219
307
  /**
220
- * Wraps a Command Code Responses HTTP response so streaming reasoning deltas
221
- * reach pi-ai. Returns the original response when it cannot be an SSE stream.
308
+ * Wraps a Command Code Responses HTTP response so streaming reasoning reaches
309
+ * pi-ai. Returns the original response when it cannot be an SSE stream.
310
+ * `plaintextReasoningContent` is opt-in per model; see the module comment.
222
311
  */
223
312
  export function normalizeCommandCodeResponsesResponse(
224
313
  response: Response,
225
314
  onWarning?: (message: string) => void,
315
+ options?: { plaintextReasoningContent?: boolean },
226
316
  ): Response {
227
317
  if (!response.ok) return response
228
318
  if (response.body === null) return response
229
319
  const mimeType = response.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase()
230
320
  if (mimeType !== SSE_MIME_TYPE) return response
231
321
 
232
- const normalizer = new ResponsesSseNormalizer(onWarning)
322
+ const normalizer = new ResponsesSseNormalizer(
323
+ onWarning,
324
+ options?.plaintextReasoningContent === true,
325
+ )
233
326
  const body = response.body.pipeThrough(
234
327
  new TransformStream<Uint8Array, Uint8Array>({
235
328
  transform: (chunk, controller) => normalizer.transform(chunk, controller),