agents 0.26.0 → 0.27.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.
Files changed (233) hide show
  1. package/README.md +8 -9
  2. package/dist/{agent-routing-0DR0Tk2v.d.ts → agent-routing-Bhdbvf7s.d.ts} +13 -8
  3. package/dist/agent-routing.d.ts +1 -1
  4. package/dist/agent-tool-types.d.ts +1 -1
  5. package/dist/{agent-tools-YrATZJu2.d.ts → agent-tools-bJZwBMfq.d.ts} +2 -2
  6. package/dist/agent-tools.d.ts +1 -1
  7. package/dist/ai-sdk-OoGkFy3s.js +2444 -0
  8. package/dist/ai-sdk-OoGkFy3s.js.map +1 -0
  9. package/dist/apply-chunks-1FheRb9W.js +99 -0
  10. package/dist/apply-chunks-1FheRb9W.js.map +1 -0
  11. package/dist/broadcast-state-CEyI4uAK.js +69 -0
  12. package/dist/broadcast-state-CEyI4uAK.js.map +1 -0
  13. package/dist/browser/ai-sdk.d.ts +1 -1
  14. package/dist/browser/ai-sdk.js +2 -2
  15. package/dist/browser/ai-sdk.js.map +1 -1
  16. package/dist/browser/index.d.ts +1 -1
  17. package/dist/browser/tanstack-ai.d.ts +1 -1
  18. package/dist/browser/tanstack-ai.js +1 -1
  19. package/dist/{browser-DE3d-RLk.d.ts → browser-tmkcAAI3.d.ts} +2 -2
  20. package/dist/{browser-tool-DuNdlwZ9.d.ts → browser-tool-Bn-nzJQI.d.ts} +3 -3
  21. package/dist/{browser-tool-CQ10e6Kj.js → browser-tool-CBqs6hqa.js} +58 -18
  22. package/dist/browser-tool-CBqs6hqa.js.map +1 -0
  23. package/dist/capability-B4WbF81e.js.map +1 -1
  24. package/dist/{capability-runner-DBAnGr6L.d.ts → capability-runner-O5VbQzqg.d.ts} +9 -1
  25. package/dist/channel-Bak_6zDP.d.ts +333 -0
  26. package/dist/chat/index.d.ts +11 -9
  27. package/dist/chat/index.js +5 -194
  28. package/dist/chat/index.js.map +1 -1
  29. package/dist/chat/react.d.ts +2 -4
  30. package/dist/chat/react.js +3 -1
  31. package/dist/chat/react.js.map +1 -1
  32. package/dist/chat-sdk/index.d.ts +1 -1
  33. package/dist/chat-sdk/index.js +1 -1
  34. package/dist/cli.js +144 -0
  35. package/dist/{client-fyQrLGkD.js → client-1tEQ1Oqz.js} +27 -2
  36. package/dist/{client-fyQrLGkD.js.map → client-1tEQ1Oqz.js.map} +1 -1
  37. package/dist/{client-je3koD9Z.d.ts → client-DS3Dz9l0.d.ts} +2 -2
  38. package/dist/client-tools-aIBO0Fk7.d.ts +53 -0
  39. package/dist/client.d.ts +1 -1
  40. package/dist/conversations-DH0ut_8n.d.ts +192 -0
  41. package/dist/{current-agent-vAk_5JMt.d.ts → current-agent-C07C5o5Y.d.ts} +3 -3
  42. package/dist/daemon-core-Buubj-y1.js +481 -0
  43. package/dist/daemon-core-Buubj-y1.js.map +1 -0
  44. package/dist/daemon-core-CbohVPAu.d.ts +132 -0
  45. package/dist/{do-oauth-client-provider-Tmf1vgKz.d.ts → do-oauth-client-provider-DfsUcpc3.d.ts} +7 -1
  46. package/dist/{durable-object-lifecycle-HhgOMWq9.d.ts → durable-object-lifecycle-DRqp475_.d.ts} +2 -2
  47. package/dist/{channels/email.d.ts → experimental/channels/email/index.d.ts} +25 -12
  48. package/dist/{channels/email.js → experimental/channels/email/index.js} +13 -35
  49. package/dist/experimental/channels/email/index.js.map +1 -0
  50. package/dist/experimental/channels/index.d.ts +270 -0
  51. package/dist/experimental/channels/index.js +1186 -0
  52. package/dist/experimental/channels/index.js.map +1 -0
  53. package/dist/{channels/slack.d.ts → experimental/channels/slack/index.d.ts} +19 -9
  54. package/dist/experimental/channels/slack/index.js +267 -0
  55. package/dist/experimental/channels/slack/index.js.map +1 -0
  56. package/dist/{channels/telegram.d.ts → experimental/channels/telegram/index.d.ts} +19 -9
  57. package/dist/experimental/channels/telegram/index.js +198 -0
  58. package/dist/experimental/channels/telegram/index.js.map +1 -0
  59. package/dist/experimental/channels/web/ai-sdk.d.ts +55 -0
  60. package/dist/experimental/channels/web/ai-sdk.js +266 -0
  61. package/dist/experimental/channels/web/ai-sdk.js.map +1 -0
  62. package/dist/experimental/channels/web/client.d.ts +97 -0
  63. package/dist/experimental/channels/web/client.js +349 -0
  64. package/dist/experimental/channels/web/client.js.map +1 -0
  65. package/dist/experimental/channels/web/index.d.ts +189 -0
  66. package/dist/experimental/channels/web/index.js +332 -0
  67. package/dist/experimental/channels/web/index.js.map +1 -0
  68. package/dist/gateway-BDC07gYO.d.ts +100 -0
  69. package/dist/handle-zAzh0UW2.d.ts +460 -0
  70. package/dist/harness/ai-sdk/index.d.ts +175 -0
  71. package/dist/harness/ai-sdk/index.js +605 -0
  72. package/dist/harness/ai-sdk/index.js.map +1 -0
  73. package/dist/harness/container/daemon/index.d.ts +76 -0
  74. package/dist/harness/container/daemon/index.js +3 -0
  75. package/dist/harness/container/index.d.ts +740 -0
  76. package/dist/harness/container/index.js +2152 -0
  77. package/dist/harness/container/index.js.map +1 -0
  78. package/dist/harness/container/runtime/index.d.ts +144 -0
  79. package/dist/harness/container/runtime/index.js +1082 -0
  80. package/dist/harness/container/runtime/index.js.map +1 -0
  81. package/dist/harness/opencode/index.d.ts +369 -0
  82. package/dist/harness/opencode/index.js +1072 -0
  83. package/dist/harness/opencode/index.js.map +1 -0
  84. package/dist/harness/pi/index.d.ts +2 -1
  85. package/dist/harness/store/index.d.ts +24 -0
  86. package/dist/harness/store/index.js +2 -0
  87. package/dist/harness/think/index.d.ts +821 -0
  88. package/dist/harness/think/index.js +2529 -0
  89. package/dist/harness/think/index.js.map +1 -0
  90. package/dist/harness-B6B9S3rb.d.ts +203 -0
  91. package/dist/{images-iiTDSyRu.js → images-Ce9SCu3X.js} +2 -248
  92. package/dist/images-Ce9SCu3X.js.map +1 -0
  93. package/dist/{index-BreL0YrQ.d.ts → index-D0A5tbWu.d.ts} +2 -2
  94. package/dist/index-Ib_4dwOo.d.ts +200 -0
  95. package/dist/index.d.ts +5 -5
  96. package/dist/index.js +2 -2
  97. package/dist/ingress-EFbrS547.js +9 -0
  98. package/dist/ingress-EFbrS547.js.map +1 -0
  99. package/dist/input-schema-DNrpTu49.js +23 -0
  100. package/dist/input-schema-DNrpTu49.js.map +1 -0
  101. package/dist/internal-kmw70xwR.js +46 -0
  102. package/dist/internal-kmw70xwR.js.map +1 -0
  103. package/dist/internal_context.d.ts +1 -1
  104. package/dist/lifecycle/index.d.ts +3 -3
  105. package/dist/mcp/client/do-oauth-client-provider.d.ts +1 -1
  106. package/dist/mcp/client/do-oauth-client-provider.js +9 -0
  107. package/dist/mcp/client/do-oauth-client-provider.js.map +1 -1
  108. package/dist/mcp/client/index.d.ts +1 -1
  109. package/dist/mcp/client/index.js +1 -1
  110. package/dist/mcp/client/x402.d.ts +35 -4
  111. package/dist/mcp/client/x402.js +24 -3
  112. package/dist/mcp/client/x402.js.map +1 -1
  113. package/dist/mcp/index.d.ts +1 -1
  114. package/dist/mcp/index.js +2 -2
  115. package/dist/models/ai-sdk/index.d.ts +16 -14
  116. package/dist/models/ai-sdk/index.js +1 -2442
  117. package/dist/models/opencode/index.d.ts +65 -0
  118. package/dist/models/opencode/index.js +285 -0
  119. package/dist/models/opencode/index.js.map +1 -0
  120. package/dist/models/pi-ai/index.d.ts +9 -7
  121. package/dist/models/pi-ai/index.js +2 -1
  122. package/dist/models/pi-ai/index.js.map +1 -1
  123. package/dist/options-pwTNq9z6.d.ts +134 -0
  124. package/dist/protocol-BEgrJYC5.d.ts +331 -0
  125. package/dist/protocol-CukuI73M.d.ts +386 -0
  126. package/dist/protocol-cOklVBBD.js +227 -0
  127. package/dist/protocol-cOklVBBD.js.map +1 -0
  128. package/dist/{protocol-kHsr-f0X.js → protocol-eXeJxhgu.js} +2 -67
  129. package/dist/protocol-eXeJxhgu.js.map +1 -0
  130. package/dist/protocol-y2sSY584.js +148 -0
  131. package/dist/protocol-y2sSY584.js.map +1 -0
  132. package/dist/queue/index.d.ts +1 -1
  133. package/dist/react.d.ts +2 -2
  134. package/dist/routing/index.d.ts +2 -2
  135. package/dist/{scheduler-RdACNXDP.d.ts → scheduler-CrFCnv_J.d.ts} +2 -2
  136. package/dist/schedules/index.d.ts +1 -1
  137. package/dist/serializable.d.ts +1 -1
  138. package/dist/sessions/index.d.ts +11 -434
  139. package/dist/sessions/index.js +1 -2271
  140. package/dist/sessions-B9pNuxdT.js +2272 -0
  141. package/dist/sessions-B9pNuxdT.js.map +1 -0
  142. package/dist/settings-C45hDliX.js +253 -0
  143. package/dist/settings-C45hDliX.js.map +1 -0
  144. package/dist/{transport-PfFnt-Ld.d.ts → settings-NgGwF7Qt.d.ts} +14 -208
  145. package/dist/{src-BZeu-SCD.js → src-DgCbZtIR.js} +4 -4
  146. package/dist/{src-BZeu-SCD.js.map → src-DgCbZtIR.js.map} +1 -1
  147. package/dist/stall-watchdog-BpRF2uwG.js +195 -0
  148. package/dist/stall-watchdog-BpRF2uwG.js.map +1 -0
  149. package/dist/state/index.d.ts +1 -1
  150. package/dist/store-DLeqKuj3.d.ts +310 -0
  151. package/dist/store-vgcPYo8K.js +432 -0
  152. package/dist/store-vgcPYo8K.js.map +1 -0
  153. package/dist/streams/index.d.ts +1 -1
  154. package/dist/streams/index.js +1 -1
  155. package/dist/{streams-DW-UCOUc.js → streams-CITClVer.js} +16 -3
  156. package/dist/streams-CITClVer.js.map +1 -0
  157. package/dist/{streams-Cmkj9QfW.d.ts → streams-fbG61qM8.d.ts} +2 -2
  158. package/dist/sub-routing.d.ts +1 -1
  159. package/dist/tasks/index.d.ts +1 -1
  160. package/dist/tasks/index.js +1 -1
  161. package/dist/{tasks-68DESxf0.js → tasks-CkTZNaV1.js} +2 -1
  162. package/dist/tasks-CkTZNaV1.js.map +1 -0
  163. package/dist/{tasks-9YxYtByh.d.ts → tasks-PtlB4Uyn.d.ts} +2 -2
  164. package/dist/tool-3PA8xjB_.js +421 -0
  165. package/dist/tool-3PA8xjB_.js.map +1 -0
  166. package/dist/tool-BPJEbwaX.d.ts +278 -0
  167. package/dist/transport-k2mFrtL8.d.ts +200 -0
  168. package/dist/turns-DCV3ycDl.js +317 -0
  169. package/dist/turns-DCV3ycDl.js.map +1 -0
  170. package/dist/voice/client.js +1 -1
  171. package/dist/voice/index.d.ts +2 -2
  172. package/dist/voice/index.js +1 -1
  173. package/dist/websearch/index.d.ts +58 -0
  174. package/dist/websearch/index.js +2 -0
  175. package/dist/websearch/tools/ai-sdk.d.ts +77 -0
  176. package/dist/websearch/tools/ai-sdk.js +46 -0
  177. package/dist/websearch/tools/ai-sdk.js.map +1 -0
  178. package/dist/websearch/tools/pi.d.ts +82 -0
  179. package/dist/websearch/tools/pi.js +89 -0
  180. package/dist/websearch/tools/pi.js.map +1 -0
  181. package/dist/websearch/tools/tanstack-ai.d.ts +71 -0
  182. package/dist/websearch/tools/tanstack-ai.js +46 -0
  183. package/dist/websearch/tools/tanstack-ai.js.map +1 -0
  184. package/dist/websockets/index.d.ts +12 -296
  185. package/dist/websockets/index.js +1 -1
  186. package/dist/{websockets-Ci-LZFHH.js → websockets-CmENGb-Z.js} +18 -4
  187. package/dist/websockets-CmENGb-Z.js.map +1 -0
  188. package/dist/{wire-types-CrjKvDyi.d.ts → wire-types-Cv0iwjk5.d.ts} +3 -51
  189. package/dist/workflow-types.d.ts +1 -1
  190. package/dist/workflows.d.ts +1 -1
  191. package/dist/workflows.js +1 -1
  192. package/docs/browse-the-web.md +3 -0
  193. package/docs/harnesses/think.md +215 -0
  194. package/docs/index.md +2 -1
  195. package/docs/lifecycle.md +40 -0
  196. package/docs/search-the-web.md +133 -0
  197. package/package.json +117 -38
  198. package/dist/browser-tool-CQ10e6Kj.js.map +0 -1
  199. package/dist/channel-Bnm4S7T2.d.ts +0 -491
  200. package/dist/channels/ai-sdk.d.ts +0 -46
  201. package/dist/channels/ai-sdk.js +0 -120
  202. package/dist/channels/ai-sdk.js.map +0 -1
  203. package/dist/channels/email.js.map +0 -1
  204. package/dist/channels/index.d.ts +0 -233
  205. package/dist/channels/index.js +0 -608
  206. package/dist/channels/index.js.map +0 -1
  207. package/dist/channels/slack.js +0 -614
  208. package/dist/channels/slack.js.map +0 -1
  209. package/dist/channels/tanstack-ai.d.ts +0 -39
  210. package/dist/channels/tanstack-ai.js +0 -17
  211. package/dist/channels/tanstack-ai.js.map +0 -1
  212. package/dist/channels/telegram.js +0 -427
  213. package/dist/channels/telegram.js.map +0 -1
  214. package/dist/channels/voice.d.ts +0 -45
  215. package/dist/channels/voice.js +0 -122
  216. package/dist/channels/voice.js.map +0 -1
  217. package/dist/images-iiTDSyRu.js.map +0 -1
  218. package/dist/index-BB0kqhIz.d.ts +0 -101
  219. package/dist/ingress-BfetZbMO.js +0 -83
  220. package/dist/ingress-BfetZbMO.js.map +0 -1
  221. package/dist/internal-CYlgHl1l.js +0 -59
  222. package/dist/internal-CYlgHl1l.js.map +0 -1
  223. package/dist/models/ai-sdk/index.js.map +0 -1
  224. package/dist/protocol-kHsr-f0X.js.map +0 -1
  225. package/dist/sessions/index.js.map +0 -1
  226. package/dist/streams-DW-UCOUc.js.map +0 -1
  227. package/dist/surface-bZZJqBka.js +0 -17
  228. package/dist/surface-bZZJqBka.js.map +0 -1
  229. package/dist/tasks-68DESxf0.js.map +0 -1
  230. package/dist/tool-schema-CBjGPrsQ.js +0 -31
  231. package/dist/tool-schema-CBjGPrsQ.js.map +0 -1
  232. package/dist/websockets-Ci-LZFHH.js.map +0 -1
  233. package/docs/channels.md +0 -323
@@ -0,0 +1,821 @@
1
+ import {
2
+ _ as LifecycleJobContext,
3
+ o as MemoryLimitContext,
4
+ s as LifecycleCapability,
5
+ t as CapabilityRequestContext,
6
+ v as LifecycleJobOutcome,
7
+ x as Connection
8
+ } from "../../capability-runner-O5VbQzqg.js";
9
+ import { n as ClientToolSchema } from "../../client-tools-aIBO0Fk7.js";
10
+ import { o as SearchResult } from "../../types-B7LojTe4.js";
11
+ import { n as WebSocketHandlers } from "../../options-pwTNq9z6.js";
12
+ import {
13
+ a as HarnessSessions,
14
+ c as OperationStatus,
15
+ g as ToolAnswer,
16
+ i as HarnessSession,
17
+ l as Receipt,
18
+ m as SessionWatch,
19
+ n as HarnessInput,
20
+ s as OperationResult,
21
+ t as AgentHarness
22
+ } from "../../harness-B6B9S3rb.js";
23
+ import { n as Session, o as CompactResult } from "../../handle-zAzh0UW2.js";
24
+ import {
25
+ JSONValue,
26
+ LanguageModel,
27
+ ModelMessage,
28
+ ToolChoice,
29
+ ToolSet,
30
+ UIMessage,
31
+ UIMessageChunk
32
+ } from "ai";
33
+
34
+ //#region src/harness/think/events.d.ts
35
+ /**
36
+ * Something that happened in a session, as the AI SDK describes it.
37
+ *
38
+ * @experimental
39
+ */
40
+ type ThinkSessionEvent =
41
+ | {
42
+ readonly type: "operation";
43
+ readonly status: OperationStatus;
44
+ }
45
+ | {
46
+ readonly type: "run-start";
47
+ readonly operationId: string /** Whether the operation continues an assistant message already persisted. */;
48
+ readonly continuation: boolean;
49
+ }
50
+ | {
51
+ readonly type: "run-end";
52
+ readonly operationId: string;
53
+ }
54
+ /**
55
+ * A streamed chunk of the operation's assistant message. Chunks of one
56
+ * model call continue the message as persisted before that call.
57
+ */
58
+ | {
59
+ readonly type: "chunk";
60
+ readonly operationId: string;
61
+ readonly chunk: UIMessageChunk;
62
+ } /** A message was persisted; it replaces any message with its id. */
63
+ | {
64
+ readonly type: "message";
65
+ readonly message: UIMessage /** The operation that wrote it. */;
66
+ readonly operationId?: string;
67
+ } /** The session was reset. Messages that follow belong to the new context. */
68
+ | {
69
+ readonly type: "reset";
70
+ }
71
+ /**
72
+ * The transcript changed in a way no single message describes: messages
73
+ * were deleted, or a compaction changed what the model sees. Re-read it.
74
+ */
75
+ | {
76
+ readonly type: "transcript";
77
+ };
78
+ /** A listener for a session's events. @experimental */
79
+ type ThinkSessionListener = (event: ThinkSessionEvent) => void;
80
+ /** A listener for every session's events. @experimental */
81
+ type ThinkHarnessListener = (session: string, event: ThinkSessionEvent) => void;
82
+ //#endregion
83
+ //#region src/harness/think/records.d.ts
84
+ /** What an operation asks the harness to do, as stored. */
85
+ type OperationInput = /** Place these user messages, then answer them. */ | {
86
+ readonly kind: "messages";
87
+ readonly messages: readonly UIMessage[];
88
+ } /** Record a tool result or approval, then continue the turn it unblocks. */
89
+ | {
90
+ readonly kind: "answer";
91
+ readonly answer: ToolAnswer /** Whether to continue the turn once nothing else is awaited. */;
92
+ readonly autoContinue: boolean;
93
+ } /** Answer a user message again, on a new branch beside earlier answers. */
94
+ | {
95
+ readonly kind: "regenerate";
96
+ readonly messageId?: string;
97
+ } /** Continue the latest assistant message. */
98
+ | {
99
+ readonly kind: "continue";
100
+ };
101
+ //#endregion
102
+ //#region src/harness/think/types.d.ts
103
+ /**
104
+ * A session id. The root session is `""`, the Sessions capability's default
105
+ * session, which is where `@cloudflare/think` keeps its one conversation.
106
+ *
107
+ * @experimental
108
+ */
109
+ type ThinkSessionId = string;
110
+ /**
111
+ * What a session accepts as input:
112
+ *
113
+ * - a string, as one user text message;
114
+ * - one `UIMessage` or several, placed in order;
115
+ * - the shared harness input (`{ parts }`);
116
+ * - a tool result or an approval (`ToolAnswer`), which continues the turn
117
+ * that was waiting for it.
118
+ *
119
+ * @experimental
120
+ */
121
+ type ThinkInput =
122
+ | string
123
+ | UIMessage
124
+ | readonly UIMessage[]
125
+ | HarnessInput
126
+ | ToolAnswer;
127
+ /**
128
+ * What a submission does when the session is already running. Only
129
+ * `followUp` (the default) is supported: the input is answered after the
130
+ * current turn, as its own turn. Steering a running turn is not supported,
131
+ * and a `"steer"` passed through the shared harness interface is refused
132
+ * with `SteerNotSupportedError`.
133
+ *
134
+ * @experimental
135
+ */
136
+ type ThinkWhenBusy = "followUp";
137
+ /** Options for `submit()` and `prompt()`. @experimental */
138
+ type ThinkSubmitOptions = {
139
+ /** Idempotency key. Submitting the same id twice returns the same receipt. */ readonly operationId?: string;
140
+ readonly whenBusy?: ThinkWhenBusy;
141
+ /**
142
+ * Who wrote the input. `"client"` input is untrusted: it may only add
143
+ * `user` messages (an operation with any other role ends `unanswered`
144
+ * with reason `"client_role"`), a message whose id is already stored is
145
+ * dropped rather than rewritten, and reserved metadata keys are
146
+ * stripped. Default `"server"`.
147
+ */
148
+ readonly source?: "client" | "server";
149
+ /**
150
+ * Tools the session's client runs, replacing any it declared before. They
151
+ * are kept with the session, so later turns, including continuations
152
+ * after an eviction, still offer them to the model.
153
+ */
154
+ readonly clientTools?: readonly ClientToolSchema[];
155
+ /**
156
+ * For a tool result or an approval: whether to continue the turn once
157
+ * nothing else is awaited. Default `true`. With `false` the answer is
158
+ * recorded and the turn waits for `session.continue()`.
159
+ */
160
+ readonly autoContinue?: boolean;
161
+ };
162
+ /** Returned once a submission is durable. @experimental */
163
+ type ThinkReceipt = Receipt;
164
+ /** How one operation ended. @experimental */
165
+ type ThinkOperationResult = OperationResult & {
166
+ /** The assistant message the operation wrote, if it wrote one. */ readonly messageId?: string;
167
+ };
168
+ /** A prompt's result, with the transcript after it. @experimental */
169
+ type ThinkPromptResponse = ThinkOperationResult & {
170
+ /** The session's active transcript. */ readonly messages: readonly UIMessage[];
171
+ };
172
+ /** An operation not settled yet. @experimental */
173
+ type ThinkPendingOperation = {
174
+ readonly operationId: string;
175
+ readonly session: ThinkSessionId /** `queued` behind other work, or `running`. */;
176
+ readonly status: "queued" | "running";
177
+ };
178
+ /** The operation a session is running, mid model call. @experimental */
179
+ type ThinkInFlight = {
180
+ readonly operationId: string;
181
+ /**
182
+ * Whether the model call continues an assistant message already
183
+ * persisted, so its chunks extend that message rather than start one.
184
+ */
185
+ readonly continuation: boolean /** The call's chunks so far. */;
186
+ readonly chunks: readonly UIMessageChunk[];
187
+ };
188
+ /** An operation's status: open, or how it ended. @experimental */
189
+ type ThinkOperationStatus =
190
+ | {
191
+ readonly operationId: string;
192
+ readonly session: ThinkSessionId;
193
+ readonly status: "queued" | "running";
194
+ }
195
+ | ThinkOperationResult;
196
+ /**
197
+ * Receives one operation's answer as it streams, as Think's `chat()`
198
+ * callback does.
199
+ *
200
+ * @experimental
201
+ */
202
+ type ThinkStreamCallback = {
203
+ /** The submission is durable. */ onStart?(event: {
204
+ readonly operationId: string;
205
+ }): void | Promise<void> /** One UI message chunk, as JSON. */;
206
+ onEvent(json: string): void | Promise<void>;
207
+ onDone(): void | Promise<void> /** The operation ended unanswered, with the reason. */;
208
+ onError(error: string): void | Promise<void>;
209
+ };
210
+ /** A session the harness knows of. @experimental */
211
+ type ThinkSessionInfo = {
212
+ readonly id: ThinkSessionId /** The session this one was forked from. */;
213
+ readonly parent?: ThinkSessionId;
214
+ readonly busy: boolean;
215
+ };
216
+ /**
217
+ * What the harness does with a tool call an eviction interrupted, set on
218
+ * the tool as its `recovery` field.
219
+ *
220
+ * - `report` (default): record the call as failed with an "interrupted"
221
+ * error, so the model sees it and decides. Right for any tool whose
222
+ * effect may have happened.
223
+ * - `rerun`: run it again. Only for tools that are safe to repeat.
224
+ *
225
+ * ```ts
226
+ * tools: {
227
+ * search: { ...tool({ description, inputSchema, execute }), recovery: "rerun" }
228
+ * }
229
+ * ```
230
+ *
231
+ * @experimental
232
+ */
233
+ type ToolRecovery = "report" | "rerun";
234
+ /** The optional field a tool carries to set its recovery. @experimental */
235
+ type RecoverableTool = {
236
+ readonly recovery?: ToolRecovery;
237
+ };
238
+ /** Recovery policy. @experimental */
239
+ type ThinkRecoveryOptions = {
240
+ /**
241
+ * Interruptions one operation survives without progress before it is
242
+ * settled as `unanswered` with reason `"interrupted"`. A finished model
243
+ * call or tool call is progress and resets the count. Default 10.
244
+ */
245
+ readonly maxAttempts?: number;
246
+ /**
247
+ * Delay before the second recovery attempt, doubled for each after it,
248
+ * up to a minute. The first is immediate. Default 1000.
249
+ */
250
+ readonly backoffMs?: number;
251
+ /**
252
+ * A model stream that sends nothing for this long is treated as
253
+ * interrupted and recovered. `0` turns the watchdog off. Default 120000.
254
+ */
255
+ readonly stallTimeoutMs?: number;
256
+ };
257
+ /** Context for every hook. @experimental */
258
+ type ThinkHookContext = {
259
+ readonly session: ThinkSessionId;
260
+ readonly operationId: string;
261
+ };
262
+ /** Context for `beforeTurn`. @experimental */
263
+ type ThinkTurnContext = ThinkHookContext & {
264
+ /** Model calls this operation made before this one. */ readonly step: number /** Whether this call continues an assistant message already started. */;
265
+ readonly continuation: boolean /** The transcript the model will see, with compaction applied. */;
266
+ readonly messages: readonly UIMessage[] /** The system prompt from the options, if any. */;
267
+ readonly system: string | undefined /** Names of the tools on offer. */;
268
+ readonly tools: readonly string[];
269
+ };
270
+ /**
271
+ * What `beforeTurn` may change for one model call. Unset fields keep the
272
+ * harness's own values.
273
+ *
274
+ * @experimental
275
+ */
276
+ type ThinkTurnConfig = {
277
+ readonly model?: LanguageModel;
278
+ readonly system?: string /** Replace the model messages the transcript converts to. */;
279
+ readonly messages?: ModelMessage[] /** Only offer these tools on this call. */;
280
+ readonly activeTools?: readonly string[];
281
+ readonly toolChoice?: ToolChoice<ToolSet>;
282
+ readonly providerOptions?: Record<string, Record<string, JSONValue>>;
283
+ readonly maxOutputTokens?: number;
284
+ readonly temperature?: number;
285
+ };
286
+ /** Context for `beforeToolCall`. @experimental */
287
+ type ThinkToolCallContext = ThinkHookContext & {
288
+ readonly toolCallId: string;
289
+ readonly toolName: string;
290
+ readonly input: unknown /** Runs of this call so far, counting this one. */;
291
+ readonly attempt: number;
292
+ };
293
+ /**
294
+ * What `beforeToolCall` decides.
295
+ *
296
+ * - `{ action: "run" }` (or nothing): run the tool, with `input` replaced
297
+ * when given.
298
+ * - `{ action: "block", reason }`: do not run it; the model sees the reason
299
+ * as the tool's error.
300
+ * - `{ action: "substitute", output }`: do not run it; the model sees
301
+ * `output` as its result.
302
+ *
303
+ * @experimental
304
+ */
305
+ type ThinkToolCallDecision =
306
+ | {
307
+ readonly action: "run";
308
+ readonly input?: unknown;
309
+ }
310
+ | {
311
+ readonly action: "block";
312
+ readonly reason: string;
313
+ }
314
+ | {
315
+ readonly action: "substitute";
316
+ readonly output: unknown;
317
+ };
318
+ /** Context for `afterToolCall`. @experimental */
319
+ type ThinkToolCallResultContext = ThinkToolCallContext &
320
+ (
321
+ | {
322
+ readonly ok: true;
323
+ readonly output: unknown;
324
+ }
325
+ | {
326
+ readonly ok: false;
327
+ readonly errorText: string;
328
+ }
329
+ );
330
+ /** Context for `onStepFinish`. @experimental */
331
+ type ThinkStepFinishContext = ThinkHookContext & {
332
+ readonly step: number /** The assistant message as persisted after this model call. */;
333
+ readonly message: UIMessage;
334
+ readonly finishReason: string | undefined;
335
+ };
336
+ /** Context for `onChunk`. @experimental */
337
+ type ThinkChunkContext = ThinkHookContext & {
338
+ readonly chunk: UIMessageChunk;
339
+ };
340
+ /** Context for `onTurnEnd`. @experimental */
341
+ type ThinkTurnEndContext = ThinkOperationResult & {
342
+ /** The assistant message the operation wrote, as persisted. */ readonly message?: UIMessage;
343
+ };
344
+ /**
345
+ * How the harness treats a model call's error.
346
+ *
347
+ * - `fail` (default): settle the operation `unanswered` with the error.
348
+ * - `context-overflow`: compact the session, if it has a compaction
349
+ * function, and call the model again, once.
350
+ * - `retry`: treat it like an interruption, within the recovery budget.
351
+ *
352
+ * @experimental
353
+ */
354
+ type ThinkErrorClass = "fail" | "context-overflow" | "retry";
355
+ /** Context for `onRecovery`. @experimental */
356
+ type ThinkRecoveryContext = ThinkHookContext & {
357
+ /** Interruptions without progress, counting this one. */ readonly attempt: number /** The partial assistant message rebuilt from the interrupted stream. */;
358
+ readonly partial: UIMessage | undefined;
359
+ };
360
+ /**
361
+ * Hooks into the turn loop. All are optional, and each may be async. A
362
+ * throwing hook ends the operation `unanswered`, except `onChunk`,
363
+ * `onTurnEnd` and `onError`, whose errors are logged and ignored.
364
+ *
365
+ * @experimental
366
+ */
367
+ type ThinkHarnessHooks = {
368
+ /**
369
+ * Before every model call. A turn makes several, and after an eviction
370
+ * the harness has no memory of what an earlier call returned, so it asks
371
+ * again each time.
372
+ */
373
+ readonly beforeTurn?: (
374
+ context: ThinkTurnContext
375
+ ) =>
376
+ | ThinkTurnConfig
377
+ | void
378
+ | Promise<ThinkTurnConfig | void> /** Before each server tool call the harness runs. */;
379
+ readonly beforeToolCall?: (
380
+ context: ThinkToolCallContext
381
+ ) =>
382
+ | ThinkToolCallDecision
383
+ | void
384
+ | Promise<ThinkToolCallDecision | void> /** After each server tool call, with its result. */;
385
+ readonly afterToolCall?: (
386
+ context: ThinkToolCallResultContext
387
+ ) => void | Promise<void> /** After each model call's message is persisted. */;
388
+ readonly onStepFinish?: (
389
+ context: ThinkStepFinishContext
390
+ ) => void | Promise<void> /** For each UI chunk the model streams. */;
391
+ readonly onChunk?: (
392
+ context: ThinkChunkContext
393
+ ) => void /** After an operation settles. */;
394
+ readonly onTurnEnd?: (
395
+ context: ThinkTurnEndContext
396
+ ) => void | Promise<void> /** Observe a model call's error, before it is classified. */;
397
+ readonly onError?: (
398
+ error: unknown,
399
+ context: ThinkHookContext
400
+ ) => void | Promise<void> /** Classify a model call's error. Default: everything is `fail`. */;
401
+ readonly classifyError?: (error: unknown) => ThinkErrorClass;
402
+ /**
403
+ * Decide what to do with an interrupted model call. Default: `continue`
404
+ * while within `recovery.maxAttempts`.
405
+ */
406
+ readonly onRecovery?: (
407
+ context: ThinkRecoveryContext
408
+ ) => "continue" | "abandon" | Promise<"continue" | "abandon">;
409
+ };
410
+ /** Context for options computed per session. @experimental */
411
+ type ThinkSessionContext = {
412
+ readonly session: ThinkSessionId;
413
+ };
414
+ /**
415
+ * Something given directly or computed for each session.
416
+ *
417
+ * @experimental
418
+ */
419
+ type PerSession<T> = T | ((context: ThinkSessionContext) => T | Promise<T>);
420
+ /** `ThinkHarness`'s options. @experimental */
421
+ type ThinkHarnessOptions<TOOLS extends ToolSet = ToolSet> = {
422
+ /**
423
+ * Message-metadata keys only the server may write. The transcript strips
424
+ * them from input submitted with `source: "client"`. Default: none.
425
+ */
426
+ readonly reservedMetadataKeys?: readonly string[];
427
+ readonly model: PerSession<LanguageModel>;
428
+ readonly system?: PerSession<string | undefined>;
429
+ /**
430
+ * Server tools, which the harness runs itself, one durable call at a
431
+ * time, and tools without `execute`, which a client runs. A server tool
432
+ * may carry `recovery: "rerun"` (see `ToolRecovery`).
433
+ */
434
+ readonly tools?: PerSession<TOOLS>;
435
+ /**
436
+ * Most model calls one operation makes. Default 10. As with the AI SDK's
437
+ * `stepCountIs`, when the last allowed call asks for tools, the tools run
438
+ * and the operation ends without another model reply.
439
+ */
440
+ readonly maxSteps?: number;
441
+ /**
442
+ * Whether a tool call needs approval before it runs. A tool's own
443
+ * `needsApproval` is honored too.
444
+ */
445
+ readonly toolApproval?: (call: {
446
+ readonly session: ThinkSessionId;
447
+ readonly toolName: string;
448
+ readonly toolCallId: string;
449
+ readonly input: unknown;
450
+ }) =>
451
+ | boolean
452
+ | Promise<boolean> /** The budget for recovering interrupted work. */;
453
+ readonly recovery?: ThinkRecoveryOptions;
454
+ /**
455
+ * Configure a session's transcript handle the first time the harness
456
+ * uses it, for example its compaction function and threshold.
457
+ */
458
+ readonly configureSession?: (session: Session, id: ThinkSessionId) => void;
459
+ readonly hooks?: ThinkHarnessHooks;
460
+ };
461
+ //#endregion
462
+ //#region src/harness/think/harness.d.ts
463
+ /**
464
+ * Thrown by `submit()` when asked to steer a running turn, which
465
+ * ThinkHarness does not support. Submit without `whenBusy` to queue the
466
+ * input behind the running turn instead.
467
+ *
468
+ * @experimental
469
+ */
470
+ declare class SteerNotSupportedError extends Error {
471
+ readonly session: ThinkSessionId;
472
+ /** Stable tag for matching without `instanceof`. */
473
+ readonly _tag: "SteerNotSupportedError";
474
+ /** @param session - The session the submission was for. */
475
+ constructor(session: ThinkSessionId);
476
+ }
477
+ /** The root session's id: the Sessions capability's default session. */
478
+ declare const ROOT_SESSION: ThinkSessionId;
479
+ /**
480
+ * Think's agent loop hosted in a Durable Object, behind the same small
481
+ * harness interface as `PiHarness`: `harness.prompt()`, `harness.sessions`,
482
+ * `harness.session(id)`. It implements the shared `AgentHarness`
483
+ * interface, so a Channels host can serve its sessions.
484
+ *
485
+ * Transcripts live in a Sessions capability and in-flight model output in
486
+ * a Streams capability, both owned by the harness, and the harness's queue
487
+ * of operations in its own table. The harness runs every server tool call itself, so after an
488
+ * eviction it knows exactly which call was cut short and applies that
489
+ * tool's recovery policy.
490
+ *
491
+ * Durability is the Lifecycle's job queue, used directly: one wake job per
492
+ * session. A submission is written, then the session's wake is scheduled.
493
+ * While a session has work, the wake job reschedules itself as a heartbeat,
494
+ * so an eviction leaves it due and its alarm restarts the object. Each step
495
+ * of a turn reads only durable state, so the restarted object continues
496
+ * where the last write left off.
497
+ *
498
+ * @experimental The API may change between releases.
499
+ */
500
+ declare class ThinkHarness<TOOLS extends ToolSet = ToolSet>
501
+ extends LifecycleCapability
502
+ implements AgentHarness
503
+ {
504
+ #private;
505
+ /** Every session in this object. */
506
+ readonly sessions: ThinkSessions;
507
+ /**
508
+ * @param options - The model, tools and hooks.
509
+ */
510
+ constructor(options: ThinkHarnessOptions<TOOLS>);
511
+ /** Create the harness's tables and wake every session with open work. */
512
+ onStart(): Promise<void>;
513
+ /**
514
+ * The alarm memory-limit breaker sealed: the work it stopped would only
515
+ * run out of memory again. Mark the running operations to be settled
516
+ * `unanswered` with reason `"out_of_memory"` rather than run again.
517
+ * Queued operations behind them still run. Runs after the isolate's
518
+ * work unwound, so it keeps to small synchronous writes.
519
+ */
520
+ onMemoryLimit(context: MemoryLimitContext): void;
521
+ /** Run a session's wake job. */
522
+ onJob(context: LifecycleJobContext): Promise<LifecycleJobOutcome | void>;
523
+ /**
524
+ * A handle on one session. No I/O until you call it.
525
+ *
526
+ * @param id - The session. Default: the root session.
527
+ */
528
+ session(id?: ThinkSessionId): ThinkSession;
529
+ /** Submit to the root session and wait for the answer. */
530
+ prompt(
531
+ input: ThinkInput,
532
+ options?: ThinkSubmitOptions
533
+ ): Promise<ThinkPromptResponse>;
534
+ /** Durably submit to the root session. Resolves before the model runs. */
535
+ submit(
536
+ input: ThinkInput,
537
+ options?: ThinkSubmitOptions
538
+ ): Promise<ThinkReceipt>;
539
+ /** Operations not settled yet, oldest first, in one session or all. */
540
+ pending(session?: ThinkSessionId): Promise<ThinkPendingOperation[]>;
541
+ /** @internal */
542
+ enqueue(
543
+ session: ThinkSessionId,
544
+ input: OperationInput,
545
+ options: ThinkSubmitOptions
546
+ ): Promise<ThinkReceipt>;
547
+ /** @internal Stop one operation, or everything open in a session. */
548
+ abort(session: ThinkSessionId, operationId?: string): Promise<boolean>;
549
+ /** @internal Wait for an operation to settle. */
550
+ wait(
551
+ session: ThinkSessionId,
552
+ operationId: string,
553
+ signal?: AbortSignal
554
+ ): Promise<ThinkOperationResult>;
555
+ /** @internal */
556
+ inspect(
557
+ session: ThinkSessionId,
558
+ operationId: string
559
+ ): Promise<ThinkOperationStatus | undefined>;
560
+ /** @internal The active transcript of a session. */
561
+ messages(session: ThinkSessionId): Promise<UIMessage[]>;
562
+ /** @internal Abort everything in a session and clear its transcript. */
563
+ reset(session: ThinkSessionId, handoff?: string): Promise<void>;
564
+ /** @internal */
565
+ subscribe(
566
+ session: ThinkSessionId,
567
+ listener: ThinkSessionListener
568
+ ): () => void;
569
+ /** @internal The shared harness interface's watch. */
570
+ watch(session: ThinkSessionId): Promise<SessionWatch>;
571
+ /** @internal The running operation and its model call's chunks so far. */
572
+ inFlight(session: ThinkSessionId): Promise<ThinkInFlight | undefined>;
573
+ /**
574
+ * Listen to every session's events, for a host that serves several
575
+ * sessions over one set of connections. Returns the unsubscribe.
576
+ */
577
+ observe(listener: ThinkHarnessListener): () => void;
578
+ /** @internal */
579
+ createSession(parent?: ThinkSessionId): Promise<ThinkSession>;
580
+ /** @internal Copy a session's active path into a new session. */
581
+ fork(from: ThinkSessionId): Promise<ThinkSession>;
582
+ /** @internal */
583
+ listSessions(): Promise<ThinkSessionInfo[]>;
584
+ /** @internal The answers to a message: its children in the tree. */
585
+ branches(session: ThinkSessionId, messageId: string): Promise<UIMessage[]>;
586
+ /** @internal Full-text search over a session's messages. */
587
+ search(
588
+ session: ThinkSessionId,
589
+ query: string,
590
+ options?: {
591
+ readonly limit?: number;
592
+ }
593
+ ): Promise<SearchResult[]>;
594
+ /** @internal Compact a session with its compaction function. */
595
+ compact(session: ThinkSessionId): Promise<CompactResult | null>;
596
+ }
597
+ /**
598
+ * Classify the context-window overflow errors of common providers
599
+ * (Anthropic, OpenAI, Google, Bedrock, Mistral and others) as
600
+ * `"context-overflow"`, and everything else as `"fail"`. Pass it as
601
+ * `hooks.classifyError`, or call it from your own classifier.
602
+ *
603
+ * @param error - The model call's error.
604
+ * @returns `"context-overflow"` or `"fail"`.
605
+ * @experimental
606
+ */
607
+ declare function classifyContextOverflow(error: unknown): ThinkErrorClass;
608
+ /**
609
+ * One session, addressed through the harness.
610
+ *
611
+ * @experimental
612
+ */
613
+ declare class ThinkSession implements HarnessSession {
614
+ #private;
615
+ /** The session's id. */
616
+ readonly id: ThinkSessionId;
617
+ /**
618
+ * @param harness - The harness that owns the session.
619
+ * @param id - The session's id.
620
+ */
621
+ constructor(harness: ThinkHarness, id: ThinkSessionId);
622
+ /** Durably submit input. Resolves before the model runs. */
623
+ submit(
624
+ input: ThinkInput,
625
+ options?: ThinkSubmitOptions
626
+ ): Promise<ThinkReceipt>;
627
+ /** Submit and wait for the answer and the updated transcript. */
628
+ prompt(
629
+ input: ThinkInput,
630
+ options?: ThinkSubmitOptions
631
+ ): Promise<ThinkPromptResponse>;
632
+ /**
633
+ * Answer a user message again. The new answer is a branch beside the
634
+ * earlier ones, which `Session.getBranches()` still reads.
635
+ *
636
+ * @param messageId - The user message. Default: the latest one.
637
+ */
638
+ regenerate(
639
+ messageId?: string,
640
+ options?: Pick<ThinkSubmitOptions, "operationId">
641
+ ): Promise<ThinkReceipt>;
642
+ /** Call the model again to continue the latest message. */
643
+ continue(
644
+ options?: Pick<ThinkSubmitOptions, "operationId">
645
+ ): Promise<ThinkReceipt>;
646
+ /** Wait for an operation to settle. Aborting `signal` stops only the wait. */
647
+ wait(
648
+ operationId: string,
649
+ signal?: AbortSignal
650
+ ): Promise<ThinkOperationResult>;
651
+ /**
652
+ * Withdraw one queued operation or abort it while it runs; with no id,
653
+ * everything open in the session.
654
+ */
655
+ abort(operationId?: string): Promise<boolean>;
656
+ /** Abort everything and clear the transcript, optionally leaving a note. */
657
+ reset(handoff?: string): Promise<void>;
658
+ /** The active transcript. */
659
+ messages(): Promise<UIMessage[]>;
660
+ /** Operations not settled yet, oldest first. */
661
+ pending(): Promise<ThinkPendingOperation[]>;
662
+ /**
663
+ * The running operation, with the chunks its model call has streamed so
664
+ * far, including those an eviction left behind. Send them, then
665
+ * `subscribe()`'s chunk events, to a client that joins mid-turn.
666
+ */
667
+ inFlight(): Promise<ThinkInFlight | undefined>;
668
+ /**
669
+ * The answers to a message: its children in the transcript tree. A
670
+ * regenerated answer is a branch beside the earlier ones.
671
+ *
672
+ * @param messageId - The message, usually a user message.
673
+ */
674
+ branches(messageId: string): Promise<UIMessage[]>;
675
+ /** Full-text search over this session's messages. */
676
+ search(
677
+ query: string,
678
+ options?: {
679
+ readonly limit?: number;
680
+ }
681
+ ): Promise<SearchResult[]>;
682
+ /**
683
+ * Summarize older messages with the compaction function set in
684
+ * `configureSession`. Resolves to null when there was nothing to compact.
685
+ */
686
+ compact(): Promise<CompactResult | null>;
687
+ /** Listen to the session's events in the AI SDK's vocabulary. */
688
+ subscribe(listener: ThinkSessionListener): () => void;
689
+ /** The shared harness interface's watch: the state, then every change. */
690
+ watch(): Promise<SessionWatch>;
691
+ /**
692
+ * Submit input and stream its answer to `callback`, as Think's `chat()`
693
+ * does: `onStart`, then `onEvent` with each UI chunk as JSON, then
694
+ * `onDone` or `onError`. Works over RPC with an `RpcTarget` callback.
695
+ *
696
+ * The callback lives in memory. If the object is evicted mid-turn the
697
+ * turn still finishes, but the callback is gone; a caller that must not
698
+ * lose the answer should `wait()` on the receipt as well.
699
+ */
700
+ chat(
701
+ input: ThinkInput,
702
+ callback: ThinkStreamCallback,
703
+ options?: ThinkSubmitOptions
704
+ ): Promise<ThinkOperationResult>;
705
+ /** One operation's status, or undefined when the id is unknown. */
706
+ inspect(operationId: string): Promise<ThinkOperationStatus | undefined>;
707
+ /** Whether the session has open work. */
708
+ busy(): Promise<boolean>;
709
+ }
710
+ /**
711
+ * Every session in this object.
712
+ *
713
+ * @experimental
714
+ */
715
+ declare class ThinkSessions implements HarnessSessions {
716
+ #private;
717
+ /** @param harness - The harness that owns the sessions. */
718
+ constructor(harness: ThinkHarness);
719
+ /** A handle on one session. */
720
+ get(id: ThinkSessionId): ThinkSession;
721
+ /** A new, empty session. */
722
+ create(): Promise<ThinkSession>;
723
+ /** A new session that starts with `from`'s active transcript. */
724
+ fork(from: ThinkSessionId): Promise<ThinkSession>;
725
+ /** Every session, with whether it has open work. */
726
+ list(): Promise<ThinkSessionInfo[]>;
727
+ }
728
+ //#endregion
729
+ //#region src/harness/think/chat.d.ts
730
+ /**
731
+ * The connections the chat protocol talks to: the WebSockets capability
732
+ * fits as is.
733
+ *
734
+ * @experimental
735
+ */
736
+ type ThinkChatConnections = {
737
+ getConnections(): Iterable<Connection>;
738
+ use(handlers: WebSocketHandlers): void;
739
+ };
740
+ /** `ThinkChat`'s options. @experimental */
741
+ type ThinkChatOptions = {
742
+ readonly harness: ThinkHarness /** The WebSockets capability the clients connect through. */;
743
+ readonly webSockets: ThinkChatConnections /** The session the chat serves. Default: the root session. */;
744
+ readonly session?: ThinkSessionId;
745
+ };
746
+ /**
747
+ * Serves one ThinkHarness session over Think's chat WebSocket protocol and
748
+ * its `GET …/get-messages` route. Install it on the Lifecycle after the
749
+ * harness and the WebSockets capability:
750
+ *
751
+ * ```ts
752
+ * readonly webSockets = new WebSockets();
753
+ * readonly chat = new ThinkChat({ harness: this.harness, webSockets: this.webSockets });
754
+ * readonly lifecycle = Lifecycle.install(this)
755
+ * .use(this.harness)
756
+ * .use(this.webSockets).use(this.chat);
757
+ * ```
758
+ *
759
+ * Supported: chat requests (`submit-message` and `regenerate-message`),
760
+ * cancel, clear, client tool results, approvals, and stream resume after
761
+ * a reconnect or an eviction. Not supported: `messageConcurrency`
762
+ * strategies other than queueing, client transcript sync, and the
763
+ * recovery progress frame.
764
+ *
765
+ * @experimental The API may change between releases.
766
+ */
767
+ declare class ThinkChat extends LifecycleCapability {
768
+ #private;
769
+ /** @param options - The harness, its WebSockets, and the session to serve. */
770
+ constructor(options: ThinkChatOptions);
771
+ /** Answer `GET …/get-messages` with the session's transcript. */
772
+ onRequest(context: CapabilityRequestContext): Promise<Response | undefined>;
773
+ /** Stop listening to the harness. */
774
+ dispose(): void;
775
+ }
776
+ //#endregion
777
+ export {
778
+ type PerSession,
779
+ ROOT_SESSION,
780
+ type RecoverableTool,
781
+ SteerNotSupportedError,
782
+ ThinkChat,
783
+ type ThinkChatConnections,
784
+ type ThinkChatOptions,
785
+ type ThinkChunkContext,
786
+ type ThinkErrorClass,
787
+ ThinkHarness,
788
+ type ThinkHarnessHooks,
789
+ type ThinkHarnessListener,
790
+ type ThinkHarnessOptions,
791
+ type ThinkHookContext,
792
+ type ThinkInFlight,
793
+ type ThinkInput,
794
+ type ThinkOperationResult,
795
+ type ThinkOperationStatus,
796
+ type ThinkPendingOperation,
797
+ type ThinkPromptResponse,
798
+ type ThinkReceipt,
799
+ type ThinkRecoveryContext,
800
+ type ThinkRecoveryOptions,
801
+ ThinkSession,
802
+ type ThinkSessionContext,
803
+ type ThinkSessionEvent,
804
+ type ThinkSessionId,
805
+ type ThinkSessionInfo,
806
+ type ThinkSessionListener,
807
+ ThinkSessions,
808
+ type ThinkStepFinishContext,
809
+ type ThinkStreamCallback,
810
+ type ThinkSubmitOptions,
811
+ type ThinkToolCallContext,
812
+ type ThinkToolCallDecision,
813
+ type ThinkToolCallResultContext,
814
+ type ThinkTurnConfig,
815
+ type ThinkTurnContext,
816
+ type ThinkTurnEndContext,
817
+ type ThinkWhenBusy,
818
+ type ToolRecovery,
819
+ classifyContextOverflow
820
+ };
821
+ //# sourceMappingURL=index.d.ts.map