agentic-ui-kit 0.4.0 → 0.5.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
@@ -35,6 +35,12 @@ pnpm --filter agentic-ui-kit pack # builds and writes agentic-ui-kit-0.1.
35
35
  cd ../your-app && npm install ../agentic-ui-kit/agentic-ui-kit-0.1.0.tgz
36
36
  ```
37
37
 
38
+ ### Upgrading
39
+
40
+ Vite pre-bundles dependencies. After you upgrade the kit, a running dev server can keep serving the old
41
+ build, and you get errors like "does not provide an export named …". Restart it with `vite --force` (or
42
+ delete `node_modules/.vite`).
43
+
38
44
  ## Quick start
39
45
 
40
46
  ```tsx
package/dist/core.js CHANGED
@@ -1,5 +1,10 @@
1
- import { A as salvageJson, C as awaitingToolCalls, D as resolveEffort, E as reduceEvents, O as settleToolCall, S as applyEvent, T as outputTokens, _ as formatEvent, a as readUiValue, b as toBlocks, c as uiMarkupGuide, d as isStateRef, f as matchesSchema, g as uiActionSchema, h as schemaErrors, i as parseUiMarkup, k as parsePartialJson, l as uiMarkupLanguage, m as renderUiToolName, n as checkUiMarkupCode, o as showUiTool, p as renderUiTool, r as findUiBlocks, s as showUiToolName, t as checkUiMarkup, u as checkUiTree, v as readEventStream, w as estimateTokens, x as activityTokens, y as isActivityPart } from "./ui-markup-DtMYer7I.js";
1
+ import { A as awaitingToolCalls, C as widgetLoaderMessages, D as toBlocks, E as isActivityPart, F as settleToolCall, I as parsePartialJson, L as salvageJson, M as outputTokens, N as reduceEvents, O as activityTokens, P as resolveEffort, S as widgetFrameLoader, T as readEventStream, _ as replacedId, a as readUiValue, b as resolveReplaces, c as uiMarkupGuide, d as isStateRef, f as matchesSchema, g as uiActionSchema, h as schemaErrors, i as parseUiMarkup, j as estimateTokens, k as applyEvent, l as uiMarkupLanguage, m as renderUiToolName, n as checkUiMarkupCode, o as showUiTool, p as renderUiTool, r as findUiBlocks, s as showUiToolName, t as checkUiMarkup, u as checkUiTree, v as replacesGuide, w as formatEvent, x as withCallId, y as replacesProperty } from "./src-Ce7xTfGU.js";
2
2
  // ../core/src/visualize.ts
3
+ /**
4
+ * The visualize preset: a tool the model calls to draw an interactive visual inline (like claude.ai's
5
+ * visualize tool), and the design guide to put in the system prompt. The kit's `show_widget` tool view feeds
6
+ * the streaming `widget_code` into a sandboxed WidgetFrame. The backend runs the tool as a no-op ("shown").
7
+ */
3
8
  /** The tool definition to give the model. Same shape as a page tool's `ToolSpec`. */
4
9
  const visualizeTool = {
5
10
  name: "show_widget",
@@ -21,7 +26,8 @@ const visualizeTool = {
21
26
  minItems: 1,
22
27
  maxItems: 4,
23
28
  description: "1-4 short lines shown while you write it, e.g. \"Finding free slots\"."
24
- }
29
+ },
30
+ replaces: replacesProperty
25
31
  },
26
32
  required: ["widget_code"]
27
33
  }
@@ -40,6 +46,7 @@ How the frame works
40
46
  - Two globals: sendPrompt(text) sends a message as the user (for "Add these to my calendar", "Explain this"),
41
47
  openLink(url) opens an http(s) link. Prefer local state (JavaScript in the widget) over round trips: filter,
42
48
  toggle, recalculate and animate in place; use sendPrompt only for what needs you.
49
+ - ${replacesGuide}
43
50
 
44
51
  Look
45
52
  - Use the chat's theme variables, never hard-coded colors or fonts: var(--chat-fg) text, var(--chat-muted) and
@@ -90,7 +97,7 @@ function checkWidgetCode(html, allow = {}, toolName = visualizeTool.name) {
90
97
  ok,
91
98
  errors,
92
99
  warnings,
93
- feedback: ok && !warnings.length ? "Shown to the user." : ok ? `Shown. To fit the chat better next time:\n${lines}` : `Shown, but it will not work as written. Fix these and call ${toolName} again, without remarking on the fix to the user:\n${lines}`
100
+ feedback: ok && !warnings.length ? "Shown to the user." : ok ? `Shown to the user, and it works: do not draw it again now. Next time, to fit the chat better:\n${lines}` : `Shown, but it will not work as written. Fix these and call ${toolName} again with "replaces" set to this call's id, without remarking on the fix to the user:\n${lines}`
94
101
  };
95
102
  }
96
- export { activityTokens, applyEvent, awaitingToolCalls, checkUiMarkup, checkUiMarkupCode, checkUiTree, checkWidgetCode, estimateTokens, findUiBlocks, formatEvent, isActivityPart, isStateRef, matchesSchema, outputTokens, parsePartialJson, parseUiMarkup, readEventStream, readUiValue, reduceEvents, renderUiTool, renderUiToolName, resolveEffort, salvageJson, schemaErrors, settleToolCall, showUiTool, showUiToolName, toBlocks, uiActionSchema, uiMarkupGuide, uiMarkupLanguage, visualizeGuide, visualizeTool };
103
+ export { activityTokens, applyEvent, awaitingToolCalls, checkUiMarkup, checkUiMarkupCode, checkUiTree, checkWidgetCode, estimateTokens, findUiBlocks, formatEvent, isActivityPart, isStateRef, matchesSchema, outputTokens, parsePartialJson, parseUiMarkup, readEventStream, readUiValue, reduceEvents, renderUiTool, renderUiToolName, replacedId, replacesGuide, replacesProperty, resolveEffort, resolveReplaces, salvageJson, schemaErrors, settleToolCall, showUiTool, showUiToolName, toBlocks, uiActionSchema, uiMarkupGuide, uiMarkupLanguage, visualizeGuide, visualizeTool, widgetFrameLoader, widgetLoaderMessages, withCallId };