@oh-my-pi/pi-coding-agent 15.0.1 → 15.1.0
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 +94 -1
- package/examples/custom-tools/README.md +11 -7
- package/examples/custom-tools/hello/index.ts +2 -2
- package/examples/extensions/README.md +19 -8
- package/examples/extensions/api-demo.ts +15 -19
- package/examples/extensions/hello.ts +5 -6
- package/examples/extensions/plan-mode.ts +1 -1
- package/examples/extensions/reload-runtime.ts +4 -3
- package/examples/extensions/with-deps/index.ts +4 -3
- package/examples/sdk/06-extensions.ts +4 -2
- package/package.json +8 -18
- package/src/autoresearch/tools/init-experiment.ts +38 -41
- package/src/autoresearch/tools/log-experiment.ts +32 -41
- package/src/autoresearch/tools/run-experiment.ts +3 -3
- package/src/autoresearch/tools/update-notes.ts +11 -11
- package/src/commands/commit.ts +10 -0
- package/src/commit/agentic/tools/analyze-file.ts +4 -4
- package/src/commit/agentic/tools/git-file-diff.ts +4 -4
- package/src/commit/agentic/tools/git-hunk.ts +5 -5
- package/src/commit/agentic/tools/git-overview.ts +4 -4
- package/src/commit/agentic/tools/propose-changelog.ts +13 -13
- package/src/commit/agentic/tools/propose-commit.ts +6 -6
- package/src/commit/agentic/tools/recent-commits.ts +3 -3
- package/src/commit/agentic/tools/schemas.ts +28 -28
- package/src/commit/agentic/tools/split-commit.ts +22 -21
- package/src/commit/analysis/summary.ts +4 -4
- package/src/commit/changelog/generate.ts +7 -11
- package/src/commit/shared-llm.ts +22 -34
- package/src/config/config-file.ts +35 -13
- package/src/config/model-registry.ts +40 -191
- package/src/config/models-config-schema.ts +166 -0
- package/src/config/settings-schema.ts +29 -0
- package/src/discovery/claude-plugins.ts +19 -7
- package/src/edit/index.ts +2 -2
- package/src/edit/modes/apply-patch.ts +7 -6
- package/src/edit/modes/patch.ts +18 -25
- package/src/edit/modes/replace.ts +18 -20
- package/src/eval/js/shared/rewrite-imports.ts +131 -10
- package/src/eval/py/executor.ts +233 -623
- package/src/eval/py/kernel.ts +27 -2
- package/src/eval/py/runner.py +42 -11
- package/src/eval/py/runtime.ts +1 -0
- package/src/exa/factory.ts +5 -4
- package/src/exa/mcp-client.ts +1 -1
- package/src/exa/researcher.ts +9 -20
- package/src/exa/search.ts +26 -52
- package/src/exa/types.ts +1 -1
- package/src/exa/websets.ts +54 -53
- package/src/exec/bash-executor.ts +2 -1
- package/src/extensibility/custom-commands/loader.ts +5 -3
- package/src/extensibility/custom-commands/types.ts +4 -2
- package/src/extensibility/custom-tools/loader.ts +5 -3
- package/src/extensibility/custom-tools/types.ts +7 -6
- package/src/extensibility/custom-tools/wrapper.ts +1 -1
- package/src/extensibility/extensions/get-commands-handler.ts +77 -0
- package/src/extensibility/extensions/loader.ts +7 -3
- package/src/extensibility/extensions/types.ts +9 -5
- package/src/extensibility/extensions/wrapper.ts +1 -2
- package/src/extensibility/hooks/loader.ts +3 -1
- package/src/extensibility/hooks/tool-wrapper.ts +1 -1
- package/src/extensibility/hooks/types.ts +4 -2
- package/src/extensibility/plugins/legacy-pi-compat.ts +78 -31
- package/src/extensibility/shared-events.ts +1 -1
- package/src/extensibility/typebox.ts +391 -0
- package/src/goals/tools/goal-tool.ts +6 -12
- package/src/hashline/input.ts +2 -1
- package/src/hashline/parser.ts +27 -3
- package/src/hashline/types.ts +4 -4
- package/src/hindsight/state.ts +2 -2
- package/src/index.ts +0 -2
- package/src/internal-urls/docs-index.generated.ts +15 -15
- package/src/internal-urls/router.ts +8 -0
- package/src/internal-urls/types.ts +21 -0
- package/src/lsp/config.ts +15 -6
- package/src/lsp/defaults.json +6 -2
- package/src/lsp/types.ts +30 -38
- package/src/mcp/manager.ts +1 -1
- package/src/mcp/tool-bridge.ts +1 -1
- package/src/modes/acp/acp-agent.ts +248 -50
- package/src/modes/components/session-observer-overlay.ts +12 -1
- package/src/modes/components/status-line/segments.ts +39 -4
- package/src/modes/controllers/command-controller.ts +27 -2
- package/src/modes/controllers/event-controller.ts +3 -4
- package/src/modes/controllers/extension-ui-controller.ts +3 -2
- package/src/modes/interactive-mode.ts +1 -1
- package/src/modes/rpc/host-tools.ts +1 -1
- package/src/modes/rpc/host-uris.ts +235 -0
- package/src/modes/rpc/rpc-client.ts +1 -1
- package/src/modes/rpc/rpc-mode.ts +27 -1
- package/src/modes/rpc/rpc-types.ts +58 -1
- package/src/modes/runtime-init.ts +2 -1
- package/src/modes/theme/defaults/dark-poimandres.json +1 -0
- package/src/modes/theme/defaults/light-poimandres.json +1 -0
- package/src/modes/theme/theme.ts +117 -117
- package/src/modes/types.ts +1 -1
- package/src/modes/utils/context-usage.ts +2 -2
- package/src/prompts/tools/github.md +4 -4
- package/src/prompts/tools/hashline.md +22 -26
- package/src/prompts/tools/read.md +55 -37
- package/src/sdk.ts +31 -8
- package/src/session/agent-session.ts +74 -104
- package/src/session/messages.ts +16 -51
- package/src/session/session-manager.ts +22 -2
- package/src/session/streaming-output.ts +16 -6
- package/src/task/discovery.ts +5 -2
- package/src/task/executor.ts +210 -87
- package/src/task/index.ts +15 -11
- package/src/task/render.ts +32 -5
- package/src/task/types.ts +54 -39
- package/src/tools/ask.ts +12 -12
- package/src/tools/ast-edit.ts +11 -15
- package/src/tools/ast-grep.ts +9 -10
- package/src/tools/bash-command-fixup.ts +47 -0
- package/src/tools/bash.ts +48 -38
- package/src/tools/browser/render.ts +2 -2
- package/src/tools/browser.ts +39 -53
- package/src/tools/calculator.ts +12 -11
- package/src/tools/checkpoint.ts +7 -7
- package/src/tools/debug.ts +40 -43
- package/src/tools/eval.ts +16 -10
- package/src/tools/find.ts +10 -13
- package/src/tools/gh.ts +108 -132
- package/src/tools/hindsight-recall.ts +4 -6
- package/src/tools/hindsight-reflect.ts +5 -5
- package/src/tools/hindsight-retain.ts +15 -17
- package/src/tools/image-gen.ts +31 -81
- package/src/tools/index.ts +4 -1
- package/src/tools/inspect-image.ts +8 -9
- package/src/tools/irc.ts +15 -27
- package/src/tools/job.ts +30 -28
- package/src/tools/output-meta.ts +26 -0
- package/src/tools/read.ts +39 -12
- package/src/tools/recipe/index.ts +7 -9
- package/src/tools/render-mermaid.ts +12 -12
- package/src/tools/report-tool-issue.ts +4 -4
- package/src/tools/resolve.ts +11 -11
- package/src/tools/review.ts +14 -26
- package/src/tools/search-tool-bm25.ts +7 -9
- package/src/tools/search.ts +19 -22
- package/src/tools/ssh.ts +10 -9
- package/src/tools/todo-write.ts +26 -34
- package/src/tools/vim.ts +10 -26
- package/src/tools/write.ts +25 -5
- package/src/tools/yield.ts +100 -54
- package/src/web/search/index.ts +9 -24
- package/src/web/search/providers/anthropic.ts +5 -0
- package/src/web/search/providers/exa.ts +3 -0
- package/src/web/search/providers/gemini.ts +5 -0
- package/src/web/search/providers/jina.ts +5 -2
- package/src/web/search/providers/zai.ts +5 -2
- package/src/prompts/compaction/branch-summary-context.md +0 -5
- package/src/prompts/compaction/branch-summary-preamble.md +0 -2
- package/src/prompts/compaction/branch-summary.md +0 -30
- package/src/prompts/compaction/compaction-short-summary.md +0 -9
- package/src/prompts/compaction/compaction-summary-context.md +0 -5
- package/src/prompts/compaction/compaction-summary.md +0 -38
- package/src/prompts/compaction/compaction-turn-prefix.md +0 -17
- package/src/prompts/compaction/compaction-update-summary.md +0 -45
- package/src/prompts/system/auto-handoff-threshold-focus.md +0 -1
- package/src/prompts/system/file-operations.md +0 -10
- package/src/prompts/system/handoff-document.md +0 -49
- package/src/prompts/system/summarization-system.md +0 -3
- package/src/session/compaction/branch-summarization.ts +0 -324
- package/src/session/compaction/compaction.ts +0 -1420
- package/src/session/compaction/errors.ts +0 -31
- package/src/session/compaction/index.ts +0 -8
- package/src/session/compaction/pruning.ts +0 -91
- package/src/session/compaction/utils.ts +0 -184
package/src/tools/browser.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
|
-
import { StringEnum } from "@oh-my-pi/pi-ai";
|
|
3
2
|
import { prompt, untilAborted } from "@oh-my-pi/pi-utils";
|
|
4
|
-
import
|
|
3
|
+
import * as z from "zod/v4";
|
|
5
4
|
import browserDescription from "../prompts/tools/browser.md" with { type: "text" };
|
|
6
5
|
import type { ToolSession } from "../sdk";
|
|
7
6
|
import { acquireBrowser, type BrowserHandle, type BrowserKind, type BrowserKindTag } from "./browser/registry";
|
|
@@ -18,62 +17,49 @@ export type { Observation, ObservationEntry } from "./browser/tab-protocol";
|
|
|
18
17
|
|
|
19
18
|
const DEFAULT_TAB_NAME = "main";
|
|
20
19
|
|
|
21
|
-
const appSchema =
|
|
22
|
-
path:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}),
|
|
27
|
-
),
|
|
28
|
-
cdp_url: Type.Optional(
|
|
29
|
-
Type.String({
|
|
30
|
-
description: "existing CDP endpoint to connect to (e.g. http://127.0.0.1:9222)",
|
|
31
|
-
}),
|
|
32
|
-
),
|
|
33
|
-
args: Type.Optional(Type.Array(Type.String(), { description: "extra CLI args when spawning" })),
|
|
34
|
-
target: Type.Optional(Type.String({ description: "substring matched against url+title to pick a BrowserWindow" })),
|
|
20
|
+
const appSchema = z.object({
|
|
21
|
+
path: z.string().describe("absolute path to a binary to spawn (single-instance reuse)").optional(),
|
|
22
|
+
cdp_url: z.string().describe("existing CDP endpoint to connect to (e.g. http://127.0.0.1:9222)").optional(),
|
|
23
|
+
args: z.array(z.string()).describe("extra CLI args when spawning").optional(),
|
|
24
|
+
target: z.string().describe("substring matched against url+title to pick a BrowserWindow").optional(),
|
|
35
25
|
});
|
|
36
26
|
|
|
37
|
-
const browserSchema =
|
|
38
|
-
action:
|
|
39
|
-
name:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
),
|
|
70
|
-
timeout: Type.Optional(Type.Number({ description: "timeout in seconds", default: 30 })),
|
|
71
|
-
all: Type.Optional(Type.Boolean({ description: "close: close every tab" })),
|
|
72
|
-
kill: Type.Optional(Type.Boolean({ description: "close: also kill spawned-app browsers (default: leave running)" })),
|
|
27
|
+
const browserSchema = z.object({
|
|
28
|
+
action: z.enum(["open", "close", "run"] as const).describe("tab/browser operation"),
|
|
29
|
+
name: z
|
|
30
|
+
.string()
|
|
31
|
+
.describe("tab id; default 'main'. Multiple tabs can coexist; reusable across run() calls and subagents.")
|
|
32
|
+
.optional(),
|
|
33
|
+
url: z.string().describe("open: navigate after acquiring tab").optional(),
|
|
34
|
+
app: appSchema.optional(),
|
|
35
|
+
viewport: z
|
|
36
|
+
.object({
|
|
37
|
+
width: z.number(),
|
|
38
|
+
height: z.number(),
|
|
39
|
+
scale: z.number().optional(),
|
|
40
|
+
})
|
|
41
|
+
.optional(),
|
|
42
|
+
wait_until: z
|
|
43
|
+
.enum(["load", "domcontentloaded", "networkidle0", "networkidle2"] as const)
|
|
44
|
+
.describe("navigation wait condition for url")
|
|
45
|
+
.optional(),
|
|
46
|
+
dialogs: z
|
|
47
|
+
.enum(["accept", "dismiss"] as const)
|
|
48
|
+
.describe("open: auto-handle alert/confirm/beforeunload dialogs (default: leave for caller to handle)")
|
|
49
|
+
.optional(),
|
|
50
|
+
code: z
|
|
51
|
+
.string()
|
|
52
|
+
.describe(
|
|
53
|
+
"run: JS body executed with `page`, `browser`, `tab`, `display`, `assert`, `wait` in scope. Treated as the body of an async function. Use `display(value)` to attach text/JSON/images; the function's return value is JSON-serialized as a final block.",
|
|
54
|
+
)
|
|
55
|
+
.optional(),
|
|
56
|
+
timeout: z.number().default(30).describe("timeout in seconds").optional(),
|
|
57
|
+
all: z.boolean().describe("close: close every tab").optional(),
|
|
58
|
+
kill: z.boolean().describe("close: also kill spawned-app browsers (default: leave running)").optional(),
|
|
73
59
|
});
|
|
74
60
|
|
|
75
61
|
/** Input schema for the browser tool. */
|
|
76
|
-
export type BrowserParams =
|
|
62
|
+
export type BrowserParams = z.infer<typeof browserSchema>;
|
|
77
63
|
|
|
78
64
|
/** Details describing a browser tool execution result (for renderers + transcript). */
|
|
79
65
|
export interface BrowserToolDetails {
|
package/src/tools/calculator.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
|
|
|
2
2
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
3
3
|
import { Text } from "@oh-my-pi/pi-tui";
|
|
4
4
|
import { prompt, untilAborted } from "@oh-my-pi/pi-utils";
|
|
5
|
-
import
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
6
|
import type { RenderResultOptions } from "../extensibility/custom-tools/types";
|
|
7
7
|
import type { Theme } from "../modes/theme/theme";
|
|
8
8
|
import calculatorDescription from "../prompts/tools/calculator.md" with { type: "text" };
|
|
@@ -28,15 +28,16 @@ type Token =
|
|
|
28
28
|
| { type: "operator"; value: Operator }
|
|
29
29
|
| { type: "paren"; value: "(" | ")" };
|
|
30
30
|
|
|
31
|
-
const calculatorSchema =
|
|
32
|
-
calculations:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
const calculatorSchema = z.object({
|
|
32
|
+
calculations: z
|
|
33
|
+
.array(
|
|
34
|
+
z.object({
|
|
35
|
+
expression: z.string().describe("math expression"),
|
|
36
|
+
prefix: z.string().describe("prefix text"),
|
|
37
|
+
suffix: z.string().describe("suffix text"),
|
|
38
|
+
}),
|
|
39
|
+
)
|
|
40
|
+
.describe("calculations to evaluate"),
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
export interface CalculatorToolDetails {
|
|
@@ -385,7 +386,7 @@ function formatResult(value: number): string {
|
|
|
385
386
|
// Tool Class
|
|
386
387
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
387
388
|
|
|
388
|
-
type CalculatorParams =
|
|
389
|
+
type CalculatorParams = z.infer<typeof calculatorSchema>;
|
|
389
390
|
|
|
390
391
|
/**
|
|
391
392
|
* Calculator tool for evaluating mathematical expressions.
|
package/src/tools/checkpoint.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import { prompt } from "@oh-my-pi/pi-utils";
|
|
3
|
-
import
|
|
3
|
+
import * as z from "zod/v4";
|
|
4
4
|
import checkpointDescription from "../prompts/tools/checkpoint.md" with { type: "text" };
|
|
5
5
|
import rewindDescription from "../prompts/tools/rewind.md" with { type: "text" };
|
|
6
6
|
import type { ToolSession } from ".";
|
|
@@ -17,17 +17,17 @@ export interface CheckpointState {
|
|
|
17
17
|
startedAt: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const checkpointSchema =
|
|
21
|
-
goal:
|
|
20
|
+
const checkpointSchema = z.object({
|
|
21
|
+
goal: z.string().describe("investigation goal"),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
type CheckpointParams =
|
|
24
|
+
type CheckpointParams = z.infer<typeof checkpointSchema>;
|
|
25
25
|
|
|
26
|
-
const rewindSchema =
|
|
27
|
-
report:
|
|
26
|
+
const rewindSchema = z.object({
|
|
27
|
+
report: z.string().describe("investigation findings"),
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
type RewindParams =
|
|
30
|
+
type RewindParams = z.infer<typeof rewindSchema>;
|
|
31
31
|
|
|
32
32
|
export interface CheckpointToolDetails {
|
|
33
33
|
goal: string;
|
package/src/tools/debug.ts
CHANGED
|
@@ -5,10 +5,9 @@ import type {
|
|
|
5
5
|
AgentToolUpdateCallback,
|
|
6
6
|
RenderResultOptions,
|
|
7
7
|
} from "@oh-my-pi/pi-agent-core";
|
|
8
|
-
import { StringEnum } from "@oh-my-pi/pi-ai";
|
|
9
8
|
import { type Component, Text } from "@oh-my-pi/pi-tui";
|
|
10
9
|
import { prompt } from "@oh-my-pi/pi-utils";
|
|
11
|
-
import
|
|
10
|
+
import * as z from "zod/v4";
|
|
12
11
|
import {
|
|
13
12
|
type DapBreakpointRecord,
|
|
14
13
|
type DapCapabilities,
|
|
@@ -51,8 +50,8 @@ import { ToolError } from "./tool-errors";
|
|
|
51
50
|
import { toolResult } from "./tool-result";
|
|
52
51
|
import { clampTimeout } from "./tool-timeouts";
|
|
53
52
|
|
|
54
|
-
const debugSchema =
|
|
55
|
-
action:
|
|
53
|
+
const debugSchema = z.object({
|
|
54
|
+
action: z.enum([
|
|
56
55
|
"launch",
|
|
57
56
|
"attach",
|
|
58
57
|
"set_breakpoint",
|
|
@@ -81,47 +80,45 @@ const debugSchema = Type.Object({
|
|
|
81
80
|
"output",
|
|
82
81
|
"terminate",
|
|
83
82
|
"sessions",
|
|
84
|
-
]),
|
|
85
|
-
program:
|
|
86
|
-
args:
|
|
87
|
-
adapter:
|
|
88
|
-
cwd:
|
|
89
|
-
file:
|
|
90
|
-
line:
|
|
91
|
-
function:
|
|
92
|
-
name:
|
|
93
|
-
condition:
|
|
94
|
-
hit_condition:
|
|
95
|
-
expression:
|
|
96
|
-
context:
|
|
97
|
-
|
|
98
|
-
),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
module_count: Type.Optional(Type.Number()),
|
|
121
|
-
timeout: Type.Optional(Type.Number({ description: "per-request timeout seconds" })),
|
|
83
|
+
] as const),
|
|
84
|
+
program: z.string().describe("program path").optional(),
|
|
85
|
+
args: z.array(z.string()).describe("program arguments").optional(),
|
|
86
|
+
adapter: z.string().describe("debugger adapter (gdb, lldb-dap, debugpy, dlv)").optional(),
|
|
87
|
+
cwd: z.string().optional(),
|
|
88
|
+
file: z.string().describe("source file").optional(),
|
|
89
|
+
line: z.number().describe("source line").optional(),
|
|
90
|
+
function: z.string().describe("function name").optional(),
|
|
91
|
+
name: z.string().describe("variable or data name").optional(),
|
|
92
|
+
condition: z.string().describe("breakpoint condition").optional(),
|
|
93
|
+
hit_condition: z.string().optional(),
|
|
94
|
+
expression: z.string().describe("expression to evaluate").optional(),
|
|
95
|
+
context: z.string().describe("evaluate context: watch | repl | hover | variables | clipboard").optional(),
|
|
96
|
+
frame_id: z.number().optional(),
|
|
97
|
+
scope_id: z.number().describe("scope variables reference").optional(),
|
|
98
|
+
variable_ref: z.number().describe("variable reference").optional(),
|
|
99
|
+
pid: z.number().describe("process id for attach").optional(),
|
|
100
|
+
port: z.number().describe("remote attach port").optional(),
|
|
101
|
+
host: z.string().describe("remote attach host").optional(),
|
|
102
|
+
levels: z.number().describe("max stack frames").optional(),
|
|
103
|
+
memory_reference: z.string().describe("memory reference or address").optional(),
|
|
104
|
+
instruction_reference: z.string().optional(),
|
|
105
|
+
instruction_count: z.number().optional(),
|
|
106
|
+
instruction_offset: z.number().optional(),
|
|
107
|
+
count: z.number().describe("bytes to read").optional(),
|
|
108
|
+
data: z.string().describe("base64 memory payload").optional(),
|
|
109
|
+
data_id: z.string().describe("data breakpoint id").optional(),
|
|
110
|
+
access_type: z.enum(["read", "write", "readWrite"] as const).optional(),
|
|
111
|
+
command: z.string().describe("custom dap request command").optional(),
|
|
112
|
+
arguments: z.record(z.string(), z.any()).describe("custom request arguments").optional(),
|
|
113
|
+
offset: z.number().optional(),
|
|
114
|
+
resolve_symbols: z.boolean().optional(),
|
|
115
|
+
allow_partial: z.boolean().optional(),
|
|
116
|
+
start_module: z.number().optional(),
|
|
117
|
+
module_count: z.number().optional(),
|
|
118
|
+
timeout: z.number().describe("per-request timeout seconds").optional(),
|
|
122
119
|
});
|
|
123
120
|
|
|
124
|
-
export type DebugParams =
|
|
121
|
+
export type DebugParams = z.infer<typeof debugSchema>;
|
|
125
122
|
export type DebugAction = DebugParams["action"];
|
|
126
123
|
|
|
127
124
|
interface DebugToolDetails {
|
package/src/tools/eval.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ImageContent } from "@oh-my-pi/pi-ai";
|
|
|
3
3
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
4
4
|
import { Markdown, Text } from "@oh-my-pi/pi-tui";
|
|
5
5
|
import { prompt } from "@oh-my-pi/pi-utils";
|
|
6
|
-
import
|
|
6
|
+
import * as z from "zod/v4";
|
|
7
7
|
import { jsBackend, parseEvalInput, pythonBackend, sniffEvalLanguage } from "../eval";
|
|
8
8
|
import type { ExecutorBackend } from "../eval/backend";
|
|
9
9
|
import evalGrammar from "../eval/eval.lark" with { type: "text" };
|
|
@@ -16,7 +16,12 @@ import evalDescription from "../prompts/tools/eval.md" with { type: "text" };
|
|
|
16
16
|
import { DEFAULT_MAX_BYTES, OutputSink, type OutputSummary, TailBuffer } from "../session/streaming-output";
|
|
17
17
|
import { getTreeBranch, getTreeContinuePrefix, renderCodeCell } from "../tui";
|
|
18
18
|
import { resolveEvalBackends, type ToolSession } from ".";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
formatStyledTruncationWarning,
|
|
21
|
+
resolveOutputMaxColumns,
|
|
22
|
+
resolveOutputSinkHeadBytes,
|
|
23
|
+
stripOutputNotice,
|
|
24
|
+
} from "./output-meta";
|
|
20
25
|
import { formatTitle, replaceTabs, shortenPath, truncateToWidth, wrapBrackets } from "./render-utils";
|
|
21
26
|
import { ToolAbortError, ToolError } from "./tool-errors";
|
|
22
27
|
import { toolResult } from "./tool-result";
|
|
@@ -24,12 +29,10 @@ import { clampTimeout } from "./tool-timeouts";
|
|
|
24
29
|
|
|
25
30
|
export const EVAL_DEFAULT_PREVIEW_LINES = 10;
|
|
26
31
|
|
|
27
|
-
export const evalSchema =
|
|
28
|
-
input:
|
|
29
|
-
description: 'eval input as a sequence of `*** Cell <lang>:"title"` cell headers followed by code',
|
|
30
|
-
}),
|
|
32
|
+
export const evalSchema = z.object({
|
|
33
|
+
input: z.string().describe('eval input as a sequence of `*** Cell <lang>:"title"` cell headers followed by code'),
|
|
31
34
|
});
|
|
32
|
-
export type EvalToolParams =
|
|
35
|
+
export type EvalToolParams = z.infer<typeof evalSchema>;
|
|
33
36
|
|
|
34
37
|
export type EvalToolResult = {
|
|
35
38
|
content: Array<{ type: "text"; text: string }>;
|
|
@@ -223,7 +226,7 @@ export class EvalTool implements AgentTool<typeof evalSchema> {
|
|
|
223
226
|
readonly parameters = evalSchema;
|
|
224
227
|
readonly concurrency = "exclusive";
|
|
225
228
|
readonly strict = true;
|
|
226
|
-
readonly intent = (args: Partial<
|
|
229
|
+
readonly intent = (args: Partial<z.infer<typeof evalSchema>>): string | undefined => {
|
|
227
230
|
const input = args.input;
|
|
228
231
|
if (input) {
|
|
229
232
|
try {
|
|
@@ -249,7 +252,7 @@ export class EvalTool implements AgentTool<typeof evalSchema> {
|
|
|
249
252
|
|
|
250
253
|
async execute(
|
|
251
254
|
_toolCallId: string,
|
|
252
|
-
params:
|
|
255
|
+
params: z.infer<typeof evalSchema>,
|
|
253
256
|
signal?: AbortSignal,
|
|
254
257
|
onUpdate?: AgentToolUpdateCallback,
|
|
255
258
|
_ctx?: AgentToolContext,
|
|
@@ -922,8 +925,11 @@ export const evalToolRenderer = {
|
|
|
922
925
|
): Component {
|
|
923
926
|
const details = result.details;
|
|
924
927
|
|
|
925
|
-
const
|
|
928
|
+
const rawOutput =
|
|
926
929
|
options.renderContext?.output ?? (result.content?.find(c => c.type === "text")?.text ?? "").trimEnd();
|
|
930
|
+
// Strip the LLM-facing notice (appended by wrappedExecute) before display;
|
|
931
|
+
// the styled `warningLine` below carries the same text in ⟨…⟩ form.
|
|
932
|
+
const output = stripOutputNotice(rawOutput, details?.meta).trimEnd();
|
|
927
933
|
|
|
928
934
|
const jsonOutputs = details?.jsonOutputs ?? [];
|
|
929
935
|
const jsonLines = jsonOutputs.flatMap((value, index) => {
|
package/src/tools/find.ts
CHANGED
|
@@ -5,8 +5,7 @@ import * as natives from "@oh-my-pi/pi-natives";
|
|
|
5
5
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
6
6
|
import { Text } from "@oh-my-pi/pi-tui";
|
|
7
7
|
import { isEnoent, prompt, untilAborted } from "@oh-my-pi/pi-utils";
|
|
8
|
-
import
|
|
9
|
-
import { Type } from "@sinclair/typebox";
|
|
8
|
+
import * as z from "zod/v4";
|
|
10
9
|
import type { RenderResultOptions } from "../extensibility/custom-tools/types";
|
|
11
10
|
import { InternalUrlRouter } from "../internal-urls";
|
|
12
11
|
import type { Theme } from "../modes/theme/theme";
|
|
@@ -35,17 +34,15 @@ import {
|
|
|
35
34
|
import { ToolAbortError, ToolError, throwIfAborted } from "./tool-errors";
|
|
36
35
|
import { toolResult } from "./tool-result";
|
|
37
36
|
|
|
38
|
-
const findSchema =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
limit: Type.Optional(Type.Number({ description: "max results", default: 1000 })),
|
|
46
|
-
});
|
|
37
|
+
const findSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
paths: z.array(z.string().describe("glob including search path")).min(1).describe("globs including search paths"),
|
|
40
|
+
hidden: z.boolean().default(true).describe("include hidden files").optional(),
|
|
41
|
+
limit: z.number().default(1000).describe("max results").optional(),
|
|
42
|
+
})
|
|
43
|
+
.strict();
|
|
47
44
|
|
|
48
|
-
export type FindToolInput =
|
|
45
|
+
export type FindToolInput = z.infer<typeof findSchema>;
|
|
49
46
|
|
|
50
47
|
const DEFAULT_LIMIT = 1000;
|
|
51
48
|
const GLOB_TIMEOUT_MS = 5000;
|
|
@@ -107,7 +104,7 @@ export class FindTool implements AgentTool<typeof findSchema, FindToolDetails> {
|
|
|
107
104
|
|
|
108
105
|
async execute(
|
|
109
106
|
_toolCallId: string,
|
|
110
|
-
params:
|
|
107
|
+
params: z.infer<typeof findSchema>,
|
|
111
108
|
signal?: AbortSignal,
|
|
112
109
|
onUpdate?: AgentToolUpdateCallback<FindToolDetails>,
|
|
113
110
|
_context?: AgentToolContext,
|