pi-ui-extend 1.0.23 → 1.0.24
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/dist/app/constants.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ResolvedToolRule } from "../config.js";
|
|
2
2
|
export declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
3
3
|
export declare const THINKING_MENU_MAX_ROWS: number;
|
|
4
|
-
export declare const PI_FAVORITE_MODEL_REFS: readonly ["amazon-bedrock/us.anthropic.claude-opus-4-6-v1", "anthropic/claude-opus-4-8", "openai/gpt-5.4", "azure-openai-responses/gpt-5.4", "openai-codex/gpt-5.6-sol", "deepseek/deepseek-v4-pro", "google/gemini-3.1-pro-preview", "google-vertex/gemini-3.1-pro-preview", "github-copilot/gpt-5.4", "openrouter/moonshotai/kimi-k2.6", "vercel-ai-gateway/zai/glm-5.2", "xai/grok-4.5", "groq/openai/gpt-oss-120b", "cerebras/
|
|
4
|
+
export declare const PI_FAVORITE_MODEL_REFS: readonly ["amazon-bedrock/us.anthropic.claude-opus-4-6-v1", "anthropic/claude-opus-4-8", "openai/gpt-5.4", "azure-openai-responses/gpt-5.4", "openai-codex/gpt-5.6-sol", "deepseek/deepseek-v4-pro", "google/gemini-3.1-pro-preview", "google-vertex/gemini-3.1-pro-preview", "github-copilot/gpt-5.4", "openrouter/moonshotai/kimi-k2.6", "vercel-ai-gateway/zai/glm-5.2", "xai/grok-4.5", "groq/openai/gpt-oss-120b", "cerebras/gpt-oss-120b", "zai/glm-5.3", "mistral/devstral-medium-latest", "minimax/MiniMax-M2.7", "minimax-cn/MiniMax-M2.7", "moonshotai/kimi-k2.6", "moonshotai-cn/kimi-k2.6", "huggingface/moonshotai/Kimi-K2.6", "fireworks/accounts/fireworks/models/kimi-k2p6", "together/moonshotai/Kimi-K2.6", "opencode/kimi-k2.6", "opencode-go/kimi-k2.6", "kimi-coding/kimi-for-coding", "cloudflare-workers-ai/@cf/moonshotai/kimi-k2.6", "cloudflare-ai-gateway/workers-ai/@cf/moonshotai/kimi-k2.6", "xiaomi/mimo-v2.5-pro", "xiaomi-token-plan-cn/mimo-v2.5-pro", "xiaomi-token-plan-ams/mimo-v2.5-pro", "xiaomi-token-plan-sgp/mimo-v2.5-pro"];
|
|
5
5
|
export declare const SLASH_COMMAND_MENU_MAX_ROWS = 6;
|
|
6
6
|
export declare const RESUME_MENU_MAX_ROWS = 20;
|
|
7
7
|
export declare const RESUME_MENU_INITIAL_SESSION_ROWS = 30;
|
package/dist/app/constants.js
CHANGED
|
@@ -15,7 +15,7 @@ export const PI_FAVORITE_MODEL_REFS = [
|
|
|
15
15
|
"vercel-ai-gateway/zai/glm-5.2",
|
|
16
16
|
"xai/grok-4.5",
|
|
17
17
|
"groq/openai/gpt-oss-120b",
|
|
18
|
-
"cerebras/
|
|
18
|
+
"cerebras/gpt-oss-120b",
|
|
19
19
|
"zai/glm-5.3",
|
|
20
20
|
"mistral/devstral-medium-latest",
|
|
21
21
|
"minimax/MiniMax-M2.7",
|
package/dist/app/runtime.d.ts
CHANGED
|
@@ -46,13 +46,6 @@ type RuntimeSessionManagerModelState = Pick<SessionManager, "getEntries" | "getB
|
|
|
46
46
|
export declare function resolvePixRuntimeModelRef(options: Pick<AppOptions, "modelRef">, sessionManager: RuntimeSessionManagerModelState, config?: PixConfig): string | undefined;
|
|
47
47
|
export declare function resolvePixRuntimeInitialThinkingLevel(options: Pick<AppOptions, "modelRef">, sessionManager: RuntimeSessionManagerModelState, config: PixConfig): ThinkingLevel | undefined;
|
|
48
48
|
export declare function resolveSessionModelRefFromTail(entries: readonly SessionEntry[]): string | undefined;
|
|
49
|
-
|
|
50
|
-
* pi-ai 0.84.2 predates GLM-5.3's final thinking contract. The released model
|
|
51
|
-
* is always-thinking and accepts exactly low/high/max via reasoning_effort.
|
|
52
|
-
* Patch the mutable catalog model before AgentSession clamps the selected level.
|
|
53
|
-
*/
|
|
54
|
-
export declare function patchGlm53ThinkingMetadata(model: unknown): boolean;
|
|
55
|
-
export declare function patchPixModelRuntimeCompatibility(modelRuntime: Pick<AgentSessionServices["modelRuntime"], "getModels">): number;
|
|
56
|
-
export declare function refreshPixModelRuntimeForStartup(modelRuntime: Pick<AgentSessionServices["modelRuntime"], "refresh" | "getModels">): Promise<void>;
|
|
49
|
+
export declare function refreshPixModelRuntimeForStartup(modelRuntime: Pick<AgentSessionServices["modelRuntime"], "refresh">): Promise<void>;
|
|
57
50
|
export declare function createPixRuntime(options: AppOptions, runtimeOptions?: CreatePixRuntimeOptions): Promise<AgentSessionRuntime>;
|
|
58
51
|
export {};
|
package/dist/app/runtime.js
CHANGED
|
@@ -235,49 +235,10 @@ export function resolveSessionModelRefFromTail(entries) {
|
|
|
235
235
|
return undefined;
|
|
236
236
|
return thinkingLevel ? `${modelRef}:${thinkingLevel}` : modelRef;
|
|
237
237
|
}
|
|
238
|
-
const GLM_53_THINKING_LEVEL_MAP = {
|
|
239
|
-
off: null,
|
|
240
|
-
minimal: null,
|
|
241
|
-
low: "low",
|
|
242
|
-
medium: null,
|
|
243
|
-
high: "high",
|
|
244
|
-
xhigh: null,
|
|
245
|
-
max: "max",
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
* pi-ai 0.84.2 predates GLM-5.3's final thinking contract. The released model
|
|
249
|
-
* is always-thinking and accepts exactly low/high/max via reasoning_effort.
|
|
250
|
-
* Patch the mutable catalog model before AgentSession clamps the selected level.
|
|
251
|
-
*/
|
|
252
|
-
export function patchGlm53ThinkingMetadata(model) {
|
|
253
|
-
if (!model || typeof model !== "object" || Array.isArray(model))
|
|
254
|
-
return false;
|
|
255
|
-
const candidate = model;
|
|
256
|
-
if (candidate.id !== "glm-5.3")
|
|
257
|
-
return false;
|
|
258
|
-
if (!candidate.compat || typeof candidate.compat !== "object" || Array.isArray(candidate.compat))
|
|
259
|
-
return false;
|
|
260
|
-
const compat = candidate.compat;
|
|
261
|
-
if (compat.thinkingFormat !== "zai")
|
|
262
|
-
return false;
|
|
263
|
-
candidate.reasoning = true;
|
|
264
|
-
candidate.thinkingLevelMap = { ...GLM_53_THINKING_LEVEL_MAP };
|
|
265
|
-
candidate.compat = { ...compat, supportsReasoningEffort: true };
|
|
266
|
-
return true;
|
|
267
|
-
}
|
|
268
|
-
export function patchPixModelRuntimeCompatibility(modelRuntime) {
|
|
269
|
-
let patched = 0;
|
|
270
|
-
for (const model of modelRuntime.getModels()) {
|
|
271
|
-
if (patchGlm53ThinkingMetadata(model))
|
|
272
|
-
patched += 1;
|
|
273
|
-
}
|
|
274
|
-
return patched;
|
|
275
|
-
}
|
|
276
238
|
export async function refreshPixModelRuntimeForStartup(modelRuntime) {
|
|
277
239
|
// Startup only needs the locally configured model catalog. Remote catalog
|
|
278
240
|
// refreshes belong to explicit model-management flows and must not block boot.
|
|
279
241
|
await modelRuntime.refresh({ allowNetwork: false });
|
|
280
|
-
patchPixModelRuntimeCompatibility(modelRuntime);
|
|
281
242
|
}
|
|
282
243
|
export async function createPixRuntime(options, runtimeOptions = {}) {
|
|
283
244
|
const agentDir = getAgentDir();
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"vscode-languageserver-protocol": "^3.17.5"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@earendil-works/pi-ai": "0.84.
|
|
48
|
-
"@earendil-works/pi-coding-agent": "0.84.
|
|
49
|
-
"@earendil-works/pi-tui": "0.84.
|
|
47
|
+
"@earendil-works/pi-ai": "0.84.3",
|
|
48
|
+
"@earendil-works/pi-coding-agent": "0.84.3",
|
|
49
|
+
"@earendil-works/pi-tui": "0.84.3",
|
|
50
50
|
"typebox": "*"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
@@ -49,16 +49,6 @@ const SILENCE_REMINDER_MIN_MESSAGE_GAP = 20;
|
|
|
49
49
|
// truncation), the chatter baseline is reset so it isn't measured against a stale peak.
|
|
50
50
|
const SILENCE_REMINDER_COMPACTION_MARGIN = 8;
|
|
51
51
|
const LOOKUP_TOOL_NAME = "lookup";
|
|
52
|
-
const GLM_53_THINKING_LEVEL_MAP = {
|
|
53
|
-
off: null,
|
|
54
|
-
minimal: null,
|
|
55
|
-
low: "low",
|
|
56
|
-
medium: null,
|
|
57
|
-
high: "high",
|
|
58
|
-
xhigh: null,
|
|
59
|
-
max: "max",
|
|
60
|
-
} as const;
|
|
61
|
-
const GLM_53_THINKING_LEVELS = ["low", "high", "max"] as const;
|
|
62
52
|
|
|
63
53
|
const LOOKUP_TOOL_PARAMS = Type.Object(
|
|
64
54
|
{
|
|
@@ -213,17 +203,13 @@ export default function codingDiscipline(pi: ExtensionAPI) {
|
|
|
213
203
|
maybeRegisterLookupTool(process.cwd());
|
|
214
204
|
|
|
215
205
|
pi.on("session_start", async (_event: unknown, ctx: unknown) => {
|
|
216
|
-
patchGlm53ThinkingModels(ctx);
|
|
217
206
|
selectedModelRef = modelRefFromContext(ctx);
|
|
218
|
-
normalizeCurrentGlm53ThinkingLevel(pi, selectedModelRef);
|
|
219
207
|
maybeRegisterLookupTool(contextCwd(ctx));
|
|
220
208
|
syncLookupToolAvailability(selectedModelRef, contextCwd(ctx));
|
|
221
209
|
});
|
|
222
210
|
|
|
223
211
|
pi.on("model_select", async (event: { model?: unknown }, ctx: unknown) => {
|
|
224
|
-
patchGlm53ThinkingModels(ctx, event.model);
|
|
225
212
|
selectedModelRef = modelRefFromModel(event.model) ?? modelRefFromContext(ctx);
|
|
226
|
-
normalizeCurrentGlm53ThinkingLevel(pi, selectedModelRef);
|
|
227
213
|
maybeRegisterLookupTool(contextCwd(ctx));
|
|
228
214
|
syncLookupToolAvailability(selectedModelRef, contextCwd(ctx));
|
|
229
215
|
});
|
|
@@ -236,11 +222,10 @@ export default function codingDiscipline(pi: ExtensionAPI) {
|
|
|
236
222
|
lookupEnabled: Boolean(lookupModelFromConfig(cwd)),
|
|
237
223
|
strictness: codingDisciplineStrictnessFromConfig(cwd),
|
|
238
224
|
});
|
|
239
|
-
const corrected = applyGlm53ThinkingToPayload(injected, modelRef, ctx, pi);
|
|
240
225
|
if (process.env.PI_DEBUG_PROMPT === "1") {
|
|
241
|
-
logFinalPrompt(
|
|
226
|
+
logFinalPrompt(injected, modelRef, contextCwd(ctx) ?? process.cwd());
|
|
242
227
|
}
|
|
243
|
-
return
|
|
228
|
+
return injected;
|
|
244
229
|
});
|
|
245
230
|
|
|
246
231
|
pi.on("before_agent_start", async (event: { systemPromptOptions?: unknown; systemPrompt?: string }, ctx: unknown) => {
|
|
@@ -365,83 +350,6 @@ export function isGlmModel(modelRef: string | undefined): boolean {
|
|
|
365
350
|
return /(?:^|[/:_.-])glm(?:$|[/:_.-]|\d)/i.test(modelRef);
|
|
366
351
|
}
|
|
367
352
|
|
|
368
|
-
function isGlm53ModelRef(modelRef: string | undefined): boolean {
|
|
369
|
-
if (!modelRef) return false;
|
|
370
|
-
return /(?:^|\/)glm-5\.3(?:$|:)/i.test(modelRef) || /^glm-5\.3(?:$|:)/i.test(modelRef);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
function patchGlm53ThinkingModel(model: unknown): boolean {
|
|
374
|
-
if (!isRecord(model)) return false;
|
|
375
|
-
const id = typeof model.id === "string"
|
|
376
|
-
? model.id
|
|
377
|
-
: typeof model.modelId === "string"
|
|
378
|
-
? model.modelId
|
|
379
|
-
: undefined;
|
|
380
|
-
if (id !== "glm-5.3") return false;
|
|
381
|
-
const provider = typeof model.provider === "string" ? model.provider : undefined;
|
|
382
|
-
const compat = isRecord(model.compat) ? model.compat : {};
|
|
383
|
-
if (provider !== "zai" && provider !== "zai-coding-cn" && compat.thinkingFormat !== "zai") return false;
|
|
384
|
-
|
|
385
|
-
model.reasoning = true;
|
|
386
|
-
model.thinkingLevelMap = { ...GLM_53_THINKING_LEVEL_MAP };
|
|
387
|
-
model.compat = { ...compat, supportsReasoningEffort: true };
|
|
388
|
-
return true;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
function patchGlm53ThinkingModels(ctx: unknown, selectedModel?: unknown): void {
|
|
392
|
-
patchGlm53ThinkingModel(selectedModel);
|
|
393
|
-
if (!isRecord(ctx)) return;
|
|
394
|
-
patchGlm53ThinkingModel(ctx.model);
|
|
395
|
-
|
|
396
|
-
if (Array.isArray(ctx.scopedModels)) {
|
|
397
|
-
for (const entry of ctx.scopedModels) {
|
|
398
|
-
if (isRecord(entry)) patchGlm53ThinkingModel(entry.model);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
const registry = ctx.modelRegistry;
|
|
403
|
-
if (!isRecord(registry) || typeof registry.getAll !== "function") return;
|
|
404
|
-
try {
|
|
405
|
-
const models = registry.getAll();
|
|
406
|
-
if (Array.isArray(models)) {
|
|
407
|
-
for (const model of models) patchGlm53ThinkingModel(model);
|
|
408
|
-
}
|
|
409
|
-
} catch {
|
|
410
|
-
// Compatibility patching must never break session startup.
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
function normalizeGlm53ThinkingLevel(level: unknown): (typeof GLM_53_THINKING_LEVELS)[number] {
|
|
415
|
-
if (level === "low" || level === "high" || level === "max") return level;
|
|
416
|
-
if (level === "off" || level === "minimal") return "low";
|
|
417
|
-
if (level === "medium") return "high";
|
|
418
|
-
return "max";
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
function normalizeCurrentGlm53ThinkingLevel(pi: ExtensionAPI, modelRef: string | undefined): void {
|
|
422
|
-
if (!isGlm53ModelRef(modelRef)) return;
|
|
423
|
-
const getter = (pi as { getThinkingLevel?: () => unknown }).getThinkingLevel;
|
|
424
|
-
const setter = (pi as { setThinkingLevel?: (level: string) => void }).setThinkingLevel;
|
|
425
|
-
if (!getter || !setter) return;
|
|
426
|
-
const current = getter.call(pi);
|
|
427
|
-
const normalized = normalizeGlm53ThinkingLevel(current);
|
|
428
|
-
if (current !== normalized) setter.call(pi, normalized);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
function applyGlm53ThinkingToPayload(payload: unknown, modelRef: string | undefined, ctx: unknown, pi: ExtensionAPI): unknown {
|
|
432
|
-
if (!isGlm53ModelRef(modelRef) || !isRecord(payload)) return payload;
|
|
433
|
-
const getter = (pi as { getThinkingLevel?: () => unknown }).getThinkingLevel;
|
|
434
|
-
const runtimeLevel = getter ? getter.call(pi) : undefined;
|
|
435
|
-
const contextLevel = isRecord(ctx) ? ctx.thinkingLevel : undefined;
|
|
436
|
-
const effort = normalizeGlm53ThinkingLevel(runtimeLevel ?? contextLevel);
|
|
437
|
-
const existingThinking = isRecord(payload.thinking) ? payload.thinking : {};
|
|
438
|
-
return {
|
|
439
|
-
...payload,
|
|
440
|
-
thinking: { ...existingThinking, type: "enabled", clear_thinking: false },
|
|
441
|
-
reasoning_effort: effort,
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
|
|
445
353
|
export function injectCodingDisciplineIntoPayload(payload: unknown, options: DisciplinePromptOptions = {}): unknown {
|
|
446
354
|
if (!isRecord(payload)) return payload;
|
|
447
355
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-ui-extend",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "Pix: a workspace-first terminal UI for Pi with tabs, readable tool activity, voice input, and bundled agent tools.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
"prepublishOnly": "npm run check && npm run build:pix && npm run generate-schemas"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@earendil-works/pi-ai": "0.84.
|
|
80
|
-
"@earendil-works/pi-coding-agent": "0.84.
|
|
81
|
-
"@earendil-works/pi-tui": "0.84.
|
|
79
|
+
"@earendil-works/pi-ai": "0.84.3",
|
|
80
|
+
"@earendil-works/pi-coding-agent": "0.84.3",
|
|
81
|
+
"@earendil-works/pi-tui": "0.84.3",
|
|
82
82
|
"@mariozechner/clipboard": "^0.3.9",
|
|
83
83
|
"jsonc-parser": "3.3.1",
|
|
84
84
|
"typebox": "1.1.38",
|