[Sync] llm stuff
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# Upstream example files as last reviewed against pi 0.85.1.
|
||||
# Written by pi-upgrade-check -a. A file is only re-raised when UPSTREAM moves,
|
||||
# so our own local edits stop generating noise on every run.
|
||||
55502f82109df07e922ef3ec41af1b1a5ed33d4d6d56076654ab2bc88e2e0888 confirm-destructive.ts
|
||||
70e4333e09ce00d546c116fd2e918abf7616c70b5da6e88ba8ee21a326afd483 notify.ts
|
||||
e32086ba9dd9b4ba0fd308b65241d9affa0b5ecd3f90ef7ea1b9f2b30cab8cc1 permission-gate.ts
|
||||
9ca66b1f3b1b9a61cc5ddc660f92cca2ea66c4264a1bdb6b00e0da5844399fe2 protected-paths.ts
|
||||
3f1f719d81152ff013f5d36a97cc3976388d43f2d89bff0f19827d3443d903e6 questionnaire.ts
|
||||
a0b9fd94e2cc827931150cc409238b473da635ab1a1cddce633cae5937a3ae24 session-name.ts
|
||||
e46824d00217e25242c186d41837cc84ca81b23f978500323448502a9a424ee2 todo.ts
|
||||
90fae53e2fada97165f7488520bd54f3cbfe5d2c7e4cfd3bd2aa07ee796e61e8 plan-mode/index.ts
|
||||
12ea28d57cc55e68e8d52a2f1d16df8b2e7f2749cd694d41453028002a2bdad9 plan-mode/utils.ts
|
||||
@@ -49,7 +49,9 @@ function notify(title: string, body: string): void {
|
||||
}
|
||||
|
||||
export default function (pi: ExtensionAPI) {
|
||||
pi.on("agent_end", async () => {
|
||||
// `agent_end` fires after each low-level run; Pi may still retry, compact,
|
||||
// or continue with queued follow-ups. Notify only after the full run settles.
|
||||
pi.on("agent_settled", async () => {
|
||||
notify("Pi", "Ready for input");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* Verbose view toggle — `/verbose` and a bound key.
|
||||
*
|
||||
* The counterpart of the opencode TUI plugin and the Claude `/verbose` skill, adjusted for
|
||||
* what pi actually allows. pi splits verbosity in two:
|
||||
*
|
||||
* LIVE `ctrl+o` (app.tools.expand) collapses/expands tool output and `ctrl+t`
|
||||
* (app.thinking.toggle) does the same for thinking blocks. These are built-in
|
||||
* keybindings. An extension cannot drive them — there is no settings API and no
|
||||
* way to dispatch a built-in action — and a key maps to one action, so they
|
||||
* cannot be merged into a single press the way opencode's four toggles were.
|
||||
*
|
||||
* PERSISTED `hideThinkingBlock` and `showCacheMissNotices` in settings.json, read at
|
||||
* startup. That is what this toggles, i.e. the default you get on every new
|
||||
* session, which is exactly the position the Claude skill is in.
|
||||
*
|
||||
* So: this sets the default and tells you the live keys. "on" shows thinking and the
|
||||
* cache/compaction/recovery notices; "off" is deliberately quieter than stock pi (it hides
|
||||
* thinking), matching how opencode's verbose-off state hides thinking too.
|
||||
*
|
||||
* ⚠️ pi writes settings.json itself (that is where `lastChangelogVersion` churn comes from),
|
||||
* so a running pi may overwrite this on exit. If a toggle seems not to have stuck, re-run it
|
||||
* after pi has exited.
|
||||
*/
|
||||
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
||||
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
||||
|
||||
type Settings = Record<string, unknown>;
|
||||
|
||||
const LIVE = "live now: ctrl+o tool output, ctrl+t thinking";
|
||||
|
||||
// Verbose-on values. Verbose-off is the inverse, not pi's defaults: stock pi already shows
|
||||
// thinking (hideThinkingBlock defaults to false), so an "off" that merely restored defaults
|
||||
// would be indistinguishable from "on" for the noisiest part.
|
||||
const VERBOSE_ON: Settings = { hideThinkingBlock: false, showCacheMissNotices: true };
|
||||
const VERBOSE_OFF: Settings = { hideThinkingBlock: true, showCacheMissNotices: false };
|
||||
|
||||
function settingsPath(): string {
|
||||
return join(getAgentDir(), "settings.json");
|
||||
}
|
||||
|
||||
function read(): Settings {
|
||||
// A parse failure must never lead to a write — that would replace a hand-edited config
|
||||
// with whatever this extension thinks it knows.
|
||||
const raw = readFileSync(settingsPath(), "utf-8");
|
||||
return JSON.parse(raw) as Settings;
|
||||
}
|
||||
|
||||
function isOn(s: Settings): boolean {
|
||||
return s.hideThinkingBlock === false && s.showCacheMissNotices === true;
|
||||
}
|
||||
|
||||
function write(s: Settings): void {
|
||||
// Plain writeFileSync, deliberately NOT write-temp-then-rename: this path is a stow
|
||||
// symlink into the dots repo, and renaming over it would replace the link with a real
|
||||
// file, silently detaching the live config from the repo.
|
||||
writeFileSync(settingsPath(), `${JSON.stringify(s, null, 2)}\n`, "utf-8");
|
||||
}
|
||||
|
||||
function describe(s: Settings): string {
|
||||
return `hideThinkingBlock: ${s.hideThinkingBlock ?? false}, showCacheMissNotices: ${s.showCacheMissNotices ?? false}`;
|
||||
}
|
||||
|
||||
function toggle(ctx: ExtensionContext, mode: "on" | "off" | "toggle" | "status"): void {
|
||||
let current: Settings;
|
||||
try {
|
||||
current = read();
|
||||
} catch (err) {
|
||||
ctx.ui.notify(`verbose: cannot read settings.json — ${err}`, "error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode === "status") {
|
||||
ctx.ui.notify(`Verbose ${isOn(current) ? "ON" : "OFF"} — ${describe(current)}. ${LIVE}`, "info");
|
||||
return;
|
||||
}
|
||||
|
||||
const on = mode === "toggle" ? !isOn(current) : mode === "on";
|
||||
const next = { ...current, ...(on ? VERBOSE_ON : VERBOSE_OFF) };
|
||||
|
||||
try {
|
||||
write(next);
|
||||
} catch (err) {
|
||||
ctx.ui.notify(`verbose: cannot write settings.json — ${err}`, "error");
|
||||
return;
|
||||
}
|
||||
|
||||
ctx.ui.notify(
|
||||
`Verbose ${on ? "ON" : "OFF"} — applies to new sessions (settings are read at startup). ${LIVE}`,
|
||||
"info",
|
||||
);
|
||||
}
|
||||
|
||||
export default function (pi: ExtensionAPI) {
|
||||
pi.registerCommand("verbose", {
|
||||
description: "Toggle the persisted verbose view (usage: /verbose [on|off|status])",
|
||||
handler: async (args, ctx) => {
|
||||
const raw = args.trim().toLowerCase();
|
||||
if (raw && raw !== "on" && raw !== "off" && raw !== "status") {
|
||||
ctx.ui.notify("usage: /verbose [on|off|status]", "error");
|
||||
return;
|
||||
}
|
||||
toggle(ctx, (raw || "toggle") as "on" | "off" | "toggle" | "status");
|
||||
},
|
||||
});
|
||||
|
||||
pi.registerShortcut("alt+v", {
|
||||
description: "Toggle verbose view",
|
||||
handler: async (ctx) => toggle(ctx, "toggle"),
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"app.thinking.cycle": ["ctrl+shift+t"],
|
||||
"app.thinking.cycle": ["alt+t"],
|
||||
"tui.editor.cursorUp": ["up", "ctrl+p"],
|
||||
"app.model.cycleForward": ["alt+p"]
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"models": [
|
||||
{
|
||||
"id": "gemma-4-E4B-it-UD-Q8_K_XL",
|
||||
"name": "Gemma 4 E4B · 64k · vision — fast generalist, long docs",
|
||||
"name": "Gemma 4 E4B · 64k · vision — fast generalist, long docs (~57 t/s)",
|
||||
"reasoning": false,
|
||||
"input": ["text", "image"],
|
||||
"contextWindow": 65536,
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
{
|
||||
"id": "gemma-4-26B-A4B-it-UD-IQ4_XS",
|
||||
"name": "Gemma 4 26B · 24k · vision — quality generalist",
|
||||
"name": "Gemma 4 26B · 24k · vision — quality generalist (~34 t/s)",
|
||||
"reasoning": false,
|
||||
"input": ["text", "image"],
|
||||
"contextWindow": 24576,
|
||||
@@ -30,7 +30,7 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-Coder-30B-Instruct-UD-Q3_K_XL",
|
||||
"name": "Qwen3 Coder 30B · 32k — main agent coder",
|
||||
"name": "Qwen3 Coder 30B · 32k — main agent coder (~30 t/s)",
|
||||
"reasoning": false,
|
||||
"input": ["text"],
|
||||
"contextWindow": 32768,
|
||||
@@ -39,7 +39,7 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-Coder-Next-UD-IQ3_XXS",
|
||||
"name": "Qwen3 Coder Next 80B · 128k — long sessions",
|
||||
"name": "Qwen3 Coder Next 80B · 128k — long sessions (~16 t/s)",
|
||||
"reasoning": false,
|
||||
"input": ["text"],
|
||||
"contextWindow": 131072,
|
||||
@@ -48,7 +48,7 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.6-35B-A3B-MTP-UD-IQ3_XXS",
|
||||
"name": "Qwen3.6 35B · 24k · vision — daily driver",
|
||||
"name": "Qwen3.6 35B · 24k · vision — daily driver (~36 t/s)",
|
||||
"reasoning": false,
|
||||
"input": ["text", "image"],
|
||||
"contextWindow": 24576,
|
||||
@@ -57,7 +57,7 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.6-35B-A3B-Thinking",
|
||||
"name": "Qwen3.6 35B Thinking · 24k · vision — hard problems",
|
||||
"name": "Qwen3.6 35B Thinking · 24k · vision — hard problems (~39 t/s)",
|
||||
"reasoning": true,
|
||||
"compat": { "thinkingFormat": "qwen-chat-template" },
|
||||
"input": ["text", "image"],
|
||||
@@ -67,7 +67,7 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.5-9B-UD-Q6_K_XL",
|
||||
"name": "Qwen3.5 9B · 32k · vision — quick tasks",
|
||||
"name": "Qwen3.5 9B · 32k · vision — quick tasks (~32 t/s)",
|
||||
"reasoning": true,
|
||||
"compat": { "thinkingFormat": "qwen-chat-template" },
|
||||
"input": ["text", "image"],
|
||||
@@ -77,17 +77,17 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.8-27B-UD-IQ3_XXS",
|
||||
"name": "Qwen3.8 27B · 24k · vision — hybrid reasoner",
|
||||
"name": "Qwen3.8 27B · 24k · vision — hybrid reasoner, quiet desktop only (~15 t/s)",
|
||||
"reasoning": true,
|
||||
"compat": { "thinkingFormat": "qwen-chat-template" },
|
||||
"input": ["text", "image"],
|
||||
"contextWindow": 24576,
|
||||
"maxTokens": 8192,
|
||||
"maxTokens": 4096,
|
||||
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
|
||||
},
|
||||
{
|
||||
"id": "GLM-4.7-Flash-UD-Q4_K_XL",
|
||||
"name": "GLM-4.7 Flash · 24k — quality coder",
|
||||
"name": "GLM-4.7 Flash · 24k — quality coder (~21 t/s)",
|
||||
"reasoning": true,
|
||||
"compat": { "thinkingFormat": "qwen-chat-template" },
|
||||
"input": ["text"],
|
||||
@@ -97,7 +97,7 @@
|
||||
},
|
||||
{
|
||||
"id": "gpt-oss-20b",
|
||||
"name": "gpt-oss 20B · 64k — fast reasoning + tools",
|
||||
"name": "gpt-oss 20B · 64k — fast reasoning + tools (~38 t/s)",
|
||||
"reasoning": true,
|
||||
"input": ["text"],
|
||||
"contextWindow": 65536,
|
||||
@@ -106,7 +106,7 @@
|
||||
},
|
||||
{
|
||||
"id": "gpt-oss-20b-low",
|
||||
"name": "gpt-oss 20B low · 64k — snappy answers",
|
||||
"name": "gpt-oss 20B low · 64k — snappy answers (~37 t/s)",
|
||||
"reasoning": true,
|
||||
"input": ["text"],
|
||||
"contextWindow": 65536,
|
||||
@@ -127,7 +127,7 @@
|
||||
"models": [
|
||||
{
|
||||
"id": "gemma-4-E4B-it-UD-Q8_K_XL",
|
||||
"name": "Gemma 4 E4B · 64k · vision — fast generalist, long docs",
|
||||
"name": "Gemma 4 E4B · 64k · vision — fast generalist, long docs (~57 t/s)",
|
||||
"reasoning": false,
|
||||
"input": ["text", "image"],
|
||||
"contextWindow": 65536,
|
||||
@@ -136,7 +136,7 @@
|
||||
},
|
||||
{
|
||||
"id": "gemma-4-26B-A4B-it-UD-IQ4_XS",
|
||||
"name": "Gemma 4 26B · 24k · vision — quality generalist",
|
||||
"name": "Gemma 4 26B · 24k · vision — quality generalist (~34 t/s)",
|
||||
"reasoning": false,
|
||||
"input": ["text", "image"],
|
||||
"contextWindow": 24576,
|
||||
@@ -145,7 +145,7 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-Coder-30B-Instruct-UD-Q3_K_XL",
|
||||
"name": "Qwen3 Coder 30B · 32k — main agent coder",
|
||||
"name": "Qwen3 Coder 30B · 32k — main agent coder (~30 t/s)",
|
||||
"reasoning": false,
|
||||
"input": ["text"],
|
||||
"contextWindow": 32768,
|
||||
@@ -154,7 +154,7 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-Coder-Next-UD-IQ3_XXS",
|
||||
"name": "Qwen3 Coder Next 80B · 128k — long sessions",
|
||||
"name": "Qwen3 Coder Next 80B · 128k — long sessions (~16 t/s)",
|
||||
"reasoning": false,
|
||||
"input": ["text"],
|
||||
"contextWindow": 131072,
|
||||
@@ -163,7 +163,7 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.6-35B-A3B-MTP-UD-IQ3_XXS",
|
||||
"name": "Qwen3.6 35B · 24k · vision — daily driver",
|
||||
"name": "Qwen3.6 35B · 24k · vision — daily driver (~36 t/s)",
|
||||
"reasoning": false,
|
||||
"input": ["text", "image"],
|
||||
"contextWindow": 24576,
|
||||
@@ -172,7 +172,7 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.6-35B-A3B-Thinking",
|
||||
"name": "Qwen3.6 35B Thinking · 24k · vision — hard problems",
|
||||
"name": "Qwen3.6 35B Thinking · 24k · vision — hard problems (~39 t/s)",
|
||||
"reasoning": true,
|
||||
"compat": { "thinkingFormat": "qwen-chat-template" },
|
||||
"input": ["text", "image"],
|
||||
@@ -182,7 +182,7 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.5-9B-UD-Q6_K_XL",
|
||||
"name": "Qwen3.5 9B · 32k · vision — quick tasks",
|
||||
"name": "Qwen3.5 9B · 32k · vision — quick tasks (~32 t/s)",
|
||||
"reasoning": true,
|
||||
"compat": { "thinkingFormat": "qwen-chat-template" },
|
||||
"input": ["text", "image"],
|
||||
@@ -192,17 +192,17 @@
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.8-27B-UD-IQ3_XXS",
|
||||
"name": "Qwen3.8 27B · 24k · vision — hybrid reasoner",
|
||||
"name": "Qwen3.8 27B · 24k · vision — hybrid reasoner, quiet desktop only (~15 t/s)",
|
||||
"reasoning": true,
|
||||
"compat": { "thinkingFormat": "qwen-chat-template" },
|
||||
"input": ["text", "image"],
|
||||
"contextWindow": 24576,
|
||||
"maxTokens": 8192,
|
||||
"maxTokens": 4096,
|
||||
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
|
||||
},
|
||||
{
|
||||
"id": "GLM-4.7-Flash-UD-Q4_K_XL",
|
||||
"name": "GLM-4.7 Flash · 24k — quality coder",
|
||||
"name": "GLM-4.7 Flash · 24k — quality coder (~21 t/s)",
|
||||
"reasoning": true,
|
||||
"compat": { "thinkingFormat": "qwen-chat-template" },
|
||||
"input": ["text"],
|
||||
@@ -212,7 +212,7 @@
|
||||
},
|
||||
{
|
||||
"id": "gpt-oss-20b",
|
||||
"name": "gpt-oss 20B · 64k — fast reasoning + tools",
|
||||
"name": "gpt-oss 20B · 64k — fast reasoning + tools (~38 t/s)",
|
||||
"reasoning": true,
|
||||
"input": ["text"],
|
||||
"contextWindow": 65536,
|
||||
@@ -221,7 +221,7 @@
|
||||
},
|
||||
{
|
||||
"id": "gpt-oss-20b-low",
|
||||
"name": "gpt-oss 20B low · 64k — snappy answers",
|
||||
"name": "gpt-oss 20B low · 64k — snappy answers (~37 t/s)",
|
||||
"reasoning": true,
|
||||
"input": ["text"],
|
||||
"contextWindow": 65536,
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
"ex": "mode"
|
||||
}
|
||||
},
|
||||
"lastChangelogVersion": "0.83.0",
|
||||
"lastChangelogVersion": "0.85.1",
|
||||
"packages": [
|
||||
"npm:pi-vim"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user