@oh-my-pi/pi-coding-agent 15.0.0 → 15.0.2
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 +79 -0
- package/examples/extensions/plan-mode.ts +0 -1
- package/package.json +10 -10
- package/scripts/build-binary.ts +5 -0
- package/src/autoresearch/helpers.ts +17 -0
- package/src/autoresearch/tools/log-experiment.ts +9 -17
- package/src/autoresearch/tools/run-experiment.ts +2 -17
- package/src/capability/skill.ts +7 -0
- package/src/cli/list-models.ts +1 -1
- package/src/cli/shell-cli.ts +3 -13
- package/src/cli/update-cli.ts +1 -1
- package/src/cli.ts +10 -29
- package/src/commands/commit.ts +10 -0
- package/src/commit/agentic/tools/propose-changelog.ts +8 -1
- package/src/commit/analysis/conventional.ts +8 -66
- package/src/commit/map-reduce/reduce-phase.ts +6 -65
- package/src/commit/pipeline.ts +2 -2
- package/src/commit/shared-llm.ts +89 -0
- package/src/config/config-file.ts +210 -0
- package/src/config/model-equivalence.ts +8 -11
- package/src/config/model-registry.ts +44 -3
- package/src/config/model-resolver.ts +1 -4
- package/src/config/settings-schema.ts +82 -1
- package/src/config/settings.ts +1 -1
- package/src/config.ts +3 -219
- package/src/discovery/claude-plugins.ts +19 -7
- package/src/edit/renderer.ts +7 -1
- package/src/eval/js/executor.ts +3 -0
- package/src/eval/js/shared/rewrite-imports.ts +2 -2
- package/src/eval/py/executor.ts +5 -0
- package/src/eval/py/runner.py +42 -11
- package/src/eval/py/runtime.ts +1 -0
- package/src/exa/factory.ts +2 -2
- package/src/exa/mcp-client.ts +74 -1
- package/src/exec/bash-executor.ts +5 -1
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +0 -11
- package/src/extensibility/extensions/get-commands-handler.ts +77 -0
- package/src/extensibility/extensions/runner.ts +1 -1
- package/src/extensibility/extensions/types.ts +89 -223
- package/src/extensibility/hooks/types.ts +89 -314
- package/src/extensibility/plugins/legacy-pi-compat.ts +48 -31
- package/src/extensibility/shared-events.ts +343 -0
- package/src/extensibility/skills.ts +9 -0
- package/src/goals/index.ts +3 -0
- package/src/goals/runtime.ts +500 -0
- package/src/goals/state.ts +37 -0
- package/src/goals/tools/goal-tool.ts +237 -0
- package/src/hashline/anchors.ts +2 -2
- package/src/hashline/input.ts +2 -1
- package/src/hashline/parser.ts +27 -3
- package/src/hindsight/mental-models.ts +1 -1
- package/src/internal-urls/agent-protocol.ts +1 -20
- package/src/internal-urls/artifact-protocol.ts +1 -19
- package/src/internal-urls/docs-index.generated.ts +11 -12
- package/src/internal-urls/registry-helpers.ts +25 -0
- 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/main.ts +11 -2
- package/src/mcp/oauth-flow.ts +20 -0
- package/src/modes/acp/acp-agent.ts +327 -95
- package/src/modes/components/assistant-message.ts +14 -8
- package/src/modes/components/bash-execution.ts +24 -63
- package/src/modes/components/custom-message.ts +14 -40
- package/src/modes/components/eval-execution.ts +27 -57
- package/src/modes/components/execution-shared.ts +102 -0
- package/src/modes/components/hook-message.ts +17 -49
- package/src/modes/components/mcp-add-wizard.ts +26 -5
- package/src/modes/components/message-frame.ts +88 -0
- package/src/modes/components/model-selector.ts +1 -1
- package/src/modes/components/session-observer-overlay.ts +6 -2
- package/src/modes/components/session-selector.ts +1 -1
- package/src/modes/components/status-line/segments.ts +93 -8
- package/src/modes/components/status-line/types.ts +4 -0
- package/src/modes/components/status-line.ts +28 -10
- package/src/modes/components/tool-execution.ts +7 -8
- package/src/modes/controllers/command-controller-shared.ts +108 -0
- package/src/modes/controllers/command-controller.ts +13 -4
- package/src/modes/controllers/event-controller.ts +36 -7
- package/src/modes/controllers/extension-ui-controller.ts +3 -2
- package/src/modes/controllers/input-controller.ts +13 -0
- package/src/modes/controllers/mcp-command-controller.ts +56 -61
- package/src/modes/controllers/ssh-command-controller.ts +18 -57
- package/src/modes/interactive-mode.ts +624 -52
- package/src/modes/print-mode.ts +16 -86
- package/src/modes/rpc/host-uris.ts +235 -0
- package/src/modes/rpc/rpc-mode.ts +41 -88
- package/src/modes/rpc/rpc-types.ts +57 -0
- package/src/modes/runtime-init.ts +116 -0
- package/src/modes/theme/defaults/dark-poimandres.json +3 -0
- package/src/modes/theme/defaults/light-poimandres.json +3 -0
- package/src/modes/theme/theme.ts +24 -6
- package/src/modes/types.ts +14 -3
- package/src/modes/utils/context-usage.ts +13 -13
- package/src/modes/utils/ui-helpers.ts +10 -3
- package/src/plan-mode/approved-plan.ts +35 -1
- package/src/prompts/goals/goal-budget-limit.md +16 -0
- package/src/prompts/goals/goal-continuation.md +28 -0
- package/src/prompts/goals/goal-mode-active.md +23 -0
- package/src/prompts/system/plan-mode-active.md +5 -5
- package/src/prompts/system/plan-mode-tool-decision-reminder.md +1 -1
- package/src/prompts/tools/bash.md +6 -0
- package/src/prompts/tools/github.md +4 -4
- package/src/prompts/tools/goal.md +13 -0
- package/src/prompts/tools/hashline.md +101 -117
- package/src/prompts/tools/read.md +55 -36
- package/src/prompts/tools/resolve.md +6 -5
- package/src/sdk.ts +12 -5
- package/src/session/agent-session.ts +428 -106
- package/src/session/blob-store.ts +36 -3
- package/src/session/messages.ts +67 -2
- package/src/session/session-manager.ts +131 -12
- package/src/session/session-storage.ts +33 -15
- package/src/session/streaming-output.ts +309 -13
- package/src/slash-commands/builtin-registry.ts +18 -0
- package/src/ssh/ssh-executor.ts +5 -0
- package/src/system-prompt.ts +4 -2
- package/src/task/discovery.ts +5 -2
- package/src/task/executor.ts +19 -8
- package/src/task/index.ts +3 -0
- package/src/task/render.ts +21 -15
- package/src/task/types.ts +4 -0
- package/src/tools/ast-edit.ts +21 -120
- package/src/tools/ast-grep.ts +21 -119
- package/src/tools/bash-command-fixup.ts +47 -0
- package/src/tools/bash-interactive.ts +9 -1
- package/src/tools/bash.ts +66 -19
- package/src/tools/browser/attach.ts +3 -3
- package/src/tools/browser/launch.ts +81 -18
- package/src/tools/browser/registry.ts +1 -5
- package/src/tools/browser/render.ts +2 -2
- package/src/tools/browser/tab-supervisor.ts +51 -14
- package/src/tools/conflict-detect.ts +15 -4
- package/src/tools/eval.ts +12 -2
- package/src/tools/find.ts +20 -38
- package/src/tools/gh.ts +44 -10
- package/src/tools/index.ts +22 -11
- package/src/tools/inspect-image.ts +3 -10
- package/src/tools/job.ts +16 -7
- package/src/tools/output-meta.ts +202 -37
- package/src/tools/path-utils.ts +125 -2
- package/src/tools/read.ts +548 -237
- package/src/tools/render-utils.ts +92 -0
- package/src/tools/renderers.ts +2 -0
- package/src/tools/resolve.ts +72 -44
- package/src/tools/search.ts +120 -186
- package/src/tools/ssh.ts +3 -2
- package/src/tools/write.ts +64 -9
- package/src/utils/file-mentions.ts +1 -1
- package/src/utils/image-loading.ts +7 -3
- package/src/utils/image-resize.ts +32 -43
- package/src/vim/parser.ts +0 -17
- package/src/vim/render.ts +1 -1
- package/src/vim/types.ts +1 -1
- 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 +40 -95
- package/src/web/search/providers/jina.ts +5 -2
- package/src/web/search/providers/zai.ts +5 -2
- package/src/prompts/tools/exit-plan-mode.md +0 -6
- package/src/tools/exit-plan-mode.ts +0 -97
- package/src/utils/fuzzy.ts +0 -108
- package/src/utils/image-convert.ts +0 -27
package/src/utils/fuzzy.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
// Fuzzy search. Matches if all query characters appear in order (not necessarily consecutive).
|
|
2
|
-
// Lower score = better match.
|
|
3
|
-
|
|
4
|
-
export interface FuzzyMatch {
|
|
5
|
-
matches: boolean;
|
|
6
|
-
score: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function fuzzyMatch(query: string, text: string): FuzzyMatch {
|
|
10
|
-
const queryLower = query.toLowerCase();
|
|
11
|
-
const textLower = text.toLowerCase();
|
|
12
|
-
|
|
13
|
-
if (queryLower.length === 0) {
|
|
14
|
-
return { matches: true, score: 0 };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (queryLower.length > textLower.length) {
|
|
18
|
-
return { matches: false, score: 0 };
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let queryIndex = 0;
|
|
22
|
-
let score = 0;
|
|
23
|
-
let lastMatchIndex = -1;
|
|
24
|
-
let consecutiveMatches = 0;
|
|
25
|
-
|
|
26
|
-
for (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) {
|
|
27
|
-
if (textLower[i] === queryLower[queryIndex]) {
|
|
28
|
-
const isWordBoundary = i === 0 || /[\s\-_./]/.test(textLower[i - 1]!);
|
|
29
|
-
|
|
30
|
-
// Reward consecutive character matches (e.g., typing "foo" matches "foobar" better than "f_o_o")
|
|
31
|
-
if (lastMatchIndex === i - 1) {
|
|
32
|
-
consecutiveMatches++;
|
|
33
|
-
score -= consecutiveMatches * 5;
|
|
34
|
-
} else {
|
|
35
|
-
consecutiveMatches = 0;
|
|
36
|
-
// Penalize gaps between matched characters
|
|
37
|
-
if (lastMatchIndex >= 0) {
|
|
38
|
-
score += (i - lastMatchIndex - 1) * 2;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Reward matches at word boundaries (start of words are more likely intentional targets)
|
|
43
|
-
if (isWordBoundary) {
|
|
44
|
-
score -= 10;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Slight penalty for matches later in the string (prefer earlier matches)
|
|
48
|
-
score += i * 0.1;
|
|
49
|
-
|
|
50
|
-
lastMatchIndex = i;
|
|
51
|
-
queryIndex++;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Not all query characters were found in order
|
|
56
|
-
if (queryIndex < queryLower.length) {
|
|
57
|
-
return { matches: false, score: 0 };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return { matches: true, score };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Filter and sort items by fuzzy match quality (best matches first)
|
|
64
|
-
// Supports space-separated tokens: all tokens must match, sorted by match count then score
|
|
65
|
-
export function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) => string): T[] {
|
|
66
|
-
if (!query.trim()) {
|
|
67
|
-
return items;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Split query into tokens
|
|
71
|
-
const tokens = query
|
|
72
|
-
.trim()
|
|
73
|
-
.split(/\s+/)
|
|
74
|
-
.filter(t => t.length > 0);
|
|
75
|
-
|
|
76
|
-
if (tokens.length === 0) {
|
|
77
|
-
return items;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const results: { item: T; totalScore: number }[] = [];
|
|
81
|
-
|
|
82
|
-
for (const item of items) {
|
|
83
|
-
const text = getText(item);
|
|
84
|
-
let totalScore = 0;
|
|
85
|
-
let allMatch = true;
|
|
86
|
-
|
|
87
|
-
// Check each token against the text - ALL must match
|
|
88
|
-
for (const token of tokens) {
|
|
89
|
-
const match = fuzzyMatch(token, text);
|
|
90
|
-
if (match.matches) {
|
|
91
|
-
totalScore += match.score;
|
|
92
|
-
} else {
|
|
93
|
-
allMatch = false;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Only include if all tokens match
|
|
99
|
-
if (allMatch) {
|
|
100
|
-
results.push({ item, totalScore });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Sort by score (asc, lower is better)
|
|
105
|
-
results.sort((a, b) => a.totalScore - b.totalScore);
|
|
106
|
-
|
|
107
|
-
return results.map(r => r.item);
|
|
108
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ImageFormat, PhotonImage } from "@oh-my-pi/pi-natives";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Convert image to PNG format for terminal display.
|
|
5
|
-
* Kitty graphics protocol requires PNG format (f=100).
|
|
6
|
-
*/
|
|
7
|
-
export async function convertToPng(
|
|
8
|
-
base64Data: string,
|
|
9
|
-
mimeType: string,
|
|
10
|
-
): Promise<{ data: string; mimeType: string } | null> {
|
|
11
|
-
// Already PNG, no conversion needed
|
|
12
|
-
if (mimeType === "image/png") {
|
|
13
|
-
return { data: base64Data, mimeType };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
const image = await PhotonImage.parse(new Uint8Array(Buffer.from(base64Data, "base64")));
|
|
18
|
-
const pngBuffer = await image.encode(ImageFormat.PNG, 100);
|
|
19
|
-
return {
|
|
20
|
-
data: Buffer.from(pngBuffer).toBase64(),
|
|
21
|
-
mimeType: "image/png",
|
|
22
|
-
};
|
|
23
|
-
} catch {
|
|
24
|
-
// Conversion failed
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}
|