@qlairoslabs/acp-client 0.9.4 → 0.10.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/CONSUMER_GUIDE.md +176 -5
- package/package.json +4 -2
- package/src/agent-conversation-contracts.ts +15 -0
- package/src/agent-conversation-errors.ts +55 -0
- package/src/agent-conversation-owner.ts +21 -1
- package/src/agent-session.ts +439 -125
- package/src/agent.ts +493 -105
- package/src/audit/config.ts +4 -0
- package/src/audit/projection.ts +11 -0
- package/src/checkpointing/recovery.ts +23 -1
- package/src/checkpointing/strategy.ts +4 -1
- package/src/index.ts +24 -0
- package/src/internal-inference/contracts.ts +12 -1
- package/src/internal-inference/coordination/manager.ts +13 -1
- package/src/metering/engine.ts +13 -0
- package/src/metering/record.ts +33 -1
- package/src/observation/agent-event-bus.ts +154 -0
- package/src/observation/index.ts +8 -0
- package/src/out-of-band-messages.ts +187 -0
- package/src/persistence/backend.ts +46 -1
- package/src/persistence/error-records.ts +104 -0
- package/src/persistence/file-registry-store.ts +11 -0
- package/src/persistence/provider-attachment.ts +46 -0
- package/src/persistence/reducer.ts +16 -3
- package/src/persistence/sqlite-conversation-records.ts +38 -0
- package/src/persistence/sqlite-schema.ts +128 -47
- package/src/persistence/state-runtime.ts +7 -0
- package/src/persistence/transcript-runtime.ts +21 -0
package/CONSUMER_GUIDE.md
CHANGED
|
@@ -95,6 +95,14 @@ Reopen the same database with `Agent.open()` and call
|
|
|
95
95
|
`Agent.close()` interrupts live prompts and waits for their finalization and queued
|
|
96
96
|
conversation writes before closing the SQLite backend; an interrupted prompt may reject.
|
|
97
97
|
|
|
98
|
+
A newly created conversation may expose `conversation.internalSessionId` immediately, but
|
|
99
|
+
the provider attachment is retained only in memory until its first completed provider turn.
|
|
100
|
+
If the conversation stops before then, reopening the durable `agc-*` conversation creates a
|
|
101
|
+
fresh provider thread. After a completed turn, the provider mapping becomes the continuation
|
|
102
|
+
candidate used by `open()`; successfully loading it does not create another history row.
|
|
103
|
+
This is a local evidence threshold, not a guarantee that the harness will keep the provider
|
|
104
|
+
session loadable forever.
|
|
105
|
+
|
|
98
106
|
### Attach consumer data to a prompt message
|
|
99
107
|
|
|
100
108
|
The object-form prompt APIs attach opaque JSON to the submitted **user message**:
|
|
@@ -205,13 +213,13 @@ earlier position when its first revision arrives. Configuration, protocol, agent
|
|
|
205
213
|
actions, and metering references remain individual records unless they have an
|
|
206
214
|
explicit logical identity; metering details are read from `persistence.metering`.
|
|
207
215
|
|
|
208
|
-
For live reconciliation, subscribe before the initial read if
|
|
209
|
-
matters, but treat
|
|
210
|
-
`records.list(conversation.id, { afterSequence: lastSeenSequence, limit: 100 })`.
|
|
216
|
+
For live reconciliation, subscribe to `agent.events` (see below) before the initial read if
|
|
217
|
+
immediate UI feedback matters, but treat live notifications as hints. The authoritative
|
|
218
|
+
catch-up is `records.list(conversation.id, { afterSequence: lastSeenSequence, limit: 100 })`.
|
|
211
219
|
Advance `lastSeenSequence` to the last returned record and repeat until the page is
|
|
212
220
|
short. Upsert by `recordId` through `reconcileConversationTimeline`; after a process
|
|
213
|
-
restart, catch up from the last sequence the consumer retained.
|
|
214
|
-
|
|
221
|
+
restart, catch up from the last sequence the consumer retained. Process-local notification
|
|
222
|
+
counters are **not** SQLite conversation sequences.
|
|
215
223
|
|
|
216
224
|
Use one batched preview read for a conversation list:
|
|
217
225
|
|
|
@@ -234,6 +242,142 @@ revision per logical message; `records.list()` and `records.listRecent()` retain
|
|
|
234
242
|
physical revisions for timeline reconstruction and audit. `listRecent` and `listPreviews` are SQLite
|
|
235
243
|
capabilities; custom persistence backends may not implement them.
|
|
236
244
|
|
|
245
|
+
### Live committed-record events
|
|
246
|
+
|
|
247
|
+
`agent.events` is a process-local stream of canonical conversation records, published only
|
|
248
|
+
after the transaction that wrote them commits. It is not durable and has no replay: it is
|
|
249
|
+
the live half of the same stream `records.list()` returns, so a UI can render immediately
|
|
250
|
+
and still reconcile against SQLite.
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
const unsubscribe = agent.events.subscribe((notification) => {
|
|
254
|
+
const record = notification.event.record; // the exact persisted record
|
|
255
|
+
applyToTimeline(record); // upsert by recordId, as a reload would
|
|
256
|
+
}, {
|
|
257
|
+
conversationIds: [conversation.id],
|
|
258
|
+
recordKinds: ["message", "tool_call", "permission", "activity"],
|
|
259
|
+
});
|
|
260
|
+
// later:
|
|
261
|
+
unsubscribe();
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Each event carries the record's stable `recordId` and conversation `sequence`. Evolving
|
|
265
|
+
records (streaming messages, tool calls, activities, thinking) emit one event per physical
|
|
266
|
+
revision, so reconcile by the same logical identity a reload uses.
|
|
267
|
+
`notification.deliverySequence` orders live events for one process but is not a durable
|
|
268
|
+
cursor.
|
|
269
|
+
|
|
270
|
+
Bootstrap without losing events: subscribe first, buffer, read history, then deduplicate by
|
|
271
|
+
`recordId`:
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
const pending: ConversationRecord[] = [];
|
|
275
|
+
const unsubscribe = agent.events.subscribe(({ event }) => pending.push(event.record), {
|
|
276
|
+
conversationIds: [conversation.id],
|
|
277
|
+
});
|
|
278
|
+
const page = await agent.persistence.records.listRecent!(conversation.id, { limit: 50 });
|
|
279
|
+
let items = reconcileConversationTimeline([], [...page.records, ...pending]);
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
After a restart or a missed window, catch up from SQLite with
|
|
283
|
+
`records.list(conversation.id, { afterSequence: lastSeenSequence })`. Filters are fixed for
|
|
284
|
+
the life of a subscription: omitting a list selects everything, an empty list selects
|
|
285
|
+
nothing, and an unknown `recordKinds` value throws at subscribe time. Filtering never
|
|
286
|
+
changes capture, audit, persistence, or another subscriber. A subscriber that throws is
|
|
287
|
+
logged and ignored; it cannot fail the operation that produced the record.
|
|
288
|
+
|
|
289
|
+
`agent.events` reports committed records only. Provisional live data — response chunks,
|
|
290
|
+
turn and state changes, handoff progress — still arrives through the prompt handlers and
|
|
291
|
+
`conversation.subscribe()`. A record may appear in both at different stages: a tool update
|
|
292
|
+
first streams provisionally, then arrives as a committed `tool_call`. Detached
|
|
293
|
+
`AgentConversation` instances without an owning `Agent` are outside this bus, and a
|
|
294
|
+
consumer-direct `persistence.records.append()` is not observed.
|
|
295
|
+
|
|
296
|
+
### Conversation error records
|
|
297
|
+
|
|
298
|
+
Important runtime failures are stored as an immutable `error` record in the same ordered
|
|
299
|
+
timeline as messages, activities, and metering references — and delivered live through
|
|
300
|
+
`agent.events`. An error is a system timeline item, not a message:
|
|
301
|
+
|
|
302
|
+
```ts
|
|
303
|
+
const errors = (await agent.persistence.records.list(conversation.id, {
|
|
304
|
+
kinds: ["error"],
|
|
305
|
+
})).records;
|
|
306
|
+
|
|
307
|
+
for (const record of errors) {
|
|
308
|
+
if (record.kind !== "error") continue;
|
|
309
|
+
// record.source, record.code, record.recoverability, record.message
|
|
310
|
+
// record.operationId / transitionId / internalSessionId correlate it with the failure
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
`source` is one of `provider_session`, `transport`, `operation`, `recovery`. `code` is an
|
|
315
|
+
open string; the library exports `CONVERSATION_ERROR_CODES` for the codes it owns and
|
|
316
|
+
readers must tolerate unknown future values. `recoverability` describes the failed
|
|
317
|
+
operation, not a promise:
|
|
318
|
+
|
|
319
|
+
- `retryable` — repeating the same action may succeed.
|
|
320
|
+
- `recoverable` — another action (checkpoint recovery, a fresh provider session) may
|
|
321
|
+
continue the logical conversation.
|
|
322
|
+
- `terminal` — the library knows of no supported continuation.
|
|
323
|
+
- `unknown` — evidence is insufficient to choose.
|
|
324
|
+
|
|
325
|
+
`message` is a sanitized display fallback; it never carries a stack trace, credentials, a
|
|
326
|
+
prompt, environment values, or a raw provider payload. At raw capture, allow-listed
|
|
327
|
+
provider detail is available in `details`. Canonical capture defaults to
|
|
328
|
+
`capture.error = "content"` (metadata drops the message; `none` stores nothing); the audit
|
|
329
|
+
destination has its own independent `auditLog.capture.error`.
|
|
330
|
+
|
|
331
|
+
A failed `conversations.open()` throws `ProviderSessionError` instead of returning a
|
|
332
|
+
conversation. It carries the same `code`, `attemptId`, `recoverability`, and — when
|
|
333
|
+
canonical capture accepted it — `recordId` as the durable row, plus
|
|
334
|
+
`agentConversationId` (always, even for a generated id) so the caller can find the
|
|
335
|
+
conversation. If writing the record also fails, that failure is attached as
|
|
336
|
+
`recordingError` and the provider diagnosis stays primary. The failed provider mapping is
|
|
337
|
+
kept as evidence and is not deleted; recovery or a future fresh-session operation
|
|
338
|
+
supersedes it. A `session/load` failure that is recoverable and has a usable checkpoint
|
|
339
|
+
still recovers, with the error recorded before the recovery action.
|
|
340
|
+
|
|
341
|
+
### Append an assistant message without a turn
|
|
342
|
+
|
|
343
|
+
`conversations.appendAssistantMessage()` adds a completed assistant message the provider
|
|
344
|
+
did not produce — for example, a notification the agent sends from another channel. It
|
|
345
|
+
runs no turn and needs no live provider session:
|
|
346
|
+
|
|
347
|
+
```ts
|
|
348
|
+
const record = await agent.conversations.appendAssistantMessage(conversation.id, {
|
|
349
|
+
text: "Your build finished; 3 tests failed.",
|
|
350
|
+
consumerMetadata: { kind: "send_message_to_user" },
|
|
351
|
+
});
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
The record is an ordinary `message` with `role: "assistant"` and `status: "completed"`,
|
|
355
|
+
published on `agent.events` and returned by history reads like any other message. Its
|
|
356
|
+
envelope `metadata` carries `origin: "out_of_band"` (exported as
|
|
357
|
+
`OUT_OF_BAND_MESSAGE_ORIGIN`; `isOutOfBandMessage(record)` tests it), so readers and
|
|
358
|
+
audits can tell it apart from provider output.
|
|
359
|
+
|
|
360
|
+
The provider learns about it on the conversation's next turn. That turn's provider text
|
|
361
|
+
carries every out-of-band message appended since the user message of the last completed
|
|
362
|
+
turn, in a `<messages-you-sent>` block between any identity preamble and
|
|
363
|
+
`<current-message>`. Only the user's own text is persisted as the user message. Rules:
|
|
364
|
+
|
|
365
|
+
- A failed turn does not count as delivery; the next turn carries the messages again.
|
|
366
|
+
- A message appended while a turn is running reaches the provider on the following turn.
|
|
367
|
+
- A recovery seed covers messages through `recoveredThroughSequence`, so they are not
|
|
368
|
+
repeated after recovery. A loaded provider session is treated like one that never
|
|
369
|
+
closed.
|
|
370
|
+
- A turn that completes without an assistant message does not advance delivery, so its
|
|
371
|
+
pending messages are repeated once more.
|
|
372
|
+
- The block is capped at `OUT_OF_BAND_PROMPT_MAX_CHARS`; the oldest messages are dropped
|
|
373
|
+
first with an omission note. The transcript always keeps all of them.
|
|
374
|
+
|
|
375
|
+
Other conversations of the same agent see the message through identity like any other
|
|
376
|
+
canonical message. Appending requires `capture.message` of `"content"` or `"raw"`, since
|
|
377
|
+
the provider could not be told otherwise; it rejects blank text and unknown or deleted
|
|
378
|
+
conversations. Backends without `records.listRecent` scan the conversation's messages
|
|
379
|
+
forward to find the last completed turn.
|
|
380
|
+
|
|
237
381
|
### Agent audit log
|
|
238
382
|
|
|
239
383
|
An SQLite-backed `Agent` can copy selected observations into an independently located,
|
|
@@ -1030,6 +1174,33 @@ V0 handoff uses the current adapter. The default summary-generation and new-thre
|
|
|
1030
1174
|
introduction prompts are library-defined, and introduction is an ordinary user prompt
|
|
1031
1175
|
because ACP has no portable system-prompt field.
|
|
1032
1176
|
|
|
1177
|
+
### Provider attachment
|
|
1178
|
+
|
|
1179
|
+
A newly created provider thread is not selected for a later open until a provider turn has
|
|
1180
|
+
completed on it. Until then the running process uses it, but a restart returns to the
|
|
1181
|
+
previous thread — or, for a conversation that never had one, starts fresh.
|
|
1182
|
+
|
|
1183
|
+
`HandoffResult.providerAttachment` reports which of those a transition produced:
|
|
1184
|
+
|
|
1185
|
+
```ts
|
|
1186
|
+
handoff.providerAttachment === "recorded"; // a turn completed on the target
|
|
1187
|
+
reset.providerAttachment === "runtime_only"; // live on the target, not yet selected
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
A promptless `reset()` has no turn to confirm its target, so it reports `runtime_only` and
|
|
1191
|
+
the previous thread stays the restart fallback until the next completed prompt. This
|
|
1192
|
+
describes local state only; it never claims the provider will still accept the session.
|
|
1193
|
+
|
|
1194
|
+
`providerAttachment` is a required field, so code that constructs a `HandoffResult` value
|
|
1195
|
+
itself — rather than consuming one — needs updating. `AgentSessionHandoffError` gained
|
|
1196
|
+
`fromInternalSessionId`, `toInternalSessionId`, `providerAttachment`, `activationCompleted`,
|
|
1197
|
+
`summary` and `targetResult`; `activationCompleted` distinguishes a target prompt that
|
|
1198
|
+
failed after the target was already selected from a transition that never reached one.
|
|
1199
|
+
|
|
1200
|
+
Because a transition keeps its source alive until the target is confirmed, both
|
|
1201
|
+
same-adapter and cross-adapter transitions now run a second provider process for the
|
|
1202
|
+
duration of the transition.
|
|
1203
|
+
|
|
1033
1204
|
## Harness configuration and commands
|
|
1034
1205
|
|
|
1035
1206
|
ACP configuration is available through the stable session:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qlairoslabs/acp-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Embeddable Agent Client Protocol (ACP) client library with degraded PTY fallback.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "src/index.ts",
|
|
@@ -58,7 +58,9 @@
|
|
|
58
58
|
"check": "bun run typecheck && bun test",
|
|
59
59
|
"pack:dry": "bun pm pack --dry-run",
|
|
60
60
|
"generate:pricing": "bun run scripts/generate-pricing-catalog.ts",
|
|
61
|
-
"pricing:list": "bun run scripts/list-pricing.ts"
|
|
61
|
+
"pricing:list": "bun run scripts/list-pricing.ts",
|
|
62
|
+
"adapters:check": "bun run scripts/adapters.ts",
|
|
63
|
+
"adapters:update": "bun run scripts/adapters.ts --update"
|
|
62
64
|
},
|
|
63
65
|
"engines": {
|
|
64
66
|
"bun": ">=1.3.5"
|
|
@@ -81,6 +81,13 @@ export interface ContinuationReport {
|
|
|
81
81
|
readonly activeInternalSessionId: string;
|
|
82
82
|
readonly transitionId: string;
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* The conversation had never selected a provider thread, so a fresh one was started.
|
|
86
|
+
*
|
|
87
|
+
* Distinct from `reconstructed`: nothing was continued because no provider turn had
|
|
88
|
+
* ever completed on a thread this conversation recorded.
|
|
89
|
+
*/
|
|
90
|
+
| { readonly kind: "fresh"; readonly activeInternalSessionId: string }
|
|
84
91
|
| { readonly kind: "unavailable" };
|
|
85
92
|
}
|
|
86
93
|
|
|
@@ -179,6 +186,14 @@ export interface HandoffResult {
|
|
|
179
186
|
readonly summary: string;
|
|
180
187
|
/** Result of `targetPrompt`, when one was supplied. */
|
|
181
188
|
readonly targetResult?: PromptResult;
|
|
189
|
+
/**
|
|
190
|
+
* Whether the target was selected locally as the next open's continuation candidate.
|
|
191
|
+
*
|
|
192
|
+
* `runtime_only` means the running process is on the target but no provider turn has yet
|
|
193
|
+
* justified recording it, so a restart returns to the previous attachment. This reports
|
|
194
|
+
* local lifecycle state; it never claims the provider will still accept the session.
|
|
195
|
+
*/
|
|
196
|
+
readonly providerAttachment: "runtime_only" | "recorded";
|
|
182
197
|
/** One record per token-consuming operation the handoff performed, in order. */
|
|
183
198
|
readonly meteringRecords: readonly OperationMeteringRecord[];
|
|
184
199
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { AgentConversationId, AgentSessionId } from "./agent-ids.ts";
|
|
2
|
+
import type {
|
|
3
|
+
ConversationErrorRecoverability,
|
|
4
|
+
ConversationErrorSource,
|
|
5
|
+
} from "./persistence/backend.ts";
|
|
1
6
|
import type { ContinuationReport, PromptBlocker } from "./agent-conversation-contracts.ts";
|
|
2
7
|
|
|
3
8
|
export class AgentSessionPromptBlockedError extends Error {
|
|
@@ -29,3 +34,53 @@ export class DirectAuditPersistenceUnsupportedError extends Error {
|
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
36
|
|
|
37
|
+
export interface ProviderSessionErrorDetails {
|
|
38
|
+
readonly agentSessionId: AgentSessionId;
|
|
39
|
+
readonly agentConversationId: AgentConversationId;
|
|
40
|
+
/** Stable identity of the failed open invocation; `${attemptId}:error` is its record id. */
|
|
41
|
+
readonly attemptId: string;
|
|
42
|
+
readonly internalSessionId?: string;
|
|
43
|
+
readonly code: string;
|
|
44
|
+
readonly source: ConversationErrorSource;
|
|
45
|
+
readonly recoverability: ConversationErrorRecoverability;
|
|
46
|
+
/** Present only when canonical capture accepted the durable error record. */
|
|
47
|
+
readonly recordId?: string;
|
|
48
|
+
/** Set when writing the durable record also failed; the provider cause stays primary. */
|
|
49
|
+
readonly recordingError?: Error;
|
|
50
|
+
/** Safe display fallback; the durable record carries the same text. */
|
|
51
|
+
readonly message?: string;
|
|
52
|
+
readonly cause?: unknown;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A provider session could not be created or loaded, and the operation could not return a
|
|
57
|
+
* live conversation. The immediate exception and the durable error record share the same
|
|
58
|
+
* code, attempt id, and recoverability; the record id is present only when canonical capture
|
|
59
|
+
* accepted the row.
|
|
60
|
+
*/
|
|
61
|
+
export class ProviderSessionError extends Error {
|
|
62
|
+
readonly agentSessionId: AgentSessionId;
|
|
63
|
+
readonly agentConversationId: AgentConversationId;
|
|
64
|
+
readonly attemptId: string;
|
|
65
|
+
readonly internalSessionId?: string;
|
|
66
|
+
readonly code: string;
|
|
67
|
+
readonly source: ConversationErrorSource;
|
|
68
|
+
readonly recoverability: ConversationErrorRecoverability;
|
|
69
|
+
readonly recordId?: string;
|
|
70
|
+
readonly recordingError?: Error;
|
|
71
|
+
|
|
72
|
+
constructor(details: ProviderSessionErrorDetails) {
|
|
73
|
+
super(details.message ?? "The provider session could not be loaded.", { cause: details.cause });
|
|
74
|
+
this.name = "ProviderSessionError";
|
|
75
|
+
this.agentSessionId = details.agentSessionId;
|
|
76
|
+
this.agentConversationId = details.agentConversationId;
|
|
77
|
+
this.attemptId = details.attemptId;
|
|
78
|
+
if (details.internalSessionId !== undefined) this.internalSessionId = details.internalSessionId;
|
|
79
|
+
this.code = details.code;
|
|
80
|
+
this.source = details.source;
|
|
81
|
+
this.recoverability = details.recoverability;
|
|
82
|
+
if (details.recordId !== undefined) this.recordId = details.recordId;
|
|
83
|
+
if (details.recordingError !== undefined) this.recordingError = details.recordingError;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
@@ -7,6 +7,10 @@ import type { ResponseMessage } from "./types.ts";
|
|
|
7
7
|
import type { OperationMeteringRecord } from "./metering/record.ts";
|
|
8
8
|
import type { AgentSessionMeteringState } from "./metering/state.ts";
|
|
9
9
|
import type { IdentityDeliveryReceipt } from "./identity.ts";
|
|
10
|
+
import type {
|
|
11
|
+
ProviderAttachmentCommitAcknowledgement,
|
|
12
|
+
ProviderAttachmentState,
|
|
13
|
+
} from "./persistence/provider-attachment.ts";
|
|
10
14
|
|
|
11
15
|
export interface OwnedPromptInput {
|
|
12
16
|
readonly operationId: string;
|
|
@@ -27,6 +31,22 @@ export interface OwnedPromptPreparation {
|
|
|
27
31
|
export interface OwnedPromptCompleted extends OwnedPromptInput {
|
|
28
32
|
readonly result: AgentSessionPromptResult;
|
|
29
33
|
readonly identityDeliveryReceipt?: IdentityDeliveryReceipt;
|
|
34
|
+
readonly providerAttachment: ProviderAttachmentState;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface OwnedPromptCommitResult {
|
|
38
|
+
readonly providerAttachment?: ProviderAttachmentCommitAcknowledgement;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @internal Indicates that the local prompt commit succeeded but a follow-up hook failed. */
|
|
42
|
+
export class OwnedPromptPostCommitError extends Error {
|
|
43
|
+
constructor(
|
|
44
|
+
readonly commit: OwnedPromptCommitResult,
|
|
45
|
+
cause: unknown,
|
|
46
|
+
) {
|
|
47
|
+
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
48
|
+
this.name = "OwnedPromptPostCommitError";
|
|
49
|
+
}
|
|
30
50
|
}
|
|
31
51
|
|
|
32
52
|
export interface OwnedPromptFailed extends OwnedPromptInput {
|
|
@@ -37,7 +57,7 @@ export interface OwnedPromptFailed extends OwnedPromptInput {
|
|
|
37
57
|
/** @internal Agent-owned persistence and identity boundary for a conversation turn. */
|
|
38
58
|
export interface AgentConversationOwnerLifecycle {
|
|
39
59
|
beforePrompt(input: OwnedPromptInput): Promise<OwnedPromptPreparation>;
|
|
40
|
-
afterPrompt(input: OwnedPromptCompleted): Promise<void>;
|
|
60
|
+
afterPrompt(input: OwnedPromptCompleted): Promise<OwnedPromptCommitResult | void>;
|
|
41
61
|
promptFailed(input: OwnedPromptFailed): Promise<void>;
|
|
42
62
|
/** Durably commit one normalized operation record and its bounded next state. */
|
|
43
63
|
meteringRecorded?(record: OperationMeteringRecord): Promise<void>;
|