@cloudflare/think 0.14.0 → 0.15.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.
Files changed (100) hide show
  1. package/README.md +20 -16
  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-CDNxUctz.d.ts → index-s3Pl812H.d.ts} +44 -16
  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-Dl5doFtz.js → angular-html-B26lsrRw.js} +1 -1
  11. package/dist/studio/assets/{angular-ts-CbN7_mlY.js → angular-ts-B0BTTyHo.js} +1 -1
  12. package/dist/studio/assets/{apl-CUTyCKtR.js → apl-W5hJk0fj.js} +1 -1
  13. package/dist/studio/assets/{astro-4sWs7Jg3.js → astro-ChkXCqsA.js} +1 -1
  14. package/dist/studio/assets/{blade-NmhW_pJp.js → blade-Dy0zTtr6.js} +1 -1
  15. package/dist/studio/assets/{c-_ropPcoN.js → c-DOHYbsuN.js} +1 -1
  16. package/dist/studio/assets/{cobol-BacpIX4U.js → cobol-DtGo7U_-.js} +1 -1
  17. package/dist/studio/assets/{coffee-DcwgCl9J.js → coffee-Uf9fkZqI.js} +1 -1
  18. package/dist/studio/assets/{cpp-BCPbrI0m.js → cpp-CVwmol0l.js} +1 -1
  19. package/dist/studio/assets/{crystal-DZXQ6wBH.js → crystal-ChHObCtF.js} +1 -1
  20. package/dist/studio/assets/{css-BYyCaTYR.js → css-DYjZAj5w.js} +1 -1
  21. package/dist/studio/assets/{edge-CVh9HJt8.js → edge-C2J43zbu.js} +1 -1
  22. package/dist/studio/assets/{elixir-9uvyi7ZY.js → elixir-B7WZ8XhB.js} +1 -1
  23. package/dist/studio/assets/{elm-DDSgRIyn.js → elm-PN4qGuR2.js} +1 -1
  24. package/dist/studio/assets/{erb-DAVyz0cP.js → erb-CkbjE2OZ.js} +1 -1
  25. package/dist/studio/assets/{git-rebase-z3txLW9w.js → git-rebase-CsGmQhFO.js} +1 -1
  26. package/dist/studio/assets/{glimmer-js-BRADiKXN.js → glimmer-js-D85-ZYXa.js} +1 -1
  27. package/dist/studio/assets/{glimmer-ts-B6C6vVGo.js → glimmer-ts-B_0SLVPe.js} +1 -1
  28. package/dist/studio/assets/{glsl-34bCtA9U.js → glsl-BE5n0T0t.js} +1 -1
  29. package/dist/studio/assets/{graphql-CL83z2DV.js → graphql-BVcCJEBO.js} +1 -1
  30. package/dist/studio/assets/{hack-B9WxPQav.js → hack-CyUu15_C.js} +1 -1
  31. package/dist/studio/assets/{haml-oavex6g4.js → haml-Dj54pugT.js} +1 -1
  32. package/dist/studio/assets/{handlebars-pd64xhEq.js → handlebars-l3llPaCT.js} +1 -1
  33. package/dist/studio/assets/{highlighted-body-OFNGDK62-DB3-I0_d.js → highlighted-body-OFNGDK62-D_z62he-.js} +1 -1
  34. package/dist/studio/assets/{html-A_mALprL.js → html--Tmh4628.js} +1 -1
  35. package/dist/studio/assets/{html-derivative-CBwZyoIR.js → html-derivative-B0Q_m8BM.js} +1 -1
  36. package/dist/studio/assets/{http-Cua_-o-V.js → http-BXKW9YQL.js} +1 -1
  37. package/dist/studio/assets/{hurl-Dpr8mC4K.js → hurl-C60QjgUE.js} +1 -1
  38. package/dist/studio/assets/index-Cd4PgOFu.js +390 -0
  39. package/dist/studio/assets/{java-B1Ptmnmm.js → java-aXeLcVht.js} +1 -1
  40. package/dist/studio/assets/{javascript-waNlhfIS.js → javascript-BQcRH4fE.js} +1 -1
  41. package/dist/studio/assets/{jinja-D06CyNkk.js → jinja-DGNUkEt-.js} +1 -1
  42. package/dist/studio/assets/{jison-CQo2g2q_.js → jison-DwfSvoKv.js} +1 -1
  43. package/dist/studio/assets/{json-T8-gmbyP.js → json-B0ukOVyl.js} +1 -1
  44. package/dist/studio/assets/{jsx-pi8aEi7y.js → jsx-CzJUnsSO.js} +1 -1
  45. package/dist/studio/assets/{julia-DQ0CkLQi.js → julia-D8zt_FEP.js} +1 -1
  46. package/dist/studio/assets/{just-BaZbjeHH.js → just-nn4e9Gpd.js} +1 -1
  47. package/dist/studio/assets/{latex-CKRYEGLe.js → latex-OBwqlec5.js} +1 -1
  48. package/dist/studio/assets/{liquid-KfgQvxVp.js → liquid-CktG-Iuw.js} +1 -1
  49. package/dist/studio/assets/{lua-BDYsw9Eb.js → lua-ZqavSetL.js} +1 -1
  50. package/dist/studio/assets/{marko-BSPq2tuh.js → marko-CxDLRfNz.js} +1 -1
  51. package/dist/studio/assets/{mdc-ZTdTy2-Y.js → mdc-COZbBQqS.js} +1 -1
  52. package/dist/studio/assets/mermaid-GHXKKRXX-ChY6AJ7l.js +1 -0
  53. package/dist/studio/assets/{nginx-BsBsElo9.js → nginx-DB8A8-iZ.js} +1 -1
  54. package/dist/studio/assets/{nim-Fud12WJN.js → nim-Cs5VB9QZ.js} +1 -1
  55. package/dist/studio/assets/{perl-BcRrrqpJ.js → perl-pV-3Dli_.js} +1 -1
  56. package/dist/studio/assets/{php-CvBMy7ll.js → php-CFSq0mhc.js} +1 -1
  57. package/dist/studio/assets/{pug-9fn0F-sp.js → pug-DuCfu-AK.js} +1 -1
  58. package/dist/studio/assets/{qml-DPYDKGeG.js → qml-Gqte1OeW.js} +1 -1
  59. package/dist/studio/assets/{r-B-BlSOk_.js → r-B8XqafmU.js} +1 -1
  60. package/dist/studio/assets/{razor-BBsuDNIH.js → razor-HyK7qWun.js} +1 -1
  61. package/dist/studio/assets/{regexp-siAWelih.js → regexp-Bdipf9Ks.js} +1 -1
  62. package/dist/studio/assets/{rst-DpBCyEwj.js → rst-DtdOQB-0.js} +1 -1
  63. package/dist/studio/assets/{ruby-BQ1xX5ej.js → ruby-DOExsDws.js} +1 -1
  64. package/dist/studio/assets/{sas-Dft5mTiQ.js → sas-BLRRJVWF.js} +1 -1
  65. package/dist/studio/assets/{scss-BFMJsYGZ.js → scss-BILH_sWZ.js} +1 -1
  66. package/dist/studio/assets/{shellscript-Cncrs_5T.js → shellscript-CC2KTOv4.js} +1 -1
  67. package/dist/studio/assets/{shellsession-BngbHbQf.js → shellsession-CiGs-_qT.js} +1 -1
  68. package/dist/studio/assets/{soy-BY5W-W7z.js → soy-QSSlYQhf.js} +1 -1
  69. package/dist/studio/assets/{sql-rEN1gzdE.js → sql-CPD_IP3i.js} +1 -1
  70. package/dist/studio/assets/{stata-BDRzO3gs.js → stata-jhUDP248.js} +1 -1
  71. package/dist/studio/assets/{surrealql-DgF3SPLS.js → surrealql-CEI1vHaO.js} +1 -1
  72. package/dist/studio/assets/{svelte-BsPFEf_A.js → svelte-BqMghnvQ.js} +1 -1
  73. package/dist/studio/assets/{templ-D4eIDjcz.js → templ-DhMt3Gd_.js} +1 -1
  74. package/dist/studio/assets/{tex-hl_BDesm.js → tex-B2oLGu4M.js} +1 -1
  75. package/dist/studio/assets/{ts-tags-mYERLvfx.js → ts-tags-DbXbAuWo.js} +1 -1
  76. package/dist/studio/assets/{tsx-4zmdohFv.js → tsx-BWdjt-eB.js} +1 -1
  77. package/dist/studio/assets/{twig-J6ElH33g.js → twig-b7sZE9-Z.js} +1 -1
  78. package/dist/studio/assets/{typescript-DaBxXTXh.js → typescript-B5gQukXY.js} +1 -1
  79. package/dist/studio/assets/{vue-CnJAvLlE.js → vue-DGv3yRD9.js} +1 -1
  80. package/dist/studio/assets/{vue-html-5M7J-A2F.js → vue-html-Cx5Ph-Io.js} +1 -1
  81. package/dist/studio/assets/{vue-vine-BgG3D4Fz.js → vue-vine-G05O51ag.js} +1 -1
  82. package/dist/studio/assets/{xml-BuA8iyrb.js → xml-Bd8eSLdt.js} +1 -1
  83. package/dist/studio/assets/{xsl-CEhAy4QP.js → xsl-DVLXYJQL.js} +1 -1
  84. package/dist/studio/assets/{yaml-CKMEvlUE.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 +229 -98
  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/package.json +12 -12
  98. package/dist/index-B-zgBVj2.d.ts +0 -109
  99. package/dist/studio/assets/index-DmVgVRjr.js +0 -390
  100. package/dist/studio/assets/mermaid-GHXKKRXX-UMXpy7w5.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/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "tools"
10
10
  ],
11
11
  "type": "module",
12
- "version": "0.14.0",
12
+ "version": "0.15.1",
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.4",
30
- "@cloudflare/shell": "^0.4.2",
27
+ "@ai-sdk/anthropic": "^4.0.0",
28
+ "@ai-sdk/openai": "^4.0.0",
29
+ "@cloudflare/codemode": "^0.5.1",
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.4",
42
+ "@cloudflare/ai-chat": "^0.10.1",
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.18.0",
53
- "ai": "^6.0.202",
52
+ "agents": "^0.20.1",
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
65
  "agents": ">=0.18.0 <1.0.0",
66
- "ai": "^6.0.182",
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