@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed tool-call preflight to stop preparing sibling tool calls after the run is aborted ([#4276](https://github.com/earendil-works/pi/issues/4276)).
|
||||||
- Fixed tail truncation for oversized single-line output that ends with a trailing newline ([#4715](https://github.com/earendil-works/pi/issues/4715)).
|
- Fixed tail truncation for oversized single-line output that ends with a trailing newline ([#4715](https://github.com/earendil-works/pi/issues/4715)).
|
||||||
- Fixed Windows Node execution environment command spawns to hide helper console windows from background processes ([#4699](https://github.com/earendil-works/pi/issues/4699)).
|
- Fixed Windows Node execution environment command spawns to hide helper console windows from background processes ([#4699](https://github.com/earendil-works/pi/issues/4699)).
|
||||||
|
|
||||||
|
|||||||
@@ -436,6 +436,10 @@ async function executeToolCallsSequential(
|
|||||||
await emitToolResultMessage(toolResultMessage, emit);
|
await emitToolResultMessage(toolResultMessage, emit);
|
||||||
finalizedCalls.push(finalized);
|
finalizedCalls.push(finalized);
|
||||||
messages.push(toolResultMessage);
|
messages.push(toolResultMessage);
|
||||||
|
|
||||||
|
if (signal?.aborted) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -471,6 +475,9 @@ async function executeToolCallsParallel(
|
|||||||
} satisfies FinalizedToolCallOutcome;
|
} satisfies FinalizedToolCallOutcome;
|
||||||
await emitToolExecutionEnd(finalized, emit);
|
await emitToolExecutionEnd(finalized, emit);
|
||||||
finalizedCalls.push(finalized);
|
finalizedCalls.push(finalized);
|
||||||
|
if (signal?.aborted) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,6 +494,9 @@ async function executeToolCallsParallel(
|
|||||||
await emitToolExecutionEnd(finalized, emit);
|
await emitToolExecutionEnd(finalized, emit);
|
||||||
return finalized;
|
return finalized;
|
||||||
});
|
});
|
||||||
|
if (signal?.aborted) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const orderedFinalizedCalls = await Promise.all(
|
const orderedFinalizedCalls = await Promise.all(
|
||||||
@@ -578,6 +588,13 @@ async function prepareToolCall(
|
|||||||
},
|
},
|
||||||
signal,
|
signal,
|
||||||
);
|
);
|
||||||
|
if (signal?.aborted) {
|
||||||
|
return {
|
||||||
|
kind: "immediate",
|
||||||
|
result: createErrorToolResult("Operation aborted"),
|
||||||
|
isError: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
if (beforeResult?.block) {
|
if (beforeResult?.block) {
|
||||||
return {
|
return {
|
||||||
kind: "immediate",
|
kind: "immediate",
|
||||||
@@ -586,6 +603,13 @@ async function prepareToolCall(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (signal?.aborted) {
|
||||||
|
return {
|
||||||
|
kind: "immediate",
|
||||||
|
result: createErrorToolResult("Operation aborted"),
|
||||||
|
isError: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
kind: "prepared",
|
kind: "prepared",
|
||||||
toolCall,
|
toolCall,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed extension `ctx.abort()` during tool-call preflight to stop later confirmations and restore queued interactive input like Escape ([#4276](https://github.com/earendil-works/pi/issues/4276)).
|
||||||
- Fixed AgentSession retry, compaction, and event settlement to use the awaited agent lifecycle instead of a separate event queue, and added `willRetry` to `agent_end` session events.
|
- Fixed AgentSession retry, compaction, and event settlement to use the awaited agent lifecycle instead of a separate event queue, and added `willRetry` to `agent_end` session events.
|
||||||
- Fixed the subagent extension's parallel mode to return useful per-task output and failed-task diagnostics to the parent model instead of 100-character previews ([#4710](https://github.com/earendil-works/pi/issues/4710)).
|
- Fixed the subagent extension's parallel mode to return useful per-task output and failed-task diagnostics to the parent model instead of 100-character previews ([#4710](https://github.com/earendil-works/pi/issues/4710)).
|
||||||
- Fixed Windows local bash execution to hide helper console windows when launched from background SDK processes ([#4699](https://github.com/earendil-works/pi/issues/4699)).
|
- Fixed Windows local bash execution to hide helper console windows when launched from background SDK processes ([#4699](https://github.com/earendil-works/pi/issues/4699)).
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ export interface AgentSessionConfig {
|
|||||||
export interface ExtensionBindings {
|
export interface ExtensionBindings {
|
||||||
uiContext?: ExtensionUIContext;
|
uiContext?: ExtensionUIContext;
|
||||||
commandContextActions?: ExtensionCommandContextActions;
|
commandContextActions?: ExtensionCommandContextActions;
|
||||||
|
abortHandler?: () => void;
|
||||||
shutdownHandler?: ShutdownHandler;
|
shutdownHandler?: ShutdownHandler;
|
||||||
onError?: ExtensionErrorListener;
|
onError?: ExtensionErrorListener;
|
||||||
}
|
}
|
||||||
@@ -296,6 +297,7 @@ export class AgentSession {
|
|||||||
private _sessionStartEvent: SessionStartEvent;
|
private _sessionStartEvent: SessionStartEvent;
|
||||||
private _extensionUIContext?: ExtensionUIContext;
|
private _extensionUIContext?: ExtensionUIContext;
|
||||||
private _extensionCommandContextActions?: ExtensionCommandContextActions;
|
private _extensionCommandContextActions?: ExtensionCommandContextActions;
|
||||||
|
private _extensionAbortHandler?: () => void;
|
||||||
private _extensionShutdownHandler?: ShutdownHandler;
|
private _extensionShutdownHandler?: ShutdownHandler;
|
||||||
private _extensionErrorListener?: ExtensionErrorListener;
|
private _extensionErrorListener?: ExtensionErrorListener;
|
||||||
private _extensionErrorUnsubscriber?: () => void;
|
private _extensionErrorUnsubscriber?: () => void;
|
||||||
@@ -2042,6 +2044,9 @@ export class AgentSession {
|
|||||||
if (bindings.commandContextActions !== undefined) {
|
if (bindings.commandContextActions !== undefined) {
|
||||||
this._extensionCommandContextActions = bindings.commandContextActions;
|
this._extensionCommandContextActions = bindings.commandContextActions;
|
||||||
}
|
}
|
||||||
|
if (bindings.abortHandler !== undefined) {
|
||||||
|
this._extensionAbortHandler = bindings.abortHandler;
|
||||||
|
}
|
||||||
if (bindings.shutdownHandler !== undefined) {
|
if (bindings.shutdownHandler !== undefined) {
|
||||||
this._extensionShutdownHandler = bindings.shutdownHandler;
|
this._extensionShutdownHandler = bindings.shutdownHandler;
|
||||||
}
|
}
|
||||||
@@ -2206,7 +2211,13 @@ export class AgentSession {
|
|||||||
getModel: () => this.model,
|
getModel: () => this.model,
|
||||||
isIdle: () => !this.isStreaming,
|
isIdle: () => !this.isStreaming,
|
||||||
getSignal: () => this.agent.signal,
|
getSignal: () => this.agent.signal,
|
||||||
abort: () => this.abort(),
|
abort: () => {
|
||||||
|
if (this._extensionAbortHandler) {
|
||||||
|
this._extensionAbortHandler();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void this.abort();
|
||||||
|
},
|
||||||
hasPendingMessages: () => this.pendingMessageCount > 0,
|
hasPendingMessages: () => this.pendingMessageCount > 0,
|
||||||
shutdown: () => {
|
shutdown: () => {
|
||||||
this._extensionShutdownHandler?.();
|
this._extensionShutdownHandler?.();
|
||||||
|
|||||||
@@ -1478,6 +1478,9 @@ export class InteractiveMode {
|
|||||||
const uiContext = this.createExtensionUIContext();
|
const uiContext = this.createExtensionUIContext();
|
||||||
await this.session.bindExtensions({
|
await this.session.bindExtensions({
|
||||||
uiContext,
|
uiContext,
|
||||||
|
abortHandler: () => {
|
||||||
|
this.restoreQueuedMessagesToEditor({ abort: true });
|
||||||
|
},
|
||||||
commandContextActions: {
|
commandContextActions: {
|
||||||
waitForIdle: () => this.session.agent.waitForIdle(),
|
waitForIdle: () => this.session.agent.waitForIdle(),
|
||||||
newSession: async (options) => {
|
newSession: async (options) => {
|
||||||
@@ -1627,7 +1630,9 @@ export class InteractiveMode {
|
|||||||
model: this.session.model,
|
model: this.session.model,
|
||||||
isIdle: () => !this.session.isStreaming,
|
isIdle: () => !this.session.isStreaming,
|
||||||
signal: this.session.agent.signal,
|
signal: this.session.agent.signal,
|
||||||
abort: () => this.session.abort(),
|
abort: () => {
|
||||||
|
this.restoreQueuedMessagesToEditor({ abort: true });
|
||||||
|
},
|
||||||
hasPendingMessages: () => this.session.pendingMessageCount > 0,
|
hasPendingMessages: () => this.session.pendingMessageCount > 0,
|
||||||
shutdown: () => {
|
shutdown: () => {
|
||||||
this.shutdownRequested = true;
|
this.shutdownRequested = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user