@oh-my-pi/pi-coding-agent 17.2.5 → 17.2.7

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 (201) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/dist/{CHANGELOG-q2w43aw3.md → CHANGELOG-1p8yvde7.md} +35 -1
  3. package/dist/cli.js +3340 -3339
  4. package/dist/types/advisor/advise-tool.d.ts +10 -4
  5. package/dist/types/autoresearch/tools/init-experiment.d.ts +19 -7
  6. package/dist/types/autoresearch/tools/log-experiment.d.ts +19 -11
  7. package/dist/types/autoresearch/tools/run-experiment.d.ts +4 -2
  8. package/dist/types/autoresearch/tools/update-notes.d.ts +5 -2
  9. package/dist/types/cli/gc-cli.d.ts +1 -0
  10. package/dist/types/commit/agentic/tools/analyze-file.d.ts +5 -2
  11. package/dist/types/commit/agentic/tools/git-file-diff.d.ts +5 -2
  12. package/dist/types/commit/agentic/tools/git-hunk.d.ts +6 -2
  13. package/dist/types/commit/agentic/tools/git-overview.d.ts +5 -2
  14. package/dist/types/commit/agentic/tools/propose-changelog.d.ts +29 -7
  15. package/dist/types/commit/agentic/tools/propose-commit.d.ts +14 -4
  16. package/dist/types/commit/agentic/tools/recent-commits.d.ts +4 -2
  17. package/dist/types/commit/agentic/tools/schemas.d.ts +7 -3
  18. package/dist/types/commit/agentic/tools/split-commit.d.ts +37 -10
  19. package/dist/types/commit/changelog/generate.d.ts +13 -3
  20. package/dist/types/commit/shared-llm.d.ts +13 -4
  21. package/dist/types/config/config-file.d.ts +1 -1
  22. package/dist/types/config/models-config-schema-bundle.d.ts +1992 -981
  23. package/dist/types/config/models-config-schema.d.ts +1201 -580
  24. package/dist/types/config/models-config.d.ts +355 -371
  25. package/dist/types/edit/hashline/params.d.ts +4 -2
  26. package/dist/types/edit/modes/apply-patch.d.ts +4 -2
  27. package/dist/types/edit/modes/patch.d.ts +16 -5
  28. package/dist/types/edit/modes/replace.d.ts +8 -3
  29. package/dist/types/eval/bridge-timeout.d.ts +5 -2
  30. package/dist/types/eval/completion-bridge.d.ts +13 -0
  31. package/dist/types/eval/py/tool-bridge.d.ts +12 -0
  32. package/dist/types/extensibility/custom-commands/types.d.ts +4 -4
  33. package/dist/types/extensibility/custom-tools/types.d.ts +4 -4
  34. package/dist/types/extensibility/extensions/types.d.ts +4 -4
  35. package/dist/types/extensibility/hooks/types.d.ts +4 -4
  36. package/dist/types/extensibility/legacy-pi-ai-shim.d.ts +1 -1
  37. package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +1 -1
  38. package/dist/types/extensibility/legacy-typebox.d.ts +8 -0
  39. package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +6 -13
  40. package/dist/types/goals/tools/goal-tool.d.ts +12 -4
  41. package/dist/types/launch/client.d.ts +9 -1
  42. package/dist/types/launch/protocol.d.ts +17 -0
  43. package/dist/types/lsp/index.d.ts +15 -5
  44. package/dist/types/lsp/types.d.ts +15 -5
  45. package/dist/types/modes/components/btw-panel.d.ts +3 -0
  46. package/dist/types/modes/controllers/btw-controller.d.ts +2 -0
  47. package/dist/types/modes/controllers/command-controller.d.ts +1 -0
  48. package/dist/types/modes/interactive-mode.d.ts +4 -1
  49. package/dist/types/modes/types.d.ts +3 -1
  50. package/dist/types/security/contracts/schemas.d.ts +1115 -537
  51. package/dist/types/security/publication.d.ts +92 -34
  52. package/dist/types/session/agent-session-types.d.ts +5 -0
  53. package/dist/types/session/agent-session.d.ts +26 -2
  54. package/dist/types/session/launch-completion.d.ts +10 -0
  55. package/dist/types/session/session-entries.d.ts +15 -1
  56. package/dist/types/session/session-manager.d.ts +7 -0
  57. package/dist/types/session/yield-queue.d.ts +6 -1
  58. package/dist/types/task/types.d.ts +63 -18
  59. package/dist/types/tools/ask.d.ts +34 -8
  60. package/dist/types/tools/ast-edit.d.ts +16 -4
  61. package/dist/types/tools/ast-grep.d.ts +12 -4
  62. package/dist/types/tools/bash.d.ts +20 -11
  63. package/dist/types/tools/browser.d.ts +64 -20
  64. package/dist/types/tools/checkpoint.d.ts +16 -8
  65. package/dist/types/tools/computer.d.ts +1 -1
  66. package/dist/types/tools/debug.d.ts +118 -48
  67. package/dist/types/tools/eval.d.ts +11 -5
  68. package/dist/types/tools/gh.d.ts +74 -26
  69. package/dist/types/tools/glob.d.ts +16 -6
  70. package/dist/types/tools/grep.d.ts +18 -6
  71. package/dist/types/tools/hub/index.d.ts +116 -46
  72. package/dist/types/tools/image-gen.d.ts +25 -8
  73. package/dist/types/tools/index.d.ts +9 -0
  74. package/dist/types/tools/inspect-image.d.ts +10 -4
  75. package/dist/types/tools/learn.d.ts +26 -8
  76. package/dist/types/tools/manage-skill.d.ts +16 -6
  77. package/dist/types/tools/memory-edit.d.ts +18 -6
  78. package/dist/types/tools/memory-recall.d.ts +8 -4
  79. package/dist/types/tools/memory-reflect.d.ts +10 -4
  80. package/dist/types/tools/memory-retain.d.ts +14 -4
  81. package/dist/types/tools/read.d.ts +8 -4
  82. package/dist/types/tools/security-scan.d.ts +82 -30
  83. package/dist/types/tools/todo.d.ts +30 -10
  84. package/dist/types/tools/tts.d.ts +12 -5
  85. package/dist/types/tools/vibe.d.ts +42 -18
  86. package/dist/types/tools/write.d.ts +10 -4
  87. package/dist/types/web/search/index.d.ts +20 -6
  88. package/package.json +13 -13
  89. package/scripts/legacy-pi-virtual-module.ts +2 -2
  90. package/src/advisor/advise-tool.ts +1 -1
  91. package/src/advisor/config.ts +1 -1
  92. package/src/autoresearch/tools/init-experiment.ts +1 -2
  93. package/src/autoresearch/tools/log-experiment.ts +1 -2
  94. package/src/autoresearch/tools/run-experiment.ts +1 -1
  95. package/src/autoresearch/tools/update-notes.ts +1 -1
  96. package/src/cli/gc-cli.ts +641 -21
  97. package/src/commit/agentic/tools/analyze-file.ts +1 -1
  98. package/src/commit/agentic/tools/git-file-diff.ts +1 -1
  99. package/src/commit/agentic/tools/git-hunk.ts +1 -1
  100. package/src/commit/agentic/tools/git-overview.ts +1 -1
  101. package/src/commit/agentic/tools/propose-changelog.ts +1 -1
  102. package/src/commit/agentic/tools/propose-commit.ts +1 -1
  103. package/src/commit/agentic/tools/recent-commits.ts +1 -1
  104. package/src/commit/agentic/tools/schemas.ts +1 -1
  105. package/src/commit/agentic/tools/split-commit.ts +1 -1
  106. package/src/commit/analysis/summary.ts +1 -1
  107. package/src/commit/changelog/generate.ts +1 -1
  108. package/src/config/config-file.ts +2 -2
  109. package/src/config/model-discovery.ts +14 -14
  110. package/src/config/model-registry.ts +10 -8
  111. package/src/config/models-config-schema-bundle.ts +1 -8
  112. package/src/config/settings.ts +1 -1
  113. package/src/discovery/codex.ts +22 -9
  114. package/src/edit/hashline/params.ts +1 -1
  115. package/src/edit/modes/apply-patch.ts +1 -1
  116. package/src/edit/modes/patch.ts +1 -1
  117. package/src/edit/modes/replace.ts +2 -1
  118. package/src/eval/agent-bridge.ts +4 -2
  119. package/src/eval/bridge-timeout.ts +5 -2
  120. package/src/eval/completion-bridge.ts +3 -2
  121. package/src/eval/executor-base.ts +20 -1
  122. package/src/eval/js/context-manager.ts +94 -6
  123. package/src/eval/py/tool-bridge.ts +29 -9
  124. package/src/export/html/index.ts +10 -3
  125. package/src/export/share.ts +4 -0
  126. package/src/extensibility/custom-commands/loader.ts +3 -3
  127. package/src/extensibility/custom-commands/types.ts +4 -4
  128. package/src/extensibility/custom-tools/loader.ts +3 -3
  129. package/src/extensibility/custom-tools/types.ts +5 -4
  130. package/src/extensibility/extensions/loader.ts +3 -3
  131. package/src/extensibility/extensions/types.ts +5 -4
  132. package/src/extensibility/hooks/loader.ts +3 -3
  133. package/src/extensibility/hooks/types.ts +4 -4
  134. package/src/extensibility/legacy-pi-ai-shim.ts +1 -1
  135. package/src/extensibility/legacy-pi-coding-agent-shim.ts +2 -2
  136. package/src/extensibility/legacy-typebox.ts +101 -0
  137. package/src/extensibility/plugins/legacy-pi-compat.ts +13 -22
  138. package/src/goals/tools/goal-tool.ts +1 -1
  139. package/src/launch/broker.ts +222 -6
  140. package/src/launch/client.ts +161 -9
  141. package/src/launch/protocol.ts +52 -0
  142. package/src/lsp/types.ts +1 -1
  143. package/src/main.ts +13 -6
  144. package/src/mcp/config-writer.ts +1 -1
  145. package/src/modes/components/btw-panel.ts +41 -4
  146. package/src/modes/controllers/btw-controller.ts +55 -7
  147. package/src/modes/controllers/command-controller.ts +31 -0
  148. package/src/modes/controllers/input-controller.ts +24 -7
  149. package/src/modes/interactive-mode.ts +16 -2
  150. package/src/modes/theme/theme.ts +3 -3
  151. package/src/modes/types.ts +8 -1
  152. package/src/prompts/session/launch-completion.md +1 -0
  153. package/src/sdk.ts +15 -0
  154. package/src/security/contracts/schemas.ts +202 -184
  155. package/src/security/contracts/validation.ts +6 -2
  156. package/src/security/publication.ts +1 -1
  157. package/src/security/store.ts +2 -2
  158. package/src/session/agent-session-types.ts +6 -0
  159. package/src/session/agent-session.ts +190 -14
  160. package/src/session/launch-completion.ts +37 -0
  161. package/src/session/session-context.ts +26 -0
  162. package/src/session/session-entries.ts +17 -1
  163. package/src/session/session-manager.ts +21 -0
  164. package/src/session/yield-queue.ts +121 -16
  165. package/src/slash-commands/builtin-registry.ts +10 -1
  166. package/src/task/types.ts +1 -1
  167. package/src/tools/ask.ts +1 -1
  168. package/src/tools/ast-edit.ts +1 -1
  169. package/src/tools/ast-grep.ts +1 -1
  170. package/src/tools/bash.ts +61 -3
  171. package/src/tools/browser/cmux/cmux-tab.ts +92 -4
  172. package/src/tools/browser.ts +1 -1
  173. package/src/tools/checkpoint.ts +1 -1
  174. package/src/tools/computer.ts +1 -1
  175. package/src/tools/debug.ts +1 -1
  176. package/src/tools/eval.ts +1 -1
  177. package/src/tools/gh.ts +1 -2
  178. package/src/tools/glob.ts +1 -1
  179. package/src/tools/grep.ts +1 -1
  180. package/src/tools/hub/index.ts +1 -1
  181. package/src/tools/hub/launch.ts +122 -6
  182. package/src/tools/image-gen.ts +1 -1
  183. package/src/tools/index.ts +9 -0
  184. package/src/tools/inspect-image.ts +1 -1
  185. package/src/tools/learn.ts +1 -1
  186. package/src/tools/manage-skill.ts +1 -1
  187. package/src/tools/memory-edit.ts +1 -1
  188. package/src/tools/memory-recall.ts +1 -1
  189. package/src/tools/memory-reflect.ts +1 -1
  190. package/src/tools/memory-retain.ts +1 -1
  191. package/src/tools/read.ts +1 -1
  192. package/src/tools/security-scan.ts +1 -1
  193. package/src/tools/todo.ts +1 -1
  194. package/src/tools/tts.ts +1 -1
  195. package/src/tools/vibe.ts +2 -1
  196. package/src/tools/write.ts +1 -1
  197. package/src/web/search/index.ts +2 -1
  198. package/dist/types/config/file-lock.d.ts +0 -29
  199. package/dist/types/extensibility/typebox.d.ts +0 -181
  200. package/src/config/file-lock.ts +0 -164
  201. package/src/extensibility/typebox.ts +0 -958
@@ -10,7 +10,7 @@ import type { Component } from "@oh-my-pi/pi-tui";
10
10
  import { Text } from "@oh-my-pi/pi-tui";
11
11
  import { sanitizeText } from "@oh-my-pi/pi-utils";
12
12
  import type { RenderResultOptions } from "../../extensibility/custom-tools/types";
13
- import { daemonClientForProject } from "../../launch/client";
13
+ import { type DaemonBrokerClient, DaemonBrokerRejectedError, daemonClientForProject } from "../../launch/client";
14
14
  import type { DaemonOperation, DaemonRpcResult, DaemonSnapshot, DaemonSpec, DaemonState } from "../../launch/protocol";
15
15
  import { renderTerminalOutputIsolated } from "../../launch/terminal-output-worker-client";
16
16
  import type { Theme, ThemeColor } from "../../modes/theme/theme";
@@ -35,6 +35,81 @@ import {
35
35
  import { styleTerminalRow } from "../terminal-output";
36
36
  import { ToolError } from "../tool-errors";
37
37
 
38
+ interface CompletionRegistration {
39
+ inFlight: number;
40
+ retained: boolean;
41
+ active: boolean;
42
+ cleanup: (preservePending?: boolean) => void;
43
+ }
44
+
45
+ interface CompletionLease {
46
+ retain: () => void;
47
+ reject: (preservePending?: boolean) => void;
48
+ hasConcurrentRequest: () => boolean;
49
+ }
50
+
51
+ const completionRegistrations = new WeakMap<
52
+ ToolSession,
53
+ Map<DaemonBrokerClient, Map<string, CompletionRegistration>>
54
+ >();
55
+
56
+ function registerCompletionSink(
57
+ session: ToolSession,
58
+ client: DaemonBrokerClient,
59
+ owner: string,
60
+ ): CompletionLease | undefined {
61
+ if (!session.queueLaunchCompletion) return undefined;
62
+ let clients = completionRegistrations.get(session);
63
+ if (!clients) {
64
+ clients = new Map();
65
+ completionRegistrations.set(session, clients);
66
+ }
67
+ let owners = clients.get(client);
68
+ if (!owners) {
69
+ owners = new Map();
70
+ clients.set(client, owners);
71
+ }
72
+ let registration = owners.get(owner);
73
+ if (!registration) {
74
+ const unregister = client.onCompletion(owner, notification => {
75
+ if (session.isDisposed?.()) throw new Error("Session disposed before launch completion delivery");
76
+ const delivery = session.queueLaunchCompletion?.(notification);
77
+ if (!delivery) throw new Error("Session cannot accept launch completion delivery");
78
+ return delivery;
79
+ });
80
+ let unregisterDispose: (() => void) | void;
81
+ let unregisterSessionChange: (() => void) | void;
82
+ const cleanup = (preservePending = false): void => {
83
+ if (!registration?.active) return;
84
+ registration.active = false;
85
+ unregister({ preservePending });
86
+ unregisterDispose?.();
87
+ unregisterSessionChange?.();
88
+ owners.delete(owner);
89
+ if (owners.size === 0) clients.delete(client);
90
+ if (clients.size === 0) completionRegistrations.delete(session);
91
+ };
92
+ registration = { inFlight: 0, retained: false, active: true, cleanup };
93
+ owners.set(owner, registration);
94
+ unregisterDispose = session.registerDisposeCallback?.(() => cleanup(true));
95
+ unregisterSessionChange = session.registerSessionChangeCallback?.(() => cleanup(true));
96
+ }
97
+ registration.inFlight++;
98
+ let settled = false;
99
+ const settle = (retain: boolean, preservePending = false): void => {
100
+ if (settled || !registration.active) return;
101
+ settled = true;
102
+ registration.inFlight--;
103
+ if (retain) registration.retained = true;
104
+ if (!registration.retained && registration.inFlight === 0) registration.cleanup(preservePending);
105
+ };
106
+ return {
107
+ retain: () => settle(true),
108
+ hasConcurrentRequest: () => registration.active && registration.inFlight > 1,
109
+ reject: preservePending => settle(false, preservePending),
110
+ };
111
+ }
112
+
38
113
  /** Broker-facing launch parameters; the hub adapts its `ps` op to `list` before calling in. */
39
114
  export interface LaunchParams {
40
115
  op: "start" | "list" | "logs" | "wait" | "send" | "stop" | "restart" | "describe";
@@ -321,11 +396,52 @@ export async function executeLaunch(
321
396
  signal?: AbortSignal,
322
397
  ): Promise<AgentToolResult<LaunchToolDetails>> {
323
398
  const client = await daemonClientForProject(session.cwd);
324
- const result = await client.request(operationFor(params, session), signal);
325
- return {
326
- content: [{ type: "text", text: replaceTabs(toolContent(result, params)) }],
327
- details: await toolDetails(result, params),
328
- };
399
+ const operation = operationFor(params, session);
400
+ const owner = operation.op === "start" ? operation.owner : undefined;
401
+ const resumedOwner = params.op !== "start" ? (session.getSessionId?.() ?? undefined) : undefined;
402
+ const completionLease = owner
403
+ ? registerCompletionSink(session, client, owner)
404
+ : resumedOwner
405
+ ? registerCompletionSink(session, client, resumedOwner)
406
+ : undefined;
407
+ try {
408
+ const result = await client.request(operation, signal);
409
+ const sessionOwner = session.getSessionId?.();
410
+ let resumedDaemonFound = false;
411
+ const daemons =
412
+ result.op === "list" ? result.daemons : "daemon" in result && result.daemon ? [result.daemon] : [];
413
+ for (const daemon of daemons) {
414
+ if (!daemon.owner || daemon.owner !== sessionOwner || TERMINAL_STATES[daemon.state]) continue;
415
+ resumedDaemonFound = true;
416
+ if (daemon.owner !== resumedOwner) registerCompletionSink(session, client, daemon.owner)?.retain();
417
+ }
418
+ if (params.op === "list" && resumedOwner && !resumedDaemonFound) completionLease?.reject(true);
419
+ else completionLease?.retain();
420
+ return {
421
+ content: [{ type: "text", text: replaceTabs(toolContent(result, params)) }],
422
+ details: await toolDetails(result, params),
423
+ };
424
+ } catch (error) {
425
+ if (error instanceof DaemonBrokerRejectedError && owner) {
426
+ if (completionLease?.hasConcurrentRequest()) {
427
+ completionLease.reject();
428
+ } else {
429
+ try {
430
+ const listed = await client.request({ op: "list" }, signal);
431
+ const ownerStillRunning =
432
+ listed.op === "list" &&
433
+ listed.daemons.some(daemon => daemon.owner === owner && !TERMINAL_STATES[daemon.state]);
434
+ if (ownerStillRunning) completionLease?.retain();
435
+ else completionLease?.reject(true);
436
+ } catch {
437
+ completionLease?.retain();
438
+ }
439
+ }
440
+ } else {
441
+ completionLease?.retain();
442
+ }
443
+ throw error;
444
+ }
329
445
  }
330
446
 
331
447
  // =============================================================================
@@ -1,5 +1,6 @@
1
1
  import * as os from "node:os";
2
2
  import * as path from "node:path";
3
+ import { type } from "@oh-my-pi/omptype";
3
4
  import { type ApiKey, type FetchImpl, getEnvApiKey, type Model, withAuth } from "@oh-my-pi/pi-ai";
4
5
  import { ProviderHttpError } from "@oh-my-pi/pi-ai/error";
5
6
  import {
@@ -20,7 +21,6 @@ import {
20
21
  Snowflake,
21
22
  untilAborted,
22
23
  } from "@oh-my-pi/pi-utils";
23
- import { type } from "arktype";
24
24
  import packageJson from "../../package.json" with { type: "json" };
25
25
  import { isAuthenticated, type ModelRegistry } from "../config/model-registry";
26
26
  import { settings } from "../config/settings";
@@ -16,6 +16,7 @@ import type { GoalModeState, GoalRuntime } from "../goals";
16
16
  import { GoalTool } from "../goals/tools/goal-tool";
17
17
  import type { HindsightSessionState } from "../hindsight/state";
18
18
  import type { LocalProtocolOptions } from "../internal-urls";
19
+ import type { DaemonCompletionNotification } from "../launch/protocol";
19
20
  import { LspTool } from "../lsp";
20
21
  import type { MCPManager } from "../mcp";
21
22
  import type { MnemopiSessionState } from "../mnemopi/state";
@@ -155,6 +156,8 @@ export interface ToolSession {
155
156
  additionalDirectories?: string[];
156
157
  /** Whether UI is available */
157
158
  hasUI: boolean;
159
+ /** Whether this session has begun disposal. */
160
+ isDisposed?: () => boolean;
158
161
  /**
159
162
  * Suppress the spawn specialization/coordination advisory appended to `task`
160
163
  * results. Set by internal/programmatic callers (e.g. the commit agent's
@@ -380,6 +383,12 @@ export interface ToolSession {
380
383
 
381
384
  /** Queue a hidden message to be injected at the next agent turn. */
382
385
  queueDeferredMessage?(message: CustomMessage): void;
386
+ /** Queue a broker supervised-process completion for the owning session. */
387
+ queueLaunchCompletion?(notification: DaemonCompletionNotification): Promise<void>;
388
+ /** Register cleanup that runs when this session is disposed; returns a handle that removes the cleanup. */
389
+ registerDisposeCallback?(callback: () => void): (() => void) | void;
390
+ /** Register cleanup that runs when this ToolSession adopts a different session ID. */
391
+ registerSessionChangeCallback?(callback: () => void): (() => void) | void;
383
392
  /** Queue late LSP diagnostics (arrived after an edit/write returned) to be shown
384
393
  * in the transcript and delivered to the model at the next yield, like background
385
394
  * job results. */
@@ -1,3 +1,4 @@
1
+ import { type } from "@oh-my-pi/omptype";
1
2
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
3
  import { instrumentedCompleteSimple, resolveTelemetry } from "@oh-my-pi/pi-agent-core";
3
4
  import {
@@ -9,7 +10,6 @@ import {
9
10
  type ToolExample,
10
11
  } from "@oh-my-pi/pi-ai";
11
12
  import { prompt } from "@oh-my-pi/pi-utils";
12
- import { type } from "arktype";
13
13
  import { extractTextContent } from "../commit/utils";
14
14
 
15
15
  import {
@@ -1,5 +1,5 @@
1
+ import { type } from "@oh-my-pi/omptype";
1
2
  import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
- import { type } from "arktype";
3
3
  import { sanitizeSkillName, writeManagedSkill } from "../autolearn/managed-skills";
4
4
  import { isNameClaimedByAuthoredSkill } from "../extensibility/skills";
5
5
  import { localBackend } from "../memory-backend/local-backend";
@@ -1,6 +1,6 @@
1
1
  import * as path from "node:path";
2
+ import { type } from "@oh-my-pi/omptype";
2
3
  import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
3
- import { type } from "arktype";
4
4
  import {
5
5
  deleteManagedSkill,
6
6
  getManagedSkillsDir,
@@ -1,5 +1,5 @@
1
+ import { type } from "@oh-my-pi/omptype";
1
2
  import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
- import { type } from "arktype";
3
3
  import memoryEditDescription from "../prompts/tools/memory-edit.md" with { type: "text" };
4
4
  import type { ToolSession } from ".";
5
5
 
@@ -1,6 +1,6 @@
1
+ import { type } from "@oh-my-pi/omptype";
1
2
  import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
3
  import { logger, untilAborted } from "@oh-my-pi/pi-utils";
3
- import { type } from "arktype";
4
4
  import { formatCurrentTime, formatMemories } from "../hindsight/content";
5
5
  import recallDescription from "../prompts/tools/recall.md" with { type: "text" };
6
6
  import type { ToolSession } from ".";
@@ -1,6 +1,6 @@
1
+ import { type } from "@oh-my-pi/omptype";
1
2
  import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
3
  import { logger, untilAborted } from "@oh-my-pi/pi-utils";
3
- import { type } from "arktype";
4
4
  import { ensureBankExists } from "../hindsight/bank";
5
5
  import reflectDescription from "../prompts/tools/reflect.md" with { type: "text" };
6
6
  import type { ToolSession } from ".";
@@ -1,5 +1,5 @@
1
+ import { type } from "@oh-my-pi/omptype";
1
2
  import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
- import { type } from "arktype";
3
3
  import retainDescription from "../prompts/tools/retain.md" with { type: "text" };
4
4
  import type { ToolSession } from ".";
5
5
 
package/src/tools/read.ts CHANGED
@@ -3,6 +3,7 @@ import * as fs from "node:fs/promises";
3
3
  import * as os from "node:os";
4
4
  import * as path from "node:path";
5
5
  import { formatHashlineHeader, formatNumberedLine, formatNumberedLines } from "@oh-my-pi/hashline";
6
+ import { type } from "@oh-my-pi/omptype";
6
7
  import type {
7
8
  AgentTool,
8
9
  AgentToolContext,
@@ -25,7 +26,6 @@ import {
25
26
  readImageMetadata,
26
27
  untilAborted,
27
28
  } from "@oh-my-pi/pi-utils";
28
- import { type } from "arktype";
29
29
  import { LRUCache } from "lru-cache/raw";
30
30
  import {
31
31
  canonicalSnapshotKey,
@@ -1,5 +1,5 @@
1
+ import { type } from "@oh-my-pi/omptype";
1
2
  import type { AgentTool, AgentToolResult, ToolTier } from "@oh-my-pi/pi-agent-core";
2
- import { type } from "arktype";
3
3
  import securityScanDescription from "../prompts/tools/security-scan.md" with { type: "text" };
4
4
  import { selectSecurityAccount } from "../security/auth";
5
5
  import {
package/src/tools/todo.ts CHANGED
@@ -1,9 +1,9 @@
1
+ import { type } from "@oh-my-pi/omptype";
1
2
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
2
3
  import type { ToolExample } from "@oh-my-pi/pi-ai";
3
4
  import type { Component } from "@oh-my-pi/pi-tui";
4
5
  import { Text } from "@oh-my-pi/pi-tui";
5
6
  import { isRecord, prompt, sanitizeText } from "@oh-my-pi/pi-utils";
6
- import { type } from "arktype";
7
7
  import chalk from "chalk";
8
8
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
9
9
  import type { Theme } from "../modes/theme/theme";
package/src/tools/tts.ts CHANGED
@@ -3,10 +3,10 @@
3
3
  // backend (Kokoro-82M via kokoro-js on the shared ONNX worker) is layered on behind
4
4
  // the `providers.tts` switch.
5
5
 
6
+ import { type } from "@oh-my-pi/omptype";
6
7
  import type { AgentToolResult } from "@oh-my-pi/pi-agent-core";
7
8
  import { type ApiKey, withAuth } from "@oh-my-pi/pi-ai";
8
9
  import { ProviderHttpError } from "@oh-my-pi/pi-ai/error";
9
- import { type } from "arktype";
10
10
  import { settings } from "../config/settings";
11
11
  import type { CustomTool, CustomToolContext } from "../extensibility/custom-tools/types";
12
12
  import { ohMyPiXAIUserAgent, resolveXAIHttpCredentials } from "../lib/xai-http";
package/src/tools/vibe.ts CHANGED
@@ -10,11 +10,12 @@
10
10
  * terminal), and wait/list draw the "TV wall" — one live screen per worker,
11
11
  * stacked, each showing its tool calls and streamed text as it works.
12
12
  */
13
+
14
+ import { type } from "@oh-my-pi/omptype";
13
15
  import type { AgentTool, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
14
16
  import type { Component } from "@oh-my-pi/pi-tui";
15
17
  import { Text } from "@oh-my-pi/pi-tui";
16
18
  import { prompt } from "@oh-my-pi/pi-utils";
17
- import { type } from "arktype";
18
19
  import type { RenderResultOptions } from "../extensibility/custom-tools/types";
19
20
  import { shimmerEnabled, shimmerText } from "../modes/theme/shimmer";
20
21
  import type { Theme } from "../modes/theme/theme";
@@ -3,6 +3,7 @@ import * as fs from "node:fs/promises";
3
3
  import * as path from "node:path";
4
4
 
5
5
  import { formatHashlineHeader, stripHashlinePrefixes } from "@oh-my-pi/hashline";
6
+ import { type } from "@oh-my-pi/omptype";
6
7
  import type {
7
8
  AgentTool,
8
9
  AgentToolContext,
@@ -12,7 +13,6 @@ import type {
12
13
  } from "@oh-my-pi/pi-agent-core";
13
14
  import { type Component, Text } from "@oh-my-pi/pi-tui";
14
15
  import { isEnoent, isRecord, prompt, untilAborted } from "@oh-my-pi/pi-utils";
15
- import { type } from "arktype";
16
16
 
17
17
  import { canonicalSnapshotKey, getFileSnapshotStore } from "../edit/file-snapshot-store";
18
18
  import { normalizeToLF } from "../edit/normalize";
@@ -4,10 +4,11 @@
4
4
  * Single tool supporting Anthropic, Perplexity, Exa, Brave, Jina, Kimi, Gemini, Codex, Tavily, Kagi, Z.AI, SearXNG, and Synthetic
5
5
  * providers with provider-specific parameters exposed conditionally.
6
6
  */
7
+
8
+ import { type } from "@oh-my-pi/omptype";
7
9
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
8
10
  import type { AuthStorage } from "@oh-my-pi/pi-ai";
9
11
  import { prompt } from "@oh-my-pi/pi-utils";
10
- import { type } from "arktype";
11
12
  import { ModelRegistry } from "../../config/model-registry";
12
13
  import { settings } from "../../config/settings";
13
14
  import type { CustomTool, CustomToolContext, RenderResultOptions } from "../../extensibility/custom-tools/types";
@@ -1,29 +0,0 @@
1
- export interface FileLockOptions {
2
- staleMs?: number;
3
- retries?: number;
4
- retryDelayMs?: number;
5
- }
6
- interface LockInfo {
7
- pid: number;
8
- timestamp: number;
9
- token: string;
10
- }
11
- declare function getLockPath(filePath: string): string;
12
- declare function readLockInfo(lockPath: string): Promise<LockInfo | null>;
13
- declare function isLockStale(lockPath: string, staleMs: number): Promise<boolean>;
14
- declare function tryAcquireLock(lockPath: string): Promise<string | null>;
15
- declare function releaseLock(lockPath: string, expectedToken?: string): Promise<void>;
16
- export declare function withFileLock<T>(filePath: string, fn: () => Promise<T>, options?: FileLockOptions): Promise<T>;
17
- /**
18
- * Test-only handles for the internal lock primitives. These are NOT part of
19
- * the public API — they exist so the contract tests can validate token-keyed
20
- * release semantics and the mkdir-race window without re-implementing them.
21
- */
22
- export declare const __internalsForTesting: {
23
- tryAcquireLock: typeof tryAcquireLock;
24
- releaseLock: typeof releaseLock;
25
- readLockInfo: typeof readLockInfo;
26
- isLockStale: typeof isLockStale;
27
- getLockPath: typeof getLockPath;
28
- };
29
- export {};
@@ -1,181 +0,0 @@
1
- /**
2
- * Minimal `@sinclair/typebox` runtime compatibility shim.
3
- *
4
- * Historically the coding agent injected the real `@sinclair/typebox` (~5MB
5
- * dependency) into extensions, hooks, custom tools, and custom commands so
6
- * they could author parameter schemas as `Type.Object({ name: Type.String() })`.
7
- *
8
- * This module provides the subset those integrations depend on:
9
- *
10
- * - TypeBox-style `Type.*` builders.
11
- * - Runtime validation through `schema.safeParse(input)` and `schema.__validator(input)`.
12
- * - Enumerable JSON Schema keywords so `{ ...schema }`, `JSON.stringify(schema)`,
13
- * and `toolWireSchema({ parameters: schema })` all see the same schema.
14
- *
15
- * Internal validator fields and methods are intentionally non-enumerable. The
16
- * object should look like JSON Schema at every serialization/wire boundary and
17
- * like a small validator at runtime.
18
- */
19
- export type TSchema = ArkSchema;
20
- export type Static<T extends ArkSchema> = T["__infer"];
21
- export type TAny = ArkSchema;
22
- export type TUnknown = ArkSchema;
23
- export type TNever = ArkSchema;
24
- export type TNull = ArkSchema;
25
- export type TString = ArkSchema;
26
- export type TNumber = ArkSchema;
27
- export type TInteger = ArkSchema;
28
- export type TBoolean = ArkSchema;
29
- export type TLiteral<_V extends string | number | boolean> = ArkSchema;
30
- export type TArray<_E extends ArkSchema> = ArkSchema;
31
- export type TObject<_P extends Record<string, ArkSchema> = Record<string, ArkSchema>> = ArkSchema;
32
- export type TOptional<_E extends ArkSchema> = ArkSchema;
33
- export type TUnion<_T extends readonly ArkSchema[] = readonly ArkSchema[]> = ArkSchema;
34
- export type TEnum<_T extends readonly (string | number)[] = readonly (string | number)[]> = ArkSchema;
35
- export type TRecord<_K extends ArkSchema, _V extends ArkSchema> = ArkSchema;
36
- /** TypeBox-compatible wrapper for raw JSON Schema documents. */
37
- export type TUnsafe<_T = unknown> = ArkSchema;
38
- declare const VALIDATION_FAILURE: unique symbol;
39
- interface ValidationFailure {
40
- message: string;
41
- readonly [VALIDATION_FAILURE]: true;
42
- }
43
- interface SafeParseSuccess {
44
- success: true;
45
- data: unknown;
46
- }
47
- interface SafeParseFailure {
48
- success: false;
49
- error: ValidationFailure;
50
- }
51
- /**
52
- * JSON-Schema-shaped object with non-enumerable runtime helpers.
53
- * Validators return the validated data or a marked `{ message }` failure.
54
- */
55
- interface ArkSchema {
56
- __validator: (data: unknown) => unknown;
57
- __metadata?: Record<string, unknown>;
58
- __optional?: true;
59
- __properties?: Record<string, ArkSchema>;
60
- __additionalProperties?: boolean | ArkSchema;
61
- __infer?: unknown;
62
- __inner?: ArkSchema;
63
- safeParse(input: unknown): SafeParseSuccess | SafeParseFailure;
64
- toJSON(): Record<string, unknown>;
65
- [key: string]: unknown;
66
- }
67
- interface Meta {
68
- title?: string;
69
- description?: string;
70
- default?: unknown;
71
- examples?: unknown[];
72
- [key: string]: unknown;
73
- }
74
- interface StringOpts extends Meta {
75
- minLength?: number;
76
- maxLength?: number;
77
- pattern?: string;
78
- format?: string;
79
- }
80
- interface NumberOpts extends Meta {
81
- minimum?: number;
82
- maximum?: number;
83
- exclusiveMinimum?: number;
84
- exclusiveMaximum?: number;
85
- multipleOf?: number;
86
- }
87
- interface ArrayOpts extends Meta {
88
- minItems?: number;
89
- maxItems?: number;
90
- uniqueItems?: boolean;
91
- }
92
- interface ObjectOpts extends Meta {
93
- /**
94
- * TypeBox default: extra keys are preserved. Set `false` to reject unknowns,
95
- * `true` to allow any, or a schema to validate them.
96
- */
97
- additionalProperties?: boolean | ArkSchema;
98
- }
99
- declare function tString(opts?: StringOpts): ArkSchema;
100
- declare function tNumber(opts?: NumberOpts): ArkSchema;
101
- declare function tInteger(opts?: NumberOpts): ArkSchema;
102
- declare function tBoolean(opts?: Meta): ArkSchema;
103
- declare function tNull(opts?: Meta): ArkSchema;
104
- declare function tAny(opts?: Meta): ArkSchema;
105
- declare function tUnknown(opts?: Meta): ArkSchema;
106
- declare function tNever(opts?: Meta): ArkSchema;
107
- declare function tLiteral<V extends string | number | boolean>(value: V, opts?: Meta): ArkSchema;
108
- declare function tUnion<T extends readonly ArkSchema[]>(schemas: T, opts?: Meta): ArkSchema;
109
- declare function tIntersect(schemas: readonly ArkSchema[], opts?: Meta): ArkSchema;
110
- declare function tEnum<T extends Record<string, string | number> | readonly (string | number)[]>(values: T, opts?: Meta): ArkSchema;
111
- declare function tArray<E extends ArkSchema>(item: E, opts?: ArrayOpts): ArkSchema;
112
- declare function tTuple(items: readonly ArkSchema[], opts?: Meta): ArkSchema;
113
- declare function tObject<P extends Record<string, ArkSchema>>(properties: P, opts?: ObjectOpts): ArkSchema;
114
- declare function tRecord<K extends ArkSchema, V extends ArkSchema>(key: K, value: V, opts?: Meta): ArkSchema;
115
- declare function tOptional<E extends ArkSchema>(schema: E, opts?: Meta): ArkSchema;
116
- declare function tNullable<E extends ArkSchema>(schema: E, opts?: Meta): ArkSchema;
117
- declare function tReadonly<E extends ArkSchema>(schema: E): ArkSchema;
118
- declare function tPartial<_P extends Record<string, ArkSchema>>(obj: ArkSchema): ArkSchema;
119
- declare function tRequired<_P extends Record<string, ArkSchema>>(obj: ArkSchema): ArkSchema;
120
- declare function tPick<P extends Record<string, ArkSchema>, K extends keyof P>(obj: ArkSchema, keys: readonly K[]): ArkSchema;
121
- declare function tOmit<P extends Record<string, ArkSchema>, K extends keyof P>(obj: ArkSchema, keys: readonly K[]): ArkSchema;
122
- declare function tComposite(objects: readonly ArkSchema[], opts?: Meta): ArkSchema;
123
- export declare const Type: {
124
- readonly String: typeof tString;
125
- readonly Number: typeof tNumber;
126
- readonly Integer: typeof tInteger;
127
- readonly Boolean: typeof tBoolean;
128
- readonly Null: typeof tNull;
129
- readonly Any: typeof tAny;
130
- readonly Unknown: typeof tUnknown;
131
- readonly Unsafe: <T = unknown>(jsonSchema?: Record<string, unknown>) => TUnsafe<T>;
132
- readonly Never: typeof tNever;
133
- readonly Literal: typeof tLiteral;
134
- readonly Union: typeof tUnion;
135
- readonly Intersect: typeof tIntersect;
136
- readonly Enum: typeof tEnum;
137
- readonly Array: typeof tArray;
138
- readonly Tuple: typeof tTuple;
139
- readonly Object: typeof tObject;
140
- readonly Record: typeof tRecord;
141
- readonly Optional: typeof tOptional;
142
- readonly Nullable: typeof tNullable;
143
- readonly Readonly: typeof tReadonly;
144
- readonly Partial: typeof tPartial;
145
- readonly Required: typeof tRequired;
146
- readonly Pick: typeof tPick;
147
- readonly Omit: typeof tOmit;
148
- readonly Composite: typeof tComposite;
149
- };
150
- export type TypeBuilder = typeof Type;
151
- /** Default namespace export so `import * as typebox from "./typebox.js"` still resolves the `Type` key. */
152
- declare const _default: {
153
- Type: {
154
- readonly String: typeof tString;
155
- readonly Number: typeof tNumber;
156
- readonly Integer: typeof tInteger;
157
- readonly Boolean: typeof tBoolean;
158
- readonly Null: typeof tNull;
159
- readonly Any: typeof tAny;
160
- readonly Unknown: typeof tUnknown;
161
- readonly Unsafe: <T = unknown>(jsonSchema?: Record<string, unknown>) => TUnsafe<T>;
162
- readonly Never: typeof tNever;
163
- readonly Literal: typeof tLiteral;
164
- readonly Union: typeof tUnion;
165
- readonly Intersect: typeof tIntersect;
166
- readonly Enum: typeof tEnum;
167
- readonly Array: typeof tArray;
168
- readonly Tuple: typeof tTuple;
169
- readonly Object: typeof tObject;
170
- readonly Record: typeof tRecord;
171
- readonly Optional: typeof tOptional;
172
- readonly Nullable: typeof tNullable;
173
- readonly Readonly: typeof tReadonly;
174
- readonly Partial: typeof tPartial;
175
- readonly Required: typeof tRequired;
176
- readonly Pick: typeof tPick;
177
- readonly Omit: typeof tOmit;
178
- readonly Composite: typeof tComposite;
179
- };
180
- };
181
- export default _default;