@oh-my-pi/pi-coding-agent 17.1.0 → 17.1.2

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 (196) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/cli.js +6325 -4420
  3. package/dist/types/cli/bench-cli.d.ts +1 -0
  4. package/dist/types/config/model-resolver.d.ts +6 -3
  5. package/dist/types/config/settings-schema.d.ts +62 -0
  6. package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +3 -0
  7. package/dist/types/launch/broker-list-order.test.d.ts +1 -0
  8. package/dist/types/live/attestation.d.ts +2 -0
  9. package/dist/types/live/controller.d.ts +10 -2
  10. package/dist/types/live/protocol.d.ts +1 -1
  11. package/dist/types/live/transport.d.ts +6 -19
  12. package/dist/types/live/visualizer.d.ts +8 -11
  13. package/dist/types/modes/components/assistant-message.d.ts +1 -0
  14. package/dist/types/modes/components/custom-message.d.ts +1 -1
  15. package/dist/types/modes/components/message-frame.d.ts +8 -4
  16. package/dist/types/modes/components/session-account-selector.d.ts +11 -0
  17. package/dist/types/modes/controllers/selector-controller.d.ts +1 -0
  18. package/dist/types/modes/interactive-mode.d.ts +3 -6
  19. package/dist/types/modes/types.d.ts +9 -5
  20. package/dist/types/modes/utils/ui-helpers.d.ts +1 -6
  21. package/dist/types/session/agent-session-types.d.ts +8 -1
  22. package/dist/types/session/agent-session.d.ts +20 -1
  23. package/dist/types/session/auth-storage.d.ts +1 -1
  24. package/dist/types/session/eval-runner.d.ts +2 -0
  25. package/dist/types/session/messages.d.ts +2 -0
  26. package/dist/types/session/session-tools.d.ts +15 -0
  27. package/dist/types/session/streaming-output.d.ts +8 -0
  28. package/dist/types/slash-commands/helpers/session-pin.d.ts +9 -0
  29. package/dist/types/stt/index.d.ts +0 -2
  30. package/dist/types/stt/stt-controller.d.ts +7 -0
  31. package/dist/types/task/executor.d.ts +3 -1
  32. package/dist/types/task/structured-subagent.d.ts +3 -0
  33. package/dist/types/task/types.d.ts +11 -11
  34. package/dist/types/thinking.d.ts +13 -0
  35. package/dist/types/tiny/title-client.d.ts +10 -0
  36. package/dist/types/tools/builtin-names.d.ts +1 -1
  37. package/dist/types/tools/computer/protocol.d.ts +43 -0
  38. package/dist/types/tools/computer/supervisor.d.ts +32 -0
  39. package/dist/types/tools/computer/worker-entry.d.ts +1 -0
  40. package/dist/types/tools/computer/worker.d.ts +15 -0
  41. package/dist/types/tools/computer-renderer.d.ts +22 -0
  42. package/dist/types/tools/computer.d.ts +71 -0
  43. package/dist/types/tools/context.d.ts +2 -0
  44. package/dist/types/tools/default-renderer.d.ts +21 -0
  45. package/dist/types/tools/eval-format/index.d.ts +7 -0
  46. package/dist/types/tools/eval-format/javascript.d.ts +2 -0
  47. package/dist/types/tools/eval-format/julia.d.ts +2 -0
  48. package/dist/types/tools/eval-format/python.d.ts +2 -0
  49. package/dist/types/tools/eval-format/ruby.d.ts +2 -0
  50. package/dist/types/tools/index.d.ts +2 -0
  51. package/dist/types/tools/resolve.d.ts +7 -0
  52. package/dist/types/tools/todo.d.ts +4 -1
  53. package/dist/types/tts/streaming-player.d.ts +10 -43
  54. package/dist/types/utils/tools-manager.d.ts +1 -2
  55. package/dist/types/web/search/providers/base.d.ts +16 -0
  56. package/dist/types/web/search/providers/brave.d.ts +2 -0
  57. package/dist/types/web/search/providers/firecrawl.d.ts +2 -0
  58. package/dist/types/web/search/providers/gemini.d.ts +3 -0
  59. package/dist/types/web/search/providers/jina.d.ts +2 -0
  60. package/dist/types/web/search/providers/kagi.d.ts +2 -0
  61. package/dist/types/web/search/providers/kimi.d.ts +2 -0
  62. package/dist/types/web/search/providers/parallel.d.ts +2 -0
  63. package/dist/types/web/search/providers/perplexity.d.ts +3 -0
  64. package/dist/types/web/search/providers/searxng.d.ts +10 -0
  65. package/dist/types/web/search/providers/tavily.d.ts +8 -0
  66. package/dist/types/web/search/query.d.ts +190 -0
  67. package/package.json +12 -12
  68. package/src/cli/args.ts +1 -0
  69. package/src/cli/bench-cli.ts +12 -1
  70. package/src/cli/setup-cli.ts +2 -14
  71. package/src/cli/web-search-cli.ts +7 -0
  72. package/src/cli.ts +8 -0
  73. package/src/config/model-registry.ts +6 -0
  74. package/src/config/model-resolver.ts +17 -6
  75. package/src/config/settings-schema.ts +66 -0
  76. package/src/debug/raw-sse-buffer.ts +157 -30
  77. package/src/eval/executor-base.ts +1 -0
  78. package/src/eval/js/executor.ts +2 -0
  79. package/src/exec/bash-executor.ts +1 -0
  80. package/src/export/share.ts +4 -3
  81. package/src/extensibility/extensions/wrapper.ts +68 -12
  82. package/src/extensibility/legacy-pi-coding-agent-shim.ts +7 -1
  83. package/src/launch/broker-list-order.test.ts +89 -0
  84. package/src/launch/broker.ts +49 -8
  85. package/src/live/attestation.ts +91 -0
  86. package/src/live/controller.ts +76 -23
  87. package/src/live/protocol.test.ts +3 -3
  88. package/src/live/protocol.ts +1 -1
  89. package/src/live/transport.ts +72 -140
  90. package/src/live/visualizer.ts +114 -134
  91. package/src/modes/components/assistant-message.ts +7 -2
  92. package/src/modes/components/custom-message.ts +4 -1
  93. package/src/modes/components/message-frame.ts +14 -8
  94. package/src/modes/components/session-account-selector.ts +62 -0
  95. package/src/modes/components/tool-execution.ts +17 -110
  96. package/src/modes/controllers/input-controller.ts +55 -47
  97. package/src/modes/controllers/live-command-controller.ts +82 -5
  98. package/src/modes/controllers/selector-controller.ts +62 -0
  99. package/src/modes/interactive-mode.ts +79 -5
  100. package/src/modes/types.ts +10 -4
  101. package/src/modes/utils/ui-helpers.ts +7 -8
  102. package/src/prompts/system/computer-safety.md +14 -0
  103. package/src/prompts/system/resolve-device-reminder.md +1 -1
  104. package/src/prompts/system/workflow-notice.md +1 -1
  105. package/src/prompts/tools/ast-edit.md +1 -0
  106. package/src/prompts/tools/bash.md +1 -0
  107. package/src/prompts/tools/computer.md +26 -0
  108. package/src/prompts/tools/eval.md +2 -2
  109. package/src/prompts/tools/task.md +5 -2
  110. package/src/prompts/tools/web-search.md +2 -0
  111. package/src/sdk.ts +13 -4
  112. package/src/session/agent-session-types.ts +9 -0
  113. package/src/session/agent-session.ts +70 -0
  114. package/src/session/auth-storage.ts +1 -0
  115. package/src/session/eval-runner.ts +5 -0
  116. package/src/session/messages.ts +3 -0
  117. package/src/session/queued-messages.ts +7 -1
  118. package/src/session/session-tools.ts +37 -0
  119. package/src/session/streaming-output.ts +52 -5
  120. package/src/slash-commands/builtin-registry.ts +165 -9
  121. package/src/slash-commands/helpers/session-pin.ts +44 -0
  122. package/src/stt/downloader.ts +0 -2
  123. package/src/stt/index.ts +0 -2
  124. package/src/stt/stt-controller.ts +57 -146
  125. package/src/system-prompt.ts +4 -0
  126. package/src/task/executor.ts +17 -9
  127. package/src/task/index.ts +14 -34
  128. package/src/task/structured-subagent.ts +4 -0
  129. package/src/task/types.ts +15 -13
  130. package/src/thinking.ts +27 -0
  131. package/src/tiny/title-client.ts +22 -0
  132. package/src/tools/ast-edit.ts +4 -1
  133. package/src/tools/bash-interactive.ts +90 -86
  134. package/src/tools/bash.ts +13 -0
  135. package/src/tools/browser/render.ts +2 -1
  136. package/src/tools/builtin-names.ts +1 -0
  137. package/src/tools/computer/protocol.ts +28 -0
  138. package/src/tools/computer/supervisor.ts +258 -0
  139. package/src/tools/computer/worker-entry.ts +25 -0
  140. package/src/tools/computer/worker.ts +135 -0
  141. package/src/tools/computer-renderer.ts +108 -0
  142. package/src/tools/computer.ts +433 -0
  143. package/src/tools/context.ts +2 -0
  144. package/src/tools/default-renderer.ts +139 -0
  145. package/src/tools/essential-tools.ts +1 -0
  146. package/src/tools/eval-format/index.ts +24 -0
  147. package/src/tools/eval-format/javascript.ts +952 -0
  148. package/src/tools/eval-format/julia.ts +446 -0
  149. package/src/tools/eval-format/python.ts +544 -0
  150. package/src/tools/eval-format/ruby.ts +380 -0
  151. package/src/tools/eval-render.ts +12 -6
  152. package/src/tools/index.ts +5 -0
  153. package/src/tools/renderers.ts +2 -0
  154. package/src/tools/resolve.ts +10 -1
  155. package/src/tools/todo.ts +58 -6
  156. package/src/tools/xdev.ts +54 -26
  157. package/src/tts/streaming-player.ts +81 -340
  158. package/src/utils/clipboard.ts +1 -30
  159. package/src/utils/mac-file-urls.applescript +37 -0
  160. package/src/utils/tool-choice.ts +14 -0
  161. package/src/utils/tools-manager.ts +1 -19
  162. package/src/web/search/index.ts +28 -5
  163. package/src/web/search/providers/anthropic.ts +62 -4
  164. package/src/web/search/providers/base.ts +16 -0
  165. package/src/web/search/providers/brave.ts +30 -3
  166. package/src/web/search/providers/codex.ts +14 -1
  167. package/src/web/search/providers/duckduckgo.ts +23 -1
  168. package/src/web/search/providers/ecosia.ts +5 -1
  169. package/src/web/search/providers/exa.ts +28 -1
  170. package/src/web/search/providers/firecrawl.ts +37 -3
  171. package/src/web/search/providers/gemini.ts +12 -2
  172. package/src/web/search/providers/google.ts +2 -1
  173. package/src/web/search/providers/jina.ts +31 -8
  174. package/src/web/search/providers/kagi.ts +10 -1
  175. package/src/web/search/providers/kimi.ts +16 -1
  176. package/src/web/search/providers/mojeek.ts +14 -1
  177. package/src/web/search/providers/parallel.ts +48 -2
  178. package/src/web/search/providers/perplexity.ts +94 -6
  179. package/src/web/search/providers/searxng.ts +145 -9
  180. package/src/web/search/providers/startpage.ts +8 -2
  181. package/src/web/search/providers/synthetic.ts +7 -1
  182. package/src/web/search/providers/tavily.ts +52 -3
  183. package/src/web/search/providers/tinyfish.ts +6 -1
  184. package/src/web/search/providers/xai.ts +49 -2
  185. package/src/web/search/providers/zai.ts +19 -1
  186. package/src/web/search/query.ts +850 -0
  187. package/dist/types/stt/recorder.d.ts +0 -30
  188. package/dist/types/stt/transcriber.d.ts +0 -14
  189. package/dist/types/stt/wav.d.ts +0 -29
  190. package/dist/types/tts/player.d.ts +0 -32
  191. package/src/live/audio-worklet.txt +0 -59
  192. package/src/live/browser-runtime.txt +0 -221
  193. package/src/stt/recorder.ts +0 -551
  194. package/src/stt/transcriber.ts +0 -60
  195. package/src/stt/wav.ts +0 -173
  196. package/src/tts/player.ts +0 -137
@@ -1,3 +1,4 @@
1
+ import type { TaskEffort } from "../thinking.js";
1
2
  import type { ToolSession } from "../tools/index.js";
2
3
  import { type DiscoveryResult } from "./discovery.js";
3
4
  import { type AgentDefinition, type AgentProgress, type SingleResult, type StructuredSubagentOutput } from "./types.js";
@@ -40,6 +41,8 @@ export interface StructuredSubagentRequest {
40
41
  /** Presence, rather than truthiness, makes this the highest-priority schema. */
41
42
  outputSchema?: unknown;
42
43
  schemaMode?: StructuredSubagentSchemaMode;
44
+ /** Per-spawn thinking effort mapped onto the resolved model's supported range; overrides the agent's default selector. */
45
+ effort?: TaskEffort;
43
46
  identity?: StructuredSubagentIdentity;
44
47
  index?: number;
45
48
  parentToolCallId?: string;
@@ -1,7 +1,7 @@
1
1
  import type { Usage } from "@oh-my-pi/pi-ai";
2
2
  import { type BaseType } from "arktype";
3
3
  import type { AgentSessionEvent } from "../session/agent-session.js";
4
- import type { ConfiguredThinkingLevel } from "../thinking.js";
4
+ import type { ConfiguredThinkingLevel, TaskEffort } from "../thinking.js";
5
5
  import type { NestedRepoPatch } from "./worktree.js";
6
6
  /** Source of an agent definition */
7
7
  export type AgentSource = "bundled" | "user" | "project";
@@ -83,7 +83,7 @@ export declare const taskItemSchema: import("arktype/internal/variants/object.ts
83
83
  name?: string | undefined;
84
84
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
85
85
  task: string;
86
- model?: string | string[] | undefined;
86
+ effort?: "hi" | "lo" | "med" | undefined;
87
87
  outputSchema?: string | boolean | object | null | undefined;
88
88
  schemaMode?: "permissive" | "strict" | undefined;
89
89
  }, {}>;
@@ -95,8 +95,8 @@ export interface TaskItem {
95
95
  agent?: string;
96
96
  /** The work; required by the schema. */
97
97
  task?: string;
98
- /** Explicit model selector or fallback chain for this spawn, including optional reasoning suffixes. */
99
- model?: string | string[];
98
+ /** Per-spawn thinking effort: lowest/middle/highest level the resolved model supports. Overrides the agent's default selector (e.g. `auto`). */
99
+ effort?: TaskEffort;
100
100
  /** Caller-provided output schema; its presence overrides the selected agent's schema. */
101
101
  outputSchema?: unknown;
102
102
  /** Validation behavior for a caller-provided or inherited output schema. */
@@ -108,7 +108,7 @@ export declare const taskSchema: import("arktype/internal/variants/object.ts").O
108
108
  name?: string | undefined;
109
109
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
110
110
  task: string;
111
- model?: string | string[] | undefined;
111
+ effort?: "hi" | "lo" | "med" | undefined;
112
112
  outputSchema?: string | boolean | object | null | undefined;
113
113
  schemaMode?: "permissive" | "strict" | undefined;
114
114
  isolated?: boolean | undefined;
@@ -117,7 +117,7 @@ declare const ALL_TASK_SCHEMAS: readonly [import("arktype/internal/variants/obje
117
117
  name?: string | undefined;
118
118
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
119
119
  task: string;
120
- model?: string | string[] | undefined;
120
+ effort?: "hi" | "lo" | "med" | undefined;
121
121
  outputSchema?: string | boolean | object | null | undefined;
122
122
  schemaMode?: "permissive" | "strict" | undefined;
123
123
  isolated?: boolean | undefined;
@@ -125,7 +125,7 @@ declare const ALL_TASK_SCHEMAS: readonly [import("arktype/internal/variants/obje
125
125
  name?: string | undefined;
126
126
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
127
127
  task: string;
128
- model?: string | string[] | undefined;
128
+ effort?: "hi" | "lo" | "med" | undefined;
129
129
  outputSchema?: string | boolean | object | null | undefined;
130
130
  schemaMode?: "permissive" | "strict" | undefined;
131
131
  }, {}>, import("arktype/internal/variants/object.ts").ObjectType<{
@@ -134,7 +134,7 @@ declare const ALL_TASK_SCHEMAS: readonly [import("arktype/internal/variants/obje
134
134
  name?: string | undefined;
135
135
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
136
136
  task: string;
137
- model?: string | string[] | undefined;
137
+ effort?: "hi" | "lo" | "med" | undefined;
138
138
  outputSchema?: string | boolean | object | null | undefined;
139
139
  schemaMode?: "permissive" | "strict" | undefined;
140
140
  isolated?: boolean | undefined;
@@ -145,7 +145,7 @@ declare const ALL_TASK_SCHEMAS: readonly [import("arktype/internal/variants/obje
145
145
  name?: string | undefined;
146
146
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
147
147
  task: string;
148
- model?: string | string[] | undefined;
148
+ effort?: "hi" | "lo" | "med" | undefined;
149
149
  outputSchema?: string | boolean | object | null | undefined;
150
150
  schemaMode?: "permissive" | "strict" | undefined;
151
151
  }[];
@@ -176,8 +176,8 @@ export interface TaskParams {
176
176
  agent?: string;
177
177
  /** The work (flat form). */
178
178
  task?: string;
179
- /** Explicit model selector or fallback chain for the spawn, including optional reasoning suffixes. */
180
- model?: string | string[];
179
+ /** Per-spawn thinking effort (flat form): lowest/middle/highest level the resolved model supports. */
180
+ effort?: TaskEffort;
181
181
  /** Caller-provided output schema; its presence overrides the selected agent's schema. */
182
182
  outputSchema?: unknown;
183
183
  /** Validation behavior for a caller-provided or inherited output schema. */
@@ -88,6 +88,19 @@ export declare function parseCliThinkingLevel(value: string | null | undefined):
88
88
  * downstream.
89
89
  */
90
90
  export declare function clampAutoThinkingEffort(model: Model | undefined, effort: Effort): Effort | undefined;
91
+ /** Coarse per-spawn effort selectors accepted by the task tool. */
92
+ export declare const TASK_EFFORTS: readonly ["lo", "med", "hi"];
93
+ /** Coarse task-spawn effort: the lowest, middle, or highest thinking level the target model supports. */
94
+ export type TaskEffort = (typeof TASK_EFFORTS)[number];
95
+ /**
96
+ * Maps a coarse task effort onto the model's supported thinking range:
97
+ * `lo` = lowest supported level, `hi` = highest (whatever the model tops out
98
+ * at — high, xhigh, or max), `med` = the middle (lower of the two middles for
99
+ * an even-sized range). Without a model, maps over the full canonical range.
100
+ * Returns `undefined` when the model has no controllable effort surface, so
101
+ * callers fall back to their default selector (e.g. `auto`).
102
+ */
103
+ export declare function resolveTaskEffortLevel(model: Model | undefined, effort: TaskEffort): Effort | undefined;
91
104
  /**
92
105
  * The provisional concrete level shown while `auto` is configured but before a
93
106
  * turn has been classified. Prefers the model's `defaultLevel`, otherwise High,
@@ -50,6 +50,16 @@ export declare class TinyTitleClient {
50
50
  #private;
51
51
  constructor(spawnWorker?: () => RefCountedWorkerHandle<TinyTitleWorkerInbound, TinyTitleWorkerOutbound>);
52
52
  onProgress(listener: (event: TinyTitleProgressEvent) => void): () => void;
53
+ /**
54
+ * Spawn the tiny-model worker ahead of first use without loading any model.
55
+ * Called from idle TUI startup so the first {@link generate} reuses a live,
56
+ * unref'd subprocess instead of paying subprocess-spawn latency on the submit
57
+ * hot path (issue #6462). No-ops for online / non-local keys and for models
58
+ * already marked failed. A no-op `ping` round-trips the transport to fault in
59
+ * the worker's module graph; no pending request is registered, so
60
+ * {@link #syncWorkerRef} leaves the worker unref'd and idle sessions still exit.
61
+ */
62
+ prewarm(modelKey: string): void;
53
63
  generate(modelKey: string, message: string, signal?: AbortSignal): Promise<string | null>;
54
64
  generate(modelKey: string, message: string, options?: TinyTitleGenerateOptions): Promise<string | null>;
55
65
  complete(modelKey: string, prompt: string, options?: {
@@ -1,4 +1,4 @@
1
- export declare const BUILTIN_TOOL_NAMES: readonly ["read", "bash", "edit", "ast_grep", "ast_edit", "ask", "debug", "eval", "github", "glob", "grep", "lsp", "inspect_image", "browser", "checkpoint", "rewind", "task", "hub", "todo", "web_search", "write", "memory_edit", "retain", "recall", "reflect", "learn", "manage_skill"];
1
+ export declare const BUILTIN_TOOL_NAMES: readonly ["read", "bash", "edit", "ast_grep", "ast_edit", "ask", "debug", "eval", "github", "glob", "grep", "lsp", "inspect_image", "browser", "computer", "checkpoint", "rewind", "task", "hub", "todo", "web_search", "write", "memory_edit", "retain", "recall", "reflect", "learn", "manage_skill"];
2
2
  export type BuiltinToolName = (typeof BUILTIN_TOOL_NAMES)[number];
3
3
  /** Hidden built-ins: constructible and `--tools`-addressable, but never part of the default active set. */
4
4
  export declare const HIDDEN_TOOL_NAMES: readonly ["yield", "goal"];
@@ -0,0 +1,43 @@
1
+ import type { DesktopAction, DesktopCapabilities, DesktopCapture, DesktopSessionOptions } from "@oh-my-pi/pi-natives";
2
+ export declare const COMPUTER_WORKER_ARG = "__omp_worker_computer";
3
+ export type ComputerWorkerInbound = {
4
+ type: "ping";
5
+ id: string;
6
+ } | {
7
+ type: "init";
8
+ options: DesktopSessionOptions;
9
+ } | {
10
+ type: "execute";
11
+ id: string;
12
+ actions: DesktopAction[];
13
+ } | {
14
+ type: "close";
15
+ };
16
+ export type ComputerWorkerOutbound = {
17
+ type: "pong";
18
+ id: string;
19
+ } | {
20
+ type: "ready";
21
+ capabilities: DesktopCapabilities;
22
+ } | {
23
+ type: "result";
24
+ id: string;
25
+ capture: DesktopCapture;
26
+ capabilities: DesktopCapabilities;
27
+ } | {
28
+ type: "error";
29
+ id?: string;
30
+ error: ComputerWorkerError;
31
+ } | {
32
+ type: "closed";
33
+ };
34
+ export interface ComputerWorkerError {
35
+ name: string;
36
+ message: string;
37
+ stack?: string;
38
+ }
39
+ export interface ComputerWorkerTransport {
40
+ send(message: ComputerWorkerOutbound, transfer?: Bun.Transferable[]): void;
41
+ onMessage(handler: (message: ComputerWorkerInbound) => void): () => void;
42
+ close(): void;
43
+ }
@@ -0,0 +1,32 @@
1
+ import type { DesktopAction, DesktopCapabilities, DesktopCapture, DesktopSessionOptions } from "@oh-my-pi/pi-natives";
2
+ import { type ComputerWorkerInbound, type ComputerWorkerOutbound } from "./protocol.js";
3
+ export interface ComputerController {
4
+ readonly capabilities: DesktopCapabilities | undefined;
5
+ execute(actions: DesktopAction[], signal?: AbortSignal): Promise<DesktopCapture>;
6
+ close(): Promise<void>;
7
+ }
8
+ export interface ComputerWorkerHandle {
9
+ send(message: ComputerWorkerInbound): void;
10
+ onMessage(handler: (message: ComputerWorkerOutbound) => void): () => void;
11
+ onError(handler: (error: Error) => void): () => void;
12
+ terminate(): Promise<void>;
13
+ }
14
+ export interface ComputerSupervisorTimeouts {
15
+ startMs: number;
16
+ closeMs: number;
17
+ }
18
+ export type ComputerWorkerFactory = () => ComputerWorkerHandle;
19
+ export declare function spawnComputerWorker(): ComputerWorkerHandle;
20
+ export declare class ComputerSupervisor implements ComputerController {
21
+ #private;
22
+ private readonly options;
23
+ private readonly createWorker;
24
+ private readonly timeouts;
25
+ constructor(options: DesktopSessionOptions, createWorker?: ComputerWorkerFactory, timeouts?: ComputerSupervisorTimeouts);
26
+ get capabilities(): DesktopCapabilities | undefined;
27
+ execute(actions: DesktopAction[], signal?: AbortSignal): Promise<DesktopCapture>;
28
+ close(): Promise<void>;
29
+ }
30
+ export declare function registerComputerController(ownerId: string | undefined, controller: ComputerController): () => void;
31
+ export declare function releaseComputerSessionsForOwner(ownerId: string | undefined): Promise<void>;
32
+ export declare function smokeTestComputerWorker(timeoutMs?: number): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { type DesktopAction, type DesktopCapture, DesktopSession, type DesktopSessionOptions } from "@oh-my-pi/pi-natives";
2
+ import type { ComputerWorkerTransport } from "./protocol.js";
3
+ export interface NativeDesktopSession {
4
+ readonly capabilities: DesktopSession["capabilities"];
5
+ capture(): Promise<DesktopCapture>;
6
+ execute(actions: DesktopAction[]): Promise<DesktopCapture>;
7
+ close(): Promise<void>;
8
+ }
9
+ export type NativeDesktopSessionFactory = (options: DesktopSessionOptions) => NativeDesktopSession;
10
+ export declare class ComputerWorkerCore {
11
+ #private;
12
+ private readonly transport;
13
+ private readonly createSession;
14
+ constructor(transport: ComputerWorkerTransport, createSession?: NativeDesktopSessionFactory);
15
+ }
@@ -0,0 +1,22 @@
1
+ import type { Component } from "@oh-my-pi/pi-tui";
2
+ import type { RenderResultOptions } from "../extensibility/custom-tools/types.js";
3
+ import type { Theme } from "../modes/theme/theme.js";
4
+ interface ComputerRenderArgs {
5
+ actions?: Array<{
6
+ type?: unknown;
7
+ }>;
8
+ }
9
+ interface ComputerRenderResult {
10
+ content: Array<{
11
+ type: string;
12
+ text?: string;
13
+ }>;
14
+ details?: unknown;
15
+ isError?: boolean;
16
+ }
17
+ export declare const computerToolRenderer: {
18
+ mergeCallAndResult: boolean;
19
+ renderCall(args: ComputerRenderArgs, _options: RenderResultOptions, theme: Theme): Component;
20
+ renderResult(result: ComputerRenderResult, options: RenderResultOptions, theme: Theme, args?: ComputerRenderArgs): Component;
21
+ };
22
+ export {};
@@ -0,0 +1,71 @@
1
+ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback, ToolApprovalDecision } from "@oh-my-pi/pi-agent-core";
2
+ import type { ComputerAction } from "@oh-my-pi/pi-ai";
3
+ import type { DesktopCapabilities, DesktopCapture, DesktopDisplay, DesktopSessionOptions } from "@oh-my-pi/pi-natives";
4
+ import { type ComputerController } from "./computer/supervisor.js";
5
+ import type { ToolSession } from "./index.js";
6
+ declare const computerSchema: import("arktype/internal/variants/object.ts").ObjectType<{
7
+ actions?: {
8
+ type: "click" | "double_click" | "drag" | "keypress" | "move" | "screenshot" | "scroll" | "type" | "wait";
9
+ x?: number | undefined;
10
+ y?: number | undefined;
11
+ button?: "back" | "forward" | "left" | "right" | "wheel" | undefined;
12
+ path?: {
13
+ x: number;
14
+ y: number;
15
+ }[] | undefined;
16
+ keys?: string[] | null | undefined;
17
+ scroll_x?: number | undefined;
18
+ scroll_y?: number | undefined;
19
+ text?: string | undefined;
20
+ }[] | undefined;
21
+ }, {}>;
22
+ export type ComputerParams = typeof computerSchema.infer;
23
+ export interface ComputerToolDetails {
24
+ width: number;
25
+ height: number;
26
+ backend: DesktopCapture["backend"];
27
+ displayServer?: string;
28
+ capturePermission: string;
29
+ inputPermission: string;
30
+ displays: DesktopDisplay[];
31
+ capabilities?: DesktopCapabilities;
32
+ actions: ComputerAction["type"][];
33
+ }
34
+ export type ComputerControllerFactory = (options: DesktopSessionOptions) => ComputerController;
35
+ export declare function computerApproval(args: unknown): ToolApprovalDecision;
36
+ export declare class ComputerTool implements AgentTool<typeof computerSchema, ComputerToolDetails> {
37
+ #private;
38
+ readonly session: ToolSession;
39
+ readonly name = "computer";
40
+ readonly native: {
41
+ readonly type: "computer";
42
+ };
43
+ readonly label = "Computer";
44
+ readonly loadMode: "essential";
45
+ readonly concurrency: "exclusive";
46
+ readonly summary = "Capture and control the host desktop through native OS APIs";
47
+ readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
48
+ actions?: {
49
+ type: "click" | "double_click" | "drag" | "keypress" | "move" | "screenshot" | "scroll" | "type" | "wait";
50
+ x?: number | undefined;
51
+ y?: number | undefined;
52
+ button?: "back" | "forward" | "left" | "right" | "wheel" | undefined;
53
+ path?: {
54
+ x: number;
55
+ y: number;
56
+ }[] | undefined;
57
+ keys?: string[] | null | undefined;
58
+ scroll_x?: number | undefined;
59
+ scroll_y?: number | undefined;
60
+ text?: string | undefined;
61
+ }[] | undefined;
62
+ }, {}>;
63
+ readonly strict = false;
64
+ readonly approval: typeof computerApproval;
65
+ readonly formatApprovalDetails: (args: unknown) => string[];
66
+ constructor(session: ToolSession, createController?: ComputerControllerFactory);
67
+ get description(): string;
68
+ execute(_toolCallId: string, params: ComputerParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<ComputerToolDetails>, context?: AgentToolContext): Promise<AgentToolResult<ComputerToolDetails>>;
69
+ close(): Promise<void>;
70
+ }
71
+ export {};
@@ -12,6 +12,8 @@ declare module "@oh-my-pi/pi-agent-core" {
12
12
  * wrapper must not re-prompt for the same action (explicit per-tool
13
13
  * policies and overrides still apply). */
14
14
  xdevApproved?: boolean;
15
+ /** Set only after an interactive prompt approves provider computer safety checks. */
16
+ providerSafetyApproved?: boolean;
15
17
  }
16
18
  }
17
19
  export declare class ToolContextStore {
@@ -0,0 +1,21 @@
1
+ import type { Component } from "@oh-my-pi/pi-tui";
2
+ import type { RenderResultOptions } from "../extensibility/custom-tools/types.js";
3
+ import type { Theme } from "../modes/theme/theme.js";
4
+ /** Inputs rendered by the fallback card used when a tool has no bespoke renderer. */
5
+ export interface DefaultToolRenderInput {
6
+ /** Human-readable tool label. */
7
+ label: string;
8
+ /** Tool arguments, shown inline when collapsed and as a tree when expanded. */
9
+ args: unknown;
10
+ /** Settled or streaming result; omitted while only the call is available. */
11
+ result?: {
12
+ output: string;
13
+ isError?: boolean;
14
+ };
15
+ /** Current expansion and lifecycle state. */
16
+ options: RenderResultOptions;
17
+ }
18
+ /** Format one generic tool call/result card at the available content width. */
19
+ export declare function formatDefaultToolExecution(input: DefaultToolRenderInput, contentWidth: number, uiTheme: Theme): string;
20
+ /** Render the generic fallback as the state-tinted card used by direct custom tools. */
21
+ export declare function renderDefaultToolExecution(input: DefaultToolRenderInput, uiTheme: Theme): Component;
@@ -0,0 +1,7 @@
1
+ import type { EvalLanguage } from "../../eval/types.js";
2
+ export * from "./javascript.js";
3
+ export * from "./julia.js";
4
+ export * from "./python.js";
5
+ export * from "./ruby.js";
6
+ /** Formats an arbitrary eval-code prefix for display without changing the executed source. */
7
+ export declare function formatEvalCodeForDisplay(source: string, language: EvalLanguage): string;
@@ -0,0 +1,2 @@
1
+ /** Formats JavaScript/TypeScript-like eval source for safe, stable display without requiring valid syntax. */
2
+ export declare function formatJavaScriptForDisplay(source: string): string;
@@ -0,0 +1,2 @@
1
+ /** Formats an arbitrary Julia source prefix for stable, readable display. */
2
+ export declare function formatJuliaForDisplay(source: string): string;
@@ -0,0 +1,2 @@
1
+ /** Formats an arbitrary Python source prefix for stable, readable display. */
2
+ export declare function formatPythonForDisplay(source: string): string;
@@ -0,0 +1,2 @@
1
+ /** Formats an arbitrary Ruby source prefix for display without requiring valid syntax. */
2
+ export declare function formatRubyForDisplay(source: string): string;
@@ -42,6 +42,8 @@ export * from "./ast-grep.js";
42
42
  export * from "./bash.js";
43
43
  export * from "./browser.js";
44
44
  export * from "./checkpoint.js";
45
+ export * from "./computer.js";
46
+ export * from "./computer/supervisor.js";
45
47
  export * from "./debug.js";
46
48
  export * from "./essential-tools.js";
47
49
  export * from "./eval.js";
@@ -27,6 +27,13 @@ export declare const PROPOSE_DEVICE_NAME = "propose";
27
27
  export declare const RESOLVE_DEVICE_PATH = "xd://resolve";
28
28
  export declare const REJECT_DEVICE_PATH = "xd://reject";
29
29
  export declare const PROPOSE_DEVICE_PATH = "xd://propose";
30
+ /**
31
+ * Model-visible banner prepended to a staged preview's tool result text. The
32
+ * TUI badge (`⟨proposed⟩`) never reaches the model, and preview diffs are
33
+ * byte-identical to applied-edit output — without this line the model reads
34
+ * the result as an already-applied change.
35
+ */
36
+ export declare const PREVIEW_PENDING_NOTICE = "Staged as a proposal \u2014 files NOT modified yet. To apply: write a one-sentence reason to xd://resolve. To discard: write to xd://reject.";
30
37
  export type ResolutionDeviceName = typeof RESOLVE_DEVICE_NAME | typeof REJECT_DEVICE_NAME | typeof PROPOSE_DEVICE_NAME;
31
38
  /** Whether an xd:// device name is one of the plain-text resolution devices. */
32
39
  export declare function isResolutionDeviceName(name: string): name is ResolutionDeviceName;
@@ -44,6 +44,8 @@ declare const todoSchema: import("arktype/internal/variants/object.ts").ObjectTy
44
44
  }, {}>;
45
45
  type TodoParams = TodoSchema;
46
46
  type TodoSchema = typeof todoSchema.infer;
47
+ /** A single todo op entry (the params object itself). */
48
+ type TodoOpEntryValue = TodoParams;
47
49
  /** Return the active todo task, preferring an in-progress item over the first pending item. */
48
50
  export declare function nextActionableTask(phases: readonly TodoPhase[]): TodoItem | undefined;
49
51
  export declare const USER_TODO_EDIT_CUSTOM_TYPE = "user_todo_edit";
@@ -92,7 +94,7 @@ export declare function selectCollapsedTodos<T extends {
92
94
  status: TodoStatus;
93
95
  }>(tasks: T[], isMatched: (task: T) => boolean, cap: number): CollapsedTodoSelection<T>;
94
96
  /** Apply an array of `todo`-style ops to existing phases. Used by /todo slash command. */
95
- export declare function applyOpsToPhases(currentPhases: TodoPhase[], ops: TodoParams[]): {
97
+ export declare function applyOpsToPhases(currentPhases: TodoPhase[], ops: TodoOpEntryValue[]): {
96
98
  phases: TodoPhase[];
97
99
  errors: string[];
98
100
  };
@@ -124,6 +126,7 @@ export declare class TodoTool implements AgentTool<typeof todoSchema, TodoToolDe
124
126
  }, {}>;
125
127
  readonly concurrency = "exclusive";
126
128
  readonly strict = true;
129
+ readonly lenientArgValidation = true;
127
130
  readonly examples: readonly ToolExample<typeof todoSchema.infer>[];
128
131
  readonly loadMode = "discoverable";
129
132
  constructor(session: ToolSession);
@@ -1,54 +1,21 @@
1
- import { type PlayerCommand } from "./player.js";
2
- /** Output gain applied while ducked (the user is speaking over the assistant). */
1
+ /** Output gain applied while the user speaks over assistant audio. */
3
2
  export declare const DUCK_GAIN = 0.25;
4
- /** Injection seam for {@link streamingPlayerCommandsFor} — defaults to real PATH/tools lookups. */
5
- export interface StreamingPlayerLookup {
6
- which?: (bin: string) => string | null;
7
- ffmpeg?: () => string | null;
8
- }
9
- /**
10
- * Ordered candidate commands for a persistent raw-PCM player on `platform`: each
11
- * reads 32-bit-float little-endian mono PCM at `sampleRate` from stdin (`pipe:0`)
12
- * and plays it to the default output device. An empty list means no streaming
13
- * backend is available and the caller should fall back to per-file playback.
14
- *
15
- * - darwin: `ffmpeg` (AudioToolbox output device) → sox's `play` (coreaudio).
16
- * - linux/other POSIX: `ffmpeg` (`-f pulse` then `-f alsa`) → `paplay`/`aplay`
17
- * raw fallbacks.
18
- * - win32: none (PowerShell `SoundPlayer` is file-only).
19
- */
20
- export declare function streamingPlayerCommandsFor(platform: NodeJS.Platform, sampleRate: number, lookup?: StreamingPlayerLookup): PlayerCommand[];
21
- /**
22
- * Test seams for {@link StreamingAudioPlayer}: override backend discovery and
23
- * the per-file fallback so playback logic can be exercised without a real audio
24
- * device. Both default to the platform lookup and {@link playAudioFile}.
25
- */
26
- export interface StreamingPlayerOptions {
27
- /** Ordered backend commands for a sample rate; defaults to {@link streamingPlayerCommandsFor}. */
28
- commandsFor?: (sampleRate: number) => PlayerCommand[];
29
- /** Per-file fallback playback; defaults to {@link playAudioFile}. */
30
- playAudio?: (wavPath: string, signal: AbortSignal) => Promise<void>;
31
- /** Max seconds of streamed PCM retained for the nonzero-exit replay; defaults to {@link REPLAY_RETENTION_SECONDS}. */
32
- replayRetentionSeconds?: number;
33
- }
34
3
  /**
35
- * Single-session gapless player. Lifecycle: {@link start} once, {@link write}
36
- * chunks in order, then {@link end} to drain or {@link stop} to abort. Not
37
- * reusable after stop/end — create a new instance per utterance.
4
+ * One native gapless playback session. Call {@link start}, enqueue mono `f32`
5
+ * chunks with {@link write}, then {@link end} to drain or {@link stop} to abort.
38
6
  */
39
7
  export declare class StreamingAudioPlayer {
40
8
  #private;
41
- constructor(options?: StreamingPlayerOptions);
42
- /** Pick a backend and begin draining. Idempotent; the first call's rate wins. */
43
- start(sampleRate: number): void;
44
- /** Queue a mono float32 PCM chunk for playback in arrival order. */
9
+ /** Opens the default speaker at the stream's logical sample rate. */
10
+ start(sampleRate?: number): void;
11
+ /** Queues one mono `f32` PCM chunk without copying it in TypeScript. */
45
12
  write(pcm: Float32Array): void;
46
- /** Scale subsequent output (1 = normal, <1 = ducked). Applies within {@link LEAD_SECONDS}. */
13
+ /** Applies gain at render time, including to samples already queued natively. */
47
14
  setGain(gain: number): void;
48
- /** Close the input; resolves once all queued audio has finished playing. */
15
+ /** Closes input and resolves after every queued sample reaches the speaker. */
49
16
  end(): Promise<void>;
50
- /** Stop immediately: kill the player, drop everything still queued. */
17
+ /** Stops immediately and discards queued audio. Safe to call repeatedly. */
51
18
  stop(): void;
52
19
  }
53
- /** Factory the vocalizer calls; a function so tests can stub it without spawning a player. */
20
+ /** Creates the single-use player used by the speech vocalizer. */
54
21
  export declare function createStreamingPlayer(): StreamingAudioPlayer;
@@ -1,5 +1,4 @@
1
- export declare function ffmpegAssetName(_version: string, plat: string, architecture: string): string | null;
2
- export type ToolName = "sd" | "sg" | "yt-dlp" | "trafilatura" | "ffmpeg";
1
+ export type ToolName = "sd" | "sg" | "yt-dlp" | "trafilatura";
3
2
  export declare function getToolPath(tool: ToolName): string | null;
4
3
  /** Download a tool asset without handing the streaming Response to Bun.write. */
5
4
  export declare function downloadFile(url: string, dest: string, signal?: AbortSignal): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  import type { AuthStorage, FetchImpl } from "@oh-my-pi/pi-ai";
2
2
  import type { ModelRegistry } from "../../../config/model-registry.js";
3
+ import type { StructuredQuery } from "../query.js";
3
4
  import type { SearchProviderId, SearchResponse } from "../types.js";
4
5
  /**
5
6
  * Shared web search parameters passed to providers.
@@ -13,6 +14,21 @@ import type { SearchProviderId, SearchResponse } from "../types.js";
13
14
  */
14
15
  export interface SearchParams {
15
16
  query: string;
17
+ /**
18
+ * Structured view of `query`, parsed once by the search pipeline:
19
+ * Google-style directives (`site:`, `before:`/`after:`, `inurl:`,
20
+ * `intitle:`, `filetype:`, quoted phrases, `OR` groups, `-exclusions`)
21
+ * extracted into fields.
22
+ *
23
+ * Providers SHOULD map constraints onto native API parameters
24
+ * (domain/date filters) or engine query syntax (`formatQuery`) where the
25
+ * upstream supports them, and lean lenient otherwise: the pipeline
26
+ * post-filters every response with `applyQueryConstraints`, which
27
+ * relaxes any constraint that would eliminate all results — so a
28
+ * best-effort search always beats an empty one. When absent (direct
29
+ * provider calls), parse with `parseSearchQuery(params.query)`.
30
+ */
31
+ parsedQuery?: StructuredQuery;
16
32
  limit?: number;
17
33
  /**
18
34
  * Temporal filter narrowing results to the specified time window.
@@ -6,12 +6,14 @@
6
6
  */
7
7
  import { type AuthStorage, type FetchImpl } from "@oh-my-pi/pi-ai";
8
8
  import type { SearchResponse } from "../../../web/search/types.js";
9
+ import type { StructuredQuery } from "../query.js";
9
10
  import type { SearchParams } from "./base.js";
10
11
  import { SearchProvider } from "./base.js";
11
12
  export interface BraveSearchParams {
12
13
  query: string;
13
14
  num_results?: number;
14
15
  recency?: "day" | "week" | "month" | "year";
16
+ parsedQuery?: StructuredQuery;
15
17
  signal?: AbortSignal;
16
18
  fetch?: FetchImpl;
17
19
  }
@@ -12,6 +12,8 @@ export interface FirecrawlSearchParams {
12
12
  query: string;
13
13
  num_results?: number;
14
14
  recency?: SearchParams["recency"];
15
+ /** Explicit `tbs` (custom date range); takes precedence over `recency`. */
16
+ tbs?: string;
15
17
  signal?: AbortSignal;
16
18
  fetch?: FetchImpl;
17
19
  }
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import { type AuthStorage, type FetchImpl, type OAuthAccess } from "@oh-my-pi/pi-ai";
12
12
  import type { SearchResponse } from "../../../web/search/types.js";
13
+ import { type StructuredQuery } from "../query.js";
13
14
  import type { SearchParams } from "./base.js";
14
15
  import { SearchProvider } from "./base.js";
15
16
  declare const GEMINI_PROVIDERS: readonly ["google-gemini-cli", "google-antigravity"];
@@ -21,6 +22,8 @@ interface GeminiToolParams {
21
22
  }
22
23
  export interface GeminiSearchParams extends GeminiToolParams {
23
24
  query: string;
25
+ /** Pre-parsed structured query; falls back to parsing `query` when omitted. */
26
+ parsedQuery?: StructuredQuery;
24
27
  system_prompt?: string;
25
28
  num_results?: number;
26
29
  /** Maximum output tokens. */
@@ -14,6 +14,8 @@ type SearchParamsWithFetch = SearchParams & {
14
14
  export interface JinaSearchParams {
15
15
  query: string;
16
16
  num_results?: number;
17
+ /** Single bare host for Jina's `X-Site` in-site search header. */
18
+ site?: string;
17
19
  signal?: AbortSignal;
18
20
  fetch?: FetchImpl;
19
21
  }
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { AuthStorage, FetchImpl } from "@oh-my-pi/pi-ai";
7
7
  import type { SearchResponse } from "../../../web/search/types.js";
8
+ import type { StructuredQuery } from "../query.js";
8
9
  import type { SearchParams } from "./base.js";
9
10
  import { SearchProvider } from "./base.js";
10
11
  type SearchParamsWithFetch = SearchParams & {
@@ -15,6 +16,7 @@ export declare function searchKagi(params: {
15
16
  query: string;
16
17
  num_results?: number;
17
18
  recency?: SearchParams["recency"];
19
+ parsedQuery?: StructuredQuery;
18
20
  signal?: AbortSignal;
19
21
  authStorage: AuthStorage;
20
22
  sessionId?: string;