agents 0.23.0 → 0.25.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-DE5zmCQ8.d.ts → agent-routing-0DR0Tk2v.d.ts} +270 -190
- package/dist/agent-routing.d.ts +1 -1
- package/dist/agent-routing.js.map +1 -1
- package/dist/agent-tool-types.d.ts +13 -7
- package/dist/agent-tool-types.js +23 -1
- package/dist/agent-tool-types.js.map +1 -1
- package/dist/{agent-tools-y7zLfw4Q.js → agent-tools-CdJC-8Dc.js} +72 -9
- package/dist/agent-tools-CdJC-8Dc.js.map +1 -0
- package/dist/{agent-tools-DtXMTDGM.d.ts → agent-tools-YrATZJu2.d.ts} +29 -15
- package/dist/agent-tools.d.ts +6 -4
- package/dist/agent-tools.js.map +1 -1
- package/dist/ai-fm7xx1BK.js +312 -0
- package/dist/ai-fm7xx1BK.js.map +1 -0
- package/dist/base64-redaction-C1Uu29t5.js +59 -0
- package/dist/base64-redaction-C1Uu29t5.js.map +1 -0
- package/dist/browser/ai-sdk.d.ts +90 -0
- package/dist/browser/ai-sdk.js +51 -0
- package/dist/browser/ai-sdk.js.map +1 -0
- package/dist/browser/ai.d.ts +4 -4
- package/dist/browser/ai.js +1 -347
- package/dist/browser/index.d.ts +81 -79
- package/dist/browser/index.js +361 -2
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/tanstack-ai.d.ts +96 -1
- package/dist/browser/tanstack-ai.js +62 -2
- package/dist/browser/tanstack-ai.js.map +1 -1
- package/dist/browser-DE3d-RLk.d.ts +275 -0
- package/dist/browser-tool-CQ10e6Kj.js +480 -0
- package/dist/browser-tool-CQ10e6Kj.js.map +1 -0
- package/dist/browser-tool-DuNdlwZ9.d.ts +73 -0
- package/dist/{capability-BjSKYpzg.js → capability-B4WbF81e.js} +2 -1
- package/dist/capability-B4WbF81e.js.map +1 -0
- package/dist/{capability-runner-Be_-PLR1.d.ts → capability-runner-DBAnGr6L.d.ts} +45 -15
- package/dist/chat/index.d.ts +341 -232
- package/dist/chat/index.js +602 -72
- package/dist/chat/index.js.map +1 -1
- package/dist/chat/react.d.ts +42 -2
- package/dist/chat/react.js +191 -35
- package/dist/chat/react.js.map +1 -1
- package/dist/chat/transport.d.ts +1 -1
- package/dist/chat/transport.js +1 -1
- package/dist/chat-sdk/index.d.ts +17 -3
- package/dist/chat-sdk/index.js +28 -2
- package/dist/chat-sdk/index.js.map +1 -1
- package/dist/client-4OlMIJx-.js +591 -0
- package/dist/client-4OlMIJx-.js.map +1 -0
- package/dist/{client-jagG8a9_.js → client-fyQrLGkD.js} +2 -2
- package/dist/{client-jagG8a9_.js.map → client-fyQrLGkD.js.map} +1 -1
- package/dist/client-je3koD9Z.d.ts +446 -0
- package/dist/client.d.ts +29 -283
- package/dist/client.js +2 -274
- package/dist/{connector-CptFKzRh.js → connector-58XDGvc3.js} +251 -120
- package/dist/connector-58XDGvc3.js.map +1 -0
- package/dist/{connector-CkQD4MK3.d.ts → connector-Cl-VqPmA.d.ts} +244 -146
- package/dist/context/index.d.ts +29 -0
- package/dist/context/index.js +64 -17
- package/dist/context/index.js.map +1 -1
- package/dist/current-agent-DhoDkSnH.js.map +1 -1
- package/dist/current-agent-vAk_5JMt.d.ts +93 -0
- package/dist/{current-agent-Da_C9a3b.d.ts → durable-object-lifecycle-HhgOMWq9.d.ts} +26 -127
- package/dist/harnesses/pi/index.d.ts +348 -0
- package/dist/harnesses/pi/index.js +754 -0
- package/dist/harnesses/pi/index.js.map +1 -0
- package/dist/images-iiTDSyRu.js +1631 -0
- package/dist/images-iiTDSyRu.js.map +1 -0
- package/dist/index-BreL0YrQ.d.ts +78 -0
- package/dist/index-kbSUIer3.d.ts +343 -0
- package/dist/index.d.ts +43 -41
- package/dist/index.js +2 -2
- package/dist/internal_context.d.ts +1 -1
- package/dist/lifecycle/index.d.ts +19 -17
- package/dist/lifecycle/index.js +2 -2
- package/dist/{lifecycle-CMRGjZdw.js → lifecycle-CFu6OV03.js} +73 -29
- package/dist/lifecycle-CFu6OV03.js.map +1 -0
- package/dist/mcp/client/index.d.ts +20 -20
- package/dist/mcp/client/index.js +1 -1
- package/dist/mcp/client/x402.js +21 -19
- package/dist/mcp/client/x402.js.map +1 -1
- package/dist/mcp/index.d.ts +35 -35
- package/dist/mcp/index.js +2 -2
- package/dist/{message-builder-BymO4N_D.js → message-builder-DAl9AhHH.js} +89 -4
- package/dist/message-builder-DAl9AhHH.js.map +1 -0
- package/dist/models/ai-sdk/index.d.ts +353 -0
- package/dist/models/ai-sdk/index.js +2443 -0
- package/dist/models/ai-sdk/index.js.map +1 -0
- package/dist/models/pi-ai/index.d.ts +313 -0
- package/dist/models/pi-ai/index.js +1795 -0
- package/dist/models/pi-ai/index.js.map +1 -0
- package/dist/observability/ai/index.js +20 -4
- package/dist/observability/ai/index.js.map +1 -1
- package/dist/{protocol-B0nh6KNf.js → protocol-kHsr-f0X.js} +26 -12
- package/dist/{protocol-B0nh6KNf.js.map → protocol-kHsr-f0X.js.map} +1 -1
- package/dist/queue/index.d.ts +123 -0
- package/dist/queue/index.js +2 -0
- package/dist/queue-BB-zfIYF.js +406 -0
- package/dist/queue-BB-zfIYF.js.map +1 -0
- package/dist/react.d.ts +31 -13
- package/dist/react.js +190 -71
- package/dist/react.js.map +1 -1
- package/dist/{retries-D9Ds-1lz.d.ts → retries-CV6AkXmQ.d.ts} +23 -8
- package/dist/retries.d.ts +12 -8
- package/dist/retries.js +19 -1
- package/dist/retries.js.map +1 -1
- package/dist/routing/index.d.ts +2 -2
- package/dist/routing/index.js +1 -1
- package/dist/{scheduler-DD9NdYbF.js → scheduler-DZ3xQfeK.js} +4 -11
- package/dist/scheduler-DZ3xQfeK.js.map +1 -0
- package/dist/{scheduler-Dwh85ZGl.d.ts → scheduler-RdACNXDP.d.ts} +6 -6
- package/dist/schedules/index.d.ts +1 -1
- package/dist/schedules/index.js +1 -1
- package/dist/serializable.d.ts +1 -1
- package/dist/sessions/index.d.ts +70 -3
- package/dist/sessions/index.js +276 -67
- package/dist/sessions/index.js.map +1 -1
- package/dist/skills/index.d.ts +29 -314
- package/dist/socket-address.d.ts +16 -0
- package/dist/socket-address.js +19 -0
- package/dist/socket-address.js.map +1 -0
- package/dist/{src-DlSHshb2.js → src-BZeu-SCD.js} +541 -500
- package/dist/src-BZeu-SCD.js.map +1 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/index.js +137 -0
- package/dist/state/index.js.map +1 -0
- package/dist/streams/index.d.ts +1 -1
- package/dist/streams/index.js +1 -1
- package/dist/{streams-D6tJ0NN9.d.ts → streams-Cmkj9QfW.d.ts} +4 -2
- package/dist/{streams-DZKgAj9b.js → streams-DW-UCOUc.js} +9 -2
- package/dist/streams-DW-UCOUc.js.map +1 -0
- package/dist/sub-routing.d.ts +12 -12
- package/dist/tasks/index.d.ts +1 -1
- package/dist/tasks/index.js +1 -1
- package/dist/{tasks-ylZgBjhj.js → tasks-68DESxf0.js} +3 -3
- package/dist/{tasks-ylZgBjhj.js.map → tasks-68DESxf0.js.map} +1 -1
- package/dist/{tasks-BRJ5zgya.d.ts → tasks-9YxYtByh.d.ts} +5 -5
- package/dist/transport-PfFnt-Ld.d.ts +525 -0
- package/dist/transport-protocol-BxyngQ_R.js +25 -0
- package/dist/transport-protocol-BxyngQ_R.js.map +1 -0
- package/dist/transport-protocol-ZTew5Wso.d.ts +27 -0
- package/dist/types-BA4anrjI.d.ts +70 -0
- package/dist/voice/index.d.ts +2 -2
- package/dist/websockets/index.d.ts +195 -69
- package/dist/websockets/index.js +3 -2
- package/dist/websockets-Ci-LZFHH.js +1030 -0
- package/dist/websockets-Ci-LZFHH.js.map +1 -0
- package/dist/wire-types-CnMt6_HR.js.map +1 -1
- package/dist/wire-types-CrjKvDyi.d.ts +300 -0
- package/dist/workflow-types.d.ts +25 -25
- package/dist/workflows.d.ts +21 -21
- package/dist/workflows.js +1 -1
- package/dist/{ws-chat-transport-UNRIS2xl.d.ts → ws-chat-transport-BbT1A5Lc.d.ts} +51 -2
- package/dist/{ws-chat-transport-rWwta645.js → ws-chat-transport-cqMKq3IY.js} +143 -16
- package/dist/ws-chat-transport-cqMKq3IY.js.map +1 -0
- package/docs/agent-class.md +2 -2
- package/docs/agent-tools.md +29 -4
- package/docs/browse-the-web.md +87 -5
- package/docs/chat-agents.md +124 -16
- package/docs/client-sdk.md +30 -0
- package/docs/context.md +27 -0
- package/docs/durable-execution.md +2 -0
- package/docs/harnesses/pi.md +91 -0
- package/docs/human-in-the-loop.md +4 -0
- package/docs/index.md +4 -1
- package/docs/lifecycle.md +114 -23
- package/docs/models-pi-ai.md +325 -0
- package/docs/models.md +504 -0
- package/docs/queue.md +135 -241
- package/docs/resumable-streaming.md +2 -0
- package/docs/retries.md +1 -1
- package/docs/routing.md +13 -13
- package/docs/sessions.md +36 -1
- package/docs/state.md +1 -0
- package/docs/sub-agents.md +12 -3
- package/package.json +51 -3
- package/dist/agent-tools-y7zLfw4Q.js.map +0 -1
- package/dist/browser/ai.js.map +0 -1
- package/dist/capability-BjSKYpzg.js.map +0 -1
- package/dist/client-tools-aIBO0Fk7.d.ts +0 -53
- package/dist/client.js.map +0 -1
- package/dist/connector-CptFKzRh.js.map +0 -1
- package/dist/lifecycle-CMRGjZdw.js.map +0 -1
- package/dist/message-builder-BymO4N_D.js.map +0 -1
- package/dist/scheduler-DD9NdYbF.js.map +0 -1
- package/dist/src-DlSHshb2.js.map +0 -1
- package/dist/streams-DZKgAj9b.js.map +0 -1
- package/dist/websockets-DUfRHPRq.js +0 -502
- package/dist/websockets-DUfRHPRq.js.map +0 -1
- package/dist/ws-chat-transport-rWwta645.js.map +0 -1
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_ as LifecycleJobContext,
|
|
3
|
+
n as CapabilityStartContext,
|
|
4
|
+
s as LifecycleCapability,
|
|
5
|
+
v as LifecycleJobOutcome
|
|
6
|
+
} from "../../capability-runner-DBAnGr6L.js";
|
|
7
|
+
import { T as SkillSource } from "../../index-kbSUIer3.js";
|
|
8
|
+
import {
|
|
9
|
+
AgentEventStream,
|
|
10
|
+
Conversation,
|
|
11
|
+
ConversationId,
|
|
12
|
+
ConversationRetryPolicy,
|
|
13
|
+
EntryRecord,
|
|
14
|
+
Harness,
|
|
15
|
+
ModelRef,
|
|
16
|
+
Registry,
|
|
17
|
+
ToolRegistration,
|
|
18
|
+
Tx,
|
|
19
|
+
UserInput
|
|
20
|
+
} from "@earendil-works/pi-durable";
|
|
21
|
+
import { SqliteStorage } from "@earendil-works/pi-durable/storage/sqlite";
|
|
22
|
+
import { ModelThinkingLevel } from "@earendil-works/pi-ai";
|
|
23
|
+
|
|
24
|
+
//#region src/harnesses/pi/context.d.ts
|
|
25
|
+
/**
|
|
26
|
+
* pi's invocation context, as `@earendil-works/chord` defines it.
|
|
27
|
+
*
|
|
28
|
+
* pi-durable takes a chord `Context` on every call but does not re-export
|
|
29
|
+
* the type or its constructors. The harness needs only a background context
|
|
30
|
+
* and a way to add an abort signal, so both are inlined here instead of
|
|
31
|
+
* depending on chord directly. A chord `Context` is a plain structural
|
|
32
|
+
* interface (an abort signal, keyed values, and a name), so these interoperate
|
|
33
|
+
* with chord's own contexts inside pi.
|
|
34
|
+
*
|
|
35
|
+
* One limit: chord's own derived contexts read the abort signal through a
|
|
36
|
+
* private key rather than `abortSignal`, so a chord `withContextValue`
|
|
37
|
+
* wrapped around one of these would not see its signal. pi 0.99.2 never
|
|
38
|
+
* wraps a caller's context that way; `withAbortSignal` and `withCancel`
|
|
39
|
+
* read `abortSignal` and work.
|
|
40
|
+
*
|
|
41
|
+
* If pi-durable starts re-exporting chord's context helpers, replace this
|
|
42
|
+
* file with those.
|
|
43
|
+
*/
|
|
44
|
+
type Context$1 = Parameters<Harness["close"]>[0];
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/harnesses/pi/session-store.d.ts
|
|
47
|
+
/**
|
|
48
|
+
* pi's session store on a Durable Object's SQLite database.
|
|
49
|
+
*
|
|
50
|
+
* pi owns its sessions: conversations, entries, tasks, submissions, and
|
|
51
|
+
* documents live in pi's own schema, created and migrated by pi's portable
|
|
52
|
+
* `SqliteStorage`. This file only supplies the synchronous database facade
|
|
53
|
+
* pi asks for, over `ctx.storage.sql`, and moves pi's tables under a prefix
|
|
54
|
+
* so they cannot collide with the SDK's or the host's tables in the same
|
|
55
|
+
* object.
|
|
56
|
+
*
|
|
57
|
+
* It is the Durable Object counterpart of `agents/sessions` for a harness
|
|
58
|
+
* that brings its own session model, and has nothing pi-harness specific in
|
|
59
|
+
* it: any harness built on pi-durable can open its storage with it.
|
|
60
|
+
*/
|
|
61
|
+
type PiSessionStoreOptions = {
|
|
62
|
+
/**
|
|
63
|
+
* Prefix for every table and index pi creates. Must not start with `_cf_`,
|
|
64
|
+
* which Durable Objects reserve. Default `pi_`.
|
|
65
|
+
*/
|
|
66
|
+
readonly prefix?: string;
|
|
67
|
+
};
|
|
68
|
+
/** Open pi-durable's storage over this object's SQLite database. */
|
|
69
|
+
declare function openPiSessionStore(
|
|
70
|
+
storage: DurableObjectStorage,
|
|
71
|
+
options?: PiSessionStoreOptions
|
|
72
|
+
): Promise<SqliteStorage>;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/harnesses/pi/types.d.ts
|
|
75
|
+
/**
|
|
76
|
+
* `PiHarness`'s own types: how the harness addresses sessions and reports
|
|
77
|
+
* operations. Anything pi already publishes (input, transcript entries,
|
|
78
|
+
* events) is pi's type, used directly.
|
|
79
|
+
*/
|
|
80
|
+
/** A pi conversation, addressed by its id as a string. The root is `"1"`. */
|
|
81
|
+
type PiSessionId = string;
|
|
82
|
+
/**
|
|
83
|
+
* What a submission does when the session is already running.
|
|
84
|
+
*
|
|
85
|
+
* - `followUp` (default): answered after the current run, as its own run.
|
|
86
|
+
* - `steer`: joins the running work after the current tool round.
|
|
87
|
+
*/
|
|
88
|
+
type PiWhenBusy = "followUp" | "steer";
|
|
89
|
+
type PiSubmitOptions = {
|
|
90
|
+
/** Default: the root session. */ readonly session?: PiSessionId /** Idempotency key. Submitting the same id twice returns the same receipt. */;
|
|
91
|
+
readonly operationId?: string;
|
|
92
|
+
readonly whenBusy?: PiWhenBusy;
|
|
93
|
+
};
|
|
94
|
+
type PiSessionOptions = {
|
|
95
|
+
/** Default: the root session. */ readonly session?: PiSessionId;
|
|
96
|
+
};
|
|
97
|
+
/** Returned once a submission is durable. It says nothing about the model yet. */
|
|
98
|
+
type PiReceipt = {
|
|
99
|
+
readonly operationId: string;
|
|
100
|
+
readonly session: PiSessionId /** False when this operation id was already submitted. */;
|
|
101
|
+
readonly accepted: boolean;
|
|
102
|
+
};
|
|
103
|
+
/** How one operation ended. */
|
|
104
|
+
type PiOperationResult = {
|
|
105
|
+
readonly operationId: string;
|
|
106
|
+
readonly session: PiSessionId /** `done`: answered. `unanswered`: failed, aborted, or withdrawn. */;
|
|
107
|
+
readonly status:
|
|
108
|
+
| "done"
|
|
109
|
+
| "unanswered" /** Why an unanswered operation ended, in pi's words. */;
|
|
110
|
+
readonly reason?: string /** The final assistant text, when answered. */;
|
|
111
|
+
readonly text?: string;
|
|
112
|
+
};
|
|
113
|
+
type PiPromptResponse = PiOperationResult & {
|
|
114
|
+
/** The session's active transcript after the operation. */ readonly messages: readonly EntryRecord[];
|
|
115
|
+
};
|
|
116
|
+
/** A submission pi has not settled yet. */
|
|
117
|
+
type PiPendingOperation = {
|
|
118
|
+
readonly operationId: string;
|
|
119
|
+
readonly session: PiSessionId /** `queued` in pi's inbox, or `running` as part of the current run. */;
|
|
120
|
+
readonly status: "queued" | "running";
|
|
121
|
+
};
|
|
122
|
+
type PiSessionInfo = {
|
|
123
|
+
readonly id: PiSessionId /** The session this one was forked from. */;
|
|
124
|
+
readonly parent?: PiSessionId;
|
|
125
|
+
readonly busy: boolean;
|
|
126
|
+
};
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/harnesses/pi/harness.d.ts
|
|
129
|
+
/** The root session's id. */
|
|
130
|
+
declare const ROOT_SESSION: PiSessionId;
|
|
131
|
+
/**
|
|
132
|
+
* What the harness factory is handed. The store is already open and pi's
|
|
133
|
+
* migrations have run, so a factory only has to decide how to call
|
|
134
|
+
* `Harness.open` — or call something else that satisfies the same contract.
|
|
135
|
+
*/
|
|
136
|
+
type PiHarnessContext = {
|
|
137
|
+
/** pi's storage over this object's SQLite, tables under the store prefix. */ readonly storage: SqliteStorage /** Background context, for the open itself. */;
|
|
138
|
+
readonly context: Context$1;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Builds pi's `Harness`. Return value is adopted as-is: the caller owns the
|
|
142
|
+
* registry (tools, system prompt, hooks, skills), `models`, `env`,
|
|
143
|
+
* `onReport` and anything else `HarnessOptions` grows.
|
|
144
|
+
*
|
|
145
|
+
* ```ts
|
|
146
|
+
* harness: ({ storage, context }) =>
|
|
147
|
+
* Harness.open(storage, { models, registry }, context)
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
type PiHarnessFactory = (
|
|
151
|
+
context: PiHarnessContext
|
|
152
|
+
) => Harness | Promise<Harness>;
|
|
153
|
+
/**
|
|
154
|
+
* Applied to a session the first time it is created. Without a model, a
|
|
155
|
+
* session's generation fails as unanswered until `session.setModel` sets one.
|
|
156
|
+
*/
|
|
157
|
+
type PiSessionDefaults = {
|
|
158
|
+
/** Model for new sessions. Change one session's with `session.setModel`. */ readonly model?: ModelRef;
|
|
159
|
+
readonly thinkingLevel?: ModelThinkingLevel /** pi's generation retries for new sessions. */;
|
|
160
|
+
readonly retry?: ConversationRetryPolicy;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* How long the wake waits and when it hands a wait to the alarm. Defaults
|
|
164
|
+
* suit a real deployment; a test shortens them so a suite does not sit on
|
|
165
|
+
* the real heartbeat.
|
|
166
|
+
*/
|
|
167
|
+
type PiWakeTiming = {
|
|
168
|
+
/** A pi wait further away than this goes to the alarm. Default 60_000. */ readonly sleepThresholdMs?: number /** Longest one wake waits inside an alarm. Default 600_000. */;
|
|
169
|
+
readonly waitBudgetMs?: number /** Heartbeat while waiting, and the re-check for background work. Default 30_000. */;
|
|
170
|
+
readonly heartbeatMs?: number;
|
|
171
|
+
};
|
|
172
|
+
/** `PiHarness`'s options. Only `harness`, which opens pi, is required. */
|
|
173
|
+
type PiHarnessOptions = {
|
|
174
|
+
/** Opens pi's `Harness` over the store this object prepared. */ readonly harness: PiHarnessFactory /** Applied to new sessions. */;
|
|
175
|
+
readonly defaults?: PiSessionDefaults;
|
|
176
|
+
readonly store?: PiSessionStoreOptions;
|
|
177
|
+
readonly timing?: PiWakeTiming;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* pi-durable hosted in a Durable Object, behind a small harness interface:
|
|
181
|
+
* `harness.prompt()`, `harness.sessions`, `harness.session(id)`. How a session reaches a
|
|
182
|
+
* client (sockets, SSE, RPC) is the host's glue, built on `session.events()`.
|
|
183
|
+
*
|
|
184
|
+
* pi owns everything about a run: the transcript, the inbox of steers and
|
|
185
|
+
* follow-ups, generation and tool tasks, retries, crash recovery, and the
|
|
186
|
+
* live view. It keeps all of it in its own tables in this object's SQLite
|
|
187
|
+
* database (see `session-store.ts`).
|
|
188
|
+
*
|
|
189
|
+
* What pi cannot do on a Durable Object is wake itself: its scheduler runs
|
|
190
|
+
* in memory, and an evicted object has no memory. The harness is that wake,
|
|
191
|
+
* with one Lifecycle job per session. Input goes to pi once, in `submit()`,
|
|
192
|
+
* after the session's job is scheduled. The job waits while pi has live
|
|
193
|
+
* tasks in the session, rescheduling itself as a heartbeat, and completes
|
|
194
|
+
* when there are none. An eviction mid-run leaves the job due, so its alarm
|
|
195
|
+
* restarts the object, pi reopens and resumes its own tasks, and the job
|
|
196
|
+
* waits again.
|
|
197
|
+
*
|
|
198
|
+
* @experimental The API may change between releases.
|
|
199
|
+
*/
|
|
200
|
+
declare class PiHarness extends LifecycleCapability {
|
|
201
|
+
#private;
|
|
202
|
+
readonly sessions: PiSessions;
|
|
203
|
+
constructor(options: PiHarnessOptions);
|
|
204
|
+
onStart(_context: CapabilityStartContext): Promise<void>;
|
|
205
|
+
onJob(context: LifecycleJobContext): Promise<LifecycleJobOutcome | void>;
|
|
206
|
+
/** Close pi's in-memory resources. Durable state is untouched. */
|
|
207
|
+
dispose(): Promise<void>;
|
|
208
|
+
/** A handle on one session. No I/O until you call it. */
|
|
209
|
+
session(id?: PiSessionId): PiSession;
|
|
210
|
+
/** Submit a prompt and wait for its answer. */
|
|
211
|
+
prompt(
|
|
212
|
+
input: UserInput,
|
|
213
|
+
options?: PiSubmitOptions
|
|
214
|
+
): Promise<PiPromptResponse>;
|
|
215
|
+
/** Durably submit a prompt. Resolves before the model runs. */
|
|
216
|
+
submit(input: UserInput, options?: PiSubmitOptions): Promise<PiReceipt>;
|
|
217
|
+
/** Stop one operation, or everything running in a session. */
|
|
218
|
+
abort(
|
|
219
|
+
options?: PiSessionOptions & {
|
|
220
|
+
readonly operationId?: string;
|
|
221
|
+
}
|
|
222
|
+
): Promise<boolean>;
|
|
223
|
+
wait(
|
|
224
|
+
operationId: string,
|
|
225
|
+
options?: PiSessionOptions & {
|
|
226
|
+
readonly signal?: AbortSignal;
|
|
227
|
+
}
|
|
228
|
+
): Promise<PiOperationResult>;
|
|
229
|
+
/** The session's active transcript, as pi's entries. */
|
|
230
|
+
messages(options?: PiSessionOptions): Promise<EntryRecord[]>;
|
|
231
|
+
/** Submissions pi has not settled yet, oldest first. */
|
|
232
|
+
pending(options?: PiSessionOptions): Promise<PiPendingOperation[]>;
|
|
233
|
+
/** The opened pi Harness, for anything the interface does not cover. */
|
|
234
|
+
pi(): Promise<Harness>;
|
|
235
|
+
/** @internal */
|
|
236
|
+
conversation(session: PiSessionId): Promise<Conversation>;
|
|
237
|
+
/** @internal */
|
|
238
|
+
storage(): Promise<SqliteStorage>;
|
|
239
|
+
/** @internal Configure a new session like the root. */
|
|
240
|
+
initSession(tx: Tx, id: ConversationId): Promise<void>;
|
|
241
|
+
/** @internal */
|
|
242
|
+
enqueue(
|
|
243
|
+
session: PiSessionId,
|
|
244
|
+
input: UserInput,
|
|
245
|
+
options: PiSubmitOptions
|
|
246
|
+
): Promise<PiReceipt>;
|
|
247
|
+
/** @internal Withdraw a queued input, or abort the run it joined. */
|
|
248
|
+
withdraw(session: PiSessionId, operationId: string): Promise<boolean>;
|
|
249
|
+
/** @internal Wait for pi to settle an operation, by its request id. */
|
|
250
|
+
settled(
|
|
251
|
+
session: PiSessionId,
|
|
252
|
+
operationId: string,
|
|
253
|
+
signal?: AbortSignal
|
|
254
|
+
): Promise<PiOperationResult>;
|
|
255
|
+
}
|
|
256
|
+
/** One pi conversation, addressed through the harness. */
|
|
257
|
+
declare class PiSession {
|
|
258
|
+
#private;
|
|
259
|
+
readonly id: PiSessionId;
|
|
260
|
+
constructor(harness: PiHarness, id: PiSessionId);
|
|
261
|
+
/** Durably submit a prompt. Resolves before the model runs. */
|
|
262
|
+
submit(input: UserInput, options?: PiSubmitOptions): Promise<PiReceipt>;
|
|
263
|
+
/** Submit and wait for the answer and the updated transcript. */
|
|
264
|
+
prompt(
|
|
265
|
+
input: UserInput,
|
|
266
|
+
options?: PiSubmitOptions
|
|
267
|
+
): Promise<PiPromptResponse>;
|
|
268
|
+
/** Join the running work after its current tool round. */
|
|
269
|
+
steer(
|
|
270
|
+
input: UserInput,
|
|
271
|
+
options?: Omit<PiSubmitOptions, "whenBusy">
|
|
272
|
+
): Promise<PiReceipt>;
|
|
273
|
+
/** Wait for an operation to settle. Aborting `signal` stops only the wait. */
|
|
274
|
+
wait(operationId: string, signal?: AbortSignal): Promise<PiOperationResult>;
|
|
275
|
+
/**
|
|
276
|
+
* Withdraw one queued operation (or abort the run it joined), or, with no
|
|
277
|
+
* id, abort the session: pi withdraws queued inputs and aborts the
|
|
278
|
+
* running work.
|
|
279
|
+
*/
|
|
280
|
+
abort(operationId?: string): Promise<boolean>;
|
|
281
|
+
/** Start a new context, optionally from a handoff note. */
|
|
282
|
+
reset(handoff?: string): Promise<void>;
|
|
283
|
+
setModel(model: ModelRef): Promise<void>;
|
|
284
|
+
/** The active transcript, as pi's entries since the newest reset. */
|
|
285
|
+
messages(): Promise<EntryRecord[]>;
|
|
286
|
+
/** pi's agent events for this session: a snapshot, then one batch per commit. */
|
|
287
|
+
events(context?: Context$1): Promise<AgentEventStream>;
|
|
288
|
+
busy(): Promise<boolean>;
|
|
289
|
+
}
|
|
290
|
+
/** Every pi conversation in this object. */
|
|
291
|
+
declare class PiSessions {
|
|
292
|
+
#private;
|
|
293
|
+
constructor(harness: PiHarness);
|
|
294
|
+
get(id: PiSessionId): PiSession;
|
|
295
|
+
/** A new top-level session, configured like the root. */
|
|
296
|
+
create(): Promise<PiSession>;
|
|
297
|
+
/** A new session that sees `from`'s history up to its newest entry. */
|
|
298
|
+
fork(from: PiSessionId): Promise<PiSession>;
|
|
299
|
+
/**
|
|
300
|
+
* Every conversation, including ones subagent tools own. Read from pi's
|
|
301
|
+
* storage directly: the Harness has no conversation listing.
|
|
302
|
+
*/
|
|
303
|
+
list(): Promise<PiSessionInfo[]>;
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/harnesses/pi/skills.d.ts
|
|
307
|
+
/** Skills resolved from `agents/skills` sources for one process lifetime. */
|
|
308
|
+
type ResolvedSkills = {
|
|
309
|
+
/** Changes when any source's fingerprint changes. */ readonly fingerprint: string /** Model-facing activation tools; empty when there are no skills. */;
|
|
310
|
+
readonly tools: readonly ToolRegistration[] /** System-prompt catalog, or null when there are no skills. */;
|
|
311
|
+
readonly catalog: string | null;
|
|
312
|
+
readonly warnings: readonly string[];
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Register `agents/skills` sources on a pi registry: the activation tools
|
|
316
|
+
* and a "skills" system prompt section. Resolution reads the sources, so a
|
|
317
|
+
* host awaits this in its `harness` factory, before `Harness.open`.
|
|
318
|
+
*/
|
|
319
|
+
declare function addSkills(
|
|
320
|
+
registry: Registry,
|
|
321
|
+
sources: readonly SkillSource[]
|
|
322
|
+
): Promise<ResolvedSkills>;
|
|
323
|
+
//#endregion
|
|
324
|
+
export {
|
|
325
|
+
PiHarness,
|
|
326
|
+
type PiHarnessContext,
|
|
327
|
+
type PiHarnessFactory,
|
|
328
|
+
type PiHarnessOptions,
|
|
329
|
+
type PiOperationResult,
|
|
330
|
+
type PiPendingOperation,
|
|
331
|
+
type PiPromptResponse,
|
|
332
|
+
type PiReceipt,
|
|
333
|
+
PiSession,
|
|
334
|
+
type PiSessionDefaults,
|
|
335
|
+
type PiSessionId,
|
|
336
|
+
type PiSessionInfo,
|
|
337
|
+
type PiSessionOptions,
|
|
338
|
+
type PiSessionStoreOptions,
|
|
339
|
+
PiSessions,
|
|
340
|
+
type PiSubmitOptions,
|
|
341
|
+
type PiWakeTiming,
|
|
342
|
+
type PiWhenBusy,
|
|
343
|
+
ROOT_SESSION,
|
|
344
|
+
type ResolvedSkills,
|
|
345
|
+
addSkills,
|
|
346
|
+
openPiSessionStore
|
|
347
|
+
};
|
|
348
|
+
//# sourceMappingURL=index.d.ts.map
|