@caupulican/pi-adaptative 0.81.5 → 0.81.7
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 +30 -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 +1 -0
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +10 -3
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/bash-execution-controller.d.ts +1 -1
- package/dist/core/bash-execution-controller.d.ts.map +1 -1
- package/dist/core/bash-execution-controller.js +9 -6
- package/dist/core/bash-execution-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/exec.d.ts.map +1 -1
- package/dist/core/exec.js +7 -2
- package/dist/core/exec.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/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +19 -5
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/failure-corpus.d.ts.map +1 -1
- package/dist/core/failure-corpus.js +1 -1
- package/dist/core/failure-corpus.js.map +1 -1
- package/dist/core/learning/reflection-engine.d.ts.map +1 -1
- package/dist/core/learning/reflection-engine.js +3 -1
- package/dist/core/learning/reflection-engine.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/scout-controller.d.ts +5 -0
- package/dist/core/scout-controller.d.ts.map +1 -1
- package/dist/core/scout-controller.js +4 -1
- package/dist/core/scout-controller.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/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/settings-manager.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 +1 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +14 -2
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.js +14 -6
- package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +11 -4
- package/dist/modes/interactive/components/session-selector.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 +107 -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/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +14 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/bug-ledger.md +45 -44
- 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
|
@@ -297,7 +297,12 @@ export class InteractiveMode {
|
|
|
297
297
|
widgetContainerBelow: this.widgetContainerBelow,
|
|
298
298
|
getEditor: () => this.editor,
|
|
299
299
|
setEditor: (editor) => {
|
|
300
|
+
const previousEditor = this.editor;
|
|
300
301
|
this.editor = editor;
|
|
302
|
+
if (previousEditor !== editor && previousEditor !== this.defaultEditor) {
|
|
303
|
+
const disposableEditor = previousEditor;
|
|
304
|
+
disposableEditor.dispose?.();
|
|
305
|
+
}
|
|
301
306
|
},
|
|
302
307
|
getBuiltInHeader: () => this.builtInHeader,
|
|
303
308
|
getAutocompleteProvider: () => this.autocompleteProvider,
|
|
@@ -485,9 +490,7 @@ export class InteractiveMode {
|
|
|
485
490
|
// Initialize extensions first so resources are shown before messages
|
|
486
491
|
await this.rebindCurrentSession();
|
|
487
492
|
// Register extensions-changed listener for live reload UI refresh
|
|
488
|
-
this.
|
|
489
|
-
this.refreshUIAfterExtensionsChanged();
|
|
490
|
-
});
|
|
493
|
+
this.subscribeToExtensionsChanged();
|
|
491
494
|
// Render initial messages AFTER showing loaded resources
|
|
492
495
|
await this.renderInitialMessages();
|
|
493
496
|
this.renderProjectTrustWarningIfNeeded();
|
|
@@ -954,10 +957,17 @@ export class InteractiveMode {
|
|
|
954
957
|
this.applyRuntimeSettings();
|
|
955
958
|
await this.bindCurrentSessionExtensions();
|
|
956
959
|
this.subscribeToAgent();
|
|
960
|
+
this.subscribeToExtensionsChanged();
|
|
957
961
|
await this.updateAvailableProviderCount();
|
|
958
962
|
this.updateEditorBorderColor();
|
|
959
963
|
this.updateTerminalTitle();
|
|
960
964
|
}
|
|
965
|
+
subscribeToExtensionsChanged() {
|
|
966
|
+
this.unsubscribeExtensionsChanged?.();
|
|
967
|
+
this.unsubscribeExtensionsChanged = this.session.onExtensionsChanged(() => {
|
|
968
|
+
this.refreshUIAfterExtensionsChanged();
|
|
969
|
+
});
|
|
970
|
+
}
|
|
961
971
|
async handleFatalRuntimeError(prefix, error) {
|
|
962
972
|
const message = error instanceof Error ? error.message : String(error);
|
|
963
973
|
this.showError(`${prefix}: ${message}`);
|
|
@@ -2053,107 +2063,113 @@ export class InteractiveMode {
|
|
|
2053
2063
|
* @param options.populateHistory Add user messages to editor history
|
|
2054
2064
|
*/
|
|
2055
2065
|
renderGeneration = 0;
|
|
2066
|
+
renderQueue;
|
|
2056
2067
|
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
|
-
if (tuiHistory.omittedMessages > 0) {
|
|
2080
|
-
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 });
|
|
2081
|
-
}
|
|
2082
|
-
for (const message of tuiHistory.messages) {
|
|
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;
|
|
2068
|
+
const run = async () => {
|
|
2069
|
+
// Build long history offscreen, then atomically swap it into the visible
|
|
2070
|
+
// chat container. This keeps the TUI responsive without flashing blank or
|
|
2071
|
+
// partial transcript frames during resume/reload/compaction rebuilds.
|
|
2072
|
+
this.renderGeneration = (this.renderGeneration ?? 0) + 1;
|
|
2073
|
+
const generation = this.renderGeneration;
|
|
2074
|
+
let processed = 0;
|
|
2075
|
+
let committed = false;
|
|
2076
|
+
const visibleChatContainer = this.chatContainer;
|
|
2077
|
+
const previousLiveHistoryHiddenNotice = this.liveHistoryHiddenNotice;
|
|
2078
|
+
const previousLiveHistoryHiddenComponents = this.liveHistoryHiddenComponents;
|
|
2079
|
+
const previousLastStatusSpacer = this.lastStatusSpacer;
|
|
2080
|
+
const previousLastStatusText = this.lastStatusText;
|
|
2081
|
+
const stagingChatContainer = new Container();
|
|
2082
|
+
this.chatContainer = stagingChatContainer;
|
|
2083
|
+
this.resetLiveTuiHistoryTrim();
|
|
2084
|
+
this.clearRenderedToolPanelState();
|
|
2085
|
+
const renderedPendingTools = new Map();
|
|
2086
|
+
try {
|
|
2087
|
+
if (options.updateFooter) {
|
|
2088
|
+
this.footer.invalidate();
|
|
2089
|
+
this.updateEditorBorderColor();
|
|
2087
2090
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2091
|
+
const tuiHistory = this.messagesForTuiHistoryReload(sessionContext.messages);
|
|
2092
|
+
if (tuiHistory.omittedMessages > 0) {
|
|
2093
|
+
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 });
|
|
2094
|
+
}
|
|
2095
|
+
for (const message of tuiHistory.messages) {
|
|
2096
|
+
if (processed > 0 && processed % TUI_HISTORY_RELOAD_CHUNK_SIZE === 0) {
|
|
2097
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
2098
|
+
if (generation !== this.renderGeneration)
|
|
2099
|
+
return;
|
|
2100
|
+
}
|
|
2101
|
+
processed++;
|
|
2102
|
+
// Assistant messages need special handling for tool calls
|
|
2103
|
+
if (message.role === "assistant") {
|
|
2104
|
+
this.addMessageToChat(message);
|
|
2105
|
+
// Render tool call components
|
|
2106
|
+
for (const content of message.content) {
|
|
2107
|
+
if (content.type === "toolCall") {
|
|
2108
|
+
const component = this.attachToolExecutionComponent(content.name, content.id, content.arguments);
|
|
2109
|
+
if (message.stopReason === "aborted" || message.stopReason === "error") {
|
|
2110
|
+
let errorMessage;
|
|
2111
|
+
if (message.stopReason === "aborted") {
|
|
2112
|
+
const retryAttempt = this.session.retryAttempt;
|
|
2113
|
+
errorMessage =
|
|
2114
|
+
retryAttempt > 0
|
|
2115
|
+
? `Aborted after ${retryAttempt} retry attempt${retryAttempt > 1 ? "s" : ""}`
|
|
2116
|
+
: "Operation aborted";
|
|
2117
|
+
}
|
|
2118
|
+
else {
|
|
2119
|
+
errorMessage = message.errorMessage || "Error";
|
|
2120
|
+
}
|
|
2121
|
+
component.updateResult({ content: [{ type: "text", text: errorMessage }], isError: true });
|
|
2122
|
+
this.toolPanels.finish(content.id);
|
|
2104
2123
|
}
|
|
2105
2124
|
else {
|
|
2106
|
-
|
|
2125
|
+
renderedPendingTools.set(content.id, component);
|
|
2107
2126
|
}
|
|
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
2127
|
}
|
|
2114
2128
|
}
|
|
2115
2129
|
}
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2130
|
+
else if (message.role === "toolResult") {
|
|
2131
|
+
// Match tool results to pending tool components
|
|
2132
|
+
const component = renderedPendingTools.get(message.toolCallId);
|
|
2133
|
+
if (component) {
|
|
2134
|
+
component.updateResult(message);
|
|
2135
|
+
renderedPendingTools.delete(message.toolCallId);
|
|
2136
|
+
this.toolPanels.finish(message.toolCallId);
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
else {
|
|
2140
|
+
// All other messages use standard rendering
|
|
2141
|
+
this.addMessageToChat(message, options);
|
|
2124
2142
|
}
|
|
2125
2143
|
}
|
|
2144
|
+
if (generation !== this.renderGeneration)
|
|
2145
|
+
return;
|
|
2146
|
+
visibleChatContainer.children = stagingChatContainer.children;
|
|
2147
|
+
committed = true;
|
|
2148
|
+
}
|
|
2149
|
+
finally {
|
|
2150
|
+
const stagedLiveHistoryHiddenNotice = this.liveHistoryHiddenNotice;
|
|
2151
|
+
const stagedLiveHistoryHiddenComponents = this.liveHistoryHiddenComponents;
|
|
2152
|
+
const stagedLastStatusSpacer = this.lastStatusSpacer;
|
|
2153
|
+
const stagedLastStatusText = this.lastStatusText;
|
|
2154
|
+
this.chatContainer = visibleChatContainer;
|
|
2155
|
+
if (committed) {
|
|
2156
|
+
this.liveHistoryHiddenNotice = stagedLiveHistoryHiddenNotice;
|
|
2157
|
+
this.liveHistoryHiddenComponents = stagedLiveHistoryHiddenComponents;
|
|
2158
|
+
this.lastStatusSpacer = stagedLastStatusSpacer;
|
|
2159
|
+
this.lastStatusText = stagedLastStatusText;
|
|
2160
|
+
}
|
|
2126
2161
|
else {
|
|
2127
|
-
|
|
2128
|
-
this.
|
|
2162
|
+
this.liveHistoryHiddenNotice = previousLiveHistoryHiddenNotice;
|
|
2163
|
+
this.liveHistoryHiddenComponents = previousLiveHistoryHiddenComponents;
|
|
2164
|
+
this.lastStatusSpacer = previousLastStatusSpacer;
|
|
2165
|
+
this.lastStatusText = previousLastStatusText;
|
|
2129
2166
|
}
|
|
2130
2167
|
}
|
|
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();
|
|
2168
|
+
if (committed)
|
|
2169
|
+
this.ui.requestRender();
|
|
2170
|
+
};
|
|
2171
|
+
this.renderQueue = (this.renderQueue ?? Promise.resolve()).then(run, run);
|
|
2172
|
+
return this.renderQueue;
|
|
2157
2173
|
}
|
|
2158
2174
|
async renderInitialMessages(options = {}) {
|
|
2159
2175
|
if (!options.forceHistoryLoad) {
|