@cloudflare/think 0.11.0 → 0.12.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 +63 -6
- package/dist/{chat-sdk-D6cUghsQ.js → chat-sdk-Dm0R3pdR.js} +24 -1
- package/dist/{chat-sdk-D6cUghsQ.js.map → chat-sdk-Dm0R3pdR.js.map} +1 -1
- package/dist/cli/index.js +6 -15
- package/dist/cli/index.js.map +1 -1
- package/dist/fetch-By3eIQ-a.d.ts +147 -0
- package/dist/{index-D_S5mETO.d.ts → index-WF0HQmkk.d.ts} +299 -74
- package/dist/messengers/index.d.ts +1 -1
- package/dist/messengers/index.js +1 -1
- package/dist/messengers/telegram.d.ts +1 -1
- package/dist/messengers/telegram.js +1 -1
- package/dist/studio/assets/{angular-html-D27LthTc.js → angular-html--XgCyfPu.js} +1 -1
- package/dist/studio/assets/{angular-ts-DtNL2gQ7.js → angular-ts-Dt-feQIe.js} +1 -1
- package/dist/studio/assets/{apl-BgEcDqM0.js → apl-B7ymkyp4.js} +1 -1
- package/dist/studio/assets/{astro-CstbRF9e.js → astro-Ce5cw2JI.js} +1 -1
- package/dist/studio/assets/{blade-CLG-7epG.js → blade-DL-aXwjv.js} +1 -1
- package/dist/studio/assets/{c-CssQqwxO.js → c-CFfr09UF.js} +1 -1
- package/dist/studio/assets/{cobol-CjmzHCjg.js → cobol-Ba1f5ZqR.js} +1 -1
- package/dist/studio/assets/{coffee-B_rqYPkp.js → coffee-BG2_viYI.js} +1 -1
- package/dist/studio/assets/{cpp-5YyZJlb7.js → cpp-pU5HgBva.js} +1 -1
- package/dist/studio/assets/{crystal-D7uKze0i.js → crystal-Dlm_uR4r.js} +1 -1
- package/dist/studio/assets/{css-k9oPgg7G.js → css-tUC4TMTn.js} +1 -1
- package/dist/studio/assets/{edge-CGgsSt0x.js → edge-CQuSKMUt.js} +1 -1
- package/dist/studio/assets/{elixir-BX_d5Evo.js → elixir-BmIB-Wi1.js} +1 -1
- package/dist/studio/assets/{elm-DENxDm5e.js → elm-ByVNCtDB.js} +1 -1
- package/dist/studio/assets/{erb-DvYOup03.js → erb-DO4uDxTq.js} +1 -1
- package/dist/studio/assets/{git-rebase-BsAdTS5A.js → git-rebase-CT8LXapC.js} +1 -1
- package/dist/studio/assets/{glimmer-js-e0h98Z67.js → glimmer-js-DzIT0v-m.js} +1 -1
- package/dist/studio/assets/{glimmer-ts-C9s5Kv8m.js → glimmer-ts-znG2j9R4.js} +1 -1
- package/dist/studio/assets/{glsl-CCiyeTRs.js → glsl-C1p8U_gW.js} +1 -1
- package/dist/studio/assets/{graphql-BRtHwsqk.js → graphql-CFqegryf.js} +1 -1
- package/dist/studio/assets/{hack-Dnt0QXHh.js → hack-BfVsNhqs.js} +1 -1
- package/dist/studio/assets/{haml-EXGmzuB1.js → haml-DVcEksY5.js} +1 -1
- package/dist/studio/assets/{handlebars-CzyBIDJE.js → handlebars-DSWgWCJ4.js} +1 -1
- package/dist/studio/assets/{highlighted-body-OFNGDK62-CQUFKLNu.js → highlighted-body-OFNGDK62-BIm4UpTS.js} +1 -1
- package/dist/studio/assets/{html-BAT8b_VM.js → html-C-lP7-T4.js} +1 -1
- package/dist/studio/assets/{html-derivative-7tkS-r6F.js → html-derivative-ByukJopb.js} +1 -1
- package/dist/studio/assets/{http-Cgka02Qq.js → http-Bax2fYIk.js} +1 -1
- package/dist/studio/assets/{hurl-Cbkh8WEw.js → hurl-BrI2qfvy.js} +1 -1
- package/dist/studio/assets/{index-D6n8vpkp.js → index-DNSTOyBe.js} +5 -5
- package/dist/studio/assets/{java-DrRKiUno.js → java-ZiR-uym-.js} +1 -1
- package/dist/studio/assets/{javascript-9LAnHOxD.js → javascript-Dhhw85Vr.js} +1 -1
- package/dist/studio/assets/{jinja-CqRt4prs.js → jinja-DqSGkgE4.js} +1 -1
- package/dist/studio/assets/{jison-BX-IOQpJ.js → jison-CwQ0BO-q.js} +1 -1
- package/dist/studio/assets/{json-dOrE-En8.js → json-Je3YfUTE.js} +1 -1
- package/dist/studio/assets/{jsx-BSTPfqWX.js → jsx-Da-dLbW1.js} +1 -1
- package/dist/studio/assets/{julia-Dvz-BPmf.js → julia-CBJ0H-0z.js} +1 -1
- package/dist/studio/assets/{just-BHQm0Atq.js → just-CnuRC_nd.js} +1 -1
- package/dist/studio/assets/{latex-CxdhxuXv.js → latex-gZANCito.js} +1 -1
- package/dist/studio/assets/{liquid-D-hM-Q_F.js → liquid-0U9aXoFI.js} +1 -1
- package/dist/studio/assets/{lua-5qtqjLHq.js → lua-CX_TqMxt.js} +1 -1
- package/dist/studio/assets/{marko-5FJaM2co.js → marko-StSURz0o.js} +1 -1
- package/dist/studio/assets/{mdc-BhYW7lCG.js → mdc-CXZpf9k1.js} +1 -1
- package/dist/studio/assets/mermaid-GHXKKRXX-CqDQH2-r.js +1 -0
- package/dist/studio/assets/{nginx-rtAXrRye.js → nginx-3Q2L4366.js} +1 -1
- package/dist/studio/assets/{nim-DQSmaN9U.js → nim-CqX_5eXP.js} +1 -1
- package/dist/studio/assets/{perl-B54AdcaE.js → perl-CLOu1GnZ.js} +1 -1
- package/dist/studio/assets/{php-DpvTxCny.js → php-C1vkiu4h.js} +1 -1
- package/dist/studio/assets/{pug-Cyffw0Ho.js → pug-Cg3cFp5y.js} +1 -1
- package/dist/studio/assets/{qml-CxRetSkO.js → qml-DhKeHMwt.js} +1 -1
- package/dist/studio/assets/{r-CXWRxrXc.js → r--Lg2-Sir.js} +1 -1
- package/dist/studio/assets/{razor-BJzI-zc9.js → razor-Cjptf146.js} +1 -1
- package/dist/studio/assets/{regexp-dqxdfrnE.js → regexp-fS0DAwei.js} +1 -1
- package/dist/studio/assets/{rst-BW7eKYj4.js → rst-BBajBzk-.js} +1 -1
- package/dist/studio/assets/{ruby-D5Npyj8-.js → ruby-KvFedogM.js} +1 -1
- package/dist/studio/assets/{sas-DZLppjul.js → sas-D6p27LWr.js} +1 -1
- package/dist/studio/assets/{scss-CbqoxyAe.js → scss-6jXfJVsd.js} +1 -1
- package/dist/studio/assets/{shellscript-CFHqBeXu.js → shellscript-BK0Qbt1B.js} +1 -1
- package/dist/studio/assets/{shellsession-CbZDA4Bf.js → shellsession-BsXmVRU4.js} +1 -1
- package/dist/studio/assets/{soy-PImjtV58.js → soy-BKtGCXkJ.js} +1 -1
- package/dist/studio/assets/{sql-DhGo8urW.js → sql-vSUKslBj.js} +1 -1
- package/dist/studio/assets/{stata-CjHWbU2v.js → stata-BQ0iXcs9.js} +1 -1
- package/dist/studio/assets/{surrealql-o8Qr4t56.js → surrealql-v5pXHIwP.js} +1 -1
- package/dist/studio/assets/{svelte-DlSIyEV1.js → svelte-BMFjqgJb.js} +1 -1
- package/dist/studio/assets/{templ-qizfwU1w.js → templ-DYMTOmIJ.js} +1 -1
- package/dist/studio/assets/{tex-Ca7T661H.js → tex-BoQem9gj.js} +1 -1
- package/dist/studio/assets/{ts-tags-DUmjLkgl.js → ts-tags-Kp2pAlsd.js} +1 -1
- package/dist/studio/assets/{tsx-CfwgIqHW.js → tsx-DaB2J5uo.js} +1 -1
- package/dist/studio/assets/{twig-D7NAYUBY.js → twig-DohCGJPH.js} +1 -1
- package/dist/studio/assets/{typescript-Bbz9oX-P.js → typescript-BGG-5I-T.js} +1 -1
- package/dist/studio/assets/{vue-vYpz06zQ.js → vue-CCDLUl9R.js} +1 -1
- package/dist/studio/assets/{vue-html-CcxTb_Jn.js → vue-html-et9GYlaF.js} +1 -1
- package/dist/studio/assets/{vue-vine-DW4RqCKF.js → vue-vine-C561z6bx.js} +1 -1
- package/dist/studio/assets/{xml-R4LZ_u4f.js → xml-CJBA1ZPm.js} +1 -1
- package/dist/studio/assets/{xsl-CS-xzp3L.js → xsl-De-lf9XG.js} +1 -1
- package/dist/studio/assets/{yaml-CqDWbYXd.js → yaml-BcMKxf75.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/think.d.ts +3 -2
- package/dist/think.js +281 -77
- package/dist/think.js.map +1 -1
- package/dist/tools/fetch.d.ts +22 -0
- package/dist/tools/fetch.js +646 -0
- package/dist/tools/fetch.js.map +1 -0
- package/dist/workflows.d.ts +1 -1
- package/docs/getting-started.md +11 -11
- package/docs/index.md +62 -13
- package/docs/lifecycle-hooks.md +39 -26
- package/docs/sub-agents.md +17 -13
- package/package.json +12 -7
- package/dist/studio/assets/mermaid-GHXKKRXX-CWM2EB-u.js +0 -1
|
@@ -6,9 +6,11 @@ import {
|
|
|
6
6
|
D as createWorkspaceTools,
|
|
7
7
|
h as WorkspaceLike
|
|
8
8
|
} from "./workspace-BZXdZcuw.js";
|
|
9
|
+
import { t as CreateFetchToolsOptions } from "./fetch-By3eIQ-a.js";
|
|
9
10
|
import {
|
|
10
11
|
FlexibleSchema,
|
|
11
12
|
InferSchema,
|
|
13
|
+
InferToolOutput,
|
|
12
14
|
LanguageModel,
|
|
13
15
|
ModelMessage,
|
|
14
16
|
PrepareStepFunction,
|
|
@@ -743,8 +745,12 @@ interface TurnContext {
|
|
|
743
745
|
* All fields are optional — return only what you want to change.
|
|
744
746
|
*/
|
|
745
747
|
interface TurnConfig {
|
|
746
|
-
/**
|
|
747
|
-
|
|
748
|
+
/**
|
|
749
|
+
* Override the model for this turn (e.g. cheap model for continuations).
|
|
750
|
+
* Accepts a model id string (resolved via the built-in provider, same rules
|
|
751
|
+
* as {@link Think.getModel}) or a `LanguageModel`.
|
|
752
|
+
*/
|
|
753
|
+
model?: ThinkModel;
|
|
748
754
|
/** Override the assembled system prompt. */
|
|
749
755
|
system?: string;
|
|
750
756
|
/** Override the assembled messages. */
|
|
@@ -971,8 +977,17 @@ type PrepareStepContext<TOOLS extends ToolSet = ToolSet> = Parameters<
|
|
|
971
977
|
* return only the fields you want to override (`model`, `toolChoice`,
|
|
972
978
|
* `activeTools`, `system`, `messages`, `experimental_context`,
|
|
973
979
|
* `providerOptions`).
|
|
980
|
+
*
|
|
981
|
+
* `model` is widened to {@link ThinkModel}: like {@link Think.getModel}, you
|
|
982
|
+
* can return a model id string (resolved via the built-in provider) instead of
|
|
983
|
+
* a `LanguageModel`. Think resolves it before handing the step to the AI SDK.
|
|
974
984
|
*/
|
|
975
|
-
type StepConfig<TOOLS extends ToolSet = ToolSet> =
|
|
985
|
+
type StepConfig<TOOLS extends ToolSet = ToolSet> = Omit<
|
|
986
|
+
PrepareStepResult<TOOLS>,
|
|
987
|
+
"model"
|
|
988
|
+
> & {
|
|
989
|
+
model?: ThinkModel;
|
|
990
|
+
};
|
|
976
991
|
/**
|
|
977
992
|
* Context passed to the `beforeToolCall` hook **before** the tool's
|
|
978
993
|
* `execute` function runs.
|
|
@@ -987,7 +1002,9 @@ type StepConfig<TOOLS extends ToolSet = ToolSet> = PrepareStepResult<TOOLS>;
|
|
|
987
1002
|
* - `messages` — conversation messages visible at tool execution time
|
|
988
1003
|
* - `abortSignal` — signal that aborts if the turn is cancelled
|
|
989
1004
|
*
|
|
990
|
-
* Pass an explicit `TOOLS` generic for full input typing
|
|
1005
|
+
* Pass an explicit `TOOLS` generic for full input typing. With a concrete
|
|
1006
|
+
* tool set, narrowing on `ctx.toolName` narrows `ctx.input` to that tool's
|
|
1007
|
+
* input shape:
|
|
991
1008
|
*
|
|
992
1009
|
* ```ts
|
|
993
1010
|
* import type { ToolCallContext } from "@cloudflare/think";
|
|
@@ -995,18 +1012,43 @@ type StepConfig<TOOLS extends ToolSet = ToolSet> = PrepareStepResult<TOOLS>;
|
|
|
995
1012
|
*
|
|
996
1013
|
* beforeToolCall(ctx: ToolCallContext<typeof tools>) {
|
|
997
1014
|
* if (ctx.toolName === "search") {
|
|
998
|
-
* ctx.input.query; // typed
|
|
1015
|
+
* ctx.input.query; // typed as string
|
|
999
1016
|
* }
|
|
1000
1017
|
* }
|
|
1001
1018
|
* ```
|
|
1002
1019
|
*/
|
|
1003
|
-
type ToolCallContext<TOOLS extends ToolSet = ToolSet> =
|
|
1020
|
+
type ToolCallContext<TOOLS extends ToolSet = ToolSet> = PerToolCall<TOOLS> &
|
|
1021
|
+
ToolCallContextExtras;
|
|
1022
|
+
/** Per-call event extras attached to every {@link ToolCallContext}. */
|
|
1023
|
+
type ToolCallContextExtras = {
|
|
1004
1024
|
/** Zero-based index of the current step where this tool call occurs. */ readonly stepNumber:
|
|
1005
1025
|
| number
|
|
1006
1026
|
| undefined /** The conversation messages available at tool execution time. */;
|
|
1007
1027
|
readonly messages: ReadonlyArray<ModelMessage> /** Signal for cancelling the operation. */;
|
|
1008
1028
|
readonly abortSignal: AbortSignal | undefined;
|
|
1009
1029
|
};
|
|
1030
|
+
/**
|
|
1031
|
+
* The `TypedToolCall<TOOLS>` union, re-keyed so that discriminating on
|
|
1032
|
+
* `toolName` narrows `input` per tool.
|
|
1033
|
+
*
|
|
1034
|
+
* The AI SDK's `TypedToolCall` includes a `DynamicToolCall` arm whose
|
|
1035
|
+
* `toolName: string` / `input: unknown` overlaps every static tool name —
|
|
1036
|
+
* leaving it in the union collapses `ctx.input` to `unknown` even after a
|
|
1037
|
+
* `toolName` check. When an explicit `TOOLS` generic is passed (so the keys
|
|
1038
|
+
* are a literal union), we distribute over those keys and drop the dynamic
|
|
1039
|
+
* arm so narrowing works. With the default `ToolSet` (keys are `string`) we
|
|
1040
|
+
* fall back to the raw union, preserving the prior loose behavior.
|
|
1041
|
+
*/
|
|
1042
|
+
type PerToolCall<TOOLS extends ToolSet> = string extends keyof TOOLS
|
|
1043
|
+
? TypedToolCall<TOOLS>
|
|
1044
|
+
: {
|
|
1045
|
+
[K in keyof TOOLS]: Extract<
|
|
1046
|
+
TypedToolCall<TOOLS>,
|
|
1047
|
+
{
|
|
1048
|
+
toolName: K;
|
|
1049
|
+
}
|
|
1050
|
+
>;
|
|
1051
|
+
}[keyof TOOLS];
|
|
1010
1052
|
/**
|
|
1011
1053
|
* Decision returned by `beforeToolCall` to control tool execution.
|
|
1012
1054
|
* Return void/undefined to allow execution with original input.
|
|
@@ -1042,41 +1084,58 @@ type ToolCallDecision =
|
|
|
1042
1084
|
* - `messages` — conversation messages visible at tool execution time
|
|
1043
1085
|
* - `durationMs` — wall-clock execution time in milliseconds
|
|
1044
1086
|
* - `success`/`output`/`error` — discriminated outcome:
|
|
1045
|
-
* - on success: `success: true`, `output
|
|
1087
|
+
* - on success: `success: true`, `output` typed per tool
|
|
1046
1088
|
* - on failure: `success: false`, `error: unknown`
|
|
1047
1089
|
*
|
|
1048
|
-
* Pass an explicit `TOOLS` generic for full input typing
|
|
1090
|
+
* Pass an explicit `TOOLS` generic for full input **and** output typing.
|
|
1091
|
+
* On the success branch, narrowing on `ctx.toolName` narrows `ctx.output`
|
|
1092
|
+
* to that tool's inferred output type (dynamic tools stay `unknown`):
|
|
1049
1093
|
*
|
|
1050
1094
|
* ```ts
|
|
1051
1095
|
* import type { ToolCallResultContext } from "@cloudflare/think";
|
|
1052
1096
|
* import type { tools } from "./my-tools";
|
|
1053
1097
|
*
|
|
1054
1098
|
* afterToolCall(ctx: ToolCallResultContext<typeof tools>) {
|
|
1055
|
-
* if (ctx.success) {
|
|
1056
|
-
*
|
|
1057
|
-
* } else {
|
|
1058
|
-
* console.error(`${ctx.toolName} failed:`, ctx.error);
|
|
1099
|
+
* if (ctx.toolName === "search" && ctx.success) {
|
|
1100
|
+
* ctx.output.results; // typed as the `search` tool's output
|
|
1059
1101
|
* }
|
|
1060
1102
|
* }
|
|
1061
1103
|
* ```
|
|
1062
1104
|
*/
|
|
1063
1105
|
type ToolCallResultContext<TOOLS extends ToolSet = ToolSet> =
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1106
|
+
string extends keyof TOOLS
|
|
1107
|
+
? TypedToolCall<TOOLS> & ToolCallResultBase & ToolCallOutcome<unknown>
|
|
1108
|
+
: {
|
|
1109
|
+
[K in keyof TOOLS]: Extract<
|
|
1110
|
+
TypedToolCall<TOOLS>,
|
|
1111
|
+
{
|
|
1112
|
+
toolName: K;
|
|
1113
|
+
}
|
|
1114
|
+
> &
|
|
1115
|
+
ToolCallResultBase &
|
|
1116
|
+
ToolCallOutcome<InferToolOutput<TOOLS[K]>>;
|
|
1117
|
+
}[keyof TOOLS];
|
|
1118
|
+
/** Per-call extras attached to every {@link ToolCallResultContext}. */
|
|
1119
|
+
type ToolCallResultBase = {
|
|
1120
|
+
readonly stepNumber: number | undefined;
|
|
1121
|
+
readonly messages: ReadonlyArray<ModelMessage> /** Wall-clock execution time in milliseconds. */;
|
|
1122
|
+
readonly durationMs: number;
|
|
1123
|
+
};
|
|
1124
|
+
/**
|
|
1125
|
+
* The discriminated success/failure outcome of a tool call. On success the
|
|
1126
|
+
* `output` is typed (`O`); on failure the `error` is `unknown`.
|
|
1127
|
+
*/
|
|
1128
|
+
type ToolCallOutcome<O> =
|
|
1129
|
+
| {
|
|
1130
|
+
readonly success: true;
|
|
1131
|
+
readonly output: O;
|
|
1132
|
+
readonly error?: never;
|
|
1133
|
+
}
|
|
1134
|
+
| {
|
|
1135
|
+
readonly success: false;
|
|
1136
|
+
readonly output?: never;
|
|
1137
|
+
readonly error: unknown;
|
|
1138
|
+
};
|
|
1080
1139
|
/**
|
|
1081
1140
|
* Context passed to the `onStepFinish` hook after each step completes.
|
|
1082
1141
|
*
|
|
@@ -1122,6 +1181,36 @@ interface ExtensionConfig {
|
|
|
1122
1181
|
*
|
|
1123
1182
|
* @experimental The API surface may change before stabilizing.
|
|
1124
1183
|
*/
|
|
1184
|
+
/**
|
|
1185
|
+
* Keys of the global `AiModels` interface (from `@cloudflare/workers-types`)
|
|
1186
|
+
* whose model type extends `T`. Mirrors the derivation `workers-ai-provider`
|
|
1187
|
+
* uses, so the set stays in sync with the installed workers-types version.
|
|
1188
|
+
*/
|
|
1189
|
+
type WorkersAIModelIdsExtending<T> = {
|
|
1190
|
+
[K in keyof AiModels]: AiModels[K] extends T ? K : never;
|
|
1191
|
+
}[keyof AiModels];
|
|
1192
|
+
/**
|
|
1193
|
+
* A model id accepted by {@link Think.getModel}.
|
|
1194
|
+
*
|
|
1195
|
+
* Provides editor autocomplete for the Workers AI text-generation catalog
|
|
1196
|
+
* (`@cf/...`) while still accepting **any** string — including
|
|
1197
|
+
* `"<provider>/<model>"` AI Gateway slugs like `"openai/gpt-5.5"`, whose
|
|
1198
|
+
* validity is only known at runtime (the catalog is server-side and changes
|
|
1199
|
+
* independently of these types). The `(string & {})` arm is what keeps
|
|
1200
|
+
* arbitrary strings assignable without collapsing the autocomplete union.
|
|
1201
|
+
*/
|
|
1202
|
+
type ThinkModelId =
|
|
1203
|
+
| Exclude<
|
|
1204
|
+
WorkersAIModelIdsExtending<BaseAiTextGeneration>,
|
|
1205
|
+
WorkersAIModelIdsExtending<BaseAiTextToImage>
|
|
1206
|
+
>
|
|
1207
|
+
| (string & {});
|
|
1208
|
+
/**
|
|
1209
|
+
* What {@link Think.getModel} may return: either a fully-constructed AI SDK
|
|
1210
|
+
* `LanguageModel`, or a {@link ThinkModelId} string resolved through Think's
|
|
1211
|
+
* built-in `workers-ai-provider`. Also the input type of {@link Think.resolveModel}.
|
|
1212
|
+
*/
|
|
1213
|
+
type ThinkModel = LanguageModel | ThinkModelId;
|
|
1125
1214
|
declare class Think<
|
|
1126
1215
|
Env extends Cloudflare.Env = Cloudflare.Env,
|
|
1127
1216
|
State = unknown,
|
|
@@ -1315,6 +1404,22 @@ declare class Think<
|
|
|
1315
1404
|
workspaceBash:
|
|
1316
1405
|
| boolean
|
|
1317
1406
|
| NonNullable<Parameters<typeof createWorkspaceTools>[1]>["bash"];
|
|
1407
|
+
/**
|
|
1408
|
+
* Opt-in HTTP fetch tools. Disabled by default — set to a config object to
|
|
1409
|
+
* register a generic `fetch_url` tool (when `allowlist` is provided) and one
|
|
1410
|
+
* `fetch_<name>` tool per `bindings` target. Read-only (GET), allowlisted,
|
|
1411
|
+
* and bounded; see {@link createFetchTools}.
|
|
1412
|
+
*
|
|
1413
|
+
* The workspace and an observability hook are injected automatically, so omit
|
|
1414
|
+
* `workspace`/`onEvent` here. This property is evaluated at construction, so
|
|
1415
|
+
* use it for static config — for per-tenant/dynamic allowlists call
|
|
1416
|
+
* `createFetchTools()` inside `getTools()` instead (it runs every turn).
|
|
1417
|
+
*
|
|
1418
|
+
* ```ts
|
|
1419
|
+
* fetchTools = { allowlist: ["https://developers.cloudflare.com/**"] };
|
|
1420
|
+
* ```
|
|
1421
|
+
*/
|
|
1422
|
+
fetchTools: false | Omit<CreateFetchToolsOptions, "workspace" | "onEvent">;
|
|
1318
1423
|
constructor(ctx: DurableObjectState, env: Env);
|
|
1319
1424
|
/**
|
|
1320
1425
|
* Conversation history as Think's live in-memory view.
|
|
@@ -1645,10 +1750,69 @@ declare class Think<
|
|
|
1645
1750
|
private _configGet;
|
|
1646
1751
|
private _configDelete;
|
|
1647
1752
|
/**
|
|
1648
|
-
* Return the
|
|
1649
|
-
*
|
|
1753
|
+
* Return the model to use for inference. Must be overridden by subclasses.
|
|
1754
|
+
*
|
|
1755
|
+
* The return value can be either:
|
|
1756
|
+
*
|
|
1757
|
+
* - A **string** model id, resolved through the built-in
|
|
1758
|
+
* {@link https://www.npmjs.com/package/workers-ai-provider | workers-ai-provider}
|
|
1759
|
+
* off your `AI` binding (see {@link getAIBinding}). A `@cf/...` id hits
|
|
1760
|
+
* Workers AI directly; any other `"<provider>/<model>"` slug — e.g.
|
|
1761
|
+
* `"openai/gpt-5.5"`, `"anthropic/claude-sonnet-4-5"`, `"google/gemini-2.5-pro"`
|
|
1762
|
+
* — is routed through AI Gateway with resumable streaming on by default.
|
|
1763
|
+
* This is the common case: no extra package to install, no provider to wire.
|
|
1764
|
+
* - A fully-constructed AI SDK `LanguageModel`, for any other provider or for
|
|
1765
|
+
* full control over provider/gateway options.
|
|
1766
|
+
*
|
|
1767
|
+
* @example String (Workers AI)
|
|
1768
|
+
* ```typescript
|
|
1769
|
+
* getModel() {
|
|
1770
|
+
* return "@cf/moonshotai/kimi-k2.7-code";
|
|
1771
|
+
* }
|
|
1772
|
+
* ```
|
|
1773
|
+
*
|
|
1774
|
+
* @example String (third-party via AI Gateway)
|
|
1775
|
+
* ```typescript
|
|
1776
|
+
* getModel() {
|
|
1777
|
+
* return "openai/gpt-5.5";
|
|
1778
|
+
* }
|
|
1779
|
+
* ```
|
|
1780
|
+
*
|
|
1781
|
+
* @example Bring your own provider
|
|
1782
|
+
* ```typescript
|
|
1783
|
+
* import { createOpenAI } from "@ai-sdk/openai";
|
|
1784
|
+
* getModel() {
|
|
1785
|
+
* return createOpenAI({ apiKey: this.env.OPENAI_API_KEY })("gpt-5.5");
|
|
1786
|
+
* }
|
|
1787
|
+
* ```
|
|
1788
|
+
*/
|
|
1789
|
+
getModel(): ThinkModel;
|
|
1790
|
+
/**
|
|
1791
|
+
* Return the Workers AI binding used by the built-in default provider when
|
|
1792
|
+
* {@link getModel} returns a string. Defaults to `this.env.AI`. Override if
|
|
1793
|
+
* your binding is named something other than `AI`.
|
|
1650
1794
|
*/
|
|
1651
|
-
|
|
1795
|
+
getAIBinding(): Ai;
|
|
1796
|
+
/**
|
|
1797
|
+
* Lazily-constructed, instance-cached default provider. Bundles the `openai`
|
|
1798
|
+
* and `anthropic` wire-format plugins so a `"<provider>/<model>"` slug routes
|
|
1799
|
+
* through AI Gateway out of the box (covers OpenAI, Anthropic, Google,
|
|
1800
|
+
* xAI/Grok, Groq, and the OpenAI-compatible long tail).
|
|
1801
|
+
*
|
|
1802
|
+
* Cached per instance, which assumes {@link getAIBinding} is stable for the
|
|
1803
|
+
* lifetime of the agent (the default `this.env.AI` always is).
|
|
1804
|
+
*/
|
|
1805
|
+
private _defaultProvider?;
|
|
1806
|
+
/**
|
|
1807
|
+
* Resolve a model value into a concrete AI SDK `LanguageModel`.
|
|
1808
|
+
*
|
|
1809
|
+
* Defaults to resolving {@link getModel}. A `LanguageModel` is returned as-is;
|
|
1810
|
+
* a string is built through the bundled default provider (see {@link getModel}
|
|
1811
|
+
* for the slug rules). Use this whenever you need a usable model outside the
|
|
1812
|
+
* main turn — e.g. a side `generateText` call for summarization/compaction —
|
|
1813
|
+
* since `getModel()` may return a bare string.
|
|
1814
|
+
*/
|
|
1815
|
+
resolveModel(model?: ThinkModel): LanguageModel;
|
|
1652
1816
|
/**
|
|
1653
1817
|
* Return the system prompt for the assistant.
|
|
1654
1818
|
* Used as fallback when no context blocks are configured via `configureSession`.
|
|
@@ -2303,16 +2467,30 @@ declare class Think<
|
|
|
2303
2467
|
*
|
|
2304
2468
|
* **Streaming tools (AsyncIterable):** the AI SDK supports tools whose
|
|
2305
2469
|
* `execute` returns `AsyncIterable<output>` to emit preliminary
|
|
2306
|
-
* results before a final value.
|
|
2307
|
-
*
|
|
2308
|
-
* a
|
|
2309
|
-
*
|
|
2310
|
-
*
|
|
2311
|
-
*
|
|
2312
|
-
*
|
|
2313
|
-
*
|
|
2470
|
+
* results before a final value. The canonical form is an async
|
|
2471
|
+
* generator (`async function* execute(...)`), where calling `execute`
|
|
2472
|
+
* synchronously returns a direct `AsyncIterable`. For that form Think
|
|
2473
|
+
* preserves preliminary streaming: the wrapper is itself an async
|
|
2474
|
+
* generator that `await`s `beforeToolCall` and then yields every
|
|
2475
|
+
* chunk through unchanged. Non-streaming tools keep a scalar wrapper
|
|
2476
|
+
* so they never emit a synthetic `preliminary` tool-result chunk.
|
|
2477
|
+
*
|
|
2478
|
+
* The non-canonical `async function execute(...) { return makeIter(); }`
|
|
2479
|
+
* form returns a `Promise<AsyncIterable>`, which does not stream even
|
|
2480
|
+
* in the raw AI SDK (it would surface the iterator object as the final
|
|
2481
|
+
* output). Think collapses it to the last yielded value instead. If
|
|
2482
|
+
* you need preliminary streaming, use an `async function*` `execute`.
|
|
2314
2483
|
*/
|
|
2315
2484
|
private _wrapToolsWithDecision;
|
|
2485
|
+
/**
|
|
2486
|
+
* Shared `beforeToolCall` resolution for both the scalar and streaming
|
|
2487
|
+
* tool wrappers (see {@link _wrapToolsWithDecision}). Builds the
|
|
2488
|
+
* `ToolCallContext`, consults the subclass `beforeToolCall` hook,
|
|
2489
|
+
* dispatches the extension observation snapshot, and resolves the
|
|
2490
|
+
* returned `ToolCallDecision` into either "run `execute` with this
|
|
2491
|
+
* input" or "short-circuit with this output".
|
|
2492
|
+
*/
|
|
2493
|
+
private _resolveToolCallDecision;
|
|
2316
2494
|
private _pipelineExtensionToolCallStart;
|
|
2317
2495
|
private _pipelineExtensionToolCallFinish;
|
|
2318
2496
|
private _pipelineExtensionStepFinish;
|
|
@@ -3311,6 +3489,19 @@ declare class Think<
|
|
|
3311
3489
|
* broadcast — the deferred re-run re-fires `onExhausted` + the banner
|
|
3312
3490
|
* (the terminal writes themselves are idempotent).
|
|
3313
3491
|
*/
|
|
3492
|
+
/**
|
|
3493
|
+
* Recovery continuation callbacks the alarm-boundary OOM circuit breaker may
|
|
3494
|
+
* back off / purge (#1825). See `Agent._cf_handleAlarmMemoryLimitReset`.
|
|
3495
|
+
*/
|
|
3496
|
+
protected _cf_recoveryAlarmCallbacks(): string[];
|
|
3497
|
+
/**
|
|
3498
|
+
* Seal any still-live recovery incident as an out-of-memory exhaustion when
|
|
3499
|
+
* the alarm circuit breaker trips at its strike budget (#1825). Runs at the
|
|
3500
|
+
* outermost alarm frame (post-unwind), so the terminal banner / `onExhausted`
|
|
3501
|
+
* and the sealed-incident write can land where the mid-turn give-up's writes
|
|
3502
|
+
* OOMed. Reuses the shared give-up spine via `_exhaustRecoveryGiveUp`.
|
|
3503
|
+
*/
|
|
3504
|
+
protected _cf_sealMemoryLimitedRecovery(): Promise<void>;
|
|
3314
3505
|
private _exhaustRecoveryGiveUp;
|
|
3315
3506
|
/**
|
|
3316
3507
|
* Give-up after the stable-state-timeout retry budget drained. Thin wrapper
|
|
@@ -3318,6 +3509,30 @@ declare class Think<
|
|
|
3318
3509
|
* `stable_timeout`.
|
|
3319
3510
|
*/
|
|
3320
3511
|
private _exhaustRecoveryAfterStableTimeout;
|
|
3512
|
+
/**
|
|
3513
|
+
* Apply the tight OOM-retry budget to a recovery error (#1825). Invoked from
|
|
3514
|
+
* `_handleRecoveryCallbackError`, i.e. for an OOM that is *thrown* out of a
|
|
3515
|
+
* recovery turn (typically from recovery bookkeeping or storage/SQL ops that
|
|
3516
|
+
* reject with the memory-limit-reset message after an isolate reset). An OOM
|
|
3517
|
+
* that surfaces as a returned `error` result means `continueLastTurn` already
|
|
3518
|
+
* terminalized the turn (client error frame + `onError`), so it is NOT routed
|
|
3519
|
+
* here — re-driving a terminalized turn would be wasteful and risk a second
|
|
3520
|
+
* terminal signal. `error` may be an Error or a wrapper with a `cause` chain.
|
|
3521
|
+
*
|
|
3522
|
+
* The reliable terminator is the begin-path (`evaluateChatRecoveryIncident`),
|
|
3523
|
+
* which seals once `oomAttempts` exceeds the budget; that runs before the
|
|
3524
|
+
* memory-heavy turn, in the low-memory window where writes succeed. This
|
|
3525
|
+
* method's job is to persist `oomAttempts` (small writes) so the begin path
|
|
3526
|
+
* can act on it, and to schedule a delayed re-run while under budget.
|
|
3527
|
+
*
|
|
3528
|
+
* Returns `true` when the error was an OOM and this method owns the outcome:
|
|
3529
|
+
* - under budget → a delayed re-run was scheduled (best-effort: a transient
|
|
3530
|
+
* spike may clear);
|
|
3531
|
+
* - over budget (or untrackable, or the bookkeeping itself OOMed) →
|
|
3532
|
+
* terminalized via the give-up path with `reason="out_of_memory"`.
|
|
3533
|
+
* Returns `false` for non-OOM errors so the caller proceeds normally.
|
|
3534
|
+
*/
|
|
3535
|
+
private _handleRecoveryOom;
|
|
3321
3536
|
/**
|
|
3322
3537
|
* Handle an error thrown by `_chatRecoveryContinue` / `_chatRecoveryRetry`
|
|
3323
3538
|
* after the incident was opened.
|
|
@@ -3584,6 +3799,14 @@ interface MessengerAuthor {
|
|
|
3584
3799
|
interface MessengerAttachment {
|
|
3585
3800
|
data?: ArrayBuffer;
|
|
3586
3801
|
fetch?: () => Promise<ArrayBuffer>;
|
|
3802
|
+
/**
|
|
3803
|
+
* Platform-specific metadata needed to re-fetch the attachment after the
|
|
3804
|
+
* event has been serialized (e.g. across a sub-agent Durable Object hop).
|
|
3805
|
+
* Adapters store identifiers here — Telegram `fileId`, WhatsApp `mediaId`,
|
|
3806
|
+
* etc. — that survive serialization even when `fetch`, `data`, and `raw`
|
|
3807
|
+
* cannot, so a downstream agent can reconstruct the download closure.
|
|
3808
|
+
*/
|
|
3809
|
+
fetchMetadata?: Record<string, string>;
|
|
3587
3810
|
id?: string;
|
|
3588
3811
|
mediaType?: string;
|
|
3589
3812
|
name?: string;
|
|
@@ -3959,64 +4182,66 @@ export {
|
|
|
3959
4182
|
messengerContextFromEvent as $,
|
|
3960
4183
|
StepResult as $t,
|
|
3961
4184
|
MessengerDeliveryPolicy as A,
|
|
3962
|
-
|
|
4185
|
+
defaultContextOverflowClassifier as An,
|
|
3963
4186
|
FiberRecoveryContext$1 as At,
|
|
3964
4187
|
messengerReplyRecoveryMode as B,
|
|
3965
|
-
|
|
4188
|
+
NormalizedChannelDefinition as Bn,
|
|
3966
4189
|
RunTurnBase as Bt,
|
|
3967
4190
|
DeliverMessengerReplyOptions as C,
|
|
3968
|
-
|
|
4191
|
+
TurnInput as Cn,
|
|
3969
4192
|
ChunkContext as Ct,
|
|
3970
4193
|
ERROR_MESSENGER_RESPONSE as D,
|
|
3971
|
-
|
|
4194
|
+
TypedToolResult as Dn,
|
|
3972
4195
|
DeliverNoticeOptions as Dt,
|
|
3973
4196
|
EMPTY_MESSENGER_RESPONSE as E,
|
|
3974
|
-
|
|
4197
|
+
TypedToolCall$1 as En,
|
|
3975
4198
|
DeleteSubmissionsOptions as Et,
|
|
3976
4199
|
TextStreamCallback as F,
|
|
3977
|
-
|
|
4200
|
+
ChannelDefinition as Fn,
|
|
3978
4201
|
PrepareStepContext as Ft,
|
|
3979
4202
|
MessengerAttachment as G,
|
|
3980
4203
|
SaveMessagesOptions$1 as Gt,
|
|
3981
4204
|
parseMessengerReplySnapshot as H,
|
|
4205
|
+
messengerChannel as Hn,
|
|
3982
4206
|
RunTurnStream as Ht,
|
|
3983
4207
|
TextStreamCallbackOptions as I,
|
|
3984
|
-
|
|
4208
|
+
ChannelDeliveryPolicy as In,
|
|
3985
4209
|
PrepareStepFunction$1 as It,
|
|
3986
4210
|
MessengerContext as J,
|
|
3987
4211
|
SessionMessage$1 as Jt,
|
|
3988
4212
|
MessengerAuthor as K,
|
|
3989
4213
|
SaveMessagesResult$1 as Kt,
|
|
3990
4214
|
defaultDeliveryTag as L,
|
|
3991
|
-
|
|
4215
|
+
ChannelDeliverySurface as Ln,
|
|
3992
4216
|
PrepareStepResult$1 as Lt,
|
|
3993
4217
|
MessengerDeliveryTarget as M,
|
|
3994
|
-
|
|
4218
|
+
skills as Mn,
|
|
3995
4219
|
MessageConcurrency$1 as Mt,
|
|
3996
4220
|
MessengerReplySnapshot as N,
|
|
3997
|
-
|
|
4221
|
+
ChannelCapabilities as Nn,
|
|
3998
4222
|
OnStartDegradation as Nt,
|
|
3999
4223
|
INTERRUPTED_MESSENGER_RESPONSE as O,
|
|
4000
|
-
|
|
4224
|
+
Workspace$1 as On,
|
|
4001
4225
|
ExtensionConfig as Ot,
|
|
4002
4226
|
MessengerReplyStage as P,
|
|
4003
|
-
|
|
4227
|
+
ChannelContext as Pn,
|
|
4004
4228
|
PendingApproval as Pt,
|
|
4005
4229
|
MessengerThread as Q,
|
|
4006
4230
|
StepContext as Qt,
|
|
4007
4231
|
deliverMessengerReply as R,
|
|
4008
|
-
|
|
4232
|
+
ChannelIngress as Rn,
|
|
4009
4233
|
ReplyAttachment as Rt,
|
|
4010
4234
|
toMessengerThread as S,
|
|
4011
|
-
|
|
4235
|
+
TurnContext as Sn,
|
|
4012
4236
|
ChatStartEvent as St,
|
|
4013
4237
|
DeliveryTag as T,
|
|
4014
|
-
|
|
4238
|
+
TurnResult as Tn,
|
|
4015
4239
|
ContextOverflowConfig as Tt,
|
|
4016
4240
|
textDeltaFromStreamChunk as U,
|
|
4241
|
+
MediaEvictionConfig as Un,
|
|
4017
4242
|
RunTurnSubmit as Ut,
|
|
4018
4243
|
messengerReplySnapshot as V,
|
|
4019
|
-
|
|
4244
|
+
ThinkChannels as Vn,
|
|
4020
4245
|
RunTurnOptions as Vt,
|
|
4021
4246
|
MessengerAction as W,
|
|
4022
4247
|
RunTurnWait as Wt,
|
|
@@ -4027,45 +4252,45 @@ export {
|
|
|
4027
4252
|
MessengerMessage as Z,
|
|
4028
4253
|
StepConfig as Zt,
|
|
4029
4254
|
idempotencyKeyForEvent as _,
|
|
4030
|
-
|
|
4255
|
+
ThinkWallClockSchedule as _n,
|
|
4031
4256
|
ChatRecoveryContext$1 as _t,
|
|
4032
4257
|
MessengerConversationTarget as a,
|
|
4033
4258
|
TextStreamPart as an,
|
|
4034
4259
|
ActionAuthorizationContext as at,
|
|
4035
4260
|
toMessengerAuthor as b,
|
|
4036
|
-
|
|
4261
|
+
ToolCallResultContext as bn,
|
|
4037
4262
|
ChatRecoveryProgressContext as bt,
|
|
4038
4263
|
MessengerThinkHost as c,
|
|
4039
|
-
|
|
4264
|
+
ThinkModel as cn,
|
|
4040
4265
|
ActionContext as ct,
|
|
4041
4266
|
ThinkMessengerRuntime as d,
|
|
4042
|
-
|
|
4267
|
+
ThinkScheduledTaskContext as dn,
|
|
4043
4268
|
ActionPermissionSpec as dt,
|
|
4044
4269
|
StopCondition$1 as en,
|
|
4045
4270
|
serializableMessengerEvent as et,
|
|
4046
4271
|
ThinkMessengerStateAgent as f,
|
|
4047
|
-
|
|
4272
|
+
ThinkScheduledTaskSchedule as fn,
|
|
4048
4273
|
AddMessagesOptions as ft,
|
|
4049
4274
|
defaultConversationName as g,
|
|
4050
|
-
|
|
4275
|
+
ThinkTime as gn,
|
|
4051
4276
|
ChatRecoveryConfig$1 as gt,
|
|
4052
4277
|
defaultChatSdkEvent as h,
|
|
4053
|
-
|
|
4278
|
+
ThinkSubmissionStatus as hn,
|
|
4054
4279
|
ChatOptions as ht,
|
|
4055
4280
|
MessengerConversationResolver as i,
|
|
4056
4281
|
SubmitMessagesResult as in,
|
|
4057
4282
|
ActionApprovalPolicy as it,
|
|
4058
4283
|
MessengerDeliverySurface as j,
|
|
4059
|
-
|
|
4284
|
+
isAction as jn,
|
|
4060
4285
|
ListSubmissionsOptions as jt,
|
|
4061
4286
|
MESSENGER_REPLY_FIBER_NAME as k,
|
|
4062
|
-
|
|
4287
|
+
action as kn,
|
|
4063
4288
|
FiberContext$1 as kt,
|
|
4064
4289
|
MessengerThinkTarget as l,
|
|
4065
|
-
|
|
4290
|
+
ThinkModelId as ln,
|
|
4066
4291
|
ActionIdempotencyKey as lt,
|
|
4067
4292
|
chatSdkMessenger as m,
|
|
4068
|
-
|
|
4293
|
+
ThinkSubmissionInspection as mn,
|
|
4069
4294
|
ChatErrorContext as mt,
|
|
4070
4295
|
ChatSdkMessengerOptions as n,
|
|
4071
4296
|
StreamableResult as nn,
|
|
@@ -4074,7 +4299,7 @@ export {
|
|
|
4074
4299
|
Think as on,
|
|
4075
4300
|
ActionAuthorizationDecision as ot,
|
|
4076
4301
|
ThinkMessengers as p,
|
|
4077
|
-
|
|
4302
|
+
ThinkScheduledTasks as pn,
|
|
4078
4303
|
ChatErrorClassification as pt,
|
|
4079
4304
|
MessengerCapabilities as q,
|
|
4080
4305
|
Session$1 as qt,
|
|
@@ -4088,22 +4313,22 @@ export {
|
|
|
4088
4313
|
StreamCallback as tn,
|
|
4089
4314
|
toMessengerUserMessage as tt,
|
|
4090
4315
|
NormalizedMessengerDefinition as u,
|
|
4091
|
-
|
|
4316
|
+
ThinkScheduledTask as un,
|
|
4092
4317
|
ActionKind as ut,
|
|
4093
4318
|
normalizeMessengers as v,
|
|
4094
|
-
|
|
4319
|
+
ToolCallContext as vn,
|
|
4095
4320
|
ChatRecoveryExhaustedContext as vt,
|
|
4096
4321
|
DeliveryKind as w,
|
|
4097
|
-
|
|
4322
|
+
TurnInputMessages as wn,
|
|
4098
4323
|
ChunkPart as wt,
|
|
4099
4324
|
toMessengerMessage as x,
|
|
4100
|
-
|
|
4325
|
+
TurnConfig as xn,
|
|
4101
4326
|
ChatResponseResult$1 as xt,
|
|
4102
4327
|
toMessengerAttachment as y,
|
|
4103
|
-
|
|
4328
|
+
ToolCallDecision as yn,
|
|
4104
4329
|
ChatRecoveryOptions$1 as yt,
|
|
4105
4330
|
messengerReplyFailureMode as z,
|
|
4106
|
-
|
|
4331
|
+
ChannelKind as zn,
|
|
4107
4332
|
ResolvedChatRecoveryConfig as zt
|
|
4108
4333
|
};
|
|
4109
|
-
//# sourceMappingURL=index-
|
|
4334
|
+
//# sourceMappingURL=index-WF0HQmkk.d.ts.map
|
package/dist/messengers/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as textDeltaFromStreamChunk, E as toMessengerUserMessage, S as parseMessengerReplySnapshot, T as serializableMessengerEvent, _ as defaultDeliveryTag, a as defaultConversationName, b as messengerReplyRecoveryMode, c as toMessengerAttachment, d as toMessengerThread, f as EMPTY_MESSENGER_RESPONSE, g as TextStreamCallback, h as MESSENGER_REPLY_FIBER_NAME, i as defaultChatSdkEvent, l as toMessengerAuthor, m as INTERRUPTED_MESSENGER_RESPONSE, n as ThinkMessengerStateAgent, o as idempotencyKeyForEvent, p as ERROR_MESSENGER_RESPONSE, r as chatSdkMessenger, s as normalizeMessengers, t as ThinkMessengerRuntime, u as toMessengerMessage, v as deliverMessengerReply, w as messengerContextFromEvent, x as messengerReplySnapshot, y as messengerReplyFailureMode } from "../chat-sdk-
|
|
1
|
+
import { C as textDeltaFromStreamChunk, E as toMessengerUserMessage, S as parseMessengerReplySnapshot, T as serializableMessengerEvent, _ as defaultDeliveryTag, a as defaultConversationName, b as messengerReplyRecoveryMode, c as toMessengerAttachment, d as toMessengerThread, f as EMPTY_MESSENGER_RESPONSE, g as TextStreamCallback, h as MESSENGER_REPLY_FIBER_NAME, i as defaultChatSdkEvent, l as toMessengerAuthor, m as INTERRUPTED_MESSENGER_RESPONSE, n as ThinkMessengerStateAgent, o as idempotencyKeyForEvent, p as ERROR_MESSENGER_RESPONSE, r as chatSdkMessenger, s as normalizeMessengers, t as ThinkMessengerRuntime, u as toMessengerMessage, v as deliverMessengerReply, w as messengerContextFromEvent, x as messengerReplySnapshot, y as messengerReplyFailureMode } from "../chat-sdk-Dm0R3pdR.js";
|
|
2
2
|
export { EMPTY_MESSENGER_RESPONSE, ERROR_MESSENGER_RESPONSE, INTERRUPTED_MESSENGER_RESPONSE, MESSENGER_REPLY_FIBER_NAME, TextStreamCallback, ThinkMessengerRuntime, ThinkMessengerStateAgent, chatSdkMessenger, defaultChatSdkEvent, defaultConversationName, defaultDeliveryTag, deliverMessengerReply, idempotencyKeyForEvent, messengerContextFromEvent, messengerReplyFailureMode, messengerReplyRecoveryMode, messengerReplySnapshot, normalizeMessengers, parseMessengerReplySnapshot, serializableMessengerEvent, textDeltaFromStreamChunk, toMessengerAttachment, toMessengerAuthor, toMessengerMessage, toMessengerThread, toMessengerUserMessage };
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
F as TextStreamCallback,
|
|
3
3
|
n as ChatSdkMessengerOptions,
|
|
4
4
|
o as MessengerDefinition
|
|
5
|
-
} from "../index-
|
|
5
|
+
} from "../index-WF0HQmkk.js";
|
|
6
6
|
import { TelegramAdapterConfig } from "@chat-adapter/telegram";
|
|
7
7
|
|
|
8
8
|
//#region src/messengers/telegram.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as chatSdkMessenger } from "../chat-sdk-
|
|
1
|
+
import { r as chatSdkMessenger } from "../chat-sdk-Dm0R3pdR.js";
|
|
2
2
|
import { createTelegramAdapter } from "@chat-adapter/telegram";
|
|
3
3
|
//#region src/messengers/telegram.ts
|
|
4
4
|
const TELEGRAM_STREAM_SOFT_LIMIT = 3400;
|