repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

refactor: use Pi thinking-level types

0144fb4bb5f9bf7dec271f5673c637abcf1617d1

Oliver Krylow <o.krylow@isp-insoft.de> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (2)

extensions/btw/index.ts

Modified
2 2 // Ported from https://github.com/mitsuhiko/agent-stuff/blob/main/extensions/btw.ts
3 3 // Original license: Apache-2.0.
5 5 import type {
6 - ThinkingLevel as AiThinkingLevel,
7 6 AssistantMessage,
8 7 Message,
8 + ModelThinkingLevel,
9 9 } from "@earendil-works/pi-ai";
10 10 import {
11 11 type AgentSession,
46 46 const BTW_SUMMARY_PROMPT =
47 47 "Summarize this side conversation for handoff into the main conversation. Keep key decisions, findings, risks, and next actions. Output only the summary.";
49 -type SessionThinkingLevel = "off" | AiThinkingLevel;
51 49 type BtwDetails = {
52 50 question: string;
53 51 answer: string;
54 52 timestamp: number;
55 53 provider: string;
56 54 model: string;
57 - thinkingLevel: SessionThinkingLevel;
55 + thinkingLevel: ModelThinkingLevel;
58 56 usage?: AssistantMessage["usage"];
652 650 const { session } = await createAgentSession({
653 651 sessionManager: SessionManager.inMemory(),
654 652 model: ctx.model,
655 - thinkingLevel: pi.getThinkingLevel() as SessionThinkingLevel,
653 + thinkingLevel: pi.getThinkingLevel(),
656 654 tools: [...SIDE_TOOLS],
657 655 resourceLoader: createBtwResourceLoader(ctx),
985 983 timestamp: Date.now(),
986 984 provider: model.provider,
987 985 model: model.id,
988 - thinkingLevel: pi.getThinkingLevel() as SessionThinkingLevel,
986 + thinkingLevel: pi.getThinkingLevel(),
989 987 usage: response.usage,
991 989 thread.push(details);

extensions/masks/index.ts

Modified
20 20 const SETTINGS_KEY = "masks";
21 21 const DEFAULT_PICKER_SHORTCUT = "alt+m";
22 -const THINKING_LEVELS = [
22 +type ThinkingLevel = ReturnType<ExtensionAPI["getThinkingLevel"]>;
23 +const THINKING_LEVELS: readonly ThinkingLevel[] = [
23 24 "off",
24 25 "minimal",
25 26 "low",
27 28 "high",
28 29 "xhigh",
29 30 "max",
30 -] as const;
32 -type ThinkingLevel = (typeof THINKING_LEVELS)[number];
31 +];
33 32 type Shortcut = Parameters<ExtensionAPI["registerShortcut"]>[0];
35 34 interface Mask {