@oh-my-pi/pi-agent-core 12.8.2 → 12.10.0
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/package.json +4 -4
- package/src/agent.ts +2 -2
- package/src/types.ts +11 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-agent-core",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.10.0",
|
|
4
4
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"test": "bun test"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@oh-my-pi/pi-ai": "12.
|
|
28
|
-
"@oh-my-pi/pi-tui": "12.
|
|
29
|
-
"@oh-my-pi/pi-utils": "12.
|
|
27
|
+
"@oh-my-pi/pi-ai": "12.10.0",
|
|
28
|
+
"@oh-my-pi/pi-tui": "12.10.0",
|
|
29
|
+
"@oh-my-pi/pi-utils": "12.10.0"
|
|
30
30
|
},
|
|
31
31
|
"keywords": [
|
|
32
32
|
"ai",
|
package/src/agent.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type AssistantMessage,
|
|
7
7
|
type CursorExecHandlers,
|
|
8
8
|
type CursorToolResultHandler,
|
|
9
|
-
|
|
9
|
+
getBundledModel,
|
|
10
10
|
type ImageContent,
|
|
11
11
|
type Message,
|
|
12
12
|
type Model,
|
|
@@ -153,7 +153,7 @@ interface CursorToolResultEntry {
|
|
|
153
153
|
export class Agent {
|
|
154
154
|
#state: AgentState = {
|
|
155
155
|
systemPrompt: "",
|
|
156
|
-
model:
|
|
156
|
+
model: getBundledModel("google", "gemini-2.5-flash-lite-preview-06-17"),
|
|
157
157
|
thinkingLevel: "off",
|
|
158
158
|
tools: [],
|
|
159
159
|
messages: [],
|
package/src/types.ts
CHANGED
|
@@ -172,7 +172,7 @@ export interface AgentState {
|
|
|
172
172
|
error?: string;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
export interface AgentToolResult<T, TNormative extends TSchema = any> {
|
|
175
|
+
export interface AgentToolResult<T = any, TNormative extends TSchema = any> {
|
|
176
176
|
// Content blocks supporting text and images
|
|
177
177
|
content: (TextContent | ImageContent)[];
|
|
178
178
|
// Details to be displayed in a UI or logged
|
|
@@ -204,6 +204,15 @@ export interface AgentToolContext {
|
|
|
204
204
|
// Empty by default - apps extend via declaration merging
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
+
export type AgentToolExecFn<TParameters extends TSchema = TSchema, TDetails = any, TTheme = unknown> = (
|
|
208
|
+
this: AgentTool<TParameters, TDetails, TTheme>,
|
|
209
|
+
toolCallId: string,
|
|
210
|
+
params: Static<TParameters>,
|
|
211
|
+
signal?: AbortSignal,
|
|
212
|
+
onUpdate?: AgentToolUpdateCallback<TDetails, TParameters>,
|
|
213
|
+
context?: AgentToolContext,
|
|
214
|
+
) => Promise<AgentToolResult<TDetails, TParameters>>;
|
|
215
|
+
|
|
207
216
|
// AgentTool extends Tool but adds the execute function
|
|
208
217
|
export interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any, TTheme = unknown>
|
|
209
218
|
extends Tool<TParameters> {
|
|
@@ -219,13 +228,7 @@ export interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any
|
|
|
219
228
|
* - "exclusive": runs alone; other tools wait until it finishes
|
|
220
229
|
*/
|
|
221
230
|
concurrency?: "shared" | "exclusive";
|
|
222
|
-
execute:
|
|
223
|
-
toolCallId: string,
|
|
224
|
-
params: Static<TParameters>,
|
|
225
|
-
signal?: AbortSignal,
|
|
226
|
-
onUpdate?: AgentToolUpdateCallback<TDetails, TParameters>,
|
|
227
|
-
context?: AgentToolContext,
|
|
228
|
-
) => Promise<AgentToolResult<TDetails, TParameters>>;
|
|
231
|
+
execute: AgentToolExecFn<TParameters, TDetails, TTheme>;
|
|
229
232
|
|
|
230
233
|
/** Optional custom rendering for tool call display (returns UI component) */
|
|
231
234
|
renderCall?: (args: Static<TParameters>, theme: TTheme) => unknown;
|