@oh-my-pi/pi-coding-agent 15.0.1 → 15.1.0

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 (168) hide show
  1. package/CHANGELOG.md +94 -1
  2. package/examples/custom-tools/README.md +11 -7
  3. package/examples/custom-tools/hello/index.ts +2 -2
  4. package/examples/extensions/README.md +19 -8
  5. package/examples/extensions/api-demo.ts +15 -19
  6. package/examples/extensions/hello.ts +5 -6
  7. package/examples/extensions/plan-mode.ts +1 -1
  8. package/examples/extensions/reload-runtime.ts +4 -3
  9. package/examples/extensions/with-deps/index.ts +4 -3
  10. package/examples/sdk/06-extensions.ts +4 -2
  11. package/package.json +8 -18
  12. package/src/autoresearch/tools/init-experiment.ts +38 -41
  13. package/src/autoresearch/tools/log-experiment.ts +32 -41
  14. package/src/autoresearch/tools/run-experiment.ts +3 -3
  15. package/src/autoresearch/tools/update-notes.ts +11 -11
  16. package/src/commands/commit.ts +10 -0
  17. package/src/commit/agentic/tools/analyze-file.ts +4 -4
  18. package/src/commit/agentic/tools/git-file-diff.ts +4 -4
  19. package/src/commit/agentic/tools/git-hunk.ts +5 -5
  20. package/src/commit/agentic/tools/git-overview.ts +4 -4
  21. package/src/commit/agentic/tools/propose-changelog.ts +13 -13
  22. package/src/commit/agentic/tools/propose-commit.ts +6 -6
  23. package/src/commit/agentic/tools/recent-commits.ts +3 -3
  24. package/src/commit/agentic/tools/schemas.ts +28 -28
  25. package/src/commit/agentic/tools/split-commit.ts +22 -21
  26. package/src/commit/analysis/summary.ts +4 -4
  27. package/src/commit/changelog/generate.ts +7 -11
  28. package/src/commit/shared-llm.ts +22 -34
  29. package/src/config/config-file.ts +35 -13
  30. package/src/config/model-registry.ts +40 -191
  31. package/src/config/models-config-schema.ts +166 -0
  32. package/src/config/settings-schema.ts +29 -0
  33. package/src/discovery/claude-plugins.ts +19 -7
  34. package/src/edit/index.ts +2 -2
  35. package/src/edit/modes/apply-patch.ts +7 -6
  36. package/src/edit/modes/patch.ts +18 -25
  37. package/src/edit/modes/replace.ts +18 -20
  38. package/src/eval/js/shared/rewrite-imports.ts +131 -10
  39. package/src/eval/py/executor.ts +233 -623
  40. package/src/eval/py/kernel.ts +27 -2
  41. package/src/eval/py/runner.py +42 -11
  42. package/src/eval/py/runtime.ts +1 -0
  43. package/src/exa/factory.ts +5 -4
  44. package/src/exa/mcp-client.ts +1 -1
  45. package/src/exa/researcher.ts +9 -20
  46. package/src/exa/search.ts +26 -52
  47. package/src/exa/types.ts +1 -1
  48. package/src/exa/websets.ts +54 -53
  49. package/src/exec/bash-executor.ts +2 -1
  50. package/src/extensibility/custom-commands/loader.ts +5 -3
  51. package/src/extensibility/custom-commands/types.ts +4 -2
  52. package/src/extensibility/custom-tools/loader.ts +5 -3
  53. package/src/extensibility/custom-tools/types.ts +7 -6
  54. package/src/extensibility/custom-tools/wrapper.ts +1 -1
  55. package/src/extensibility/extensions/get-commands-handler.ts +77 -0
  56. package/src/extensibility/extensions/loader.ts +7 -3
  57. package/src/extensibility/extensions/types.ts +9 -5
  58. package/src/extensibility/extensions/wrapper.ts +1 -2
  59. package/src/extensibility/hooks/loader.ts +3 -1
  60. package/src/extensibility/hooks/tool-wrapper.ts +1 -1
  61. package/src/extensibility/hooks/types.ts +4 -2
  62. package/src/extensibility/plugins/legacy-pi-compat.ts +78 -31
  63. package/src/extensibility/shared-events.ts +1 -1
  64. package/src/extensibility/typebox.ts +391 -0
  65. package/src/goals/tools/goal-tool.ts +6 -12
  66. package/src/hashline/input.ts +2 -1
  67. package/src/hashline/parser.ts +27 -3
  68. package/src/hashline/types.ts +4 -4
  69. package/src/hindsight/state.ts +2 -2
  70. package/src/index.ts +0 -2
  71. package/src/internal-urls/docs-index.generated.ts +15 -15
  72. package/src/internal-urls/router.ts +8 -0
  73. package/src/internal-urls/types.ts +21 -0
  74. package/src/lsp/config.ts +15 -6
  75. package/src/lsp/defaults.json +6 -2
  76. package/src/lsp/types.ts +30 -38
  77. package/src/mcp/manager.ts +1 -1
  78. package/src/mcp/tool-bridge.ts +1 -1
  79. package/src/modes/acp/acp-agent.ts +248 -50
  80. package/src/modes/components/session-observer-overlay.ts +12 -1
  81. package/src/modes/components/status-line/segments.ts +39 -4
  82. package/src/modes/controllers/command-controller.ts +27 -2
  83. package/src/modes/controllers/event-controller.ts +3 -4
  84. package/src/modes/controllers/extension-ui-controller.ts +3 -2
  85. package/src/modes/interactive-mode.ts +1 -1
  86. package/src/modes/rpc/host-tools.ts +1 -1
  87. package/src/modes/rpc/host-uris.ts +235 -0
  88. package/src/modes/rpc/rpc-client.ts +1 -1
  89. package/src/modes/rpc/rpc-mode.ts +27 -1
  90. package/src/modes/rpc/rpc-types.ts +58 -1
  91. package/src/modes/runtime-init.ts +2 -1
  92. package/src/modes/theme/defaults/dark-poimandres.json +1 -0
  93. package/src/modes/theme/defaults/light-poimandres.json +1 -0
  94. package/src/modes/theme/theme.ts +117 -117
  95. package/src/modes/types.ts +1 -1
  96. package/src/modes/utils/context-usage.ts +2 -2
  97. package/src/prompts/tools/github.md +4 -4
  98. package/src/prompts/tools/hashline.md +22 -26
  99. package/src/prompts/tools/read.md +55 -37
  100. package/src/sdk.ts +31 -8
  101. package/src/session/agent-session.ts +74 -104
  102. package/src/session/messages.ts +16 -51
  103. package/src/session/session-manager.ts +22 -2
  104. package/src/session/streaming-output.ts +16 -6
  105. package/src/task/discovery.ts +5 -2
  106. package/src/task/executor.ts +210 -87
  107. package/src/task/index.ts +15 -11
  108. package/src/task/render.ts +32 -5
  109. package/src/task/types.ts +54 -39
  110. package/src/tools/ask.ts +12 -12
  111. package/src/tools/ast-edit.ts +11 -15
  112. package/src/tools/ast-grep.ts +9 -10
  113. package/src/tools/bash-command-fixup.ts +47 -0
  114. package/src/tools/bash.ts +48 -38
  115. package/src/tools/browser/render.ts +2 -2
  116. package/src/tools/browser.ts +39 -53
  117. package/src/tools/calculator.ts +12 -11
  118. package/src/tools/checkpoint.ts +7 -7
  119. package/src/tools/debug.ts +40 -43
  120. package/src/tools/eval.ts +16 -10
  121. package/src/tools/find.ts +10 -13
  122. package/src/tools/gh.ts +108 -132
  123. package/src/tools/hindsight-recall.ts +4 -6
  124. package/src/tools/hindsight-reflect.ts +5 -5
  125. package/src/tools/hindsight-retain.ts +15 -17
  126. package/src/tools/image-gen.ts +31 -81
  127. package/src/tools/index.ts +4 -1
  128. package/src/tools/inspect-image.ts +8 -9
  129. package/src/tools/irc.ts +15 -27
  130. package/src/tools/job.ts +30 -28
  131. package/src/tools/output-meta.ts +26 -0
  132. package/src/tools/read.ts +39 -12
  133. package/src/tools/recipe/index.ts +7 -9
  134. package/src/tools/render-mermaid.ts +12 -12
  135. package/src/tools/report-tool-issue.ts +4 -4
  136. package/src/tools/resolve.ts +11 -11
  137. package/src/tools/review.ts +14 -26
  138. package/src/tools/search-tool-bm25.ts +7 -9
  139. package/src/tools/search.ts +19 -22
  140. package/src/tools/ssh.ts +10 -9
  141. package/src/tools/todo-write.ts +26 -34
  142. package/src/tools/vim.ts +10 -26
  143. package/src/tools/write.ts +25 -5
  144. package/src/tools/yield.ts +100 -54
  145. package/src/web/search/index.ts +9 -24
  146. package/src/web/search/providers/anthropic.ts +5 -0
  147. package/src/web/search/providers/exa.ts +3 -0
  148. package/src/web/search/providers/gemini.ts +5 -0
  149. package/src/web/search/providers/jina.ts +5 -2
  150. package/src/web/search/providers/zai.ts +5 -2
  151. package/src/prompts/compaction/branch-summary-context.md +0 -5
  152. package/src/prompts/compaction/branch-summary-preamble.md +0 -2
  153. package/src/prompts/compaction/branch-summary.md +0 -30
  154. package/src/prompts/compaction/compaction-short-summary.md +0 -9
  155. package/src/prompts/compaction/compaction-summary-context.md +0 -5
  156. package/src/prompts/compaction/compaction-summary.md +0 -38
  157. package/src/prompts/compaction/compaction-turn-prefix.md +0 -17
  158. package/src/prompts/compaction/compaction-update-summary.md +0 -45
  159. package/src/prompts/system/auto-handoff-threshold-focus.md +0 -1
  160. package/src/prompts/system/file-operations.md +0 -10
  161. package/src/prompts/system/handoff-document.md +0 -49
  162. package/src/prompts/system/summarization-system.md +0 -3
  163. package/src/session/compaction/branch-summarization.ts +0 -324
  164. package/src/session/compaction/compaction.ts +0 -1420
  165. package/src/session/compaction/errors.ts +0 -31
  166. package/src/session/compaction/index.ts +0 -8
  167. package/src/session/compaction/pruning.ts +0 -91
  168. package/src/session/compaction/utils.ts +0 -184
@@ -1,7 +1,6 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
- import { StringEnum } from "@oh-my-pi/pi-ai";
3
2
  import { prompt, untilAborted } from "@oh-my-pi/pi-utils";
4
- import { type Static, Type } from "@sinclair/typebox";
3
+ import * as z from "zod/v4";
5
4
  import browserDescription from "../prompts/tools/browser.md" with { type: "text" };
6
5
  import type { ToolSession } from "../sdk";
7
6
  import { acquireBrowser, type BrowserHandle, type BrowserKind, type BrowserKindTag } from "./browser/registry";
@@ -18,62 +17,49 @@ export type { Observation, ObservationEntry } from "./browser/tab-protocol";
18
17
 
19
18
  const DEFAULT_TAB_NAME = "main";
20
19
 
21
- const appSchema = Type.Object({
22
- path: Type.Optional(
23
- Type.String({
24
- description: "absolute path to a binary to spawn (single-instance reuse)",
25
- examples: ["/Applications/Cursor.app/Contents/MacOS/Cursor"],
26
- }),
27
- ),
28
- cdp_url: Type.Optional(
29
- Type.String({
30
- description: "existing CDP endpoint to connect to (e.g. http://127.0.0.1:9222)",
31
- }),
32
- ),
33
- args: Type.Optional(Type.Array(Type.String(), { description: "extra CLI args when spawning" })),
34
- target: Type.Optional(Type.String({ description: "substring matched against url+title to pick a BrowserWindow" })),
20
+ const appSchema = z.object({
21
+ path: z.string().describe("absolute path to a binary to spawn (single-instance reuse)").optional(),
22
+ cdp_url: z.string().describe("existing CDP endpoint to connect to (e.g. http://127.0.0.1:9222)").optional(),
23
+ args: z.array(z.string()).describe("extra CLI args when spawning").optional(),
24
+ target: z.string().describe("substring matched against url+title to pick a BrowserWindow").optional(),
35
25
  });
36
26
 
37
- const browserSchema = Type.Object({
38
- action: StringEnum(["open", "close", "run"], { description: "tab/browser operation" }),
39
- name: Type.Optional(
40
- Type.String({
41
- description: "tab id; default 'main'. Multiple tabs can coexist; reusable across run() calls and subagents.",
42
- examples: ["main", "docs", "gh"],
43
- }),
44
- ),
45
- url: Type.Optional(Type.String({ description: "open: navigate after acquiring tab" })),
46
- app: Type.Optional(appSchema),
47
- viewport: Type.Optional(
48
- Type.Object({
49
- width: Type.Number(),
50
- height: Type.Number(),
51
- scale: Type.Optional(Type.Number()),
52
- }),
53
- ),
54
- wait_until: Type.Optional(
55
- StringEnum(["load", "domcontentloaded", "networkidle0", "networkidle2"], {
56
- description: "navigation wait condition for url",
57
- }),
58
- ),
59
- dialogs: Type.Optional(
60
- StringEnum(["accept", "dismiss"], {
61
- description: "open: auto-handle alert/confirm/beforeunload dialogs (default: leave for caller to handle)",
62
- }),
63
- ),
64
- code: Type.Optional(
65
- Type.String({
66
- description:
67
- "run: JS body executed with `page`, `browser`, `tab`, `display`, `assert`, `wait` in scope. Treated as the body of an async function. Use `display(value)` to attach text/JSON/images; the function's return value is JSON-serialized as a final block.",
68
- }),
69
- ),
70
- timeout: Type.Optional(Type.Number({ description: "timeout in seconds", default: 30 })),
71
- all: Type.Optional(Type.Boolean({ description: "close: close every tab" })),
72
- kill: Type.Optional(Type.Boolean({ description: "close: also kill spawned-app browsers (default: leave running)" })),
27
+ const browserSchema = z.object({
28
+ action: z.enum(["open", "close", "run"] as const).describe("tab/browser operation"),
29
+ name: z
30
+ .string()
31
+ .describe("tab id; default 'main'. Multiple tabs can coexist; reusable across run() calls and subagents.")
32
+ .optional(),
33
+ url: z.string().describe("open: navigate after acquiring tab").optional(),
34
+ app: appSchema.optional(),
35
+ viewport: z
36
+ .object({
37
+ width: z.number(),
38
+ height: z.number(),
39
+ scale: z.number().optional(),
40
+ })
41
+ .optional(),
42
+ wait_until: z
43
+ .enum(["load", "domcontentloaded", "networkidle0", "networkidle2"] as const)
44
+ .describe("navigation wait condition for url")
45
+ .optional(),
46
+ dialogs: z
47
+ .enum(["accept", "dismiss"] as const)
48
+ .describe("open: auto-handle alert/confirm/beforeunload dialogs (default: leave for caller to handle)")
49
+ .optional(),
50
+ code: z
51
+ .string()
52
+ .describe(
53
+ "run: JS body executed with `page`, `browser`, `tab`, `display`, `assert`, `wait` in scope. Treated as the body of an async function. Use `display(value)` to attach text/JSON/images; the function's return value is JSON-serialized as a final block.",
54
+ )
55
+ .optional(),
56
+ timeout: z.number().default(30).describe("timeout in seconds").optional(),
57
+ all: z.boolean().describe("close: close every tab").optional(),
58
+ kill: z.boolean().describe("close: also kill spawned-app browsers (default: leave running)").optional(),
73
59
  });
74
60
 
75
61
  /** Input schema for the browser tool. */
76
- export type BrowserParams = Static<typeof browserSchema>;
62
+ export type BrowserParams = z.infer<typeof browserSchema>;
77
63
 
78
64
  /** Details describing a browser tool execution result (for renderers + transcript). */
79
65
  export interface BrowserToolDetails {
@@ -2,7 +2,7 @@ import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
2
  import type { Component } from "@oh-my-pi/pi-tui";
3
3
  import { Text } from "@oh-my-pi/pi-tui";
4
4
  import { prompt, untilAborted } from "@oh-my-pi/pi-utils";
5
- import { type Static, Type } from "@sinclair/typebox";
5
+ import * as z from "zod/v4";
6
6
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
7
7
  import type { Theme } from "../modes/theme/theme";
8
8
  import calculatorDescription from "../prompts/tools/calculator.md" with { type: "text" };
@@ -28,15 +28,16 @@ type Token =
28
28
  | { type: "operator"; value: Operator }
29
29
  | { type: "paren"; value: "(" | ")" };
30
30
 
31
- const calculatorSchema = Type.Object({
32
- calculations: Type.Array(
33
- Type.Object({
34
- expression: Type.String({ description: "math expression", examples: ["2 + 2", "sqrt(16)"] }),
35
- prefix: Type.String({ description: "prefix text" }),
36
- suffix: Type.String({ description: "suffix text" }),
37
- }),
38
- { description: "calculations to evaluate" },
39
- ),
31
+ const calculatorSchema = z.object({
32
+ calculations: z
33
+ .array(
34
+ z.object({
35
+ expression: z.string().describe("math expression"),
36
+ prefix: z.string().describe("prefix text"),
37
+ suffix: z.string().describe("suffix text"),
38
+ }),
39
+ )
40
+ .describe("calculations to evaluate"),
40
41
  });
41
42
 
42
43
  export interface CalculatorToolDetails {
@@ -385,7 +386,7 @@ function formatResult(value: number): string {
385
386
  // Tool Class
386
387
  // ═══════════════════════════════════════════════════════════════════════════
387
388
 
388
- type CalculatorParams = Static<typeof calculatorSchema>;
389
+ type CalculatorParams = z.infer<typeof calculatorSchema>;
389
390
 
390
391
  /**
391
392
  * Calculator tool for evaluating mathematical expressions.
@@ -1,6 +1,6 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
2
  import { prompt } from "@oh-my-pi/pi-utils";
3
- import { type Static, Type } from "@sinclair/typebox";
3
+ import * as z from "zod/v4";
4
4
  import checkpointDescription from "../prompts/tools/checkpoint.md" with { type: "text" };
5
5
  import rewindDescription from "../prompts/tools/rewind.md" with { type: "text" };
6
6
  import type { ToolSession } from ".";
@@ -17,17 +17,17 @@ export interface CheckpointState {
17
17
  startedAt: string;
18
18
  }
19
19
 
20
- const checkpointSchema = Type.Object({
21
- goal: Type.String({ description: "investigation goal", examples: ["investigate retry logic"] }),
20
+ const checkpointSchema = z.object({
21
+ goal: z.string().describe("investigation goal"),
22
22
  });
23
23
 
24
- type CheckpointParams = Static<typeof checkpointSchema>;
24
+ type CheckpointParams = z.infer<typeof checkpointSchema>;
25
25
 
26
- const rewindSchema = Type.Object({
27
- report: Type.String({ description: "investigation findings" }),
26
+ const rewindSchema = z.object({
27
+ report: z.string().describe("investigation findings"),
28
28
  });
29
29
 
30
- type RewindParams = Static<typeof rewindSchema>;
30
+ type RewindParams = z.infer<typeof rewindSchema>;
31
31
 
32
32
  export interface CheckpointToolDetails {
33
33
  goal: string;
@@ -5,10 +5,9 @@ import type {
5
5
  AgentToolUpdateCallback,
6
6
  RenderResultOptions,
7
7
  } from "@oh-my-pi/pi-agent-core";
8
- import { StringEnum } from "@oh-my-pi/pi-ai";
9
8
  import { type Component, Text } from "@oh-my-pi/pi-tui";
10
9
  import { prompt } from "@oh-my-pi/pi-utils";
11
- import { type Static, Type } from "@sinclair/typebox";
10
+ import * as z from "zod/v4";
12
11
  import {
13
12
  type DapBreakpointRecord,
14
13
  type DapCapabilities,
@@ -51,8 +50,8 @@ import { ToolError } from "./tool-errors";
51
50
  import { toolResult } from "./tool-result";
52
51
  import { clampTimeout } from "./tool-timeouts";
53
52
 
54
- const debugSchema = Type.Object({
55
- action: StringEnum([
53
+ const debugSchema = z.object({
54
+ action: z.enum([
56
55
  "launch",
57
56
  "attach",
58
57
  "set_breakpoint",
@@ -81,47 +80,45 @@ const debugSchema = Type.Object({
81
80
  "output",
82
81
  "terminate",
83
82
  "sessions",
84
- ]),
85
- program: Type.Optional(Type.String({ description: "program path" })),
86
- args: Type.Optional(Type.Array(Type.String(), { description: "program arguments" })),
87
- adapter: Type.Optional(Type.String({ description: "debugger adapter (gdb, lldb-dap, debugpy, dlv)" })),
88
- cwd: Type.Optional(Type.String()),
89
- file: Type.Optional(Type.String({ description: "source file" })),
90
- line: Type.Optional(Type.Number({ description: "source line" })),
91
- function: Type.Optional(Type.String({ description: "function name" })),
92
- name: Type.Optional(Type.String({ description: "variable or data name" })),
93
- condition: Type.Optional(Type.String({ description: "breakpoint condition" })),
94
- hit_condition: Type.Optional(Type.String()),
95
- expression: Type.Optional(Type.String({ description: "expression to evaluate" })),
96
- context: Type.Optional(
97
- Type.String({ description: "evaluate context: watch | repl | hover | variables | clipboard" }),
98
- ),
99
- frame_id: Type.Optional(Type.Number()),
100
- scope_id: Type.Optional(Type.Number({ description: "scope variables reference" })),
101
- variable_ref: Type.Optional(Type.Number({ description: "variable reference" })),
102
- pid: Type.Optional(Type.Number({ description: "process id for attach" })),
103
- port: Type.Optional(Type.Number({ description: "remote attach port" })),
104
- host: Type.Optional(Type.String({ description: "remote attach host" })),
105
- levels: Type.Optional(Type.Number({ description: "max stack frames" })),
106
- memory_reference: Type.Optional(Type.String({ description: "memory reference or address" })),
107
- instruction_reference: Type.Optional(Type.String()),
108
- instruction_count: Type.Optional(Type.Number()),
109
- instruction_offset: Type.Optional(Type.Number()),
110
- count: Type.Optional(Type.Number({ description: "bytes to read" })),
111
- data: Type.Optional(Type.String({ description: "base64 memory payload" })),
112
- data_id: Type.Optional(Type.String({ description: "data breakpoint id" })),
113
- access_type: Type.Optional(StringEnum(["read", "write", "readWrite"])),
114
- command: Type.Optional(Type.String({ description: "custom dap request command" })),
115
- arguments: Type.Optional(Type.Record(Type.String(), Type.Any(), { description: "custom request arguments" })),
116
- offset: Type.Optional(Type.Number()),
117
- resolve_symbols: Type.Optional(Type.Boolean()),
118
- allow_partial: Type.Optional(Type.Boolean()),
119
- start_module: Type.Optional(Type.Number()),
120
- module_count: Type.Optional(Type.Number()),
121
- timeout: Type.Optional(Type.Number({ description: "per-request timeout seconds" })),
83
+ ] as const),
84
+ program: z.string().describe("program path").optional(),
85
+ args: z.array(z.string()).describe("program arguments").optional(),
86
+ adapter: z.string().describe("debugger adapter (gdb, lldb-dap, debugpy, dlv)").optional(),
87
+ cwd: z.string().optional(),
88
+ file: z.string().describe("source file").optional(),
89
+ line: z.number().describe("source line").optional(),
90
+ function: z.string().describe("function name").optional(),
91
+ name: z.string().describe("variable or data name").optional(),
92
+ condition: z.string().describe("breakpoint condition").optional(),
93
+ hit_condition: z.string().optional(),
94
+ expression: z.string().describe("expression to evaluate").optional(),
95
+ context: z.string().describe("evaluate context: watch | repl | hover | variables | clipboard").optional(),
96
+ frame_id: z.number().optional(),
97
+ scope_id: z.number().describe("scope variables reference").optional(),
98
+ variable_ref: z.number().describe("variable reference").optional(),
99
+ pid: z.number().describe("process id for attach").optional(),
100
+ port: z.number().describe("remote attach port").optional(),
101
+ host: z.string().describe("remote attach host").optional(),
102
+ levels: z.number().describe("max stack frames").optional(),
103
+ memory_reference: z.string().describe("memory reference or address").optional(),
104
+ instruction_reference: z.string().optional(),
105
+ instruction_count: z.number().optional(),
106
+ instruction_offset: z.number().optional(),
107
+ count: z.number().describe("bytes to read").optional(),
108
+ data: z.string().describe("base64 memory payload").optional(),
109
+ data_id: z.string().describe("data breakpoint id").optional(),
110
+ access_type: z.enum(["read", "write", "readWrite"] as const).optional(),
111
+ command: z.string().describe("custom dap request command").optional(),
112
+ arguments: z.record(z.string(), z.any()).describe("custom request arguments").optional(),
113
+ offset: z.number().optional(),
114
+ resolve_symbols: z.boolean().optional(),
115
+ allow_partial: z.boolean().optional(),
116
+ start_module: z.number().optional(),
117
+ module_count: z.number().optional(),
118
+ timeout: z.number().describe("per-request timeout seconds").optional(),
122
119
  });
123
120
 
124
- export type DebugParams = Static<typeof debugSchema>;
121
+ export type DebugParams = z.infer<typeof debugSchema>;
125
122
  export type DebugAction = DebugParams["action"];
126
123
 
127
124
  interface DebugToolDetails {
package/src/tools/eval.ts CHANGED
@@ -3,7 +3,7 @@ import type { ImageContent } from "@oh-my-pi/pi-ai";
3
3
  import type { Component } from "@oh-my-pi/pi-tui";
4
4
  import { Markdown, Text } from "@oh-my-pi/pi-tui";
5
5
  import { prompt } from "@oh-my-pi/pi-utils";
6
- import { type Static, Type } from "@sinclair/typebox";
6
+ import * as z from "zod/v4";
7
7
  import { jsBackend, parseEvalInput, pythonBackend, sniffEvalLanguage } from "../eval";
8
8
  import type { ExecutorBackend } from "../eval/backend";
9
9
  import evalGrammar from "../eval/eval.lark" with { type: "text" };
@@ -16,7 +16,12 @@ import evalDescription from "../prompts/tools/eval.md" with { type: "text" };
16
16
  import { DEFAULT_MAX_BYTES, OutputSink, type OutputSummary, TailBuffer } from "../session/streaming-output";
17
17
  import { getTreeBranch, getTreeContinuePrefix, renderCodeCell } from "../tui";
18
18
  import { resolveEvalBackends, type ToolSession } from ".";
19
- import { formatStyledTruncationWarning, resolveOutputMaxColumns, resolveOutputSinkHeadBytes } from "./output-meta";
19
+ import {
20
+ formatStyledTruncationWarning,
21
+ resolveOutputMaxColumns,
22
+ resolveOutputSinkHeadBytes,
23
+ stripOutputNotice,
24
+ } from "./output-meta";
20
25
  import { formatTitle, replaceTabs, shortenPath, truncateToWidth, wrapBrackets } from "./render-utils";
21
26
  import { ToolAbortError, ToolError } from "./tool-errors";
22
27
  import { toolResult } from "./tool-result";
@@ -24,12 +29,10 @@ import { clampTimeout } from "./tool-timeouts";
24
29
 
25
30
  export const EVAL_DEFAULT_PREVIEW_LINES = 10;
26
31
 
27
- export const evalSchema = Type.Object({
28
- input: Type.String({
29
- description: 'eval input as a sequence of `*** Cell <lang>:"title"` cell headers followed by code',
30
- }),
32
+ export const evalSchema = z.object({
33
+ input: z.string().describe('eval input as a sequence of `*** Cell <lang>:"title"` cell headers followed by code'),
31
34
  });
32
- export type EvalToolParams = Static<typeof evalSchema>;
35
+ export type EvalToolParams = z.infer<typeof evalSchema>;
33
36
 
34
37
  export type EvalToolResult = {
35
38
  content: Array<{ type: "text"; text: string }>;
@@ -223,7 +226,7 @@ export class EvalTool implements AgentTool<typeof evalSchema> {
223
226
  readonly parameters = evalSchema;
224
227
  readonly concurrency = "exclusive";
225
228
  readonly strict = true;
226
- readonly intent = (args: Partial<Static<typeof evalSchema>>): string | undefined => {
229
+ readonly intent = (args: Partial<z.infer<typeof evalSchema>>): string | undefined => {
227
230
  const input = args.input;
228
231
  if (input) {
229
232
  try {
@@ -249,7 +252,7 @@ export class EvalTool implements AgentTool<typeof evalSchema> {
249
252
 
250
253
  async execute(
251
254
  _toolCallId: string,
252
- params: Static<typeof evalSchema>,
255
+ params: z.infer<typeof evalSchema>,
253
256
  signal?: AbortSignal,
254
257
  onUpdate?: AgentToolUpdateCallback,
255
258
  _ctx?: AgentToolContext,
@@ -922,8 +925,11 @@ export const evalToolRenderer = {
922
925
  ): Component {
923
926
  const details = result.details;
924
927
 
925
- const output =
928
+ const rawOutput =
926
929
  options.renderContext?.output ?? (result.content?.find(c => c.type === "text")?.text ?? "").trimEnd();
930
+ // Strip the LLM-facing notice (appended by wrappedExecute) before display;
931
+ // the styled `warningLine` below carries the same text in ⟨…⟩ form.
932
+ const output = stripOutputNotice(rawOutput, details?.meta).trimEnd();
927
933
 
928
934
  const jsonOutputs = details?.jsonOutputs ?? [];
929
935
  const jsonLines = jsonOutputs.flatMap((value, index) => {
package/src/tools/find.ts CHANGED
@@ -5,8 +5,7 @@ import * as natives from "@oh-my-pi/pi-natives";
5
5
  import type { Component } from "@oh-my-pi/pi-tui";
6
6
  import { Text } from "@oh-my-pi/pi-tui";
7
7
  import { isEnoent, prompt, untilAborted } from "@oh-my-pi/pi-utils";
8
- import type { Static } from "@sinclair/typebox";
9
- import { Type } from "@sinclair/typebox";
8
+ import * as z from "zod/v4";
10
9
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
11
10
  import { InternalUrlRouter } from "../internal-urls";
12
11
  import type { Theme } from "../modes/theme/theme";
@@ -35,17 +34,15 @@ import {
35
34
  import { ToolAbortError, ToolError, throwIfAborted } from "./tool-errors";
36
35
  import { toolResult } from "./tool-result";
37
36
 
38
- const findSchema = Type.Object({
39
- paths: Type.Array(Type.String({ description: "glob including search path" }), {
40
- minItems: 1,
41
- description: "globs including search paths",
42
- examples: [["src/**/*.ts"], ["lib/*.json"], ["apps/", "packages/"], ["*.ts"]],
43
- }),
44
- hidden: Type.Optional(Type.Boolean({ description: "include hidden files", default: true })),
45
- limit: Type.Optional(Type.Number({ description: "max results", default: 1000 })),
46
- });
37
+ const findSchema = z
38
+ .object({
39
+ paths: z.array(z.string().describe("glob including search path")).min(1).describe("globs including search paths"),
40
+ hidden: z.boolean().default(true).describe("include hidden files").optional(),
41
+ limit: z.number().default(1000).describe("max results").optional(),
42
+ })
43
+ .strict();
47
44
 
48
- export type FindToolInput = Static<typeof findSchema>;
45
+ export type FindToolInput = z.infer<typeof findSchema>;
49
46
 
50
47
  const DEFAULT_LIMIT = 1000;
51
48
  const GLOB_TIMEOUT_MS = 5000;
@@ -107,7 +104,7 @@ export class FindTool implements AgentTool<typeof findSchema, FindToolDetails> {
107
104
 
108
105
  async execute(
109
106
  _toolCallId: string,
110
- params: Static<typeof findSchema>,
107
+ params: z.infer<typeof findSchema>,
111
108
  signal?: AbortSignal,
112
109
  onUpdate?: AgentToolUpdateCallback<FindToolDetails>,
113
110
  _context?: AgentToolContext,