@oh-my-pi/pi-coding-agent 15.5.12 → 15.5.15
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 +46 -0
- package/dist/types/config/model-registry.d.ts +1 -1
- package/dist/types/config/models-config-schema.d.ts +2 -0
- package/dist/types/config/settings-schema.d.ts +1 -10
- package/dist/types/edit/file-snapshot-store.d.ts +19 -0
- package/dist/types/eval/__tests__/llm-bridge.test.d.ts +1 -0
- package/dist/types/eval/llm-bridge.d.ts +25 -0
- package/dist/types/export/html/template.generated.d.ts +1 -1
- package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +15 -0
- package/dist/types/modes/theme/theme.d.ts +2 -1
- package/dist/types/session/agent-session.d.ts +2 -0
- package/dist/types/tools/index.d.ts +0 -1
- package/package.json +8 -8
- package/src/config/model-registry.ts +89 -5
- package/src/config/models-config-schema.ts +1 -1
- package/src/config/settings-schema.ts +1 -10
- package/src/edit/file-snapshot-store.ts +34 -0
- package/src/edit/hashline/diff.ts +3 -8
- package/src/edit/renderer.ts +1 -1
- package/src/eval/__tests__/llm-bridge.test.ts +297 -0
- package/src/eval/js/shared/prelude.txt +8 -0
- package/src/eval/js/tool-bridge.ts +4 -0
- package/src/eval/llm-bridge.ts +181 -0
- package/src/eval/py/prelude.py +52 -31
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +0 -13
- package/src/extensibility/plugins/legacy-pi-compat.ts +60 -23
- package/src/internal-urls/docs-index.generated.ts +4 -5
- package/src/main.ts +4 -0
- package/src/modes/components/model-selector.ts +119 -22
- package/src/modes/components/status-line/presets.ts +1 -0
- package/src/modes/components/status-line/segments.ts +23 -0
- package/src/modes/interactive-mode.ts +22 -87
- package/src/modes/theme/theme.ts +7 -0
- package/src/prompts/tools/eval.md +2 -0
- package/src/session/agent-session.ts +19 -0
- package/src/session/session-manager.ts +47 -0
- package/src/tools/ast-edit.ts +1 -1
- package/src/tools/ast-grep.ts +6 -17
- package/src/tools/eval.ts +24 -48
- package/src/tools/index.ts +0 -4
- package/src/tools/read.ts +23 -33
- package/src/tools/renderers.ts +0 -2
- package/src/tools/search.ts +12 -21
- package/src/tools/write.ts +1 -3
- package/src/utils/file-mentions.ts +1 -3
- package/dist/types/tools/calculator.d.ts +0 -77
- package/src/prompts/tools/calculator.md +0 -10
- package/src/tools/calculator.ts +0 -541
|
@@ -1227,17 +1227,6 @@
|
|
|
1227
1227
|
return html;
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
-
function renderCalc(name, args, result, ctx) {
|
|
1231
|
-
let html = toolHead('calc');
|
|
1232
|
-
const exprs = args.expressions || (args.expression ? [args.expression] : []);
|
|
1233
|
-
for (const e of exprs) html += codeBlock(String(e), 'plaintext');
|
|
1234
|
-
if (result) {
|
|
1235
|
-
const output = ctx.getResultText();
|
|
1236
|
-
if (output) html += formatExpandableOutput(output, 6);
|
|
1237
|
-
}
|
|
1238
|
-
return html;
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
1230
|
function renderJob(name, args, result, ctx) {
|
|
1242
1231
|
const badges = [];
|
|
1243
1232
|
const pollIds = Array.isArray(args.poll) ? args.poll : Array.isArray(args.jobs) ? args.jobs : Array.isArray(args.jobIds) ? args.jobIds : [];
|
|
@@ -1558,8 +1547,6 @@
|
|
|
1558
1547
|
yield: renderYield,
|
|
1559
1548
|
report_finding: renderReportFinding,
|
|
1560
1549
|
report_tool_issue: renderReportToolIssue,
|
|
1561
|
-
calc: renderCalc,
|
|
1562
|
-
calculator: renderCalc,
|
|
1563
1550
|
await: renderJob,
|
|
1564
1551
|
poll: renderJob,
|
|
1565
1552
|
cancel_job: renderJob,
|
|
@@ -59,20 +59,57 @@ const resolvedSpecifierFallbacks = new Map<string, string>();
|
|
|
59
59
|
const TYPEBOX_SPECIFIER = "@sinclair/typebox";
|
|
60
60
|
const TYPEBOX_SPECIFIER_FILTER = /^@sinclair\/typebox$/;
|
|
61
61
|
|
|
62
|
-
// Compat shim paths
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
// the
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
// Compat shim and bundled-package paths used in compiled-binary mode. The shim
|
|
63
|
+
// paths must point at files that ship inside the bunfs root; in dev /
|
|
64
|
+
// source-link / installed-package mode the canonical specifier resolves via
|
|
65
|
+
// `Bun.resolveSync` so only the shim files need explicit paths there.
|
|
66
|
+
//
|
|
67
|
+
// `BUNFS_PACKAGE_ROOT` is derived from `import.meta.dir` rather than hardcoded
|
|
68
|
+
// as `/$bunfs/root/packages` so the prefix stays platform-native: on Windows
|
|
69
|
+
// the bunfs mount appears as `<drive>:\~BUN\root\…` (see oven-sh/bun#15766),
|
|
70
|
+
// and a hardcoded POSIX literal would normalize to `\$bunfs\root\…` and fail
|
|
71
|
+
// to resolve. Compiled Bun modules currently report the bunfs root itself from
|
|
72
|
+
// `import.meta.dir`, so appending `packages` lands on the `--root ../..`
|
|
73
|
+
// package directory used by `scripts/build-binary.ts`.
|
|
74
|
+
//
|
|
75
|
+
// Every shim listed below must also be registered as an explicit `--compile`
|
|
76
|
+
// entrypoint in `scripts/build-binary.ts` or release builds fail with
|
|
77
|
+
// missing-module errors. Non-shim bundled packages are resolved via
|
|
78
|
+
// `Bun.resolveSync` (see `resolveCanonicalPiSpecifier`) outside compiled mode,
|
|
79
|
+
// so they keep working when on-disk layout differs from the monorepo tree.
|
|
80
|
+
/**
|
|
81
|
+
* Compute the bunfs package root from the compiled binary's `import.meta.dir`
|
|
82
|
+
* (or any stand-in supplied by tests). Bun 1.3 reports the bunfs mount root
|
|
83
|
+
* (`/$bunfs/root` or `<drive>:\~BUN\root`) for imported modules as well as the
|
|
84
|
+
* entrypoint, so the normal path is `<root>/packages`.
|
|
85
|
+
*
|
|
86
|
+
* The suffix branch preserves correctness if a future Bun release switches to
|
|
87
|
+
* module-specific `import.meta.dir` values inside compiled binaries, matching
|
|
88
|
+
* the source layout:
|
|
89
|
+
* `<bunfs>/packages/coding-agent/src/extensibility/plugins`.
|
|
90
|
+
*
|
|
91
|
+
* Exported for tests; production callers use `BUNFS_PACKAGE_ROOT` below.
|
|
92
|
+
*/
|
|
93
|
+
export function __computeBunfsPackageRoot(metaDir: string, pathImpl: typeof path = path): string {
|
|
94
|
+
const pluginsDirSuffix = pathImpl.join("packages", "coding-agent", "src", "extensibility", "plugins");
|
|
95
|
+
const normalizedMetaDir = pathImpl.normalize(metaDir);
|
|
96
|
+
if (normalizedMetaDir.endsWith(pluginsDirSuffix)) {
|
|
97
|
+
return pathImpl.resolve(metaDir, "..", "..", "..", "..");
|
|
98
|
+
}
|
|
99
|
+
return pathImpl.join(metaDir, "packages");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const BUNFS_PACKAGE_ROOT = IS_COMPILED_BINARY ? __computeBunfsPackageRoot(import.meta.dir) : null;
|
|
103
|
+
|
|
104
|
+
function bunfsPath(...segments: string[]): string {
|
|
105
|
+
if (!BUNFS_PACKAGE_ROOT) {
|
|
106
|
+
throw new Error("bunfsPath is only valid in compiled-binary mode");
|
|
107
|
+
}
|
|
108
|
+
return path.join(BUNFS_PACKAGE_ROOT, ...segments);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const TYPEBOX_SHIM_PATH = BUNFS_PACKAGE_ROOT
|
|
112
|
+
? bunfsPath("coding-agent", "src", "extensibility", "typebox.js")
|
|
76
113
|
: path.resolve(import.meta.dir, "../typebox.ts");
|
|
77
114
|
|
|
78
115
|
// Legacy extensions historically imported `Type` (and `Static`/`TSchema`) from
|
|
@@ -83,8 +120,8 @@ const TYPEBOX_SHIM_PATH = IS_COMPILED_BINARY
|
|
|
83
120
|
// plus the borrowed `Type` runtime from the Zod-backed TypeBox shim. Subpath
|
|
84
121
|
// imports such as `@oh-my-pi/pi-ai/utils/oauth` continue to resolve directly
|
|
85
122
|
// against the bundled pi-ai package.
|
|
86
|
-
const LEGACY_PI_AI_SHIM_PATH =
|
|
87
|
-
?
|
|
123
|
+
const LEGACY_PI_AI_SHIM_PATH = BUNFS_PACKAGE_ROOT
|
|
124
|
+
? bunfsPath("coding-agent", "src", "extensibility", "legacy-pi-ai-shim.js")
|
|
88
125
|
: path.resolve(import.meta.dir, "../legacy-pi-ai-shim.ts");
|
|
89
126
|
|
|
90
127
|
// The coding-agent's own `./src/index.ts` cannot be listed as an extra
|
|
@@ -92,8 +129,8 @@ const LEGACY_PI_AI_SHIM_PATH = IS_COMPILED_BINARY
|
|
|
92
129
|
// startup (issue #1474 follow-up). Legacy `@(scope)/pi-coding-agent` root
|
|
93
130
|
// imports therefore resolve through a sibling shim whose distinct file path
|
|
94
131
|
// avoids that collision while re-exporting the canonical package surface.
|
|
95
|
-
const LEGACY_PI_CODING_AGENT_SHIM_PATH =
|
|
96
|
-
?
|
|
132
|
+
const LEGACY_PI_CODING_AGENT_SHIM_PATH = BUNFS_PACKAGE_ROOT
|
|
133
|
+
? bunfsPath("coding-agent", "src", "extensibility", "legacy-pi-coding-agent-shim.js")
|
|
97
134
|
: path.resolve(import.meta.dir, "../legacy-pi-coding-agent-shim.ts");
|
|
98
135
|
|
|
99
136
|
// Package-root overrides. Shim entries are always applied because they replace
|
|
@@ -106,12 +143,12 @@ const LEGACY_PI_CODING_AGENT_SHIM_PATH = IS_COMPILED_BINARY
|
|
|
106
143
|
const LEGACY_PI_PACKAGE_ROOT_OVERRIDES: Record<string, string> = {
|
|
107
144
|
[`${CANONICAL_PI_SCOPE}/pi-ai`]: LEGACY_PI_AI_SHIM_PATH,
|
|
108
145
|
[`${CANONICAL_PI_SCOPE}/pi-coding-agent`]: LEGACY_PI_CODING_AGENT_SHIM_PATH,
|
|
109
|
-
...(
|
|
146
|
+
...(BUNFS_PACKAGE_ROOT
|
|
110
147
|
? {
|
|
111
|
-
[`${CANONICAL_PI_SCOPE}/pi-agent-core`]:
|
|
112
|
-
[`${CANONICAL_PI_SCOPE}/pi-natives`]:
|
|
113
|
-
[`${CANONICAL_PI_SCOPE}/pi-tui`]:
|
|
114
|
-
[`${CANONICAL_PI_SCOPE}/pi-utils`]:
|
|
148
|
+
[`${CANONICAL_PI_SCOPE}/pi-agent-core`]: bunfsPath("agent", "src", "index.js"),
|
|
149
|
+
[`${CANONICAL_PI_SCOPE}/pi-natives`]: bunfsPath("natives", "native", "index.js"),
|
|
150
|
+
[`${CANONICAL_PI_SCOPE}/pi-tui`]: bunfsPath("tui", "src", "index.js"),
|
|
151
|
+
[`${CANONICAL_PI_SCOPE}/pi-utils`]: bunfsPath("utils", "src", "index.js"),
|
|
115
152
|
}
|
|
116
153
|
: {}),
|
|
117
154
|
};
|