@cloudflare/think 0.13.0 → 0.15.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 (102) hide show
  1. package/README.md +39 -21
  2. package/dist/cli/index.js +1 -1
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/extensions/index.d.ts +100 -8
  5. package/dist/{hook-proxy-CkF0EhRO.js → hook-proxy-Dogs9wbj.js} +3 -3
  6. package/dist/{hook-proxy-CkF0EhRO.js.map → hook-proxy-Dogs9wbj.js.map} +1 -1
  7. package/dist/{index-Cm0jriTY.d.ts → index-s3Pl812H.d.ts} +82 -21
  8. package/dist/messengers/index.d.ts +1 -1
  9. package/dist/messengers/telegram.d.ts +1 -1
  10. package/dist/studio/assets/{angular-html--XgCyfPu.js → angular-html-B26lsrRw.js} +1 -1
  11. package/dist/studio/assets/{angular-ts-Dt-feQIe.js → angular-ts-B0BTTyHo.js} +1 -1
  12. package/dist/studio/assets/{apl-B7ymkyp4.js → apl-W5hJk0fj.js} +1 -1
  13. package/dist/studio/assets/{astro-Ce5cw2JI.js → astro-ChkXCqsA.js} +1 -1
  14. package/dist/studio/assets/{blade-DL-aXwjv.js → blade-Dy0zTtr6.js} +1 -1
  15. package/dist/studio/assets/{c-CFfr09UF.js → c-DOHYbsuN.js} +1 -1
  16. package/dist/studio/assets/{cobol-Ba1f5ZqR.js → cobol-DtGo7U_-.js} +1 -1
  17. package/dist/studio/assets/{coffee-BG2_viYI.js → coffee-Uf9fkZqI.js} +1 -1
  18. package/dist/studio/assets/{cpp-pU5HgBva.js → cpp-CVwmol0l.js} +1 -1
  19. package/dist/studio/assets/{crystal-Dlm_uR4r.js → crystal-ChHObCtF.js} +1 -1
  20. package/dist/studio/assets/{css-tUC4TMTn.js → css-DYjZAj5w.js} +1 -1
  21. package/dist/studio/assets/{edge-CQuSKMUt.js → edge-C2J43zbu.js} +1 -1
  22. package/dist/studio/assets/{elixir-BmIB-Wi1.js → elixir-B7WZ8XhB.js} +1 -1
  23. package/dist/studio/assets/{elm-ByVNCtDB.js → elm-PN4qGuR2.js} +1 -1
  24. package/dist/studio/assets/{erb-DO4uDxTq.js → erb-CkbjE2OZ.js} +1 -1
  25. package/dist/studio/assets/{git-rebase-CT8LXapC.js → git-rebase-CsGmQhFO.js} +1 -1
  26. package/dist/studio/assets/{glimmer-js-DzIT0v-m.js → glimmer-js-D85-ZYXa.js} +1 -1
  27. package/dist/studio/assets/{glimmer-ts-znG2j9R4.js → glimmer-ts-B_0SLVPe.js} +1 -1
  28. package/dist/studio/assets/{glsl-C1p8U_gW.js → glsl-BE5n0T0t.js} +1 -1
  29. package/dist/studio/assets/{graphql-CFqegryf.js → graphql-BVcCJEBO.js} +1 -1
  30. package/dist/studio/assets/{hack-BfVsNhqs.js → hack-CyUu15_C.js} +1 -1
  31. package/dist/studio/assets/{haml-DVcEksY5.js → haml-Dj54pugT.js} +1 -1
  32. package/dist/studio/assets/{handlebars-DSWgWCJ4.js → handlebars-l3llPaCT.js} +1 -1
  33. package/dist/studio/assets/{highlighted-body-OFNGDK62-BIm4UpTS.js → highlighted-body-OFNGDK62-D_z62he-.js} +1 -1
  34. package/dist/studio/assets/{html-C-lP7-T4.js → html--Tmh4628.js} +1 -1
  35. package/dist/studio/assets/{html-derivative-ByukJopb.js → html-derivative-B0Q_m8BM.js} +1 -1
  36. package/dist/studio/assets/{http-Bax2fYIk.js → http-BXKW9YQL.js} +1 -1
  37. package/dist/studio/assets/{hurl-BrI2qfvy.js → hurl-C60QjgUE.js} +1 -1
  38. package/dist/studio/assets/index-Cd4PgOFu.js +390 -0
  39. package/dist/studio/assets/{java-ZiR-uym-.js → java-aXeLcVht.js} +1 -1
  40. package/dist/studio/assets/{javascript-Dhhw85Vr.js → javascript-BQcRH4fE.js} +1 -1
  41. package/dist/studio/assets/{jinja-DqSGkgE4.js → jinja-DGNUkEt-.js} +1 -1
  42. package/dist/studio/assets/{jison-CwQ0BO-q.js → jison-DwfSvoKv.js} +1 -1
  43. package/dist/studio/assets/{json-Je3YfUTE.js → json-B0ukOVyl.js} +1 -1
  44. package/dist/studio/assets/{jsx-Da-dLbW1.js → jsx-CzJUnsSO.js} +1 -1
  45. package/dist/studio/assets/{julia-CBJ0H-0z.js → julia-D8zt_FEP.js} +1 -1
  46. package/dist/studio/assets/{just-CnuRC_nd.js → just-nn4e9Gpd.js} +1 -1
  47. package/dist/studio/assets/{latex-gZANCito.js → latex-OBwqlec5.js} +1 -1
  48. package/dist/studio/assets/{liquid-0U9aXoFI.js → liquid-CktG-Iuw.js} +1 -1
  49. package/dist/studio/assets/{lua-CX_TqMxt.js → lua-ZqavSetL.js} +1 -1
  50. package/dist/studio/assets/{marko-StSURz0o.js → marko-CxDLRfNz.js} +1 -1
  51. package/dist/studio/assets/{mdc-CXZpf9k1.js → mdc-COZbBQqS.js} +1 -1
  52. package/dist/studio/assets/mermaid-GHXKKRXX-ChY6AJ7l.js +1 -0
  53. package/dist/studio/assets/{nginx-3Q2L4366.js → nginx-DB8A8-iZ.js} +1 -1
  54. package/dist/studio/assets/{nim-CqX_5eXP.js → nim-Cs5VB9QZ.js} +1 -1
  55. package/dist/studio/assets/{perl-CLOu1GnZ.js → perl-pV-3Dli_.js} +1 -1
  56. package/dist/studio/assets/{php-C1vkiu4h.js → php-CFSq0mhc.js} +1 -1
  57. package/dist/studio/assets/{pug-Cg3cFp5y.js → pug-DuCfu-AK.js} +1 -1
  58. package/dist/studio/assets/{qml-DhKeHMwt.js → qml-Gqte1OeW.js} +1 -1
  59. package/dist/studio/assets/{r--Lg2-Sir.js → r-B8XqafmU.js} +1 -1
  60. package/dist/studio/assets/{razor-Cjptf146.js → razor-HyK7qWun.js} +1 -1
  61. package/dist/studio/assets/{regexp-fS0DAwei.js → regexp-Bdipf9Ks.js} +1 -1
  62. package/dist/studio/assets/{rst-BBajBzk-.js → rst-DtdOQB-0.js} +1 -1
  63. package/dist/studio/assets/{ruby-KvFedogM.js → ruby-DOExsDws.js} +1 -1
  64. package/dist/studio/assets/{sas-D6p27LWr.js → sas-BLRRJVWF.js} +1 -1
  65. package/dist/studio/assets/{scss-6jXfJVsd.js → scss-BILH_sWZ.js} +1 -1
  66. package/dist/studio/assets/{shellscript-BK0Qbt1B.js → shellscript-CC2KTOv4.js} +1 -1
  67. package/dist/studio/assets/{shellsession-BsXmVRU4.js → shellsession-CiGs-_qT.js} +1 -1
  68. package/dist/studio/assets/{soy-BKtGCXkJ.js → soy-QSSlYQhf.js} +1 -1
  69. package/dist/studio/assets/{sql-vSUKslBj.js → sql-CPD_IP3i.js} +1 -1
  70. package/dist/studio/assets/{stata-BQ0iXcs9.js → stata-jhUDP248.js} +1 -1
  71. package/dist/studio/assets/{surrealql-v5pXHIwP.js → surrealql-CEI1vHaO.js} +1 -1
  72. package/dist/studio/assets/{svelte-BMFjqgJb.js → svelte-BqMghnvQ.js} +1 -1
  73. package/dist/studio/assets/{templ-DYMTOmIJ.js → templ-DhMt3Gd_.js} +1 -1
  74. package/dist/studio/assets/{tex-BoQem9gj.js → tex-B2oLGu4M.js} +1 -1
  75. package/dist/studio/assets/{ts-tags-Kp2pAlsd.js → ts-tags-DbXbAuWo.js} +1 -1
  76. package/dist/studio/assets/{tsx-DaB2J5uo.js → tsx-BWdjt-eB.js} +1 -1
  77. package/dist/studio/assets/{twig-DohCGJPH.js → twig-b7sZE9-Z.js} +1 -1
  78. package/dist/studio/assets/{typescript-BGG-5I-T.js → typescript-B5gQukXY.js} +1 -1
  79. package/dist/studio/assets/{vue-CCDLUl9R.js → vue-DGv3yRD9.js} +1 -1
  80. package/dist/studio/assets/{vue-html-et9GYlaF.js → vue-html-Cx5Ph-Io.js} +1 -1
  81. package/dist/studio/assets/{vue-vine-C561z6bx.js → vue-vine-G05O51ag.js} +1 -1
  82. package/dist/studio/assets/{xml-CJBA1ZPm.js → xml-Bd8eSLdt.js} +1 -1
  83. package/dist/studio/assets/{xsl-De-lf9XG.js → xsl-DVLXYJQL.js} +1 -1
  84. package/dist/studio/assets/{yaml-BcMKxf75.js → yaml-CO0sPwby.js} +1 -1
  85. package/dist/studio/index.html +1 -1
  86. package/dist/think.d.ts +2 -2
  87. package/dist/think.js +419 -123
  88. package/dist/think.js.map +1 -1
  89. package/dist/tools/execute.d.ts +1 -1
  90. package/dist/tools/extensions.d.ts +4 -37
  91. package/dist/tools/extensions.js.map +1 -1
  92. package/dist/tools/workspace.d.ts +1 -1
  93. package/dist/tools/workspace.js +1 -13
  94. package/dist/tools/workspace.js.map +1 -1
  95. package/dist/workflows.d.ts +1 -1
  96. package/dist/{workspace-BZXdZcuw.d.ts → workspace-DxZQSbko.d.ts} +10 -157
  97. package/docs/index.md +16 -0
  98. package/docs/tools.md +19 -2
  99. package/package.json +13 -13
  100. package/dist/index-B-zgBVj2.d.ts +0 -109
  101. package/dist/studio/assets/index-DNSTOyBe.js +0 -390
  102. package/dist/studio/assets/mermaid-GHXKKRXX-CqDQH2-r.js +0 -1
@@ -1,3 +1,4 @@
1
+ import { Tool } from "ai";
1
2
  import { FileInfo, Workspace } from "@cloudflare/shell";
2
3
 
3
4
  //#region src/tools/workspace.d.ts
@@ -123,155 +124,30 @@ declare function createWorkspaceTools(
123
124
  workspace: WorkspaceLike,
124
125
  options?: WorkspaceToolsOptions
125
126
  ): WorkspaceTools;
126
- type TextReadToolOutput = {
127
- path: string;
128
- content: string;
129
- totalLines: number;
130
- fromLine?: number;
131
- toLine?: number;
132
- };
133
- type ImageReadToolOutput = {
134
- kind: "image";
135
- path: string;
136
- name: string;
137
- mediaType: string;
138
- sizeBytes: number;
139
- };
140
- type FileReadToolOutput = {
141
- kind: "file";
142
- path: string;
143
- name: string;
144
- mediaType: string;
145
- sizeBytes: number;
146
- };
147
- type BinaryReadToolOutput = {
148
- kind: "binary";
149
- path: string;
150
- name: string;
151
- mediaType: string;
152
- sizeBytes: number;
153
- unsupported: true;
154
- };
155
- type ReadToolError = {
156
- error: string;
157
- };
158
- type ReadToolOutput =
159
- | TextReadToolOutput
160
- | ImageReadToolOutput
161
- | FileReadToolOutput
162
- | BinaryReadToolOutput
163
- | ReadToolError;
164
127
  interface ReadToolOptions {
165
128
  ops: ReadOperations;
166
129
  }
167
- declare function createReadTool(options: ReadToolOptions): import("ai").Tool<
168
- {
169
- path: string;
170
- offset?: number | undefined;
171
- limit?: number | undefined;
172
- },
173
- ReadToolOutput
174
- >;
130
+ declare function createReadTool(options: ReadToolOptions): Tool;
175
131
  interface WriteToolOptions {
176
132
  ops: WriteOperations;
177
133
  }
178
- declare function createWriteTool(options: WriteToolOptions): import("ai").Tool<
179
- {
180
- path: string;
181
- content: string;
182
- },
183
- {
184
- path: string;
185
- bytesWritten: number;
186
- lines: number;
187
- }
188
- >;
134
+ declare function createWriteTool(options: WriteToolOptions): Tool;
189
135
  interface EditToolOptions {
190
136
  ops: EditOperations;
191
137
  }
192
- declare function createEditTool(options: EditToolOptions): import("ai").Tool<
193
- {
194
- path: string;
195
- old_string: string;
196
- new_string: string;
197
- },
198
- | {
199
- error: string;
200
- path?: undefined;
201
- created?: undefined;
202
- lines?: undefined;
203
- replaced?: undefined;
204
- fuzzyMatch?: undefined;
205
- }
206
- | {
207
- path: string;
208
- created: boolean;
209
- lines: number;
210
- error?: undefined;
211
- replaced?: undefined;
212
- fuzzyMatch?: undefined;
213
- }
214
- | {
215
- path: string;
216
- replaced: boolean;
217
- fuzzyMatch: boolean;
218
- lines: number;
219
- error?: undefined;
220
- created?: undefined;
221
- }
222
- | {
223
- path: string;
224
- replaced: boolean;
225
- lines: number;
226
- error?: undefined;
227
- created?: undefined;
228
- fuzzyMatch?: undefined;
229
- }
230
- >;
138
+ declare function createEditTool(options: EditToolOptions): Tool;
231
139
  interface ListToolOptions {
232
140
  ops: ListOperations;
233
141
  }
234
- declare function createListTool(options: ListToolOptions): import("ai").Tool<
235
- {
236
- path: string;
237
- limit?: number | undefined;
238
- offset?: number | undefined;
239
- },
240
- {
241
- path: string;
242
- count: number;
243
- entries: string[];
244
- }
245
- >;
142
+ declare function createListTool(options: ListToolOptions): Tool;
246
143
  interface FindToolOptions {
247
144
  ops: FindOperations;
248
145
  }
249
- declare function createFindTool(options: FindToolOptions): import("ai").Tool<
250
- {
251
- pattern: string;
252
- },
253
- Record<string, unknown>
254
- >;
146
+ declare function createFindTool(options: FindToolOptions): Tool;
255
147
  interface GrepToolOptions {
256
148
  ops: GrepOperations;
257
149
  }
258
- declare function createGrepTool(options: GrepToolOptions): import("ai").Tool<
259
- {
260
- query: string;
261
- include?: string | undefined;
262
- fixedString?: boolean | undefined;
263
- caseSensitive?: boolean | undefined;
264
- contextLines?: number | undefined;
265
- },
266
- Record<string, unknown>
267
- >;
268
- type BashChangedFiles = {
269
- created: string[];
270
- updated: string[];
271
- deleted: string[];
272
- directoriesCreated: string[];
273
- directoriesDeleted: string[];
274
- };
150
+ declare function createGrepTool(options: GrepToolOptions): Tool;
275
151
  interface BashToolOptions {
276
152
  ops: BashOperations;
277
153
  timeout?: number;
@@ -280,34 +156,11 @@ interface BashToolOptions {
280
156
  maxWorkspaceFileBytes?: number;
281
157
  maxOutputBytes?: number;
282
158
  }
283
- declare function createBashTool(options: BashToolOptions): import("ai").Tool<
284
- {
285
- script: string;
286
- cwd?: string | undefined;
287
- },
288
- {
289
- errors?: string[] | undefined;
290
- skippedFiles?: string[] | undefined;
291
- stdout: string;
292
- stderr: string;
293
- exitCode: number;
294
- changedFiles: BashChangedFiles;
295
- }
296
- >;
159
+ declare function createBashTool(options: BashToolOptions): Tool;
297
160
  interface DeleteToolOptions {
298
161
  ops: DeleteOperations;
299
162
  }
300
- declare function createDeleteTool(
301
- options: DeleteToolOptions
302
- ): import("ai").Tool<
303
- {
304
- path: string;
305
- recursive?: boolean | undefined;
306
- },
307
- {
308
- deleted: string;
309
- }
310
- >;
163
+ declare function createDeleteTool(options: DeleteToolOptions): Tool;
311
164
  //#endregion
312
165
  export {
313
166
  createFindTool as C,
@@ -339,4 +192,4 @@ export {
339
192
  createDeleteTool as x,
340
193
  WriteToolOptions as y
341
194
  };
342
- //# sourceMappingURL=workspace-BZXdZcuw.d.ts.map
195
+ //# sourceMappingURL=workspace-DxZQSbko.d.ts.map
package/docs/index.md CHANGED
@@ -857,11 +857,27 @@ path.
857
857
  | `workspaceBash` | `true` | Include or configure the default workspace `bash` tool |
858
858
  | `fetchTools` | `false` | Opt-in allowlisted, read-only HTTP fetch tools (`fetch_url` + per-binding `fetch_<name>`). Set to a config object; see [Fetch tool](#fetch-tool) |
859
859
  | `messageConcurrency` | `"queue"` | How overlapping submits behave — see [Client Tools](./client-tools.md) |
860
+ | `includeMcpTools` | `true` | Automatically convert connected MCP tools to AI SDK tools and merge them into model turns |
860
861
  | `waitForMcpConnections` | `false` | Wait for MCP servers before inference |
861
862
  | `chatRecovery` | `true` | Wrap turns in `runFiber` for durable execution, including sub-agent turns. Set to `{ maxAttempts, stableTimeoutMs, terminalMessage, onExhausted }` to tune bounded recovery. |
862
863
  | `chatStreamStallTimeoutMs` | `0` (off) | Opt-in inactivity watchdog: abort a turn whose model stream produces no chunk for this long (measures the gap between chunks, including tool execution — set above your slowest model TTFT + tool, e.g. `120_000`). Emits a `chat:stream:stalled` event; with `chatRecovery` on (the default) the stall routes into bounded recovery (see below) instead of an infinite spinner, and only terminalizes once the budget is exhausted. Override per-turn via `TurnConfig.chatStreamStallTimeoutMs` (returned from `beforeTurn`) for a turn with a known-slow tool. |
863
864
  | `contextOverflow` | `undefined` | Opt-in mid-turn context-overflow handling: `{ reactive?, maxRetries?, proactive? }`. Requires `classifyChatError` + a session compaction function. See [Context-window overflow recovery](#context-window-overflow-recovery). |
864
865
 
866
+ ### MCP tools exposed outside the harness
867
+
868
+ Think normally calls `this.mcp.getAITools()` while assembling every turn. If you expose MCP tools through Code Mode or another mechanism outside Think's automatic tool set, set `includeMcpTools = false` to avoid direct JSON Schema-to-Zod materialization:
869
+
870
+ ```typescript
871
+ export class MyAgent extends Think<Env> {
872
+ includeMcpTools = false;
873
+ waitForMcpConnections = true;
874
+ }
875
+ ```
876
+
877
+ This setting affects only Think's automatic AI SDK tool merge. Connections still register, restore, discover, and wait normally; raw tool listing and calls, Code Mode access, and explicit `this.mcp.getAITools()` calls are unchanged. Returning `activeTools: []` from `beforeTurn` does not provide the same behavior because tool conversion occurs before that hook.
878
+
879
+ See [Tools](./tools.md#mcp-tools) for MCP setup and alternative exposure paths.
880
+
865
881
  ## Agent Skills
866
882
 
867
883
  Think supports [Agent Skills](https://agentskills.io/) as on-demand
package/docs/tools.md CHANGED
@@ -11,7 +11,7 @@ On every turn, Think merges tools from multiple sources. Later sources override
11
11
  3. **Extension tools** — tools from loaded extensions (prefixed by extension name)
12
12
  4. **Session tools** — `set_context`, `load_context`, `search_context` (from `configureSession`)
13
13
  5. **Skill tools** — `activate_skill`, `read_skill_resource`, `run_skill_script` (from `getSkills()`)
14
- 6. **MCP tools** — from connected MCP servers
14
+ 6. **MCP tools** — from connected MCP servers (when `includeMcpTools` is enabled)
15
15
  7. **Client tools** — from the browser (see [Client Tools](./client-tools.md))
16
16
 
17
17
  Tools belong to the agent running the turn. For parent-child orchestration,
@@ -182,7 +182,7 @@ beforeTurn(ctx: TurnContext) {
182
182
 
183
183
  ## MCP Tools
184
184
 
185
- Think inherits MCP client support from the `Agent` base class. MCP tools from connected servers are automatically merged into every turn.
185
+ Think inherits MCP client support from the `Agent` base class. By default, tools from connected MCP servers are converted to AI SDK tools and merged into every turn.
186
186
 
187
187
  Set `waitForMcpConnections` to ensure MCP servers are connected before the inference loop runs:
188
188
 
@@ -197,6 +197,23 @@ export class MyAgent extends Think<Env> {
197
197
  }
198
198
  ```
199
199
 
200
+ If you expose MCP tools through Code Mode or another mechanism outside Think's automatic tool set, disable direct AI SDK tool exposure:
201
+
202
+ ```typescript
203
+ export class MyAgent extends Think<Env> {
204
+ includeMcpTools = false;
205
+ waitForMcpConnections = true;
206
+
207
+ getModel() {
208
+ /* ... */
209
+ }
210
+ }
211
+ ```
212
+
213
+ `includeMcpTools = false` suppresses only Think's automatic `this.mcp.getAITools()` merge. MCP registration, restoration, discovery, waiting, raw catalog access, direct calls, Code Mode connectors, and explicit application calls to `this.mcp.getAITools()` continue to work. This avoids converting every MCP JSON Schema to Zod when the model only uses the raw MCP connection through the connector.
214
+
215
+ Use the class property instead of `beforeTurn({ activeTools: [] })` for this purpose. `activeTools` limits tools after turn assembly; MCP schema conversion happens while Think assembles the context, before `beforeTurn` runs.
216
+
200
217
  Add MCP servers programmatically or via `@callable` methods:
201
218
 
202
219
  ```typescript
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "tools"
10
10
  ],
11
11
  "type": "module",
12
- "version": "0.13.0",
12
+ "version": "0.15.0",
13
13
  "license": "MIT",
14
14
  "repository": {
15
15
  "directory": "packages/think",
@@ -24,22 +24,22 @@
24
24
  "think": "dist/cli/index.js"
25
25
  },
26
26
  "dependencies": {
27
- "@ai-sdk/anthropic": "^3.0.83",
28
- "@ai-sdk/openai": "^3.0.70",
29
- "@cloudflare/codemode": "^0.4.3",
30
- "@cloudflare/shell": "^0.4.1",
27
+ "@ai-sdk/anthropic": "^4.0.0",
28
+ "@ai-sdk/openai": "^4.0.0",
29
+ "@cloudflare/codemode": "^0.5.0",
30
+ "@cloudflare/shell": "^0.4.3",
31
31
  "aywson": "^0.0.16",
32
32
  "chat": "^4.31.0",
33
33
  "create-think": "^0.1.1",
34
34
  "just-bash": "^3.0.2",
35
35
  "smol-toml": "^1.7.0",
36
- "workers-ai-provider": "^3.3.0",
36
+ "workers-ai-provider": "^4.0.0",
37
37
  "yargs": "^18.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@ai-sdk/react": "^3.0.204",
40
+ "@ai-sdk/react": "^4.0.0",
41
41
  "@chat-adapter/telegram": "^4.31.0",
42
- "@cloudflare/ai-chat": "^0.9.3",
42
+ "@cloudflare/ai-chat": "^0.10.0",
43
43
  "@cloudflare/kumo": "^2.6.0",
44
44
  "@phosphor-icons/react": "^2.1.10",
45
45
  "@streamdown/code": "^1.1.1",
@@ -49,8 +49,8 @@
49
49
  "@types/react-dom": "^19.2.3",
50
50
  "@types/yargs": "^17.0.35",
51
51
  "@vitejs/plugin-react": "^6.0.3",
52
- "agents": "^0.17.4",
53
- "ai": "^6.0.202",
52
+ "agents": "^0.19.0",
53
+ "ai": "^7.0.0",
54
54
  "jsdom": "^29.1.1",
55
55
  "react": "^19.2.7",
56
56
  "react-dom": "^19.2.7",
@@ -60,10 +60,10 @@
60
60
  "zod": "^4.4.3"
61
61
  },
62
62
  "peerDependencies": {
63
- "@ai-sdk/react": "^3.0.204",
63
+ "@ai-sdk/react": "^3.0.0 || ^4.0.0",
64
64
  "@chat-adapter/telegram": "^4.29.0",
65
- "agents": ">=0.17.1 <1.0.0",
66
- "ai": "^6.0.182",
65
+ "agents": ">=0.18.0 <1.0.0",
66
+ "ai": "^6.0.0 || ^7.0.0",
67
67
  "react": "^19.0.0",
68
68
  "vite": ">=6 <9",
69
69
  "zod": "^4.0.0"
@@ -1,109 +0,0 @@
1
- import { a as ExtensionPermissions } from "./manager-dOcdCX4u.js";
2
- import { WorkerEntrypoint } from "cloudflare:workers";
3
-
4
- //#region src/extensions/host-bridge.d.ts
5
- type HostBridgeLoopbackProps = {
6
- agentClassName: string;
7
- agentId: string;
8
- permissions: ExtensionPermissions /** Namespaced context labels this extension declared (for "own" write validation). */;
9
- ownContextLabels?: string[];
10
- };
11
- declare class HostBridgeLoopback extends WorkerEntrypoint<
12
- Record<string, unknown>,
13
- HostBridgeLoopbackProps
14
- > {
15
- #private;
16
- private _permissions;
17
- private _getAgent;
18
- readFile(path: string): Promise<string | null>;
19
- writeFile(path: string, content: string): Promise<void>;
20
- deleteFile(path: string): Promise<boolean>;
21
- listFiles(dir: string): Promise<
22
- Array<{
23
- name: string;
24
- type: string;
25
- size: number;
26
- path: string;
27
- }>
28
- >;
29
- getContext(label: string): Promise<string | null>;
30
- setContext(label: string, content: string): Promise<void>;
31
- getMessages(limit?: number): Promise<
32
- Array<{
33
- id: string;
34
- role: string;
35
- content: string;
36
- }>
37
- >;
38
- sendMessage(content: string): Promise<void>;
39
- getSessionInfo(): Promise<{
40
- messageCount: number;
41
- }>;
42
- }
43
- //#endregion
44
- //#region src/extensions/bridge-provider.d.ts
45
- /**
46
- * Bridge providers that adapt extension Worker RPC into Session's
47
- * ContextProvider / SkillProvider / WritableContextProvider interfaces.
48
- *
49
- * When an extension declares context blocks in its manifest, Think creates
50
- * a bridge provider for each block. The bridge delegates `get()`, `load()`,
51
- * and `set()` to the extension Worker's entrypoint via RPC.
52
- *
53
- * This allows extensions to contribute context blocks to the Session's
54
- * system prompt without Session knowing about the extension system.
55
- */
56
- interface ExtensionContextEntrypoint {
57
- contextGet(label: string): Promise<string | null>;
58
- contextLoad?(label: string, key: string): Promise<string | null>;
59
- contextSet?(
60
- label: string,
61
- key: string,
62
- content: string,
63
- description?: string
64
- ): Promise<void>;
65
- }
66
- /**
67
- * A readonly context provider backed by an extension Worker.
68
- * Delegates `get()` to the extension's `contextGet` RPC method.
69
- */
70
- declare class ExtensionContextBridge {
71
- protected _label: string;
72
- protected _entrypoint: ExtensionContextEntrypoint;
73
- constructor(label: string, entrypoint: ExtensionContextEntrypoint);
74
- init(_label: string): void;
75
- get(): Promise<string | null>;
76
- }
77
- /**
78
- * A writable context provider backed by an extension Worker.
79
- * Delegates `get()` and `set()` to the extension's RPC methods.
80
- */
81
- declare class ExtensionWritableBridge extends ExtensionContextBridge {
82
- set(content: string): Promise<void>;
83
- }
84
- /**
85
- * A skill provider backed by an extension Worker.
86
- * Delegates `get()`, `load()`, and optionally `set()` to the extension's RPC methods.
87
- */
88
- declare class ExtensionSkillBridge extends ExtensionContextBridge {
89
- load(key: string): Promise<string | null>;
90
- set(key: string, content: string, description?: string): Promise<void>;
91
- }
92
- /**
93
- * Create the appropriate bridge provider based on the context block type.
94
- */
95
- declare function createBridgeProvider(
96
- label: string,
97
- type: "readonly" | "writable" | "skill" | "searchable",
98
- entrypoint: ExtensionContextEntrypoint
99
- ): ExtensionContextBridge;
100
- //#endregion
101
- export {
102
- HostBridgeLoopback as a,
103
- createBridgeProvider as i,
104
- ExtensionSkillBridge as n,
105
- HostBridgeLoopbackProps as o,
106
- ExtensionWritableBridge as r,
107
- ExtensionContextBridge as t
108
- };
109
- //# sourceMappingURL=index-B-zgBVj2.d.ts.map