agents 0.28.1 → 0.30.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/dist/{agent-routing-BMvWTFEp.d.ts → agent-routing-CDbpVjYq.d.ts} +7 -8
- package/dist/agent-routing.d.ts +1 -1
- package/dist/agent-tool-types.d.ts +1 -1
- package/dist/{agent-tools-ohoewW-B.d.ts → agent-tools-C8DH8Yii.d.ts} +2 -2
- package/dist/agent-tools.d.ts +1 -1
- package/dist/{ai-ahruGw7e.d.ts → ai-iXw0uOGj.d.ts} +3 -3
- package/dist/{ai-sdk-C2iTAwUd.js → ai-sdk-DRPh2rRa.js} +185 -125
- package/dist/ai-sdk-DRPh2rRa.js.map +1 -0
- package/dist/browser/ai.d.ts +1 -1
- package/dist/browser/ai.js +2 -2
- package/dist/browser/index.d.ts +8 -8
- package/dist/browser/index.js +3 -3
- package/dist/browser/tools/ai-sdk.d.ts +2 -2
- package/dist/browser/tools/ai-sdk.js +1 -1
- package/dist/browser/tools/pi.d.ts +7 -3
- package/dist/browser/tools/pi.js +9 -5
- package/dist/browser/tools/pi.js.map +1 -1
- package/dist/browser/tools/tanstack-ai.d.ts +2 -2
- package/dist/browser/tools/tanstack-ai.js +1 -1
- package/dist/{browser-CEdNlsaD.js → browser-DccPw_wW.js} +130 -79
- package/dist/browser-DccPw_wW.js.map +1 -0
- package/dist/{browser-D30VlpcA.d.ts → browser-DlXhSAdf.d.ts} +41 -37
- package/dist/{browser-tool-4iomavs_.js → browser-tool-B1mhifin.js} +3 -3
- package/dist/{browser-tool-4iomavs_.js.map → browser-tool-B1mhifin.js.map} +1 -1
- package/dist/{browser-tool-vtrPOV8e.d.ts → browser-tool-Cxjk5sgG.d.ts} +2 -2
- package/dist/chat/index.d.ts +143 -71
- package/dist/chat/index.js +269 -110
- package/dist/chat/index.js.map +1 -1
- package/dist/chat-sdk/index.d.ts +1 -1
- package/dist/chat-sdk/index.js +1 -1
- package/dist/cli.js +53 -52
- package/dist/{client-Bp-JwL3p.d.ts → client-C27CtRZr.d.ts} +2 -2
- package/dist/client.d.ts +1 -1
- package/dist/{connector-DEXzVoaY.d.ts → connector-20DJ6p4k.d.ts} +2 -2
- package/dist/{connector-CtZylXdk.js → connector-DAXBOIIi.js} +2 -2
- package/dist/{connector-CtZylXdk.js.map → connector-DAXBOIIi.js.map} +1 -1
- package/dist/experimental/channels/web/index.js +1 -1
- package/dist/harness/container/index.js +1 -1
- package/dist/harness/container/index.js.map +1 -1
- package/dist/harness/opencode/index.js +1 -1
- package/dist/harness/pi/index.d.ts +70 -40
- package/dist/harness/pi/index.js +266 -330
- package/dist/harness/pi/index.js.map +1 -1
- package/dist/{images-C4hiIexM.js → images-xaDv2Fqe.js} +636 -168
- package/dist/images-xaDv2Fqe.js.map +1 -0
- package/dist/index-DCxk3OSJ.d.ts +378 -0
- package/dist/{index-kbSUIer3.d.ts → index-iv9FTXX9.d.ts} +80 -112
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{input-schema-xBofjBKC.js → input-schema-B0Etuo-o.js} +2 -2
- package/dist/{input-schema-xBofjBKC.js.map → input-schema-B0Etuo-o.js.map} +1 -1
- package/dist/lifecycle/index.js +1 -1
- package/dist/{lifecycle-DGorpAmA.js → lifecycle-v1rKHV2C.js} +67 -19
- package/dist/lifecycle-v1rKHV2C.js.map +1 -0
- package/dist/mcp/client/index.d.ts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/models/ai-sdk/index.d.ts +29 -352
- package/dist/models/ai-sdk/index.js +1 -1
- package/dist/models/opencode/index.d.ts +25 -13
- package/dist/models/opencode/index.js +16 -11
- package/dist/models/opencode/index.js.map +1 -1
- package/dist/models/pi-ai/index.d.ts +13 -14
- package/dist/models/pi-ai/index.js +87 -34
- package/dist/models/pi-ai/index.js.map +1 -1
- package/dist/react.d.ts +2 -2
- package/dist/routing/index.d.ts +1 -1
- package/dist/serializable.d.ts +1 -1
- package/dist/{session-store-DoPY12xM.d.ts → session-store-_IK6dV-w.d.ts} +14 -2
- package/dist/{session-store-Do4xkDcf.js → session-store-yvwq1f9x.js} +55 -2
- package/dist/session-store-yvwq1f9x.js.map +1 -0
- package/dist/{settings-BjAiPd6Z.js → settings-Dk2il2Hf.js} +4 -1
- package/dist/settings-Dk2il2Hf.js.map +1 -0
- package/dist/skills/index.d.ts +22 -28
- package/dist/skills/index.js +183 -143
- package/dist/skills/index.js.map +1 -1
- package/dist/{src-CQxJFv4l.js → src-DfLzdwlK.js} +3 -3
- package/dist/src-DfLzdwlK.js.map +1 -0
- package/dist/sub-routing.d.ts +1 -1
- package/dist/{tool-VF0qiO7q.js → tool-DkT_DJBm.js} +2 -2
- package/dist/tool-DkT_DJBm.js.map +1 -0
- package/dist/transport-CPh7YGiw.d.ts +623 -0
- package/dist/voice/index.d.ts +1 -1
- package/dist/web/fetch/tools/pi.d.ts +10 -6
- package/dist/web/fetch/tools/pi.js +12 -8
- package/dist/web/fetch/tools/pi.js.map +1 -1
- package/dist/web/search/index.js +1 -1
- package/dist/web/search/tools/ai-sdk.js +2 -2
- package/dist/web/search/tools/pi.d.ts +10 -6
- package/dist/web/search/tools/pi.js +13 -9
- package/dist/web/search/tools/pi.js.map +1 -1
- package/dist/web/search/tools/tanstack-ai.js +2 -2
- package/dist/websockets/index.js +1 -1
- package/dist/{websockets-C3zy8YR0.js → websockets-CyoeosdO.js} +2 -2
- package/dist/{websockets-C3zy8YR0.js.map → websockets-CyoeosdO.js.map} +1 -1
- package/dist/workflow-types.d.ts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.js +1 -1
- package/docs/browse-the-web.md +1 -1
- package/docs/chat-agents.md +19 -18
- package/docs/harnesses/pi.md +101 -38
- package/docs/lifecycle.md +7 -1
- package/docs/models-pi-ai.md +66 -20
- package/docs/models.md +197 -172
- package/package.json +12 -7
- package/dist/ai-sdk-C2iTAwUd.js.map +0 -1
- package/dist/browser-CEdNlsaD.js.map +0 -1
- package/dist/images-C4hiIexM.js.map +0 -1
- package/dist/lifecycle-DGorpAmA.js.map +0 -1
- package/dist/session-store-Do4xkDcf.js.map +0 -1
- package/dist/settings-BjAiPd6Z.js.map +0 -1
- package/dist/settings-DnD__xuE.d.ts +0 -349
- package/dist/src-CQxJFv4l.js.map +0 -1
- package/dist/tool-VF0qiO7q.js.map +0 -1
- package/dist/transport-DCyarnwm.d.ts +0 -200
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as _classPrivateFieldInitSpec, n as _classPrivateFieldSet2, r as _assertClassBrand, t as _classPrivateFieldGet2 } from "../../classPrivateFieldGet2-DZBYAB34.js";
|
|
2
2
|
import { t as _classPrivateMethodInitSpec } from "../../classPrivateMethodInitSpec-qMjJ6sHQ.js";
|
|
3
3
|
import { t as LifecycleCapability } from "../../capability-DBAKc6UZ.js";
|
|
4
|
-
import "../../lifecycle-
|
|
4
|
+
import "../../lifecycle-v1rKHV2C.js";
|
|
5
5
|
//#region src/harness/table-prefix.ts
|
|
6
6
|
/**
|
|
7
7
|
* A view of `storage` whose SQL is rewritten into `prefix`'s namespace.
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
s as LifecycleCapability,
|
|
5
5
|
v as LifecycleJobOutcome
|
|
6
6
|
} from "../../capability-runner-BiVUtjqC.js";
|
|
7
|
-
import {
|
|
7
|
+
import { S as SkillSource } from "../../index-iv9FTXX9.js";
|
|
8
8
|
import { Api, Model, ModelThinkingLevel } from "@earendil-works/pi-ai";
|
|
9
9
|
import {
|
|
10
10
|
AgentChange,
|
|
@@ -13,33 +13,14 @@ import {
|
|
|
13
13
|
EntryRecord,
|
|
14
14
|
Extension,
|
|
15
15
|
Harness,
|
|
16
|
+
InputEntry,
|
|
16
17
|
ToolRegistration,
|
|
17
|
-
UserInput
|
|
18
|
+
UserInput,
|
|
19
|
+
Wake
|
|
18
20
|
} from "@earendil-works/pi-durable";
|
|
21
|
+
import { Context as Context$1 } from "@earendil-works/chord/context";
|
|
19
22
|
import { SqliteStorage } from "@earendil-works/pi-durable/storage/sqlite";
|
|
20
23
|
|
|
21
|
-
//#region src/harness/pi/context.d.ts
|
|
22
|
-
/**
|
|
23
|
-
* pi's invocation context, as `@earendil-works/chord` defines it.
|
|
24
|
-
*
|
|
25
|
-
* pi-durable takes a chord `Context` on every call but does not re-export
|
|
26
|
-
* the type or its constructors. The harness needs only a background context
|
|
27
|
-
* and a way to add an abort signal, so both are inlined here instead of
|
|
28
|
-
* depending on chord directly. A chord `Context` is a plain structural
|
|
29
|
-
* interface (an abort signal, keyed values, and a name), so these interoperate
|
|
30
|
-
* with chord's own contexts inside pi.
|
|
31
|
-
*
|
|
32
|
-
* One limit: chord's own derived contexts read the abort signal through a
|
|
33
|
-
* private key rather than `abortSignal`, so a chord `withContextValue`
|
|
34
|
-
* wrapped around one of these would not see its signal. pi-durable does not
|
|
35
|
-
* use `withContextValue` to wrap a caller's context that way; `withAbortSignal`
|
|
36
|
-
* and `withCancel` read `abortSignal` and work.
|
|
37
|
-
*
|
|
38
|
-
* If pi-durable starts re-exporting chord's context helpers, replace this
|
|
39
|
-
* file with those.
|
|
40
|
-
*/
|
|
41
|
-
type Context$1 = Parameters<Harness["close"]>[0];
|
|
42
|
-
//#endregion
|
|
43
24
|
//#region src/harness/pi/types.d.ts
|
|
44
25
|
/**
|
|
45
26
|
* `PiHarness`'s own types: how the harness addresses sessions and reports
|
|
@@ -59,6 +40,14 @@ type PiSubmitOptions = {
|
|
|
59
40
|
/** Default: the root session. */ readonly session?: PiSessionId /** Idempotency key. Submitting the same id twice returns the same receipt. */;
|
|
60
41
|
readonly operationId?: string;
|
|
61
42
|
readonly whenBusy?: PiWhenBusy;
|
|
43
|
+
/**
|
|
44
|
+
* The transcript entry the input is placed as, instead of pi's `pi.user`:
|
|
45
|
+
* for input the user did not type, such as a scheduled prompt, a webhook,
|
|
46
|
+
* or an approval's outcome. The model still gets the input as a user
|
|
47
|
+
* message; `kind` and `data` record where it came from. The kind must not
|
|
48
|
+
* start with `pi.`.
|
|
49
|
+
*/
|
|
50
|
+
readonly entry?: InputEntry;
|
|
62
51
|
};
|
|
63
52
|
type PiSessionOptions = {
|
|
64
53
|
/** Default: the root session. */ readonly session?: PiSessionId;
|
|
@@ -85,8 +74,13 @@ type PiPromptResponse = PiOperationResult & {
|
|
|
85
74
|
/** A submission pi has not settled yet. */
|
|
86
75
|
type PiPendingOperation = {
|
|
87
76
|
readonly operationId: string;
|
|
88
|
-
readonly session: PiSessionId
|
|
89
|
-
|
|
77
|
+
readonly session: PiSessionId;
|
|
78
|
+
/**
|
|
79
|
+
* `queued` in pi's inbox, or `running` as part of the current run.
|
|
80
|
+
* `parked`: running, but pi's crash-loop guard (`settings.restartLimit`)
|
|
81
|
+
* stopped a task of the session; `retry()` runs it again.
|
|
82
|
+
*/
|
|
83
|
+
readonly status: "queued" | "running" | "parked";
|
|
90
84
|
};
|
|
91
85
|
type PiSessionInfo = {
|
|
92
86
|
readonly id: PiSessionId /** The session this one was forked from. */;
|
|
@@ -98,22 +92,34 @@ type PiSessionInfo = {
|
|
|
98
92
|
/** The root session's id. */
|
|
99
93
|
declare const ROOT_SESSION: PiSessionId;
|
|
100
94
|
/**
|
|
101
|
-
* What the factory is handed: the
|
|
95
|
+
* What the factory is handed: the things only the harness can build.
|
|
102
96
|
* Everything else `Harness.open` takes (models, registry, settings, env,
|
|
103
97
|
* onReport) the factory builds itself.
|
|
104
98
|
*/
|
|
105
99
|
type PiHarnessContext = {
|
|
106
100
|
/** pi's storage over this object's SQLite, its migrations already run. */ readonly storage: SqliteStorage /** Background context, for the open itself. */;
|
|
107
101
|
readonly context: Context$1;
|
|
102
|
+
/**
|
|
103
|
+
* Pass this to `Harness.open` as its `onWake` option. pi calls it when it
|
|
104
|
+
* next needs to run, and the harness sets this object's alarm for then.
|
|
105
|
+
*
|
|
106
|
+
* With it, pi sets no in-memory timer for a sleeping task (a retry
|
|
107
|
+
* backoff, a poll, a `sleepUntil`), so the object can hibernate until the
|
|
108
|
+
* alarm. Without it the harness still works, but pi's timer keeps the
|
|
109
|
+
* object in memory, and billed, while a task sleeps, and the harness logs
|
|
110
|
+
* a warning when it opens pi.
|
|
111
|
+
*/
|
|
112
|
+
readonly onWake: (wake: Wake) => void;
|
|
108
113
|
};
|
|
109
114
|
/**
|
|
110
|
-
* Opens pi's `Harness`. The harness adopts what it returns.
|
|
115
|
+
* Opens pi's `Harness`. The harness adopts what it returns. Pass `onWake`
|
|
116
|
+
* through to `Harness.open`.
|
|
111
117
|
*
|
|
112
118
|
* ```ts
|
|
113
|
-
* harness: async ({ storage, context }) => {
|
|
119
|
+
* harness: async ({ storage, context, onWake }) => {
|
|
114
120
|
* const registry = createRegistry();
|
|
115
121
|
* registry.install(await skills(sources));
|
|
116
|
-
* return Harness.open(storage, { models, registry }, context);
|
|
122
|
+
* return Harness.open(storage, { models, registry, onWake }, context);
|
|
117
123
|
* }
|
|
118
124
|
* ```
|
|
119
125
|
*/
|
|
@@ -160,12 +166,14 @@ type PiHarnessOptions = {
|
|
|
160
166
|
*
|
|
161
167
|
* What pi cannot do on a Durable Object is wake itself: its scheduler runs
|
|
162
168
|
* in memory, and an evicted object has no memory. The harness is that wake,
|
|
163
|
-
* with one Lifecycle job
|
|
164
|
-
* after the
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
+
* with one Lifecycle job driven by `pi.wake()`. Input goes to pi once, in
|
|
170
|
+
* `submit()`, after the job is scheduled. While pi has work running, the
|
|
171
|
+
* job waits on it, rescheduling itself as a heartbeat. While pi's tasks
|
|
172
|
+
* sleep, the job is due when the first one wakes; pi tells the harness
|
|
173
|
+
* through the `onWake` the factory passes to `Harness.open`. When pi has
|
|
174
|
+
* nothing to do, the job completes. An eviction mid-run leaves the job due,
|
|
175
|
+
* so its alarm restarts the object, pi reopens and resumes its own tasks,
|
|
176
|
+
* and the job waits again.
|
|
169
177
|
*
|
|
170
178
|
* @beta The API may change between releases.
|
|
171
179
|
*/
|
|
@@ -175,6 +183,16 @@ declare class PiHarness extends LifecycleCapability {
|
|
|
175
183
|
constructor(options: PiHarnessOptions);
|
|
176
184
|
onStart(_context: CapabilityStartContext): Promise<void>;
|
|
177
185
|
onJob(context: LifecycleJobContext): Promise<LifecycleJobOutcome | void>;
|
|
186
|
+
/**
|
|
187
|
+
* A wake dispatch that failed through Lifecycle's retries, as when pi
|
|
188
|
+
* cannot be opened. Lifecycle would complete the job, and pi's work would
|
|
189
|
+
* never be woken again, so try again later: at the heartbeat, doubling
|
|
190
|
+
* while the failures continue, up to 10 minutes.
|
|
191
|
+
*/
|
|
192
|
+
onJobError(
|
|
193
|
+
context: LifecycleJobContext,
|
|
194
|
+
error: unknown
|
|
195
|
+
): LifecycleJobOutcome | void;
|
|
178
196
|
/** Close pi's in-memory resources. Durable state is untouched. */
|
|
179
197
|
dispose(): Promise<void>;
|
|
180
198
|
/** A handle on one session. No I/O until you call it. */
|
|
@@ -192,6 +210,11 @@ declare class PiHarness extends LifecycleCapability {
|
|
|
192
210
|
readonly operationId?: string;
|
|
193
211
|
}
|
|
194
212
|
): Promise<boolean>;
|
|
213
|
+
/**
|
|
214
|
+
* Run again the tasks pi's crash-loop guard parked in a session's work.
|
|
215
|
+
* False when nothing was parked.
|
|
216
|
+
*/
|
|
217
|
+
retry(options?: PiSessionOptions): Promise<boolean>;
|
|
195
218
|
wait(
|
|
196
219
|
operationId: string,
|
|
197
220
|
options?: PiSessionOptions & {
|
|
@@ -214,6 +237,8 @@ declare class PiHarness extends LifecycleCapability {
|
|
|
214
237
|
input: UserInput,
|
|
215
238
|
options: PiSubmitOptions
|
|
216
239
|
): Promise<PiReceipt>;
|
|
240
|
+
/** @internal Run again the tasks pi's restart limit parked in a session. */
|
|
241
|
+
retryParked(session: PiSessionId): Promise<boolean>;
|
|
217
242
|
/** @internal Withdraw a queued input, or abort the run it joined. */
|
|
218
243
|
withdraw(session: PiSessionId, operationId: string): Promise<boolean>;
|
|
219
244
|
/** @internal Wait for pi to settle an operation, by its request id. */
|
|
@@ -250,6 +275,12 @@ declare class PiSession {
|
|
|
250
275
|
* running work.
|
|
251
276
|
*/
|
|
252
277
|
abort(operationId?: string): Promise<boolean>;
|
|
278
|
+
/**
|
|
279
|
+
* Run again the tasks pi's crash-loop guard (`settings.restartLimit`)
|
|
280
|
+
* parked in this session's work, including subagent sessions it owns.
|
|
281
|
+
* False when nothing was parked.
|
|
282
|
+
*/
|
|
283
|
+
retry(): Promise<boolean>;
|
|
253
284
|
/** Start a new context, optionally from a handoff note. */
|
|
254
285
|
reset(handoff?: string): Promise<void>;
|
|
255
286
|
/**
|
|
@@ -285,10 +316,9 @@ declare class PiSessions {
|
|
|
285
316
|
*
|
|
286
317
|
* pi owns its sessions: conversations, entries, tasks, submissions, and
|
|
287
318
|
* documents live in pi's own schema, created and migrated by pi's portable
|
|
288
|
-
* `SqliteStorage
|
|
289
|
-
* pi
|
|
290
|
-
*
|
|
291
|
-
* object.
|
|
319
|
+
* `SqliteStorage` through pi's own Durable Object adapter. The store keeps
|
|
320
|
+
* pi's tables under a prefix, so they cannot collide with the SDK's or the
|
|
321
|
+
* host's tables in the same object.
|
|
292
322
|
*
|
|
293
323
|
* It is the Durable Object counterpart of `agents/sessions` for a harness
|
|
294
324
|
* that brings its own session model, and has nothing pi-harness specific in
|