@oh-my-pi/pi-coding-agent 8.0.1 → 8.0.3
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/package.json +5 -1
- package/src/cli/args.ts +2 -2
- package/src/cli/config-cli.ts +4 -4
- package/src/cli/file-processor.ts +3 -3
- package/src/cli/list-models.ts +2 -2
- package/src/cli/plugin-cli.ts +7 -3
- package/src/cli/session-picker.ts +2 -2
- package/src/cli/setup-cli.ts +2 -2
- package/src/cli/stats-cli.ts +1 -1
- package/src/cli/update-cli.ts +2 -2
- package/src/config/keybindings.ts +1 -1
- package/src/config/model-registry.ts +1 -1
- package/src/config/model-resolver.ts +1 -1
- package/src/config/prompt-templates.ts +2 -2
- package/src/config/settings-manager.ts +5 -5
- package/src/cursor.ts +1 -1
- package/src/discovery/agents-md.ts +4 -4
- package/src/discovery/builtin.ts +21 -17
- package/src/discovery/claude.ts +12 -12
- package/src/discovery/cline.ts +6 -6
- package/src/discovery/codex.ts +21 -21
- package/src/discovery/cursor.ts +9 -9
- package/src/discovery/gemini.ts +13 -9
- package/src/discovery/github.ts +6 -6
- package/src/discovery/helpers.ts +4 -4
- package/src/discovery/index.ts +16 -16
- package/src/discovery/mcp-json.ts +4 -4
- package/src/discovery/ssh.ts +4 -4
- package/src/discovery/vscode.ts +4 -4
- package/src/discovery/windsurf.ts +6 -6
- package/src/exa/company.ts +1 -1
- package/src/exa/index.ts +2 -2
- package/src/exa/linkedin.ts +1 -1
- package/src/exa/mcp-client.ts +2 -2
- package/src/exa/render.ts +6 -6
- package/src/exa/researcher.ts +1 -1
- package/src/exa/search.ts +1 -1
- package/src/exa/websets.ts +1 -1
- package/src/exec/bash-executor.ts +3 -3
- package/src/export/custom-share.ts +1 -1
- package/src/export/html/index.ts +3 -3
- package/src/export/ttsr.ts +2 -2
- package/src/extensibility/custom-commands/bundled/review/index.ts +4 -4
- package/src/extensibility/custom-commands/loader.ts +3 -3
- package/src/extensibility/custom-commands/types.ts +1 -1
- package/src/extensibility/custom-tools/loader.ts +9 -9
- package/src/extensibility/custom-tools/types.ts +6 -6
- package/src/extensibility/custom-tools/wrapper.ts +1 -1
- package/src/extensibility/extensions/loader.ts +8 -8
- package/src/extensibility/extensions/runner.ts +3 -3
- package/src/extensibility/extensions/types.ts +23 -17
- package/src/extensibility/extensions/wrapper.ts +1 -1
- package/src/extensibility/hooks/index.ts +1 -1
- package/src/extensibility/hooks/loader.ts +7 -7
- package/src/extensibility/hooks/runner.ts +4 -4
- package/src/extensibility/hooks/types.ts +16 -10
- package/src/extensibility/plugins/doctor.ts +1 -1
- package/src/extensibility/plugins/installer.ts +1 -1
- package/src/extensibility/plugins/paths.ts +1 -1
- package/src/extensibility/skills.ts +9 -6
- package/src/extensibility/slash-commands.ts +6 -6
- package/src/index.ts +7 -7
- package/src/internal-urls/rule-protocol.ts +1 -1
- package/src/internal-urls/skill-protocol.ts +1 -1
- package/src/ipy/executor.ts +3 -3
- package/src/ipy/gateway-coordinator.ts +3 -3
- package/src/ipy/kernel.ts +3 -3
- package/src/lsp/client.ts +1 -1
- package/src/lsp/clients/biome-client.ts +1 -1
- package/src/lsp/clients/index.ts +1 -1
- package/src/lsp/clients/lsp-linter-client.ts +4 -4
- package/src/lsp/config.ts +1 -1
- package/src/lsp/index.ts +6 -6
- package/src/lsp/render.ts +7 -2
- package/src/lsp/utils.ts +1 -1
- package/src/main.ts +1 -1
- package/src/mcp/config.ts +3 -3
- package/src/mcp/loader.ts +2 -2
- package/src/mcp/manager.ts +1 -1
- package/src/mcp/tool-bridge.ts +6 -2
- package/src/mcp/tool-cache.ts +1 -1
- package/src/mcp/transports/http.ts +1 -1
- package/src/mcp/transports/stdio.ts +1 -1
- package/src/migrations.ts +2 -2
- package/src/modes/components/armin.ts +1 -1
- package/src/modes/components/assistant-message.ts +1 -1
- package/src/modes/components/bash-execution.ts +3 -3
- package/src/modes/components/bordered-loader.ts +1 -1
- package/src/modes/components/branch-summary-message.ts +2 -2
- package/src/modes/components/compaction-summary-message.ts +2 -2
- package/src/modes/components/custom-message.ts +3 -3
- package/src/modes/components/diff.ts +1 -1
- package/src/modes/components/dynamic-border.ts +1 -1
- package/src/modes/components/extensions/extension-dashboard.ts +3 -3
- package/src/modes/components/extensions/extension-list.ts +2 -2
- package/src/modes/components/extensions/inspector-panel.ts +1 -1
- package/src/modes/components/extensions/state-manager.ts +17 -11
- package/src/modes/components/extensions/types.ts +1 -1
- package/src/modes/components/footer.ts +3 -3
- package/src/modes/components/history-search.ts +2 -2
- package/src/modes/components/hook-editor.ts +1 -1
- package/src/modes/components/hook-input.ts +1 -1
- package/src/modes/components/hook-message.ts +3 -3
- package/src/modes/components/hook-selector.ts +1 -1
- package/src/modes/components/keybinding-hints.ts +2 -2
- package/src/modes/components/login-dialog.ts +1 -1
- package/src/modes/components/model-selector.ts +5 -5
- package/src/modes/components/oauth-selector.ts +2 -2
- package/src/modes/components/plugin-settings.ts +3 -3
- package/src/modes/components/python-execution.ts +3 -3
- package/src/modes/components/queue-mode-selector.ts +1 -1
- package/src/modes/components/read-tool-group.ts +2 -2
- package/src/modes/components/session-selector.ts +3 -3
- package/src/modes/components/settings-defs.ts +2 -2
- package/src/modes/components/settings-selector.ts +2 -2
- package/src/modes/components/show-images-selector.ts +1 -1
- package/src/modes/components/status-line/segments.ts +2 -2
- package/src/modes/components/status-line/separators.ts +1 -1
- package/src/modes/components/status-line/types.ts +2 -2
- package/src/modes/components/status-line-segment-editor.ts +2 -2
- package/src/modes/components/status-line.ts +3 -3
- package/src/modes/components/theme-selector.ts +1 -1
- package/src/modes/components/thinking-selector.ts +1 -1
- package/src/modes/components/todo-display.ts +2 -2
- package/src/modes/components/todo-reminder.ts +2 -2
- package/src/modes/components/tool-execution.ts +11 -6
- package/src/modes/components/tree-selector.ts +3 -3
- package/src/modes/components/ttsr-notification.ts +2 -2
- package/src/modes/components/user-message-selector.ts +1 -1
- package/src/modes/components/user-message.ts +1 -1
- package/src/modes/components/welcome.ts +2 -2
- package/src/modes/controllers/command-controller.ts +15 -15
- package/src/modes/controllers/event-controller.ts +13 -9
- package/src/modes/controllers/extension-ui-controller.ts +17 -11
- package/src/modes/controllers/input-controller.ts +6 -6
- package/src/modes/controllers/selector-controller.ts +22 -16
- package/src/modes/interactive-mode.ts +12 -12
- package/src/modes/print-mode.ts +1 -1
- package/src/modes/rpc/rpc-client.ts +3 -3
- package/src/modes/rpc/rpc-mode.ts +6 -3
- package/src/modes/rpc/rpc-types.ts +3 -3
- package/src/modes/theme/theme.ts +1 -1
- package/src/modes/types.ts +8 -8
- package/src/modes/utils/ui-helpers.ts +14 -14
- package/src/patch/applicator.ts +1 -1
- package/src/patch/diff.ts +1 -1
- package/src/patch/index.ts +8 -8
- package/src/patch/shared.ts +9 -9
- package/src/sdk.ts +19 -16
- package/src/session/agent-session.ts +27 -27
- package/src/session/agent-storage.ts +2 -2
- package/src/session/auth-storage.ts +1 -1
- package/src/session/compaction/branch-summarization.ts +7 -5
- package/src/session/compaction/compaction.ts +16 -6
- package/src/session/compaction/utils.ts +5 -3
- package/src/session/history-storage.ts +1 -1
- package/src/session/messages.ts +2 -2
- package/src/session/session-manager.ts +2 -2
- package/src/session/storage-migration.ts +2 -2
- package/src/session/streaming-output.ts +1 -1
- package/src/ssh/connection-manager.ts +1 -1
- package/src/ssh/ssh-executor.ts +1 -1
- package/src/ssh/sshfs-mount.ts +1 -1
- package/src/system-prompt.ts +14 -8
- package/src/task/agents.ts +8 -8
- package/src/task/commands.ts +5 -5
- package/src/task/discovery.ts +3 -3
- package/src/task/executor.ts +11 -11
- package/src/task/index.ts +4 -4
- package/src/task/render.ts +6 -6
- package/src/task/subprocess-tool-registry.ts +1 -1
- package/src/task/worker-protocol.ts +3 -3
- package/src/task/worker.ts +18 -13
- package/src/tools/ask.ts +4 -4
- package/src/tools/bash-interceptor.ts +4 -1
- package/src/tools/bash.ts +8 -8
- package/src/tools/calculator.ts +4 -4
- package/src/tools/complete.ts +1 -1
- package/src/tools/context.ts +2 -2
- package/src/tools/fetch.ts +11 -11
- package/src/tools/find.ts +7 -7
- package/src/tools/gemini-image.ts +6 -6
- package/src/tools/grep.ts +8 -8
- package/src/tools/index.ts +19 -19
- package/src/tools/list-limit.ts +1 -1
- package/src/tools/ls.ts +4 -4
- package/src/tools/notebook.ts +3 -3
- package/src/tools/output-meta.ts +3 -3
- package/src/tools/output-utils.ts +1 -1
- package/src/tools/python.ts +10 -10
- package/src/tools/read.ts +11 -11
- package/src/tools/render-utils.ts +1 -1
- package/src/tools/renderers.ts +6 -6
- package/src/tools/review.ts +2 -2
- package/src/tools/ssh.ts +12 -12
- package/src/tools/todo-write.ts +5 -5
- package/src/tools/tool-result.ts +3 -3
- package/src/tools/write.ts +11 -11
- package/src/utils/changelog.ts +1 -1
- package/src/utils/file-mentions.ts +9 -4
- package/src/utils/image-convert.ts +1 -1
- package/src/utils/image-resize.ts +1 -1
- package/src/utils/shell.ts +1 -1
- package/src/utils/title-generator.ts +4 -4
- package/src/utils/tools-manager.ts +1 -1
- package/src/web/scrapers/choosealicense.ts +1 -1
- package/src/web/scrapers/twitter.ts +1 -1
- package/src/web/scrapers/types.ts +1 -1
- package/src/web/scrapers/utils.ts +1 -1
- package/src/web/scrapers/youtube.ts +2 -2
- package/src/web/search/auth.ts +8 -4
- package/src/web/search/index.ts +19 -10
- package/src/web/search/providers/anthropic.ts +8 -3
- package/src/web/search/providers/exa.ts +2 -2
- package/src/web/search/providers/perplexity.ts +2 -2
- package/src/web/search/render.ts +5 -5
package/src/tools/write.ts
CHANGED
|
@@ -5,22 +5,22 @@ import type {
|
|
|
5
5
|
AgentToolUpdateCallback,
|
|
6
6
|
ToolCallContext,
|
|
7
7
|
} from "@oh-my-pi/pi-agent-core";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import { untilAborted } from "@oh-my-pi/pi-utils";
|
|
11
|
-
import { Type } from "@sinclair/typebox";
|
|
12
|
-
import { renderPromptTemplate } from "$c/config/prompt-templates";
|
|
13
|
-
import type { RenderResultOptions } from "$c/extensibility/custom-tools/types";
|
|
8
|
+
import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates";
|
|
9
|
+
import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types";
|
|
14
10
|
import {
|
|
15
11
|
createLspWritethrough,
|
|
16
12
|
type FileDiagnosticsResult,
|
|
17
13
|
type WritethroughCallback,
|
|
18
14
|
writethroughNoop,
|
|
19
|
-
} from "
|
|
20
|
-
import { getLanguageFromPath, highlightCode, type Theme } from "
|
|
21
|
-
import writeDescription from "
|
|
22
|
-
import type { ToolSession } from "
|
|
23
|
-
import { type OutputMeta, outputMeta } from "
|
|
15
|
+
} from "@oh-my-pi/pi-coding-agent/lsp/index";
|
|
16
|
+
import { getLanguageFromPath, highlightCode, type Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
17
|
+
import writeDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/write.md" with { type: "text" };
|
|
18
|
+
import type { ToolSession } from "@oh-my-pi/pi-coding-agent/sdk";
|
|
19
|
+
import { type OutputMeta, outputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta";
|
|
20
|
+
import type { Component } from "@oh-my-pi/pi-tui";
|
|
21
|
+
import { Text } from "@oh-my-pi/pi-tui";
|
|
22
|
+
import { untilAborted } from "@oh-my-pi/pi-utils";
|
|
23
|
+
import { Type } from "@sinclair/typebox";
|
|
24
24
|
import { resolveToCwd } from "./path-utils";
|
|
25
25
|
import { formatDiagnostics, formatExpandHint, formatStatusIcon, replaceTabs, shortenPath } from "./render-utils";
|
|
26
26
|
import type { RenderCallOptions } from "./renderers";
|
package/src/utils/changelog.ts
CHANGED
|
@@ -96,4 +96,4 @@ export function getNewEntries(entries: ChangelogEntry[], lastVersion: string): C
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// Re-export getChangelogPath from paths.ts for convenience
|
|
99
|
-
export { getChangelogPath } from "
|
|
99
|
+
export { getChangelogPath } from "@oh-my-pi/pi-coding-agent/config";
|
|
@@ -8,10 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
11
|
-
import type { FileMentionMessage } from "
|
|
12
|
-
import { resolveReadPath } from "
|
|
13
|
-
import { formatAge } from "
|
|
14
|
-
import {
|
|
11
|
+
import type { FileMentionMessage } from "@oh-my-pi/pi-coding-agent/session/messages";
|
|
12
|
+
import { resolveReadPath } from "@oh-my-pi/pi-coding-agent/tools/path-utils";
|
|
13
|
+
import { formatAge } from "@oh-my-pi/pi-coding-agent/tools/render-utils";
|
|
14
|
+
import {
|
|
15
|
+
DEFAULT_MAX_BYTES,
|
|
16
|
+
formatSize,
|
|
17
|
+
truncateHead,
|
|
18
|
+
truncateStringToBytesFromStart,
|
|
19
|
+
} from "@oh-my-pi/pi-coding-agent/tools/truncate";
|
|
15
20
|
|
|
16
21
|
/** Regex to match @filepath patterns in text */
|
|
17
22
|
const FILE_MENTION_REGEX = /@([^\s@]+)/g;
|
package/src/utils/shell.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { constants } from "node:fs";
|
|
2
2
|
import { access } from "node:fs/promises";
|
|
3
|
+
import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager";
|
|
3
4
|
import { $ } from "bun";
|
|
4
|
-
import { SettingsManager } from "$c/config/settings-manager";
|
|
5
5
|
|
|
6
6
|
export interface ShellConfig {
|
|
7
7
|
shell: string;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import type { Api, Model } from "@oh-my-pi/pi-ai";
|
|
6
6
|
import { completeSimple } from "@oh-my-pi/pi-ai";
|
|
7
|
+
import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry";
|
|
8
|
+
import { parseModelString, SMOL_MODEL_PRIORITY } from "@oh-my-pi/pi-coding-agent/config/model-resolver";
|
|
9
|
+
import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates";
|
|
10
|
+
import titleSystemPrompt from "@oh-my-pi/pi-coding-agent/prompts/system/title-system.md" with { type: "text" };
|
|
7
11
|
import { logger } from "@oh-my-pi/pi-utils";
|
|
8
|
-
import type { ModelRegistry } from "$c/config/model-registry";
|
|
9
|
-
import { parseModelString, SMOL_MODEL_PRIORITY } from "$c/config/model-resolver";
|
|
10
|
-
import { renderPromptTemplate } from "$c/config/prompt-templates";
|
|
11
|
-
import titleSystemPrompt from "$c/prompts/system/title-system.md" with { type: "text" };
|
|
12
12
|
|
|
13
13
|
const TITLE_SYSTEM_PROMPT = renderPromptTemplate(titleSystemPrompt);
|
|
14
14
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { chmod, mkdir, rename, rm } from "node:fs/promises";
|
|
2
2
|
import { arch, platform } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
import { APP_NAME, getBinDir } from "@oh-my-pi/pi-coding-agent/config";
|
|
4
5
|
import { createTempDir, logger } from "@oh-my-pi/pi-utils";
|
|
5
6
|
import { $ } from "bun";
|
|
6
|
-
import { APP_NAME, getBinDir } from "$c/config";
|
|
7
7
|
|
|
8
8
|
const TOOLS_DIR = getBinDir();
|
|
9
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ToolAbortError } from "@oh-my-pi/pi-coding-agent/tools/tool-errors";
|
|
1
2
|
import { parse as parseHtml } from "node-html-parser";
|
|
2
|
-
import { ToolAbortError } from "$c/tools/tool-errors";
|
|
3
3
|
import type { RenderResult, SpecialHandler } from "./types";
|
|
4
4
|
import { finalizeOutput, loadPage } from "./types";
|
|
5
5
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { rm } from "node:fs/promises";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
import { ensureTool } from "@oh-my-pi/pi-coding-agent/utils/tools-manager";
|
|
4
5
|
import { ptree } from "@oh-my-pi/pi-utils";
|
|
5
6
|
import { nanoid } from "nanoid";
|
|
6
|
-
import { ensureTool } from "$c/utils/tools-manager";
|
|
7
7
|
import { createRequestSignal } from "./types";
|
|
8
8
|
|
|
9
9
|
const MAX_BYTES = 50 * 1024 * 1024; // 50MB for binary files
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { unlinkSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { throwIfAborted } from "@oh-my-pi/pi-coding-agent/tools/tool-errors";
|
|
5
|
+
import { ensureTool } from "@oh-my-pi/pi-coding-agent/utils/tools-manager";
|
|
4
6
|
import { cspawn } from "@oh-my-pi/pi-utils";
|
|
5
7
|
import { nanoid } from "nanoid";
|
|
6
|
-
import { throwIfAborted } from "$c/tools/tool-errors";
|
|
7
|
-
import { ensureTool } from "$c/utils/tools-manager";
|
|
8
8
|
import type { RenderResult, SpecialHandler } from "./types";
|
|
9
9
|
import { finalizeOutput } from "./types";
|
|
10
10
|
|
package/src/web/search/auth.ts
CHANGED
|
@@ -11,11 +11,15 @@
|
|
|
11
11
|
import * as os from "node:os";
|
|
12
12
|
import * as path from "node:path";
|
|
13
13
|
import { buildAnthropicHeaders as buildProviderAnthropicHeaders } from "@oh-my-pi/pi-ai";
|
|
14
|
+
import { getAgentDbPath, getConfigDirPaths } from "@oh-my-pi/pi-coding-agent/config";
|
|
15
|
+
import { AgentStorage } from "@oh-my-pi/pi-coding-agent/session/agent-storage";
|
|
16
|
+
import type {
|
|
17
|
+
AuthCredential,
|
|
18
|
+
AuthCredentialEntry,
|
|
19
|
+
AuthStorageData,
|
|
20
|
+
} from "@oh-my-pi/pi-coding-agent/session/auth-storage";
|
|
21
|
+
import { migrateJsonStorage } from "@oh-my-pi/pi-coding-agent/session/storage-migration";
|
|
14
22
|
import { logger } from "@oh-my-pi/pi-utils";
|
|
15
|
-
import { getAgentDbPath, getConfigDirPaths } from "$c/config";
|
|
16
|
-
import { AgentStorage } from "$c/session/agent-storage";
|
|
17
|
-
import type { AuthCredential, AuthCredentialEntry, AuthStorageData } from "$c/session/auth-storage";
|
|
18
|
-
import { migrateJsonStorage } from "$c/session/storage-migration";
|
|
19
23
|
import type { AnthropicAuthConfig, AnthropicOAuthCredential, ModelsJson } from "./types";
|
|
20
24
|
|
|
21
25
|
const DEFAULT_BASE_URL = "https://api.anthropic.com";
|
package/src/web/search/index.ts
CHANGED
|
@@ -14,17 +14,26 @@
|
|
|
14
14
|
|
|
15
15
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
16
16
|
import { StringEnum } from "@oh-my-pi/pi-ai";
|
|
17
|
+
import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates";
|
|
18
|
+
import {
|
|
19
|
+
callExaTool,
|
|
20
|
+
findApiKey as findExaKey,
|
|
21
|
+
formatSearchResults,
|
|
22
|
+
isSearchResponse,
|
|
23
|
+
} from "@oh-my-pi/pi-coding-agent/exa/mcp-client";
|
|
24
|
+
import { renderExaCall, renderExaResult } from "@oh-my-pi/pi-coding-agent/exa/render";
|
|
25
|
+
import type { ExaRenderDetails } from "@oh-my-pi/pi-coding-agent/exa/types";
|
|
26
|
+
import type {
|
|
27
|
+
CustomTool,
|
|
28
|
+
CustomToolContext,
|
|
29
|
+
RenderResultOptions,
|
|
30
|
+
} from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types";
|
|
31
|
+
import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
32
|
+
import webSearchSystemPrompt from "@oh-my-pi/pi-coding-agent/prompts/system/web-search.md" with { type: "text" };
|
|
33
|
+
import webSearchDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/web-search.md" with { type: "text" };
|
|
34
|
+
import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index";
|
|
35
|
+
import { formatAge } from "@oh-my-pi/pi-coding-agent/tools/render-utils";
|
|
17
36
|
import { Type } from "@sinclair/typebox";
|
|
18
|
-
import { renderPromptTemplate } from "$c/config/prompt-templates";
|
|
19
|
-
import { callExaTool, findApiKey as findExaKey, formatSearchResults, isSearchResponse } from "$c/exa/mcp-client";
|
|
20
|
-
import { renderExaCall, renderExaResult } from "$c/exa/render";
|
|
21
|
-
import type { ExaRenderDetails } from "$c/exa/types";
|
|
22
|
-
import type { CustomTool, CustomToolContext, RenderResultOptions } from "$c/extensibility/custom-tools/types";
|
|
23
|
-
import type { Theme } from "$c/modes/theme/theme";
|
|
24
|
-
import webSearchSystemPrompt from "$c/prompts/system/web-search.md" with { type: "text" };
|
|
25
|
-
import webSearchDescription from "$c/prompts/tools/web-search.md" with { type: "text" };
|
|
26
|
-
import type { ToolSession } from "$c/tools/index";
|
|
27
|
-
import { formatAge } from "$c/tools/render-utils";
|
|
28
37
|
import { findAnthropicAuth } from "./auth";
|
|
29
38
|
import { searchAnthropic } from "./providers/anthropic";
|
|
30
39
|
import { searchExa } from "./providers/exa";
|
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { applyClaudeToolPrefix, buildAnthropicSystemBlocks, stripClaudeToolPrefix } from "@oh-my-pi/pi-ai";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
buildAnthropicHeaders,
|
|
11
|
+
buildAnthropicUrl,
|
|
12
|
+
findAnthropicAuth,
|
|
13
|
+
getEnv,
|
|
14
|
+
} from "@oh-my-pi/pi-coding-agent/web/search/auth";
|
|
10
15
|
import type {
|
|
11
16
|
AnthropicApiResponse,
|
|
12
17
|
AnthropicAuthConfig,
|
|
@@ -14,8 +19,8 @@ import type {
|
|
|
14
19
|
WebSearchCitation,
|
|
15
20
|
WebSearchResponse,
|
|
16
21
|
WebSearchSource,
|
|
17
|
-
} from "
|
|
18
|
-
import { WebSearchProviderError } from "
|
|
22
|
+
} from "@oh-my-pi/pi-coding-agent/web/search/types";
|
|
23
|
+
import { WebSearchProviderError } from "@oh-my-pi/pi-coding-agent/web/search/types";
|
|
19
24
|
|
|
20
25
|
const DEFAULT_MODEL = "claude-haiku-4-5";
|
|
21
26
|
const DEFAULT_MAX_TOKENS = 4096;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
9
|
import { homedir } from "node:os";
|
|
10
|
-
import type { WebSearchResponse, WebSearchSource } from "
|
|
11
|
-
import { WebSearchProviderError } from "
|
|
10
|
+
import type { WebSearchResponse, WebSearchSource } from "@oh-my-pi/pi-coding-agent/web/search/types";
|
|
11
|
+
import { WebSearchProviderError } from "@oh-my-pi/pi-coding-agent/web/search/types";
|
|
12
12
|
|
|
13
13
|
const EXA_API_URL = "https://api.exa.ai/search";
|
|
14
14
|
|
|
@@ -12,8 +12,8 @@ import type {
|
|
|
12
12
|
WebSearchCitation,
|
|
13
13
|
WebSearchResponse,
|
|
14
14
|
WebSearchSource,
|
|
15
|
-
} from "
|
|
16
|
-
import { WebSearchProviderError } from "
|
|
15
|
+
} from "@oh-my-pi/pi-coding-agent/web/search/types";
|
|
16
|
+
import { WebSearchProviderError } from "@oh-my-pi/pi-coding-agent/web/search/types";
|
|
17
17
|
|
|
18
18
|
const PERPLEXITY_API_URL = "https://api.perplexity.ai/chat/completions";
|
|
19
19
|
|
package/src/web/search/render.ts
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
* Tree-based rendering with collapsed/expanded states for web search results.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {
|
|
8
|
-
import {
|
|
9
|
-
import type { RenderResultOptions } from "$c/extensibility/custom-tools/types";
|
|
10
|
-
import type { Theme } from "$c/modes/theme/theme";
|
|
7
|
+
import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types";
|
|
8
|
+
import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
11
9
|
import {
|
|
12
10
|
formatAge,
|
|
13
11
|
formatCount,
|
|
@@ -19,7 +17,9 @@ import {
|
|
|
19
17
|
PREVIEW_LIMITS,
|
|
20
18
|
TRUNCATE_LENGTHS,
|
|
21
19
|
truncate,
|
|
22
|
-
} from "
|
|
20
|
+
} from "@oh-my-pi/pi-coding-agent/tools/render-utils";
|
|
21
|
+
import type { Component } from "@oh-my-pi/pi-tui";
|
|
22
|
+
import { Text } from "@oh-my-pi/pi-tui";
|
|
23
23
|
import type { WebSearchResponse } from "./types";
|
|
24
24
|
|
|
25
25
|
const MAX_COLLAPSED_ANSWER_LINES = PREVIEW_LIMITS.COLLAPSED_LINES;
|