@herbertgao/pi-extensions 2026.11.18 → 2026.11.20
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/CHANGELOG.md +18 -0
- package/README.md +5 -5
- package/THIRD_PARTY_NOTICES.md +3 -24
- package/node_modules/@estebanforge/pi-antigravity-bridge/CHANGELOG.md +956 -0
- package/node_modules/{pi-antigravity → @estebanforge/pi-antigravity-bridge}/LICENSE +1 -1
- package/node_modules/@estebanforge/pi-antigravity-bridge/README.md +240 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/extensions/index.ts +2117 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/package.json +61 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/connection.ts +644 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/driver.ts +1043 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/events.ts +323 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/home.ts +145 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/jsonrpc.ts +243 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/setup.ts +107 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/usage-estimate.ts +61 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/agents.ts +64 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/agy-install.ts +93 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/agy-paths.ts +30 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/agy-setup.ts +81 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/agy-version.ts +289 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/approval-detect.ts +161 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/approval-gate.ts +233 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/approval-hook.ts +325 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/artifacts-ui.ts +88 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/artifacts.ts +144 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/ask-tool.ts +1221 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/background-watch.ts +225 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/bridge-catalog.ts +197 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/config.ts +523 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/daily-log.ts +196 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/dialog-lock.ts +48 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/diff-render.ts +207 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/driver-types.ts +168 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/driver.ts +907 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/engine-picker.ts +160 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/frame-guard.ts +38 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/handoff-toast.ts +21 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/mcp-registration.ts +376 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/mcp-server.ts +618 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/models.ts +404 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/native-tools.ts +104 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/parked-turn.ts +125 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/patch-cleanup.ts +523 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/poll-fold.ts +55 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/prompt-images.ts +92 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/provider.ts +2214 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/queued-messages.ts +152 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/quota-notice.ts +40 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/redact.ts +27 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/sessions.ts +197 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/skills.ts +207 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/stream-events.ts +161 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/stream-sanitizer.ts +180 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/subagent-roster.ts +245 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/sysprompt-agent.ts +130 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/tasks-ui.ts +90 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/tasks.ts +174 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/usage.ts +174 -0
- package/node_modules/@estebanforge/pi-antigravity-bridge/src/web-tools.ts +320 -0
- package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +3 -1
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +1 -1
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +317 -105
- package/node_modules/@herbertgao/pi-subagents/SECURITY.md +2 -2
- package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +240 -36
- package/node_modules/@herbertgao/pi-subagents/docs/translations.md +63 -0
- package/node_modules/@herbertgao/pi-subagents/docs/workflows.md +1 -1
- package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
- package/node_modules/@herbertgao/pi-subagents/src/agent-file-toggle.ts +2 -0
- package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +89 -6
- package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +6 -2
- package/node_modules/@herbertgao/pi-subagents/src/agent-types.ts +20 -11
- package/node_modules/@herbertgao/pi-subagents/src/cache-retention.ts +39 -0
- package/node_modules/@herbertgao/pi-subagents/src/completion-outbox.ts +5 -0
- package/node_modules/@herbertgao/pi-subagents/src/cross-extension-rpc.ts +185 -44
- package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +7 -0
- package/node_modules/@herbertgao/pi-subagents/src/group-join.ts +9 -0
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +126 -116
- package/node_modules/@herbertgao/pi-subagents/src/mention-clone.ts +3 -2
- package/node_modules/@herbertgao/pi-subagents/src/settings.ts +21 -0
- package/node_modules/@herbertgao/pi-subagents/src/subagent-info.ts +115 -0
- package/node_modules/@herbertgao/pi-subagents/src/types.ts +11 -7
- package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +2 -3
- package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +1 -1
- package/node_modules/@herbertgao/pi-subagents/src/workflow/meta.ts +2 -2
- package/node_modules/@herbertgao/pi-subagents/src/workflow-info.ts +184 -0
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +10 -0
- package/node_modules/pi-commandcode-provider/README.md +3 -2
- package/node_modules/pi-commandcode-provider/index.ts +120 -13
- package/node_modules/pi-commandcode-provider/package.json +4 -3
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +11 -2
- package/node_modules/pi-commandcode-provider/src/pricing.ts +17 -1
- package/node_modules/pi-commandcode-provider/src/quota-command.ts +3 -2
- package/node_modules/pi-commandcode-provider/src/zdr.ts +163 -0
- package/node_modules/pi-typesafe/README.md +1 -1
- package/node_modules/pi-typesafe/dist/ask.js +6 -3
- package/node_modules/pi-typesafe/dist/auth.d.ts +31 -7
- package/node_modules/pi-typesafe/dist/auth.js +159 -55
- package/node_modules/pi-typesafe/dist/batch.d.ts +16 -2
- package/node_modules/pi-typesafe/dist/batch.js +62 -22
- package/node_modules/pi-typesafe/dist/calibrate.d.ts +38 -11
- package/node_modules/pi-typesafe/dist/calibrate.js +56 -24
- package/node_modules/pi-typesafe/dist/client.d.ts +13 -0
- package/node_modules/pi-typesafe/dist/client.js +67 -27
- package/node_modules/pi-typesafe/dist/errors.d.ts +20 -0
- package/node_modules/pi-typesafe/dist/errors.js +105 -2
- package/node_modules/pi-typesafe/dist/extension.d.ts +106 -0
- package/node_modules/pi-typesafe/dist/extension.js +206 -106
- package/node_modules/pi-typesafe/dist/index.d.ts +8 -8
- package/node_modules/pi-typesafe/dist/index.js +3 -3
- package/node_modules/pi-typesafe/dist/key-prompt.d.ts +20 -0
- package/node_modules/pi-typesafe/dist/key-prompt.js +23 -3
- package/node_modules/pi-typesafe/dist/login.d.ts +58 -1
- package/node_modules/pi-typesafe/dist/login.js +167 -13
- package/node_modules/pi-typesafe/dist/schema.d.ts +3 -0
- package/node_modules/pi-typesafe/dist/schema.js +47 -13
- package/node_modules/pi-typesafe/dist/ui.d.ts +2 -1
- package/node_modules/pi-typesafe/dist/usage.d.ts +53 -0
- package/node_modules/pi-typesafe/dist/usage.js +79 -40
- package/node_modules/pi-typesafe/package.json +3 -3
- package/package.json +12 -15
- package/node_modules/pi-antigravity/README.md +0 -298
- package/node_modules/pi-antigravity/docs/reader-guarantees.md +0 -35
- package/node_modules/pi-antigravity/package.json +0 -87
- package/node_modules/pi-antigravity/src/auth/accounts.ts +0 -327
- package/node_modules/pi-antigravity/src/auth/index.ts +0 -23
- package/node_modules/pi-antigravity/src/auth/oauth.ts +0 -445
- package/node_modules/pi-antigravity/src/client/client.ts +0 -602
- package/node_modules/pi-antigravity/src/client/enterprise.ts +0 -150
- package/node_modules/pi-antigravity/src/client/index.ts +0 -2
- package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +0 -104
- package/node_modules/pi-antigravity/src/diagnostics/index.ts +0 -1
- package/node_modules/pi-antigravity/src/features/generate-image.ts +0 -132
- package/node_modules/pi-antigravity/src/features/google-search.ts +0 -72
- package/node_modules/pi-antigravity/src/features/read-url-content.ts +0 -124
- package/node_modules/pi-antigravity/src/image/image.ts +0 -427
- package/node_modules/pi-antigravity/src/image/index.ts +0 -1
- package/node_modules/pi-antigravity/src/image/native.ts +0 -69
- package/node_modules/pi-antigravity/src/index.ts +0 -547
- package/node_modules/pi-antigravity/src/models/discovery.ts +0 -176
- package/node_modules/pi-antigravity/src/models/grouping.ts +0 -487
- package/node_modules/pi-antigravity/src/models/index.ts +0 -3
- package/node_modules/pi-antigravity/src/models/models.ts +0 -647
- package/node_modules/pi-antigravity/src/search/index.ts +0 -1
- package/node_modules/pi-antigravity/src/search/search.ts +0 -967
- package/node_modules/pi-antigravity/src/stream/index.ts +0 -1
- package/node_modules/pi-antigravity/src/stream/stream.ts +0 -1961
- package/node_modules/pi-antigravity/src/types/enums.ts +0 -52
- package/node_modules/pi-antigravity/src/types/index.ts +0 -2
- package/node_modules/pi-antigravity/src/types/types.ts +0 -329
- package/node_modules/pi-antigravity/src/usage/index.ts +0 -1
- package/node_modules/pi-antigravity/src/usage/usage.ts +0 -437
- package/node_modules/pi-antigravity/src/utils/address.ts +0 -180
- package/node_modules/pi-antigravity/src/utils/credits.ts +0 -149
- package/node_modules/pi-antigravity/src/utils/html.ts +0 -31
- package/node_modules/pi-antigravity/src/utils/http.ts +0 -96
- package/node_modules/pi-antigravity/src/utils/index.ts +0 -5
- package/node_modules/pi-antigravity/src/utils/security.ts +0 -278
- package/node_modules/pi-antigravity/src/utils/text.ts +0 -66
- package/node_modules/pi-antigravity/src/utils/util.ts +0 -217
- package/node_modules/pi-antigravity/src/web-fetch/document.ts +0 -83
- package/node_modules/pi-antigravity/src/web-fetch/fences.ts +0 -24
- package/node_modules/pi-antigravity/src/web-fetch/header.ts +0 -97
- package/node_modules/pi-antigravity/src/web-fetch/index.ts +0 -3
- package/node_modules/pi-antigravity/src/web-fetch/inspect.ts +0 -328
- package/node_modules/pi-antigravity/src/web-fetch/limits.ts +0 -4
- package/node_modules/pi-antigravity/src/web-fetch/markdown.ts +0 -744
- package/node_modules/pi-antigravity/src/web-fetch/mdn.ts +0 -164
- package/node_modules/pi-antigravity/src/web-fetch/media.ts +0 -11
- package/node_modules/pi-antigravity/src/web-fetch/metadata.ts +0 -9
- package/node_modules/pi-antigravity/src/web-fetch/representation.ts +0 -93
- package/node_modules/pi-antigravity/src/web-fetch/save.ts +0 -71
- package/node_modules/pi-antigravity/src/web-fetch/sites.ts +0 -138
- package/node_modules/pi-antigravity/src/web-fetch/vendor.d.ts +0 -9
- package/node_modules/pi-antigravity/src/web-fetch/web-fetch.ts +0 -957
- package/node_modules/pi-antigravity/tsconfig.json +0 -21
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* types.ts — Type definitions for the subagent system.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { ThinkingLevel } from "@earendil-works/pi-ai"
|
|
5
|
+
import type { CacheRetention, ThinkingLevel } from "@earendil-works/pi-ai"
|
|
6
6
|
import type { AgentSession } from "@earendil-works/pi-coding-agent"
|
|
7
7
|
import type { LifetimeUsage } from "./usage.js"
|
|
8
8
|
|
|
@@ -80,6 +80,8 @@ export interface AgentConfig {
|
|
|
80
80
|
maxTurns?: number
|
|
81
81
|
/** Persist this subagent as a normal pi session instead of keeping it in memory only. */
|
|
82
82
|
persistSession?: boolean
|
|
83
|
+
/** Prompt-cache retention for this agent's model calls; overrides the `cacheRetention` setting. */
|
|
84
|
+
cacheRetention?: CacheRetention
|
|
83
85
|
/** Write the subagent's .output transcript. Defaults to true; false suppresses only that transcript. */
|
|
84
86
|
outputTranscript?: boolean
|
|
85
87
|
/** Optional session directory used when persistSession is true. Omitted = pi's normal session location. */
|
|
@@ -129,6 +131,13 @@ export type JoinMode = "async" | "group" | "smart"
|
|
|
129
131
|
*/
|
|
130
132
|
export type WidgetMode = "all" | "background" | "off"
|
|
131
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Prompt-cache retention for subagent model calls: pi's own values, plus
|
|
136
|
+
* `inherit` (the global setting only) to leave pi's default — including its
|
|
137
|
+
* `PI_CACHE_RETENTION` environment variable — in charge.
|
|
138
|
+
*/
|
|
139
|
+
export type CacheRetentionSetting = CacheRetention | "inherit"
|
|
140
|
+
|
|
132
141
|
/**
|
|
133
142
|
* How much of the conversation viewer's transcript is rendered as Markdown.
|
|
134
143
|
* - `off`: every line wraps as literal text, as it did before the mode existed.
|
|
@@ -259,12 +268,7 @@ export interface AgentRecord {
|
|
|
259
268
|
/** Worktree info if the agent is running in an isolated worktree. */
|
|
260
269
|
worktree?: { path: string; branch: string; baseSha: string; workPath: string }
|
|
261
270
|
/** Worktree cleanup result after agent completion. */
|
|
262
|
-
worktreeResult?: {
|
|
263
|
-
hasChanges: boolean
|
|
264
|
-
branch?: string
|
|
265
|
-
path?: string
|
|
266
|
-
error?: string
|
|
267
|
-
}
|
|
271
|
+
worktreeResult?: { hasChanges: boolean; branch?: string }
|
|
268
272
|
/** The tool_use_id from the original Agent tool call. */
|
|
269
273
|
toolCallId?: string
|
|
270
274
|
/** Path to the streaming output transcript file. */
|
|
@@ -452,7 +452,6 @@ export class AgentWidget {
|
|
|
452
452
|
startedAt: number
|
|
453
453
|
completedAt?: number
|
|
454
454
|
error?: string
|
|
455
|
-
alias?: string
|
|
456
455
|
lifetimeUsage?: LifetimeUsage
|
|
457
456
|
},
|
|
458
457
|
theme: Theme,
|
|
@@ -496,7 +495,7 @@ export class AgentWidget {
|
|
|
496
495
|
parts.push(duration)
|
|
497
496
|
|
|
498
497
|
const modeTag = modeLabel ? ` ${theme.fg("dim", `(${modeLabel})`)}` : ""
|
|
499
|
-
return `${icon} ${renderAgentName(a.type, theme, { fallbackColor: "dim" }
|
|
498
|
+
return `${icon} ${renderAgentName(a.type, theme, { fallbackColor: "dim" })}${modeTag} ${theme.fg("dim", a.description)} ${theme.fg("dim", "·")} ${theme.fg("dim", parts.join(" · "))}${statusText}`
|
|
500
499
|
}
|
|
501
500
|
|
|
502
501
|
/**
|
|
@@ -591,7 +590,7 @@ export class AgentWidget {
|
|
|
591
590
|
runningLines.push([
|
|
592
591
|
truncate(
|
|
593
592
|
theme.fg("dim", "├─") +
|
|
594
|
-
` ${theme.fg("accent", frame)} ${renderAgentName(a.type, theme, { bold: true }
|
|
593
|
+
` ${theme.fg("accent", frame)} ${renderAgentName(a.type, theme, { bold: true })}${modeTag} ${theme.fg("muted", a.description)} ${theme.fg("dim", "·")} ${fgPreservingNestedStyles(theme, "dim", statsText)}`,
|
|
595
594
|
),
|
|
596
595
|
truncate(theme.fg("dim", "│ ") + theme.fg("dim", ` ⎿ ${activity}`)),
|
|
597
596
|
])
|
|
@@ -659,7 +659,7 @@ export class ConversationViewer implements Component, Focusable {
|
|
|
659
659
|
|
|
660
660
|
lines.push(
|
|
661
661
|
row(
|
|
662
|
-
`${statusIcon} ${renderAgentName(this.record.type, th, { bold: true }
|
|
662
|
+
`${statusIcon} ${renderAgentName(this.record.type, th, { bold: true })}${modeTag} ${th.fg("muted", this.record.description)} ${th.fg("dim", "·")} ${fgPreservingNestedStyles(th, "dim", headerParts.join(" · "))}`,
|
|
663
663
|
),
|
|
664
664
|
)
|
|
665
665
|
const invocationLine = this.invocationLine()
|
|
@@ -297,9 +297,9 @@ export function extractMeta(source: string): MetaExtraction {
|
|
|
297
297
|
// `` `a${1 + 1}b` `` resolves without touching a single global, so it would
|
|
298
298
|
// sail through the empty-context check below and silently produce "a2b".
|
|
299
299
|
if (sawInterpolation) {
|
|
300
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: quoting the syntax being rejected
|
|
300
301
|
fail(
|
|
301
|
-
"`meta` must not use template interpolation (`$" +
|
|
302
|
-
"{...}`).\n" +
|
|
302
|
+
"`meta` must not use template interpolation (`${...}`).\n" +
|
|
303
303
|
PURE_LITERAL_HINT,
|
|
304
304
|
)
|
|
305
305
|
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow-info.ts — The one workflow-run shape other extensions read off the bus.
|
|
3
|
+
*
|
|
4
|
+
* `subagents:workflow_started` / `subagents:workflow_settled` carry `WorkflowInfo`,
|
|
5
|
+
* started with the run's `args` and settled with its `result` spread beside it;
|
|
6
|
+
* `subagents:rpc:workflow_get` returns `WorkflowDetail` (the summary plus the
|
|
7
|
+
* live per-agent snapshot, the logs, the args and the result) and
|
|
8
|
+
* `subagents:rpc:workflow_list` returns `WorkflowInfo[]`.
|
|
9
|
+
* It is a public contract, so it is built from a whitelist: a field reaches a
|
|
10
|
+
* listener only by being named here, never because it was added to `WorkflowTask`
|
|
11
|
+
* or `WorkflowAgentEntry`. The agent entries are explicitly unstable internally
|
|
12
|
+
* (last-write-by-index, mutated in place, churn fields), so `WorkflowAgentInfo`
|
|
13
|
+
* copies a fixed subset into fresh objects rather than exposing them. Documented
|
|
14
|
+
* in docs/rpc.md. Mirrors subagent-info.ts.
|
|
15
|
+
*
|
|
16
|
+
* A key whose value is unknown is omitted, never present as `undefined`.
|
|
17
|
+
*/
|
|
18
|
+
import {
|
|
19
|
+
collapse,
|
|
20
|
+
elapsedMs,
|
|
21
|
+
stats,
|
|
22
|
+
type WorkflowAgentEntry,
|
|
23
|
+
type WorkflowEntryState,
|
|
24
|
+
type WorkflowRunStatus,
|
|
25
|
+
} from "./workflow/progress.js"
|
|
26
|
+
import type { WorkflowTask } from "./workflow/task.js"
|
|
27
|
+
|
|
28
|
+
export interface WorkflowInfo {
|
|
29
|
+
id: string
|
|
30
|
+
name: string
|
|
31
|
+
status: WorkflowRunStatus
|
|
32
|
+
startedAt: number
|
|
33
|
+
/** Until the run settles, the time elapsed so far; excludes paused time. */
|
|
34
|
+
durationMs: number
|
|
35
|
+
/** Agents the run has scheduled. */
|
|
36
|
+
agentCount: number
|
|
37
|
+
/** Agents that have settled successfully. */
|
|
38
|
+
doneCount: number
|
|
39
|
+
/** Agents that failed. */
|
|
40
|
+
failedCount: number
|
|
41
|
+
totalTokens: number
|
|
42
|
+
totalToolCalls: number
|
|
43
|
+
/** `Reviewing (2/3)` — phases with work outstanding, or `""`. */
|
|
44
|
+
phaseLabel: string
|
|
45
|
+
/** From the script's `meta`. */
|
|
46
|
+
description?: string
|
|
47
|
+
/** The `tool_use_id` of the call that started this; absent on the CLI path. */
|
|
48
|
+
toolCallId?: string
|
|
49
|
+
completedAt?: number
|
|
50
|
+
error?: string
|
|
51
|
+
/** Per-agent failure lines, when the run failed with any. */
|
|
52
|
+
failures?: string[]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** One agent in a `WorkflowDetail`, a fixed subset of the internal entry. */
|
|
56
|
+
export interface WorkflowAgentInfo {
|
|
57
|
+
/** Stable identity within the run. */
|
|
58
|
+
index: number
|
|
59
|
+
label: string
|
|
60
|
+
state: WorkflowEntryState
|
|
61
|
+
phaseIndex?: number
|
|
62
|
+
phaseTitle?: string
|
|
63
|
+
agentType?: string
|
|
64
|
+
/** Effective short model label, once the child's session reports one. */
|
|
65
|
+
model?: string
|
|
66
|
+
thinking?: string
|
|
67
|
+
tokens?: number
|
|
68
|
+
toolCalls?: number
|
|
69
|
+
durationMs?: number
|
|
70
|
+
error?: string
|
|
71
|
+
skipped?: boolean
|
|
72
|
+
resultPreview?: string
|
|
73
|
+
/**
|
|
74
|
+
* The manager's `AgentRecord` id, once the child has one — the join key back
|
|
75
|
+
* to this child's own agent-lifecycle events (their `id`). The run's internal
|
|
76
|
+
* `wf-agent-N` handle is deliberately not exposed; it means nothing off the run.
|
|
77
|
+
*/
|
|
78
|
+
recordId?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The summary plus the live per-agent snapshot — what `workflow_get` returns. */
|
|
82
|
+
export interface WorkflowDetail extends WorkflowInfo {
|
|
83
|
+
/** `task.progressVersion`: bumped once per applied progress batch. */
|
|
84
|
+
version: number
|
|
85
|
+
agents: WorkflowAgentInfo[]
|
|
86
|
+
/** The script's `log()` lines in order, as the TUI shows them; `[]` when none. */
|
|
87
|
+
logs: string[]
|
|
88
|
+
/** See {@link workflowArgs}. */
|
|
89
|
+
args?: unknown
|
|
90
|
+
/** See {@link workflowResult}. */
|
|
91
|
+
result?: unknown
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The `args` the run was called with, the script's global `args`. Present only
|
|
96
|
+
* when the call passed them; a `--subagents-workflow-file` run has none.
|
|
97
|
+
* Carried by `subagents:workflow_started` and `workflow_get`, not by
|
|
98
|
+
* `workflow_settled` or the `workflow_list` summaries. A fresh copy per
|
|
99
|
+
* payload, as {@link workflowResult}. The tool takes JSON-shaped `args` only,
|
|
100
|
+
* so it always clones.
|
|
101
|
+
*/
|
|
102
|
+
export function workflowArgs(task: WorkflowTask): { args?: unknown } {
|
|
103
|
+
return task.args !== undefined ? { args: structuredClone(task.args) } : {}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The script's return value, as returned — object, array or primitive, never
|
|
108
|
+
* truncated. Present only once the run completed and returned something.
|
|
109
|
+
* Carried by `subagents:workflow_settled` and `workflow_get`, not by
|
|
110
|
+
* `workflow_started` or the `workflow_list` summaries. A fresh copy per
|
|
111
|
+
* payload: mutating it never touches the run or the parent's notification.
|
|
112
|
+
* Listeners of one event share that payload. The worker has already passed the
|
|
113
|
+
* value through JSON, so it always clones.
|
|
114
|
+
*/
|
|
115
|
+
export function workflowResult(task: WorkflowTask): { result?: unknown } {
|
|
116
|
+
return task.value !== undefined ? { result: structuredClone(task.value) } : {}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The run summary — carried by the lifecycle events and `workflow_list`. */
|
|
120
|
+
export function toWorkflowInfo(
|
|
121
|
+
task: WorkflowTask,
|
|
122
|
+
now = Date.now(),
|
|
123
|
+
): WorkflowInfo {
|
|
124
|
+
const { failedCount } = stats(task.workflowProgress, task.agentCount)
|
|
125
|
+
return {
|
|
126
|
+
id: task.id,
|
|
127
|
+
name: task.workflowName ?? task.meta?.name ?? task.id,
|
|
128
|
+
status: task.status,
|
|
129
|
+
startedAt: task.startTime,
|
|
130
|
+
durationMs: elapsedMs(task, now),
|
|
131
|
+
agentCount: task.agentCount,
|
|
132
|
+
doneCount: task.doneCount,
|
|
133
|
+
failedCount,
|
|
134
|
+
totalTokens: task.totalTokens,
|
|
135
|
+
totalToolCalls: task.totalToolCalls,
|
|
136
|
+
phaseLabel: task.phaseLabel,
|
|
137
|
+
...(task.meta?.description !== undefined
|
|
138
|
+
? { description: task.meta.description }
|
|
139
|
+
: {}),
|
|
140
|
+
...(task.toolCallId !== undefined ? { toolCallId: task.toolCallId } : {}),
|
|
141
|
+
...(task.endTime !== undefined ? { completedAt: task.endTime } : {}),
|
|
142
|
+
...(task.error !== undefined ? { error: task.error } : {}),
|
|
143
|
+
...(task.failures !== undefined ? { failures: task.failures } : {}),
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** The summary plus the current collapsed per-agent snapshot and logs (fresh objects). */
|
|
148
|
+
export function toWorkflowDetail(
|
|
149
|
+
task: WorkflowTask,
|
|
150
|
+
now = Date.now(),
|
|
151
|
+
): WorkflowDetail {
|
|
152
|
+
// `collapse` builds a fresh `logs` array on every call, so it is the copy.
|
|
153
|
+
const { agents, logs } = collapse(task.workflowProgress)
|
|
154
|
+
return {
|
|
155
|
+
...toWorkflowInfo(task, now),
|
|
156
|
+
version: task.progressVersion,
|
|
157
|
+
agents: agents.map(toWorkflowAgentInfo),
|
|
158
|
+
logs,
|
|
159
|
+
...workflowArgs(task),
|
|
160
|
+
...workflowResult(task),
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function toWorkflowAgentInfo(e: WorkflowAgentEntry): WorkflowAgentInfo {
|
|
165
|
+
return {
|
|
166
|
+
index: e.index,
|
|
167
|
+
label: e.label,
|
|
168
|
+
state: e.state,
|
|
169
|
+
...(e.phaseIndex !== undefined ? { phaseIndex: e.phaseIndex } : {}),
|
|
170
|
+
...(e.phaseTitle !== undefined ? { phaseTitle: e.phaseTitle } : {}),
|
|
171
|
+
...(e.agentType !== undefined ? { agentType: e.agentType } : {}),
|
|
172
|
+
...(e.model !== undefined ? { model: e.model } : {}),
|
|
173
|
+
...(e.thinking !== undefined ? { thinking: e.thinking } : {}),
|
|
174
|
+
...(e.tokens !== undefined ? { tokens: e.tokens } : {}),
|
|
175
|
+
...(e.toolCalls !== undefined ? { toolCalls: e.toolCalls } : {}),
|
|
176
|
+
...(e.durationMs !== undefined ? { durationMs: e.durationMs } : {}),
|
|
177
|
+
...(e.error !== undefined ? { error: e.error } : {}),
|
|
178
|
+
...(e.skipped !== undefined ? { skipped: e.skipped } : {}),
|
|
179
|
+
...(e.resultPreview !== undefined
|
|
180
|
+
? { resultPreview: e.resultPreview }
|
|
181
|
+
: {}),
|
|
182
|
+
...(e.recordId !== undefined ? { recordId: e.recordId } : {}),
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.7 - 2026-11-20
|
|
4
|
+
|
|
5
|
+
- On Pi, use `/commandcode-zdr on` or `/commandcode-zdr off` to change the zero-data-retention opt-in for the next request and persist it in the agent directory's `settings.json`. Project settings cannot override this global setting. `/commandcode-zdr` shows the effective state, which is also included in status and diagnostics; the quota command uses the current opt-in. `CMD_ZDR=1` and its legacy alias `COMMANDCODE_ZDR=1` still take precedence and remain the only opt-in on Oh My Pi. ZDR stays off by default. ([#227](https://github.com/patlux/pi-commandcode-provider/pull/227))
|
|
6
|
+
- Refresh the capability snapshot to `command-code@1.91.1` ([#228](https://github.com/patlux/pi-commandcode-provider/pull/228)) and verify pricing for all 105 advertised models. Add reviewed display pricing for `gpt-6.2-astra` and `gpt-6.2-sol` (including their 272K input tiers), `google/gemini-4-neon`, and `tencent/hy4`. Existing prices and routing defaults are unchanged.
|
|
7
|
+
|
|
8
|
+
### Contributors
|
|
9
|
+
|
|
10
|
+
- @Trex-Hub — implemented persistent ZDR controls and added host and settings regression coverage ([#227](https://github.com/patlux/pi-commandcode-provider/pull/227)).
|
|
11
|
+
- @pierreraby — reviewed ZDR on both hosts, verified the new model prices, and prepared this release ([#227](https://github.com/patlux/pi-commandcode-provider/pull/227), [#228](https://github.com/patlux/pi-commandcode-provider/pull/228)).
|
|
12
|
+
|
|
3
13
|
## 0.8.6 - 2026-11-17
|
|
4
14
|
|
|
5
15
|
- 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))
|
|
@@ -163,13 +163,14 @@ While pi is running, use these provider commands without restarting:
|
|
|
163
163
|
- `/commandcode-refresh` fetches and re-registers the current model catalog, and resets the latest transport status. Every inference attempt uses the Provider API; entitlement denials are not cached. Overlapping refreshes are coalesced, and a failed refresh keeps the last valid catalog active.
|
|
164
164
|
- `/commandcode-status` shows redacted discovery diagnostics, including the source, model count, timestamps, cache path, endpoint, and warning. Transport status is `unknown` until the latest inference attempt completes successfully; a denial remains `unknown`, not proof of API entitlement. If a Responses reasoning event has an unsupported shape, a separate stream warning is cleared when the next Responses HTTP request starts, before its outcome is known. Requests on Chat Completions or Messages do not clear it. The slot is shared by concurrent Responses requests, so a late warning from an older in-flight response can still replace it. The event is preserved unchanged; no reasoning text is included in the warning.
|
|
165
165
|
- `/commandcode-diagnostics` shows a shareable support report: plugin/host version, CLI snapshot, selected transport and wire, capability provenance, price status, and the latest request's HTTP status, attempts, outcome, first body-chunk latency and longest gap. It keeps only one request summary in memory. It never collects prompts, tool content, credentials, raw errors, account data or configured local paths. Model identifiers come from the host; recognized path-/credential-shaped values are redacted, but custom names can still identify your setup. Request IDs are included only when they match a bounded hexadecimal/UUID format. Timing is measured between body chunks, not tokens; first-chunk latency may include an error response. A request started most recently owns the report even if another request finishes later. Retry counts are scoped to that stream call, not host-level retries. Review the report before sharing it.
|
|
166
|
+
- `/commandcode-zdr` shows the effective zero-data-retention state; `/commandcode-zdr on` or `/commandcode-zdr off` writes it to the agent settings file. The provider re-registers so the change applies to the next request and survives restart. Saving is supported on pi only; Oh My Pi keeps the `CMD_ZDR` environment opt-in. A symlinked `settings.json` is updated through its target. Turning it off is refused while `CMD_ZDR` or `COMMANDCODE_ZDR` is set, because the environment wins.
|
|
166
167
|
- `/commandcode-quota` shows your Command Code account usage and quota in a dashboard-style layout: credits remaining and used with a percentage, monthly/purchased/free sources, the current plan, available usage totals, the API key name, and the 5-hour and weekly usage windows.
|
|
167
168
|
|
|
168
169
|
As an explicit exception to the inference policy, the `commandcode-quota` command reads from the internal Command Code alpha usage endpoints (the same ones the `cmd` CLI `/usage` command uses): `whoami`, `billing/credits`, `billing/subscriptions`, and `usage/summary`. It authenticates with the same API key the provider already uses. These requests are GET-only account/usage reads, not an inference fallback. Their success says nothing about Provider API entitlement; the undocumented schemas and availability may change independently. If the command cannot reach those endpoints or an endpoint schema changes, unavailable sections are reported explicitly instead of being displayed as zero usage. Output is plain text (via `ui.notify`) so it works across pi and compatible hosts such as OMP.
|
|
169
170
|
|
|
170
171
|
On Oh My Pi the provider also registers an OMP usage provider through the `usage` field of `pi.registerProvider`, reading the same endpoints with the same credentials. It supplies the account's 5-hour and weekly usage windows, credits remaining and used against the billing-period pool, and the current plan to the host's usage surfaces, and it follows the same rule for sections the API does not report. pi has no such field and ignores it.
|
|
171
172
|
|
|
172
|
-
Set `CMD_ZDR=1` to send Command Code's documented `x-cmd-zdr: 1` zero-data-retention header. The legacy `COMMANDCODE_ZDR=1` alias remains supported.
|
|
173
|
+
Set `CMD_ZDR=1` to send Command Code's documented `x-cmd-zdr: 1` zero-data-retention header. The legacy `COMMANDCODE_ZDR=1` alias remains supported. On pi, a settings file is an alternative where exporting an environment variable is inconvenient: add `{ "commandcode": { "enableZDR": true } }` to `settings.json` in the agent directory (`~/.pi/agent/settings.json` for pi), or run `/commandcode-zdr on`. The provider reads that agent-directory file directly, so a project `.pi/settings.json` cannot turn the opt-in on or off; the environment takes precedence over the file. Oh My Pi ignores that file and keeps the environment opt-in only, so a settings file shared with a pi install cannot switch protection on there. A single leading UTF-8 BOM in the file is tolerated. Only a literal `true` enables it, and every other settings key is preserved when the command writes it. The opt-in is sent as a registration header, so an edit made outside the command applies after `/reload` or a restart. Some models have no ZDR-capable upstream yet; a request for those models fails instead of routing through a non-ZDR provider.
|
|
173
174
|
|
|
174
175
|
The following environment variables are intended for tests, local mocks, and compatible API endpoints:
|
|
175
176
|
|
|
@@ -180,7 +181,7 @@ The following environment variables are intended for tests, local mocks, and com
|
|
|
180
181
|
|
|
181
182
|
## Image input
|
|
182
183
|
|
|
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.
|
|
184
|
+
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.91.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.
|
|
184
185
|
|
|
185
186
|
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
187
|
|
|
@@ -49,6 +49,14 @@ import { registerCommandCodeQuota } from "./src/quota-command.ts"
|
|
|
49
49
|
import { normalizeCommandCodeResponsesResponse } from "./src/responses-stream.ts"
|
|
50
50
|
import { modelWireTraits, withResponsesWireRepairs } from "./src/responses-compat.ts"
|
|
51
51
|
import { createCommandCodeRuntime } from "./src/runtime.ts"
|
|
52
|
+
import {
|
|
53
|
+
describeZdr,
|
|
54
|
+
loadZdrSettings,
|
|
55
|
+
resolveZdr,
|
|
56
|
+
saveZdrSetting,
|
|
57
|
+
zdrHeaders,
|
|
58
|
+
type ZdrState,
|
|
59
|
+
} from "./src/zdr.ts"
|
|
52
60
|
import {
|
|
53
61
|
compatForEndpoint,
|
|
54
62
|
endpointChoiceForModel,
|
|
@@ -81,6 +89,15 @@ function compatApiProviderRegistrar(): ((...args: unknown[]) => unknown) | undef
|
|
|
81
89
|
return typeof register === "function" ? (register as (...args: unknown[]) => unknown) : undefined
|
|
82
90
|
}
|
|
83
91
|
|
|
92
|
+
/**
|
|
93
|
+
* The settings.json opt-in is pi-only. pi registers the compat API provider that
|
|
94
|
+
* applies a re-registered header; Oh My Pi does not, so its contract stays the
|
|
95
|
+
* environment only. Both paths use the same probe as the write guard.
|
|
96
|
+
*/
|
|
97
|
+
function settingsZdrSupported(): boolean {
|
|
98
|
+
return compatApiProviderRegistrar() !== undefined
|
|
99
|
+
}
|
|
100
|
+
|
|
84
101
|
function registerCompatApiProvider(stream: CompatStreamFunction): void {
|
|
85
102
|
compatApiProviderRegistrar()?.(
|
|
86
103
|
{ api: COMMAND_CODE_API, stream, streamSimple: stream },
|
|
@@ -112,13 +129,6 @@ function providerApiKey(): string | undefined {
|
|
|
112
129
|
return compatApiProviderRegistrar() ? "$COMMAND_CODE_API_KEY" : undefined
|
|
113
130
|
}
|
|
114
131
|
|
|
115
|
-
function commandCodeHeaders(): Record<string, string> | undefined {
|
|
116
|
-
if (process.env.CMD_ZDR === "1" || process.env.COMMANDCODE_ZDR === "1") {
|
|
117
|
-
return { "x-cmd-zdr": "1" }
|
|
118
|
-
}
|
|
119
|
-
return undefined
|
|
120
|
-
}
|
|
121
|
-
|
|
122
132
|
/**
|
|
123
133
|
* The registered config, plus Oh My Pi's extension-only usage hook.
|
|
124
134
|
*
|
|
@@ -181,19 +191,23 @@ function createProviderConfig(
|
|
|
181
191
|
models: readonly CommandCodeModel[],
|
|
182
192
|
apiBase: string,
|
|
183
193
|
streamCommandCode: ProviderConfig["streamSimple"],
|
|
194
|
+
headers: Record<string, string> | undefined,
|
|
184
195
|
): CommandCodeProviderConfig {
|
|
185
|
-
|
|
196
|
+
// The host merges a re-registration over the previous one and preserves
|
|
197
|
+
// undefined values, so an empty object is what clears a previously sent
|
|
198
|
+
// header after ZDR is turned off.
|
|
199
|
+
const registeredHeaders = headers ?? {}
|
|
186
200
|
return {
|
|
187
201
|
name: "Command Code",
|
|
188
202
|
baseUrl: apiBase,
|
|
189
203
|
apiKey: providerApiKey(),
|
|
190
204
|
api: COMMAND_CODE_API,
|
|
191
205
|
streamSimple: streamCommandCode,
|
|
192
|
-
headers,
|
|
206
|
+
headers: registeredHeaders,
|
|
193
207
|
// Same alpha endpoints and credentials as the /commandcode-quota command.
|
|
194
208
|
usage: createCommandCodeUsageProvider({
|
|
195
209
|
apiBase: quotaApiBase(apiBase),
|
|
196
|
-
headers,
|
|
210
|
+
headers: registeredHeaders,
|
|
197
211
|
}),
|
|
198
212
|
oauth: {
|
|
199
213
|
name: "Command Code",
|
|
@@ -216,7 +230,7 @@ function createProviderConfig(
|
|
|
216
230
|
},
|
|
217
231
|
contextWindow: model.contextWindow,
|
|
218
232
|
maxTokens: model.maxTokens,
|
|
219
|
-
headers,
|
|
233
|
+
headers: registeredHeaders,
|
|
220
234
|
compat: { ...compatForModel(model), commandCodeWire: model.api },
|
|
221
235
|
})),
|
|
222
236
|
}
|
|
@@ -260,6 +274,9 @@ export default async function (pi: ExtensionAPI) {
|
|
|
260
274
|
// Hosts may select their built-in Command Code model before loading extensions.
|
|
261
275
|
// Rebind that stale selection to our registered transport before the first turn.
|
|
262
276
|
pi.on("session_start", async (_event, ctx) => {
|
|
277
|
+
// Applies the opt-in from the agent settings file and picks up a file
|
|
278
|
+
// changed since the last load.
|
|
279
|
+
await applyHostZdr()
|
|
263
280
|
if (ctx.model?.provider !== "commandcode") return
|
|
264
281
|
const registered = ctx.modelRegistry.find("commandcode", ctx.model.id)
|
|
265
282
|
if (registered?.api === COMMAND_CODE_API && ctx.model.api !== COMMAND_CODE_API) {
|
|
@@ -277,6 +294,13 @@ export default async function (pi: ExtensionAPI) {
|
|
|
277
294
|
// the wire each model answers on is resolved here from the catalog that
|
|
278
295
|
// `createProviderConfig` registered. Unknown ids fall back to the id rule.
|
|
279
296
|
const catalogModels = new Map<string, CommandCodeModel>()
|
|
297
|
+
// The environment is readable while extensions load; the agent settings file
|
|
298
|
+
// is read at session start so a change made while the host was stopped applies
|
|
299
|
+
// before the first request. The environment is fixed for the process, and the
|
|
300
|
+
// file only reloads with the extension. /commandcode-zdr updates this state
|
|
301
|
+
// after writing the file.
|
|
302
|
+
const settingsPath = join(getAgentDir(), "settings.json")
|
|
303
|
+
let zdr: ZdrState = resolveZdr(undefined)
|
|
280
304
|
const routingPath = join(getAgentDir(), "commandcode-routing.json")
|
|
281
305
|
let routing: EndpointOverrides = {}
|
|
282
306
|
let routingWarning: string | undefined
|
|
@@ -413,15 +437,97 @@ export default async function (pi: ExtensionAPI) {
|
|
|
413
437
|
const compatStream: CompatStreamFunction = measuredStream
|
|
414
438
|
registerCompatApiProvider(compatStream)
|
|
415
439
|
|
|
440
|
+
const registerProvider = () =>
|
|
441
|
+
pi.registerProvider(
|
|
442
|
+
"commandcode",
|
|
443
|
+
createProviderConfig([...catalogModels.values()], apiBase, measuredStream, zdrHeaders(zdr)),
|
|
444
|
+
)
|
|
445
|
+
const applyHostZdr = async () => {
|
|
446
|
+
// Read the agent settings file, not the host's merged global+project view:
|
|
447
|
+
// the command writes this file, so a project override must not be able to
|
|
448
|
+
// invalidate the persisted opt-in at restart. Only pi owns this file; OMP
|
|
449
|
+
// must not pick up a leftover one, so it keeps the environment opt-in.
|
|
450
|
+
const resolved = resolveZdr(
|
|
451
|
+
settingsZdrSupported() ? await loadZdrSettings(settingsPath) : undefined,
|
|
452
|
+
)
|
|
453
|
+
const changed = resolved.enabled !== zdr.enabled
|
|
454
|
+
zdr = resolved
|
|
455
|
+
// Re-registration is the only way to change a registration header, and it
|
|
456
|
+
// needs a catalog to register.
|
|
457
|
+
if (changed && catalogModels.size > 0) registerProvider()
|
|
458
|
+
}
|
|
459
|
+
|
|
416
460
|
pi.on("message_end", async (event, ctx) => {
|
|
417
461
|
if (event.message.role !== "assistant") return
|
|
418
462
|
const normalized = normalizeCommandCodeMessage(event.message, ctx.model?.provider)
|
|
419
463
|
return normalized ? { message: normalized.message } : undefined
|
|
420
464
|
})
|
|
421
465
|
|
|
466
|
+
// The opt-in is only sent as a registration header, so a change needs the
|
|
467
|
+
// provider re-registered before it reaches the next request. Re-registering
|
|
468
|
+
// is the same path /commandcode-refresh already uses.
|
|
469
|
+
pi.registerCommand("commandcode-zdr", {
|
|
470
|
+
description: "Show or set zero data retention: /commandcode-zdr [on|off]",
|
|
471
|
+
handler: async (args, ctx) => {
|
|
472
|
+
const [choice, extra] = args.trim().split(/\s+/)
|
|
473
|
+
if (!choice) {
|
|
474
|
+
ctx.ui.notify(
|
|
475
|
+
`Command Code zero data retention: ${describeZdr(zdr)}. Usage: /commandcode-zdr on|off`,
|
|
476
|
+
"info",
|
|
477
|
+
)
|
|
478
|
+
return
|
|
479
|
+
}
|
|
480
|
+
if ((choice !== "on" && choice !== "off") || extra) {
|
|
481
|
+
ctx.ui.notify("Usage: /commandcode-zdr on|off", "warning")
|
|
482
|
+
return
|
|
483
|
+
}
|
|
484
|
+
// Only pi reads this settings file back and applies a re-registered header
|
|
485
|
+
// to the next request; other hosts keep the environment opt-in.
|
|
486
|
+
if (!settingsZdrSupported()) {
|
|
487
|
+
ctx.ui.notify(
|
|
488
|
+
"Saving zero data retention is only supported on pi. Set CMD_ZDR=1 in the environment instead.",
|
|
489
|
+
"warning",
|
|
490
|
+
)
|
|
491
|
+
return
|
|
492
|
+
}
|
|
493
|
+
// The environment wins at resolution time, so refuse instead of writing a
|
|
494
|
+
// setting that would not take effect.
|
|
495
|
+
if (choice === "off" && zdr.source === "env") {
|
|
496
|
+
ctx.ui.notify(
|
|
497
|
+
`Zero data retention is forced on by ${zdr.envVar ?? "the environment"}. Unset that variable to disable it.`,
|
|
498
|
+
"warning",
|
|
499
|
+
)
|
|
500
|
+
return
|
|
501
|
+
}
|
|
502
|
+
await ctx.waitForIdle?.()
|
|
503
|
+
let written: unknown
|
|
504
|
+
try {
|
|
505
|
+
written = await saveZdrSetting(settingsPath, choice === "on")
|
|
506
|
+
} catch (error) {
|
|
507
|
+
ctx.ui.notify(
|
|
508
|
+
error instanceof Error ? error.message : "Could not save settings.json",
|
|
509
|
+
"error",
|
|
510
|
+
)
|
|
511
|
+
return
|
|
512
|
+
}
|
|
513
|
+
zdr = resolveZdr(written)
|
|
514
|
+
// Without a catalog there is nothing to register; the next successful
|
|
515
|
+
// load or /commandcode-refresh picks the saved setting up.
|
|
516
|
+
const applied = catalogModels.size > 0
|
|
517
|
+
if (applied) registerProvider()
|
|
518
|
+
ctx.ui.notify(
|
|
519
|
+
`Command Code zero data retention: ${describeZdr(zdr)}. Saved to settings.json; ` +
|
|
520
|
+
(applied
|
|
521
|
+
? "applies to the next request and survives restart."
|
|
522
|
+
: "applies after the next catalog load or /commandcode-refresh."),
|
|
523
|
+
"info",
|
|
524
|
+
)
|
|
525
|
+
},
|
|
526
|
+
})
|
|
527
|
+
|
|
422
528
|
registerCommandCodeQuota(pi, {
|
|
423
529
|
apiBase: quotaApiBase(apiBase),
|
|
424
|
-
headers:
|
|
530
|
+
headers: () => zdrHeaders(zdr),
|
|
425
531
|
})
|
|
426
532
|
|
|
427
533
|
const runtime = createCommandCodeRuntime<ProviderConfig, ExtensionCommandContext>(pi, {
|
|
@@ -438,7 +544,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
438
544
|
createProviderConfig: (models) => {
|
|
439
545
|
catalogModels.clear()
|
|
440
546
|
for (const model of models) catalogModels.set(model.id, model)
|
|
441
|
-
return createProviderConfig(models, apiBase, measuredStream)
|
|
547
|
+
return createProviderConfig(models, apiBase, measuredStream, zdrHeaders(zdr))
|
|
442
548
|
},
|
|
443
549
|
getDiagnostics: (model) => {
|
|
444
550
|
let route = "not selected"
|
|
@@ -473,6 +579,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
473
579
|
request: diagnostics.snapshot(),
|
|
474
580
|
}),
|
|
475
581
|
endpointStatus,
|
|
582
|
+
`zdr: ${describeZdr(zdr)}`,
|
|
476
583
|
routingWarning,
|
|
477
584
|
]
|
|
478
585
|
.filter(Boolean)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-commandcode-provider",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.7",
|
|
4
4
|
"description": "pi custom provider for Command Code API (commandcode.ai)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"LICENSE"
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
|
-
"test": "npm run typecheck && npm run test:diagnostics && npm run test:routing && node --test tests/test-release.mjs tests/test-maintenance-alert.mjs tests/test-pi-child-cleanup.mjs tests/test-entrypoint-typecheck.mjs tests/test-host-protocol-helpers.mjs && tsx tests/test-package-manifest.ts && tsx tests/test-api-key.ts && tsx tests/test-pure-functions.ts && tsx tests/test-models.ts && tsx tests/test-model-metadata-check.ts && tsx tests/test-runtime.ts && tsx tests/test-pricing.ts && tsx tests/test-pricing-check.ts && tsx tests/test-cost.ts && tsx tests/test-oauth.ts && tsx tests/test-overflow.ts && tsx tests/test-quota.ts && tsx tests/test-quota-command.ts && tsx tests/test-usage.ts && tsx tests/test-transport.ts && tsx tests/test-responses-compat.ts && node tests/test-pi-isolated.mjs && node tests/test-pi-authenticated.mjs && node tests/test-pi-local.mjs && node tests/test-omp-compat.mjs && node tests/test-host-protocols.mjs && node tests/test-endpoint-routing.mjs",
|
|
32
|
+
"test": "npm run typecheck && npm run test:diagnostics && npm run test:routing && node --test tests/test-release.mjs tests/test-maintenance-alert.mjs tests/test-pi-child-cleanup.mjs tests/test-entrypoint-typecheck.mjs tests/test-host-protocol-helpers.mjs && tsx tests/test-package-manifest.ts && tsx tests/test-api-key.ts && tsx tests/test-pure-functions.ts && tsx tests/test-models.ts && tsx tests/test-model-metadata-check.ts && tsx tests/test-runtime.ts && tsx tests/test-pricing.ts && tsx tests/test-pricing-check.ts && tsx tests/test-cost.ts && tsx tests/test-oauth.ts && tsx tests/test-overflow.ts && tsx tests/test-quota.ts && tsx tests/test-quota-command.ts && tsx tests/test-usage.ts && tsx tests/test-transport.ts && tsx tests/test-responses-compat.ts && tsx tests/test-zdr.ts && node tests/test-pi-isolated.mjs && node tests/test-pi-authenticated.mjs && node tests/test-pi-local.mjs && node tests/test-omp-compat.mjs && node tests/test-host-protocols.mjs && node tests/test-endpoint-routing.mjs",
|
|
33
33
|
"typecheck": "tsc --noEmit",
|
|
34
34
|
"typecheck:entrypoint": "node scripts/typecheck-entrypoint.mjs",
|
|
35
35
|
"format:check": "prettier --check '**/*.{ts,mjs,json,md}'",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"sync:commandcode-catalog": "tsx .github/scripts/check-commandcode-model-metadata.ts command-code@latest --write",
|
|
42
42
|
"test:quota": "tsx tests/test-quota.ts && tsx tests/test-quota-command.ts && tsx tests/test-usage.ts",
|
|
43
43
|
"test:usage": "tsx tests/test-usage.ts",
|
|
44
|
-
"test:unit": "npm run test:diagnostics && npm run test:routing && tsx tests/test-api-key.ts && tsx tests/test-pure-functions.ts && tsx tests/test-models.ts && tsx tests/test-model-metadata-check.ts && tsx tests/test-runtime.ts && tsx tests/test-pricing.ts && tsx tests/test-pricing-check.ts && tsx tests/test-cost.ts && tsx tests/test-oauth.ts && tsx tests/test-overflow.ts && tsx tests/test-quota.ts && tsx tests/test-quota-command.ts && tsx tests/test-usage.ts && tsx tests/test-transport.ts && tsx tests/test-responses-compat.ts",
|
|
44
|
+
"test:unit": "npm run test:diagnostics && npm run test:routing && tsx tests/test-api-key.ts && tsx tests/test-pure-functions.ts && tsx tests/test-models.ts && tsx tests/test-model-metadata-check.ts && tsx tests/test-runtime.ts && tsx tests/test-pricing.ts && tsx tests/test-pricing-check.ts && tsx tests/test-cost.ts && tsx tests/test-oauth.ts && tsx tests/test-overflow.ts && tsx tests/test-quota.ts && tsx tests/test-quota-command.ts && tsx tests/test-usage.ts && tsx tests/test-transport.ts && tsx tests/test-responses-compat.ts && tsx tests/test-zdr.ts",
|
|
45
45
|
"test:api-key": "tsx tests/test-api-key.ts",
|
|
46
46
|
"test:models": "tsx tests/test-models.ts && tsx tests/test-model-metadata-check.ts",
|
|
47
47
|
"test:diagnostics": "tsx tests/test-diagnostics.ts",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"test:e2e:live:provider": "node scripts/live-e2e-profile.mjs provider",
|
|
66
66
|
"test:e2e:live:all": "node scripts/live-e2e-profile.mjs goat provider",
|
|
67
67
|
"test:cost": "tsx tests/test-cost.ts",
|
|
68
|
+
"test:zdr": "tsx tests/test-zdr.ts",
|
|
68
69
|
"test:responses-compat": "tsx tests/test-responses-compat.ts"
|
|
69
70
|
},
|
|
70
71
|
"pi": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const COMMAND_CODE_CLI_VERSION = "1.
|
|
1
|
+
export const COMMAND_CODE_CLI_VERSION = "1.91.1"
|
|
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.
|
|
14
|
+
* Generated from command-code@1.91.1 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[]>> = {
|
|
@@ -51,6 +51,8 @@ export const MODEL_INPUT_MODALITIES: Readonly<Record<string, readonly CommandCod
|
|
|
51
51
|
"gpt-6-sol": ["text", "image"],
|
|
52
52
|
"gpt-6.1-sol": ["text", "image"],
|
|
53
53
|
"gpt-6.1-terra": ["text", "image"],
|
|
54
|
+
"gpt-6.2-astra": ["text", "image"],
|
|
55
|
+
"gpt-6.2-sol": ["text", "image"],
|
|
54
56
|
"meta/muse-ember": ["text", "image"],
|
|
55
57
|
"meta/muse-spark-1.1": ["text", "image"],
|
|
56
58
|
"meta/muse-spark-1.2": ["text", "image"],
|
|
@@ -83,6 +85,7 @@ export const MODEL_INPUT_MODALITIES: Readonly<Record<string, readonly CommandCod
|
|
|
83
85
|
"sakana/fugu-ultra": ["text", "image"],
|
|
84
86
|
"stepfun/Step-3.7-Flash": ["text", "image"],
|
|
85
87
|
"stepfun/Step-5-Preview": ["text", "image"],
|
|
88
|
+
"tencent/hy4": ["text", "image"],
|
|
86
89
|
"tencent/hy4-flash": ["text", "image"],
|
|
87
90
|
"thinkingmachines/inkling": ["text", "image"],
|
|
88
91
|
"thinkingmachines/inkling-2-small:free": ["text", "image"],
|
|
@@ -136,6 +139,8 @@ export const MODEL_REASONING: Readonly<Record<string, true>> = {
|
|
|
136
139
|
"gpt-6-sol": true,
|
|
137
140
|
"gpt-6.1-sol": true,
|
|
138
141
|
"gpt-6.1-terra": true,
|
|
142
|
+
"gpt-6.2-astra": true,
|
|
143
|
+
"gpt-6.2-sol": true,
|
|
139
144
|
"inclusionai/ling-3.1-flash": true,
|
|
140
145
|
"inclusionai/ling-3.1-flash-1019": true,
|
|
141
146
|
"meituan/LongCat-2.0": true,
|
|
@@ -176,6 +181,7 @@ export const MODEL_REASONING: Readonly<Record<string, true>> = {
|
|
|
176
181
|
"stepfun/Step-3.7-Flash": true,
|
|
177
182
|
"stepfun/Step-5-Preview": true,
|
|
178
183
|
"tencent/hy3-paid": true,
|
|
184
|
+
"tencent/hy4": true,
|
|
179
185
|
"tencent/hy4-flash": true,
|
|
180
186
|
"tencent/hy4-preview": true,
|
|
181
187
|
"thinkingmachines/inkling": true,
|
|
@@ -229,6 +235,8 @@ export const MODEL_EFFORTS: Readonly<Record<string, readonly CommandCodeReasonin
|
|
|
229
235
|
"gpt-6-sol": ["low", "medium", "high", "xhigh", "max"],
|
|
230
236
|
"gpt-6.1-sol": ["low", "medium", "high", "xhigh", "max"],
|
|
231
237
|
"gpt-6.1-terra": ["low", "medium", "high", "xhigh", "max"],
|
|
238
|
+
"gpt-6.2-astra": ["low", "medium", "high", "xhigh", "max"],
|
|
239
|
+
"gpt-6.2-sol": ["low", "medium", "high", "xhigh", "max"],
|
|
232
240
|
"inclusionai/ling-3.1-flash": ["low", "medium", "high"],
|
|
233
241
|
"inclusionai/ling-3.1-flash-1019": ["low", "medium", "high"],
|
|
234
242
|
"meta/muse-ember": ["low", "medium", "high", "xhigh", "max"],
|
|
@@ -255,6 +263,7 @@ export const MODEL_EFFORTS: Readonly<Record<string, readonly CommandCodeReasonin
|
|
|
255
263
|
"sakana/fugu-ultra": ["high", "xhigh"],
|
|
256
264
|
"stealth/glyph-cluster:free": ["low", "medium", "high", "xhigh"],
|
|
257
265
|
"stepfun/Step-5-Preview": ["low", "medium", "high"],
|
|
266
|
+
"tencent/hy4": ["low", "medium", "high"],
|
|
258
267
|
"tencent/hy4-flash": ["off", "high"],
|
|
259
268
|
"tencent/hy4-preview": ["low", "medium", "high"],
|
|
260
269
|
"thinkingmachines/inkling-2-small:free": ["low", "medium", "high", "max"],
|