@fleetagent/pi-coding-agent 0.0.2 → 0.0.5

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 CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.5](https://github.com/fleetagent/pi/compare/@fleetagent/pi-coding-agent-v0.0.4...@fleetagent/pi-coding-agent-v0.0.5) (2026-05-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * **coding-agent:** expose structured responses over rpc ([8ba9a44](https://github.com/fleetagent/pi/commit/8ba9a444d94b6b1ed79f6a44bae8fec3449e2414))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @fleetagent/pi-agent-core bumped from ^0.0.4 to ^0.0.5
16
+ * @fleetagent/pi-ai bumped from ^0.0.4 to ^0.0.5
17
+ * @fleetagent/pi-tui bumped from ^0.0.4 to ^0.0.5
18
+
19
+ ## [0.0.4](https://github.com/fleetagent/pi/compare/@fleetagent/pi-coding-agent-v0.0.3...@fleetagent/pi-coding-agent-v0.0.4) (2026-05-23)
20
+
21
+
22
+ ### Features
23
+
24
+ * **coding-agent:** add structured response extraction ([04fb861](https://github.com/fleetagent/pi/commit/04fb8617bff69c98bc04afaeadbd4782f46e4691))
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * The following workspace dependencies were updated
30
+ * dependencies
31
+ * @fleetagent/pi-agent-core bumped from ^0.0.3 to ^0.0.4
32
+ * @fleetagent/pi-ai bumped from ^0.0.3 to ^0.0.4
33
+ * @fleetagent/pi-tui bumped from ^0.0.3 to ^0.0.4
34
+
3
35
  ## [0.0.3](https://github.com/fleetagent/pi/compare/@fleetagent/pi-coding-agent-v0.0.2...@fleetagent/pi-coding-agent-v0.0.3) (2026-05-23)
4
36
 
5
37
 
@@ -13,11 +13,12 @@
13
13
  * Modes use this class and add their own I/O layer on top.
14
14
  */
15
15
  import type { Agent, AgentEvent, AgentMessage, AgentState, AgentTool, ThinkingLevel } from "@fleetagent/pi-agent-core";
16
- import type { ImageContent, Model, TextContent } from "@fleetagent/pi-ai";
16
+ import type { AssistantMessage, ImageContent, Model, TextContent } from "@fleetagent/pi-ai";
17
+ import type { Static, TSchema } from "typebox";
17
18
  import { type BashResult } from "./bash-executor.ts";
18
19
  import { type CompactionResult } from "./compaction/index.ts";
19
20
  import { type ContextUsage, type ExtensionCommandContextActions, type ExtensionErrorListener, ExtensionRunner, type ExtensionUIContext, type InputSource, type ReplacedSessionContext, type SessionStartEvent, type ShutdownHandler, type ToolDefinition, type ToolInfo } from "./extensions/index.ts";
20
- import type { CustomMessage } from "./messages.ts";
21
+ import { type CustomMessage } from "./messages.ts";
21
22
  import type { ModelRegistry } from "./model-registry.ts";
22
23
  import { type PromptTemplate } from "./prompt-templates.ts";
23
24
  import type { ResourceLoader } from "./resource-loader.ts";
@@ -131,6 +132,24 @@ export interface PromptOptions {
131
132
  /** Internal hook used by RPC mode to observe prompt preflight acceptance or rejection. */
132
133
  preflightResult?: (success: boolean) => void;
133
134
  }
135
+ export interface StructuredResponseOptions<TSchemaValue extends TSchema> {
136
+ /** TypeBox object schema for the structured response. */
137
+ schema: TSchemaValue;
138
+ /** Schema/tool name shown to the model. Defaults to "structured_output". */
139
+ name?: string;
140
+ /** Optional description for the temporary structured output tool. */
141
+ description?: string;
142
+ /** Maximum correction calls after an invalid response. Defaults to 2. */
143
+ maxCorrections?: number;
144
+ /** Source context for extraction. Defaults to the latest assistant answer. */
145
+ scope?: "latest" | "conversation";
146
+ }
147
+ export interface StructuredResponse<T> {
148
+ output: T;
149
+ attempts: number;
150
+ source: "json" | "tool";
151
+ message: AssistantMessage;
152
+ }
134
153
  /** Result from cycleModel() */
135
154
  export interface ModelCycleResult {
136
155
  model: Model<any>;
@@ -313,6 +332,12 @@ export declare class AgentSession {
313
332
  private _rebuildSystemPrompt;
314
333
  private _runAgentPrompt;
315
334
  private _handlePostAgentRun;
335
+ getStructuredResponse<TSchemaValue extends TSchema>(options: StructuredResponseOptions<TSchemaValue>): Promise<StructuredResponse<Static<TSchemaValue>>>;
336
+ private _buildStructuredResponseMessages;
337
+ private _tryParseStructuredAssistantText;
338
+ private _validateStructuredArguments;
339
+ private _appendStructuredInternalEntry;
340
+ private _formatStructuredAssistantLog;
316
341
  /**
317
342
  * Send a prompt to the agent.
318
343
  * - Handles extension commands (registered via pi.registerCommand) immediately, even during streaming