@anam-ai/agent-widget 0.5.0-alpha.1 → 0.6.0-alpha.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.
package/README.md CHANGED
@@ -156,6 +156,43 @@ document.querySelector('anam-agent').addEventListener('anam-agent:tool-call-star
156
156
  });
157
157
  ```
158
158
 
159
+ Note: for client tools, only `tool-call-started` is guaranteed — the SDK emits
160
+ `tool-call-completed` only when a tool-call handler is registered, which the
161
+ widget deliberately does not do. Key your integration off `tool-call-started`.
162
+
163
+ ## Built-in tools
164
+
165
+ Tool names starting with the reserved **`anam_`** prefix are Anam built-ins.
166
+ When a built-in is enabled for a persona in the Anam Lab (Build → Embed tab),
167
+ the Lab injects the tool definition into widget sessions server-side, and the
168
+ widget renders calls to it as a native block in the transcript. No integration
169
+ code is required on the host page.
170
+
171
+ Current built-ins:
172
+
173
+ | Tool name | Enabled by | Input schema | Rendered as |
174
+ |-----------|-----------|--------------|-------------|
175
+ | `anam_show_link` | "Show links in chat" (requires transcript) | `{ url: string (https:// or mailto:), label: string }` | Clickable link card in the transcript; the pane auto-opens when a card arrives |
176
+
177
+ Behavior notes:
178
+
179
+ - URLs are validated before rendering: only `https:` and `mailto:` schemes
180
+ produce a card. Invalid or non-allowlisted URLs render nothing.
181
+ - Every tool call — built-in or not — still dispatches the
182
+ `anam-agent:tool-call-*` DOM events above. Host pages that want to ignore
183
+ built-ins can filter with `toolName.startsWith('anam_')`.
184
+ - Widgets older than a built-in's introduction render nothing for it but still
185
+ dispatch the DOM events (graceful degradation).
186
+ - A built-in's argument shape is a stable contract: it is never repurposed.
187
+ New behavior means a new tool name.
188
+
189
+ Adding a built-in (for contributors): add a parser entry to
190
+ `BUILTIN_TOOL_PARSERS` and a renderer to `BLOCK_RENDERERS` in
191
+ `src/widget/builtinBlocks.tsx`, plus CSS. The server-side tool definition
192
+ (description prompt, injection flag) lives in the Lab codebase
193
+ (`src/lib/builtin-tools/widget-tools.ts`), so prompt tuning ships without a
194
+ widget release.
195
+
159
196
  ## Development
160
197
 
161
198
  ### Prerequisites