@oh-my-pi/pi-coding-agent 16.0.5 → 16.0.6
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 +53 -0
- package/dist/cli.js +1927 -1376
- 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 +160 -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 +4 -11
- 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
package/src/tools/write.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { formatHashlineHeader, stripHashlinePrefixes } from "@oh-my-pi/hashline"
|
|
|
6
6
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
7
7
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
8
8
|
import { isEnoent, isRecord, prompt, untilAborted } from "@oh-my-pi/pi-utils";
|
|
9
|
-
import {
|
|
9
|
+
import { type } from "arktype";
|
|
10
10
|
|
|
11
11
|
import { canonicalSnapshotKey, getFileSnapshotStore } from "../edit/file-snapshot-store";
|
|
12
12
|
import { normalizeToLF } from "../edit/normalize";
|
|
@@ -71,12 +71,12 @@ async function loadFflate(): Promise<typeof import("fflate")> {
|
|
|
71
71
|
return fflateModulePromise;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const writeSchema =
|
|
75
|
-
path:
|
|
76
|
-
content:
|
|
74
|
+
const writeSchema = type({
|
|
75
|
+
path: type("string").describe("file path"),
|
|
76
|
+
content: type("string").describe("file content"),
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
export type WriteToolInput =
|
|
79
|
+
export type WriteToolInput = typeof writeSchema.infer;
|
|
80
80
|
|
|
81
81
|
/** Details returned by the write tool for TUI rendering */
|
|
82
82
|
export interface WriteToolDetails {
|
package/src/tui/index.ts
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type Component, getPaddingX, Text } from "@oh-my-pi/pi-tui";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Text whose content is (re)formatted against the actual render width.
|
|
5
|
+
*
|
|
6
|
+
* A plain `Text` receives an already-formatted string and only wraps it at
|
|
7
|
+
* render time, so width-dependent layout (per-line truncation, inline previews)
|
|
8
|
+
* has to be decided before the width is known. Renderers used to cope by
|
|
9
|
+
* hard-capping output lines at a fixed column count (e.g. 80), which truncated
|
|
10
|
+
* to roughly a third of a wide terminal. This defers formatting to
|
|
11
|
+
* `render(width)`: it computes the same content width the inner `Text` uses
|
|
12
|
+
* (mirroring its tight-layout flag so the budget can't desync), hands that to
|
|
13
|
+
* the formatter, and delegates margins/background/vertical padding to the inner
|
|
14
|
+
* `Text`. Lines the formatter caps at `contentWidth` fit exactly and so never
|
|
15
|
+
* wrap.
|
|
16
|
+
*/
|
|
17
|
+
export class WidthAwareText implements Component {
|
|
18
|
+
#format: (contentWidth: number) => string;
|
|
19
|
+
readonly #paddingX: number;
|
|
20
|
+
#inner: Text;
|
|
21
|
+
#cachedContentWidth = -1;
|
|
22
|
+
#cachedText: string | undefined;
|
|
23
|
+
#ignoreTight = false;
|
|
24
|
+
|
|
25
|
+
constructor(format: (contentWidth: number) => string, paddingX = 1, paddingY = 1) {
|
|
26
|
+
this.#format = format;
|
|
27
|
+
this.#paddingX = paddingX;
|
|
28
|
+
this.#inner = new Text("", paddingX, paddingY);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setCustomBgFn(customBgFn?: (text: string) => string): void {
|
|
32
|
+
this.#inner.setCustomBgFn(customBgFn);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
setIgnoreTight(ignore: boolean): this {
|
|
36
|
+
this.#ignoreTight = ignore;
|
|
37
|
+
this.#inner.setIgnoreTight(ignore);
|
|
38
|
+
this.invalidate();
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
invalidate(): void {
|
|
43
|
+
this.#cachedContentWidth = -1;
|
|
44
|
+
this.#cachedText = undefined;
|
|
45
|
+
this.#inner.invalidate();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
render(width: number): readonly string[] {
|
|
49
|
+
const paddingX = this.#ignoreTight ? this.#paddingX : getPaddingX(this.#paddingX);
|
|
50
|
+
const contentWidth = Math.max(1, width - paddingX * 2);
|
|
51
|
+
if (this.#cachedText === undefined || contentWidth !== this.#cachedContentWidth) {
|
|
52
|
+
this.#cachedContentWidth = contentWidth;
|
|
53
|
+
this.#cachedText = this.#format(contentWidth);
|
|
54
|
+
this.#inner.setText(this.#cachedText);
|
|
55
|
+
}
|
|
56
|
+
return this.#inner.render(width);
|
|
57
|
+
}
|
|
58
|
+
}
|
package/src/utils/markit.ts
CHANGED
|
@@ -8,6 +8,16 @@ export interface MarkitConversionResult {
|
|
|
8
8
|
error?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export interface MarkitFileConversionOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Directory the PDF converter writes extracted images/diagrams into. When
|
|
14
|
+
* set, each embedded image is rendered to `<id>.png` and referenced by path
|
|
15
|
+
* in the markdown; when unset, markit emits an `<!-- image: <id> ... -->`
|
|
16
|
+
* placeholder comment instead.
|
|
17
|
+
*/
|
|
18
|
+
imageDir?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
11
21
|
interface MuPdfWasmModuleConfig {
|
|
12
22
|
print?: (...values: unknown[]) => void;
|
|
13
23
|
printErr?: (...values: unknown[]) => void;
|
|
@@ -77,9 +87,14 @@ function finalizeConversion(markdown?: string): MarkitConversionResult {
|
|
|
77
87
|
return { content: "", ok: false, error: "Conversion produced no output" };
|
|
78
88
|
}
|
|
79
89
|
|
|
80
|
-
export async function convertFileWithMarkit(
|
|
90
|
+
export async function convertFileWithMarkit(
|
|
91
|
+
filePath: string,
|
|
92
|
+
signal?: AbortSignal,
|
|
93
|
+
options?: MarkitFileConversionOptions,
|
|
94
|
+
): Promise<MarkitConversionResult> {
|
|
95
|
+
const extra = options?.imageDir ? { imageDir: options.imageDir } : undefined;
|
|
81
96
|
try {
|
|
82
|
-
const result = await runMarkitConversion(markit => markit.convertFile(filePath), signal);
|
|
97
|
+
const result = await runMarkitConversion(markit => markit.convertFile(filePath, extra), signal);
|
|
83
98
|
return finalizeConversion(result.markdown);
|
|
84
99
|
} catch (error) {
|
|
85
100
|
if (error instanceof ToolAbortError) {
|
package/src/web/search/index.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
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
9
|
import { prompt } from "@oh-my-pi/pi-utils";
|
|
10
|
-
import {
|
|
10
|
+
import { type } from "arktype";
|
|
11
11
|
import { settings } from "../../config/settings";
|
|
12
12
|
import type { CustomTool, CustomToolContext, RenderResultOptions } from "../../extensibility/custom-tools/types";
|
|
13
13
|
import type { Theme } from "../../modes/theme/theme";
|
|
@@ -23,16 +23,16 @@ import type { SearchProviderId, SearchResponse } from "./types";
|
|
|
23
23
|
import { SearchProviderError } from "./types";
|
|
24
24
|
|
|
25
25
|
/** Web search tool parameters schema */
|
|
26
|
-
export const webSearchSchema =
|
|
27
|
-
query:
|
|
28
|
-
recency:
|
|
29
|
-
limit:
|
|
30
|
-
max_tokens:
|
|
31
|
-
temperature:
|
|
32
|
-
num_search_results:
|
|
26
|
+
export const webSearchSchema = type({
|
|
27
|
+
query: "string",
|
|
28
|
+
recency: "'day' | 'week' | 'month' | 'year'?",
|
|
29
|
+
limit: "number?",
|
|
30
|
+
max_tokens: "number?",
|
|
31
|
+
temperature: "number?",
|
|
32
|
+
num_search_results: "number?",
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
export type SearchToolParams =
|
|
35
|
+
export type SearchToolParams = typeof webSearchSchema.infer;
|
|
36
36
|
|
|
37
37
|
export interface SearchQueryParams extends SearchToolParams {
|
|
38
38
|
provider?: SearchProviderId | "auto";
|