@rivus/agent 0.11.0 → 0.12.4

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/README.md CHANGED
@@ -911,7 +911,7 @@ const daemon = createFeishuAgentDaemon({
911
911
  });
912
912
  ```
913
913
 
914
- The daemon converts Feishu text and rich-text Post messages into prompt commands, preferring Post `content_v2` and flattening its textual paragraphs. It consumes harness `AgentRunUpdate` values and emits `update_text`, `finish`, `fail`, or `cancel` actions from projected run state. It accepts `/new` and `/reset` to advance a persisted session generation for the current Feishu conversation, so the next prompt starts with a fresh transcript; `/new /skill:<name> ...` combines the reset and the first prompt. The reset command replies with a short confirmation and does not invoke the model. It also accepts `/cancel <runId>` as a daemon command; the intake attaches the message's stable `sessionKey`, and the daemon calls `harness.forSession(sessionKey).cancelRun(runId, "Feishu cancel command")` so a cancel message from another chat cannot cancel the active run. `/cancel` without an exact run id is rejected at intake instead of being sent to the model. `card.action.trigger` can cancel through the same exact path or resolve a persisted Human Interaction using only the trusted Feishu operator identity. Card-action tokens are process-locally deduplicated. Interaction decisions are persisted before the callback returns a toast and updated raw card; resolved cards contain no stale buttons. `prepareRun` is called on `agent_run_accepted`, before any stream action is published, so adapters can create a card and bind `runId` to `{ cardId, elementId }`. Publish effects are awaited in update order, and terminal publication replaces the entire card with a completed, failed, or cancelled projection. When daemon-level `dedupe` is enabled, a failed run releases its message-id marker so a retried delivery can run again; runtime-level queues treat `AgentRunCancelled` as terminal and do not retry cancelled messages.
914
+ The daemon converts Feishu text and rich-text Post messages into prompt commands, preferring Post `content_v2` and flattening its textual paragraphs. It consumes harness `AgentRunUpdate` values and emits `update_text`, `finish`, `fail`, or `cancel` actions from projected run state. It accepts `/new` and `/reset` to stop any active run in the same conversation and advance a persisted session generation, so the next prompt starts with a fresh transcript; `/new /skill:<name> ...` combines the reset and the first prompt. A bare reset replies immediately and does not invoke the model. `/cancel` immediately cancels the active run in the current Feishu session, while `/cancel <runId>` keeps the stale-safe exact form used by running cards and callbacks. Both forms bypass the durable prompt queue, remain session-bound, and reply with an explicit stopped/no-active acknowledgement. `card.action.trigger` can cancel through the same exact path or resolve a persisted Human Interaction using only the trusted Feishu operator identity. Card-action tokens are process-locally deduplicated. Interaction decisions are persisted before the callback returns a toast and updated raw card; resolved cards contain no stale buttons. `prepareRun` is called on `agent_run_accepted`, before any stream action is published, so adapters can create a card and bind `runId` to `{ cardId, elementId }`. Publish effects are awaited in update order, and terminal publication replaces the entire card with a completed, failed, or cancelled projection. When daemon-level `dedupe` is enabled, a failed run releases its message-id marker so a retried delivery can run again; runtime-level queues treat `AgentRunCancelled` as terminal and do not retry cancelled messages.
915
915
 
916
916
  For Feishu's 3-second event handling requirement, put a queue in front of the daemon:
917
917
 
@@ -926,7 +926,7 @@ await Effect.runPromise(queue.accept(payload)); // return/ack quickly
926
926
  await Effect.runPromise(queue.drainOne()); // run agent work outside the ack path
927
927
  ```
928
928
 
929
- For the Feishu Node SDK, register the handler map returned by `createFeishuEventHandlers({ queue, cardActions })` and keep worker draining outside the SDK callback. Subscribe to both `im.message.receive_v1` and `card.action.trigger` when using interactive run or Human Interaction cards. The callback handler returns Feishu response JSON rather than the daemon's internal result; Human Interaction responses include both `toast` and `{ card: { type: "raw", data } }` so the clicked card reaches its terminal projection immediately.
929
+ For the Feishu Node SDK, register the handler map returned by `createFeishuEventHandlers({ queue, cardActions })` and keep worker draining outside the SDK callback. An HTTP webhook can subscribe to both `im.message.receive_v1` and `card.action.trigger`; Feishu's long-connection WebSocket transport supports event subscriptions only, so it cannot deliver card callbacks. Long-connection deployments therefore omit the running-card callback button and show the exact `/cancel <runId>` command instead. The HTTP callback handler returns Feishu response JSON rather than the daemon's internal result; Human Interaction responses include both `toast` and `{ card: { type: "raw", data } }` so the clicked card reaches its terminal projection immediately.
930
930
  If queued message handling fails, `drainOne()` leaves the message pending and fails the effect so the worker loop can report the error and retry on a later pass instead of silently dropping accepted work.
931
931
 
932
932
  For the common local-daemon path, use the runtime factory to keep that wiring in one place:
@@ -1071,7 +1071,7 @@ const bootstrap = await Effect.runPromise(
1071
1071
  );
1072
1072
  ```
1073
1073
 
1074
- The configured preparation helper creates a blue streaming CardKit entity, replies to the inbound Feishu message, and binds the run to the card target before any stream action is published. The running card includes a “Stop generating” button carrying `{ rivus_action: "cancel_run", run_id, session_key }`; completed, failed, and cancelled cards remove it. The configured publisher coalesces consecutive `update_text` actions by run, flushes the latest text before a terminal action, and exposes `flush(runId?)` for explicit worker-driven flushing. `createConfiguredRivusDaemonBootstrap` flushes pending text at `config.feishu.streamMinIntervalMs` by default; pass `flushIntervalMs` only to override that cadence. It also adds the event log, history restore helper, status reporter, optional status transport, WebSocket transport, worker loop, and managed process around those same pieces; `restoreConfiguredRivusDaemonBootstrap` first replays that event log as restored harness events so read models and same-session loop input are hydrated after restart. Local tests can use `createInMemoryFeishuCardTargetRegistry`; daemon processes should prefer `createJsonFileFeishuCardTargetRegistry` so run-to-card bindings survive restarts and malformed registry files fail loudly instead of being treated as empty state.
1074
+ The configured preparation helper creates a blue streaming CardKit entity, replies to the inbound Feishu message, and binds the run to the card target before any stream action is published. HTTP-callback deployments may include a “Stop generating” button carrying `{ rivus_action: "cancel_run", run_id, session_key }`; the WebSocket bootstrap omits that callback-only button and shows the exact `/cancel <runId>` command instead. Completed, failed, and cancelled cards remove active controls. The configured publisher coalesces consecutive `update_text` actions by run, flushes the latest text before a terminal action, and exposes `flush(runId?)` for explicit worker-driven flushing. `createConfiguredRivusDaemonBootstrap` flushes pending text at `config.feishu.streamMinIntervalMs` by default; pass `flushIntervalMs` only to override that cadence. It also adds the event log, history restore helper, status reporter, optional status transport, WebSocket transport, worker loop, and managed process around those same pieces; `restoreConfiguredRivusDaemonBootstrap` first replays that event log as restored harness events so read models and same-session loop input are hydrated after restart. Local tests can use `createInMemoryFeishuCardTargetRegistry`; daemon processes should prefer `createJsonFileFeishuCardTargetRegistry` so run-to-card bindings survive restarts and malformed registry files fail loudly instead of being treated as empty state.
1075
1075
 
1076
1076
  ## Design Notes
1077
1077
 
package/dist/acp.d.ts CHANGED
@@ -18,11 +18,15 @@ interface AcpPromptResult {
18
18
  readonly stopReason: string;
19
19
  }
20
20
  interface AcpAgentSession {
21
- cancel(): Promise<void> | void;
21
+ cancel(options?: {
22
+ readonly preserveSession?: boolean;
23
+ }): Promise<void> | void;
22
24
  prompt(text: string, onUpdate: (update: AcpSessionUpdate) => void): Promise<AcpPromptResult>;
23
25
  dispose?(): Promise<void> | void;
26
+ invalidate?(): Promise<void> | void;
24
27
  }
25
28
  interface AcpAgentLoopOptions {
29
+ readonly cancellationSettleTimeoutMs?: number;
26
30
  readonly disposeSessionAfterRun?: boolean;
27
31
  readonly resolveSession: (input: AgentLoopInput) => Promise<AcpAgentSession> | AcpAgentSession;
28
32
  }
@@ -82,6 +86,7 @@ interface AcpSessionRecord {
82
86
  readonly sessionId: string;
83
87
  }
84
88
  interface AcpSessionStore {
89
+ delete(sessionKey: string): Promise<void>;
85
90
  load(sessionKey: string): Promise<AcpSessionRecord | undefined>;
86
91
  save(sessionKey: string, record: AcpSessionRecord): Promise<void>;
87
92
  }
package/dist/acp.js CHANGED
@@ -8,51 +8,128 @@ import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
8
8
  import { dirname } from "node:path";
9
9
  //#region src/infrastructure/acp/acp-agent-loop.ts
10
10
  function createAcpAgentLoop(options) {
11
- return createAsyncIterableAgentLoop({ run: (input) => runAcpSession(input, options) });
11
+ const loop = createAsyncIterableAgentLoop({ run: (input) => runAcpSession(input, options) });
12
+ return {
13
+ run: (input) => loop.run(input),
14
+ supportsSteering: true
15
+ };
12
16
  }
13
17
  async function* runAcpSession(input, options) {
14
18
  const session = await options.resolveSession(input);
15
19
  const updates = [];
16
20
  const tools = /* @__PURE__ */ new Map();
17
21
  let wake;
18
- let completed = false;
19
- let failure;
22
+ let abortCancellation;
23
+ let abortFailure;
24
+ let abortSettled = false;
25
+ let aborted = false;
26
+ let currentTurn = startAcpTurn(input.text, session, input, updates, tools, () => {
27
+ wake?.();
28
+ wake = void 0;
29
+ });
20
30
  const onAbort = () => {
21
- Promise.resolve(session.cancel()).catch((error) => {
22
- failure = error;
23
- completed = true;
31
+ aborted = true;
32
+ abortCancellation ??= settleCancelledTurn(session, currentTurn.promise, options.cancellationSettleTimeoutMs ?? 5e3);
33
+ abortCancellation.then(() => {
34
+ abortSettled = true;
35
+ wake?.();
36
+ wake = void 0;
37
+ }, (error) => {
38
+ abortFailure = error;
24
39
  wake?.();
25
40
  wake = void 0;
26
41
  });
27
42
  };
28
43
  input.abortSignal.addEventListener("abort", onAbort, { once: true });
29
- const prompt = session.prompt(input.text, (update) => {
30
- updates.push(...mapAcpSessionUpdate(update, tools));
31
- wake?.();
32
- wake = void 0;
33
- }).catch((error) => {
34
- if (!input.abortSignal.aborted) failure = error;
35
- }).finally(() => {
36
- completed = true;
37
- wake?.();
38
- wake = void 0;
39
- });
44
+ let steering = input.steering?.next();
40
45
  try {
41
46
  if (input.abortSignal.aborted) onAbort();
42
- while (!completed || updates.length > 0) {
47
+ while (!currentTurn.completed || updates.length > 0) {
48
+ if (abortFailure !== void 0) throw abortFailure;
49
+ if (aborted && abortSettled) break;
43
50
  const event = updates.shift();
44
51
  if (event) yield event;
45
- else await new Promise((resolve) => {
46
- wake = resolve;
47
- });
52
+ else {
53
+ const signal = await Promise.race([
54
+ new Promise((resolve) => {
55
+ wake = () => resolve({ type: "wake" });
56
+ }),
57
+ ...steering ? [steering.then((text) => ({
58
+ text,
59
+ type: "steer"
60
+ }))] : [],
61
+ currentTurn.promise.then(() => ({ type: "turn_completed" }), () => ({ type: "turn_completed" }))
62
+ ]);
63
+ if (signal.type === "steer") {
64
+ await Promise.resolve(session.cancel({ preserveSession: true }));
65
+ await currentTurn.promise;
66
+ currentTurn = startAcpTurn(createSteeringTurnPrompt(signal.text), session, input, updates, tools, () => {
67
+ wake?.();
68
+ wake = void 0;
69
+ });
70
+ steering = input.steering?.next();
71
+ }
72
+ if (signal.type === "turn_completed" && currentTurn.completed) break;
73
+ if (signal.type === "wake") wake = void 0;
74
+ }
75
+ }
76
+ if (!aborted) {
77
+ await currentTurn.promise;
78
+ if (currentTurn.failure !== void 0) throw currentTurn.failure;
48
79
  }
49
- if (failure !== void 0) throw failure;
50
- await prompt;
51
80
  } finally {
52
81
  input.abortSignal.removeEventListener("abort", onAbort);
82
+ if (abortCancellation) await abortCancellation;
53
83
  if (options.disposeSessionAfterRun !== false) await session.dispose?.();
54
84
  }
55
85
  }
86
+ async function settleCancelledTurn(session, currentTurn, timeoutMs) {
87
+ await Promise.resolve(session.cancel({ preserveSession: false }));
88
+ if (await settlesWithin(currentTurn, timeoutMs)) return;
89
+ if (session.invalidate) await session.invalidate();
90
+ else await session.dispose?.();
91
+ }
92
+ async function settlesWithin(promise, timeoutMs) {
93
+ let timeout;
94
+ try {
95
+ return await Promise.race([promise.then(() => true), new Promise((resolve) => {
96
+ timeout = setTimeout(() => resolve(false), timeoutMs);
97
+ })]);
98
+ } finally {
99
+ if (timeout) clearTimeout(timeout);
100
+ }
101
+ }
102
+ function createSteeringTurnPrompt(text) {
103
+ return [
104
+ "用户刚刚在当前任务执行期间发送了一条 steering 消息。",
105
+ "请先直接回答这条消息;如果它是关于当前任务的进度或概念问题,先给出清晰解释。",
106
+ "只有消息明确要求改变任务时才执行动作;不要把用户自然语言当作 shell 命令。",
107
+ "回答后基于当前会话已有状态继续任务;不得重放最初指令或重复已经完成的步骤。",
108
+ "用户消息:",
109
+ text
110
+ ].join("\n");
111
+ }
112
+ function startAcpTurn(text, session, input, updates, tools, notify) {
113
+ let completed = false;
114
+ let failure;
115
+ return {
116
+ promise: session.prompt(text, (update) => {
117
+ updates.push(...mapAcpSessionUpdate(update, tools));
118
+ notify();
119
+ }).then(() => void 0).catch((error) => {
120
+ if (!input.abortSignal.aborted) failure = error;
121
+ }).finally(() => {
122
+ completed = true;
123
+ notify();
124
+ }),
125
+ get completed() {
126
+ return completed;
127
+ },
128
+ get failure() {
129
+ return failure;
130
+ }
131
+ };
132
+ }
56
133
  function mapAcpSessionUpdate(update, tools) {
57
134
  if (update.sessionUpdate === "agent_message_chunk") {
58
135
  const text = readTextContent(update.content);
@@ -365,7 +442,7 @@ function createAcpStdioAgentLoop(options) {
365
442
  current.dispose();
366
443
  processConnection.sessions.delete(input.sessionKey);
367
444
  }
368
- const session = new SdkAcpAgentSession(await buildAcpSession(processConnection, options, input), processConnection.connection.agent, options.sessionStore !== void 0);
445
+ const session = new SdkAcpAgentSession(await buildAcpSession(processConnection, options, input), processConnection.connection.agent, input.sessionKey, options.sessionStore);
369
446
  sessionKeys.set(session.sessionId, input.sessionKey);
370
447
  processConnection.sessions.set(input.sessionKey, session);
371
448
  return session;
@@ -376,12 +453,14 @@ function createAcpStdioAgentLoop(options) {
376
453
  var SdkAcpAgentSession = class {
377
454
  session;
378
455
  agent;
379
- preserveOnCancel;
456
+ sessionKey;
457
+ sessionStore;
380
458
  reusable = true;
381
- constructor(session, agent, preserveOnCancel) {
459
+ constructor(session, agent, sessionKey, sessionStore) {
382
460
  this.session = session;
383
461
  this.agent = agent;
384
- this.preserveOnCancel = preserveOnCancel;
462
+ this.sessionKey = sessionKey;
463
+ this.sessionStore = sessionStore;
385
464
  }
386
465
  get sessionId() {
387
466
  return this.session.sessionId;
@@ -389,14 +468,19 @@ var SdkAcpAgentSession = class {
389
468
  get isReusable() {
390
469
  return this.reusable;
391
470
  }
392
- cancel() {
393
- if (!this.preserveOnCancel) this.reusable = false;
471
+ cancel(options) {
472
+ if (options?.preserveSession !== true) this.reusable = false;
394
473
  return this.agent.notify(acp.methods.agent.session.cancel, { sessionId: this.session.sessionId });
395
474
  }
396
475
  dispose() {
397
476
  this.reusable = false;
398
477
  this.session.dispose();
399
478
  }
479
+ async invalidate() {
480
+ this.reusable = false;
481
+ this.session.dispose();
482
+ await this.sessionStore?.delete(this.sessionKey);
483
+ }
400
484
  async prompt(text, onUpdate) {
401
485
  const failure = this.session.prompt(text).then(() => new Promise(() => void 0), (error) => Promise.reject(error));
402
486
  for (;;) {
@@ -615,6 +699,14 @@ function createJsonAcpSessionStore(options) {
615
699
  await rename(temporaryPath, options.filePath);
616
700
  };
617
701
  return {
702
+ delete: async (sessionKey) => {
703
+ writeChain = writeChain.then(async () => {
704
+ const current = await records();
705
+ if (!current.delete(sessionKey)) return;
706
+ await persist(current);
707
+ });
708
+ await writeChain;
709
+ },
618
710
  load: async (sessionKey) => (await records()).get(sessionKey),
619
711
  save: async (sessionKey, record) => {
620
712
  writeChain = writeChain.then(async () => {
@@ -315,10 +315,15 @@ interface AgentLoopInput {
315
315
  readonly messages?: ReadonlyArray<AgentTranscriptMessage>;
316
316
  readonly runId: AgentRunId;
317
317
  readonly sessionKey: SessionKey;
318
+ /** Optional mailbox for user steering while the run is active. */
319
+ readonly steering?: AgentSteeringChannel;
318
320
  readonly text: string;
319
321
  readonly previousSessionState?: AgentRunState;
320
322
  readonly previousSessionTranscript?: AgentTranscript;
321
323
  }
324
+ interface AgentSteeringChannel {
325
+ next(): Promise<string>;
326
+ }
322
327
  type AgentLoopEvent = AgentLoopTextDelta | AgentLoopThinkingDelta | AgentLoopModelExecutionStart | AgentLoopModelExecutionEnd | AgentLoopSkillExecutionStart | AgentLoopSkillExecutionEnd | AgentLoopToolExecutionStart | AgentLoopToolExecutionUpdate | AgentLoopToolExecutionEnd;
323
328
  type AgentLoopEventLike = AgentLoopEvent | string;
324
329
  interface AgentLoopTextDelta {
@@ -391,6 +396,8 @@ interface AgentLoopToolExecutionEnd {
391
396
  }
392
397
  interface AgentLoop {
393
398
  run(input: AgentLoopInput): Stream.Stream<AgentLoopEvent, unknown>;
399
+ /** Provider adapters opt in only when they can consume steering safely. */
400
+ readonly supportsSteering?: boolean;
394
401
  }
395
402
  type AgentLoopCallbackOutput = Iterable<AgentLoopEventLike> | AsyncIterable<AgentLoopEventLike> | Stream.Stream<AgentLoopEventLike, unknown>;
396
403
  type AgentLoopCallbackResult = AgentLoopCallbackOutput | PromiseLike<AgentLoopCallbackOutput> | Effect.Effect<AgentLoopCallbackOutput, unknown>;
@@ -427,4 +434,4 @@ declare function createAgentLoopFromCallback(run: AgentLoopCallback): AgentLoop;
427
434
  declare function createTextAgentLoop(options: TextAgentLoopOptions): AgentLoop;
428
435
  declare function createTextAgentLoopFromCallback(generate: TextAgentLoopCallback): AgentLoop;
429
436
  //#endregion
430
- export { createAgentTranscriptTurn as $, createAgentLoopModelExecutionStart as A, AssistantThinkingDelta as At, createTextAgentLoop as B, AgentLoopToolExecutionUpdateOptions as C, AgentToolExecutionEnded as Ct, TextAgentLoopOptions as D, AgentTurnCompleted as Dt, TextAgentLoopCallback as E, AgentToolExecutionUpdated as Et, createAgentLoopToolExecutionEnd as F, isAssistantThinkingDeltaEvent as Ft, LocalCliAgentInvocationOrigin as G, AgentInvocationOrigin as H, createAgentLoopToolExecutionStart as I, isTerminalAgentDomainEvent as It, AgentTranscriptMessage as J, AgentConversationMessagesOptions as K, createAgentLoopToolExecutionUpdate as L, createAgentLoopSkillExecutionStart as M, TerminalAgentDomainEvent as Mt, createAgentLoopTextDelta as N, isAgentToolExecutionEvent as Nt, createAgentLoopFromCallback as O, AgentTurnStarted as Ot, createAgentLoopThinkingDelta as P, isAssistantTextDeltaEvent as Pt, createAgentTranscriptMessages as Q, createAsyncIterableAgentLoop as R, AgentLoopToolExecutionUpdate as S, AgentSkillExecutionStarted as St, EventAgentLoopOptions as T, AgentToolExecutionStarted as Tt, AutomationAgentInvocationOrigin as U, createTextAgentLoopFromCallback as V, FeishuAgentInvocationOrigin as W, AgentTranscriptTurn as X, AgentTranscriptMessageRole as Y, createAgentConversationMessages as Z, AgentLoopThinkingDelta as _, AgentRunCancelled as _t, AgentLoopEvent as a, AgentRunPhase as at, AgentLoopToolExecutionStart as b, AgentRunId as bt, AgentLoopModelExecutionEnd as c, evolveAgentRun as ct, AgentLoopModelExecutionStartOptions as d, AgentDomainEvent as dt, replayAgentTranscript as et, AgentLoopSkillExecutionEnd as f, AgentModelExecutionEnded as ft, AgentLoopTextDelta as g, AgentRunAccepted as gt, AgentLoopSkillExecutionStartOptions as h, AgentModelUsage as ht, AgentLoopCallbackResult as i, replayAgentHistory as it, createAgentLoopSkillExecutionEnd as j, SessionKey as jt, createAgentLoopModelExecutionEnd as k, AssistantTextDelta as kt, AgentLoopModelExecutionEndOptions as l, initialAgentRunState as lt, AgentLoopSkillExecutionStart as m, AgentModelExecutionStarted as mt, AgentLoopCallback as n, AgentRunSummary as nt, AgentLoopEventLike as o, AgentRunState as ot, AgentLoopSkillExecutionEndOptions as p, AgentModelExecutionEvent as pt, AgentTranscript as q, AgentLoopCallbackOutput as r, AgentSessionSummary as rt, AgentLoopInput as s, AgentSkillExecutionState as st, AgentLoop as t, AgentHistory as tt, AgentLoopModelExecutionStart as u, isTerminalAgentRunPhase as ut, AgentLoopToolExecutionEnd as v, AgentRunCompleted as vt, AsyncIterableAgentLoopOptions as w, AgentToolExecutionEvent as wt, AgentLoopToolExecutionStartOptions as x, AgentSkillExecutionEnded as xt, AgentLoopToolExecutionEndOptions as y, AgentRunFailed as yt, createEventAgentLoop as z };
437
+ export { createAgentTranscriptMessages as $, createAgentLoopModelExecutionEnd as A, AssistantTextDelta as At, createEventAgentLoop as B, AgentLoopToolExecutionUpdateOptions as C, AgentSkillExecutionStarted as Ct, TextAgentLoopCallback as D, AgentToolExecutionUpdated as Dt, EventAgentLoopOptions as E, AgentToolExecutionStarted as Et, createAgentLoopThinkingDelta as F, isAssistantTextDeltaEvent as Ft, FeishuAgentInvocationOrigin as G, createTextAgentLoopFromCallback as H, createAgentLoopToolExecutionEnd as I, isAssistantThinkingDeltaEvent as It, AgentTranscript as J, LocalCliAgentInvocationOrigin as K, createAgentLoopToolExecutionStart as L, isTerminalAgentDomainEvent as Lt, createAgentLoopSkillExecutionEnd as M, SessionKey as Mt, createAgentLoopSkillExecutionStart as N, TerminalAgentDomainEvent as Nt, TextAgentLoopOptions as O, AgentTurnCompleted as Ot, createAgentLoopTextDelta as P, isAgentToolExecutionEvent as Pt, createAgentConversationMessages as Q, createAgentLoopToolExecutionUpdate as R, AgentLoopToolExecutionUpdate as S, AgentSkillExecutionEnded as St, AsyncIterableAgentLoopOptions as T, AgentToolExecutionEvent as Tt, AgentInvocationOrigin as U, createTextAgentLoop as V, AutomationAgentInvocationOrigin as W, AgentTranscriptMessageRole as X, AgentTranscriptMessage as Y, AgentTranscriptTurn as Z, AgentLoopThinkingDelta as _, AgentRunAccepted as _t, AgentLoopEvent as a, replayAgentHistory as at, AgentLoopToolExecutionStart as b, AgentRunFailed as bt, AgentLoopModelExecutionEnd as c, AgentSkillExecutionState as ct, AgentLoopModelExecutionStartOptions as d, isTerminalAgentRunPhase as dt, createAgentTranscriptTurn as et, AgentLoopSkillExecutionEnd as f, AgentDomainEvent as ft, AgentLoopTextDelta as g, AgentModelUsage as gt, AgentLoopSkillExecutionStartOptions as h, AgentModelExecutionStarted as ht, AgentLoopCallbackResult as i, AgentSessionSummary as it, createAgentLoopModelExecutionStart as j, AssistantThinkingDelta as jt, createAgentLoopFromCallback as k, AgentTurnStarted as kt, AgentLoopModelExecutionEndOptions as l, evolveAgentRun as lt, AgentLoopSkillExecutionStart as m, AgentModelExecutionEvent as mt, AgentLoopCallback as n, AgentHistory as nt, AgentLoopEventLike as o, AgentRunPhase as ot, AgentLoopSkillExecutionEndOptions as p, AgentModelExecutionEnded as pt, AgentConversationMessagesOptions as q, AgentLoopCallbackOutput as r, AgentRunSummary as rt, AgentLoopInput as s, AgentRunState as st, AgentLoop as t, replayAgentTranscript as tt, AgentLoopModelExecutionStart as u, initialAgentRunState as ut, AgentLoopToolExecutionEnd as v, AgentRunCancelled as vt, AgentSteeringChannel as w, AgentToolExecutionEnded as wt, AgentLoopToolExecutionStartOptions as x, AgentRunId as xt, AgentLoopToolExecutionEndOptions as y, AgentRunCompleted as yt, createAsyncIterableAgentLoop as z };