@cloudflare/think 0.8.8 → 0.9.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/README.md +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/{codegen-CauNNguA.js → codegen-CuPdJRpV.js} +3 -2
- package/dist/codegen-CuPdJRpV.js.map +1 -0
- package/dist/extensions/index.js +1 -1
- package/dist/framework/index.d.ts +4 -4
- package/dist/framework/index.js +3 -3
- package/dist/{manager-EBL4uMVp.js → manager-BPndMP_6.js} +7 -7
- package/dist/{manager-EBL4uMVp.js.map → manager-BPndMP_6.js.map} +1 -1
- package/dist/messengers/index.d.ts +54 -54
- package/dist/messengers/telegram.d.ts +4 -4
- package/dist/{project-D1o1-3dN.js → project-BHurFdu4.js} +2 -2
- package/dist/{project-D1o1-3dN.js.map → project-BHurFdu4.js.map} +1 -1
- package/dist/server-entry.d.ts +2 -0
- package/dist/server-entry.js +2 -1
- package/dist/server-entry.js.map +1 -1
- package/dist/think-2nHHEcY3.js +6446 -0
- package/dist/think-2nHHEcY3.js.map +1 -0
- package/dist/{think-8jik2oZ5.d.ts → think-CwxWGsX1.d.ts} +563 -133
- package/dist/think.d.ts +2 -2
- package/dist/think.js +1 -5825
- package/dist/tools/browser.d.ts +80 -45
- package/dist/tools/browser.js +25 -41
- package/dist/tools/browser.js.map +1 -1
- package/dist/tools/execute.d.ts +145 -75
- package/dist/tools/execute.js +180 -54
- package/dist/tools/execute.js.map +1 -1
- package/dist/tools/extensions.js +2 -2
- package/dist/tools/extensions.js.map +1 -1
- package/dist/tools/workspace.js +10 -8
- package/dist/tools/workspace.js.map +1 -1
- package/dist/vite.js +2 -2
- package/dist/workflows.d.ts +1 -1
- package/package.json +8 -8
- package/dist/codegen-CauNNguA.js.map +0 -1
- package/dist/think.js.map +0 -1
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
ChatRecoveryProgressContext,
|
|
57
57
|
ChatResponseResult,
|
|
58
58
|
ChatResponseResult as ChatResponseResult$1,
|
|
59
|
+
ClientToolExecutor,
|
|
59
60
|
ClientToolSchema,
|
|
60
61
|
MessageConcurrency,
|
|
61
62
|
MessageConcurrency as MessageConcurrency$1,
|
|
@@ -82,6 +83,38 @@ import {
|
|
|
82
83
|
import { ChatSdkStateAdapterOptions, ChatSdkStateAgent } from "agents/chat-sdk";
|
|
83
84
|
import { RpcTarget } from "cloudflare:workers";
|
|
84
85
|
|
|
86
|
+
//#region src/media-eviction.d.ts
|
|
87
|
+
interface MediaEvictionConfig {
|
|
88
|
+
/**
|
|
89
|
+
* Messages at the tail of the active path that are never evicted.
|
|
90
|
+
* Think clamps this to at least the read-time truncation window
|
|
91
|
+
* (4 messages — the recent span the model replays at full fidelity),
|
|
92
|
+
* so a misconfigured low value can never strip content the model
|
|
93
|
+
* still sees.
|
|
94
|
+
* @default 8
|
|
95
|
+
*/
|
|
96
|
+
keepRecentMessages?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Minimum serialized size (in characters; base64 is ASCII so this equals
|
|
99
|
+
* bytes for media) of a single part value to evict.
|
|
100
|
+
* @default 32 * 1024
|
|
101
|
+
*/
|
|
102
|
+
minPartBytes?: number;
|
|
103
|
+
/**
|
|
104
|
+
* Preserve evicted values as workspace files under
|
|
105
|
+
* `/attachments/evicted/` instead of dropping them. The marker records
|
|
106
|
+
* the file path.
|
|
107
|
+
* @default true
|
|
108
|
+
*/
|
|
109
|
+
externalizeToWorkspace?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Maximum oversized stored rows processed per pass. Bounds how long a
|
|
112
|
+
* single pass can take; remaining rows are picked up by later passes.
|
|
113
|
+
* @default 64
|
|
114
|
+
*/
|
|
115
|
+
maxRowsPerPass?: number;
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
85
118
|
//#region src/messengers/events.d.ts
|
|
86
119
|
type MessengerEventKind =
|
|
87
120
|
| "direct-message"
|
|
@@ -447,6 +480,26 @@ type ChatRecoveryContinueData = {
|
|
|
447
480
|
lastClientTools?: ClientToolSchema[] | null;
|
|
448
481
|
recoveredRequestId?: string;
|
|
449
482
|
};
|
|
483
|
+
/**
|
|
484
|
+
* A best-effort internal `onStart` step that failed on this wake and was
|
|
485
|
+
* skipped so the agent could still come up (#1710).
|
|
486
|
+
*
|
|
487
|
+
* - `transcript-hydration` — reading the persisted conversation into the
|
|
488
|
+
* in-memory message cache failed (e.g. `SQLITE_NOMEM` on an oversized,
|
|
489
|
+
* media-heavy transcript). The agent starts with an empty in-memory view;
|
|
490
|
+
* persisted history is untouched and the next safe-boundary sync retries.
|
|
491
|
+
* - `scheduled-task-reconcile` — declarative scheduled tasks were not
|
|
492
|
+
* reconciled on this wake; the next successful wake reconciles them.
|
|
493
|
+
* - `durable-work-recovery` — pending submissions / workflow notifications
|
|
494
|
+
* were not recovered or drained on this wake.
|
|
495
|
+
*/
|
|
496
|
+
interface OnStartDegradation {
|
|
497
|
+
step:
|
|
498
|
+
| "transcript-hydration"
|
|
499
|
+
| "scheduled-task-reconcile"
|
|
500
|
+
| "durable-work-recovery";
|
|
501
|
+
error: unknown;
|
|
502
|
+
}
|
|
450
503
|
/**
|
|
451
504
|
* Callback interface for streaming chat events from a Think sub-agent.
|
|
452
505
|
*
|
|
@@ -505,6 +558,28 @@ interface StreamableResult {
|
|
|
505
558
|
*/
|
|
506
559
|
interface ChatOptions {
|
|
507
560
|
signal?: AbortSignal;
|
|
561
|
+
/**
|
|
562
|
+
* Client-defined tool schemas to expose to the model for this turn, mirroring
|
|
563
|
+
* the `clientTools` carried over the WebSocket chat protocol. Use this when a
|
|
564
|
+
* parent agent delegates to a Think sub-agent over RPC but the sub-agent still
|
|
565
|
+
* needs access to tools the client (or parent) defines at runtime.
|
|
566
|
+
*
|
|
567
|
+
* On their own these are execute-less — the model's call surfaces as a tool
|
|
568
|
+
* call through the stream callback. Provide {@link ChatOptions.onClientToolCall}
|
|
569
|
+
* to also resolve those calls inline so the turn can continue to completion.
|
|
570
|
+
*/
|
|
571
|
+
clientTools?: ClientToolSchema[];
|
|
572
|
+
/**
|
|
573
|
+
* Executes a client tool call and returns its output, completing the
|
|
574
|
+
* round trip for {@link ChatOptions.clientTools} within the same turn.
|
|
575
|
+
*
|
|
576
|
+
* Without this, a client-tool call has no result and the turn ends with a
|
|
577
|
+
* dangling tool call (the RPC stream callback has no inbound result channel).
|
|
578
|
+
* With it, the model can call a client tool, receive the result, and keep
|
|
579
|
+
* going — the same multi-step behavior the WebSocket path gets from
|
|
580
|
+
* `cf_agent_tool_result` messages.
|
|
581
|
+
*/
|
|
582
|
+
onClientToolCall?: ClientToolExecutor;
|
|
508
583
|
}
|
|
509
584
|
type AgentToolChildRunStatus =
|
|
510
585
|
| "starting"
|
|
@@ -646,6 +721,13 @@ interface TurnInput {
|
|
|
646
721
|
signal?: AbortSignal;
|
|
647
722
|
/** Client-provided tool schemas for dynamic tool registration. */
|
|
648
723
|
clientTools?: ClientToolSchema[];
|
|
724
|
+
/**
|
|
725
|
+
* Executor that resolves client-tool calls inline (RPC `chat()` path). When
|
|
726
|
+
* present, `clientTools` are built WITH an `execute` that delegates to it, so
|
|
727
|
+
* the turn completes the tool round trip itself instead of surfacing a
|
|
728
|
+
* dangling tool call. Not persisted — recovery cannot replay a live executor.
|
|
729
|
+
*/
|
|
730
|
+
clientToolExecutor?: ClientToolExecutor;
|
|
649
731
|
/** Custom body fields from the client request. */
|
|
650
732
|
body?: Record<string, unknown>;
|
|
651
733
|
/** Internal workflow prompt configuration, never sourced from client body. */
|
|
@@ -738,6 +820,16 @@ interface TurnConfig {
|
|
|
738
820
|
experimental_telemetry?: Parameters<
|
|
739
821
|
typeof streamText
|
|
740
822
|
>[0]["experimental_telemetry"];
|
|
823
|
+
/**
|
|
824
|
+
* Optional AI SDK stream transform(s) for this turn (`experimental_transform`).
|
|
825
|
+
* Forwarded to `streamText` so callers can inspect/rewrite the stream — e.g.
|
|
826
|
+
* detecting tool results that carry `{ content, sources }` and enqueuing
|
|
827
|
+
* additional `source` parts via the transform's controller. Accepts a single
|
|
828
|
+
* transform or an array applied in order.
|
|
829
|
+
*/
|
|
830
|
+
experimental_transform?: Parameters<
|
|
831
|
+
typeof streamText
|
|
832
|
+
>[0]["experimental_transform"];
|
|
741
833
|
/**
|
|
742
834
|
* Optional structured-output specification (AI SDK `output`).
|
|
743
835
|
* Forwarded to `streamText` so the model's final response is parsed
|
|
@@ -1074,6 +1166,65 @@ declare class Think<
|
|
|
1074
1166
|
* @default "queue"
|
|
1075
1167
|
*/
|
|
1076
1168
|
messageConcurrency: MessageConcurrency;
|
|
1169
|
+
/**
|
|
1170
|
+
* Byte budget for hydrating the persisted transcript into the in-memory
|
|
1171
|
+
* message cache (`this.messages`).
|
|
1172
|
+
*
|
|
1173
|
+
* Hydration runs on every wake (and at safe boundaries during a session).
|
|
1174
|
+
* Without a budget it materializes the ENTIRE stored conversation — for
|
|
1175
|
+
* long-lived, media-heavy sessions that footprint approaches the isolate's
|
|
1176
|
+
* 128MB memory budget and the next SQLite allocation fails with
|
|
1177
|
+
* `SQLITE_NOMEM`, permanently bricking the DO (#1710).
|
|
1178
|
+
*
|
|
1179
|
+
* When the stored path exceeds the budget, only the most recent messages
|
|
1180
|
+
* that fit are hydrated — never fewer than the recent window the model
|
|
1181
|
+
* sees at full fidelity (the `truncateOlderMessages` default of 4), even
|
|
1182
|
+
* when those messages alone exceed the budget — a
|
|
1183
|
+
* `chat:hydration:windowed` observability event is emitted, and
|
|
1184
|
+
* `this.messages` exposes the bounded window. Durable storage is never
|
|
1185
|
+
* truncated by this — `session.getHistory()` still reads the full path.
|
|
1186
|
+
* The model-facing context is unaffected: older content is already
|
|
1187
|
+
* truncated at read time before each turn, and the hydration floor
|
|
1188
|
+
* guarantees the full-fidelity span is always present.
|
|
1189
|
+
*
|
|
1190
|
+
* The default (24MB) leaves headroom for the ~2-3x amplification between
|
|
1191
|
+
* stored JSON and parsed in-memory messages. Set to
|
|
1192
|
+
* `Number.POSITIVE_INFINITY` (or any non-positive value) to disable
|
|
1193
|
+
* windowing and always hydrate the full transcript.
|
|
1194
|
+
*
|
|
1195
|
+
* @default 24 * 1024 * 1024
|
|
1196
|
+
*/
|
|
1197
|
+
hydrationByteBudget: number;
|
|
1198
|
+
/**
|
|
1199
|
+
* Bound the PERSISTED transcript footprint by evicting oversized inline
|
|
1200
|
+
* media (base64 data-URL attachments, large strings inside tool outputs)
|
|
1201
|
+
* from messages that have aged out of the recent window.
|
|
1202
|
+
*
|
|
1203
|
+
* Read-time truncation already hides aged media from the model, but the
|
|
1204
|
+
* bytes stay in storage forever and are rehydrated on every wake — the
|
|
1205
|
+
* boot footprint grows with every image a session ever produced until
|
|
1206
|
+
* SQLite's allocator fails with `SQLITE_NOMEM` (#1710). Eviction passes
|
|
1207
|
+
* run in the background after the agent starts and as the conversation
|
|
1208
|
+
* grows; each pass processes a bounded number of oversized rows.
|
|
1209
|
+
*
|
|
1210
|
+
* By default evicted values are preserved as workspace files under
|
|
1211
|
+
* `/attachments/evicted/` (same Durable Object storage, but outside the
|
|
1212
|
+
* hydration path) and the in-message marker records the file path.
|
|
1213
|
+
* Pass a {@link MediaEvictionConfig} with `externalizeToWorkspace: false`
|
|
1214
|
+
* to drop the bytes instead of preserving them. Set this field to
|
|
1215
|
+
* `false` to disable eviction entirely.
|
|
1216
|
+
*
|
|
1217
|
+
* `keepRecentMessages` is clamped to at least the recent window the model
|
|
1218
|
+
* replays at full fidelity (4 messages), so eviction can never rewrite
|
|
1219
|
+
* content the model still sees.
|
|
1220
|
+
*
|
|
1221
|
+
* Requires a SessionProvider that implements `getHistoryRowStats`
|
|
1222
|
+
* (the default DO SQLite provider does); otherwise eviction is a no-op
|
|
1223
|
+
* and a warning is logged once.
|
|
1224
|
+
*
|
|
1225
|
+
* @default true
|
|
1226
|
+
*/
|
|
1227
|
+
mediaEviction: MediaEvictionConfig | boolean;
|
|
1077
1228
|
/**
|
|
1078
1229
|
* When true, chat turns are wrapped in `runFiber` for durable execution.
|
|
1079
1230
|
* Enables `onChatRecovery` hook and `this.stash()` during streaming.
|
|
@@ -1096,6 +1247,24 @@ declare class Think<
|
|
|
1096
1247
|
session: Session;
|
|
1097
1248
|
/** Cached messages — kept in sync with session storage. */
|
|
1098
1249
|
private _cachedMessages;
|
|
1250
|
+
/**
|
|
1251
|
+
* Internal onStart steps that failed on this wake and were skipped so the
|
|
1252
|
+
* agent could still come up.
|
|
1253
|
+
*
|
|
1254
|
+
* onStart failures are terminal: partyserver resets its init state and
|
|
1255
|
+
* rethrows, so every subsequent wake — including platform alarm retries —
|
|
1256
|
+
* re-runs the failing onStart. A data-driven failure (e.g. SQLITE_NOMEM
|
|
1257
|
+
* hydrating an oversized transcript) would otherwise permanently brick the
|
|
1258
|
+
* DO and drive an unbounded alarm-retry loop (#1710).
|
|
1259
|
+
*/
|
|
1260
|
+
protected _onStartDegradations: OnStartDegradation[];
|
|
1261
|
+
/**
|
|
1262
|
+
* Internal onStart steps that failed on this wake and were skipped so the
|
|
1263
|
+
* agent could still come up (see {@link OnStartDegradation}). Empty when
|
|
1264
|
+
* boot was clean. Lets hosts and operators surface degraded boots —
|
|
1265
|
+
* e.g. via a health RPC — without subclassing.
|
|
1266
|
+
*/
|
|
1267
|
+
getOnStartDegradations(): ReadonlyArray<OnStartDegradation>;
|
|
1099
1268
|
private _activeMessengerContext?;
|
|
1100
1269
|
private _messengerRuntime?;
|
|
1101
1270
|
/**
|
|
@@ -1130,6 +1299,14 @@ declare class Think<
|
|
|
1130
1299
|
* ```
|
|
1131
1300
|
*/
|
|
1132
1301
|
workspace: WorkspaceLike;
|
|
1302
|
+
/**
|
|
1303
|
+
* The codemode runtime behind the execute tool, when one has been created
|
|
1304
|
+
* via `createExecuteRuntime(this)` / `createExecuteTool(this)` (from
|
|
1305
|
+
* `@cloudflare/think/tools/execute`). Gives callables and lifecycle hooks
|
|
1306
|
+
* access to approvals (`approve`/`reject`/`pending`), the audit trail
|
|
1307
|
+
* (`executions`), `expirePaused`, and snippets.
|
|
1308
|
+
*/
|
|
1309
|
+
codemode?: import("@cloudflare/codemode").CodemodeRuntimeHandle;
|
|
1133
1310
|
/**
|
|
1134
1311
|
* Include the default workspace Bash tool. Enabled by default so models can
|
|
1135
1312
|
* run shell-style multi-file workflows against the workspace. Set to `false`
|
|
@@ -1146,9 +1323,32 @@ declare class Think<
|
|
|
1146
1323
|
* through this cache so in-flight turns, tool updates, and recovery state all
|
|
1147
1324
|
* observe the same message list. Use `_syncMessages()` only at safe
|
|
1148
1325
|
* boundaries where a full storage reread cannot drop in-flight state.
|
|
1326
|
+
*
|
|
1327
|
+
* When the stored transcript exceeds `hydrationByteBudget`, this view is a
|
|
1328
|
+
* bounded window of the most recent messages (see `_lastHydration`); the
|
|
1329
|
+
* full history remains readable via `session.getHistory()`.
|
|
1149
1330
|
*/
|
|
1150
1331
|
get messages(): UIMessage[];
|
|
1151
|
-
/**
|
|
1332
|
+
/**
|
|
1333
|
+
* Read the durable message path from session storage.
|
|
1334
|
+
*
|
|
1335
|
+
* Intentionally UNBUDGETED — unlike the cache refresh in `_syncMessages`,
|
|
1336
|
+
* which routes through `session.getRecentHistory(hydrationByteBudget)`, this
|
|
1337
|
+
* returns the full active path. Callers (message reconciliation, tool-update
|
|
1338
|
+
* application) must see every message: reconciliation diffs incoming client
|
|
1339
|
+
* messages against the complete server transcript, and a tool result can
|
|
1340
|
+
* target any message on the path, so a windowed read would drop rows and
|
|
1341
|
+
* corrupt the result.
|
|
1342
|
+
*
|
|
1343
|
+
* These full reads are not the unbounded boot-time hydration that bricked the
|
|
1344
|
+
* DO in #1710: they run during a live turn (never in `onStart`), so an
|
|
1345
|
+
* `SQLITE_NOMEM` here surfaces as a recoverable turn-level error rather than a
|
|
1346
|
+
* partyserver init-reset/alarm-retry loop. They also inherit step 1's
|
|
1347
|
+
* mitigation — `session.getHistory()` now fetches content in bounded chunks
|
|
1348
|
+
* (`messagesByPathIds`) instead of carrying blobs through the recursive CTE
|
|
1349
|
+
* and its `ORDER BY` sorter — and background media eviction shrinks the stored
|
|
1350
|
+
* footprint over time, so the steady-state read size converges down.
|
|
1351
|
+
*/
|
|
1152
1352
|
private _readMessagesFromStorage;
|
|
1153
1353
|
/**
|
|
1154
1354
|
* Normalize a tool part's `input` into something the provider will accept.
|
|
@@ -1216,9 +1416,91 @@ declare class Think<
|
|
|
1216
1416
|
): UIMessage["parts"][number];
|
|
1217
1417
|
private _repairToolTranscriptParts;
|
|
1218
1418
|
private _repairTranscriptForProvider;
|
|
1419
|
+
/**
|
|
1420
|
+
* Run a best-effort internal onStart step, degrading on failure instead of
|
|
1421
|
+
* throwing.
|
|
1422
|
+
*
|
|
1423
|
+
* Throwing out of `onStart` is terminal: partyserver resets its init state
|
|
1424
|
+
* and rethrows, so every wake — including platform alarm retries — re-runs
|
|
1425
|
+
* the failing `onStart` and fails again. A data-driven failure (oversized
|
|
1426
|
+
* transcript, bad declared-task config) would permanently brick the DO and
|
|
1427
|
+
* drive an unbounded alarm-retry loop (#1710). Instead, record the
|
|
1428
|
+
* degradation, emit `chat:onstart:degraded`, and let the agent come up so
|
|
1429
|
+
* it stays reachable for remediation (compaction, clearing, redeploy).
|
|
1430
|
+
*
|
|
1431
|
+
* Returns `true` when the step succeeded.
|
|
1432
|
+
*/
|
|
1433
|
+
private _runBestEffortOnStartStep;
|
|
1434
|
+
private _mediaEvictionRunning;
|
|
1435
|
+
private _mediaEvictionScheduled;
|
|
1436
|
+
/**
|
|
1437
|
+
* Schedule a background media-eviction pass (see `mediaEviction`).
|
|
1438
|
+
* Coalesces repeated requests; the timer fires after the current
|
|
1439
|
+
* event-loop work (and after `onStart`'s `blockConcurrencyWhile`), so
|
|
1440
|
+
* boot and turn latency are unaffected.
|
|
1441
|
+
*/
|
|
1442
|
+
private _scheduleMediaEvictionPass;
|
|
1443
|
+
private _warnedEvictionUnsupported;
|
|
1444
|
+
/**
|
|
1445
|
+
* Evict oversized inline media from aged stored messages (#1710).
|
|
1446
|
+
*
|
|
1447
|
+
* Memory-bounded by design: row sizes come from `getHistoryRowStats()`
|
|
1448
|
+
* (no content loaded), only rows large enough to contain an evictable
|
|
1449
|
+
* part are parsed, and they are processed one at a time via
|
|
1450
|
+
* `session.internal_rewriteMessage` — the maintenance write path that
|
|
1451
|
+
* skips the full-history token-estimate broadcast a public
|
|
1452
|
+
* `updateMessage` performs per row. Evicted values are written to the
|
|
1453
|
+
* workspace BEFORE the row is rewritten, so a failed pass never loses
|
|
1454
|
+
* data. Best-effort: failures are logged and the next pass retries.
|
|
1455
|
+
*
|
|
1456
|
+
* The aged cutoff is `keepRecentMessages` clamped to at least
|
|
1457
|
+
* `MODEL_RECENT_WINDOW`: messages the model still replays at full
|
|
1458
|
+
* fidelity each turn are never rewritten, regardless of configuration.
|
|
1459
|
+
*
|
|
1460
|
+
* When a pass stops at `maxRowsPerPass` with eligible rows remaining,
|
|
1461
|
+
* another pass is scheduled automatically so a large backlog drains
|
|
1462
|
+
* without waiting for new appends. Termination is guaranteed: every
|
|
1463
|
+
* rewritten row drops below `minPartBytes` and is skipped by later
|
|
1464
|
+
* passes, so the eligible set strictly shrinks.
|
|
1465
|
+
*
|
|
1466
|
+
* Returns the pass totals, or `null` when eviction is disabled, already
|
|
1467
|
+
* running, or the provider cannot enumerate row sizes (warned once).
|
|
1468
|
+
*/
|
|
1469
|
+
protected _evictAgedMediaBestEffort(): Promise<{
|
|
1470
|
+
messages: number;
|
|
1471
|
+
parts: number;
|
|
1472
|
+
bytes: number;
|
|
1473
|
+
externalizedBytes: number;
|
|
1474
|
+
} | null>;
|
|
1219
1475
|
/** Replace the live cache with a durable storage snapshot. */
|
|
1220
1476
|
private _replaceCachedMessages;
|
|
1221
|
-
/**
|
|
1477
|
+
/**
|
|
1478
|
+
* Result of the most recent cache refresh when `hydrationByteBudget` is
|
|
1479
|
+
* active. `truncated` means `this.messages` is a bounded recent window of
|
|
1480
|
+
* a larger stored transcript.
|
|
1481
|
+
*/
|
|
1482
|
+
protected _lastHydration: {
|
|
1483
|
+
truncated: boolean;
|
|
1484
|
+
totalContentBytes: number;
|
|
1485
|
+
hydratedMessages: number;
|
|
1486
|
+
} | null;
|
|
1487
|
+
private _warnedHydrationWindowed;
|
|
1488
|
+
/**
|
|
1489
|
+
* Snapshot of the last `chat:hydration:windowed` emit, used to emit on
|
|
1490
|
+
* CHANGE rather than on every safe-boundary sync — a chronically
|
|
1491
|
+
* oversized session syncs many times per turn and would otherwise spam
|
|
1492
|
+
* identical events.
|
|
1493
|
+
*/
|
|
1494
|
+
private _lastWindowedEmit;
|
|
1495
|
+
/**
|
|
1496
|
+
* Refresh the live cache from durable storage at a safe boundary.
|
|
1497
|
+
*
|
|
1498
|
+
* Bounded by `hydrationByteBudget`: oversized transcripts hydrate as a
|
|
1499
|
+
* recent window instead of exhausting the isolate's memory (#1710). The
|
|
1500
|
+
* window never shrinks below `MODEL_RECENT_WINDOW` messages, so budgeted
|
|
1501
|
+
* hydration cannot starve the model-facing context assembly (which keeps
|
|
1502
|
+
* that many recent messages at full fidelity).
|
|
1503
|
+
*/
|
|
1222
1504
|
private _syncMessages;
|
|
1223
1505
|
/** Patch or append one message in the live cache after a durable write. */
|
|
1224
1506
|
private _upsertCachedMessage;
|
|
@@ -1259,6 +1541,15 @@ declare class Think<
|
|
|
1259
1541
|
private _agentToolLastErrors;
|
|
1260
1542
|
private _agentToolPreTurnAssistantIds;
|
|
1261
1543
|
private _agentToolLiveSequences;
|
|
1544
|
+
/**
|
|
1545
|
+
* Request id → run id for in-flight agent-tool turns (null = resolved as
|
|
1546
|
+
* not an agent-tool turn, cached so unrelated turns don't re-query SQLite
|
|
1547
|
+
* per frame). Drives frame attribution in {@link broadcast}: a frame
|
|
1548
|
+
* belongs to a run iff it carries that run's turn request id, so an error
|
|
1549
|
+
* in an unrelated turn or a concurrent run can never leak into another
|
|
1550
|
+
* run's state (#1575).
|
|
1551
|
+
*/
|
|
1552
|
+
private _agentToolRunsByRequestId;
|
|
1262
1553
|
private _submissionTableEnsured;
|
|
1263
1554
|
private _workflowNotificationTableEnsured;
|
|
1264
1555
|
private _declaredScheduledTasksTableEnsured;
|
|
@@ -1271,6 +1562,14 @@ declare class Think<
|
|
|
1271
1562
|
msg: string | ArrayBuffer | ArrayBufferView,
|
|
1272
1563
|
without?: string[]
|
|
1273
1564
|
): void;
|
|
1565
|
+
/**
|
|
1566
|
+
* Resolve the agent-tool run whose turn owns a request id, or null when the
|
|
1567
|
+
* request is not an agent-tool turn. Falls back to the persisted child-run
|
|
1568
|
+
* row (whose `request_id` is written when the run's turn is bound, see
|
|
1569
|
+
* `startAgentToolRun`) so attribution survives a DO restart mid-run; either
|
|
1570
|
+
* outcome is cached.
|
|
1571
|
+
*/
|
|
1572
|
+
private _agentToolRunForRequest;
|
|
1274
1573
|
alarm(): Promise<void>;
|
|
1275
1574
|
/**
|
|
1276
1575
|
* Persist an arbitrary JSON-serializable configuration object for this
|
|
@@ -2112,6 +2411,19 @@ declare class Think<
|
|
|
2112
2411
|
*/
|
|
2113
2412
|
protected abortAllRequests(): void;
|
|
2114
2413
|
private _handleClear;
|
|
2414
|
+
/**
|
|
2415
|
+
* Stamp the allocated assistant id onto a new turn's `start` chunk so a chat
|
|
2416
|
+
* client builds the live-streamed message under the SAME id this agent
|
|
2417
|
+
* persists under. Providers that emit no `start.messageId` (e.g. Workers AI)
|
|
2418
|
+
* otherwise leave the client to generate its own id; the live stream and the
|
|
2419
|
+
* persisted message broadcast then can't reconcile by id, and the originating
|
|
2420
|
+
* tab briefly renders the turn twice before collapsing. Mirrors the fix in
|
|
2421
|
+
* `@cloudflare/ai-chat`. Continuations are skipped — they reuse the existing
|
|
2422
|
+
* assistant message via the `continuation` frame flag, so the id must not
|
|
2423
|
+
* change mid-message. The orphan-recovery path inherits the id from the
|
|
2424
|
+
* stored chunk, so it needs no separate stamping.
|
|
2425
|
+
*/
|
|
2426
|
+
private _alignStreamStartId;
|
|
2115
2427
|
private _streamResultToRpcCallback;
|
|
2116
2428
|
/**
|
|
2117
2429
|
* Whether storing this chunk should immediately flush the resumable-stream
|
|
@@ -2188,6 +2500,74 @@ declare class Think<
|
|
|
2188
2500
|
): Promise<boolean>;
|
|
2189
2501
|
private _applyToolResult;
|
|
2190
2502
|
private _applyToolApproval;
|
|
2503
|
+
/**
|
|
2504
|
+
* The codemode runtime handle behind the execute tool. `this.codemode` is
|
|
2505
|
+
* assigned when `createExecuteRuntime(this)` / `createExecuteTool(this)`
|
|
2506
|
+
* runs (normally at turn start, via `getTools()`); after a DO restart no
|
|
2507
|
+
* turn may have run yet, so fall back to building the tools once.
|
|
2508
|
+
*/
|
|
2509
|
+
private _codemodeRuntime;
|
|
2510
|
+
/**
|
|
2511
|
+
* Pending (awaiting-approval) actions across paused executions of the
|
|
2512
|
+
* execute tool's codemode runtime — `{ executionId, seq, connector,
|
|
2513
|
+
* method, args }` each, with FULL args (the transcript copy is truncated).
|
|
2514
|
+
* Clients reconcile approval cards against this on load.
|
|
2515
|
+
*
|
|
2516
|
+
* Client-callable (registered below — see the `callable()` calls after the
|
|
2517
|
+
* class body).
|
|
2518
|
+
*/
|
|
2519
|
+
pendingExecutions(
|
|
2520
|
+
executionId?: string
|
|
2521
|
+
): Promise<import("@cloudflare/codemode").PendingAction[]>;
|
|
2522
|
+
/**
|
|
2523
|
+
* Approve a paused execution and resume it. The run continues from where
|
|
2524
|
+
* it stopped (replaying logged work, executing the approved call); the
|
|
2525
|
+
* outcome — completed, errored, or paused again on the NEXT gated call —
|
|
2526
|
+
* replaces the paused tool output in the transcript and the chat
|
|
2527
|
+
* auto-continues so the model can act on it.
|
|
2528
|
+
*
|
|
2529
|
+
* Approving an execution that is no longer pending (already settled,
|
|
2530
|
+
* expired, or unknown) returns `{ status: "error" }` with an explanatory
|
|
2531
|
+
* message — it never throws.
|
|
2532
|
+
*
|
|
2533
|
+
* Client-callable.
|
|
2534
|
+
*/
|
|
2535
|
+
approveExecution(executionId: string): Promise<unknown>;
|
|
2536
|
+
/**
|
|
2537
|
+
* Reject a paused execution's pending action, ending the run. The
|
|
2538
|
+
* transcript's paused output is replaced with
|
|
2539
|
+
* `{ status: "rejected", executionId, reason }` and the chat
|
|
2540
|
+
* auto-continues so the model can adapt (or explain) instead of erroring.
|
|
2541
|
+
*
|
|
2542
|
+
* Client-callable.
|
|
2543
|
+
*/
|
|
2544
|
+
rejectExecution(executionId: string, reason?: string): Promise<unknown>;
|
|
2545
|
+
/**
|
|
2546
|
+
* Replace a paused execute-tool output in the transcript with the
|
|
2547
|
+
* execution's new outcome and kick the auto-continuation so the model sees
|
|
2548
|
+
* it.
|
|
2549
|
+
*
|
|
2550
|
+
* When no paused part carries `executionId` — the output was already
|
|
2551
|
+
* replaced from another tab, or compaction summarized the part away — the
|
|
2552
|
+
* runtime has still durably applied the approval/rejection, so the outcome
|
|
2553
|
+
* must not be dropped: it is appended as a system note instead, and the
|
|
2554
|
+
* continuation still fires so the model can act on it.
|
|
2555
|
+
*/
|
|
2556
|
+
private _applyExecutionOutcome;
|
|
2557
|
+
/**
|
|
2558
|
+
* Find the tool part holding the paused output of `executionId` — in the
|
|
2559
|
+
* in-flight streaming accumulator first (an approval can land while a new
|
|
2560
|
+
* turn streams), then the persisted transcript, newest message first.
|
|
2561
|
+
*/
|
|
2562
|
+
private _findPausedExecutionToolCall;
|
|
2563
|
+
/**
|
|
2564
|
+
* Find the tool part carrying `executionId` in its output. With
|
|
2565
|
+
* `pausedOnly`, only a still-paused output matches — used to locate the
|
|
2566
|
+
* part an approval outcome should replace. Without it, any settled output
|
|
2567
|
+
* matches — used to distinguish "already resolved elsewhere" from "the
|
|
2568
|
+
* part is gone from the transcript" (e.g. compacted away).
|
|
2569
|
+
*/
|
|
2570
|
+
private _findExecutionToolCall;
|
|
2191
2571
|
private _applyToolUpdateToMessages;
|
|
2192
2572
|
protected hasPendingInteraction(): boolean;
|
|
2193
2573
|
protected waitUntilStable(options?: { timeout?: number }): Promise<boolean>;
|
|
@@ -2378,31 +2758,35 @@ declare class Think<
|
|
|
2378
2758
|
* completed the recovered submission as `error`, which bypassed
|
|
2379
2759
|
* `_exhaustChatRecovery` entirely — so an app relying on `onExhausted` for the
|
|
2380
2760
|
* terminal banner regressed to an eternal spinner when recovery gave up under
|
|
2381
|
-
* extreme churn. The error path matters just as much: a non-
|
|
2382
|
-
* recovery callback is SWALLOWED by `Agent._executeScheduleCallback`
|
|
2383
|
-
*
|
|
2384
|
-
* routing it here the alarm row is deleted with no terminal UX at
|
|
2385
|
-
* half-finished message wedges silently. Shared by
|
|
2386
|
-
* `_chatRecoveryContinue`.
|
|
2761
|
+
* extreme churn. The error path matters just as much: a non-transient throw
|
|
2762
|
+
* in a recovery callback is SWALLOWED by `Agent._executeScheduleCallback`
|
|
2763
|
+
* (only a platform transient is re-thrown to preserve the one-shot row), so
|
|
2764
|
+
* without routing it here the alarm row is deleted with no terminal UX at
|
|
2765
|
+
* all — the half-finished message wedges silently. Shared by
|
|
2766
|
+
* `_chatRecoveryRetry` and `_chatRecoveryContinue`.
|
|
2387
2767
|
*
|
|
2388
2768
|
* Exactly-once terminalization is defended by two independent guards:
|
|
2389
2769
|
* 1. The `stored?.status === "exhausted"` re-entry guard below — once an
|
|
2390
2770
|
* incident is sealed, a duplicate stale alarm (or retried callback)
|
|
2391
|
-
* returns before re-firing. The
|
|
2392
|
-
*
|
|
2393
|
-
*
|
|
2771
|
+
* returns before re-firing. The seal is persisted only AFTER the
|
|
2772
|
+
* terminal writes in `_exhaustChatRecovery` succeed (see the ordering
|
|
2773
|
+
* note at the call below), so a give-up interrupted by a platform
|
|
2774
|
+
* transient re-runs in full instead of being half-sealed.
|
|
2394
2775
|
* 2. The durable-submission paths additionally short-circuit earlier at the
|
|
2395
2776
|
* `submission_not_running` check (the submission is already `error` after
|
|
2396
2777
|
* the first give-up). This is the ONLY guard `@cloudflare/ai-chat` lacks
|
|
2397
2778
|
* (no submission layer), so guard #1 carries it there.
|
|
2398
2779
|
*
|
|
2399
|
-
*
|
|
2780
|
+
* Residual at-least-once edges, all deliberately accepted as "deliver a
|
|
2400
2781
|
* second banner" ≫ "silently drop the turn":
|
|
2401
2782
|
* • No `incidentId` at all in the payload (only reachable via a direct/test
|
|
2402
2783
|
* invocation — every production scheduler carries one): the synthesized
|
|
2403
2784
|
* incident can't be persisted (no key), so guard #1 can't arm.
|
|
2404
2785
|
* • The record is swept AGAIN between two alarms (guard #1 re-persists on the
|
|
2405
2786
|
* first, so this needs a second independent sweep) — vanishingly unlikely.
|
|
2787
|
+
* • A platform transient interrupts `_exhaustChatRecovery` after the banner
|
|
2788
|
+
* broadcast — the deferred re-run re-fires `onExhausted` + the banner
|
|
2789
|
+
* (the terminal writes themselves are idempotent).
|
|
2406
2790
|
*/
|
|
2407
2791
|
private _exhaustRecoveryGiveUp;
|
|
2408
2792
|
/**
|
|
@@ -2411,39 +2795,32 @@ declare class Think<
|
|
|
2411
2795
|
* `stable_timeout`.
|
|
2412
2796
|
*/
|
|
2413
2797
|
private _exhaustRecoveryAfterStableTimeout;
|
|
2414
|
-
/**
|
|
2415
|
-
* Whether an error is a transient "superseded isolate" failure — a deploy /
|
|
2416
|
-
* code update replaced the isolate mid-invocation. Mirrors the base `Agent`
|
|
2417
|
-
* check (`isDurableObjectCodeUpdateReset`) and MUST stay in lockstep with it:
|
|
2418
|
-
* the base `_executeScheduleCallback` re-throws this class for a one-shot row
|
|
2419
|
-
* (preserving it so the platform re-runs on the new code), so a recovery
|
|
2420
|
-
* callback must also re-throw — NOT terminalize — since recovery will re-run
|
|
2421
|
-
* and succeed on the fresh isolate. The matched family (kept identical to the
|
|
2422
|
-
* base):
|
|
2423
|
-
* - "Durable Object reset because its code was updated." (deploy bounce)
|
|
2424
|
-
* - "This script has been upgraded. Please send a new request to connect to
|
|
2425
|
-
* the new version." (a stub/connection to a superseded script)
|
|
2426
|
-
* "Network connection lost." is intentionally excluded (a connection error,
|
|
2427
|
-
* not an isolate replacement — see the base helper's note). The match stays
|
|
2428
|
-
* close to the verbatim platform strings so an ordinary error mentioning
|
|
2429
|
-
* those words isn't misclassified as a supersede.
|
|
2430
|
-
*/
|
|
2431
|
-
private _isDeployCodeUpdateReset;
|
|
2432
2798
|
/**
|
|
2433
2799
|
* Handle an error thrown by `_chatRecoveryContinue` / `_chatRecoveryRetry`
|
|
2434
2800
|
* after the incident was opened.
|
|
2435
2801
|
*
|
|
2436
|
-
* - A
|
|
2437
|
-
*
|
|
2438
|
-
*
|
|
2439
|
-
*
|
|
2440
|
-
*
|
|
2802
|
+
* - A platform transient (`isPlatformTransientError` from `agents` — a
|
|
2803
|
+
* deploy code-update reset / script supersede, a `retryable`-flagged
|
|
2804
|
+
* platform error, or "Network connection lost.", looking through wrappers
|
|
2805
|
+
* like `SqlError` via the `cause` chain) is re-thrown (after best-effort
|
|
2806
|
+
* marking the incident `failed` for observability) so
|
|
2807
|
+
* `Agent._executeScheduleCallback` preserves the one-shot alarm row and
|
|
2808
|
+
* the platform re-runs recovery once it is healthy again — the turn can
|
|
2809
|
+
* still recover, so it must NOT terminalize. Terminalizing here was the
|
|
2810
|
+
* #1730 freeze: the give-up's own seal needs the very storage that is
|
|
2811
|
+
* down, so it throws too, burns the in-process retry budget inside the
|
|
2812
|
+
* same reset window, and the row is consumed milliseconds before storage
|
|
2813
|
+
* recovers. The submission is deliberately left `running` — the deferred
|
|
2814
|
+
* re-run reads it via `_readRunningSubmissionByRequestId`, so marking it
|
|
2815
|
+
* terminal here would turn the preserved row into a guaranteed
|
|
2816
|
+
* `submission_not_running` no-op skip (a self-defeating defer).
|
|
2817
|
+
* - Any OTHER (application) error is terminalized through the give-up path
|
|
2441
2818
|
* (`onExhausted` + the `terminalMessage` banner) and NOT re-thrown. This is
|
|
2442
2819
|
* the fix for the silent-seal failure mode: `_executeScheduleCallback`
|
|
2443
|
-
* swallows a non-
|
|
2444
|
-
* without terminalizing here the half-finished turn is dropped
|
|
2445
|
-
* terminal event and no banner (the user stares at a frozen
|
|
2446
|
-
* they send something new).
|
|
2820
|
+
* swallows a non-transient throw and then `alarm()` deletes the one-shot
|
|
2821
|
+
* row, so without terminalizing here the half-finished turn is dropped
|
|
2822
|
+
* with no terminal event and no banner (the user stares at a frozen
|
|
2823
|
+
* message until they send something new).
|
|
2447
2824
|
*/
|
|
2448
2825
|
private _handleRecoveryCallbackError;
|
|
2449
2826
|
_chatRecoveryRetry(data?: ChatRecoveryRetryData): Promise<void>;
|
|
@@ -2601,6 +2978,57 @@ declare class Think<
|
|
|
2601
2978
|
*/
|
|
2602
2979
|
private _buildIdleConnectMessages;
|
|
2603
2980
|
private _notifyStreamResuming;
|
|
2981
|
+
/**
|
|
2982
|
+
* Start a resumable stream and arm buffer cleanup. Wrapper around
|
|
2983
|
+
* `ResumableStream.start`: arming on START as well as finish guarantees a
|
|
2984
|
+
* stream whose DO is evicted mid-flight and never reaches a finish still gets
|
|
2985
|
+
* a future sweep instead of leaking its buffer.
|
|
2986
|
+
*
|
|
2987
|
+
* When a turn runs inside `runFiber` (durable recovery), the DO already
|
|
2988
|
+
* self-heals: `runFiber` holds `keepAlive`, which leaves a durable alarm in
|
|
2989
|
+
* storage that survives eviction, fires within ~keepAliveIntervalMs, and runs
|
|
2990
|
+
* the fiber-recovery scan — finalizing the stream (which arms cleanup) without
|
|
2991
|
+
* any client reconnect. Arming here is the safety net for any non-fiber stream
|
|
2992
|
+
* path, where no such alarm exists. The last-activity sweep threshold prevents
|
|
2993
|
+
* an actively streaming run from being reclaimed before it goes quiet (#1706).
|
|
2994
|
+
*/
|
|
2995
|
+
protected _startResumableStream(
|
|
2996
|
+
requestId: string,
|
|
2997
|
+
options?: {
|
|
2998
|
+
messageId?: string;
|
|
2999
|
+
}
|
|
3000
|
+
): string;
|
|
3001
|
+
/**
|
|
3002
|
+
* Mark a resumable stream completed and arm buffer cleanup. Wrapper around
|
|
3003
|
+
* `ResumableStream.complete` so every stream-finish path also schedules the
|
|
3004
|
+
* cleanup alarm (#1706).
|
|
3005
|
+
*/
|
|
3006
|
+
protected _completeResumableStream(streamId: string): void;
|
|
3007
|
+
/**
|
|
3008
|
+
* Mark a resumable stream errored and arm buffer cleanup. Wrapper around
|
|
3009
|
+
* `ResumableStream.markError` — see {@link _completeResumableStream}.
|
|
3010
|
+
*/
|
|
3011
|
+
protected _errorResumableStream(streamId: string): void;
|
|
3012
|
+
/**
|
|
3013
|
+
* Ensure a single cleanup alarm is pending for this DO's resumable-stream
|
|
3014
|
+
* buffers. Armed whenever a stream finishes so that idle/one-off chat DOs
|
|
3015
|
+
* still reclaim their buffers — the lazy sweep in {@link ResumableStream}
|
|
3016
|
+
* only fires when a *subsequent* stream completes, which never happens for a
|
|
3017
|
+
* chat that receives a single turn (#1706).
|
|
3018
|
+
*
|
|
3019
|
+
* `idempotent` dedupes on (callback, payload, owner) so repeated finishes
|
|
3020
|
+
* collapse onto one pending alarm rather than stacking.
|
|
3021
|
+
*/
|
|
3022
|
+
protected _ensureStreamCleanupScheduled({
|
|
3023
|
+
idempotent
|
|
3024
|
+
}?: {
|
|
3025
|
+
idempotent?: boolean;
|
|
3026
|
+
}): Promise<void>;
|
|
3027
|
+
/**
|
|
3028
|
+
* Alarm callback: sweep aged stream buffers, then re-arm only while rows
|
|
3029
|
+
* remain so a fully-swept DO stops waking itself.
|
|
3030
|
+
*/
|
|
3031
|
+
_cleanupStreamBuffers(): Promise<void>;
|
|
2604
3032
|
private _persistOrphanedStream;
|
|
2605
3033
|
private _broadcastChat;
|
|
2606
3034
|
private _broadcast;
|
|
@@ -2608,117 +3036,119 @@ declare class Think<
|
|
|
2608
3036
|
}
|
|
2609
3037
|
//#endregion
|
|
2610
3038
|
export {
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
3039
|
+
TurnContext as $,
|
|
3040
|
+
MessengerEvent as $t,
|
|
3041
|
+
StepConfig as A,
|
|
3042
|
+
DeliverMessengerReplyOptions as At,
|
|
3043
|
+
ThinkIntervalSchedule as B,
|
|
3044
|
+
TextStreamCallback as Bt,
|
|
3045
|
+
PrepareStepResult$1 as C,
|
|
3046
|
+
defineMessengers as Ct,
|
|
3047
|
+
Session$1 as D,
|
|
3048
|
+
toMessengerAuthor as Dt,
|
|
3049
|
+
SaveMessagesResult$1 as E,
|
|
3050
|
+
toMessengerAttachment as Et,
|
|
3051
|
+
StreamableResult as F,
|
|
3052
|
+
MessengerDeliveryPolicy as Ft,
|
|
3053
|
+
ThinkSubmissionInspection as G,
|
|
3054
|
+
messengerReplySnapshot as Gt,
|
|
3055
|
+
ThinkScheduledTaskContext as H,
|
|
3056
|
+
deliverMessengerReply as Ht,
|
|
3057
|
+
SubmitMessagesOptions as I,
|
|
3058
|
+
MessengerDeliverySurface as It,
|
|
3059
|
+
ThinkWallClockSchedule as J,
|
|
3060
|
+
MessengerAction as Jt,
|
|
3061
|
+
ThinkSubmissionStatus as K,
|
|
3062
|
+
parseMessengerReplySnapshot as Kt,
|
|
3063
|
+
SubmitMessagesResult as L,
|
|
3064
|
+
MessengerDeliveryTarget as Lt,
|
|
3065
|
+
StepResult as M,
|
|
3066
|
+
ERROR_MESSENGER_RESPONSE as Mt,
|
|
3067
|
+
StopCondition$1 as N,
|
|
3068
|
+
INTERRUPTED_MESSENGER_RESPONSE as Nt,
|
|
3069
|
+
SkillRunContext as O,
|
|
3070
|
+
toMessengerMessage as Ot,
|
|
3071
|
+
StreamCallback as P,
|
|
3072
|
+
MESSENGER_REPLY_FIBER_NAME as Pt,
|
|
3073
|
+
TurnConfig as Q,
|
|
3074
|
+
MessengerContext as Qt,
|
|
3075
|
+
TextStreamPart as R,
|
|
3076
|
+
MessengerReplySnapshot as Rt,
|
|
3077
|
+
PrepareStepFunction$1 as S,
|
|
3078
|
+
defaultConversationName as St,
|
|
3079
|
+
SaveMessagesOptions$1 as T,
|
|
3080
|
+
normalizeMessengers as Tt,
|
|
3081
|
+
ThinkScheduledTaskSchedule as U,
|
|
3082
|
+
messengerReplyFailureMode as Ut,
|
|
3083
|
+
ThinkScheduledTask as V,
|
|
3084
|
+
TextStreamCallbackOptions as Vt,
|
|
3085
|
+
ThinkScheduledTasks as W,
|
|
3086
|
+
messengerReplyRecoveryMode as Wt,
|
|
3087
|
+
ToolCallDecision as X,
|
|
3088
|
+
MessengerAuthor as Xt,
|
|
3089
|
+
ToolCallContext as Y,
|
|
3090
|
+
MessengerAttachment as Yt,
|
|
3091
|
+
ToolCallResultContext as Z,
|
|
3092
|
+
MessengerCapabilities as Zt,
|
|
2665
3093
|
FiberRecoveryContext$1 as _,
|
|
2666
|
-
|
|
3094
|
+
ThinkMessengerRuntime as _t,
|
|
2667
3095
|
ChatRecoveryContext$1 as a,
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
3096
|
+
toMessengerUserMessage as an,
|
|
3097
|
+
defineScheduledTasks as at,
|
|
3098
|
+
OnStartDegradation as b,
|
|
3099
|
+
chatSdkMessenger as bt,
|
|
2671
3100
|
ChatRecoveryProgressContext as c,
|
|
2672
|
-
|
|
3101
|
+
ChatSdkMessengerOptions as ct,
|
|
2673
3102
|
ChunkContext as d,
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
3103
|
+
MessengerConversationTarget as dt,
|
|
3104
|
+
MessengerEventKind as en,
|
|
3105
|
+
TurnInput as et,
|
|
2677
3106
|
ChunkPart as f,
|
|
2678
|
-
|
|
3107
|
+
MessengerDefinition as ft,
|
|
2679
3108
|
FiberContext$1 as g,
|
|
2680
|
-
|
|
3109
|
+
NormalizedMessengerDefinition as gt,
|
|
2681
3110
|
ExtensionConfig as h,
|
|
2682
|
-
|
|
3111
|
+
MessengerThinkTarget as ht,
|
|
2683
3112
|
ChatRecoveryConfig$1 as i,
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
3113
|
+
serializableMessengerEvent as in,
|
|
3114
|
+
defaultContextOverflowClassifier as it,
|
|
3115
|
+
StepContext as j,
|
|
3116
|
+
EMPTY_MESSENGER_RESPONSE as jt,
|
|
3117
|
+
SkillSource$1 as k,
|
|
3118
|
+
toMessengerThread as kt,
|
|
2690
3119
|
ChatResponseResult$1 as l,
|
|
2691
|
-
|
|
3120
|
+
MessengerConversationMode as lt,
|
|
2692
3121
|
DeleteSubmissionsOptions as m,
|
|
2693
|
-
|
|
3122
|
+
MessengerThinkHost as mt,
|
|
2694
3123
|
ChatErrorContext as n,
|
|
2695
|
-
|
|
2696
|
-
|
|
3124
|
+
MessengerThread as nn,
|
|
3125
|
+
TypedToolResult as nt,
|
|
2697
3126
|
ChatRecoveryExhaustedContext as o,
|
|
2698
|
-
|
|
3127
|
+
MediaEvictionConfig as on,
|
|
3128
|
+
skills as ot,
|
|
2699
3129
|
ContextOverflowConfig as p,
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
3130
|
+
MessengerRespondTo as pt,
|
|
3131
|
+
ThinkTime as q,
|
|
3132
|
+
textDeltaFromStreamChunk as qt,
|
|
2703
3133
|
ChatOptions as r,
|
|
2704
|
-
|
|
2705
|
-
|
|
3134
|
+
messengerContextFromEvent as rn,
|
|
3135
|
+
Workspace$1 as rt,
|
|
2706
3136
|
ChatRecoveryOptions$1 as s,
|
|
2707
|
-
|
|
3137
|
+
ChatSdkMessengerEventInput as st,
|
|
2708
3138
|
ChatErrorClassification as t,
|
|
2709
|
-
|
|
2710
|
-
|
|
3139
|
+
MessengerMessage as tn,
|
|
3140
|
+
TypedToolCall$1 as tt,
|
|
2711
3141
|
ChatStartEvent as u,
|
|
2712
|
-
|
|
3142
|
+
MessengerConversationResolver as ut,
|
|
2713
3143
|
ListSubmissionsOptions as v,
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
3144
|
+
ThinkMessengerStateAgent as vt,
|
|
3145
|
+
ResolvedChatRecoveryConfig as w,
|
|
3146
|
+
idempotencyKeyForEvent as wt,
|
|
3147
|
+
PrepareStepContext as x,
|
|
3148
|
+
defaultChatSdkEvent as xt,
|
|
2719
3149
|
MessageConcurrency$1 as y,
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
3150
|
+
ThinkMessengers as yt,
|
|
3151
|
+
Think as z,
|
|
3152
|
+
MessengerReplyStage as zt
|
|
2723
3153
|
};
|
|
2724
|
-
//# sourceMappingURL=think-
|
|
3154
|
+
//# sourceMappingURL=think-CwxWGsX1.d.ts.map
|