@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.
- package/CHANGELOG.md +14 -0
- package/package.json +7 -7
- package/src/commit/agentic/tools/analyze-file.ts +1 -0
- package/src/extensibility/custom-tools/types.ts +3 -0
- package/src/extensibility/extensions/runner.ts +7 -0
- package/src/extensibility/extensions/types.ts +4 -0
- package/src/ipy/cancellation.ts +28 -0
- package/src/ipy/executor.ts +252 -77
- package/src/ipy/kernel.ts +181 -35
- package/src/ipy/modules.ts +39 -4
- package/src/modes/acp/acp-agent.ts +1 -0
- package/src/modes/controllers/extension-ui-controller.ts +3 -0
- package/src/modes/controllers/input-controller.ts +1 -0
- package/src/modes/print-mode.ts +1 -0
- package/src/modes/prompt-action-autocomplete.ts +5 -3
- package/src/modes/rpc/rpc-mode.ts +1 -0
- package/src/prompts/tools/grep.md +1 -1
- package/src/sdk.ts +17 -1
- package/src/session/agent-session.ts +6 -0
- package/src/task/executor.ts +4 -0
- package/src/task/index.ts +2 -0
- package/src/tools/find.ts +1 -0
- package/src/tools/grep.ts +21 -17
- package/src/tools/index.ts +3 -0
- package/src/tools/python.ts +3 -2
package/src/task/executor.ts
CHANGED
|
@@ -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
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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);
|
package/src/tools/index.ts
CHANGED
|
@@ -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) */
|
package/src/tools/python.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
271
|
+
deadlineMs,
|
|
271
272
|
signal: combinedSignal,
|
|
272
273
|
sessionId,
|
|
273
274
|
kernelMode: this.session.settings.get("python.kernelMode"),
|