- Stopped the core agent loop immediately after a tool batch finishes under an aborted signal.
- This prevents a tool-level abort result from continuing into
prepareNextTurn, steering queue polling, follow-up queue polling, or another provider request. - This closes the remaining abort path not covered by terminal assistant stream event normalization.
packages/agent/src/agent-loop.tspackages/agent/test/agent-loop.test.ts
- The decision to poll queued steering after tool execution happens inside the core loop before extensions can safely restore UI/editor queue state.
packages/agent/src/agent-loop.tsafterturn_endemission inrunLoop().
- Preserved the fork's ES2021 diagnostic compatibility while accepting upstream's result-based harness/environment refactor.
- Kept stream option patching on
Object.prototype.hasOwnProperty.callinstead ofObject.hasOwn. - Kept harness error
causecapture without relying on two-argumentErrorconstruction.
packages/agent/src/harness/agent-harness.tspackages/agent/src/harness/types.ts
- These are exported harness primitives and internal option-merging helpers that are evaluated before coding-agent extensions can participate.
packages/agent/src/harness/agent-harness.tsaroundapplyStreamOptionsPatch().packages/agent/src/harness/types.tsaround harness error constructors.
- Added optional
detailsmetadata to the harnessCompactionSummaryMessagetype. - This keeps the shared agent-core message augmentation compatible with coding-agent compaction summaries that carry provider-native compaction route details for TUI rendering and replay.
packages/agent/src/harness/messages.ts
- This is exported type metadata in the shared harness message model. Extensions can populate compaction details, but they
cannot alter the core
CustomAgentMessagesdeclaration merge.
- LOW:
packages/agent/src/harness/messages.tsaroundCompactionSummaryMessage.
- Normalized terminal assistant stream messages in
agent-loop.tsso the event-levelreasonis authoritative fordone/errorevents. - This prevents an abort event with a stale assistant
stopReasonfrom being treated as a normal stop and draining queued steering/follow-up messages after the user interrupted the run.
packages/agent/src/agent-loop.tspackages/agent/test/agent.test.ts
- The stale-stopReason decision happens inside the core agent loop before extensions see a completed turn.
- Extensions can observe abort events after the fact, but they cannot prevent the loop from deciding to continue into queued messages.
packages/agent/src/agent-loop.tsaround terminaldone/errorstream handling.
- Updated
executeToolCallsParallel()to finalize prepared tool calls concurrently after sequential preflight. - This lets
tool_execution_endandtoolResultmessage events appear as soon as each tool finishes instead of waiting behind an earlier slow tool. - The returned
toolResultsarray still stays in assistant source order, which preserves next-turn context ordering and matches existing semantic expectations.
packages/agent/src/agent-loop.tspackages/agent/src/types.tspackages/agent/README.mdpackages/agent/test/agent-loop.test.ts
- The scheduling and final result collection logic lives in
@mariozechner/pi-agent-core, specificallyexecuteToolCallsParallel(). - Coding-agent extensions can observe and mutate tool inputs/results, but they cannot replace the agent loop's internal await/collection strategy or
toolExecutionscheduling behavior. - The existing builtin
parallel-tool-callsextension only changes provider payloads (parallel_tool_calls: true) and does not control runtime result finalization.
packages/agent/src/agent-loop.tsaroundexecuteToolCallsParallel()packages/agent/src/types.tstool execution mode docspackages/agent/README.mdtool execution behavior description
- Replaced upstream harness imports of
uuid/v7with a local UUIDv7 generator backed by Node'scrypto.randomBytes. - This keeps clean package-manager builds working without adding a new direct
uuiddependency to@earendil-works/pi-agent-core.
packages/agent/src/harness/session/repo/shared.tspackages/agent/src/harness/session/storage/memory.ts
- The failing imports live inside the agent harness session storage implementation and run before any coding-agent extension can intercept them.
packages/agent/src/harness/session/repo/shared.tsaround session id creation.packages/agent/src/harness/session/storage/memory.tsaround default metadata initialization.
- Replaced
ErrorOptions/two-argumentErrorconstruction inFileErrorwith an equivalent local{ cause }option stored on the class. - Replaced
Object.hasOwnwithObject.prototype.hasOwnProperty.callin the stream option patch helper. - This keeps the upstream harness behavior intact while avoiding diagnostics in environments that type-check the package with ES2021 library declarations.
packages/agent/src/harness/types.tspackages/agent/src/harness/agent-harness.ts
- These are type-level compatibility fixes in exported harness primitives and internal option-merging code that run before coding-agent extensions are involved.
packages/agent/src/harness/types.tsaroundFileErrorconstruction.packages/agent/src/harness/agent-harness.tsaroundhasOwn().