@gajae-code/agent-core 0.1.1
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 +482 -0
- package/README.md +473 -0
- package/dist/types/agent-loop.d.ts +55 -0
- package/dist/types/agent.d.ts +334 -0
- package/dist/types/append-only-context.d.ts +113 -0
- package/dist/types/compaction/branch-summarization.d.ts +94 -0
- package/dist/types/compaction/compaction.d.ts +166 -0
- package/dist/types/compaction/entries.d.ts +103 -0
- package/dist/types/compaction/errors.d.ts +26 -0
- package/dist/types/compaction/index.d.ts +11 -0
- package/dist/types/compaction/messages.d.ts +61 -0
- package/dist/types/compaction/openai.d.ts +58 -0
- package/dist/types/compaction/pruning.d.ts +18 -0
- package/dist/types/compaction/utils.d.ts +32 -0
- package/dist/types/compaction.d.ts +1 -0
- package/dist/types/harmony-leak.d.ts +99 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/proxy.d.ts +84 -0
- package/dist/types/run-collector.d.ts +196 -0
- package/dist/types/telemetry.d.ts +588 -0
- package/dist/types/thinking.d.ts +17 -0
- package/dist/types/types.d.ts +407 -0
- package/package.json +75 -0
- package/src/agent-loop.ts +1279 -0
- package/src/agent.ts +1399 -0
- package/src/append-only-context.ts +297 -0
- package/src/compaction/branch-summarization.ts +339 -0
- package/src/compaction/compaction.ts +1065 -0
- package/src/compaction/entries.ts +133 -0
- package/src/compaction/errors.ts +31 -0
- package/src/compaction/index.ts +12 -0
- package/src/compaction/messages.ts +212 -0
- package/src/compaction/openai.ts +552 -0
- package/src/compaction/prompts/auto-handoff-threshold-focus.md +1 -0
- package/src/compaction/prompts/branch-summary-context.md +5 -0
- package/src/compaction/prompts/branch-summary-preamble.md +2 -0
- package/src/compaction/prompts/branch-summary.md +30 -0
- package/src/compaction/prompts/compaction-short-summary.md +9 -0
- package/src/compaction/prompts/compaction-summary-context.md +5 -0
- package/src/compaction/prompts/compaction-summary.md +38 -0
- package/src/compaction/prompts/compaction-turn-prefix.md +17 -0
- package/src/compaction/prompts/compaction-update-summary.md +45 -0
- package/src/compaction/prompts/file-operations.md +10 -0
- package/src/compaction/prompts/handoff-document.md +49 -0
- package/src/compaction/prompts/summarization-system.md +3 -0
- package/src/compaction/pruning.ts +92 -0
- package/src/compaction/utils.ts +185 -0
- package/src/compaction.ts +1 -0
- package/src/harmony-leak.ts +427 -0
- package/src/index.ts +19 -0
- package/src/proxy.ts +326 -0
- package/src/run-collector.ts +631 -0
- package/src/telemetry.ts +2018 -0
- package/src/thinking.ts +19 -0
- package/src/types.ts +467 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.1.1] - 2026-05-28
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added `Agent.forceAbort()` so hosts can recover from provider/tool aborts that ignore cooperative cancellation without clearing conversation history.
|
|
10
|
+
|
|
11
|
+
## [15.3.0] - 2026-05-25
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Fixed `transformContext` receiving the loop config object as the `signal` argument instead of the actual `AbortSignal`, so hooks that check `signal.aborted` or call `signal.addEventListener` now work correctly under abort/timeout conditions
|
|
15
|
+
- Fixed `appendOnlyContext` not being re-evaluated after `setModel()` — the mode was decided once at session construction based on the initial model's provider, so switching from/to DeepSeek (or changing `provider.appendOnlyContext`) mid-session produced incorrect mode behavior
|
|
16
|
+
|
|
17
|
+
## [15.2.3] - 2026-05-22
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Added `onBeforeYield` hook support so user code can run right before the agent loop checks for follow-up messages
|
|
21
|
+
|
|
22
|
+
## [15.1.3] - 2026-05-17
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Added optional `telemetry` support to `generateSummary`, `generateHandoff`, `generateBranchSummary`, and `compact` options so compaction, handoff, and branch summary one-shot LLM calls can emit OpenTelemetry chat telemetry when enabled
|
|
26
|
+
- Added shared oneshot telemetry instrumentation for compaction, handoff, and branch summary calls, tagging spans with `pi.gen_ai.oneshot.kind` values such as `compaction_summary`, `compaction_short_summary`, `compaction_turn_prefix`, `handoff`, and `branch_summary`
|
|
27
|
+
|
|
28
|
+
## [15.1.2] - 2026-05-15
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- Added `responseHeaders` to `ChatUsageEvent` and `ManualChatTelemetryOptions` so telemetry hooks receive captured lowercase upstream response headers for each chat span
|
|
32
|
+
- Added automatic gateway/proxy detection from response headers (`litellm`, `helicone`, `portkey`, `openrouter`) and stamped `pi.gen_ai.gateway.*` span attributes for detected routing metadata
|
|
33
|
+
- Added exported `detectGatewayFromHeaders` API for header-based gateway detection
|
|
34
|
+
|
|
35
|
+
## [15.1.0] - 2026-05-15
|
|
36
|
+
### Breaking Changes
|
|
37
|
+
|
|
38
|
+
- Removed the `@gajae-code/agent-core/compaction/handoff` exports from the package surface, including `extractHandoffDocument`, `createHandoffContext`, and `createHandoffFileName`
|
|
39
|
+
- Removed legacy telemetry constants from the public enum surface (including `AGGREGATE_ATTR`, `GenAIAttr.System`, and old `gen_ai.*` extension keys such as `gen_ai.request.service_tier`/cost/tool status/handoff fields) and replaced them with `OpenAIAttr`, `PiGenAIAttr`, and `PiGenAIAggregateAttr`
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- Added `generateHandoff(messages, model, apiKey, options)` to `@gajae-code/agent-core/compaction` to generate a handoff document by calling the model directly, using live system/tool context and optional metadata
|
|
44
|
+
- Added generation filtering so the returned handoff document now includes only text content blocks from the model output
|
|
45
|
+
- Added support for defining `AgentTool` schemas with Zod, with legacy TypeBox schemas still supported when generating tool schemas for model calls
|
|
46
|
+
- Added `OpenAIAttr`, `PiGenAIAttr`, and `PiGenAIAggregateAttr` exports so consumers can reference the new `openai.*` and `pi.gen_ai.*` telemetry attribute keys directly
|
|
47
|
+
- Added `onChatUsage` to `AgentTelemetryConfig`, an always-fired hook receiving a `ChatUsageEvent` for every chat step that produced usage. The event carries the chat `span`, `agent`, `conversationId`, `stepNumber`, `model`, `provider`, `serviceTier`, `usage`, optional `cost`, and resolved dynamic `attributes` — independent of whether a `costEstimator` is configured.
|
|
48
|
+
- Added `agentLoopDetailed(...)` and `agentLoopContinueDetailed(...)` helpers that return the same event stream plus a `detailed()` result with run `telemetry` and `coverage`
|
|
49
|
+
- Added `onRunEnd` to `AgentTelemetryConfig` to receive `AgentRunSummary` and `AgentRunCoverage` at the end of each invocation
|
|
50
|
+
- Added run-level telemetry and coverage types/helpers (for example `AgentRunSummary`, `AgentRunCoverage`, `aggregateAgentRunSummaries`, and `aggregateAgentRunCoverage`) to package exports
|
|
51
|
+
- Added generic telemetry extension hooks for dynamic span attributes, provider/agent-name normalization, per-step cost deltas, warning callbacks, bounded summary content capture, and manual chat telemetry for non-loop model calls.
|
|
52
|
+
- Added opt-in OpenTelemetry instrumentation on the agent loop. Pass `telemetry: {}` (or a richer `AgentTelemetryConfig`) on `AgentLoopConfig` / `AgentOptions` / `createAgentSession({ telemetry })` to emit GenAI-semantic-convention spans plus `pi.gen_ai.*` extension attributes:
|
|
53
|
+
- `invoke_agent {agent.name}` wraps each `agentLoop` invocation with `gen_ai.operation.name=invoke_agent`, agent identity, conversation id, and `pi.gen_ai.agent.step.count`.
|
|
54
|
+
- `chat {model}` per provider call, parented under `invoke_agent`, with OTEL request/response/usage attributes (`gen_ai.request.{model,stream,temperature,top_p,top_k,max_tokens,presence_penalty,stop_sequences}`, `gen_ai.response.{model,id,finish_reasons,time_to_first_chunk}`, `gen_ai.usage.{input_tokens,output_tokens,cache_read.input_tokens,cache_creation.input_tokens,reasoning.output_tokens}`) and project extensions for reasoning effort, tool choice, available tools, usage totals, and cost.
|
|
55
|
+
- `execute_tool {tool.name}` per tool call, parented under `invoke_agent`, with `gen_ai.tool.{name,call.id,description,type}` plus the active context so user/MCP/provider spans created inside `tool.execute()` attach as children.
|
|
56
|
+
- One-shot `handoff` span available via the public `recordHandoff(...)` helper for agent-to-agent transitions.
|
|
57
|
+
- Added `AgentTelemetryConfig` hooks (`onSpanStart`, `onSpanEnd`, `costEstimator`), `agent` identity, `attributes` envelope merged onto every span, `captureMessageContent` toggle (defaults to the `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` env var) emitting OTEL-shaped `gen_ai.input.messages` / `gen_ai.output.messages` / `gen_ai.system_instructions` / `gen_ai.tool.call.arguments` / `gen_ai.tool.call.result`, and tracer/tracerName override surfaces.
|
|
58
|
+
- Added `Agent#setTelemetry(config)` so consumers can swap or disable instrumentation between invocations.
|
|
59
|
+
- Added `@opentelemetry/api` as a runtime dependency; SDK setup (exporters, samplers, processors) remains the host's responsibility per standard OTEL conventions. When no SDK is registered, helpers fall through to no-op spans with zero overhead.
|
|
60
|
+
- Added compaction APIs under `@gajae-code/agent-core/compaction`, including context compaction, branch summarization, handoff prompt/context helpers, pruning, token budgeting, prompt templates, and OpenAI `/responses/compact` helpers.
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
|
|
64
|
+
- Changed handoff document generation to force `toolChoice: "none"` when calling the model so tool invocation is disabled during generation
|
|
65
|
+
- Changed `chat` spans to emit normalized provider identifiers in `gen_ai.provider.name` via OTEL-style values (for example `google` to `gcp.gemini`) instead of the legacy `gen_ai.system` label
|
|
66
|
+
- Changed service-tier telemetry to emit `openai.request.service_tier`/`openai.response.service_tier` only when supported by provider via `shouldSendServiceTier`, rather than always using `gen_ai.request.service_tier`
|
|
67
|
+
- Changed captured message payloads so full capture now records OTEL-structured message parts with `pi.gen_ai.request.messages`, `pi.gen_ai.system_instructions`, and `gen_ai.output.messages` including assistant `finish_reason`
|
|
68
|
+
- Changed the `agent_end` event payload to include optional `telemetry` and `coverage` fields when telemetry is enabled, while keeping the legacy payload shape when disabled
|
|
69
|
+
- Changed `invoke_agent` spans to include aggregate `pi.gen_ai.agent.*` attributes for chat/tool counts, latency, usage, cost, errors, and tool coverage
|
|
70
|
+
|
|
71
|
+
### Fixed
|
|
72
|
+
|
|
73
|
+
- Fixed intent-field injection for tool schemas defined with Zod by converting them to wire schema before mutation
|
|
74
|
+
- Fixed token accounting in `ChatUsageEvent` and usage summaries so `inputTokens` and `totalTokens` now include cached read/write input tokens
|
|
75
|
+
- Fixed `execute_tool` span attributes so `pi.gen_ai.tool.status` and `error.type` now reflect run-level tool outcomes (`ok`, `error`, `skipped`, `blocked`, `timeout`, `aborted`) instead of mapping all non-ok cases the same way
|
|
76
|
+
- Fixed `onRunEnd` callbacks to be safe and idempotent by invoking them once per run and swallowing thrown callback errors so they cannot fail or duplicate successful runs
|
|
77
|
+
- Fixed run telemetry to count interrupted, blocked, or otherwise skipped tool calls so run coverage and tool counters now include those paths
|
|
78
|
+
- Fixed chat failure handling so failed chat steps are still represented in run summaries when provider streaming throws before yielding an assistant message
|
|
79
|
+
- Fixed double-counting of interrupted tool calls in run summaries: the `runTool` early-return on a queued steering interrupt now defers to the post-batch tail sweep so each call is recorded exactly once
|
|
80
|
+
- Fixed `coverage.toolsInvoked` and run-summary tool counters under-reporting tool calls embedded in an aborted/errored assistant message — those calls now record a collector orphan with status `aborted` or `error`
|
|
81
|
+
- Fixed `AgentRunSummary.usage.inputTokens` so it now includes `cache_read` and `cache_write` input tokens, matching `ChatUsageEvent.inputTokens`
|
|
82
|
+
- Fixed span lifecycle hooks (`onSpanStart`, `onSpanEnd`) so a thrown user callback is caught and surfaced via `onTelemetryWarning` (`on_span_start_failed` / `on_span_end_failed`) instead of leaking and aborting the surrounding span
|
|
83
|
+
- Fixed unbounded recursion in summary content capture when a captured value contains a cyclic or deeply nested array — array recursion now respects the same depth cap as plain-object recursion and replaces back-references with `"[Circular]"`
|
|
84
|
+
|
|
85
|
+
## [15.0.1] - 2026-05-14
|
|
86
|
+
### Breaking Changes
|
|
87
|
+
|
|
88
|
+
- Raised the minimum required Bun version from >=1.3.7 to >=1.3.14
|
|
89
|
+
|
|
90
|
+
## [14.9.5] - 2026-05-12
|
|
91
|
+
|
|
92
|
+
### Added
|
|
93
|
+
|
|
94
|
+
- Added an `isError?: boolean` field on `AgentToolResult` so tools can flag a non-throwing failure (e.g. an aggregator that catches per-entry errors). `coerceToolResult` preserves the flag and the agent loop surfaces it as a tool error on the wire.
|
|
95
|
+
|
|
96
|
+
## [14.9.3] - 2026-05-10
|
|
97
|
+
### Added
|
|
98
|
+
|
|
99
|
+
- Added `onHarmonyLeak` option on `Agent`/loop config to receive GPT-5 Harmony leak audit callbacks
|
|
100
|
+
- Added harmony-leak detection and audit exports to the package index for programmatic leak detection and recovery hooks
|
|
101
|
+
|
|
102
|
+
### Changed
|
|
103
|
+
|
|
104
|
+
- Changed OpenAI code provider model runs to detect GPT-5 Harmony protocol leakage during streaming and automatically retry or recover tool calls instead of sending contaminated arguments downstream
|
|
105
|
+
|
|
106
|
+
### Security
|
|
107
|
+
|
|
108
|
+
- Hardened tool-call handling against leaked `to=functions.*` protocol tails by truncating or retrying before execution
|
|
109
|
+
- Hardened failure handling so repeated GPT-5 Harmony leak mitigation is retried only up to two times before escalating to an explicit error
|
|
110
|
+
|
|
111
|
+
## [14.9.0] - 2026-05-10
|
|
112
|
+
### Added
|
|
113
|
+
|
|
114
|
+
- Added `Agent#metadata` field forwarded to every API request; callers can set arbitrary provider metadata (e.g. `metadata.user_id`) once and have it applied to all subsequent stream calls without modifying per-call options
|
|
115
|
+
- Added `Agent#setMetadataResolver(fn)` for installing a function that resolves request metadata at call time. The `metadata` getter dispatches through the resolver on every read (including the snapshot taken per `prompt()`), so callers reflect mutable external state (e.g. live OAuth account UUID after a token refresh) without manual re-syncs. Plain `agent.metadata = …` continues to set a static value and clears any installed resolver.
|
|
116
|
+
|
|
117
|
+
### Added
|
|
118
|
+
|
|
119
|
+
- Added an `onSseEvent` agent option and loop config forwarding path for raw provider SSE diagnostics.
|
|
120
|
+
|
|
121
|
+
## [14.7.6] - 2026-05-07
|
|
122
|
+
|
|
123
|
+
### Added
|
|
124
|
+
|
|
125
|
+
- Added `hideThinkingSummary` option/getter/setter on `Agent` and `AgentLoopConfig`. Forwarded to the underlying stream call so providers can omit reasoning/thinking summaries on demand.
|
|
126
|
+
## [14.7.2] - 2026-05-06
|
|
127
|
+
### Added
|
|
128
|
+
|
|
129
|
+
- Added `loadMode` option to `AgentTool` to mark built-in tools as `essential` for initial loading or `discoverable` for search activation
|
|
130
|
+
- Added optional `summary` field to `AgentTool` definitions for one-line text used in tool discovery indexes
|
|
131
|
+
|
|
132
|
+
## [14.7.0] - 2026-05-04
|
|
133
|
+
### Breaking Changes
|
|
134
|
+
|
|
135
|
+
- Changed `Agent` API types so `systemPrompt` is now a list of prompt strings, requiring callers to pass and update system prompts via string arrays
|
|
136
|
+
|
|
137
|
+
### Changed
|
|
138
|
+
|
|
139
|
+
- Removed automatic project-context injection into each model call from loop logic
|
|
140
|
+
|
|
141
|
+
### Removed
|
|
142
|
+
|
|
143
|
+
- Removed the `projectPrompt` field from agent state/context and the `setProjectPrompt` mutator
|
|
144
|
+
|
|
145
|
+
## [14.6.2] - 2026-05-03
|
|
146
|
+
|
|
147
|
+
### Fixed
|
|
148
|
+
|
|
149
|
+
- Fixed unhandled promise rejection when `getApiKey` or any other async error occurs during `streamAssistantResponse`: agent loop IIFEs now catch and route errors through `EventStream.fail()`, which terminates the `for await` loop and lets `Agent#runLoop`'s catch block create a proper error assistant message instead of crashing
|
|
150
|
+
|
|
151
|
+
## [14.6.0] - 2026-05-02
|
|
152
|
+
### Fixed
|
|
153
|
+
|
|
154
|
+
- Fixed request cancellation before provider events by emitting an aborted assistant message and ending the stream with `stopReason: "aborted"`
|
|
155
|
+
|
|
156
|
+
## [14.5.10] - 2026-04-30
|
|
157
|
+
|
|
158
|
+
### Added
|
|
159
|
+
|
|
160
|
+
- Added an `onResponse` stream option for observing provider response metadata after response headers arrive.
|
|
161
|
+
|
|
162
|
+
## [14.2.0] - 2026-04-23
|
|
163
|
+
|
|
164
|
+
### Changed
|
|
165
|
+
|
|
166
|
+
- Changed tool dispatch to match model-returned tool calls by either internal tool name or custom wire name, enabling custom OpenAI tool names such as `apply_patch`.
|
|
167
|
+
|
|
168
|
+
## [14.0.1] - 2026-04-08
|
|
169
|
+
### Added
|
|
170
|
+
|
|
171
|
+
- Added `onAssistantMessageEvent` callback option to inspect assistant streaming events before they are emitted, enabling abort decisions before buffered events continue flowing
|
|
172
|
+
- Added `setAssistantMessageEventInterceptor()` method to dynamically set or update the assistant message event interceptor
|
|
173
|
+
|
|
174
|
+
## [13.13.0] - 2026-03-18
|
|
175
|
+
|
|
176
|
+
### Added
|
|
177
|
+
|
|
178
|
+
- Added `startup.checkUpdate` setting, set to `true` by default, can be disabled to skip the update check on agent initialization
|
|
179
|
+
|
|
180
|
+
## [13.12.7] - 2026-03-16
|
|
181
|
+
|
|
182
|
+
### Added
|
|
183
|
+
|
|
184
|
+
- Added overload for `prompt()` method accepting a string input with optional options parameter
|
|
185
|
+
|
|
186
|
+
### Fixed
|
|
187
|
+
|
|
188
|
+
- Fixed stale forced toolChoice being passed to provider after tools are refreshed mid-turn
|
|
189
|
+
|
|
190
|
+
## [13.9.16] - 2026-03-10
|
|
191
|
+
### Added
|
|
192
|
+
|
|
193
|
+
- Added `onPayload` option to `AgentOptions` to inspect or replace provider payloads before they are sent
|
|
194
|
+
|
|
195
|
+
## [13.9.3] - 2026-03-07
|
|
196
|
+
|
|
197
|
+
### Added
|
|
198
|
+
|
|
199
|
+
- Exported `ThinkingLevel` selector constants and types for configuring agent reasoning behavior
|
|
200
|
+
- Added `inherit` thinking level option to defer reasoning configuration to higher-level selectors
|
|
201
|
+
- Added `serviceTier` option to configure service tier for agent requests
|
|
202
|
+
|
|
203
|
+
### Changed
|
|
204
|
+
|
|
205
|
+
- Changed `thinkingLevel` from required string to optional `Effort` type, allowing undefined state
|
|
206
|
+
- Updated `setThinkingLevel()` method to accept `Effort | undefined` instead of `ThinkingLevel` string
|
|
207
|
+
|
|
208
|
+
## [13.4.0] - 2026-03-01
|
|
209
|
+
### Added
|
|
210
|
+
|
|
211
|
+
- Added `getToolChoice` option to dynamically override tool choice per LLM call
|
|
212
|
+
|
|
213
|
+
## [13.3.8] - 2026-02-28
|
|
214
|
+
### Changed
|
|
215
|
+
|
|
216
|
+
- Changed intent field name from `agent__intent` to `_i` in tool schemas
|
|
217
|
+
|
|
218
|
+
### Fixed
|
|
219
|
+
|
|
220
|
+
- Fixed synthetic tool result text formatting so aborted/error tool results no longer emit `Tool execution was aborted.: Request was aborted` style punctuation.
|
|
221
|
+
## [13.3.7] - 2026-02-27
|
|
222
|
+
### Added
|
|
223
|
+
|
|
224
|
+
- Added `lenientArgValidation` option to tools to allow graceful handling of argument validation errors by passing raw arguments to execute() instead of returning an error to the LLM
|
|
225
|
+
|
|
226
|
+
## [13.3.1] - 2026-02-26
|
|
227
|
+
### Added
|
|
228
|
+
|
|
229
|
+
- Added `topP`, `topK`, `minP`, `presencePenalty`, and `repetitionPenalty` options to `AgentOptions` for fine-grained sampling control
|
|
230
|
+
- Added getter and setter properties for sampling parameters on the `Agent` class to allow runtime configuration
|
|
231
|
+
|
|
232
|
+
## [13.1.0] - 2026-02-23
|
|
233
|
+
|
|
234
|
+
### Changed
|
|
235
|
+
|
|
236
|
+
- Removed per-tool `agent__intent` field description from injected schema to reduce token usage; intent format is now documented once in the system prompt instead of repeated in every tool definition
|
|
237
|
+
## [12.19.0] - 2026-02-22
|
|
238
|
+
### Changed
|
|
239
|
+
|
|
240
|
+
- Updated tool result messages to include error details when tool execution fails
|
|
241
|
+
|
|
242
|
+
## [12.14.0] - 2026-02-19
|
|
243
|
+
|
|
244
|
+
### Added
|
|
245
|
+
|
|
246
|
+
- Added `intentTracing` option to enable intent goal extraction from tool calls, allowing models to specify high-level goals via a required `_intent` field that is automatically injected into tool schemas and stripped from arguments before execution
|
|
247
|
+
|
|
248
|
+
## [12.11.0] - 2026-02-19
|
|
249
|
+
|
|
250
|
+
### Added
|
|
251
|
+
|
|
252
|
+
- Exported `AgentBusyError` exception class for handling concurrent agent operations
|
|
253
|
+
|
|
254
|
+
### Changed
|
|
255
|
+
|
|
256
|
+
- Agent now throws `AgentBusyError` instead of generic `Error` when attempting concurrent operations
|
|
257
|
+
|
|
258
|
+
## [12.8.0] - 2026-02-16
|
|
259
|
+
|
|
260
|
+
### Added
|
|
261
|
+
|
|
262
|
+
- Added `transformToolCallArguments` option to `AgentOptions` and `AgentLoopConfig` for transforming tool call arguments before execution (e.g. secret deobfuscation)
|
|
263
|
+
|
|
264
|
+
## [12.2.0] - 2026-02-13
|
|
265
|
+
|
|
266
|
+
### Added
|
|
267
|
+
|
|
268
|
+
- Added `providerSessionState` option to share provider state map for session-scoped transport and session caches
|
|
269
|
+
- Added `preferWebsockets` option to hint that websocket transport should be preferred when supported by the provider implementation
|
|
270
|
+
|
|
271
|
+
## [11.10.0] - 2026-02-10
|
|
272
|
+
|
|
273
|
+
### Added
|
|
274
|
+
|
|
275
|
+
- Added `temperature` option to `AgentOptions` to control LLM sampling temperature
|
|
276
|
+
- Added `temperature` getter and setter to `Agent` class for runtime configuration
|
|
277
|
+
|
|
278
|
+
## [11.6.0] - 2026-02-07
|
|
279
|
+
|
|
280
|
+
### Added
|
|
281
|
+
|
|
282
|
+
- Added `hasQueuedMessages()` method to check for pending steering/follow-up messages
|
|
283
|
+
- Resume queued steering and follow-up messages from `continue()` after auto-compaction
|
|
284
|
+
|
|
285
|
+
### Changed
|
|
286
|
+
|
|
287
|
+
- Extracted `dequeueSteeringMessages()` and `dequeueFollowUpMessages()` from inline config callbacks
|
|
288
|
+
- Added `skipInitialSteeringPoll` option to `_runLoop()` for correct queue resume ordering
|
|
289
|
+
|
|
290
|
+
## [11.3.0] - 2026-02-06
|
|
291
|
+
|
|
292
|
+
### Added
|
|
293
|
+
|
|
294
|
+
- Added `maxRetryDelayMs` option to AgentOptions to cap server-requested retry delays, allowing higher-level retry logic to handle long waits with user visibility
|
|
295
|
+
|
|
296
|
+
### Changed
|
|
297
|
+
|
|
298
|
+
- Updated ThinkingLevel documentation to include support for gpt-5.3 and gpt-5.3-openai-code models with 'xhigh' thinking level
|
|
299
|
+
|
|
300
|
+
## [11.2.0] - 2026-02-05
|
|
301
|
+
|
|
302
|
+
### Fixed
|
|
303
|
+
|
|
304
|
+
- Fixed handling of aborted requests to properly throw abort errors when stream terminates without a terminal event
|
|
305
|
+
|
|
306
|
+
## [10.5.0] - 2026-02-04
|
|
307
|
+
|
|
308
|
+
### Added
|
|
309
|
+
|
|
310
|
+
- Added `concurrency` option to `AgentTool` to control tool scheduling: "shared" (default, runs in parallel) or "exclusive" (runs alone)
|
|
311
|
+
- Implemented parallel execution of shared tools within a single agent turn for improved performance
|
|
312
|
+
|
|
313
|
+
### Changed
|
|
314
|
+
|
|
315
|
+
- Refactored tool execution to support concurrent scheduling with proper interrupt handling and steering message checks
|
|
316
|
+
|
|
317
|
+
## [9.2.2] - 2026-01-31
|
|
318
|
+
|
|
319
|
+
### Added
|
|
320
|
+
|
|
321
|
+
- Added toolChoice option to AgentPromptOptions for controlling tool selection
|
|
322
|
+
|
|
323
|
+
## [8.2.0] - 2026-01-24
|
|
324
|
+
|
|
325
|
+
### Changed
|
|
326
|
+
|
|
327
|
+
- Updated TypeScript configuration for better publish-time configuration handling with tsconfig.publish.json
|
|
328
|
+
|
|
329
|
+
## [8.0.0] - 2026-01-23
|
|
330
|
+
|
|
331
|
+
### Added
|
|
332
|
+
|
|
333
|
+
- Added `nonAbortable` option to tools to ignore abort signals during execution
|
|
334
|
+
|
|
335
|
+
## [6.8.0] - 2026-01-20
|
|
336
|
+
|
|
337
|
+
### Changed
|
|
338
|
+
|
|
339
|
+
- Updated proxy stream processing to use utility function for reading lines
|
|
340
|
+
|
|
341
|
+
## [6.2.0] - 2026-01-19
|
|
342
|
+
|
|
343
|
+
### Added
|
|
344
|
+
|
|
345
|
+
- Enhanced getToolContext to receive tool call batch information including batchId, index, total count, and tool call details
|
|
346
|
+
|
|
347
|
+
## [5.6.7] - 2026-01-18
|
|
348
|
+
|
|
349
|
+
### Fixed
|
|
350
|
+
|
|
351
|
+
- Added proper tool result messages for tool calls that are aborted or error out
|
|
352
|
+
- Ensured tool_use/tool_result pairing is maintained when tool execution fails
|
|
353
|
+
|
|
354
|
+
## [4.6.0] - 2026-01-12
|
|
355
|
+
|
|
356
|
+
### Changed
|
|
357
|
+
|
|
358
|
+
- Modified assistant message handling to split messages around tool results for improved readability when using Cursor tools
|
|
359
|
+
|
|
360
|
+
### Fixed
|
|
361
|
+
|
|
362
|
+
- Fixed tool result ordering in Cursor mode by buffering results and emitting them at the correct position within assistant messages
|
|
363
|
+
|
|
364
|
+
## [4.3.0] - 2026-01-11
|
|
365
|
+
|
|
366
|
+
### Added
|
|
367
|
+
|
|
368
|
+
- Added `cursorExecHandlers` and `cursorOnToolResult` options for local tool execution with cursor-based streaming
|
|
369
|
+
- Added `emitExternalEvent` method to allow external event injection into the agent state
|
|
370
|
+
|
|
371
|
+
## [4.0.0] - 2026-01-10
|
|
372
|
+
|
|
373
|
+
### Added
|
|
374
|
+
|
|
375
|
+
- Added `popLastSteer()` and `popLastFollowUp()` methods to remove and return the last queued message (LIFO) for dequeue operations
|
|
376
|
+
- `thinkingBudgets` option on `Agent` and `AgentOptions` to customize token budgets per thinking level
|
|
377
|
+
- `sessionId` option on `Agent` to forward session identifiers to LLM providers for session-based caching
|
|
378
|
+
|
|
379
|
+
### Fixed
|
|
380
|
+
|
|
381
|
+
- `minimal` thinking level now maps to `minimal` reasoning effort instead of being treated as `low`
|
|
382
|
+
|
|
383
|
+
## [3.33.0] - 2026-01-08
|
|
384
|
+
|
|
385
|
+
### Fixed
|
|
386
|
+
|
|
387
|
+
- Ensured aborted assistant responses always include an error message for callers.
|
|
388
|
+
- Filtered thinking blocks from Cerebras request context to keep multi-turn prompts compatible.
|
|
389
|
+
|
|
390
|
+
## [3.21.0] - 2026-01-06
|
|
391
|
+
|
|
392
|
+
### Changed
|
|
393
|
+
|
|
394
|
+
- Switched from local `@gajae-code/ai` to upstream `@gajae-code/ai` package
|
|
395
|
+
|
|
396
|
+
### Added
|
|
397
|
+
|
|
398
|
+
- Added `sessionId` option for provider caching (e.g., OpenAI code provider session-based prompt caching)
|
|
399
|
+
- Added `sessionId` getter/setter on Agent class for runtime session switching
|
|
400
|
+
|
|
401
|
+
## [3.20.0] - 2026-01-06
|
|
402
|
+
|
|
403
|
+
### Breaking Changes
|
|
404
|
+
|
|
405
|
+
- Replaced `queueMessage`/`queueMode` with steering + follow-up queues: use `steer`, `setSteeringMode`, and `getSteeringMode` for mid-run interruptions, and `followUp`, `setFollowUpMode`, and `getFollowUpMode` for post-turn messages
|
|
406
|
+
- Agent loop callbacks now use `getSteeringMessages` and `getFollowUpMessages` instead of `getQueuedMessages`
|
|
407
|
+
|
|
408
|
+
### Added
|
|
409
|
+
|
|
410
|
+
- Added follow-up message queue support so new user messages can continue a run after the agent would otherwise stop
|
|
411
|
+
- Added `RenderResultOptions.spinnerFrame` for animated tool-result rendering
|
|
412
|
+
|
|
413
|
+
### Changed
|
|
414
|
+
|
|
415
|
+
- `prompt()` and `continue()` now throw when the agent is already streaming; use steering or follow-up queues instead
|
|
416
|
+
|
|
417
|
+
## [3.4.1337] - 2026-01-03
|
|
418
|
+
|
|
419
|
+
### Added
|
|
420
|
+
|
|
421
|
+
- Added `popMessage()` method to Agent class for removing and retrieving the last message
|
|
422
|
+
- Added abort signal checks during response streaming for faster interruption handling
|
|
423
|
+
|
|
424
|
+
### Fixed
|
|
425
|
+
|
|
426
|
+
- Fixed abort handling to properly return aborted message state when stream is interrupted mid-response
|
|
427
|
+
|
|
428
|
+
## [1.341.0] - 2026-01-03
|
|
429
|
+
|
|
430
|
+
### Added
|
|
431
|
+
|
|
432
|
+
- Added `interruptMode` option to control when queued messages interrupt tool execution.
|
|
433
|
+
- Implemented "immediate" mode (default) to check queue after each tool and interrupt remaining tools.
|
|
434
|
+
- Implemented "wait" mode to defer queue processing until the entire turn completes.
|
|
435
|
+
- Added getter and setter methods for `interruptMode` on Agent class.
|
|
436
|
+
|
|
437
|
+
## [1.337.1] - 2026-01-02
|
|
438
|
+
|
|
439
|
+
### Changed
|
|
440
|
+
|
|
441
|
+
- Forked to @gajae-code scope with unified versioning across all packages
|
|
442
|
+
|
|
443
|
+
## [1.337.0] - 2026-01-02
|
|
444
|
+
|
|
445
|
+
Initial release under @gajae-code scope. See previous releases at [badlogic/pi-mono](https://github.com/badlogic/pi-mono).
|
|
446
|
+
|
|
447
|
+
## [0.31.0] - 2026-01-02
|
|
448
|
+
|
|
449
|
+
### Breaking Changes
|
|
450
|
+
|
|
451
|
+
- **Transport abstraction removed**: `ProviderTransport`, `AppTransport`, and `AgentTransport` interface have been removed. Use the `streamFn` option directly for custom streaming implementations.
|
|
452
|
+
|
|
453
|
+
- **Agent options renamed**:
|
|
454
|
+
- `transport` → removed (use `streamFn` instead)
|
|
455
|
+
- `messageTransformer` → `convertToLlm`
|
|
456
|
+
- `preprocessor` → `transformContext`
|
|
457
|
+
|
|
458
|
+
- **`AppMessage` renamed to `AgentMessage`**: All references to `AppMessage` have been renamed to `AgentMessage` for consistency.
|
|
459
|
+
|
|
460
|
+
- **`CustomMessages` renamed to `CustomAgentMessages`**: The declaration merging interface has been renamed.
|
|
461
|
+
|
|
462
|
+
- **`UserMessageWithAttachments` and `Attachment` types removed**: Attachment handling is now the responsibility of the `convertToLlm` function.
|
|
463
|
+
|
|
464
|
+
- **Agent loop moved from `@gajae-code/ai`**: The `agentLoop`, `agentLoopContinue`, and related types have moved to this package. Import from `@gajae-code/pi-agent` instead.
|
|
465
|
+
|
|
466
|
+
### Added
|
|
467
|
+
|
|
468
|
+
- `streamFn` option on `Agent` for custom stream implementations. Default uses `streamSimple` from pi-ai.
|
|
469
|
+
|
|
470
|
+
- `streamProxy()` utility function for browser apps that need to proxy LLM calls through a backend server. Replaces the removed `AppTransport`.
|
|
471
|
+
|
|
472
|
+
- `getApiKey` option for dynamic API key resolution (useful for expiring OAuth tokens like GitHub Copilot).
|
|
473
|
+
|
|
474
|
+
- `agentLoop()` and `agentLoopContinue()` low-level functions for running the agent loop without the `Agent` class wrapper.
|
|
475
|
+
|
|
476
|
+
- New exported types: `AgentLoopConfig`, `AgentContext`, `AgentTool`, `AgentToolResult`, `AgentToolUpdateCallback`, `StreamFn`.
|
|
477
|
+
|
|
478
|
+
### Changed
|
|
479
|
+
|
|
480
|
+
- `Agent` constructor now has all options optional (empty options use defaults).
|
|
481
|
+
|
|
482
|
+
- `queueMessage()` is now synchronous (no longer returns a Promise).
|