@oh-my-pi/pi-coding-agent 16.0.5 → 16.0.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.
- package/CHANGELOG.md +60 -0
- package/dist/cli.js +1945 -1386
- package/dist/types/advisor/advise-tool.d.ts +22 -19
- package/dist/types/autoresearch/tools/init-experiment.d.ts +13 -17
- package/dist/types/autoresearch/tools/log-experiment.d.ts +17 -19
- package/dist/types/autoresearch/tools/run-experiment.d.ts +3 -4
- package/dist/types/autoresearch/tools/update-notes.d.ts +4 -5
- package/dist/types/cli/ttsr-cli.d.ts +39 -0
- package/dist/types/commands/ttsr.d.ts +57 -0
- package/dist/types/commit/agentic/tools/analyze-file.d.ts +4 -5
- package/dist/types/commit/agentic/tools/git-file-diff.d.ts +4 -5
- package/dist/types/commit/agentic/tools/git-hunk.d.ts +5 -6
- package/dist/types/commit/agentic/tools/git-overview.d.ts +4 -5
- package/dist/types/commit/agentic/tools/propose-changelog.d.ts +23 -24
- package/dist/types/commit/agentic/tools/propose-commit.d.ts +11 -32
- package/dist/types/commit/agentic/tools/recent-commits.d.ts +3 -4
- package/dist/types/commit/agentic/tools/schemas.d.ts +6 -27
- package/dist/types/commit/agentic/tools/split-commit.d.ts +28 -49
- package/dist/types/commit/changelog/generate.d.ts +12 -13
- package/dist/types/commit/shared-llm.d.ts +10 -37
- package/dist/types/config/config-file.d.ts +4 -4
- package/dist/types/config/keybindings.d.ts +5 -0
- package/dist/types/config/models-config-schema.d.ts +625 -990
- package/dist/types/config/models-config.d.ts +229 -217
- package/dist/types/config/settings-schema.d.ts +53 -23
- package/dist/types/edit/hashline/params.d.ts +7 -11
- package/dist/types/edit/index.d.ts +2 -1
- package/dist/types/edit/modes/apply-patch.d.ts +4 -5
- package/dist/types/edit/modes/patch.d.ts +15 -24
- package/dist/types/edit/modes/replace.d.ts +16 -17
- package/dist/types/eval/js/index.d.ts +1 -0
- package/dist/types/extensibility/custom-commands/types.d.ts +6 -3
- package/dist/types/extensibility/custom-tools/types.d.ts +8 -5
- package/dist/types/extensibility/extensions/types.d.ts +6 -3
- package/dist/types/extensibility/hooks/types.d.ts +7 -4
- package/dist/types/extensibility/legacy-pi-ai-shim.d.ts +13 -5
- package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +17 -0
- package/dist/types/extensibility/typebox.d.ts +80 -58
- package/dist/types/goals/tools/goal-tool.d.ts +11 -24
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lsp/index.d.ts +11 -26
- package/dist/types/lsp/types.d.ts +12 -28
- package/dist/types/mcp/client.d.ts +8 -0
- package/dist/types/modes/components/btw-panel.d.ts +1 -0
- package/dist/types/modes/components/custom-editor.d.ts +3 -1
- package/dist/types/modes/controllers/btw-controller.d.ts +2 -0
- package/dist/types/modes/controllers/input-controller.d.ts +1 -0
- package/dist/types/modes/interactive-mode.d.ts +3 -0
- package/dist/types/modes/setup-wizard/index.d.ts +1 -0
- package/dist/types/modes/setup-wizard/startup-splash.d.ts +7 -0
- package/dist/types/modes/theme/theme.d.ts +1 -1
- package/dist/types/modes/types.d.ts +3 -0
- package/dist/types/sdk.d.ts +5 -0
- package/dist/types/session/agent-session.d.ts +4 -0
- package/dist/types/startup-splash.d.ts +12 -0
- package/dist/types/task/types.d.ts +47 -48
- package/dist/types/tools/ask.d.ts +26 -27
- package/dist/types/tools/ast-edit.d.ts +17 -17
- package/dist/types/tools/ast-grep.d.ts +12 -13
- package/dist/types/tools/bash.d.ts +20 -17
- package/dist/types/tools/browser.d.ts +46 -71
- package/dist/types/tools/checkpoint.d.ts +14 -15
- package/dist/types/tools/debug.d.ts +82 -145
- package/dist/types/tools/eval.d.ts +30 -40
- package/dist/types/tools/find.d.ts +17 -18
- package/dist/types/tools/gh.d.ts +49 -78
- package/dist/types/tools/image-gen.d.ts +20 -36
- package/dist/types/tools/inspect-image.d.ts +10 -11
- package/dist/types/tools/irc.d.ts +22 -33
- package/dist/types/tools/job.d.ts +11 -12
- package/dist/types/tools/learn.d.ts +21 -28
- package/dist/types/tools/manage-skill.d.ts +13 -22
- package/dist/types/tools/memory-edit.d.ts +15 -24
- package/dist/types/tools/memory-recall.d.ts +7 -8
- package/dist/types/tools/memory-reflect.d.ts +9 -10
- package/dist/types/tools/memory-retain.d.ts +13 -14
- package/dist/types/tools/read.d.ts +7 -8
- package/dist/types/tools/resolve.d.ts +11 -18
- package/dist/types/tools/review.d.ts +9 -15
- package/dist/types/tools/search-tool-bm25.d.ts +9 -10
- package/dist/types/tools/search.d.ts +16 -17
- package/dist/types/tools/ssh.d.ts +14 -15
- package/dist/types/tools/todo.d.ts +27 -43
- package/dist/types/tools/tts.d.ts +8 -9
- package/dist/types/tools/write.d.ts +9 -10
- package/dist/types/tui/index.d.ts +1 -0
- package/dist/types/tui/width-aware-text.d.ts +23 -0
- package/dist/types/utils/markit.d.ts +10 -1
- package/dist/types/web/search/index.d.ts +17 -28
- package/dist/types/web/search/providers/perplexity.d.ts +0 -2
- package/dist/types/web/search/types.d.ts +32 -26
- package/package.json +14 -13
- package/scripts/omp +1 -1
- package/src/advisor/__tests__/advisor.test.ts +44 -1
- package/src/advisor/advise-tool.ts +34 -11
- package/src/autoresearch/tools/init-experiment.ts +13 -16
- package/src/autoresearch/tools/log-experiment.ts +15 -18
- package/src/autoresearch/tools/run-experiment.ts +3 -3
- package/src/autoresearch/tools/update-notes.ts +4 -4
- package/src/cli/ttsr-cli.ts +995 -0
- package/src/cli-commands.ts +1 -0
- package/src/cli.ts +7 -1
- package/src/commands/ttsr.ts +125 -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 +7 -5
- package/src/commit/agentic/tools/git-overview.ts +4 -4
- package/src/commit/agentic/tools/propose-changelog.ts +18 -15
- 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 +8 -20
- package/src/commit/agentic/tools/split-commit.ts +19 -23
- package/src/commit/analysis/summary.ts +7 -5
- package/src/commit/changelog/generate.ts +15 -11
- package/src/commit/shared-llm.ts +17 -24
- package/src/config/config-file.ts +13 -15
- package/src/config/keybindings.ts +6 -0
- package/src/config/models-config-schema.ts +206 -179
- package/src/config/settings-schema.ts +34 -0
- package/src/discovery/builtin-rules/index.ts +2 -0
- package/src/discovery/builtin-rules/ts-import-type.md +2 -2
- package/src/discovery/builtin-rules/ts-no-any.md +11 -2
- package/src/discovery/builtin-rules/ts-no-inline-cast-access.md +55 -0
- package/src/edit/hashline/params.ts +12 -11
- package/src/edit/index.ts +5 -4
- package/src/edit/modes/apply-patch.ts +4 -4
- package/src/edit/modes/patch.ts +15 -18
- package/src/edit/modes/replace.ts +13 -17
- package/src/edit/renderer.ts +0 -1
- package/src/eval/agent-bridge.ts +11 -13
- package/src/eval/completion-bridge.ts +25 -17
- package/src/eval/js/context-manager.ts +17 -2
- package/src/eval/js/index.ts +1 -1
- package/src/eval/py/executor.ts +2 -2
- package/src/extensibility/custom-commands/loader.ts +5 -3
- package/src/extensibility/custom-commands/types.ts +6 -3
- package/src/extensibility/custom-tools/loader.ts +4 -2
- package/src/extensibility/custom-tools/types.ts +8 -5
- package/src/extensibility/extensions/loader.ts +4 -2
- package/src/extensibility/extensions/types.ts +6 -3
- package/src/extensibility/hooks/loader.ts +5 -2
- package/src/extensibility/hooks/types.ts +7 -4
- package/src/extensibility/legacy-pi-ai-shim.ts +42 -5
- package/src/extensibility/legacy-pi-coding-agent-shim.ts +113 -0
- package/src/extensibility/plugins/legacy-pi-compat.ts +13 -13
- package/src/extensibility/tool-proxy.ts +4 -1
- package/src/extensibility/typebox.ts +778 -251
- package/src/goals/guided-setup.ts +12 -3
- package/src/goals/tools/goal-tool.ts +6 -6
- package/src/index.ts +2 -0
- package/src/internal-urls/docs-index.generated.ts +11 -9
- package/src/lsp/types.ts +13 -27
- package/src/main.ts +19 -18
- package/src/mcp/client.ts +38 -13
- package/src/mcp/render.ts +102 -89
- package/src/modes/components/agent-hub.ts +11 -4
- package/src/modes/components/btw-panel.ts +5 -1
- package/src/modes/components/custom-editor.ts +18 -0
- package/src/modes/components/status-line/component.ts +8 -1
- package/src/modes/components/tool-execution.ts +17 -10
- package/src/modes/controllers/btw-controller.ts +69 -1
- package/src/modes/controllers/input-controller.ts +29 -0
- package/src/modes/interactive-mode.ts +38 -8
- package/src/modes/setup-wizard/index.ts +1 -0
- package/src/modes/setup-wizard/scenes/sign-in.ts +77 -5
- package/src/modes/setup-wizard/startup-splash.ts +107 -0
- package/src/modes/theme/theme.ts +133 -143
- package/src/modes/types.ts +3 -0
- package/src/modes/utils/context-usage.ts +9 -5
- package/src/modes/utils/hotkeys-markdown.ts +1 -0
- package/src/prompts/system/system-prompt.md +1 -0
- package/src/sdk.ts +21 -4
- package/src/session/agent-session.ts +173 -33
- package/src/session/session-history-format.ts +11 -2
- package/src/session/snapcompact-inline.ts +1 -1
- package/src/slash-commands/builtin-registry.ts +3 -10
- package/src/startup-splash.ts +19 -0
- package/src/task/executor.ts +11 -6
- package/src/task/types.ts +44 -41
- package/src/tool-discovery/tool-index.ts +17 -4
- package/src/tools/ask.ts +14 -14
- package/src/tools/ast-edit.ts +17 -14
- package/src/tools/ast-grep.ts +10 -9
- package/src/tools/bash.ts +15 -10
- package/src/tools/browser/launch.ts +13 -0
- package/src/tools/browser.ts +26 -32
- package/src/tools/checkpoint.ts +7 -7
- package/src/tools/debug.ts +72 -69
- package/src/tools/eval.ts +18 -19
- package/src/tools/find.ts +20 -13
- package/src/tools/gh.ts +29 -49
- package/src/tools/image-gen.ts +27 -32
- package/src/tools/inspect-image.ts +8 -9
- package/src/tools/irc.ts +12 -12
- package/src/tools/job.ts +6 -6
- package/src/tools/learn.ts +11 -14
- package/src/tools/manage-skill.ts +19 -23
- package/src/tools/memory-edit.ts +8 -8
- package/src/tools/memory-recall.ts +4 -4
- package/src/tools/memory-reflect.ts +5 -5
- package/src/tools/memory-retain.ts +9 -11
- package/src/tools/puppeteer/02_stealth_hairline.txt +1 -1
- package/src/tools/puppeteer/04_stealth_iframe.txt +4 -4
- package/src/tools/puppeteer/05_stealth_webgl.txt +1 -1
- package/src/tools/puppeteer/10_stealth_plugins.txt +6 -4
- package/src/tools/puppeteer/12_stealth_codecs.txt +2 -2
- package/src/tools/puppeteer/13_stealth_worker.txt +1 -1
- package/src/tools/read.ts +169 -13
- package/src/tools/report-tool-issue.ts +6 -6
- package/src/tools/resolve.ts +6 -6
- package/src/tools/review.ts +10 -12
- package/src/tools/search-tool-bm25.ts +5 -5
- package/src/tools/search.ts +20 -29
- package/src/tools/ssh.ts +8 -8
- package/src/tools/todo.ts +16 -19
- package/src/tools/tts.ts +16 -15
- package/src/tools/write.ts +5 -5
- package/src/tui/index.ts +1 -0
- package/src/tui/width-aware-text.ts +58 -0
- package/src/utils/markit.ts +17 -2
- package/src/web/search/index.ts +9 -9
- package/src/web/search/providers/perplexity.ts +373 -126
- package/src/web/search/types.ts +28 -48
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
3
|
-
import { z } from "zod/v4";
|
|
4
3
|
import type { RenderResultOptions } from "../extensibility/custom-tools/types";
|
|
5
4
|
import type { Theme } from "../modes/theme/theme";
|
|
6
5
|
import { type TruncationResult } from "../session/streaming-output";
|
|
7
6
|
import type { ToolSession } from ".";
|
|
8
7
|
import type { OutputMeta } from "./output-meta";
|
|
9
|
-
declare const searchSchema:
|
|
10
|
-
pattern:
|
|
11
|
-
paths
|
|
12
|
-
i
|
|
13
|
-
gitignore
|
|
14
|
-
skip
|
|
15
|
-
},
|
|
16
|
-
export type SearchToolInput =
|
|
8
|
+
declare const searchSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
9
|
+
pattern: string;
|
|
10
|
+
paths?: string | string[] | undefined;
|
|
11
|
+
i?: boolean | undefined;
|
|
12
|
+
gitignore?: boolean | undefined;
|
|
13
|
+
skip?: number | null | undefined;
|
|
14
|
+
}, {}>;
|
|
15
|
+
export type SearchToolInput = typeof searchSchema.infer;
|
|
17
16
|
export declare function toPathList(input: string | string[] | undefined): string[];
|
|
18
17
|
/** Maximum number of distinct files surfaced in a single response. The
|
|
19
18
|
* agent paginates further pages via `skip`. */
|
|
@@ -56,7 +55,7 @@ export interface SearchToolDetails {
|
|
|
56
55
|
* non-fatal warning in the renderer and in the model-facing text. */
|
|
57
56
|
missingPaths?: string[];
|
|
58
57
|
}
|
|
59
|
-
type SearchParams =
|
|
58
|
+
type SearchParams = typeof searchSchema.infer;
|
|
60
59
|
export declare class SearchTool implements AgentTool<typeof searchSchema, SearchToolDetails> {
|
|
61
60
|
private readonly session;
|
|
62
61
|
readonly name = "search";
|
|
@@ -65,13 +64,13 @@ export declare class SearchTool implements AgentTool<typeof searchSchema, Search
|
|
|
65
64
|
readonly loadMode = "discoverable";
|
|
66
65
|
readonly summary = "Search file contents using ripgrep (fast text search)";
|
|
67
66
|
readonly description: string;
|
|
68
|
-
readonly parameters:
|
|
69
|
-
pattern:
|
|
70
|
-
paths
|
|
71
|
-
i
|
|
72
|
-
gitignore
|
|
73
|
-
skip
|
|
74
|
-
},
|
|
67
|
+
readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
68
|
+
pattern: string;
|
|
69
|
+
paths?: string | string[] | undefined;
|
|
70
|
+
i?: boolean | undefined;
|
|
71
|
+
gitignore?: boolean | undefined;
|
|
72
|
+
skip?: number | null | undefined;
|
|
73
|
+
}, {}>;
|
|
75
74
|
readonly strict = true;
|
|
76
75
|
constructor(session: ToolSession);
|
|
77
76
|
execute(_toolCallId: string, params: SearchParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<SearchToolDetails>, _toolContext?: AgentToolContext): Promise<AgentToolResult<SearchToolDetails>>;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { ToolExample } from "@oh-my-pi/pi-ai";
|
|
3
3
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
4
|
-
import { z } from "zod/v4";
|
|
5
4
|
import type { SSHHost } from "../capability/ssh";
|
|
6
5
|
import type { RenderResultOptions } from "../extensibility/custom-tools/types";
|
|
7
6
|
import type { Theme } from "../modes/theme/theme";
|
|
8
7
|
import type { ToolSession } from ".";
|
|
9
8
|
import { type OutputMeta } from "./output-meta";
|
|
10
|
-
declare const sshSchema:
|
|
11
|
-
host:
|
|
12
|
-
command:
|
|
13
|
-
cwd
|
|
14
|
-
timeout
|
|
15
|
-
},
|
|
9
|
+
declare const sshSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
10
|
+
host: string;
|
|
11
|
+
command: string;
|
|
12
|
+
cwd?: string | undefined;
|
|
13
|
+
timeout?: number | undefined;
|
|
14
|
+
}, {}>;
|
|
16
15
|
export interface SSHToolDetails {
|
|
17
16
|
meta?: OutputMeta;
|
|
18
17
|
}
|
|
19
|
-
type SshToolParams =
|
|
18
|
+
type SshToolParams = typeof sshSchema.infer;
|
|
20
19
|
export declare class SshTool implements AgentTool<typeof sshSchema, SSHToolDetails> {
|
|
21
20
|
#private;
|
|
22
21
|
private readonly session;
|
|
@@ -29,15 +28,15 @@ export declare class SshTool implements AgentTool<typeof sshSchema, SSHToolDetai
|
|
|
29
28
|
readonly summary = "Execute a command on a remote host over SSH";
|
|
30
29
|
readonly loadMode = "discoverable";
|
|
31
30
|
readonly label = "SSH";
|
|
32
|
-
readonly parameters:
|
|
33
|
-
host:
|
|
34
|
-
command:
|
|
35
|
-
cwd
|
|
36
|
-
timeout
|
|
37
|
-
},
|
|
31
|
+
readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
32
|
+
host: string;
|
|
33
|
+
command: string;
|
|
34
|
+
cwd?: string | undefined;
|
|
35
|
+
timeout?: number | undefined;
|
|
36
|
+
}, {}>;
|
|
38
37
|
readonly concurrency = "exclusive";
|
|
39
38
|
readonly strict = true;
|
|
40
|
-
readonly examples: readonly ToolExample<
|
|
39
|
+
readonly examples: readonly ToolExample<SshToolParams>[];
|
|
41
40
|
constructor(session: ToolSession, hostNames: string[], hostsByName: Map<string, SSHHost>, description: string);
|
|
42
41
|
execute(_toolCallId: string, { host, command, cwd, timeout: rawTimeout }: SshToolParams, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<SSHToolDetails>, _ctx?: AgentToolContext): Promise<AgentToolResult<SSHToolDetails>>;
|
|
43
42
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { ToolExample } from "@oh-my-pi/pi-ai";
|
|
3
3
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
4
|
-
import { z } from "zod/v4";
|
|
5
4
|
import type { RenderResultOptions } from "../extensibility/custom-tools/types";
|
|
6
5
|
import type { Theme } from "../modes/theme/theme";
|
|
7
6
|
import type { ToolSession } from "../sdk";
|
|
@@ -24,27 +23,20 @@ export interface TodoToolDetails {
|
|
|
24
23
|
storage: "session" | "memory";
|
|
25
24
|
completedTasks?: TodoCompletionTransition[];
|
|
26
25
|
}
|
|
27
|
-
declare const todoSchema:
|
|
28
|
-
ops:
|
|
29
|
-
op:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}, z.core.$strip>>>;
|
|
42
|
-
task: z.ZodOptional<z.ZodString>;
|
|
43
|
-
phase: z.ZodOptional<z.ZodString>;
|
|
44
|
-
items: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
-
}, z.core.$strip>>;
|
|
46
|
-
}, z.core.$strip>;
|
|
47
|
-
type TodoParams = z.infer<typeof todoSchema>;
|
|
26
|
+
declare const todoSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
27
|
+
ops: {
|
|
28
|
+
op: "append" | "done" | "drop" | "init" | "rm" | "start" | "view";
|
|
29
|
+
list?: {
|
|
30
|
+
phase: string;
|
|
31
|
+
items: string[];
|
|
32
|
+
}[] | undefined;
|
|
33
|
+
task?: string | undefined;
|
|
34
|
+
phase?: string | undefined;
|
|
35
|
+
items?: string[] | undefined;
|
|
36
|
+
}[];
|
|
37
|
+
}, {}>;
|
|
38
|
+
type TodoParams = TodoSchema;
|
|
39
|
+
type TodoSchema = typeof todoSchema.infer;
|
|
48
40
|
export declare const USER_TODO_EDIT_CUSTOM_TYPE = "user_todo_edit";
|
|
49
41
|
export declare function getLatestTodoPhasesFromEntries(entries: SessionEntry[]): TodoPhase[];
|
|
50
42
|
/**
|
|
@@ -96,29 +88,21 @@ export declare class TodoTool implements AgentTool<typeof todoSchema, TodoToolDe
|
|
|
96
88
|
readonly label = "Todo";
|
|
97
89
|
readonly summary = "Write a structured todo list to track progress within a session";
|
|
98
90
|
readonly description: string;
|
|
99
|
-
readonly parameters:
|
|
100
|
-
ops:
|
|
101
|
-
op:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
phase: z.ZodString;
|
|
112
|
-
items: z.ZodArray<z.ZodString>;
|
|
113
|
-
}, z.core.$strip>>>;
|
|
114
|
-
task: z.ZodOptional<z.ZodString>;
|
|
115
|
-
phase: z.ZodOptional<z.ZodString>;
|
|
116
|
-
items: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
117
|
-
}, z.core.$strip>>;
|
|
118
|
-
}, z.core.$strip>;
|
|
91
|
+
readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
92
|
+
ops: {
|
|
93
|
+
op: "append" | "done" | "drop" | "init" | "rm" | "start" | "view";
|
|
94
|
+
list?: {
|
|
95
|
+
phase: string;
|
|
96
|
+
items: string[];
|
|
97
|
+
}[] | undefined;
|
|
98
|
+
task?: string | undefined;
|
|
99
|
+
phase?: string | undefined;
|
|
100
|
+
items?: string[] | undefined;
|
|
101
|
+
}[];
|
|
102
|
+
}, {}>;
|
|
119
103
|
readonly concurrency = "exclusive";
|
|
120
104
|
readonly strict = true;
|
|
121
|
-
readonly examples: readonly ToolExample<
|
|
105
|
+
readonly examples: readonly ToolExample<typeof todoSchema.infer>[];
|
|
122
106
|
readonly loadMode = "discoverable";
|
|
123
107
|
constructor(session: ToolSession);
|
|
124
108
|
execute(_toolCallId: string, params: TodoParams, _signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<TodoToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<TodoToolDetails>>;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { z } from "zod/v4";
|
|
2
1
|
import type { CustomTool } from "../extensibility/custom-tools/types";
|
|
3
2
|
type TtsCodec = "mp3" | "wav";
|
|
4
3
|
type TtsBackend = "local" | "xai";
|
|
5
|
-
declare const ttsSchema:
|
|
6
|
-
text:
|
|
7
|
-
voice_id:
|
|
8
|
-
language:
|
|
9
|
-
output_path:
|
|
10
|
-
sample_rate
|
|
11
|
-
bit_rate
|
|
12
|
-
},
|
|
4
|
+
declare const ttsSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
5
|
+
text: string;
|
|
6
|
+
voice_id: import("arktype/internal/attributes.ts").Default<string, "eve">;
|
|
7
|
+
language: import("arktype/internal/attributes.ts").Default<string, "en">;
|
|
8
|
+
output_path: string;
|
|
9
|
+
sample_rate?: number | undefined;
|
|
10
|
+
bit_rate?: number | undefined;
|
|
11
|
+
}, {}>;
|
|
13
12
|
interface TtsToolDetails {
|
|
14
13
|
bytes: number;
|
|
15
14
|
voiceId: string;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
3
|
-
import { z } from "zod/v4";
|
|
4
3
|
import type { RenderResultOptions } from "../extensibility/custom-tools/types";
|
|
5
4
|
import { type FileDiagnosticsResult } from "../lsp";
|
|
6
5
|
import { type Theme } from "../modes/theme/theme";
|
|
7
6
|
import type { ToolSession } from "../sdk";
|
|
8
7
|
import { type OutputMeta } from "./output-meta";
|
|
9
|
-
declare const writeSchema:
|
|
10
|
-
path:
|
|
11
|
-
content:
|
|
12
|
-
},
|
|
13
|
-
export type WriteToolInput =
|
|
8
|
+
declare const writeSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
9
|
+
path: string;
|
|
10
|
+
content: string;
|
|
11
|
+
}, {}>;
|
|
12
|
+
export type WriteToolInput = typeof writeSchema.infer;
|
|
14
13
|
/** Details returned by the write tool for TUI rendering */
|
|
15
14
|
export interface WriteToolDetails {
|
|
16
15
|
diagnostics?: FileDiagnosticsResult;
|
|
@@ -35,10 +34,10 @@ export declare class WriteTool implements AgentTool<typeof writeSchema, WriteToo
|
|
|
35
34
|
readonly formatApprovalDetails: (args: unknown) => string[];
|
|
36
35
|
readonly label = "Write";
|
|
37
36
|
readonly description: string;
|
|
38
|
-
readonly parameters:
|
|
39
|
-
path:
|
|
40
|
-
content:
|
|
41
|
-
},
|
|
37
|
+
readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
38
|
+
path: string;
|
|
39
|
+
content: string;
|
|
40
|
+
}, {}>;
|
|
42
41
|
readonly strict = true;
|
|
43
42
|
readonly concurrency = "exclusive";
|
|
44
43
|
readonly loadMode = "discoverable";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Component } from "@oh-my-pi/pi-tui";
|
|
2
|
+
/**
|
|
3
|
+
* Text whose content is (re)formatted against the actual render width.
|
|
4
|
+
*
|
|
5
|
+
* A plain `Text` receives an already-formatted string and only wraps it at
|
|
6
|
+
* render time, so width-dependent layout (per-line truncation, inline previews)
|
|
7
|
+
* has to be decided before the width is known. Renderers used to cope by
|
|
8
|
+
* hard-capping output lines at a fixed column count (e.g. 80), which truncated
|
|
9
|
+
* to roughly a third of a wide terminal. This defers formatting to
|
|
10
|
+
* `render(width)`: it computes the same content width the inner `Text` uses
|
|
11
|
+
* (mirroring its tight-layout flag so the budget can't desync), hands that to
|
|
12
|
+
* the formatter, and delegates margins/background/vertical padding to the inner
|
|
13
|
+
* `Text`. Lines the formatter caps at `contentWidth` fit exactly and so never
|
|
14
|
+
* wrap.
|
|
15
|
+
*/
|
|
16
|
+
export declare class WidthAwareText implements Component {
|
|
17
|
+
#private;
|
|
18
|
+
constructor(format: (contentWidth: number) => string, paddingX?: number, paddingY?: number);
|
|
19
|
+
setCustomBgFn(customBgFn?: (text: string) => string): void;
|
|
20
|
+
setIgnoreTight(ignore: boolean): this;
|
|
21
|
+
invalidate(): void;
|
|
22
|
+
render(width: number): readonly string[];
|
|
23
|
+
}
|
|
@@ -3,6 +3,15 @@ export interface MarkitConversionResult {
|
|
|
3
3
|
ok: boolean;
|
|
4
4
|
error?: string;
|
|
5
5
|
}
|
|
6
|
+
export interface MarkitFileConversionOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Directory the PDF converter writes extracted images/diagrams into. When
|
|
9
|
+
* set, each embedded image is rendered to `<id>.png` and referenced by path
|
|
10
|
+
* in the markdown; when unset, markit emits an `<!-- image: <id> ... -->`
|
|
11
|
+
* placeholder comment instead.
|
|
12
|
+
*/
|
|
13
|
+
imageDir?: string;
|
|
14
|
+
}
|
|
6
15
|
interface MuPdfWasmModuleConfig {
|
|
7
16
|
print?: (...values: unknown[]) => void;
|
|
8
17
|
printErr?: (...values: unknown[]) => void;
|
|
@@ -10,6 +19,6 @@ interface MuPdfWasmModuleConfig {
|
|
|
10
19
|
declare global {
|
|
11
20
|
var $libmupdf_wasm_Module: MuPdfWasmModuleConfig | undefined;
|
|
12
21
|
}
|
|
13
|
-
export declare function convertFileWithMarkit(filePath: string, signal?: AbortSignal): Promise<MarkitConversionResult>;
|
|
22
|
+
export declare function convertFileWithMarkit(filePath: string, signal?: AbortSignal, options?: MarkitFileConversionOptions): Promise<MarkitConversionResult>;
|
|
14
23
|
export declare function convertBufferWithMarkit(buffer: Uint8Array, extension: string, signal?: AbortSignal): Promise<MarkitConversionResult>;
|
|
15
24
|
export {};
|
|
@@ -6,26 +6,20 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
8
8
|
import type { AuthStorage } from "@oh-my-pi/pi-ai";
|
|
9
|
-
import { z } from "zod/v4";
|
|
10
9
|
import type { CustomTool } from "../../extensibility/custom-tools/types";
|
|
11
10
|
import type { ToolSession } from "../../tools";
|
|
12
11
|
import { type SearchRenderDetails } from "./render";
|
|
13
12
|
import type { SearchProviderId } from "./types";
|
|
14
13
|
/** Web search tool parameters schema */
|
|
15
|
-
export declare const webSearchSchema:
|
|
16
|
-
query:
|
|
17
|
-
recency
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
25
|
-
temperature: z.ZodOptional<z.ZodNumber>;
|
|
26
|
-
num_search_results: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
}, z.core.$strip>;
|
|
28
|
-
export type SearchToolParams = z.infer<typeof webSearchSchema>;
|
|
14
|
+
export declare const webSearchSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
15
|
+
query: string;
|
|
16
|
+
recency?: "day" | "month" | "week" | "year" | undefined;
|
|
17
|
+
limit?: number | undefined;
|
|
18
|
+
max_tokens?: number | undefined;
|
|
19
|
+
temperature?: number | undefined;
|
|
20
|
+
num_search_results?: number | undefined;
|
|
21
|
+
}, {}>;
|
|
22
|
+
export type SearchToolParams = typeof webSearchSchema.infer;
|
|
29
23
|
export interface SearchQueryParams extends SearchToolParams {
|
|
30
24
|
provider?: SearchProviderId | "auto";
|
|
31
25
|
}
|
|
@@ -58,19 +52,14 @@ export declare class WebSearchTool implements AgentTool<typeof webSearchSchema,
|
|
|
58
52
|
readonly approval: "read";
|
|
59
53
|
readonly label = "Web Search";
|
|
60
54
|
readonly description: string;
|
|
61
|
-
readonly parameters:
|
|
62
|
-
query:
|
|
63
|
-
recency
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
70
|
-
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
71
|
-
temperature: z.ZodOptional<z.ZodNumber>;
|
|
72
|
-
num_search_results: z.ZodOptional<z.ZodNumber>;
|
|
73
|
-
}, z.core.$strip>;
|
|
55
|
+
readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
56
|
+
query: string;
|
|
57
|
+
recency?: "day" | "month" | "week" | "year" | undefined;
|
|
58
|
+
limit?: number | undefined;
|
|
59
|
+
max_tokens?: number | undefined;
|
|
60
|
+
temperature?: number | undefined;
|
|
61
|
+
num_search_results?: number | undefined;
|
|
62
|
+
}, {}>;
|
|
74
63
|
readonly strict = true;
|
|
75
64
|
readonly loadMode = "discoverable";
|
|
76
65
|
readonly summary = "Search the web for up-to-date information";
|
|
@@ -27,8 +27,6 @@ export interface PerplexitySearchParams {
|
|
|
27
27
|
sessionId?: string;
|
|
28
28
|
fetch?: FetchImpl;
|
|
29
29
|
}
|
|
30
|
-
/** Find PERPLEXITY_API_KEY from environment or .env files (also checks PPLX_API_KEY) */
|
|
31
|
-
export declare function findApiKey(): string | null;
|
|
32
30
|
/** Execute Perplexity web search */
|
|
33
31
|
export declare function searchPerplexity(params: PerplexitySearchParams): Promise<SearchResponse>;
|
|
34
32
|
/** Search provider for Perplexity. */
|
|
@@ -3,42 +3,22 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Unified types for web search responses across supported providers.
|
|
5
5
|
*/
|
|
6
|
-
export declare const SEARCH_PROVIDER_ORDER: readonly ["tavily", "perplexity", "brave", "jina", "kimi", "anthropic", "gemini", "codex", "zai", "exa", "parallel", "kagi", "synthetic", "searxng"];
|
|
7
|
-
/** Supported web search providers */
|
|
8
|
-
export type SearchProviderId = (typeof SEARCH_PROVIDER_ORDER)[number];
|
|
9
|
-
export declare const SEARCH_PROVIDER_PREFERENCES: readonly ["auto", "tavily", "perplexity", "brave", "jina", "kimi", "anthropic", "gemini", "codex", "zai", "exa", "parallel", "kagi", "synthetic", "searxng"];
|
|
10
6
|
export declare const SEARCH_PROVIDER_OPTIONS: readonly [{
|
|
11
7
|
readonly value: "auto";
|
|
12
8
|
readonly label: "Auto";
|
|
13
9
|
readonly description: "Automatically uses the first configured web-search provider";
|
|
14
|
-
}, {
|
|
15
|
-
readonly value: "tavily";
|
|
16
|
-
readonly label: "Tavily";
|
|
17
|
-
readonly description: "Requires TAVILY_API_KEY";
|
|
18
10
|
}, {
|
|
19
11
|
readonly value: "perplexity";
|
|
20
12
|
readonly label: "Perplexity";
|
|
21
13
|
readonly description: "Uses auth when configured; explicit selection falls back to anonymous search";
|
|
22
14
|
}, {
|
|
23
|
-
readonly value: "
|
|
24
|
-
readonly label: "
|
|
25
|
-
readonly description: "
|
|
26
|
-
}, {
|
|
27
|
-
readonly value: "jina";
|
|
28
|
-
readonly label: "Jina";
|
|
29
|
-
readonly description: "Requires JINA_API_KEY";
|
|
30
|
-
}, {
|
|
31
|
-
readonly value: "kimi";
|
|
32
|
-
readonly label: "Kimi";
|
|
33
|
-
readonly description: "Requires MOONSHOT_SEARCH_API_KEY or MOONSHOT_API_KEY";
|
|
15
|
+
readonly value: "gemini";
|
|
16
|
+
readonly label: "Gemini";
|
|
17
|
+
readonly description: "Google Search grounding via Gemini (uses google-gemini-cli or google-antigravity OAuth)";
|
|
34
18
|
}, {
|
|
35
19
|
readonly value: "anthropic";
|
|
36
20
|
readonly label: "Anthropic";
|
|
37
21
|
readonly description: "Claude's native web_search tool (uses Anthropic OAuth or ANTHROPIC_API_KEY)";
|
|
38
|
-
}, {
|
|
39
|
-
readonly value: "gemini";
|
|
40
|
-
readonly label: "Gemini";
|
|
41
|
-
readonly description: "Google Search grounding via Gemini (uses google-gemini-cli or google-antigravity OAuth)";
|
|
42
22
|
}, {
|
|
43
23
|
readonly value: "codex";
|
|
44
24
|
readonly label: "OpenAI";
|
|
@@ -52,13 +32,29 @@ export declare const SEARCH_PROVIDER_OPTIONS: readonly [{
|
|
|
52
32
|
readonly label: "Exa";
|
|
53
33
|
readonly description: "Uses Exa API when EXA_API_KEY is set; falls back to Exa MCP";
|
|
54
34
|
}, {
|
|
55
|
-
readonly value: "
|
|
56
|
-
readonly label: "
|
|
57
|
-
readonly description: "Requires
|
|
35
|
+
readonly value: "jina";
|
|
36
|
+
readonly label: "Jina";
|
|
37
|
+
readonly description: "Requires JINA_API_KEY";
|
|
58
38
|
}, {
|
|
59
39
|
readonly value: "kagi";
|
|
60
40
|
readonly label: "Kagi";
|
|
61
41
|
readonly description: "Requires KAGI_API_KEY and Kagi Search API beta access";
|
|
42
|
+
}, {
|
|
43
|
+
readonly value: "tavily";
|
|
44
|
+
readonly label: "Tavily";
|
|
45
|
+
readonly description: "Requires TAVILY_API_KEY";
|
|
46
|
+
}, {
|
|
47
|
+
readonly value: "brave";
|
|
48
|
+
readonly label: "Brave";
|
|
49
|
+
readonly description: "Requires BRAVE_API_KEY";
|
|
50
|
+
}, {
|
|
51
|
+
readonly value: "kimi";
|
|
52
|
+
readonly label: "Kimi";
|
|
53
|
+
readonly description: "Requires MOONSHOT_SEARCH_API_KEY or MOONSHOT_API_KEY";
|
|
54
|
+
}, {
|
|
55
|
+
readonly value: "parallel";
|
|
56
|
+
readonly label: "Parallel";
|
|
57
|
+
readonly description: "Requires PARALLEL_API_KEY";
|
|
62
58
|
}, {
|
|
63
59
|
readonly value: "synthetic";
|
|
64
60
|
readonly label: "Synthetic";
|
|
@@ -68,6 +64,16 @@ export declare const SEARCH_PROVIDER_OPTIONS: readonly [{
|
|
|
68
64
|
readonly label: "SearXNG";
|
|
69
65
|
readonly description: "Requires SEARXNG_ENDPOINT or searxng.endpoint";
|
|
70
66
|
}];
|
|
67
|
+
/** Supported web search providers (every option except `auto`). */
|
|
68
|
+
export type SearchProviderId = Exclude<(typeof SEARCH_PROVIDER_OPTIONS)[number]["value"], "auto">;
|
|
69
|
+
/**
|
|
70
|
+
* Auto-resolution priority order. Derived from {@link SEARCH_PROVIDER_OPTIONS}
|
|
71
|
+
* (minus `auto`) so the settings/setup dropdown and `resolveProviderChain()`
|
|
72
|
+
* share one source of truth and never drift apart.
|
|
73
|
+
*/
|
|
74
|
+
export declare const SEARCH_PROVIDER_ORDER: readonly SearchProviderId[];
|
|
75
|
+
export declare const SEARCH_PROVIDER_PREFERENCES: readonly ["auto", ...SearchProviderId[]];
|
|
76
|
+
/** Display labels, derived from {@link SEARCH_PROVIDER_OPTIONS}. */
|
|
71
77
|
export declare const SEARCH_PROVIDER_LABELS: Record<SearchProviderId, string>;
|
|
72
78
|
export declare function isSearchProviderId(value: string): value is SearchProviderId;
|
|
73
79
|
export declare function isSearchProviderPreference(value: string): value is SearchProviderId | "auto";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-coding-agent",
|
|
4
|
-
"version": "16.0.
|
|
4
|
+
"version": "16.0.7",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"check": "biome check . && bun run check:types",
|
|
36
36
|
"check:types": "tsgo -p tsconfig.json --noEmit",
|
|
37
37
|
"lint": "biome lint .",
|
|
38
|
-
"test": "bun test --parallel",
|
|
38
|
+
"test": "bun test --parallel=4",
|
|
39
39
|
"fix": "biome check --write --unsafe . && bun run format-prompts && bun run generate-docs-index",
|
|
40
40
|
"fmt": "biome format --write . && bun run format-prompts",
|
|
41
41
|
"format-prompts": "bun scripts/format-prompts.ts",
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"@agentclientprotocol/sdk": "0.25.0",
|
|
48
48
|
"@babel/parser": "^7.29.7",
|
|
49
49
|
"@mozilla/readability": "^0.6.0",
|
|
50
|
-
"@oh-my-pi/hashline": "16.0.
|
|
51
|
-
"@oh-my-pi/omp-stats": "16.0.
|
|
52
|
-
"@oh-my-pi/pi-agent-core": "16.0.
|
|
53
|
-
"@oh-my-pi/pi-ai": "16.0.
|
|
54
|
-
"@oh-my-pi/pi-catalog": "16.0.
|
|
55
|
-
"@oh-my-pi/pi-mnemopi": "16.0.
|
|
56
|
-
"@oh-my-pi/pi-natives": "16.0.
|
|
57
|
-
"@oh-my-pi/pi-tui": "16.0.
|
|
58
|
-
"@oh-my-pi/pi-utils": "16.0.
|
|
59
|
-
"@oh-my-pi/pi-wire": "16.0.
|
|
60
|
-
"@oh-my-pi/snapcompact": "16.0.
|
|
50
|
+
"@oh-my-pi/hashline": "16.0.7",
|
|
51
|
+
"@oh-my-pi/omp-stats": "16.0.7",
|
|
52
|
+
"@oh-my-pi/pi-agent-core": "16.0.7",
|
|
53
|
+
"@oh-my-pi/pi-ai": "16.0.7",
|
|
54
|
+
"@oh-my-pi/pi-catalog": "16.0.7",
|
|
55
|
+
"@oh-my-pi/pi-mnemopi": "16.0.7",
|
|
56
|
+
"@oh-my-pi/pi-natives": "16.0.7",
|
|
57
|
+
"@oh-my-pi/pi-tui": "16.0.7",
|
|
58
|
+
"@oh-my-pi/pi-utils": "16.0.7",
|
|
59
|
+
"@oh-my-pi/pi-wire": "16.0.7",
|
|
60
|
+
"@oh-my-pi/snapcompact": "16.0.7",
|
|
61
61
|
"@opentelemetry/api": "^1.9.1",
|
|
62
62
|
"@opentelemetry/context-async-hooks": "^2.7.1",
|
|
63
63
|
"@opentelemetry/exporter-trace-otlp-proto": "^0.218.0",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"@puppeteer/browsers": "^3.0.4",
|
|
68
68
|
"@types/turndown": "5.0.6",
|
|
69
69
|
"@xterm/headless": "^6.0.0",
|
|
70
|
+
"arktype": "^2.2.0",
|
|
70
71
|
"chalk": "^5.6.2",
|
|
71
72
|
"diff": "^9.0.0",
|
|
72
73
|
"fflate": "0.8.3",
|
package/scripts/omp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
# Dev launcher for the omp CLI
|
|
2
|
+
# Dev launcher for the omp CLI.
|
|
3
3
|
#
|
|
4
4
|
# Problem it solves: Bun reads `bunfig.toml` from the *current working
|
|
5
5
|
# directory* at startup and evaluates its `preload` entries before running the
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from "bun:test";
|
|
2
|
-
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
2
|
+
import type { AgentMessage, AgentTelemetryConfig } from "@oh-my-pi/pi-agent-core";
|
|
3
|
+
import { type } from "arktype";
|
|
3
4
|
import { createAdvisorMessageCard } from "../../modes/components/advisor-message";
|
|
4
5
|
import { getThemeByName } from "../../modes/theme/theme";
|
|
5
6
|
import { formatSessionHistoryMarkdown } from "../../session/session-history-format";
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
type AdvisorNote,
|
|
12
13
|
AdvisorRuntime,
|
|
13
14
|
type AdvisorRuntimeHost,
|
|
15
|
+
deriveAdvisorTelemetry,
|
|
14
16
|
formatAdvisorBatchContent,
|
|
15
17
|
isAdvisorInterruptImmuneTurnActive,
|
|
16
18
|
isInterruptingSeverity,
|
|
@@ -115,6 +117,16 @@ describe("advisor", () => {
|
|
|
115
117
|
expect(result.details).toEqual({ note: "x", severity: "concern" });
|
|
116
118
|
expect(result.useless).toBe(true);
|
|
117
119
|
});
|
|
120
|
+
|
|
121
|
+
it("validates parameters using ArkType", () => {
|
|
122
|
+
const onAdvice = vi.fn();
|
|
123
|
+
const tool = new AdviseTool(onAdvice);
|
|
124
|
+
const valid = tool.parameters({ note: "x", severity: "concern" });
|
|
125
|
+
expect(valid instanceof type.errors).toBe(false);
|
|
126
|
+
|
|
127
|
+
const invalid = tool.parameters({ note: 123, severity: "invalid" as any });
|
|
128
|
+
expect(invalid instanceof type.errors).toBe(true);
|
|
129
|
+
});
|
|
118
130
|
});
|
|
119
131
|
|
|
120
132
|
describe("advice delivery policy", () => {
|
|
@@ -181,6 +193,37 @@ describe("advisor", () => {
|
|
|
181
193
|
});
|
|
182
194
|
});
|
|
183
195
|
|
|
196
|
+
describe("deriveAdvisorTelemetry", () => {
|
|
197
|
+
it("returns undefined when the primary has no telemetry so the advisor stays a no-op", () => {
|
|
198
|
+
expect(deriveAdvisorTelemetry(undefined, { id: "s-advisor", name: "Advisor" })).toBeUndefined();
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it("inherits the primary's usage/cost hooks but restamps identity and clears the conversation", () => {
|
|
202
|
+
const onChatUsage = vi.fn();
|
|
203
|
+
const costEstimator = vi.fn();
|
|
204
|
+
const primary: AgentTelemetryConfig = {
|
|
205
|
+
agent: { id: "main", name: "Main" },
|
|
206
|
+
conversationId: "session-1",
|
|
207
|
+
attributes: { "deployment.id": "prod" },
|
|
208
|
+
onChatUsage,
|
|
209
|
+
costEstimator,
|
|
210
|
+
};
|
|
211
|
+
const identity = { id: "session-1-advisor", name: "Advisor", description: "anthropic/claude-sonnet-4-5" };
|
|
212
|
+
|
|
213
|
+
const derived = deriveAdvisorTelemetry(primary, identity);
|
|
214
|
+
|
|
215
|
+
// Usage/cost hooks are inherited so the advisor model's calls report through
|
|
216
|
+
// the same pipeline as the primary — the whole point of the fix.
|
|
217
|
+
expect(derived?.onChatUsage).toBe(onChatUsage);
|
|
218
|
+
expect(derived?.costEstimator).toBe(costEstimator);
|
|
219
|
+
expect(derived?.attributes).toEqual({ "deployment.id": "prod" });
|
|
220
|
+
// Advisor identity replaces the primary's so spans are attributable to the advisor.
|
|
221
|
+
expect(derived?.agent).toEqual(identity);
|
|
222
|
+
// Conversation cleared so the advisor loop falls back to its own `-advisor` session id.
|
|
223
|
+
expect(derived?.conversationId).toBeUndefined();
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
184
227
|
describe("AdvisorRuntime", () => {
|
|
185
228
|
function makeAgent(promptInputs: string[]): AdvisorAgent {
|
|
186
229
|
return {
|