@astralyn/pi 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 +28 -0
- package/dist/bundle/chunks/chunk-INDBRWNK.js +2 -0
- package/dist/bundle/chunks/{chunk-GTBMYBFG.js → chunk-RKLIHRPH.js} +39 -33
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{openai-completions-6SMWQWQN.js → openai-completions-JZCEEJ43.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-OHUZ2T7X.js → virtual-modules-CG7NJ5WO.js} +1 -1
- package/dist/bundle/cli.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.js +1 -1
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +31 -4
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +395 -126
- 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/extensions/btw/agent.d.ts.map +1 -1
- package/dist/extensions/btw/agent.js +8 -5
- package/dist/extensions/btw/agent.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.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 +72 -8
- package/docs/models.md +30 -1
- package/docs/sdk.md +14 -3
- package/docs/session-format.md +25 -4
- package/examples/plugins/pi-example-plugin/src/session.ts +3 -2
- package/npm-shrinkwrap.json +43 -43
- package/package.json +8 -8
- package/dist/bundle/chunks/chunk-DAEM5JIZ.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";
|
|
@@ -119,6 +119,22 @@ function isDeadTerminalError(error) {
|
|
|
119
119
|
const code = error.code;
|
|
120
120
|
return code !== undefined && DEAD_TERMINAL_ERROR_CODES.has(code);
|
|
121
121
|
}
|
|
122
|
+
export function formatCrashExtensionHint(extensionMatches) {
|
|
123
|
+
const matches = Array.isArray(extensionMatches)
|
|
124
|
+
? extensionMatches.filter((match) => typeof match === "string" && match.length > 0)
|
|
125
|
+
: [];
|
|
126
|
+
if (matches.length === 0)
|
|
127
|
+
return undefined;
|
|
128
|
+
const quoted = matches.map((match) => `\`${match}\``);
|
|
129
|
+
const labels = quoted.length === 1
|
|
130
|
+
? quoted[0]
|
|
131
|
+
: quoted.length === 2
|
|
132
|
+
? quoted.join(" and ")
|
|
133
|
+
: `${quoted.slice(0, -1).join(", ")}, and ${quoted[quoted.length - 1]}`;
|
|
134
|
+
const noun = matches.length === 1 ? "extension" : "extensions";
|
|
135
|
+
const pronoun = matches.length === 1 ? "it" : "them";
|
|
136
|
+
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.`;
|
|
137
|
+
}
|
|
122
138
|
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.";
|
|
123
139
|
function isAnthropicSubscriptionAuthKey(apiKey) {
|
|
124
140
|
return typeof apiKey === "string" && apiKey.startsWith("sk-ant-oat");
|
|
@@ -233,6 +249,7 @@ export class InteractiveMode {
|
|
|
233
249
|
this.managedToolStatusStarted = false;
|
|
234
250
|
// Streaming message tracking
|
|
235
251
|
this.streamingComponent = undefined;
|
|
252
|
+
this.entriesRenderedByBoundaryCompaction = new Set();
|
|
236
253
|
this.streamingMessage = undefined;
|
|
237
254
|
// Tool execution tracking: toolCallId -> component
|
|
238
255
|
this.pendingTools = new Map();
|
|
@@ -1507,6 +1524,10 @@ export class InteractiveMode {
|
|
|
1507
1524
|
async handleFatalRuntimeError(prefix, error) {
|
|
1508
1525
|
const message = error instanceof Error ? error.message : String(error);
|
|
1509
1526
|
this.showError(`${prefix}: ${message}`);
|
|
1527
|
+
const extensionHint = this.getCrashExtensionHint(error);
|
|
1528
|
+
if (extensionHint) {
|
|
1529
|
+
this.chatContainer.addChild(new Text(theme.fg("warning", extensionHint), this.outputPad, 0));
|
|
1530
|
+
}
|
|
1510
1531
|
if (this.recordCrash("fatal_error", error)) {
|
|
1511
1532
|
this.chatContainer.addChild(new Text(theme.fg("muted", this.crashReportInstructions()), this.outputPad, 0));
|
|
1512
1533
|
}
|
|
@@ -1514,6 +1535,14 @@ export class InteractiveMode {
|
|
|
1514
1535
|
this.stop("transcript");
|
|
1515
1536
|
process.exit(1);
|
|
1516
1537
|
}
|
|
1538
|
+
getCrashExtensionHint(error) {
|
|
1539
|
+
try {
|
|
1540
|
+
return formatCrashExtensionHint(findExtensionStackMatches(error instanceof Error ? error.stack : undefined, this.session.resourceLoader.getExtensions().extensions));
|
|
1541
|
+
}
|
|
1542
|
+
catch {
|
|
1543
|
+
return undefined;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1517
1546
|
/** Persist a crash so the next start can point the user at `/bug`. Returns false when nothing was written. */
|
|
1518
1547
|
recordCrash(kind, error) {
|
|
1519
1548
|
try {
|
|
@@ -2706,6 +2735,8 @@ export class InteractiveMode {
|
|
|
2706
2735
|
this.ui.requestRender();
|
|
2707
2736
|
break;
|
|
2708
2737
|
case "entry_appended":
|
|
2738
|
+
if (this.entriesRenderedByBoundaryCompaction.delete(event.entry.id))
|
|
2739
|
+
break;
|
|
2709
2740
|
if (event.entry.type === "custom") {
|
|
2710
2741
|
this.addCustomEntryToChat(event.entry);
|
|
2711
2742
|
this.ui.requestRender();
|
|
@@ -2714,6 +2745,34 @@ export class InteractiveMode {
|
|
|
2714
2745
|
this.addCacheWarmingUsage(event.entry);
|
|
2715
2746
|
this.ui.requestRender();
|
|
2716
2747
|
}
|
|
2748
|
+
else if (event.entry.type === "custom_message" && event.entry.display) {
|
|
2749
|
+
this.addMessageToChat(createCustomMessage(event.entry.customType, event.entry.content, event.entry.display, event.entry.details, event.entry.timestamp));
|
|
2750
|
+
this.ui.requestRender();
|
|
2751
|
+
}
|
|
2752
|
+
else if (event.entry.type === "compaction") {
|
|
2753
|
+
const entries = this.sessionManager.buildContextEntries();
|
|
2754
|
+
if (entries[0]?.id !== event.entry.id)
|
|
2755
|
+
break;
|
|
2756
|
+
this.chatContainer.clear();
|
|
2757
|
+
const branch = this.sessionManager.getBranch();
|
|
2758
|
+
const compactionIndex = branch.findIndex((entry) => entry.id === event.entry.id);
|
|
2759
|
+
const entriesAfterCompaction = new Set(branch.slice(compactionIndex + 1).map((entry) => entry.id));
|
|
2760
|
+
const retainedEntries = entries.slice(1);
|
|
2761
|
+
this.renderSessionEntries(retainedEntries.filter((entry) => !entriesAfterCompaction.has(entry.id)));
|
|
2762
|
+
this.addMessageToChat(createCompactionSummaryMessage(event.entry.summary, event.entry.tokensBefore, event.entry.timestamp));
|
|
2763
|
+
if (event.entry.usage) {
|
|
2764
|
+
this.addCompactionCostNotice({
|
|
2765
|
+
type: "compaction_cost",
|
|
2766
|
+
kind: "compaction",
|
|
2767
|
+
usage: event.entry.usage,
|
|
2768
|
+
});
|
|
2769
|
+
}
|
|
2770
|
+
this.renderSessionEntries(retainedEntries.filter((entry) => entriesAfterCompaction.has(entry.id)));
|
|
2771
|
+
for (const entryId of entriesAfterCompaction)
|
|
2772
|
+
this.entriesRenderedByBoundaryCompaction.add(entryId);
|
|
2773
|
+
this.footer.invalidate();
|
|
2774
|
+
this.ui.requestRender();
|
|
2775
|
+
}
|
|
2717
2776
|
break;
|
|
2718
2777
|
case "session_info_changed":
|
|
2719
2778
|
this.updateTerminalTitle();
|
|
@@ -3419,6 +3478,9 @@ export class InteractiveMode {
|
|
|
3419
3478
|
catch { }
|
|
3420
3479
|
console.error(`${APP_NAME} exiting due to uncaughtException:`);
|
|
3421
3480
|
console.error(error);
|
|
3481
|
+
const extensionHint = this.getCrashExtensionHint(error);
|
|
3482
|
+
if (extensionHint)
|
|
3483
|
+
console.error(`\n${extensionHint}`);
|
|
3422
3484
|
if (this.recordCrash("uncaught_exception", error)) {
|
|
3423
3485
|
console.error(`\n${this.crashReportInstructions()}`);
|
|
3424
3486
|
}
|