@oh-my-pi/pi-coding-agent 13.16.0 → 13.16.1

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.
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import path from "node:path";
7
7
  import type { AgentEvent, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
8
+ import type { SearchDb } from "@oh-my-pi/pi-natives";
8
9
  import { logger, untilAborted } from "@oh-my-pi/pi-utils";
9
10
  import type { TSchema } from "@sinclair/typebox";
10
11
  import Ajv, { type ValidateFunction } from "ajv";
@@ -147,6 +148,7 @@ export interface ExecutorOptions {
147
148
  mcpManager?: MCPManager;
148
149
  authStorage?: AuthStorage;
149
150
  modelRegistry?: ModelRegistry;
151
+ searchDb?: SearchDb;
150
152
  settings?: Settings;
151
153
  }
152
154
 
@@ -950,6 +952,7 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
950
952
  cwd: worktree ?? cwd,
951
953
  authStorage,
952
954
  modelRegistry,
955
+ searchDb: options.searchDb,
953
956
  settings: subagentSettings,
954
957
  model,
955
958
  thinkingLevel: effectiveThinkingLevel,
@@ -1042,6 +1045,7 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
1042
1045
  },
1043
1046
  {
1044
1047
  getModel: () => session.model,
1048
+ getSearchDb: () => session.searchDb,
1045
1049
  isIdle: () => !session.isStreaming,
1046
1050
  abort: () => session.abort(),
1047
1051
  hasPendingMessages: () => session.queuedMessageCount > 0,
package/src/task/index.ts CHANGED
@@ -775,6 +775,7 @@ export class TaskTool implements AgentTool<TaskSchema, TaskToolDetails, Theme> {
775
775
  },
776
776
  authStorage: this.session.authStorage,
777
777
  modelRegistry: this.session.modelRegistry,
778
+ searchDb: this.session.searchDb,
778
779
  settings: this.session.settings,
779
780
  mcpManager: this.session.mcpManager,
780
781
  contextFiles,
@@ -828,6 +829,7 @@ export class TaskTool implements AgentTool<TaskSchema, TaskToolDetails, Theme> {
828
829
  },
829
830
  authStorage: this.session.authStorage,
830
831
  modelRegistry: this.session.modelRegistry,
832
+ searchDb: this.session.searchDb,
831
833
  settings: this.session.settings,
832
834
  mcpManager: this.session.mcpManager,
833
835
  contextFiles,
package/src/tools/find.ts CHANGED
@@ -261,6 +261,7 @@ export class FindTool implements AgentTool<typeof findSchema, FindToolDetails> {
261
261
  gitignore: useGitignore,
262
262
  },
263
263
  onMatch,
264
+ this.session.searchDb,
264
265
  ),
265
266
  );
266
267
 
package/src/tools/grep.ts CHANGED
@@ -169,23 +169,27 @@ export class GrepTool implements AgentTool<typeof grepSchema, GrepToolDetails> {
169
169
  // Run grep
170
170
  let result: GrepResult;
171
171
  try {
172
- result = await grep({
173
- pattern: normalizedPattern,
174
- path: searchPath,
175
- glob: globFilter,
176
- type: type?.trim() || undefined,
177
- ignoreCase,
178
- multiline: effectiveMultiline,
179
- hidden: true,
180
- gitignore: useGitignore,
181
- cache: false,
182
- maxCount: internalLimit,
183
- offset: normalizedOffset > 0 ? normalizedOffset : undefined,
184
- contextBefore: normalizedContextBefore,
185
- contextAfter: normalizedContextAfter,
186
- maxColumns: DEFAULT_MAX_COLUMN,
187
- mode: effectiveOutputMode,
188
- });
172
+ result = await grep(
173
+ {
174
+ pattern: normalizedPattern,
175
+ path: searchPath,
176
+ glob: globFilter,
177
+ type: type?.trim() || undefined,
178
+ ignoreCase,
179
+ multiline: effectiveMultiline,
180
+ hidden: true,
181
+ gitignore: useGitignore,
182
+ cache: false,
183
+ maxCount: internalLimit,
184
+ offset: normalizedOffset > 0 ? normalizedOffset : undefined,
185
+ contextBefore: normalizedContextBefore,
186
+ contextAfter: normalizedContextAfter,
187
+ maxColumns: DEFAULT_MAX_COLUMN,
188
+ mode: effectiveOutputMode,
189
+ },
190
+ undefined,
191
+ this.session.searchDb,
192
+ );
189
193
  } catch (err) {
190
194
  if (err instanceof Error && err.message.startsWith("regex parse error")) {
191
195
  throw new ToolError(err.message);
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool } from "@oh-my-pi/pi-agent-core";
2
+ import type { SearchDb } from "@oh-my-pi/pi-natives";
2
3
  import { $env, logger } from "@oh-my-pi/pi-utils";
3
4
  import type { AsyncJobManager } from "../async";
4
5
  import type { PromptTemplate } from "../config/prompt-templates";
@@ -144,6 +145,8 @@ export interface ToolSession {
144
145
  asyncJobManager?: AsyncJobManager;
145
146
  /** Settings instance for passing to subagents */
146
147
  settings: Settings;
148
+ /** Shared native search DB for grep/glob/fuzzyFind-backed workflows. */
149
+ searchDb?: SearchDb;
147
150
  /** Plan mode state (if active) */
148
151
  getPlanModeState?: () => PlanModeState | undefined;
149
152
  /** Get compact conversation context for subagents (excludes tool results, system prompts) */
@@ -180,7 +180,8 @@ export class PythonTool implements AgentTool<typeof pythonSchema> {
180
180
  // Clamp to reasonable range: 1s - 600s (10 min)
181
181
  const timeoutSec = clampTimeout("python", rawTimeout);
182
182
  const timeoutMs = timeoutSec * 1000;
183
- const timeoutSignal = AbortSignal.timeout(timeoutMs);
183
+ const deadlineMs = Date.now() + timeoutMs;
184
+ const timeoutSignal = AbortSignal.timeout(Math.max(0, deadlineMs - Date.now()));
184
185
  const combinedSignal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
185
186
  let outputSink: OutputSink | undefined;
186
187
  let outputSummary: OutputSummary | undefined;
@@ -267,7 +268,7 @@ export class PythonTool implements AgentTool<typeof pythonSchema> {
267
268
  const sessionId = sessionFile ? `session:${sessionFile}:cwd:${commandCwd}` : `cwd:${commandCwd}`;
268
269
  const baseExecutorOptions: Omit<PythonExecutorOptions, "reset"> = {
269
270
  cwd: commandCwd,
270
- timeoutMs,
271
+ deadlineMs,
271
272
  signal: combinedSignal,
272
273
  sessionId,
273
274
  kernelMode: this.session.settings.get("python.kernelMode"),