@supertools-ai/core 0.1.3 → 0.1.5

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 CHANGED
@@ -59,7 +59,7 @@ E2B_API_KEY=your-key # Get at e2b.dev
59
59
  Create `index.ts` and run with `bun run index.ts`:
60
60
 
61
61
  ```typescript
62
- import { supertools, defineTool, z } from '@supertools-ai/core';
62
+ import { supertools, defineTool, z, SANDBOX_TEMPLATE } from '@supertools-ai/core';
63
63
  import { Sandbox } from 'e2b';
64
64
  import Anthropic from '@anthropic-ai/sdk';
65
65
 
@@ -88,8 +88,8 @@ const getOrders = defineTool({
88
88
  status ? orders.filter(o => o.status === status) : orders,
89
89
  });
90
90
 
91
- // Main
92
- const sandbox = await Sandbox.create('supertools-bun').catch((e) => {
91
+ // SANDBOX_TEMPLATE is exported by supertools - always use it to ensure compatibility
92
+ const sandbox = await Sandbox.create(SANDBOX_TEMPLATE).catch((e) => {
93
93
  console.error('Failed to create sandbox:', e);
94
94
  process.exit(1);
95
95
  });
@@ -131,6 +131,7 @@ const states = ['AL', 'AK', 'AZ', /* ... all 50 */];
131
131
  const results = {};
132
132
 
133
133
  for (const state of states) {
134
+ // be careful with this - using raw sql tool call can lead to injection or dangerous queries
134
135
  const data = await query_database({
135
136
  sql: `SELECT SUM(revenue) FROM sales WHERE state = '${state}'`
136
137
  });
@@ -178,11 +179,11 @@ The benchmark compares three approaches on the same model (Claude Sonnet 4.5):
178
179
  Wrap any supported LLM SDK client with programmatic tool calling.
179
180
 
180
181
  ```typescript
181
- import { supertools, defineTool, z } from '@supertools-ai/core';
182
+ import { supertools, defineTool, z, SANDBOX_TEMPLATE } from '@supertools-ai/core';
182
183
  import { Sandbox } from 'e2b';
183
184
  import Anthropic from '@anthropic-ai/sdk';
184
185
 
185
- const sandbox = await Sandbox.create('supertools-bun');
186
+ const sandbox = await Sandbox.create(SANDBOX_TEMPLATE);
186
187
  const client = supertools(new Anthropic(), {
187
188
  // Required
188
189
  tools: [defineTool({ name, description, parameters, execute })],
@@ -258,7 +259,7 @@ const calculateStats = defineTool({
258
259
  For more control, use the executor directly:
259
260
 
260
261
  ```typescript
261
- import { createExecutor, defineTool } from '@supertools-ai/core';
262
+ import { createExecutor, defineTool, SANDBOX_TEMPLATE } from '@supertools-ai/core';
262
263
  import { Sandbox } from 'e2b';
263
264
 
264
265
  // Create your own LLM adapter
@@ -269,7 +270,7 @@ const myAdapter = {
269
270
  },
270
271
  };
271
272
 
272
- const sandbox = await Sandbox.create('supertools-bun');
273
+ const sandbox = await Sandbox.create(SANDBOX_TEMPLATE);
273
274
  const executor = createExecutor({
274
275
  llm: myAdapter,
275
276
  tools: [/* your tools */],
@@ -343,7 +344,7 @@ console.log(result.result.output); // stdout from execution
343
344
  7. Results flow back to the sandbox, code continues executing
344
345
  8. Final output returns in the expected SDK response format
345
346
 
346
- > **Note:** The Relay Server runs inside the pre-built `supertools-bun` E2B template. The Relay Client is included in the `@supertools-ai/core` package and runs on your host.
347
+ > **Note:** The Relay Server runs inside the pre-built `supertools-bun-014` E2B template. The Relay Client is included in the `@supertools-ai/core` package and runs on your host.
347
348
 
348
349
  **Security:**
349
350
  - LLM-generated code runs in isolated cloud containers
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,KAAK,EAAE,cAAc,EAAW,MAAM,QAAQ,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAkB,MAAM,SAAS,CAAC;AAE/G,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;CAC1B;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,oBAAoB,CAEnF;AAED,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAA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AAQ,CAAC,QAAQ,CAA8B;IACvD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAkC;gBAE/C,OAAO,EAAE,qBAAqB;IAW1C,OAAO,CAAC,IAAI;IAIN,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA+CrD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;YAW3C,oBAAoB;IA8ClC,QAAQ,IAAI,SAAS,cAAc,EAAE;IAIrC,oBAAoB,IAAI,MAAM;YAIhB,YAAY;YA6BZ,YAAY;YA2BZ,OAAO;IAcrB,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,SAAS;CAMlB"}
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @example
8
8
  * ```ts
9
- * import { supertools, defineTool, z } from '@supertools-ai/core';
9
+ * import { supertools, defineTool, z, SANDBOX_TEMPLATE } from '@supertools-ai/core';
10
10
  * import { Sandbox } from 'e2b';
11
11
  * import Anthropic from '@anthropic-ai/sdk';
12
12
  *
@@ -20,7 +20,7 @@
20
20
  * });
21
21
  *
22
22
  * // Create sandbox and wrap your SDK client
23
- * const sandbox = await Sandbox.create('supertools-bun');
23
+ * const sandbox = await Sandbox.create(SANDBOX_TEMPLATE);
24
24
  * const client = supertools(new Anthropic(), { tools: [queryDb], sandbox });
25
25
  *
26
26
  * // Use exactly like normal - tools execute automatically
@@ -33,6 +33,8 @@
33
33
  *
34
34
  * @packageDocumentation
35
35
  */
36
+ /** The recommended E2B sandbox template for this version of supertools */
37
+ export declare const SANDBOX_TEMPLATE = "supertools-bun-014";
36
38
  export { supertools, detectProvider } from './supertools';
37
39
  export type { SupertoolsConfig, SupportedProvider } from './supertools';
38
40
  export { defineTool, z } from './tool';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AACvC,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGxD,YAAY,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,cAAc,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,0EAA0E;A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