@oh-my-pi/pi-coding-agent 15.13.1 → 15.13.3

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/cli.js +1057 -289
  3. package/dist/types/config/model-registry.d.ts +1 -0
  4. package/dist/types/config/models-config-schema.d.ts +3 -0
  5. package/dist/types/config/models-config.d.ts +3 -0
  6. package/dist/types/config/settings-schema.d.ts +97 -0
  7. package/dist/types/edit/hashline/block-resolver.d.ts +1 -1
  8. package/dist/types/edit/index.d.ts +2 -0
  9. package/dist/types/eval/js/context-manager.d.ts +15 -0
  10. package/dist/types/modes/components/welcome.d.ts +1 -0
  11. package/dist/types/modes/controllers/input-controller.d.ts +4 -4
  12. package/dist/types/modes/interactive-mode.d.ts +1 -0
  13. package/dist/types/modes/rpc/rpc-types.d.ts +2 -1
  14. package/dist/types/modes/types.d.ts +6 -0
  15. package/dist/types/sdk.d.ts +3 -0
  16. package/dist/types/session/session-dump-format.d.ts +2 -1
  17. package/dist/types/session/unexpected-stop-classifier.d.ts +13 -0
  18. package/dist/types/stt/asr-client.d.ts +1 -1
  19. package/dist/types/system-prompt.d.ts +11 -0
  20. package/dist/types/tiny/title-client.d.ts +1 -1
  21. package/dist/types/tools/ask.d.ts +2 -0
  22. package/dist/types/tools/ast-edit.d.ts +2 -0
  23. package/dist/types/tools/ast-grep.d.ts +2 -0
  24. package/dist/types/tools/browser.d.ts +2 -0
  25. package/dist/types/tools/debug.d.ts +2 -0
  26. package/dist/types/tools/eval.d.ts +2 -0
  27. package/dist/types/tools/find.d.ts +2 -0
  28. package/dist/types/tools/inspect-image.d.ts +2 -1
  29. package/dist/types/tools/irc.d.ts +2 -0
  30. package/dist/types/tools/job.d.ts +1 -0
  31. package/dist/types/tools/ssh.d.ts +2 -0
  32. package/dist/types/tools/todo.d.ts +2 -0
  33. package/dist/types/tts/tts-client.d.ts +1 -1
  34. package/dist/types/tui/tree-list.d.ts +1 -0
  35. package/dist/types/utils/thinking-display.d.ts +1 -17
  36. package/package.json +12 -12
  37. package/src/cli.ts +25 -12
  38. package/src/config/model-registry.ts +16 -2
  39. package/src/config/models-config-schema.ts +2 -0
  40. package/src/config/models-config.ts +1 -0
  41. package/src/config/settings-schema.ts +78 -0
  42. package/src/edit/hashline/block-resolver.ts +1 -1
  43. package/src/edit/hashline/execute.ts +1 -6
  44. package/src/edit/index.ts +48 -0
  45. package/src/eval/__tests__/agent-bridge.test.ts +106 -46
  46. package/src/eval/__tests__/js-context-manager.test.ts +53 -3
  47. package/src/eval/js/context-manager.ts +132 -29
  48. package/src/eval/js/worker-core.ts +1 -1
  49. package/src/eval/js/worker-entry.ts +7 -0
  50. package/src/export/html/template.js +18 -22
  51. package/src/internal-urls/docs-index.generated.ts +12 -3
  52. package/src/main.ts +15 -5
  53. package/src/modes/acp/acp-agent.ts +2 -2
  54. package/src/modes/acp/acp-event-mapper.ts +2 -2
  55. package/src/modes/components/agent-hub.ts +31 -7
  56. package/src/modes/components/assistant-message.ts +24 -15
  57. package/src/modes/components/snapcompact-shape-preview-doc.md +2 -2
  58. package/src/modes/components/snapcompact-shape-preview.ts +2 -2
  59. package/src/modes/components/tree-selector.ts +3 -2
  60. package/src/modes/components/welcome.ts +14 -4
  61. package/src/modes/controllers/event-controller.ts +3 -3
  62. package/src/modes/controllers/input-controller.ts +28 -39
  63. package/src/modes/controllers/streaming-reveal.ts +4 -4
  64. package/src/modes/interactive-mode.ts +2 -0
  65. package/src/modes/rpc/rpc-mode.ts +1 -0
  66. package/src/modes/rpc/rpc-types.ts +2 -2
  67. package/src/modes/types.ts +6 -0
  68. package/src/modes/utils/ui-helpers.ts +3 -3
  69. package/src/prompts/agents/oracle.md +0 -1
  70. package/src/prompts/agents/reviewer.md +0 -1
  71. package/src/prompts/system/system-prompt.md +17 -21
  72. package/src/prompts/system/unexpected-stop-classifier.md +17 -0
  73. package/src/prompts/system/unexpected-stop-retry.md +4 -0
  74. package/src/prompts/tools/ask.md +0 -8
  75. package/src/prompts/tools/ast-edit.md +0 -15
  76. package/src/prompts/tools/ast-grep.md +0 -13
  77. package/src/prompts/tools/browser.md +0 -21
  78. package/src/prompts/tools/debug.md +0 -13
  79. package/src/prompts/tools/eval.md +0 -9
  80. package/src/prompts/tools/find.md +0 -13
  81. package/src/prompts/tools/inspect-image.md +0 -9
  82. package/src/prompts/tools/irc.md +0 -15
  83. package/src/prompts/tools/patch.md +0 -13
  84. package/src/prompts/tools/ssh.md +0 -9
  85. package/src/prompts/tools/todo.md +1 -19
  86. package/src/sdk.ts +19 -0
  87. package/src/session/agent-session.ts +289 -29
  88. package/src/session/session-dump-format.ts +17 -49
  89. package/src/session/unexpected-stop-classifier.ts +129 -0
  90. package/src/stt/asr-client.ts +1 -1
  91. package/src/system-prompt.ts +31 -0
  92. package/src/tiny/title-client.ts +1 -1
  93. package/src/tools/ask.ts +41 -0
  94. package/src/tools/ast-edit.ts +46 -0
  95. package/src/tools/ast-grep.ts +24 -0
  96. package/src/tools/browser/tab-supervisor.ts +1 -1
  97. package/src/tools/browser/tab-worker-entry.ts +12 -4
  98. package/src/tools/browser.ts +52 -0
  99. package/src/tools/debug.ts +17 -0
  100. package/src/tools/eval.ts +20 -1
  101. package/src/tools/find.ts +24 -0
  102. package/src/tools/inspect-image.ts +27 -1
  103. package/src/tools/irc.ts +41 -0
  104. package/src/tools/job.ts +1 -0
  105. package/src/tools/ssh.ts +16 -0
  106. package/src/tools/todo.ts +82 -3
  107. package/src/tts/tts-client.ts +1 -1
  108. package/src/tui/tree-list.ts +68 -19
  109. package/src/utils/thinking-display.ts +8 -34
@@ -248,6 +248,7 @@ export interface ProviderConfigInput {
248
248
  reasoning: boolean;
249
249
  thinking?: ThinkingConfig;
250
250
  input: ("text" | "image")[];
251
+ supportsTools?: boolean;
251
252
  cost: {
252
253
  input: number;
253
254
  output: number;
@@ -215,6 +215,7 @@ export declare const ModelOverrideSchema: z.ZodObject<{
215
215
  image: "image";
216
216
  text: "text";
217
217
  }>>>;
218
+ supportsTools: z.ZodOptional<z.ZodBoolean>;
218
219
  cost: z.ZodOptional<z.ZodObject<{
219
220
  input: z.ZodOptional<z.ZodNumber>;
220
221
  output: z.ZodOptional<z.ZodNumber>;
@@ -633,6 +634,7 @@ export declare const ModelsConfigSchema: z.ZodObject<{
633
634
  image: "image";
634
635
  text: "text";
635
636
  }>>>;
637
+ supportsTools: z.ZodOptional<z.ZodBoolean>;
636
638
  cost: z.ZodOptional<z.ZodObject<{
637
639
  input: z.ZodNumber;
638
640
  output: z.ZodNumber;
@@ -862,6 +864,7 @@ export declare const ModelsConfigSchema: z.ZodObject<{
862
864
  image: "image";
863
865
  text: "text";
864
866
  }>>>;
867
+ supportsTools: z.ZodOptional<z.ZodBoolean>;
865
868
  cost: z.ZodOptional<z.ZodObject<{
866
869
  input: z.ZodOptional<z.ZodNumber>;
867
870
  output: z.ZodOptional<z.ZodNumber>;
@@ -9,6 +9,7 @@ export interface ProviderValidationModel {
9
9
  id: string;
10
10
  api?: Api;
11
11
  contextWindow?: number;
12
+ supportsTools?: boolean;
12
13
  maxTokens?: number;
13
14
  }
14
15
  export interface ProviderValidationConfig {
@@ -150,6 +151,7 @@ export declare const ModelsConfigFile: ConfigFile<{
150
151
  supportsDisplay?: boolean | undefined;
151
152
  } | undefined;
152
153
  input?: ("image" | "text")[] | undefined;
154
+ supportsTools?: boolean | undefined;
153
155
  cost?: {
154
156
  input: number;
155
157
  output: number;
@@ -274,6 +276,7 @@ export declare const ModelsConfigFile: ConfigFile<{
274
276
  supportsDisplay?: boolean | undefined;
275
277
  } | undefined;
276
278
  input?: ("image" | "text")[] | undefined;
279
+ supportsTools?: boolean | undefined;
277
280
  cost?: {
278
281
  input?: number | undefined;
279
282
  output?: number | undefined;
@@ -1841,6 +1841,62 @@ export declare const SETTINGS_SCHEMA: {
1841
1841
  readonly description: "Experimental: render large historical tool results as dense PNG image(s) instead of text (vision models only). Saves tokens on accumulated read/search output.";
1842
1842
  };
1843
1843
  };
1844
+ readonly "tools.format": {
1845
+ readonly type: "enum";
1846
+ readonly values: readonly ["auto", "native", "glm", "hermes", "kimi", "xml", "anthropic", "deepseek", "harmony", "pi", "qwen3"];
1847
+ readonly default: "auto";
1848
+ readonly ui: {
1849
+ readonly tab: "context";
1850
+ readonly group: "Experimental";
1851
+ readonly label: "Tool Call Format";
1852
+ readonly description: "Controls how tools are exposed to the model. Auto uses native tool calls unless the selected model is marked as not supporting tools, then falls back to GLM-style in-band tool calls. Native forces provider-native tools; the other values force the named in-band syntax. Applies on session start.";
1853
+ readonly options: readonly [{
1854
+ readonly value: "auto";
1855
+ readonly label: "Auto";
1856
+ readonly description: "Use native tool calls unless the model is known not to support them.";
1857
+ }, {
1858
+ readonly value: "native";
1859
+ readonly label: "Native";
1860
+ readonly description: "Use provider-native tool calls.";
1861
+ }, {
1862
+ readonly value: "glm";
1863
+ readonly label: "GLM";
1864
+ readonly description: "Use GLM-style in-band tool calls.";
1865
+ }, {
1866
+ readonly value: "hermes";
1867
+ readonly label: "Hermes";
1868
+ readonly description: "Use Hermes-style in-band tool calls.";
1869
+ }, {
1870
+ readonly value: "kimi";
1871
+ readonly label: "Kimi";
1872
+ readonly description: "Use Kimi-style in-band tool calls.";
1873
+ }, {
1874
+ readonly value: "xml";
1875
+ readonly label: "XML";
1876
+ readonly description: "Use generic XML in-band tool calls.";
1877
+ }, {
1878
+ readonly value: "anthropic";
1879
+ readonly label: "Anthropic";
1880
+ readonly description: "Use Anthropic-style in-band tool calls.";
1881
+ }, {
1882
+ readonly value: "deepseek";
1883
+ readonly label: "DeepSeek";
1884
+ readonly description: "Use DeepSeek-style in-band tool calls.";
1885
+ }, {
1886
+ readonly value: "harmony";
1887
+ readonly label: "Harmony";
1888
+ readonly description: "Use Harmony-style in-band tool calls.";
1889
+ }, {
1890
+ readonly value: "pi";
1891
+ readonly label: "Pi";
1892
+ readonly description: "Use Pi-style in-band tool calls.";
1893
+ }, {
1894
+ readonly value: "qwen3";
1895
+ readonly label: "Qwen3";
1896
+ readonly description: "Use Qwen3-style in-band tool calls.";
1897
+ }];
1898
+ };
1899
+ };
1844
1900
  readonly "snapcompact.shape": {
1845
1901
  readonly type: "enum";
1846
1902
  readonly values: readonly ["auto", ...("11on16-bw" | "5x8-bw" | "5x8-sent" | "6x12-dim" | "6x6u-bw" | "6x6u-sent" | "8on16-bw" | "8on22-bw" | "8x13-bw" | "8x8r-bw" | "8x8r-sent" | "8x8u-bw" | "8x8u-sent" | "doc-8on16-bw" | "doc-8on16-sent" | "doc-8on16-sent-dim")[]];
@@ -3315,6 +3371,16 @@ export declare const SETTINGS_SCHEMA: {
3315
3371
  readonly description: "Ask the agent to describe the intent of each tool call before executing it";
3316
3372
  };
3317
3373
  };
3374
+ readonly "tools.abortOnFabricatedResult": {
3375
+ readonly type: "boolean";
3376
+ readonly default: true;
3377
+ readonly ui: {
3378
+ readonly tab: "tools";
3379
+ readonly group: "Execution";
3380
+ readonly label: "Abort On Fabricated Tool Result";
3381
+ readonly description: "With in-band tool calls, stop the model immediately when it starts hallucinating a tool result mid-turn. Disable to let the model finish generating and discard the fabricated continuation instead.";
3382
+ };
3383
+ };
3318
3384
  readonly "tools.maxTimeout": {
3319
3385
  readonly type: "number";
3320
3386
  readonly default: 0;
@@ -4350,6 +4416,37 @@ export declare const SETTINGS_SCHEMA: {
4350
4416
  })[];
4351
4417
  };
4352
4418
  };
4419
+ readonly "features.unexpectedStopDetection": {
4420
+ readonly type: "boolean";
4421
+ readonly default: false;
4422
+ readonly ui: {
4423
+ readonly tab: "interaction";
4424
+ readonly group: "Agent";
4425
+ readonly label: "Detect unexpected stops";
4426
+ readonly description: "Use a small model to detect when the assistant says it will continue but stops without tool calls; automatically prompt it to continue.";
4427
+ };
4428
+ };
4429
+ readonly "providers.unexpectedStopModel": {
4430
+ readonly type: "enum";
4431
+ readonly values: readonly ["online", "qwen3-1.7b", "gemma-3-1b", "qwen2.5-1.5b", "lfm2-1.2b"];
4432
+ readonly default: "online";
4433
+ readonly ui: {
4434
+ readonly tab: "providers";
4435
+ readonly group: "Tiny Model";
4436
+ readonly label: "Unexpected Stop Model";
4437
+ readonly description: "Classifier for unexpected-stop detection: online smol by default, or a local on-device model.";
4438
+ readonly condition: "unexpectedStopDetection";
4439
+ readonly options: ({
4440
+ value: "online";
4441
+ label: string;
4442
+ description: string;
4443
+ } | {
4444
+ value: "gemma-3-1b" | "lfm2-1.2b" | "qwen2.5-1.5b" | "qwen3-1.7b";
4445
+ label: "Gemma 3 1B" | "LFM2 1.2B" | "Qwen2.5 1.5B" | "Qwen3 1.7B";
4446
+ description: "Best consolidation/dedup; lighter footprint, but leaks small talk during extraction." | "Best extraction granularity (atomic facts); weaker consolidation." | "Fastest load; solid all-rounder, slightly noisier extraction labels." | "Recommended; most disciplined extraction (ignores chit-chat), good consolidation, about 1.1 GB cached.";
4447
+ })[];
4448
+ };
4449
+ };
4353
4450
  readonly "providers.kimiApiFormat": {
4354
4451
  readonly type: "enum";
4355
4452
  readonly values: readonly ["openai", "anthropic"];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tree-sitter-backed {@link BlockResolver} for the hashline `replace block N:`
2
+ * Tree-sitter-backed {@link BlockResolver} for the hashline block replace
3
3
  * operator. Bridges the pure hashline seam to the native `blockRangeAt`
4
4
  * primitive in `@oh-my-pi/pi-natives`, which infers the language from the file
5
5
  * path and returns the 1-indexed line span of the syntactic block beginning on
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
2
3
  import type { ToolSession } from "../tools";
3
4
  import { type EditMode } from "../utils/edit-mode";
4
5
  import { type HashlineParams, hashlineEditParamsSchema } from "./hashline";
@@ -34,6 +35,7 @@ export declare class EditTool implements AgentTool<TInput> {
34
35
  get mode(): EditMode;
35
36
  get description(): string;
36
37
  get parameters(): TInput;
38
+ get examples(): readonly ToolExample[] | undefined;
37
39
  /**
38
40
  * When in `apply_patch` mode, expose the Codex Lark grammar so providers
39
41
  * that support OpenAI-style custom tools can emit a grammar-constrained
@@ -7,6 +7,12 @@ export interface VmRunState {
7
7
  onText?: (chunk: string) => void;
8
8
  onDisplay?: (output: JsDisplayOutput) => void;
9
9
  }
10
+ /**
11
+ * Test-only seam: override the graceful-close grace period (ms). Returns the
12
+ * previous value so callers can restore it. Production always uses
13
+ * {@link WORKER_CLOSE_TIMEOUT_MS}; never call this outside tests.
14
+ */
15
+ export declare function setWorkerCloseTimeoutMsForTests(ms: number): number;
10
16
  export declare function executeInVmContext(options: {
11
17
  sessionKey: string;
12
18
  sessionId: string;
@@ -23,3 +29,12 @@ export declare function executeInVmContext(options: {
23
29
  }>;
24
30
  export declare function resetVmContext(sessionKey: string): Promise<void>;
25
31
  export declare function disposeAllVmContexts(): Promise<void>;
32
+ /**
33
+ * Smoke probe: spawn the JS eval worker through the worker-host entry and prove
34
+ * it answers the `init` handshake on a real worker thread (not the inline
35
+ * fallback). Catches the silent worker-load and init-message-drop regressions
36
+ * that otherwise strand every cell on the init timeout in a distribution build —
37
+ * the failure mode that motivated `installWorkerInbox`. Wired into
38
+ * `omp --smoke-test` so binary / source / tarball installs all exercise it.
39
+ */
40
+ export declare function smokeTestJsEvalWorker(): Promise<void>;
@@ -30,6 +30,7 @@ export declare class WelcomeComponent implements Component {
30
30
  private recentSessions;
31
31
  private lspServers;
32
32
  constructor(version: string, modelName: string, providerName: string, recentSessions?: RecentSession[], lspServers?: LspServerInfo[]);
33
+ get tip(): string | undefined;
33
34
  invalidate(): void;
34
35
  /**
35
36
  * Play a one-shot intro that sweeps the gradient through every phase
@@ -35,10 +35,10 @@ export declare class InputController {
35
35
  */
36
36
  handleLargePaste(text: string, lineCount: number): boolean;
37
37
  /**
38
- * Present the large-paste menu and apply the chosen action: wrap in a code block or in XML tags
39
- * (both collapse to a `[Paste]` marker that expands on submit), or save the text to a file and
40
- * reference its path so the agent can `read` it on demand. Cancelling (Esc) falls back to the
41
- * default inline paste marker, so the pasted content is never lost.
38
+ * Present the large-paste menu and apply the chosen action: wrap in `<attachment>` tags (collapsed
39
+ * to a `[Paste]` marker that expands on submit), save the text to a file and reference its path so
40
+ * the agent can `read` it on demand, or paste inline. Cancelling (Esc) falls back to the default
41
+ * inline paste marker, so the pasted content is never lost.
42
42
  */
43
43
  presentLargePasteMenu(text: string, lineCount: number): Promise<void>;
44
44
  createAutocompleteProvider(commands: SlashCommand[], basePath: string): AutocompleteProvider;
@@ -186,6 +186,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
186
186
  imageLinks?: (string | undefined)[];
187
187
  customType?: string;
188
188
  display?: boolean;
189
+ streamingBehavior?: "steer" | "followUp";
189
190
  }): SubmittedUserInput;
190
191
  cancelPendingSubmission(): boolean;
191
192
  markPendingSubmissionStarted(input: SubmittedUserInput): boolean;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { AgentMessage, AgentToolResult, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
8
8
  import type { CompactionResult } from "@oh-my-pi/pi-agent-core/compaction";
9
- import type { Effort, ImageContent, Model } from "@oh-my-pi/pi-ai";
9
+ import type { Effort, ImageContent, Model, ToolExample } from "@oh-my-pi/pi-ai";
10
10
  import type { BashResult } from "../../exec/bash-executor";
11
11
  import type { ContextUsage } from "../../extensibility/extensions/types";
12
12
  import type { AgentSessionEvent, SessionStats } from "../../session/agent-session";
@@ -186,6 +186,7 @@ export interface RpcSessionState {
186
186
  name: string;
187
187
  description: string;
188
188
  parameters: unknown;
189
+ examples?: readonly ToolExample[];
189
190
  }>;
190
191
  /** Current context window usage. Null tokens/percent when unknown (e.g. right after compaction). */
191
192
  contextUsage?: ContextUsage;
@@ -46,6 +46,11 @@ export type SubmittedUserInput = {
46
46
  * turn. Used by the `c`/`.` continue shortcut. */
47
47
  synthetic?: boolean;
48
48
  display?: boolean;
49
+ /** Queue intent if the session is (or becomes) busy when this submission is
50
+ * dispatched: "steer" (interrupt the active turn) or "followUp" (process after
51
+ * it). Normal user Enter carries "steer" to match the streaming-branch Enter;
52
+ * background/continuation submits omit it and default to "followUp". */
53
+ streamingBehavior?: "steer" | "followUp";
49
54
  cancelled: boolean;
50
55
  started: boolean;
51
56
  };
@@ -199,6 +204,7 @@ export interface InteractiveModeContext {
199
204
  imageLinks?: (string | undefined)[];
200
205
  customType?: string;
201
206
  display?: boolean;
207
+ streamingBehavior?: "steer" | "followUp";
202
208
  }): SubmittedUserInput;
203
209
  cancelPendingSubmission(): boolean;
204
210
  markPendingSubmissionStarted(input: SubmittedUserInput): boolean;
@@ -1,5 +1,6 @@
1
1
  import { type AgentTelemetryConfig, type ThinkingLevel } from "@oh-my-pi/pi-agent-core";
2
2
  import { type Model } from "@oh-my-pi/pi-ai";
3
+ import type { ToolCallSyntax } from "@oh-my-pi/pi-ai/grammar";
3
4
  import { type Rule } from "./capability/rule";
4
5
  import { ModelRegistry } from "./config/model-registry";
5
6
  import { type PromptTemplate } from "./config/prompt-templates";
@@ -183,6 +184,8 @@ export interface CreateAgentSessionResult {
183
184
  /** Shared event bus for tool/extension communication */
184
185
  eventBus: EventBus;
185
186
  }
187
+ export type ToolCallFormat = "auto" | "native" | ToolCallSyntax;
188
+ export declare function resolveToolCallSyntax(format: ToolCallFormat, model: Pick<Model, "supportsTools"> | undefined): ToolCallSyntax | undefined;
186
189
  export type { PromptTemplate } from "./config/prompt-templates";
187
190
  export { Settings, type SkillsSettings } from "./config/settings";
188
191
  export type { CustomCommand, CustomCommandFactory } from "./extensibility/custom-commands/types";
@@ -2,12 +2,13 @@
2
2
  * Plain-text / markdown session formatting (same shape as /dump clipboard export).
3
3
  */
4
4
  import type { AgentMessage, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
5
- import type { Model } from "@oh-my-pi/pi-ai";
5
+ import type { Model, ToolExample } from "@oh-my-pi/pi-ai";
6
6
  /** Minimal tool shape for dump output (matches AgentTool fields used by formatSessionDumpText). */
7
7
  export interface SessionDumpToolInfo {
8
8
  name: string;
9
9
  description: string;
10
10
  parameters: unknown;
11
+ examples?: readonly ToolExample[];
11
12
  }
12
13
  export interface FormatSessionDumpTextOptions {
13
14
  messages: readonly AgentMessage[];
@@ -0,0 +1,13 @@
1
+ import { type AssistantMessage } from "@oh-my-pi/pi-ai";
2
+ import type { ModelRegistry } from "../config/model-registry";
3
+ import type { Settings } from "../config/settings";
4
+ export interface ClassifyUnexpectedStopDeps {
5
+ settings: Settings;
6
+ registry: ModelRegistry;
7
+ sessionId: string;
8
+ metadataResolver?: (provider: string) => Record<string, unknown> | undefined;
9
+ signal?: AbortSignal;
10
+ }
11
+ export declare function isUnexpectedStopCandidate(message: AssistantMessage): boolean;
12
+ export declare function classifyUnexpectedStop(text: string, deps: ClassifyUnexpectedStopDeps): Promise<boolean | undefined>;
13
+ export declare function parseUnexpectedStopClassification(text: string): boolean | undefined;
@@ -43,7 +43,7 @@ export interface SttStreamOptions {
43
43
  * Hidden subcommand on the main CLI that boots the speech-recognition worker in
44
44
  * the spawned subprocess. Kept in sync with the dispatch in `cli.ts`.
45
45
  */
46
- export declare const STT_WORKER_ARG = "__omp_stt_worker";
46
+ export declare const STT_WORKER_ARG = "__omp_worker_stt";
47
47
  interface SpawnedSubprocess {
48
48
  proc: Subprocess<"ignore", "ignore", "ignore">;
49
49
  inbound: Set<(message: SttWorkerOutbound) => void>;
@@ -2,6 +2,7 @@
2
2
  * System prompt construction and project context loading
3
3
  */
4
4
  import type { AgentTool } from "@oh-my-pi/pi-agent-core";
5
+ import type { ToolExample, TSchema } from "@oh-my-pi/pi-ai";
5
6
  import type { Personality, SkillsSettings } from "./config/settings";
6
7
  import { type Skill } from "./extensibility/skills";
7
8
  import { type WorkspaceTree } from "./workspace-tree";
@@ -38,6 +39,10 @@ export interface SystemPromptToolMetadata {
38
39
  description: string;
39
40
  /** Tool name the model sees on the provider wire. Defaults to the internal tool name. */
40
41
  wireName?: string;
42
+ /** Tool parameters schema (Zod or JSON Schema), fed to the verbose inventory renderer. */
43
+ parameters?: TSchema;
44
+ /** Illustrative examples rendered into the verbose inventory. */
45
+ examples?: readonly ToolExample[];
41
46
  }
42
47
  export declare function buildSystemPromptToolMetadata(tools: Map<string, AgentTool>, overrides?: Partial<Record<string, Partial<SystemPromptToolMetadata>>>): Map<string, SystemPromptToolMetadata>;
43
48
  export interface BuildSystemPromptOptions {
@@ -51,6 +56,12 @@ export interface BuildSystemPromptOptions {
51
56
  appendSystemPrompt?: string;
52
57
  /** Repeat full tool descriptions in system prompt. Default: false */
53
58
  repeatToolDescriptions?: boolean;
59
+ /**
60
+ * Whether provider-native tool calling is active (no owned/in-band syntax).
61
+ * When true and `repeatToolDescriptions` is false, the inventory renders as a
62
+ * compact tool-name list; otherwise it renders full `# Tool:` sections. Default: true
63
+ */
64
+ nativeTools?: boolean;
54
65
  /** Skills settings for discovery. */
55
66
  skillsSettings?: SkillsSettings;
56
67
  /** Working directory. Default: getProjectDir() */
@@ -32,7 +32,7 @@ export interface TinyTitleGenerateOptions {
32
32
  * Hidden subcommand on the main CLI that boots the tiny-model worker in the
33
33
  * spawned subprocess. Kept in sync with the dispatch in `cli.ts`.
34
34
  */
35
- export declare const TINY_WORKER_ARG = "--tiny-worker";
35
+ export declare const TINY_WORKER_ARG = "__omp_worker_tiny_inference";
36
36
  /**
37
37
  * Decide which `PI_TINY_DEVICE` / `PI_TINY_DTYPE` vars to overlay onto the worker
38
38
  * env. A present env var wins (left untouched); otherwise the mapped persisted
@@ -15,6 +15,7 @@
15
15
  * - Questions may time out and auto-select the recommended option (configurable, disabled in plan mode)
16
16
  */
17
17
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
18
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
18
19
  import { type Component } from "@oh-my-pi/pi-tui";
19
20
  import { z } from "zod/v4";
20
21
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
@@ -83,6 +84,7 @@ export declare class AskTool implements AgentTool<typeof askSchema, AskToolDetai
83
84
  }, z.core.$strip>>;
84
85
  }, z.core.$strip>;
85
86
  readonly strict = true;
87
+ readonly examples: readonly ToolExample<z.input<typeof askSchema>>[];
86
88
  readonly concurrency = "exclusive";
87
89
  readonly loadMode = "discoverable";
88
90
  constructor(session: ToolSession);
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
2
3
  import type { Component } from "@oh-my-pi/pi-tui";
3
4
  import { z } from "zod/v4";
4
5
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
@@ -54,6 +55,7 @@ export declare class AstEditTool implements AgentTool<typeof astEditSchema, AstE
54
55
  paths: z.ZodArray<z.ZodString>;
55
56
  }, z.core.$strip>;
56
57
  readonly strict = true;
58
+ readonly examples: readonly ToolExample<z.input<typeof astEditSchema>>[];
57
59
  readonly deferrable = true;
58
60
  readonly loadMode = "discoverable";
59
61
  constructor(session: ToolSession);
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
2
3
  import type { Component } from "@oh-my-pi/pi-tui";
3
4
  import { z } from "zod/v4";
4
5
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
@@ -48,6 +49,7 @@ export declare class AstGrepTool implements AgentTool<typeof astGrepSchema, AstG
48
49
  skip: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
49
50
  }, z.core.$strip>;
50
51
  readonly strict = true;
52
+ readonly examples: readonly ToolExample<z.input<typeof astGrepSchema>>[];
51
53
  readonly loadMode = "discoverable";
52
54
  constructor(session: ToolSession);
53
55
  execute(_toolCallId: string, params: z.infer<typeof astGrepSchema>, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<AstGrepToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<AstGrepToolDetails>>;
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
2
3
  import { z } from "zod/v4";
3
4
  import type { ToolSession } from "../sdk";
4
5
  import { type BrowserKindTag } from "./browser/registry";
@@ -110,6 +111,7 @@ export declare class BrowserTool implements AgentTool<typeof browserSchema, Brow
110
111
  kill: z.ZodOptional<z.ZodBoolean>;
111
112
  }, z.core.$strip>;
112
113
  readonly strict = true;
114
+ readonly examples: readonly ToolExample<z.input<typeof browserSchema>>[];
113
115
  constructor(session: ToolSession);
114
116
  get description(): string;
115
117
  /** Restart browser to apply mode changes (e.g. headless toggle). Drops only headless browsers. */
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback, RenderResultOptions, ToolApprovalDecision } from "@oh-my-pi/pi-agent-core";
2
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
2
3
  import { type Component } from "@oh-my-pi/pi-tui";
3
4
  import { z } from "zod/v4";
4
5
  import { type DapBreakpointRecord, type DapContinueOutcome, type DapDataBreakpointInfoResponse, type DapDataBreakpointRecord, type DapDisassembledInstruction, type DapEvaluateResponse, type DapFunctionBreakpointRecord, type DapInstructionBreakpointRecord, type DapModule, type DapScope, type DapSessionSummary, type DapSource, type DapStackFrame, type DapThread, type DapVariable } from "../dap";
@@ -208,6 +209,7 @@ export declare class DebugTool implements AgentTool<typeof debugSchema, DebugToo
208
209
  timeout: z.ZodOptional<z.ZodNumber>;
209
210
  }, z.core.$strip>;
210
211
  readonly strict = true;
212
+ readonly examples: readonly ToolExample<z.input<typeof debugSchema>>[];
211
213
  readonly concurrency = "exclusive";
212
214
  readonly loadMode = "discoverable";
213
215
  constructor(session: ToolSession);
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
2
3
  import { z } from "zod/v4";
3
4
  import type { EvalToolDetails } from "../eval/types";
4
5
  import type { ToolSession } from ".";
@@ -65,6 +66,7 @@ export declare class EvalTool implements AgentTool<typeof evalSchema> {
65
66
  readonly loadMode = "discoverable";
66
67
  readonly label = "Eval";
67
68
  get description(): string;
69
+ readonly examples: readonly ToolExample<z.input<typeof evalSchema>>[];
68
70
  readonly parameters: z.ZodObject<{
69
71
  cells: z.ZodArray<z.ZodObject<{
70
72
  language: z.ZodEnum<{
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
2
3
  import type { Component } from "@oh-my-pi/pi-tui";
3
4
  import { z } from "zod/v4";
4
5
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
@@ -72,6 +73,7 @@ export declare class FindTool implements AgentTool<typeof findSchema, FindToolDe
72
73
  limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
73
74
  timeout: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
74
75
  }, z.core.$strict>;
76
+ readonly examples: readonly ToolExample<z.input<typeof findSchema>>[];
75
77
  readonly strict = true;
76
78
  constructor(session: ToolSession, options?: FindToolOptions);
77
79
  execute(_toolCallId: string, params: z.infer<typeof findSchema>, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<FindToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<FindToolDetails>>;
@@ -1,5 +1,5 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
- import { completeSimple } from "@oh-my-pi/pi-ai";
2
+ import { completeSimple, type ToolExample } from "@oh-my-pi/pi-ai";
3
3
  import { z } from "zod/v4";
4
4
  import type { ToolSession } from "./index";
5
5
  declare const inspectImageSchema: z.ZodObject<{
@@ -26,6 +26,7 @@ export declare class InspectImageTool implements AgentTool<typeof inspectImageSc
26
26
  question: z.ZodString;
27
27
  }, z.core.$strict>;
28
28
  readonly strict = false;
29
+ readonly examples: readonly ToolExample<z.input<typeof inspectImageSchema>>[];
29
30
  constructor(session: ToolSession, completeImageRequest?: typeof completeSimple);
30
31
  execute(_toolCallId: string, params: InspectImageParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<InspectImageToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<InspectImageToolDetails>>;
31
32
  }
@@ -9,6 +9,7 @@
9
9
  * drains pending messages; `list` shows every addressable peer.
10
10
  */
11
11
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
12
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
12
13
  import { type Component } from "@oh-my-pi/pi-tui";
13
14
  import { z } from "zod/v4";
14
15
  import type { Settings } from "../config/settings";
@@ -83,6 +84,7 @@ export declare class IrcTool implements AgentTool<typeof ircSchema, IrcDetails>
83
84
  peek: z.ZodOptional<z.ZodBoolean>;
84
85
  }, z.core.$strip>;
85
86
  readonly strict = true;
87
+ readonly examples: readonly ToolExample<z.input<typeof ircSchema>>[];
86
88
  readonly loadMode = "discoverable";
87
89
  constructor(session: ToolSession);
88
90
  static createIf(session: ToolSession): IrcTool | null;
@@ -48,6 +48,7 @@ export declare class JobTool implements AgentTool<typeof jobSchema, JobToolDetai
48
48
  list: z.ZodOptional<z.ZodBoolean>;
49
49
  }, z.core.$strip>;
50
50
  readonly strict = true;
51
+ readonly interruptible = true;
51
52
  readonly loadMode = "discoverable";
52
53
  constructor(session: ToolSession);
53
54
  execute(_toolCallId: string, params: JobParams, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<JobToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<JobToolDetails>>;
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
2
3
  import type { Component } from "@oh-my-pi/pi-tui";
3
4
  import { z } from "zod/v4";
4
5
  import type { SSHHost } from "../capability/ssh";
@@ -36,6 +37,7 @@ export declare class SshTool implements AgentTool<typeof sshSchema, SSHToolDetai
36
37
  }, z.core.$strip>;
37
38
  readonly concurrency = "exclusive";
38
39
  readonly strict = true;
40
+ readonly examples: readonly ToolExample<z.input<typeof sshSchema>>[];
39
41
  constructor(session: ToolSession, hostNames: string[], hostsByName: Map<string, SSHHost>, description: string);
40
42
  execute(_toolCallId: string, { host, command, cwd, timeout: rawTimeout }: SshToolParams, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<SSHToolDetails>, _ctx?: AgentToolContext): Promise<AgentToolResult<SSHToolDetails>>;
41
43
  }
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
+ import type { ToolExample } from "@oh-my-pi/pi-ai";
2
3
  import type { Component } from "@oh-my-pi/pi-tui";
3
4
  import { z } from "zod/v4";
4
5
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
@@ -117,6 +118,7 @@ export declare class TodoTool implements AgentTool<typeof todoSchema, TodoToolDe
117
118
  }, z.core.$strip>;
118
119
  readonly concurrency = "exclusive";
119
120
  readonly strict = true;
121
+ readonly examples: readonly ToolExample<z.input<typeof todoSchema>>[];
120
122
  readonly loadMode = "discoverable";
121
123
  constructor(session: ToolSession);
122
124
  execute(_toolCallId: string, params: TodoParams, _signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<TodoToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<TodoToolDetails>>;
@@ -54,7 +54,7 @@ export interface TtsStreamHandle {
54
54
  * Hidden subcommand on the main CLI that boots the TTS worker in the spawned
55
55
  * subprocess. Kept in sync with the dispatch in `cli.ts` (Main-owned).
56
56
  */
57
- export declare const TTS_WORKER_ARG = "__omp_tts_worker";
57
+ export declare const TTS_WORKER_ARG = "__omp_worker_tts";
58
58
  interface SpawnedSubprocess {
59
59
  proc: Subprocess<"ignore", "ignore", "ignore">;
60
60
  inbound: Set<(message: TtsWorkerOutbound) => void>;
@@ -12,6 +12,7 @@ export interface TreeListOptions<T> {
12
12
  */
13
13
  maxCollapsedLines?: number;
14
14
  itemType?: string;
15
+ truncateFrom?: "start" | "end";
15
16
  /** Called once per item with `isLast: false` during budget calculation;
16
17
  * line count MUST NOT vary based on `isLast`. */
17
18
  renderItem: (item: T, context: TreeContext) => string | string[];
@@ -1,17 +1 @@
1
- import type { AssistantMessage } from "@oh-my-pi/pi-ai";
2
- type AssistantContentBlock = AssistantMessage["content"][number];
3
- type ThinkingBlock = Extract<AssistantContentBlock, {
4
- type: "thinking";
5
- }>;
6
- /**
7
- * Returns the operator-visible thinking text for a block.
8
- *
9
- * Some OpenAI-compatible reasoning gateways require a non-empty
10
- * `reasoning_content` field on historical assistant tool-call turns even when
11
- * the model did not emit any reasoning. The provider adapter uses a single dot
12
- * as the wire-only placeholder those gateways accept; if that value is later
13
- * replayed or echoed as a thinking block, it should not render as model thought.
14
- */
15
- export declare function getVisibleThinkingText(block: ThinkingBlock): string;
16
- export declare function hasVisibleThinking(block: ThinkingBlock): boolean;
17
- export {};
1
+ export declare function canonicalizeMessage(text: string | null | undefined): string;