toolpack-sdk 3.1.0 → 3.2.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
@@ -619,22 +619,15 @@ See the [Knowledge package README](../toolpack-knowledge/README.md) for full doc
619
619
 
620
620
  ## Skills
621
621
 
622
- The skills system lets you define **reusable behavioral instructions** in `.skill.md` files and automatically inject them into requests based on message relevance — no agent code changes required.
622
+ The skills system lets you define **reusable behavioral instructions** in `.skill.md` files and expose them to the agent via LLM-callable tools.
623
623
 
624
624
  ### Quick Start
625
625
 
626
626
  ```typescript
627
- import { Toolpack, createSkillInterceptor, createSkillTools } from 'toolpack-sdk';
627
+ import { createSkillTools } from 'toolpack-sdk';
628
628
 
629
629
  const skillTools = createSkillTools({ dir: '.toolpack/skills' });
630
630
 
631
- const toolpack = await Toolpack.init({
632
- provider: 'anthropic',
633
- interceptors: [
634
- createSkillInterceptor({ dir: '.toolpack/skills', maxSkills: 3, minScore: 0.3 }),
635
- ],
636
- });
637
-
638
631
  // Attach skill tools per agent via ModeConfig.customTools:
639
632
  // agent.mode = { ...agentMode, customTools: [...skillTools.tools] };
640
633
  ```
@@ -669,21 +662,9 @@ When reviewing code:
669
662
  4. Be constructive — suggest improvements, not just problems
670
663
  ```
671
664
 
672
- When a user sends "review this PR", the interceptor automatically injects the `## Instructions` block before the LLM sees the message.
673
-
674
665
  ### How It Works
675
666
 
676
- - **`createSkillInterceptor`** An SDK interceptor that runs BM25 search on every user message and prepends matching skill instructions as a `<skill-instructions>` block. Validates all files at `Toolpack.init()` time.
677
- - **`createSkillTools`** — Four LLM-callable tools (`skill.create`, `skill.read`, `skill.update`, `skill.list`) for managing the skill library at runtime.
678
-
679
- ### `createSkillInterceptor` Options
680
-
681
- | Option | Type | Default | Description |
682
- |--------|------|---------|-------------|
683
- | `dir` | string | `.toolpack/skills` | Path to the skill files directory |
684
- | `maxSkills` | number | `3` | Maximum number of skills injected per message |
685
- | `minScore` | number | `0.3` | BM25 relevance threshold |
686
- | `onValidationError` | `'fail'` \| `'warn'` | `'fail'` | How to handle invalid skill files at startup |
667
+ **`createSkillTools`** registers four LLM-callable tools (`skill.create`, `skill.read`, `skill.update`, `skill.list`) for managing the skill library at runtime. The agent calls `skill.read` to load instructions on demand skills are never auto-injected.
687
668
 
688
669
  See the [Skills guide](https://toolpacksdk.com/guides/skills) and [Skill Tools reference](https://toolpacksdk.com/tools/skills) for full documentation.
689
670
 
@@ -1025,7 +1006,7 @@ class FintechResearchAgent extends ResearchAgent {
1025
1006
 
1026
1007
  ### Features
1027
1008
 
1028
- - ✅ **7 Built-in Channels** — Slack, Telegram, Discord, Email, SMS, Webhook, Scheduled
1009
+ - ✅ **8 Built-in Channels** — Slack, Telegram, Discord, Email, SMS, Webhook, Scheduled, Chat
1029
1010
  - ✅ **4 Built-in Agents** — Research, Coding, Data, Browser
1030
1011
  - ✅ **Event-Driven** — Full lifecycle events for monitoring
1031
1012
  - ✅ **Knowledge Integration** — Conversation memory and RAG
@@ -1038,10 +1019,10 @@ See the [Agents package README](./packages/toolpack-agents/README.md) for full d
1038
1019
 
1039
1020
  ## Multimodal Support
1040
1021
 
1041
- The SDK supports multimodal inputs (text + images) across all vision-capable providers. Images can be provided in three formats:
1022
+ The SDK supports multimodal inputs (text + images + files) across all vision-capable providers. Images can be provided in three formats:
1042
1023
 
1043
1024
  ```typescript
1044
- import { Toolpack, ImageFilePart, ImageDataPart, ImageUrlPart } from 'toolpack-sdk';
1025
+ import { Toolpack, ImageFilePart, ImageDataPart, ImageUrlPart, FilePart } from 'toolpack-sdk';
1045
1026
 
1046
1027
  const sdk = await Toolpack.init({ provider: 'openai' });
1047
1028
 
@@ -1076,6 +1057,30 @@ const response = await sdk.generate({
1076
1057
  });
1077
1058
  ```
1078
1059
 
1060
+ ### File Attachments (Documents)
1061
+
1062
+ Use `FilePart` to attach non-image files such as PDFs. Pass a public or pre-signed URL and the MIME type:
1063
+
1064
+ ```typescript
1065
+ import { FilePart, FILE_LIMITS } from 'toolpack-sdk';
1066
+
1067
+ const doc: FilePart = {
1068
+ type: 'file',
1069
+ file: {
1070
+ url: 'https://example.com/report.pdf',
1071
+ mimeType: 'application/pdf',
1072
+ name: 'report.pdf', // optional
1073
+ size: 204800, // optional bytes, used for client-side limit checks
1074
+ },
1075
+ };
1076
+
1077
+ // FILE_LIMITS.image.maxBytes → 10 MB
1078
+ // FILE_LIMITS.document.maxBytes → 10 MB
1079
+ // FILE_LIMITS.document.maxPages → 20 pages
1080
+ ```
1081
+
1082
+ A data URI (`data:<mime>;base64,<data>`) is also accepted in `file.url` for inline embedding.
1083
+
1079
1084
  ### Provider Behavior
1080
1085
 
1081
1086
  | Provider | File Path | Base64 | URL |
@@ -1085,6 +1090,16 @@ const response = await sdk.generate({
1085
1090
  | Gemini | Converted to base64 | ✓ Native | Downloaded → base64 |
1086
1091
  | Ollama | Converted to base64 | ✓ Native | Downloaded → base64 |
1087
1092
 
1093
+ ### Provider Support for File Attachments (FilePart)
1094
+
1095
+ | Provider | URL | Inline base64 (`data:` URI) |
1096
+ |----------|-----|-----------------------------|
1097
+ | **Anthropic** | ✓ images and documents | ✓ auto-routed to `image` or `document` block |
1098
+ | **Anthropic Vertex** | ✓ | ✓ |
1099
+ | **Gemini** | ✓ (`fileData`) | ✓ (`inlineData`) |
1100
+ | **VertexAI** | ✓ (`fileData`) | ✓ (`inlineData`) |
1101
+ | **OpenAI** | ✓ images and documents | Images only (non-image base64 is dropped) |
1102
+
1088
1103
  ## Configuration
1089
1104
 
1090
1105
  ### Environment Variables