@caupulican/pi-adaptative 0.81.4 → 0.81.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 +15 -0
- package/dist/core/agent-session.d.ts +8 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +125 -66
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +3 -0
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/billing-failover-controller.d.ts +2 -2
- package/dist/core/billing-failover-controller.d.ts.map +1 -1
- package/dist/core/billing-failover-controller.js +2 -8
- package/dist/core/billing-failover-controller.js.map +1 -1
- package/dist/core/compaction-support.d.ts +3 -0
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js +18 -4
- package/dist/core/compaction-support.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +1 -0
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +12 -0
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +33 -9
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/models/local-registration.d.ts +1 -0
- package/dist/core/models/local-registration.d.ts.map +1 -1
- package/dist/core/models/local-registration.js +3 -2
- package/dist/core/models/local-registration.js.map +1 -1
- package/dist/core/research/model-fitness.d.ts +16 -0
- package/dist/core/research/model-fitness.d.ts.map +1 -1
- package/dist/core/research/model-fitness.js +74 -1
- package/dist/core/research/model-fitness.js.map +1 -1
- package/dist/core/session-tree-navigator.d.ts.map +1 -1
- package/dist/core/session-tree-navigator.js +1 -0
- package/dist/core/session-tree-navigator.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +6 -3
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +7 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +2 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +102 -91
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-flow-commands.js +10 -7
- package/dist/modes/interactive/session-flow-commands.js.map +1 -1
- package/docs/bug-ledger.md +24 -21
- 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/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/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -485,9 +485,7 @@ export class InteractiveMode {
|
|
|
485
485
|
// Initialize extensions first so resources are shown before messages
|
|
486
486
|
await this.rebindCurrentSession();
|
|
487
487
|
// Register extensions-changed listener for live reload UI refresh
|
|
488
|
-
this.
|
|
489
|
-
this.refreshUIAfterExtensionsChanged();
|
|
490
|
-
});
|
|
488
|
+
this.subscribeToExtensionsChanged();
|
|
491
489
|
// Render initial messages AFTER showing loaded resources
|
|
492
490
|
await this.renderInitialMessages();
|
|
493
491
|
this.renderProjectTrustWarningIfNeeded();
|
|
@@ -954,10 +952,17 @@ export class InteractiveMode {
|
|
|
954
952
|
this.applyRuntimeSettings();
|
|
955
953
|
await this.bindCurrentSessionExtensions();
|
|
956
954
|
this.subscribeToAgent();
|
|
955
|
+
this.subscribeToExtensionsChanged();
|
|
957
956
|
await this.updateAvailableProviderCount();
|
|
958
957
|
this.updateEditorBorderColor();
|
|
959
958
|
this.updateTerminalTitle();
|
|
960
959
|
}
|
|
960
|
+
subscribeToExtensionsChanged() {
|
|
961
|
+
this.unsubscribeExtensionsChanged?.();
|
|
962
|
+
this.unsubscribeExtensionsChanged = this.session.onExtensionsChanged(() => {
|
|
963
|
+
this.refreshUIAfterExtensionsChanged();
|
|
964
|
+
});
|
|
965
|
+
}
|
|
961
966
|
async handleFatalRuntimeError(prefix, error) {
|
|
962
967
|
const message = error instanceof Error ? error.message : String(error);
|
|
963
968
|
this.showError(`${prefix}: ${message}`);
|
|
@@ -2053,107 +2058,113 @@ export class InteractiveMode {
|
|
|
2053
2058
|
* @param options.populateHistory Add user messages to editor history
|
|
2054
2059
|
*/
|
|
2055
2060
|
renderGeneration = 0;
|
|
2061
|
+
renderQueue;
|
|
2056
2062
|
async renderSessionContext(sessionContext, options = {}) {
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
if (processed > 0 && processed % TUI_HISTORY_RELOAD_CHUNK_SIZE === 0) {
|
|
2084
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
2085
|
-
if (generation !== this.renderGeneration)
|
|
2086
|
-
return;
|
|
2063
|
+
const run = async () => {
|
|
2064
|
+
// Build long history offscreen, then atomically swap it into the visible
|
|
2065
|
+
// chat container. This keeps the TUI responsive without flashing blank or
|
|
2066
|
+
// partial transcript frames during resume/reload/compaction rebuilds.
|
|
2067
|
+
this.renderGeneration = (this.renderGeneration ?? 0) + 1;
|
|
2068
|
+
const generation = this.renderGeneration;
|
|
2069
|
+
let processed = 0;
|
|
2070
|
+
let committed = false;
|
|
2071
|
+
const visibleChatContainer = this.chatContainer;
|
|
2072
|
+
const previousLiveHistoryHiddenNotice = this.liveHistoryHiddenNotice;
|
|
2073
|
+
const previousLiveHistoryHiddenComponents = this.liveHistoryHiddenComponents;
|
|
2074
|
+
const previousLastStatusSpacer = this.lastStatusSpacer;
|
|
2075
|
+
const previousLastStatusText = this.lastStatusText;
|
|
2076
|
+
const stagingChatContainer = new Container();
|
|
2077
|
+
this.chatContainer = stagingChatContainer;
|
|
2078
|
+
this.resetLiveTuiHistoryTrim();
|
|
2079
|
+
this.clearRenderedToolPanelState();
|
|
2080
|
+
const renderedPendingTools = new Map();
|
|
2081
|
+
try {
|
|
2082
|
+
if (options.updateFooter) {
|
|
2083
|
+
this.footer.invalidate();
|
|
2084
|
+
this.updateEditorBorderColor();
|
|
2085
|
+
}
|
|
2086
|
+
const tuiHistory = this.messagesForTuiHistoryReload(sessionContext.messages);
|
|
2087
|
+
if (tuiHistory.omittedMessages > 0) {
|
|
2088
|
+
this.appendStatusToChat(`Showing last ~${historyReloadMath.TUI_HISTORY_RELOAD_MAX_LINES} TUI history lines; omitted ${tuiHistory.omittedMessages} older message${tuiHistory.omittedMessages === 1 ? "" : "s"}. Full session remains available to the model.`, { requestRender: false });
|
|
2087
2089
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2090
|
+
for (const message of tuiHistory.messages) {
|
|
2091
|
+
if (processed > 0 && processed % TUI_HISTORY_RELOAD_CHUNK_SIZE === 0) {
|
|
2092
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
2093
|
+
if (generation !== this.renderGeneration)
|
|
2094
|
+
return;
|
|
2095
|
+
}
|
|
2096
|
+
processed++;
|
|
2097
|
+
// Assistant messages need special handling for tool calls
|
|
2098
|
+
if (message.role === "assistant") {
|
|
2099
|
+
this.addMessageToChat(message);
|
|
2100
|
+
// Render tool call components
|
|
2101
|
+
for (const content of message.content) {
|
|
2102
|
+
if (content.type === "toolCall") {
|
|
2103
|
+
const component = this.attachToolExecutionComponent(content.name, content.id, content.arguments);
|
|
2104
|
+
if (message.stopReason === "aborted" || message.stopReason === "error") {
|
|
2105
|
+
let errorMessage;
|
|
2106
|
+
if (message.stopReason === "aborted") {
|
|
2107
|
+
const retryAttempt = this.session.retryAttempt;
|
|
2108
|
+
errorMessage =
|
|
2109
|
+
retryAttempt > 0
|
|
2110
|
+
? `Aborted after ${retryAttempt} retry attempt${retryAttempt > 1 ? "s" : ""}`
|
|
2111
|
+
: "Operation aborted";
|
|
2112
|
+
}
|
|
2113
|
+
else {
|
|
2114
|
+
errorMessage = message.errorMessage || "Error";
|
|
2115
|
+
}
|
|
2116
|
+
component.updateResult({ content: [{ type: "text", text: errorMessage }], isError: true });
|
|
2117
|
+
this.toolPanels.finish(content.id);
|
|
2104
2118
|
}
|
|
2105
2119
|
else {
|
|
2106
|
-
|
|
2120
|
+
renderedPendingTools.set(content.id, component);
|
|
2107
2121
|
}
|
|
2108
|
-
component.updateResult({ content: [{ type: "text", text: errorMessage }], isError: true });
|
|
2109
|
-
this.toolPanels.finish(content.id);
|
|
2110
|
-
}
|
|
2111
|
-
else {
|
|
2112
|
-
renderedPendingTools.set(content.id, component);
|
|
2113
2122
|
}
|
|
2114
2123
|
}
|
|
2115
2124
|
}
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2125
|
+
else if (message.role === "toolResult") {
|
|
2126
|
+
// Match tool results to pending tool components
|
|
2127
|
+
const component = renderedPendingTools.get(message.toolCallId);
|
|
2128
|
+
if (component) {
|
|
2129
|
+
component.updateResult(message);
|
|
2130
|
+
renderedPendingTools.delete(message.toolCallId);
|
|
2131
|
+
this.toolPanels.finish(message.toolCallId);
|
|
2132
|
+
}
|
|
2124
2133
|
}
|
|
2134
|
+
else {
|
|
2135
|
+
// All other messages use standard rendering
|
|
2136
|
+
this.addMessageToChat(message, options);
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
if (generation !== this.renderGeneration)
|
|
2140
|
+
return;
|
|
2141
|
+
visibleChatContainer.children = stagingChatContainer.children;
|
|
2142
|
+
committed = true;
|
|
2143
|
+
}
|
|
2144
|
+
finally {
|
|
2145
|
+
const stagedLiveHistoryHiddenNotice = this.liveHistoryHiddenNotice;
|
|
2146
|
+
const stagedLiveHistoryHiddenComponents = this.liveHistoryHiddenComponents;
|
|
2147
|
+
const stagedLastStatusSpacer = this.lastStatusSpacer;
|
|
2148
|
+
const stagedLastStatusText = this.lastStatusText;
|
|
2149
|
+
this.chatContainer = visibleChatContainer;
|
|
2150
|
+
if (committed) {
|
|
2151
|
+
this.liveHistoryHiddenNotice = stagedLiveHistoryHiddenNotice;
|
|
2152
|
+
this.liveHistoryHiddenComponents = stagedLiveHistoryHiddenComponents;
|
|
2153
|
+
this.lastStatusSpacer = stagedLastStatusSpacer;
|
|
2154
|
+
this.lastStatusText = stagedLastStatusText;
|
|
2125
2155
|
}
|
|
2126
2156
|
else {
|
|
2127
|
-
|
|
2128
|
-
this.
|
|
2157
|
+
this.liveHistoryHiddenNotice = previousLiveHistoryHiddenNotice;
|
|
2158
|
+
this.liveHistoryHiddenComponents = previousLiveHistoryHiddenComponents;
|
|
2159
|
+
this.lastStatusSpacer = previousLastStatusSpacer;
|
|
2160
|
+
this.lastStatusText = previousLastStatusText;
|
|
2129
2161
|
}
|
|
2130
2162
|
}
|
|
2131
|
-
if (
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
finally {
|
|
2137
|
-
const stagedLiveHistoryHiddenNotice = this.liveHistoryHiddenNotice;
|
|
2138
|
-
const stagedLiveHistoryHiddenComponents = this.liveHistoryHiddenComponents;
|
|
2139
|
-
const stagedLastStatusSpacer = this.lastStatusSpacer;
|
|
2140
|
-
const stagedLastStatusText = this.lastStatusText;
|
|
2141
|
-
this.chatContainer = visibleChatContainer;
|
|
2142
|
-
if (committed) {
|
|
2143
|
-
this.liveHistoryHiddenNotice = stagedLiveHistoryHiddenNotice;
|
|
2144
|
-
this.liveHistoryHiddenComponents = stagedLiveHistoryHiddenComponents;
|
|
2145
|
-
this.lastStatusSpacer = stagedLastStatusSpacer;
|
|
2146
|
-
this.lastStatusText = stagedLastStatusText;
|
|
2147
|
-
}
|
|
2148
|
-
else {
|
|
2149
|
-
this.liveHistoryHiddenNotice = previousLiveHistoryHiddenNotice;
|
|
2150
|
-
this.liveHistoryHiddenComponents = previousLiveHistoryHiddenComponents;
|
|
2151
|
-
this.lastStatusSpacer = previousLastStatusSpacer;
|
|
2152
|
-
this.lastStatusText = previousLastStatusText;
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
if (committed)
|
|
2156
|
-
this.ui.requestRender();
|
|
2163
|
+
if (committed)
|
|
2164
|
+
this.ui.requestRender();
|
|
2165
|
+
};
|
|
2166
|
+
this.renderQueue = (this.renderQueue ?? Promise.resolve()).then(run, run);
|
|
2167
|
+
return this.renderQueue;
|
|
2157
2168
|
}
|
|
2158
2169
|
async renderInitialMessages(options = {}) {
|
|
2159
2170
|
if (!options.forceHistoryLoad) {
|