@earendil-works/pi-coding-agent 0.86.1 → 0.87.0
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 +38 -0
- package/README.md +36 -0
- package/dist/bundle/chunks/{chunk-CMRUVXTE.js → chunk-4DKZACXI.js} +38 -32
- package/dist/bundle/chunks/chunk-GV2E3GBU.js +2 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{openai-completions-CYGM3XXP.js → openai-completions-XHML6MTL.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-MGTKWDID.js → virtual-modules-BNWPZYDH.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/file-processor.d.ts +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +1 -1
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +27 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +389 -119
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/cache-warmer.d.ts +1 -0
- package/dist/core/cache-warmer.d.ts.map +1 -1
- package/dist/core/cache-warmer.js +15 -1
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +3 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +146 -48
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/crash-log.d.ts +5 -0
- package/dist/core/crash-log.d.ts.map +1 -1
- package/dist/core/crash-log.js +68 -0
- package/dist/core/crash-log.js.map +1 -1
- package/dist/core/export-html/template.js +6 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +16 -3
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +110 -5
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +77 -6
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/model-config.d.ts +52 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +16 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +6 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +61 -35
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts +1 -0
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +19 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +6 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -4
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +36 -9
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +97 -7
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/tools/read.d.ts +4 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +5 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -3
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/bug-report.d.ts.map +1 -1
- package/dist/modes/interactive/bug-report.js +4 -0
- package/dist/modes/interactive/bug-report.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +7 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +64 -2
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/tool-result-images.d.ts +3 -1
- package/dist/utils/tool-result-images.d.ts.map +1 -1
- package/dist/utils/tool-result-images.js +4 -1
- package/dist/utils/tool-result-images.js.map +1 -1
- package/docs/compaction.md +23 -4
- package/docs/extensions.md +70 -6
- package/docs/models.md +29 -1
- package/docs/sdk.md +13 -2
- package/docs/session-format.md +15 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/plugins/pi-example-plugin/src/session.ts +3 -2
- package/npm-shrinkwrap.json +20 -20
- package/package.json +8 -8
- package/dist/bundle/chunks/chunk-HTEQD2HM.js +0 -2
|
@@ -16,12 +16,12 @@ import { parseSkillBlock } from "../../core/agent-session.js";
|
|
|
16
16
|
import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
|
|
17
17
|
import { CACHE_TTL_MS, collectCacheMisses, computeCacheWaste, detectCacheMiss, } from "../../core/cache-stats.js";
|
|
18
18
|
import { formatCacheWarmingStatus, formatCacheWarmingUsage } from "../../core/cache-warmer.js";
|
|
19
|
-
import { recordCrash, takeUnnotifiedCrash } from "../../core/crash-log.js";
|
|
19
|
+
import { findExtensionStackMatches, recordCrash, takeUnnotifiedCrash } from "../../core/crash-log.js";
|
|
20
20
|
import { DEFAULT_THINKING_LEVEL, THINKING_LEVEL_OPTIONS } from "../../core/defaults.js";
|
|
21
21
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
22
22
|
import { configureHttpDispatcher, formatHttpIdleTimeoutMs } from "../../core/http-dispatcher.js";
|
|
23
23
|
import { KeybindingsManager } from "../../core/keybindings.js";
|
|
24
|
-
import { createCompactionSummaryMessage } from "../../core/messages.js";
|
|
24
|
+
import { createCompactionSummaryMessage, createCustomMessage } from "../../core/messages.js";
|
|
25
25
|
import { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScopeFromModels, } from "../../core/model-resolver.js";
|
|
26
26
|
import { CredentialSynchronizationError } from "../../core/model-runtime.js";
|
|
27
27
|
import { DefaultPackageManager } from "../../core/package-manager.js";
|
|
@@ -121,6 +121,22 @@ function isDeadTerminalError(error) {
|
|
|
121
121
|
const code = error.code;
|
|
122
122
|
return code !== undefined && DEAD_TERMINAL_ERROR_CODES.has(code);
|
|
123
123
|
}
|
|
124
|
+
export function formatCrashExtensionHint(extensionMatches) {
|
|
125
|
+
const matches = Array.isArray(extensionMatches)
|
|
126
|
+
? extensionMatches.filter((match) => typeof match === "string" && match.length > 0)
|
|
127
|
+
: [];
|
|
128
|
+
if (matches.length === 0)
|
|
129
|
+
return undefined;
|
|
130
|
+
const quoted = matches.map((match) => `\`${match}\``);
|
|
131
|
+
const labels = quoted.length === 1
|
|
132
|
+
? quoted[0]
|
|
133
|
+
: quoted.length === 2
|
|
134
|
+
? quoted.join(" and ")
|
|
135
|
+
: `${quoted.slice(0, -1).join(", ")}, and ${quoted[quoted.length - 1]}`;
|
|
136
|
+
const noun = matches.length === 1 ? "extension" : "extensions";
|
|
137
|
+
const pronoun = matches.length === 1 ? "it" : "them";
|
|
138
|
+
return `A stack frame came from loaded ${noun} ${labels}, which may be involved. Try disabling ${pronoun} with \`${APP_NAME} config\`, or run \`${APP_NAME} -ne\` to confirm.`;
|
|
139
|
+
}
|
|
124
140
|
const ANTHROPIC_SUBSCRIPTION_AUTH_WARNING = "Anthropic subscription auth is active. Third-party harness usage draws from extra usage and is billed per token, not your Claude plan limits. Manage extra usage at https://claude.ai/settings/usage. Disable this warning in /settings.";
|
|
125
141
|
function isAnthropicSubscriptionAuthKey(apiKey) {
|
|
126
142
|
return typeof apiKey === "string" && apiKey.startsWith("sk-ant-oat");
|
|
@@ -243,6 +259,7 @@ export class InteractiveMode {
|
|
|
243
259
|
managedToolStatusStarted = false;
|
|
244
260
|
// Streaming message tracking
|
|
245
261
|
streamingComponent = undefined;
|
|
262
|
+
entriesRenderedByBoundaryCompaction = new Set();
|
|
246
263
|
streamingMessage = undefined;
|
|
247
264
|
// Tool execution tracking: toolCallId -> component
|
|
248
265
|
pendingTools = new Map();
|
|
@@ -1540,6 +1557,10 @@ export class InteractiveMode {
|
|
|
1540
1557
|
async handleFatalRuntimeError(prefix, error) {
|
|
1541
1558
|
const message = error instanceof Error ? error.message : String(error);
|
|
1542
1559
|
this.showError(`${prefix}: ${message}`);
|
|
1560
|
+
const extensionHint = this.getCrashExtensionHint(error);
|
|
1561
|
+
if (extensionHint) {
|
|
1562
|
+
this.chatContainer.addChild(new Text(theme.fg("warning", extensionHint), this.outputPad, 0));
|
|
1563
|
+
}
|
|
1543
1564
|
if (this.recordCrash("fatal_error", error)) {
|
|
1544
1565
|
this.chatContainer.addChild(new Text(theme.fg("muted", this.crashReportInstructions()), this.outputPad, 0));
|
|
1545
1566
|
}
|
|
@@ -1547,6 +1568,14 @@ export class InteractiveMode {
|
|
|
1547
1568
|
this.stop("transcript");
|
|
1548
1569
|
process.exit(1);
|
|
1549
1570
|
}
|
|
1571
|
+
getCrashExtensionHint(error) {
|
|
1572
|
+
try {
|
|
1573
|
+
return formatCrashExtensionHint(findExtensionStackMatches(error instanceof Error ? error.stack : undefined, this.session.resourceLoader.getExtensions().extensions));
|
|
1574
|
+
}
|
|
1575
|
+
catch {
|
|
1576
|
+
return undefined;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1550
1579
|
/** Persist a crash so the next start can point the user at `/bug`. Returns false when nothing was written. */
|
|
1551
1580
|
recordCrash(kind, error) {
|
|
1552
1581
|
try {
|
|
@@ -2644,6 +2673,8 @@ export class InteractiveMode {
|
|
|
2644
2673
|
this.ui.requestRender();
|
|
2645
2674
|
break;
|
|
2646
2675
|
case "entry_appended":
|
|
2676
|
+
if (this.entriesRenderedByBoundaryCompaction.delete(event.entry.id))
|
|
2677
|
+
break;
|
|
2647
2678
|
if (event.entry.type === "custom") {
|
|
2648
2679
|
this.addCustomEntryToChat(event.entry);
|
|
2649
2680
|
this.ui.requestRender();
|
|
@@ -2652,6 +2683,34 @@ export class InteractiveMode {
|
|
|
2652
2683
|
this.addCacheWarmingUsage(event.entry);
|
|
2653
2684
|
this.ui.requestRender();
|
|
2654
2685
|
}
|
|
2686
|
+
else if (event.entry.type === "custom_message" && event.entry.display) {
|
|
2687
|
+
this.addMessageToChat(createCustomMessage(event.entry.customType, event.entry.content, event.entry.display, event.entry.details, event.entry.timestamp));
|
|
2688
|
+
this.ui.requestRender();
|
|
2689
|
+
}
|
|
2690
|
+
else if (event.entry.type === "compaction") {
|
|
2691
|
+
const entries = this.sessionManager.buildContextEntries();
|
|
2692
|
+
if (entries[0]?.id !== event.entry.id)
|
|
2693
|
+
break;
|
|
2694
|
+
this.chatContainer.clear();
|
|
2695
|
+
const branch = this.sessionManager.getBranch();
|
|
2696
|
+
const compactionIndex = branch.findIndex((entry) => entry.id === event.entry.id);
|
|
2697
|
+
const entriesAfterCompaction = new Set(branch.slice(compactionIndex + 1).map((entry) => entry.id));
|
|
2698
|
+
const retainedEntries = entries.slice(1);
|
|
2699
|
+
this.renderSessionEntries(retainedEntries.filter((entry) => !entriesAfterCompaction.has(entry.id)));
|
|
2700
|
+
this.addMessageToChat(createCompactionSummaryMessage(event.entry.summary, event.entry.tokensBefore, event.entry.timestamp));
|
|
2701
|
+
if (event.entry.usage) {
|
|
2702
|
+
this.addCompactionCostNotice({
|
|
2703
|
+
type: "compaction_cost",
|
|
2704
|
+
kind: "compaction",
|
|
2705
|
+
usage: event.entry.usage,
|
|
2706
|
+
});
|
|
2707
|
+
}
|
|
2708
|
+
this.renderSessionEntries(retainedEntries.filter((entry) => entriesAfterCompaction.has(entry.id)));
|
|
2709
|
+
for (const entryId of entriesAfterCompaction)
|
|
2710
|
+
this.entriesRenderedByBoundaryCompaction.add(entryId);
|
|
2711
|
+
this.footer.invalidate();
|
|
2712
|
+
this.ui.requestRender();
|
|
2713
|
+
}
|
|
2655
2714
|
break;
|
|
2656
2715
|
case "session_info_changed":
|
|
2657
2716
|
this.updateTerminalTitle();
|
|
@@ -3374,6 +3433,9 @@ export class InteractiveMode {
|
|
|
3374
3433
|
catch { }
|
|
3375
3434
|
console.error(`${APP_NAME} exiting due to uncaughtException:`);
|
|
3376
3435
|
console.error(error);
|
|
3436
|
+
const extensionHint = this.getCrashExtensionHint(error);
|
|
3437
|
+
if (extensionHint)
|
|
3438
|
+
console.error(`\n${extensionHint}`);
|
|
3377
3439
|
if (this.recordCrash("uncaught_exception", error)) {
|
|
3378
3440
|
console.error(`\n${this.crashReportInstructions()}`);
|
|
3379
3441
|
}
|