toolpack-sdk 3.2.0 → 3.4.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.
package/README.md CHANGED
@@ -574,6 +574,30 @@ await sdk.loadToolProjects([myToolProject]);
574
574
  | `tools` | ToolDefinition[] | ✓ | Array of tool definitions |
575
575
  | `dependencies` | Record<string, string> | | npm dependencies (validated at load) |
576
576
 
577
+ ### Tool Context and `actor`
578
+
579
+ Every tool's `execute` receives a context as its second argument. Besides `workspaceRoot` and `config`, it carries `ctx.actor`: who the run acts for (for example the signed-in user). The host sets it with the `actor` init option; the model never sees or sets it, so a tool can trust it for per-user data.
580
+
581
+ ```typescript
582
+ const sdk = await Toolpack.init({
583
+ provider: 'openai',
584
+ tools: true,
585
+ actor: { id: 'user_123', kind: 'user' },
586
+ });
587
+
588
+ // In a tool:
589
+ execute: async (args, ctx) => {
590
+ const userId = ctx.actor?.id; // undefined when no actor was set
591
+ // load only this user's data
592
+ }
593
+ ```
594
+
595
+ When one instance serves several people, pass a function (read on every tool call), for example `actor: () => requestStore.getStore() ?? null`.
596
+
597
+ ### Returning files from tools
598
+
599
+ A tool can return a file by URL with `{ "type": "file", "mimeType": "application/pdf", "url": "https://..." }`. Anthropic and Vertex AI receive it as a native file part, and OpenAI receives images (other files get a placeholder). `data:` URIs keep working as before.
600
+
577
601
  ## Knowledge & RAG (Retrieval-Augmented Generation)
578
602
 
579
603
  For AI applications that need to search and reference documentation, use the companion `@toolpack-sdk/knowledge` package:
@@ -1176,7 +1200,7 @@ const sdk = await Toolpack.init({
1176
1200
  |--------|------|---------|-------------|
1177
1201
  | `enabled` | boolean | `true` | Enable/disable the tool system entirely |
1178
1202
  | `autoExecute` | boolean | `true` | Auto-execute tool calls from AI |
1179
- | `maxToolRounds` | number | `5` | Max tool execution rounds per request |
1203
+ | `maxToolRounds` | number | `5` | Max tool execution rounds per request. When the cap is hit with tools still pending, the model gets one final text-only round to wrap up |
1180
1204
  | `toolChoicePolicy` | string | `"auto"` | `"auto"`, `"required"`, or `"required_for_actions"` |
1181
1205
  | `resultMaxChars` | number | `20000` | Max characters in a tool result |
1182
1206
  | `enabledTools` | string[] | `[]` | Whitelist specific tools (empty = all) |
@@ -1250,7 +1274,7 @@ import { Toolpack } from 'toolpack-sdk';
1250
1274
  // modeOverrides → configure modes directly via registerMode()
1251
1275
  // configPath → configuration is now passed inline to Toolpack.init()
1252
1276
  //
1253
- // Fields: logging, hitl, toolsConfig, toolOverrides (v3.1.0)
1277
+ // Fields: logging, hitl, toolsConfig, toolOverrides (v3.1.0), actor and disableToolGuidance (v3.4.0)
1254
1278
  const sdk = await Toolpack.init(config: ToolpackInitConfig): Promise<Toolpack>
1255
1279
 
1256
1280
  // Completions (routes through workflow engine if mode has workflow enabled)