@oh-my-pi/pi-coding-agent 16.0.5 → 16.0.6

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 (223) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/cli.js +1927 -1376
  3. package/dist/types/advisor/advise-tool.d.ts +22 -19
  4. package/dist/types/autoresearch/tools/init-experiment.d.ts +13 -17
  5. package/dist/types/autoresearch/tools/log-experiment.d.ts +17 -19
  6. package/dist/types/autoresearch/tools/run-experiment.d.ts +3 -4
  7. package/dist/types/autoresearch/tools/update-notes.d.ts +4 -5
  8. package/dist/types/cli/ttsr-cli.d.ts +39 -0
  9. package/dist/types/commands/ttsr.d.ts +57 -0
  10. package/dist/types/commit/agentic/tools/analyze-file.d.ts +4 -5
  11. package/dist/types/commit/agentic/tools/git-file-diff.d.ts +4 -5
  12. package/dist/types/commit/agentic/tools/git-hunk.d.ts +5 -6
  13. package/dist/types/commit/agentic/tools/git-overview.d.ts +4 -5
  14. package/dist/types/commit/agentic/tools/propose-changelog.d.ts +23 -24
  15. package/dist/types/commit/agentic/tools/propose-commit.d.ts +11 -32
  16. package/dist/types/commit/agentic/tools/recent-commits.d.ts +3 -4
  17. package/dist/types/commit/agentic/tools/schemas.d.ts +6 -27
  18. package/dist/types/commit/agentic/tools/split-commit.d.ts +28 -49
  19. package/dist/types/commit/changelog/generate.d.ts +12 -13
  20. package/dist/types/commit/shared-llm.d.ts +10 -37
  21. package/dist/types/config/config-file.d.ts +4 -4
  22. package/dist/types/config/keybindings.d.ts +5 -0
  23. package/dist/types/config/models-config-schema.d.ts +625 -990
  24. package/dist/types/config/models-config.d.ts +229 -217
  25. package/dist/types/config/settings-schema.d.ts +53 -23
  26. package/dist/types/edit/hashline/params.d.ts +7 -11
  27. package/dist/types/edit/index.d.ts +2 -1
  28. package/dist/types/edit/modes/apply-patch.d.ts +4 -5
  29. package/dist/types/edit/modes/patch.d.ts +15 -24
  30. package/dist/types/edit/modes/replace.d.ts +16 -17
  31. package/dist/types/eval/js/index.d.ts +1 -0
  32. package/dist/types/extensibility/custom-commands/types.d.ts +6 -3
  33. package/dist/types/extensibility/custom-tools/types.d.ts +8 -5
  34. package/dist/types/extensibility/extensions/types.d.ts +6 -3
  35. package/dist/types/extensibility/hooks/types.d.ts +7 -4
  36. package/dist/types/extensibility/legacy-pi-ai-shim.d.ts +13 -5
  37. package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +17 -0
  38. package/dist/types/extensibility/typebox.d.ts +80 -58
  39. package/dist/types/goals/tools/goal-tool.d.ts +11 -24
  40. package/dist/types/index.d.ts +2 -0
  41. package/dist/types/lsp/index.d.ts +11 -26
  42. package/dist/types/lsp/types.d.ts +12 -28
  43. package/dist/types/mcp/client.d.ts +8 -0
  44. package/dist/types/modes/components/btw-panel.d.ts +1 -0
  45. package/dist/types/modes/components/custom-editor.d.ts +3 -1
  46. package/dist/types/modes/controllers/btw-controller.d.ts +2 -0
  47. package/dist/types/modes/controllers/input-controller.d.ts +1 -0
  48. package/dist/types/modes/interactive-mode.d.ts +3 -0
  49. package/dist/types/modes/setup-wizard/index.d.ts +1 -0
  50. package/dist/types/modes/setup-wizard/startup-splash.d.ts +7 -0
  51. package/dist/types/modes/theme/theme.d.ts +1 -1
  52. package/dist/types/modes/types.d.ts +3 -0
  53. package/dist/types/sdk.d.ts +5 -0
  54. package/dist/types/session/agent-session.d.ts +4 -0
  55. package/dist/types/startup-splash.d.ts +12 -0
  56. package/dist/types/task/types.d.ts +47 -48
  57. package/dist/types/tools/ask.d.ts +26 -27
  58. package/dist/types/tools/ast-edit.d.ts +17 -17
  59. package/dist/types/tools/ast-grep.d.ts +12 -13
  60. package/dist/types/tools/bash.d.ts +20 -17
  61. package/dist/types/tools/browser.d.ts +46 -71
  62. package/dist/types/tools/checkpoint.d.ts +14 -15
  63. package/dist/types/tools/debug.d.ts +82 -145
  64. package/dist/types/tools/eval.d.ts +30 -40
  65. package/dist/types/tools/find.d.ts +17 -18
  66. package/dist/types/tools/gh.d.ts +49 -78
  67. package/dist/types/tools/image-gen.d.ts +20 -36
  68. package/dist/types/tools/inspect-image.d.ts +10 -11
  69. package/dist/types/tools/irc.d.ts +22 -33
  70. package/dist/types/tools/job.d.ts +11 -12
  71. package/dist/types/tools/learn.d.ts +21 -28
  72. package/dist/types/tools/manage-skill.d.ts +13 -22
  73. package/dist/types/tools/memory-edit.d.ts +15 -24
  74. package/dist/types/tools/memory-recall.d.ts +7 -8
  75. package/dist/types/tools/memory-reflect.d.ts +9 -10
  76. package/dist/types/tools/memory-retain.d.ts +13 -14
  77. package/dist/types/tools/read.d.ts +7 -8
  78. package/dist/types/tools/resolve.d.ts +11 -18
  79. package/dist/types/tools/review.d.ts +9 -15
  80. package/dist/types/tools/search-tool-bm25.d.ts +9 -10
  81. package/dist/types/tools/search.d.ts +16 -17
  82. package/dist/types/tools/ssh.d.ts +14 -15
  83. package/dist/types/tools/todo.d.ts +27 -43
  84. package/dist/types/tools/tts.d.ts +8 -9
  85. package/dist/types/tools/write.d.ts +9 -10
  86. package/dist/types/tui/index.d.ts +1 -0
  87. package/dist/types/tui/width-aware-text.d.ts +23 -0
  88. package/dist/types/utils/markit.d.ts +10 -1
  89. package/dist/types/web/search/index.d.ts +17 -28
  90. package/dist/types/web/search/providers/perplexity.d.ts +0 -2
  91. package/dist/types/web/search/types.d.ts +32 -26
  92. package/package.json +14 -13
  93. package/scripts/omp +1 -1
  94. package/src/advisor/__tests__/advisor.test.ts +44 -1
  95. package/src/advisor/advise-tool.ts +34 -11
  96. package/src/autoresearch/tools/init-experiment.ts +13 -16
  97. package/src/autoresearch/tools/log-experiment.ts +15 -18
  98. package/src/autoresearch/tools/run-experiment.ts +3 -3
  99. package/src/autoresearch/tools/update-notes.ts +4 -4
  100. package/src/cli/ttsr-cli.ts +995 -0
  101. package/src/cli-commands.ts +1 -0
  102. package/src/cli.ts +7 -1
  103. package/src/commands/ttsr.ts +125 -0
  104. package/src/commit/agentic/tools/analyze-file.ts +4 -4
  105. package/src/commit/agentic/tools/git-file-diff.ts +4 -4
  106. package/src/commit/agentic/tools/git-hunk.ts +7 -5
  107. package/src/commit/agentic/tools/git-overview.ts +4 -4
  108. package/src/commit/agentic/tools/propose-changelog.ts +18 -15
  109. package/src/commit/agentic/tools/propose-commit.ts +6 -6
  110. package/src/commit/agentic/tools/recent-commits.ts +3 -3
  111. package/src/commit/agentic/tools/schemas.ts +8 -20
  112. package/src/commit/agentic/tools/split-commit.ts +19 -23
  113. package/src/commit/analysis/summary.ts +7 -5
  114. package/src/commit/changelog/generate.ts +15 -11
  115. package/src/commit/shared-llm.ts +17 -24
  116. package/src/config/config-file.ts +13 -15
  117. package/src/config/keybindings.ts +6 -0
  118. package/src/config/models-config-schema.ts +206 -179
  119. package/src/config/settings-schema.ts +34 -0
  120. package/src/discovery/builtin-rules/index.ts +2 -0
  121. package/src/discovery/builtin-rules/ts-import-type.md +2 -2
  122. package/src/discovery/builtin-rules/ts-no-any.md +11 -2
  123. package/src/discovery/builtin-rules/ts-no-inline-cast-access.md +55 -0
  124. package/src/edit/hashline/params.ts +12 -11
  125. package/src/edit/index.ts +5 -4
  126. package/src/edit/modes/apply-patch.ts +4 -4
  127. package/src/edit/modes/patch.ts +15 -18
  128. package/src/edit/modes/replace.ts +13 -17
  129. package/src/edit/renderer.ts +0 -1
  130. package/src/eval/agent-bridge.ts +11 -13
  131. package/src/eval/completion-bridge.ts +25 -17
  132. package/src/eval/js/context-manager.ts +17 -2
  133. package/src/eval/js/index.ts +1 -1
  134. package/src/eval/py/executor.ts +2 -2
  135. package/src/extensibility/custom-commands/loader.ts +5 -3
  136. package/src/extensibility/custom-commands/types.ts +6 -3
  137. package/src/extensibility/custom-tools/loader.ts +4 -2
  138. package/src/extensibility/custom-tools/types.ts +8 -5
  139. package/src/extensibility/extensions/loader.ts +4 -2
  140. package/src/extensibility/extensions/types.ts +6 -3
  141. package/src/extensibility/hooks/loader.ts +5 -2
  142. package/src/extensibility/hooks/types.ts +7 -4
  143. package/src/extensibility/legacy-pi-ai-shim.ts +42 -5
  144. package/src/extensibility/legacy-pi-coding-agent-shim.ts +113 -0
  145. package/src/extensibility/plugins/legacy-pi-compat.ts +13 -13
  146. package/src/extensibility/tool-proxy.ts +4 -1
  147. package/src/extensibility/typebox.ts +778 -251
  148. package/src/goals/guided-setup.ts +12 -3
  149. package/src/goals/tools/goal-tool.ts +6 -6
  150. package/src/index.ts +2 -0
  151. package/src/internal-urls/docs-index.generated.ts +11 -9
  152. package/src/lsp/types.ts +13 -27
  153. package/src/main.ts +19 -18
  154. package/src/mcp/client.ts +38 -13
  155. package/src/mcp/render.ts +102 -89
  156. package/src/modes/components/agent-hub.ts +11 -4
  157. package/src/modes/components/btw-panel.ts +5 -1
  158. package/src/modes/components/custom-editor.ts +18 -0
  159. package/src/modes/components/status-line/component.ts +8 -1
  160. package/src/modes/components/tool-execution.ts +17 -10
  161. package/src/modes/controllers/btw-controller.ts +69 -1
  162. package/src/modes/controllers/input-controller.ts +29 -0
  163. package/src/modes/interactive-mode.ts +38 -8
  164. package/src/modes/setup-wizard/index.ts +1 -0
  165. package/src/modes/setup-wizard/scenes/sign-in.ts +77 -5
  166. package/src/modes/setup-wizard/startup-splash.ts +107 -0
  167. package/src/modes/theme/theme.ts +133 -143
  168. package/src/modes/types.ts +3 -0
  169. package/src/modes/utils/context-usage.ts +9 -5
  170. package/src/modes/utils/hotkeys-markdown.ts +1 -0
  171. package/src/prompts/system/system-prompt.md +1 -0
  172. package/src/sdk.ts +21 -4
  173. package/src/session/agent-session.ts +160 -33
  174. package/src/session/session-history-format.ts +11 -2
  175. package/src/session/snapcompact-inline.ts +1 -1
  176. package/src/slash-commands/builtin-registry.ts +4 -11
  177. package/src/startup-splash.ts +19 -0
  178. package/src/task/executor.ts +11 -6
  179. package/src/task/types.ts +44 -41
  180. package/src/tool-discovery/tool-index.ts +17 -4
  181. package/src/tools/ask.ts +14 -14
  182. package/src/tools/ast-edit.ts +17 -14
  183. package/src/tools/ast-grep.ts +10 -9
  184. package/src/tools/bash.ts +15 -10
  185. package/src/tools/browser/launch.ts +13 -0
  186. package/src/tools/browser.ts +26 -32
  187. package/src/tools/checkpoint.ts +7 -7
  188. package/src/tools/debug.ts +72 -69
  189. package/src/tools/eval.ts +18 -19
  190. package/src/tools/find.ts +20 -13
  191. package/src/tools/gh.ts +29 -49
  192. package/src/tools/image-gen.ts +27 -32
  193. package/src/tools/inspect-image.ts +8 -9
  194. package/src/tools/irc.ts +12 -12
  195. package/src/tools/job.ts +6 -6
  196. package/src/tools/learn.ts +11 -14
  197. package/src/tools/manage-skill.ts +19 -23
  198. package/src/tools/memory-edit.ts +8 -8
  199. package/src/tools/memory-recall.ts +4 -4
  200. package/src/tools/memory-reflect.ts +5 -5
  201. package/src/tools/memory-retain.ts +9 -11
  202. package/src/tools/puppeteer/02_stealth_hairline.txt +1 -1
  203. package/src/tools/puppeteer/04_stealth_iframe.txt +4 -4
  204. package/src/tools/puppeteer/05_stealth_webgl.txt +1 -1
  205. package/src/tools/puppeteer/10_stealth_plugins.txt +6 -4
  206. package/src/tools/puppeteer/12_stealth_codecs.txt +2 -2
  207. package/src/tools/puppeteer/13_stealth_worker.txt +1 -1
  208. package/src/tools/read.ts +169 -13
  209. package/src/tools/report-tool-issue.ts +6 -6
  210. package/src/tools/resolve.ts +6 -6
  211. package/src/tools/review.ts +10 -12
  212. package/src/tools/search-tool-bm25.ts +5 -5
  213. package/src/tools/search.ts +20 -29
  214. package/src/tools/ssh.ts +8 -8
  215. package/src/tools/todo.ts +16 -19
  216. package/src/tools/tts.ts +16 -15
  217. package/src/tools/write.ts +5 -5
  218. package/src/tui/index.ts +1 -0
  219. package/src/tui/width-aware-text.ts +58 -0
  220. package/src/utils/markit.ts +17 -2
  221. package/src/web/search/index.ts +9 -9
  222. package/src/web/search/providers/perplexity.ts +373 -126
  223. package/src/web/search/types.ts +28 -48
@@ -1,19 +1,18 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
2
  import type { Component } from "@oh-my-pi/pi-tui";
3
- import { z } from "zod/v4";
4
3
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
5
4
  import type { Theme } from "../modes/theme/theme";
6
5
  import { type TruncationResult } from "../session/streaming-output";
7
6
  import type { ToolSession } from ".";
8
7
  import type { OutputMeta } from "./output-meta";
9
- declare const searchSchema: z.ZodObject<{
10
- pattern: z.ZodString;
11
- paths: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
12
- i: z.ZodOptional<z.ZodBoolean>;
13
- gitignore: z.ZodOptional<z.ZodBoolean>;
14
- skip: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
15
- }, z.core.$strict>;
16
- export type SearchToolInput = z.infer<typeof searchSchema>;
8
+ declare const searchSchema: import("arktype/internal/variants/object.ts").ObjectType<{
9
+ pattern: string;
10
+ paths?: string | string[] | undefined;
11
+ i?: boolean | undefined;
12
+ gitignore?: boolean | undefined;
13
+ skip?: number | null | undefined;
14
+ }, {}>;
15
+ export type SearchToolInput = typeof searchSchema.infer;
17
16
  export declare function toPathList(input: string | string[] | undefined): string[];
18
17
  /** Maximum number of distinct files surfaced in a single response. The
19
18
  * agent paginates further pages via `skip`. */
@@ -56,7 +55,7 @@ export interface SearchToolDetails {
56
55
  * non-fatal warning in the renderer and in the model-facing text. */
57
56
  missingPaths?: string[];
58
57
  }
59
- type SearchParams = z.infer<typeof searchSchema>;
58
+ type SearchParams = typeof searchSchema.infer;
60
59
  export declare class SearchTool implements AgentTool<typeof searchSchema, SearchToolDetails> {
61
60
  private readonly session;
62
61
  readonly name = "search";
@@ -65,13 +64,13 @@ export declare class SearchTool implements AgentTool<typeof searchSchema, Search
65
64
  readonly loadMode = "discoverable";
66
65
  readonly summary = "Search file contents using ripgrep (fast text search)";
67
66
  readonly description: string;
68
- readonly parameters: z.ZodObject<{
69
- pattern: z.ZodString;
70
- paths: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
71
- i: z.ZodOptional<z.ZodBoolean>;
72
- gitignore: z.ZodOptional<z.ZodBoolean>;
73
- skip: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
74
- }, z.core.$strict>;
67
+ readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
68
+ pattern: string;
69
+ paths?: string | string[] | undefined;
70
+ i?: boolean | undefined;
71
+ gitignore?: boolean | undefined;
72
+ skip?: number | null | undefined;
73
+ }, {}>;
75
74
  readonly strict = true;
76
75
  constructor(session: ToolSession);
77
76
  execute(_toolCallId: string, params: SearchParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<SearchToolDetails>, _toolContext?: AgentToolContext): Promise<AgentToolResult<SearchToolDetails>>;
@@ -1,22 +1,21 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
2
  import type { ToolExample } from "@oh-my-pi/pi-ai";
3
3
  import type { Component } from "@oh-my-pi/pi-tui";
4
- import { z } from "zod/v4";
5
4
  import type { SSHHost } from "../capability/ssh";
6
5
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
7
6
  import type { Theme } from "../modes/theme/theme";
8
7
  import type { ToolSession } from ".";
9
8
  import { type OutputMeta } from "./output-meta";
10
- declare const sshSchema: z.ZodObject<{
11
- host: z.ZodString;
12
- command: z.ZodString;
13
- cwd: z.ZodOptional<z.ZodString>;
14
- timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
15
- }, z.core.$strip>;
9
+ declare const sshSchema: import("arktype/internal/variants/object.ts").ObjectType<{
10
+ host: string;
11
+ command: string;
12
+ cwd?: string | undefined;
13
+ timeout?: number | undefined;
14
+ }, {}>;
16
15
  export interface SSHToolDetails {
17
16
  meta?: OutputMeta;
18
17
  }
19
- type SshToolParams = z.infer<typeof sshSchema>;
18
+ type SshToolParams = typeof sshSchema.infer;
20
19
  export declare class SshTool implements AgentTool<typeof sshSchema, SSHToolDetails> {
21
20
  #private;
22
21
  private readonly session;
@@ -29,15 +28,15 @@ export declare class SshTool implements AgentTool<typeof sshSchema, SSHToolDetai
29
28
  readonly summary = "Execute a command on a remote host over SSH";
30
29
  readonly loadMode = "discoverable";
31
30
  readonly label = "SSH";
32
- readonly parameters: z.ZodObject<{
33
- host: z.ZodString;
34
- command: z.ZodString;
35
- cwd: z.ZodOptional<z.ZodString>;
36
- timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
37
- }, z.core.$strip>;
31
+ readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
32
+ host: string;
33
+ command: string;
34
+ cwd?: string | undefined;
35
+ timeout?: number | undefined;
36
+ }, {}>;
38
37
  readonly concurrency = "exclusive";
39
38
  readonly strict = true;
40
- readonly examples: readonly ToolExample<z.input<typeof sshSchema>>[];
39
+ readonly examples: readonly ToolExample<SshToolParams>[];
41
40
  constructor(session: ToolSession, hostNames: string[], hostsByName: Map<string, SSHHost>, description: string);
42
41
  execute(_toolCallId: string, { host, command, cwd, timeout: rawTimeout }: SshToolParams, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<SSHToolDetails>, _ctx?: AgentToolContext): Promise<AgentToolResult<SSHToolDetails>>;
43
42
  }
@@ -1,7 +1,6 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
2
  import type { ToolExample } from "@oh-my-pi/pi-ai";
3
3
  import type { Component } from "@oh-my-pi/pi-tui";
4
- import { z } from "zod/v4";
5
4
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
6
5
  import type { Theme } from "../modes/theme/theme";
7
6
  import type { ToolSession } from "../sdk";
@@ -24,27 +23,20 @@ export interface TodoToolDetails {
24
23
  storage: "session" | "memory";
25
24
  completedTasks?: TodoCompletionTransition[];
26
25
  }
27
- declare const todoSchema: z.ZodObject<{
28
- ops: z.ZodArray<z.ZodObject<{
29
- op: z.ZodEnum<{
30
- append: "append";
31
- done: "done";
32
- drop: "drop";
33
- init: "init";
34
- rm: "rm";
35
- start: "start";
36
- view: "view";
37
- }>;
38
- list: z.ZodOptional<z.ZodArray<z.ZodObject<{
39
- phase: z.ZodString;
40
- items: z.ZodArray<z.ZodString>;
41
- }, z.core.$strip>>>;
42
- task: z.ZodOptional<z.ZodString>;
43
- phase: z.ZodOptional<z.ZodString>;
44
- items: z.ZodOptional<z.ZodArray<z.ZodString>>;
45
- }, z.core.$strip>>;
46
- }, z.core.$strip>;
47
- type TodoParams = z.infer<typeof todoSchema>;
26
+ declare const todoSchema: import("arktype/internal/variants/object.ts").ObjectType<{
27
+ ops: {
28
+ op: "append" | "done" | "drop" | "init" | "rm" | "start" | "view";
29
+ list?: {
30
+ phase: string;
31
+ items: string[];
32
+ }[] | undefined;
33
+ task?: string | undefined;
34
+ phase?: string | undefined;
35
+ items?: string[] | undefined;
36
+ }[];
37
+ }, {}>;
38
+ type TodoParams = TodoSchema;
39
+ type TodoSchema = typeof todoSchema.infer;
48
40
  export declare const USER_TODO_EDIT_CUSTOM_TYPE = "user_todo_edit";
49
41
  export declare function getLatestTodoPhasesFromEntries(entries: SessionEntry[]): TodoPhase[];
50
42
  /**
@@ -96,29 +88,21 @@ export declare class TodoTool implements AgentTool<typeof todoSchema, TodoToolDe
96
88
  readonly label = "Todo";
97
89
  readonly summary = "Write a structured todo list to track progress within a session";
98
90
  readonly description: string;
99
- readonly parameters: z.ZodObject<{
100
- ops: z.ZodArray<z.ZodObject<{
101
- op: z.ZodEnum<{
102
- append: "append";
103
- done: "done";
104
- drop: "drop";
105
- init: "init";
106
- rm: "rm";
107
- start: "start";
108
- view: "view";
109
- }>;
110
- list: z.ZodOptional<z.ZodArray<z.ZodObject<{
111
- phase: z.ZodString;
112
- items: z.ZodArray<z.ZodString>;
113
- }, z.core.$strip>>>;
114
- task: z.ZodOptional<z.ZodString>;
115
- phase: z.ZodOptional<z.ZodString>;
116
- items: z.ZodOptional<z.ZodArray<z.ZodString>>;
117
- }, z.core.$strip>>;
118
- }, z.core.$strip>;
91
+ readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
92
+ ops: {
93
+ op: "append" | "done" | "drop" | "init" | "rm" | "start" | "view";
94
+ list?: {
95
+ phase: string;
96
+ items: string[];
97
+ }[] | undefined;
98
+ task?: string | undefined;
99
+ phase?: string | undefined;
100
+ items?: string[] | undefined;
101
+ }[];
102
+ }, {}>;
119
103
  readonly concurrency = "exclusive";
120
104
  readonly strict = true;
121
- readonly examples: readonly ToolExample<z.input<typeof todoSchema>>[];
105
+ readonly examples: readonly ToolExample<typeof todoSchema.infer>[];
122
106
  readonly loadMode = "discoverable";
123
107
  constructor(session: ToolSession);
124
108
  execute(_toolCallId: string, params: TodoParams, _signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<TodoToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<TodoToolDetails>>;
@@ -1,15 +1,14 @@
1
- import { z } from "zod/v4";
2
1
  import type { CustomTool } from "../extensibility/custom-tools/types";
3
2
  type TtsCodec = "mp3" | "wav";
4
3
  type TtsBackend = "local" | "xai";
5
- declare const ttsSchema: z.ZodObject<{
6
- text: z.ZodString;
7
- voice_id: z.ZodDefault<z.ZodString>;
8
- language: z.ZodDefault<z.ZodString>;
9
- output_path: z.ZodString;
10
- sample_rate: z.ZodOptional<z.ZodNumber>;
11
- bit_rate: z.ZodOptional<z.ZodNumber>;
12
- }, z.core.$strip>;
4
+ declare const ttsSchema: import("arktype/internal/variants/object.ts").ObjectType<{
5
+ text: string;
6
+ voice_id: import("arktype/internal/attributes.ts").Default<string, "eve">;
7
+ language: import("arktype/internal/attributes.ts").Default<string, "en">;
8
+ output_path: string;
9
+ sample_rate?: number | undefined;
10
+ bit_rate?: number | undefined;
11
+ }, {}>;
13
12
  interface TtsToolDetails {
14
13
  bytes: number;
15
14
  voiceId: string;
@@ -1,16 +1,15 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
2
  import type { Component } from "@oh-my-pi/pi-tui";
3
- import { z } from "zod/v4";
4
3
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
5
4
  import { type FileDiagnosticsResult } from "../lsp";
6
5
  import { type Theme } from "../modes/theme/theme";
7
6
  import type { ToolSession } from "../sdk";
8
7
  import { type OutputMeta } from "./output-meta";
9
- declare const writeSchema: z.ZodObject<{
10
- path: z.ZodString;
11
- content: z.ZodString;
12
- }, z.core.$strip>;
13
- export type WriteToolInput = z.infer<typeof writeSchema>;
8
+ declare const writeSchema: import("arktype/internal/variants/object.ts").ObjectType<{
9
+ path: string;
10
+ content: string;
11
+ }, {}>;
12
+ export type WriteToolInput = typeof writeSchema.infer;
14
13
  /** Details returned by the write tool for TUI rendering */
15
14
  export interface WriteToolDetails {
16
15
  diagnostics?: FileDiagnosticsResult;
@@ -35,10 +34,10 @@ export declare class WriteTool implements AgentTool<typeof writeSchema, WriteToo
35
34
  readonly formatApprovalDetails: (args: unknown) => string[];
36
35
  readonly label = "Write";
37
36
  readonly description: string;
38
- readonly parameters: z.ZodObject<{
39
- path: z.ZodString;
40
- content: z.ZodString;
41
- }, z.core.$strip>;
37
+ readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
38
+ path: string;
39
+ content: string;
40
+ }, {}>;
42
41
  readonly strict = true;
43
42
  readonly concurrency = "exclusive";
44
43
  readonly loadMode = "discoverable";
@@ -9,3 +9,4 @@ export * from "./status-line";
9
9
  export * from "./tree-list";
10
10
  export * from "./types";
11
11
  export * from "./utils";
12
+ export * from "./width-aware-text";
@@ -0,0 +1,23 @@
1
+ import { type Component } from "@oh-my-pi/pi-tui";
2
+ /**
3
+ * Text whose content is (re)formatted against the actual render width.
4
+ *
5
+ * A plain `Text` receives an already-formatted string and only wraps it at
6
+ * render time, so width-dependent layout (per-line truncation, inline previews)
7
+ * has to be decided before the width is known. Renderers used to cope by
8
+ * hard-capping output lines at a fixed column count (e.g. 80), which truncated
9
+ * to roughly a third of a wide terminal. This defers formatting to
10
+ * `render(width)`: it computes the same content width the inner `Text` uses
11
+ * (mirroring its tight-layout flag so the budget can't desync), hands that to
12
+ * the formatter, and delegates margins/background/vertical padding to the inner
13
+ * `Text`. Lines the formatter caps at `contentWidth` fit exactly and so never
14
+ * wrap.
15
+ */
16
+ export declare class WidthAwareText implements Component {
17
+ #private;
18
+ constructor(format: (contentWidth: number) => string, paddingX?: number, paddingY?: number);
19
+ setCustomBgFn(customBgFn?: (text: string) => string): void;
20
+ setIgnoreTight(ignore: boolean): this;
21
+ invalidate(): void;
22
+ render(width: number): readonly string[];
23
+ }
@@ -3,6 +3,15 @@ export interface MarkitConversionResult {
3
3
  ok: boolean;
4
4
  error?: string;
5
5
  }
6
+ export interface MarkitFileConversionOptions {
7
+ /**
8
+ * Directory the PDF converter writes extracted images/diagrams into. When
9
+ * set, each embedded image is rendered to `<id>.png` and referenced by path
10
+ * in the markdown; when unset, markit emits an `<!-- image: <id> ... -->`
11
+ * placeholder comment instead.
12
+ */
13
+ imageDir?: string;
14
+ }
6
15
  interface MuPdfWasmModuleConfig {
7
16
  print?: (...values: unknown[]) => void;
8
17
  printErr?: (...values: unknown[]) => void;
@@ -10,6 +19,6 @@ interface MuPdfWasmModuleConfig {
10
19
  declare global {
11
20
  var $libmupdf_wasm_Module: MuPdfWasmModuleConfig | undefined;
12
21
  }
13
- export declare function convertFileWithMarkit(filePath: string, signal?: AbortSignal): Promise<MarkitConversionResult>;
22
+ export declare function convertFileWithMarkit(filePath: string, signal?: AbortSignal, options?: MarkitFileConversionOptions): Promise<MarkitConversionResult>;
14
23
  export declare function convertBufferWithMarkit(buffer: Uint8Array, extension: string, signal?: AbortSignal): Promise<MarkitConversionResult>;
15
24
  export {};
@@ -6,26 +6,20 @@
6
6
  */
7
7
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
8
8
  import type { AuthStorage } from "@oh-my-pi/pi-ai";
9
- import { z } from "zod/v4";
10
9
  import type { CustomTool } from "../../extensibility/custom-tools/types";
11
10
  import type { ToolSession } from "../../tools";
12
11
  import { type SearchRenderDetails } from "./render";
13
12
  import type { SearchProviderId } from "./types";
14
13
  /** Web search tool parameters schema */
15
- export declare const webSearchSchema: z.ZodObject<{
16
- query: z.ZodString;
17
- recency: z.ZodOptional<z.ZodEnum<{
18
- day: "day";
19
- month: "month";
20
- week: "week";
21
- year: "year";
22
- }>>;
23
- limit: z.ZodOptional<z.ZodNumber>;
24
- max_tokens: z.ZodOptional<z.ZodNumber>;
25
- temperature: z.ZodOptional<z.ZodNumber>;
26
- num_search_results: z.ZodOptional<z.ZodNumber>;
27
- }, z.core.$strip>;
28
- export type SearchToolParams = z.infer<typeof webSearchSchema>;
14
+ export declare const webSearchSchema: import("arktype/internal/variants/object.ts").ObjectType<{
15
+ query: string;
16
+ recency?: "day" | "month" | "week" | "year" | undefined;
17
+ limit?: number | undefined;
18
+ max_tokens?: number | undefined;
19
+ temperature?: number | undefined;
20
+ num_search_results?: number | undefined;
21
+ }, {}>;
22
+ export type SearchToolParams = typeof webSearchSchema.infer;
29
23
  export interface SearchQueryParams extends SearchToolParams {
30
24
  provider?: SearchProviderId | "auto";
31
25
  }
@@ -58,19 +52,14 @@ export declare class WebSearchTool implements AgentTool<typeof webSearchSchema,
58
52
  readonly approval: "read";
59
53
  readonly label = "Web Search";
60
54
  readonly description: string;
61
- readonly parameters: z.ZodObject<{
62
- query: z.ZodString;
63
- recency: z.ZodOptional<z.ZodEnum<{
64
- day: "day";
65
- month: "month";
66
- week: "week";
67
- year: "year";
68
- }>>;
69
- limit: z.ZodOptional<z.ZodNumber>;
70
- max_tokens: z.ZodOptional<z.ZodNumber>;
71
- temperature: z.ZodOptional<z.ZodNumber>;
72
- num_search_results: z.ZodOptional<z.ZodNumber>;
73
- }, z.core.$strip>;
55
+ readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
56
+ query: string;
57
+ recency?: "day" | "month" | "week" | "year" | undefined;
58
+ limit?: number | undefined;
59
+ max_tokens?: number | undefined;
60
+ temperature?: number | undefined;
61
+ num_search_results?: number | undefined;
62
+ }, {}>;
74
63
  readonly strict = true;
75
64
  readonly loadMode = "discoverable";
76
65
  readonly summary = "Search the web for up-to-date information";
@@ -27,8 +27,6 @@ export interface PerplexitySearchParams {
27
27
  sessionId?: string;
28
28
  fetch?: FetchImpl;
29
29
  }
30
- /** Find PERPLEXITY_API_KEY from environment or .env files (also checks PPLX_API_KEY) */
31
- export declare function findApiKey(): string | null;
32
30
  /** Execute Perplexity web search */
33
31
  export declare function searchPerplexity(params: PerplexitySearchParams): Promise<SearchResponse>;
34
32
  /** Search provider for Perplexity. */
@@ -3,42 +3,22 @@
3
3
  *
4
4
  * Unified types for web search responses across supported providers.
5
5
  */
6
- export declare const SEARCH_PROVIDER_ORDER: readonly ["tavily", "perplexity", "brave", "jina", "kimi", "anthropic", "gemini", "codex", "zai", "exa", "parallel", "kagi", "synthetic", "searxng"];
7
- /** Supported web search providers */
8
- export type SearchProviderId = (typeof SEARCH_PROVIDER_ORDER)[number];
9
- export declare const SEARCH_PROVIDER_PREFERENCES: readonly ["auto", "tavily", "perplexity", "brave", "jina", "kimi", "anthropic", "gemini", "codex", "zai", "exa", "parallel", "kagi", "synthetic", "searxng"];
10
6
  export declare const SEARCH_PROVIDER_OPTIONS: readonly [{
11
7
  readonly value: "auto";
12
8
  readonly label: "Auto";
13
9
  readonly description: "Automatically uses the first configured web-search provider";
14
- }, {
15
- readonly value: "tavily";
16
- readonly label: "Tavily";
17
- readonly description: "Requires TAVILY_API_KEY";
18
10
  }, {
19
11
  readonly value: "perplexity";
20
12
  readonly label: "Perplexity";
21
13
  readonly description: "Uses auth when configured; explicit selection falls back to anonymous search";
22
14
  }, {
23
- readonly value: "brave";
24
- readonly label: "Brave";
25
- readonly description: "Requires BRAVE_API_KEY";
26
- }, {
27
- readonly value: "jina";
28
- readonly label: "Jina";
29
- readonly description: "Requires JINA_API_KEY";
30
- }, {
31
- readonly value: "kimi";
32
- readonly label: "Kimi";
33
- readonly description: "Requires MOONSHOT_SEARCH_API_KEY or MOONSHOT_API_KEY";
15
+ readonly value: "gemini";
16
+ readonly label: "Gemini";
17
+ readonly description: "Google Search grounding via Gemini (uses google-gemini-cli or google-antigravity OAuth)";
34
18
  }, {
35
19
  readonly value: "anthropic";
36
20
  readonly label: "Anthropic";
37
21
  readonly description: "Claude's native web_search tool (uses Anthropic OAuth or ANTHROPIC_API_KEY)";
38
- }, {
39
- readonly value: "gemini";
40
- readonly label: "Gemini";
41
- readonly description: "Google Search grounding via Gemini (uses google-gemini-cli or google-antigravity OAuth)";
42
22
  }, {
43
23
  readonly value: "codex";
44
24
  readonly label: "OpenAI";
@@ -52,13 +32,29 @@ export declare const SEARCH_PROVIDER_OPTIONS: readonly [{
52
32
  readonly label: "Exa";
53
33
  readonly description: "Uses Exa API when EXA_API_KEY is set; falls back to Exa MCP";
54
34
  }, {
55
- readonly value: "parallel";
56
- readonly label: "Parallel";
57
- readonly description: "Requires PARALLEL_API_KEY";
35
+ readonly value: "jina";
36
+ readonly label: "Jina";
37
+ readonly description: "Requires JINA_API_KEY";
58
38
  }, {
59
39
  readonly value: "kagi";
60
40
  readonly label: "Kagi";
61
41
  readonly description: "Requires KAGI_API_KEY and Kagi Search API beta access";
42
+ }, {
43
+ readonly value: "tavily";
44
+ readonly label: "Tavily";
45
+ readonly description: "Requires TAVILY_API_KEY";
46
+ }, {
47
+ readonly value: "brave";
48
+ readonly label: "Brave";
49
+ readonly description: "Requires BRAVE_API_KEY";
50
+ }, {
51
+ readonly value: "kimi";
52
+ readonly label: "Kimi";
53
+ readonly description: "Requires MOONSHOT_SEARCH_API_KEY or MOONSHOT_API_KEY";
54
+ }, {
55
+ readonly value: "parallel";
56
+ readonly label: "Parallel";
57
+ readonly description: "Requires PARALLEL_API_KEY";
62
58
  }, {
63
59
  readonly value: "synthetic";
64
60
  readonly label: "Synthetic";
@@ -68,6 +64,16 @@ export declare const SEARCH_PROVIDER_OPTIONS: readonly [{
68
64
  readonly label: "SearXNG";
69
65
  readonly description: "Requires SEARXNG_ENDPOINT or searxng.endpoint";
70
66
  }];
67
+ /** Supported web search providers (every option except `auto`). */
68
+ export type SearchProviderId = Exclude<(typeof SEARCH_PROVIDER_OPTIONS)[number]["value"], "auto">;
69
+ /**
70
+ * Auto-resolution priority order. Derived from {@link SEARCH_PROVIDER_OPTIONS}
71
+ * (minus `auto`) so the settings/setup dropdown and `resolveProviderChain()`
72
+ * share one source of truth and never drift apart.
73
+ */
74
+ export declare const SEARCH_PROVIDER_ORDER: readonly SearchProviderId[];
75
+ export declare const SEARCH_PROVIDER_PREFERENCES: readonly ["auto", ...SearchProviderId[]];
76
+ /** Display labels, derived from {@link SEARCH_PROVIDER_OPTIONS}. */
71
77
  export declare const SEARCH_PROVIDER_LABELS: Record<SearchProviderId, string>;
72
78
  export declare function isSearchProviderId(value: string): value is SearchProviderId;
73
79
  export declare function isSearchProviderPreference(value: string): value is SearchProviderId | "auto";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-coding-agent",
4
- "version": "16.0.5",
4
+ "version": "16.0.6",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
@@ -35,7 +35,7 @@
35
35
  "check": "biome check . && bun run check:types",
36
36
  "check:types": "tsgo -p tsconfig.json --noEmit",
37
37
  "lint": "biome lint .",
38
- "test": "bun test --parallel",
38
+ "test": "bun test --parallel=4",
39
39
  "fix": "biome check --write --unsafe . && bun run format-prompts && bun run generate-docs-index",
40
40
  "fmt": "biome format --write . && bun run format-prompts",
41
41
  "format-prompts": "bun scripts/format-prompts.ts",
@@ -47,17 +47,17 @@
47
47
  "@agentclientprotocol/sdk": "0.25.0",
48
48
  "@babel/parser": "^7.29.7",
49
49
  "@mozilla/readability": "^0.6.0",
50
- "@oh-my-pi/hashline": "16.0.5",
51
- "@oh-my-pi/omp-stats": "16.0.5",
52
- "@oh-my-pi/pi-agent-core": "16.0.5",
53
- "@oh-my-pi/pi-ai": "16.0.5",
54
- "@oh-my-pi/pi-catalog": "16.0.5",
55
- "@oh-my-pi/pi-mnemopi": "16.0.5",
56
- "@oh-my-pi/pi-natives": "16.0.5",
57
- "@oh-my-pi/pi-tui": "16.0.5",
58
- "@oh-my-pi/pi-utils": "16.0.5",
59
- "@oh-my-pi/pi-wire": "16.0.5",
60
- "@oh-my-pi/snapcompact": "16.0.5",
50
+ "@oh-my-pi/hashline": "16.0.6",
51
+ "@oh-my-pi/omp-stats": "16.0.6",
52
+ "@oh-my-pi/pi-agent-core": "16.0.6",
53
+ "@oh-my-pi/pi-ai": "16.0.6",
54
+ "@oh-my-pi/pi-catalog": "16.0.6",
55
+ "@oh-my-pi/pi-mnemopi": "16.0.6",
56
+ "@oh-my-pi/pi-natives": "16.0.6",
57
+ "@oh-my-pi/pi-tui": "16.0.6",
58
+ "@oh-my-pi/pi-utils": "16.0.6",
59
+ "@oh-my-pi/pi-wire": "16.0.6",
60
+ "@oh-my-pi/snapcompact": "16.0.6",
61
61
  "@opentelemetry/api": "^1.9.1",
62
62
  "@opentelemetry/context-async-hooks": "^2.7.1",
63
63
  "@opentelemetry/exporter-trace-otlp-proto": "^0.218.0",
@@ -67,6 +67,7 @@
67
67
  "@puppeteer/browsers": "^3.0.4",
68
68
  "@types/turndown": "5.0.6",
69
69
  "@xterm/headless": "^6.0.0",
70
+ "arktype": "^2.2.0",
70
71
  "chalk": "^5.6.2",
71
72
  "diff": "^9.0.0",
72
73
  "fflate": "0.8.3",
package/scripts/omp CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/bin/sh
2
- # Dev launcher for the omp CLI, installed by `bun run install:dev`.
2
+ # Dev launcher for the omp CLI.
3
3
  #
4
4
  # Problem it solves: Bun reads `bunfig.toml` from the *current working
5
5
  # directory* at startup and evaluates its `preload` entries before running the
@@ -1,5 +1,6 @@
1
1
  import { describe, expect, it, vi } from "bun:test";
2
- import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
2
+ import type { AgentMessage, AgentTelemetryConfig } from "@oh-my-pi/pi-agent-core";
3
+ import { type } from "arktype";
3
4
  import { createAdvisorMessageCard } from "../../modes/components/advisor-message";
4
5
  import { getThemeByName } from "../../modes/theme/theme";
5
6
  import { formatSessionHistoryMarkdown } from "../../session/session-history-format";
@@ -11,6 +12,7 @@ import {
11
12
  type AdvisorNote,
12
13
  AdvisorRuntime,
13
14
  type AdvisorRuntimeHost,
15
+ deriveAdvisorTelemetry,
14
16
  formatAdvisorBatchContent,
15
17
  isAdvisorInterruptImmuneTurnActive,
16
18
  isInterruptingSeverity,
@@ -115,6 +117,16 @@ describe("advisor", () => {
115
117
  expect(result.details).toEqual({ note: "x", severity: "concern" });
116
118
  expect(result.useless).toBe(true);
117
119
  });
120
+
121
+ it("validates parameters using ArkType", () => {
122
+ const onAdvice = vi.fn();
123
+ const tool = new AdviseTool(onAdvice);
124
+ const valid = tool.parameters({ note: "x", severity: "concern" });
125
+ expect(valid instanceof type.errors).toBe(false);
126
+
127
+ const invalid = tool.parameters({ note: 123, severity: "invalid" as any });
128
+ expect(invalid instanceof type.errors).toBe(true);
129
+ });
118
130
  });
119
131
 
120
132
  describe("advice delivery policy", () => {
@@ -181,6 +193,37 @@ describe("advisor", () => {
181
193
  });
182
194
  });
183
195
 
196
+ describe("deriveAdvisorTelemetry", () => {
197
+ it("returns undefined when the primary has no telemetry so the advisor stays a no-op", () => {
198
+ expect(deriveAdvisorTelemetry(undefined, { id: "s-advisor", name: "Advisor" })).toBeUndefined();
199
+ });
200
+
201
+ it("inherits the primary's usage/cost hooks but restamps identity and clears the conversation", () => {
202
+ const onChatUsage = vi.fn();
203
+ const costEstimator = vi.fn();
204
+ const primary: AgentTelemetryConfig = {
205
+ agent: { id: "main", name: "Main" },
206
+ conversationId: "session-1",
207
+ attributes: { "deployment.id": "prod" },
208
+ onChatUsage,
209
+ costEstimator,
210
+ };
211
+ const identity = { id: "session-1-advisor", name: "Advisor", description: "anthropic/claude-sonnet-4-5" };
212
+
213
+ const derived = deriveAdvisorTelemetry(primary, identity);
214
+
215
+ // Usage/cost hooks are inherited so the advisor model's calls report through
216
+ // the same pipeline as the primary — the whole point of the fix.
217
+ expect(derived?.onChatUsage).toBe(onChatUsage);
218
+ expect(derived?.costEstimator).toBe(costEstimator);
219
+ expect(derived?.attributes).toEqual({ "deployment.id": "prod" });
220
+ // Advisor identity replaces the primary's so spans are attributable to the advisor.
221
+ expect(derived?.agent).toEqual(identity);
222
+ // Conversation cleared so the advisor loop falls back to its own `-advisor` session id.
223
+ expect(derived?.conversationId).toBeUndefined();
224
+ });
225
+ });
226
+
184
227
  describe("AdvisorRuntime", () => {
185
228
  function makeAgent(promptInputs: string[]): AdvisorAgent {
186
229
  return {