@herbertgao/pi-extensions 2026.11.9 → 2026.11.11
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 +21 -0
- package/README.md +6 -6
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +12 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +8 -6
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +8 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +12 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +36 -13
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +4 -8
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +7 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +115 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +47 -15
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/startup-header.ts +3 -18
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +34 -10
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +6 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +30 -17
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/scroll.ts +4 -21
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +63 -7
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +3 -13
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +0 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-mode.ts +34 -7
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +43 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/keybindings.ts +75 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
- package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
- package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +3 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/adapt.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/audit.md +12 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/audit.native.md +4 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique.md +5 -5
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/documenter.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/finish-reviewer.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/distill.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/document.md +3 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/foundations.md +44 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live-setup.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live.md +26 -12
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +10 -9
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/onboard.md +7 -6
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/overdrive.md +2 -2
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/quieter.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/visualize.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable +69 -16
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable.cmd +55 -7
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +34 -4
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +12 -0
- package/node_modules/@herbertgao/pi-subagents/README.md +53 -26
- package/node_modules/@herbertgao/pi-subagents/docs/workflows.md +12 -12
- package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
- package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +84 -8
- package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +51 -32
- package/node_modules/@herbertgao/pi-subagents/src/default-agents.ts +7 -0
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +369 -879
- package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +4 -1
- package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +13 -0
- package/node_modules/@herbertgao/pi-subagents/src/schedule-store.ts +18 -13
- package/node_modules/@herbertgao/pi-subagents/src/schedule.ts +25 -5
- package/node_modules/@herbertgao/pi-subagents/src/settings.ts +225 -61
- package/node_modules/@herbertgao/pi-subagents/src/types.ts +27 -0
- package/node_modules/@herbertgao/pi-subagents/src/ui/agent-tree.ts +47 -0
- package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +16 -5
- package/node_modules/@herbertgao/pi-subagents/src/ui/agents-menu.ts +705 -0
- package/node_modules/@herbertgao/pi-subagents/src/ui/fleet-list.ts +211 -47
- package/node_modules/@herbertgao/pi-subagents/src/ui/settings-menu.ts +361 -0
- package/node_modules/@herbertgao/pi-subagents/src/ui/viewer-keys.ts +1 -1
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +11 -1
- package/node_modules/pi-commandcode-provider/index.ts +2 -1
- package/node_modules/pi-commandcode-provider/package.json +5 -4
- package/node_modules/pi-commandcode-provider/src/pricing.ts +8 -1
- package/node_modules/pi-commandcode-provider/src/responses-compat.ts +137 -0
- package/package.json +5 -5
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* settings-menu.ts — the `/agents → Settings` page.
|
|
3
|
+
*
|
|
4
|
+
* ```
|
|
5
|
+
* ⚙ Subagent Settings · Saving to: Project · Tab to switch
|
|
6
|
+
* .pi/subagents.json · tagged rows are set in a file
|
|
7
|
+
* > cost
|
|
8
|
+
*
|
|
9
|
+
* Show cost global on
|
|
10
|
+
*
|
|
11
|
+
* Type to filter · ↓ or Enter to the list · Esc to clear
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The page owns presentation and keys: the filter, focus, the number editor,
|
|
15
|
+
* the file-tag column and the height the terminal leaves. What each row means
|
|
16
|
+
* (its values, what changing or resetting it does, which file it is saved to)
|
|
17
|
+
* stays with the caller, behind `SettingsPageDeps`.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
getSettingsListTheme,
|
|
22
|
+
type KeybindingsManager,
|
|
23
|
+
type Theme,
|
|
24
|
+
} from "@earendil-works/pi-coding-agent"
|
|
25
|
+
import {
|
|
26
|
+
type Component,
|
|
27
|
+
Container,
|
|
28
|
+
fuzzyFilter,
|
|
29
|
+
Input,
|
|
30
|
+
type SettingItem,
|
|
31
|
+
SettingsList,
|
|
32
|
+
type SettingsListTheme,
|
|
33
|
+
Spacer,
|
|
34
|
+
Text,
|
|
35
|
+
type TUI,
|
|
36
|
+
truncateToWidth,
|
|
37
|
+
visibleWidth,
|
|
38
|
+
wrapTextWithAnsi,
|
|
39
|
+
} from "@earendil-works/pi-tui"
|
|
40
|
+
import {
|
|
41
|
+
isNumericSettingKey,
|
|
42
|
+
NUMERIC_SETTING_BOUNDS,
|
|
43
|
+
type NumericSettingKey,
|
|
44
|
+
type SettingsScope,
|
|
45
|
+
} from "../settings.js"
|
|
46
|
+
import { formatKeyLabel } from "./viewer-keys.js"
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Rows the page leaves for what pi draws under it — its footer and any
|
|
50
|
+
* widgets below the editor, which the page cannot measure.
|
|
51
|
+
*/
|
|
52
|
+
const FOOTER_ROWS = 2
|
|
53
|
+
/** The fewest settings rows the page shows, however short the terminal. */
|
|
54
|
+
const MIN_ROWS = 3
|
|
55
|
+
|
|
56
|
+
export interface SettingsPageDeps {
|
|
57
|
+
/** The rows with their current effective values, labels untagged. */
|
|
58
|
+
buildItems(): SettingItem[]
|
|
59
|
+
/** The file that sets each row's value; called once per refresh. */
|
|
60
|
+
fileTags(): (id: string) => SettingsScope | undefined
|
|
61
|
+
/** Apply and save a row's new value, and notify. */
|
|
62
|
+
apply(id: string, value: string): void
|
|
63
|
+
/** Remove the row's setting from the file that sets it, and notify. */
|
|
64
|
+
reset(id: string): void
|
|
65
|
+
/** The scope changes are saved to, and its file as the header shows it. */
|
|
66
|
+
header(): { scope: SettingsScope; file: string }
|
|
67
|
+
toggleScope(): void
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function createSettingsPage(
|
|
71
|
+
deps: SettingsPageDeps,
|
|
72
|
+
tui: TUI,
|
|
73
|
+
theme: Theme,
|
|
74
|
+
kb: KeybindingsManager,
|
|
75
|
+
done: () => void,
|
|
76
|
+
): Component {
|
|
77
|
+
const items = deps.buildItems()
|
|
78
|
+
const baseLabels = new Map(items.map((item) => [item.id, item.label]))
|
|
79
|
+
// Tags sit in their own column after the longest label, and every label is
|
|
80
|
+
// padded to the tagged width, so the value column stays put whichever rows
|
|
81
|
+
// a filter leaves. The widest (26 + 2 + "project") stays inside
|
|
82
|
+
// SettingsList's 36-column label cap.
|
|
83
|
+
const tagColumn =
|
|
84
|
+
Math.max(...items.map((item) => visibleWidth(item.label))) + 2
|
|
85
|
+
const labelWidth = tagColumn + "project".length
|
|
86
|
+
const title = new Text("", 0, 0)
|
|
87
|
+
const fileLine = new Text("", 0, 0)
|
|
88
|
+
const tabKey = kb.getKeys("tui.input.tab")[0]
|
|
89
|
+
const keyLabel = (id: Parameters<typeof kb.getKeys>[0]) => {
|
|
90
|
+
const key = kb.getKeys(id)[0]
|
|
91
|
+
return key ? formatKeyLabel(key) : id
|
|
92
|
+
}
|
|
93
|
+
const renderHeader = () => {
|
|
94
|
+
const { scope, file } = deps.header()
|
|
95
|
+
const switchHint = tabKey
|
|
96
|
+
? theme.fg("muted", ` · ${formatKeyLabel(tabKey)} to switch`)
|
|
97
|
+
: ""
|
|
98
|
+
title.setText(
|
|
99
|
+
`⚙ Subagent Settings · Saving to: ${scope === "global" ? "Global" : "Project"}${switchHint}`,
|
|
100
|
+
)
|
|
101
|
+
fileLine.setText(
|
|
102
|
+
theme.fg("muted", ` ${file} · tagged rows are set in a file`),
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
// Re-read values and file tags after every change: a save can move a key
|
|
106
|
+
// into the other file, and some rows' values depend on others.
|
|
107
|
+
const refreshRows = () => {
|
|
108
|
+
const tagOf = deps.fileTags()
|
|
109
|
+
const fresh = new Map(deps.buildItems().map((item) => [item.id, item]))
|
|
110
|
+
for (const item of items) {
|
|
111
|
+
const next = fresh.get(item.id)
|
|
112
|
+
if (next)
|
|
113
|
+
Object.assign(item, {
|
|
114
|
+
currentValue: next.currentValue,
|
|
115
|
+
values: next.values,
|
|
116
|
+
description: next.description,
|
|
117
|
+
})
|
|
118
|
+
const source = tagOf(item.id)
|
|
119
|
+
const base = baseLabels.get(item.id) ?? item.label
|
|
120
|
+
item.label = source
|
|
121
|
+
? `${base.padEnd(tagColumn)}${theme.fg("muted", source.padEnd(labelWidth - tagColumn))}`
|
|
122
|
+
: base.padEnd(labelWidth)
|
|
123
|
+
}
|
|
124
|
+
renderHeader()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// The rows the filter leaves, in an array the list holds by reference:
|
|
128
|
+
// filtering rewrites it in place rather than rebuilding the list.
|
|
129
|
+
const shown = [...items]
|
|
130
|
+
// The filter is a stop above the first row. While it has focus, typing,
|
|
131
|
+
// Backspace and Del edit it, and the list draws no cursor; on a row,
|
|
132
|
+
// Backspace and Del reset that row. Typing on a row jumps back here.
|
|
133
|
+
const filter = new Input()
|
|
134
|
+
let filterFocused = true
|
|
135
|
+
const baseTheme = getSettingsListTheme()
|
|
136
|
+
const listTheme: SettingsListTheme = {
|
|
137
|
+
...baseTheme,
|
|
138
|
+
label: (text, isSelected) =>
|
|
139
|
+
baseTheme.label(text, isSelected && !filterFocused),
|
|
140
|
+
value: (text, isSelected) =>
|
|
141
|
+
baseTheme.value(text, isSelected && !filterFocused),
|
|
142
|
+
get cursor() {
|
|
143
|
+
return filterFocused
|
|
144
|
+
? " ".repeat(visibleWidth(baseTheme.cursor))
|
|
145
|
+
: baseTheme.cursor
|
|
146
|
+
},
|
|
147
|
+
}
|
|
148
|
+
// `maxVisible` is fixed per list, so a list is rebuilt when the rows the
|
|
149
|
+
// terminal has room for change.
|
|
150
|
+
const makeList = (maxVisible: number) =>
|
|
151
|
+
new SettingsList(
|
|
152
|
+
shown,
|
|
153
|
+
maxVisible,
|
|
154
|
+
listTheme,
|
|
155
|
+
(id, newValue) => {
|
|
156
|
+
deps.apply(id, newValue)
|
|
157
|
+
refreshRows()
|
|
158
|
+
},
|
|
159
|
+
done,
|
|
160
|
+
)
|
|
161
|
+
let listRows = shown.length
|
|
162
|
+
let list = makeList(listRows)
|
|
163
|
+
refreshRows()
|
|
164
|
+
|
|
165
|
+
// The selected row, an index into `shown`, owned here: SettingsList
|
|
166
|
+
// doesn't expose its own, and Enter and Del must know which row it is.
|
|
167
|
+
let selected = 0
|
|
168
|
+
// The list draws no cursor while the filter has focus, so the selection
|
|
169
|
+
// resets to the first row, which is where Down or Enter lands.
|
|
170
|
+
const applyFilter = () => {
|
|
171
|
+
shown.splice(
|
|
172
|
+
0,
|
|
173
|
+
shown.length,
|
|
174
|
+
...fuzzyFilter(
|
|
175
|
+
items,
|
|
176
|
+
filter.getValue(),
|
|
177
|
+
(item) => baseLabels.get(item.id) ?? item.label,
|
|
178
|
+
),
|
|
179
|
+
)
|
|
180
|
+
selected = 0
|
|
181
|
+
if (shown[0]) list.selectItem(shown[0].id)
|
|
182
|
+
}
|
|
183
|
+
// The number editor under the list, while one is open.
|
|
184
|
+
let editing: { id: NumericSettingKey; input: Input; error: Text } | undefined
|
|
185
|
+
const editor = new Container()
|
|
186
|
+
|
|
187
|
+
const closeEditor = () => {
|
|
188
|
+
editing = undefined
|
|
189
|
+
editor.clear()
|
|
190
|
+
}
|
|
191
|
+
const openEditor = (item: SettingItem, id: NumericSettingKey) => {
|
|
192
|
+
const { min, max } = NUMERIC_SETTING_BOUNDS[id]
|
|
193
|
+
// Empty, not pre-filled: Input.setValue leaves the cursor at column 0,
|
|
194
|
+
// so typed digits would land in front of the old value.
|
|
195
|
+
const input = new Input()
|
|
196
|
+
input.focused = true
|
|
197
|
+
const error = new Text("", 0, 0)
|
|
198
|
+
editing = { id, input, error }
|
|
199
|
+
editor.clear()
|
|
200
|
+
editor.addChild(new Spacer(1))
|
|
201
|
+
editor.addChild(
|
|
202
|
+
new Text(
|
|
203
|
+
`${baseLabels.get(id)} (${min}–${max}, now ${item.currentValue})` +
|
|
204
|
+
theme.fg(
|
|
205
|
+
"muted",
|
|
206
|
+
` · ${keyLabel("tui.input.submit")} to save · ${keyLabel("tui.select.cancel")} to cancel`,
|
|
207
|
+
),
|
|
208
|
+
0,
|
|
209
|
+
0,
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
editor.addChild(input)
|
|
213
|
+
editor.addChild(error)
|
|
214
|
+
}
|
|
215
|
+
const submitEditor = ({ id, input, error }: NonNullable<typeof editing>) => {
|
|
216
|
+
const { min, max } = NUMERIC_SETTING_BOUNDS[id]
|
|
217
|
+
const trimmed = input.getValue().trim()
|
|
218
|
+
const n = Number(trimmed)
|
|
219
|
+
if (trimmed === "" || !Number.isInteger(n) || n < min || n > max) {
|
|
220
|
+
error.setText(
|
|
221
|
+
theme.fg("error", `Enter a whole number from ${min} to ${max}`),
|
|
222
|
+
)
|
|
223
|
+
return
|
|
224
|
+
}
|
|
225
|
+
closeEditor()
|
|
226
|
+
deps.apply(id, String(n))
|
|
227
|
+
refreshRows()
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const hint = () => {
|
|
231
|
+
const keys = filterFocused
|
|
232
|
+
? `Type to filter · ${keyLabel("tui.select.down")} or Enter to the list`
|
|
233
|
+
: `Enter/Space to change · ${keyLabel("tui.editor.deleteCharForward")} to reset`
|
|
234
|
+
const esc = filter.getValue() ? "clear" : "close"
|
|
235
|
+
return listTheme.hint(` ${keys} · Esc to ${esc}`)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return {
|
|
239
|
+
render: (w: number) => {
|
|
240
|
+
filter.focused = filterFocused && !editing
|
|
241
|
+
const head = [
|
|
242
|
+
...title.render(w),
|
|
243
|
+
...fileLine.render(w),
|
|
244
|
+
"",
|
|
245
|
+
...filter.render(w),
|
|
246
|
+
"",
|
|
247
|
+
]
|
|
248
|
+
const tail = editing ? editor.render(w) : ["", truncateToWidth(hint(), w)]
|
|
249
|
+
if (shown.length === 0)
|
|
250
|
+
return [...head, listTheme.hint(" No matching settings"), ...tail]
|
|
251
|
+
// Rows left once everything else is drawn: the description under the
|
|
252
|
+
// list (blank + wrapped, sized by the longest in view so the window
|
|
253
|
+
// doesn't resize as the cursor moves), the list's (n/N) line, and
|
|
254
|
+
// pi's footer, which stays below the page.
|
|
255
|
+
const description = Math.max(
|
|
256
|
+
...shown.map((item) =>
|
|
257
|
+
item.description
|
|
258
|
+
? wrapTextWithAnsi(item.description, w - 4).length + 1
|
|
259
|
+
: 0,
|
|
260
|
+
),
|
|
261
|
+
)
|
|
262
|
+
const room =
|
|
263
|
+
tui.terminal.rows -
|
|
264
|
+
head.length -
|
|
265
|
+
tail.length -
|
|
266
|
+
description -
|
|
267
|
+
1 -
|
|
268
|
+
FOOTER_ROWS
|
|
269
|
+
const rows = Math.min(shown.length, Math.max(MIN_ROWS, room))
|
|
270
|
+
if (rows !== listRows) {
|
|
271
|
+
listRows = rows
|
|
272
|
+
list = makeList(rows)
|
|
273
|
+
list.selectItem(shown[selected].id)
|
|
274
|
+
}
|
|
275
|
+
// Its own hint (blank + "Enter/Space to change · Esc to cancel") is
|
|
276
|
+
// replaced by ours, which names the filter and Del.
|
|
277
|
+
return [...head, ...list.render(w).slice(0, -2), ...tail]
|
|
278
|
+
},
|
|
279
|
+
invalidate: () => {
|
|
280
|
+
title.invalidate()
|
|
281
|
+
fileLine.invalidate()
|
|
282
|
+
editor.invalidate()
|
|
283
|
+
filter.invalidate()
|
|
284
|
+
list.invalidate()
|
|
285
|
+
},
|
|
286
|
+
handleInput: (data: string) => {
|
|
287
|
+
// pi repaints after every keystroke it hands the page.
|
|
288
|
+
if (editing) {
|
|
289
|
+
if (kb.matches(data, "tui.input.submit")) submitEditor(editing)
|
|
290
|
+
else if (kb.matches(data, "tui.select.cancel")) closeEditor()
|
|
291
|
+
else if (!kb.matches(data, "tui.input.tab"))
|
|
292
|
+
editing.input.handleInput(data)
|
|
293
|
+
return
|
|
294
|
+
}
|
|
295
|
+
if (kb.matches(data, "tui.input.tab")) {
|
|
296
|
+
deps.toggleScope()
|
|
297
|
+
renderHeader()
|
|
298
|
+
return
|
|
299
|
+
}
|
|
300
|
+
const query = filter.getValue()
|
|
301
|
+
if (kb.matches(data, "tui.select.cancel")) {
|
|
302
|
+
if (!query) {
|
|
303
|
+
done()
|
|
304
|
+
return
|
|
305
|
+
}
|
|
306
|
+
filter.setValue("")
|
|
307
|
+
filterFocused = true
|
|
308
|
+
applyFilter()
|
|
309
|
+
return
|
|
310
|
+
}
|
|
311
|
+
// Delete, and Backspace: it is the key labelled "delete" on a Mac.
|
|
312
|
+
const deletes =
|
|
313
|
+
kb.matches(data, "tui.editor.deleteCharForward") ||
|
|
314
|
+
kb.matches(data, "tui.editor.deleteCharBackward")
|
|
315
|
+
if (deletes && !filterFocused) {
|
|
316
|
+
if (shown[selected]) {
|
|
317
|
+
deps.reset(shown[selected].id)
|
|
318
|
+
refreshRows()
|
|
319
|
+
}
|
|
320
|
+
return
|
|
321
|
+
}
|
|
322
|
+
// One cycle through the filter and the rows: Down (or Enter) from the
|
|
323
|
+
// filter enters the first row, Up from the first row returns to the
|
|
324
|
+
// filter, and both ends wrap through it. Enter in the filter changes
|
|
325
|
+
// nothing: a change always needs the cursor on its row.
|
|
326
|
+
const up = kb.matches(data, "tui.select.up")
|
|
327
|
+
const confirm = kb.matches(data, "tui.select.confirm")
|
|
328
|
+
if (
|
|
329
|
+
up ||
|
|
330
|
+
kb.matches(data, "tui.select.down") ||
|
|
331
|
+
(confirm && filterFocused)
|
|
332
|
+
) {
|
|
333
|
+
if (shown.length === 0) return
|
|
334
|
+
if (filterFocused) {
|
|
335
|
+
filterFocused = false
|
|
336
|
+
selected = up ? shown.length - 1 : 0
|
|
337
|
+
} else if (selected === (up ? 0 : shown.length - 1)) {
|
|
338
|
+
filterFocused = true
|
|
339
|
+
selected = 0
|
|
340
|
+
} else {
|
|
341
|
+
selected += up ? -1 : 1
|
|
342
|
+
}
|
|
343
|
+
list.selectItem(shown[selected].id)
|
|
344
|
+
return
|
|
345
|
+
}
|
|
346
|
+
// Space in the filter types a space.
|
|
347
|
+
if (!filterFocused && (confirm || data === " ")) {
|
|
348
|
+
const item = shown[selected]
|
|
349
|
+
if (!item) return
|
|
350
|
+
if (confirm && isNumericSettingKey(item.id)) openEditor(item, item.id)
|
|
351
|
+
else list.handleInput(data)
|
|
352
|
+
return
|
|
353
|
+
}
|
|
354
|
+
filter.handleInput(data)
|
|
355
|
+
if (filter.getValue() !== query) {
|
|
356
|
+
filterFocused = true
|
|
357
|
+
applyFilter()
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
}
|
|
361
|
+
}
|
|
@@ -48,7 +48,7 @@ export interface ViewerKeys {
|
|
|
48
48
|
* the key (pi #4748). Formatting the injected manager's own resolved keys here
|
|
49
49
|
* sidesteps both.
|
|
50
50
|
*/
|
|
51
|
-
function formatKeyLabel(key: KeyId): string {
|
|
51
|
+
export function formatKeyLabel(key: KeyId): string {
|
|
52
52
|
return key
|
|
53
53
|
.split("+")
|
|
54
54
|
.map((part) => {
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.8.3 - 2026-11-13
|
|
4
|
+
|
|
5
|
+
- Tag the Responses `system`/`developer` and `user` items with the item-level `type: "message"` the Provider API adapter requires for `zai-org/GLM-5.3`, which answered `400 invalid_request: input item is missing type` on the first turn. The rewrite is limited to the models known to need the verbose form, so every other model keeps the exact body the host sends. ([#214](https://github.com/patlux/pi-commandcode-provider/issues/214), [#215](https://github.com/patlux/pi-commandcode-provider/pull/215))
|
|
6
|
+
- Drop the inert `reasoning` block pi sends when thinking is off for `zai-org/GLM-5.3` and `mistral/mistral-large-4`, which reject `effort: "none"` with `unsupported output_config.effort` and `reasoning_effort none is not supported for this model`. Omitting the field succeeds; declaring `off: null` would clamp to the lowest allowed level and silently force reasoning on. The repair table is per-model and evidence-driven, so no other model's request body changes. ([#214](https://github.com/patlux/pi-commandcode-provider/issues/214), [#215](https://github.com/patlux/pi-commandcode-provider/pull/215))
|
|
7
|
+
- Add the live Provider API addition `thinkingmachines/inkling-2-small:free` to the reviewed pricing snapshot at zero cost, free while the free tier lasts with no fixed expiry published, and refresh the 98-model API and pricing snapshots to 2026-11-13. The model is already usable through the live `/provider/v1/models` response with a zero estimate and an unknown-price warning; static capability metadata stays at `command-code@1.88.5`, so it remains text-only without reasoning or effort flags until upstream ships it. ([#213](https://github.com/patlux/pi-commandcode-provider/pull/213))
|
|
8
|
+
|
|
9
|
+
### Contributors
|
|
10
|
+
|
|
11
|
+
- @ThomasByr — reported the `zai-org/GLM-5.3` failures on the Responses endpoint with a minimal reproduction ([#214](https://github.com/patlux/pi-commandcode-provider/issues/214)).
|
|
12
|
+
- @sandexzx — refreshed the reviewed pricing snapshot for `thinkingmachines/inkling-2-small:free` ([#213](https://github.com/patlux/pi-commandcode-provider/pull/213)).
|
|
13
|
+
- @pierreraby — isolated and proved both wire causes against the live Provider API, swept all 74 `/responses` models to bound the blast radius, implemented the per-model repair table with tests, and prepared this release.
|
|
4
14
|
|
|
5
15
|
## 0.8.2 - 2026-11-11
|
|
6
16
|
|
|
@@ -47,6 +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
51
|
import { createCommandCodeRuntime } from "./src/runtime.ts"
|
|
51
52
|
import {
|
|
52
53
|
compatForEndpoint,
|
|
@@ -360,7 +361,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
360
361
|
fetch: async (...args: Parameters<typeof fetch>) => {
|
|
361
362
|
streamWarning = undefined
|
|
362
363
|
return normalizeCommandCodeResponsesResponse(
|
|
363
|
-
await (resolvedOptions?.fetch ?? fetch)(...args),
|
|
364
|
+
await (resolvedOptions?.fetch ?? fetch)(...withResponsesWireRepairs(args)),
|
|
364
365
|
(warning) => {
|
|
365
366
|
streamWarning = warning
|
|
366
367
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-commandcode-provider",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
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 && 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 && 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",
|
|
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",
|
|
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",
|
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
"test:e2e:live:goat": "node scripts/live-e2e-profile.mjs goat",
|
|
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
|
-
"test:cost": "tsx tests/test-cost.ts"
|
|
67
|
+
"test:cost": "tsx tests/test-cost.ts",
|
|
68
|
+
"test:responses-compat": "tsx tests/test-responses-compat.ts"
|
|
68
69
|
},
|
|
69
70
|
"pi": {
|
|
70
71
|
"extensions": [
|
|
@@ -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-
|
|
23
|
+
export const PRICING_LAST_VERIFIED = "2026-11-13"
|
|
24
24
|
|
|
25
25
|
export const ZERO_MODEL_COST: CommandCodeModelCost = {
|
|
26
26
|
input: 0,
|
|
@@ -41,6 +41,13 @@ export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
|
|
|
41
41
|
// Free models
|
|
42
42
|
// Free while the stealth preview lasts; no fixed expiry is published.
|
|
43
43
|
"stealth/glyph-cluster:free": { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
44
|
+
// Free while the free tier lasts; no fixed expiry is published.
|
|
45
|
+
"thinkingmachines/inkling-2-small:free": {
|
|
46
|
+
input: 0,
|
|
47
|
+
output: 0,
|
|
48
|
+
cacheRead: 0,
|
|
49
|
+
cacheWrite: 0,
|
|
50
|
+
},
|
|
44
51
|
|
|
45
52
|
// Open and open-weight models
|
|
46
53
|
"inclusionai/ling-3.1-flash-1019": { input: 0.3, output: 0.9, cacheRead: 0.06, cacheWrite: 0 },
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repairs two Provider API wire quirks the host encoder cannot express.
|
|
3
|
+
*
|
|
4
|
+
* ## 1. Untagged message items
|
|
5
|
+
*
|
|
6
|
+
* pi-ai tags only non-message items (`type: "message"` for assistant text,
|
|
7
|
+
* `function_call`, `function_call_output`, `reasoning`, ...). The leading
|
|
8
|
+
* `system`/`developer` item and every `user` item go out as a bare
|
|
9
|
+
* `{ role, content }` pair. OpenAI accepts that shorthand, but the adapter in
|
|
10
|
+
* front of some models rejects the whole request with
|
|
11
|
+
* `400 invalid_request: input item is missing type` (issue #214,
|
|
12
|
+
* `zai-org/GLM-5.3`). A sweep of all 74 `/responses` models with a minimal text
|
|
13
|
+
* request showed GLM-5.3 is the only one refusing the shorthand, so the rewrite
|
|
14
|
+
* is allowlisted rather than applied to every backend.
|
|
15
|
+
*
|
|
16
|
+
* ## 2. `reasoning.effort: "none"`
|
|
17
|
+
*
|
|
18
|
+
* When thinking is off, pi-ai emits `reasoning: { effort: "none" }` (it reads
|
|
19
|
+
* the level from `thinkingLevelMap`, which has no `off` entry). Some models
|
|
20
|
+
* reject that value — `zai-org/GLM-5.3` with
|
|
21
|
+
* `unsupported output_config.effort: none`, `mistral/mistral-large-4` with
|
|
22
|
+
* `reasoning_effort none is not supported for this model` — while omitting the
|
|
23
|
+
* `reasoning` field entirely succeeds. Declaring `off: null` in
|
|
24
|
+
* `thinkingLevelMap` is not a fix: pi then clamps to the lowest allowed level and
|
|
25
|
+
* sends `effort: "low"`, silently forcing reasoning on. So the field is dropped
|
|
26
|
+
* here instead.
|
|
27
|
+
*
|
|
28
|
+
* Both transforms are no-ops for every other model, for invalid JSON, and for
|
|
29
|
+
* bodies whose shape is not the expected object, because a malformed rewrite
|
|
30
|
+
* would turn a model-specific 400 into a failure for every backend.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/** Model ID -> repairs to apply. Keep it evidence-driven and short. */
|
|
34
|
+
export interface ResponsesWireRepair {
|
|
35
|
+
/** Needs an explicit `type: "message"` on role-carrying input items. */
|
|
36
|
+
messageItemType?: boolean
|
|
37
|
+
/** Rejects `reasoning.effort: "none"`; the field is dropped in that case. */
|
|
38
|
+
dropNoneEffort?: boolean
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Per-model repairs. An entry is only added once a live request shows the
|
|
43
|
+
* failure, because none of this is verifiable from the test suite alone.
|
|
44
|
+
*/
|
|
45
|
+
export const RESPONSES_WIRE_REPAIRS: Readonly<Record<string, ResponsesWireRepair>> = {
|
|
46
|
+
"zai-org/GLM-5.3": { messageItemType: true, dropNoneEffort: true },
|
|
47
|
+
"mistral/mistral-large-4": { dropNoneEffort: true },
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Roles that carry an item-level `message` type in the Responses schema. */
|
|
51
|
+
const MESSAGE_ROLES: ReadonlySet<string> = new Set(["system", "developer", "user", "assistant"])
|
|
52
|
+
|
|
53
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
54
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Tags every role-carrying input item that has no `type` yet. */
|
|
58
|
+
function tagMessageItems(body: Record<string, unknown>): boolean {
|
|
59
|
+
if (!Array.isArray(body.input)) return false
|
|
60
|
+
let changed = false
|
|
61
|
+
body.input = body.input.map((item) => {
|
|
62
|
+
if (!isRecord(item) || "type" in item) return item
|
|
63
|
+
if (typeof item.role !== "string" || !MESSAGE_ROLES.has(item.role)) return item
|
|
64
|
+
if (item.content === undefined) return item
|
|
65
|
+
changed = true
|
|
66
|
+
return { type: "message", ...item }
|
|
67
|
+
})
|
|
68
|
+
return changed
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Returns a copy without `reasoning` when the block only says `effort: "none"`. */
|
|
72
|
+
function withoutInertReasoning(body: Record<string, unknown>): Record<string, unknown> | undefined {
|
|
73
|
+
const reasoning = body.reasoning
|
|
74
|
+
if (!isRecord(reasoning)) return undefined
|
|
75
|
+
if (Object.keys(reasoning).length !== 1 || reasoning.effort !== "none") return undefined
|
|
76
|
+
const { reasoning: _dropped, ...rest } = body
|
|
77
|
+
return rest
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Applies the repairs for `model`.
|
|
82
|
+
*
|
|
83
|
+
* Returns the original string when nothing changed, so callers can hand the
|
|
84
|
+
* exact bytes through instead of a re-serialized copy.
|
|
85
|
+
*/
|
|
86
|
+
export function rewriteResponsesBody(
|
|
87
|
+
body: string,
|
|
88
|
+
repairs: Readonly<Record<string, ResponsesWireRepair>> = RESPONSES_WIRE_REPAIRS,
|
|
89
|
+
): string {
|
|
90
|
+
let parsed: unknown
|
|
91
|
+
try {
|
|
92
|
+
parsed = JSON.parse(body)
|
|
93
|
+
} catch {
|
|
94
|
+
return body
|
|
95
|
+
}
|
|
96
|
+
if (!isRecord(parsed)) return body
|
|
97
|
+
const model = parsed.model
|
|
98
|
+
if (typeof model !== "string" || !Object.hasOwn(repairs, model)) return body
|
|
99
|
+
const repair = repairs[model]
|
|
100
|
+
if (repair.messageItemType !== true && repair.dropNoneEffort !== true) return body
|
|
101
|
+
// Work on copies so a no-op repair never mutates the parsed object.
|
|
102
|
+
let next: Record<string, unknown> = parsed
|
|
103
|
+
let changed = false
|
|
104
|
+
if (repair.messageItemType === true) {
|
|
105
|
+
const tagged = { ...next }
|
|
106
|
+
if (tagMessageItems(tagged)) {
|
|
107
|
+
next = tagged
|
|
108
|
+
changed = true
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (repair.dropNoneEffort === true) {
|
|
112
|
+
const pruned = withoutInertReasoning(next)
|
|
113
|
+
if (pruned !== undefined) {
|
|
114
|
+
next = pruned
|
|
115
|
+
changed = true
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return changed ? JSON.stringify(next) : body
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Applies {@link rewriteResponsesBody} to the arguments the host passes to
|
|
123
|
+
* `fetch`. Decoded bodies and `Request` objects pass through untouched, and the
|
|
124
|
+
* stale `content-length` is dropped so the transport recomputes it.
|
|
125
|
+
*/
|
|
126
|
+
export function withResponsesWireRepairs(
|
|
127
|
+
args: Parameters<typeof fetch>,
|
|
128
|
+
repairs: Readonly<Record<string, ResponsesWireRepair>> = RESPONSES_WIRE_REPAIRS,
|
|
129
|
+
): Parameters<typeof fetch> {
|
|
130
|
+
const [input, init] = args
|
|
131
|
+
if (typeof init?.body !== "string") return args
|
|
132
|
+
const body = rewriteResponsesBody(init.body, repairs)
|
|
133
|
+
if (body === init.body) return args
|
|
134
|
+
const headers = new Headers(init.headers)
|
|
135
|
+
headers.delete("content-length")
|
|
136
|
+
return [input, { ...init, body, headers }]
|
|
137
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herbertgao/pi-extensions",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.11",
|
|
4
4
|
"description": "Aggregate installer for HerbertGao-maintained Pi extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"extensions",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"@dietrichgebert/ponytail": "5.3.3",
|
|
42
42
|
"@herbertgao/pi-agency": "0.1.3",
|
|
43
43
|
"@herbertgao/pi-bark": "0.2.2",
|
|
44
|
-
"@herbertgao/pi-cc-extensions": "1.0.
|
|
45
|
-
"@herbertgao/pi-impeccable": "0.
|
|
46
|
-
"@herbertgao/pi-subagents": "0.
|
|
44
|
+
"@herbertgao/pi-cc-extensions": "1.0.18-local.1",
|
|
45
|
+
"@herbertgao/pi-impeccable": "0.4.0",
|
|
46
|
+
"@herbertgao/pi-subagents": "0.25.0-local.1",
|
|
47
47
|
"@herbertgao/sol-pi": "0.4.3",
|
|
48
48
|
"@juicesharp/rpiv-ask-user-question": "2.15.0",
|
|
49
49
|
"@juicesharp/rpiv-config": "^2.15.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"nanoid": "^5.0.0",
|
|
74
74
|
"p-limit": "^6.1.0",
|
|
75
75
|
"pi-antigravity": "0.12.0",
|
|
76
|
-
"pi-commandcode-provider": "0.8.
|
|
76
|
+
"pi-commandcode-provider": "0.8.3",
|
|
77
77
|
"pi-lens": "4.4.12",
|
|
78
78
|
"pi-next-cue": "1.0.8",
|
|
79
79
|
"pi-provider-qoder": "0.6.12",
|