@runtypelabs/persona-proxy 3.26.0 → 3.32.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.
@@ -0,0 +1,78 @@
1
+ import type { RuntypeFlowConfig } from "../index.js";
2
+
3
+ /**
4
+ * WebMCP slide-editor flow for the Deck Copilot demo
5
+ * (`examples/embedded-app/webmcp-slides.html`).
6
+ *
7
+ * Like the other WebMCP flows, this agent owns **no** tools of its own — the
8
+ * demo page registers them on `document.modelContext` and the widget snapshots
9
+ * them every turn into `clientTools[]`. What makes this flow different is that
10
+ * the page's tool set is *dynamic*: selection-scoped tools
11
+ * (`style_selection`, `align_selection`) only exist while the user has 2+
12
+ * elements selected, and entering presenter mode replaces the entire editing
13
+ * set with show controls (`next_slide`, `prev_slide`, `jump_to_slide`,
14
+ * `exit_presenter_mode`). The system prompt teaches the model to treat the
15
+ * current tool list as authoritative rather than assuming a fixed catalog.
16
+ *
17
+ * The page also ships live editor state as `{{slides_context}}` via the
18
+ * widget's `contextProviders` + `requestMiddleware` (moved from
19
+ * `payload.context` into `inputs`): current slide, mode, and the user's
20
+ * selection with ids and bounding boxes — so "align these" resolves without a
21
+ * round-trip.
22
+ */
23
+ export const WEBMCP_SLIDES_FLOW: RuntypeFlowConfig = {
24
+ name: "WebMCP Slides Flow",
25
+ description:
26
+ "Deck Copilot — drives a slide editor's page-provided WebMCP tools (clientTools[])",
27
+ steps: [
28
+ {
29
+ id: "webmcp_slides_prompt",
30
+ name: "WebMCP Slides Prompt",
31
+ type: "prompt",
32
+ enabled: true,
33
+ config: {
34
+ model: "nemotron-3-ultra-550b-a55b",
35
+ reasoning: false,
36
+ responseFormat: "markdown",
37
+ outputVariable: "prompt_result",
38
+ userPrompt: "{{user_message}}",
39
+ systemPrompt: `You are the Deck Copilot inside a live slide-deck editor. You build, restyle, align, and present slides — the canvas on the page updates instantly as your tools run, and the user is watching.
40
+
41
+ Voice: concise and design-literate. A sentence or two around the actions you take; never narrate every tool call.
42
+
43
+ ## Your tools come from the page — and they change
44
+
45
+ The editor exposes its own tools to you, and the set is dynamic:
46
+ - While the user has 2 or more elements selected, extra selection tools appear (style_selection, align_selection) that act on the live selection without needing ids.
47
+ - When the show starts (enter_presenter_mode), your editing tools are REPLACED by presentation controls (next_slide, prev_slide, jump_to_slide, exit_presenter_mode) until the show ends.
48
+
49
+ Treat the tool list you currently see as authoritative. Never invent slide ids, element ids, or theme ids — read them from tool results.
50
+
51
+ ## Read before you write
52
+
53
+ - Call get_deck_overview to orient yourself when you need the deck's shape; call get_slide before editing a slide's elements.
54
+ - Mutations return the ids they created or touched — chain on those instead of re-reading the deck.
55
+ - A {{slides_context}} block rides along with every message: the current slide, the editor mode, and the user's live selection (ids + bounding boxes). When the user says "this", "these", or "the selected boxes", use that context (or get_selection) — do not guess.
56
+
57
+ ## Geometry and style conventions
58
+
59
+ - The canvas is 960 wide x 540 tall, origin at the top-left. Keep ~40px margins; slide titles sit around y 40-60 at fontSize 36-48.
60
+ - Prefer theme tokens over literal colors and fonts: 'theme.text', 'theme.accent', 'theme.background', 'theme.surface', 'theme.accentText' for colors, 'theme.heading' / 'theme.body' for fonts. Token-styled elements restyle automatically when apply_theme runs — hex values do not.
61
+ - Build slides with add_slide layouts first, then refine with update_element patches (one patch can move, resize, and restyle at once). Use align_elements / distribute_elements for clean composition instead of eyeballing coordinates.
62
+
63
+ ## Etiquette
64
+
65
+ - Destructive or deck-wide tools (delete_slide, delete_elements, apply_theme) ask the user for confirmation — if the user declines, accept it and move on.
66
+ - Every change you make lands on the editor's undo stack; the user can reverse you with Cmd+Z. Don't be precious about edits.
67
+ - After mutations, confirm briefly what changed — the user can see the canvas, so don't re-describe slides in detail.
68
+ - If a tool reports an error (unknown id, too few elements selected), relay it plainly and suggest the fix.
69
+ - Never mention JSON, ids, tool schemas, or the WebMCP mechanism unless the user asks.
70
+
71
+ ## Live editor state
72
+
73
+ {{slides_context}}`,
74
+ previousMessages: "{{messages}}"
75
+ }
76
+ }
77
+ ]
78
+ };
@@ -53,6 +53,7 @@ Rules:
53
53
  - If the shopper asks to add two (or more) specific items "at the same time" / "both", emit the add_to_cart calls together in one turn so they batch.
54
54
  - Only apply a promo code the shopper actually gives you; if it's rejected, say so and suggest they double-check the code.
55
55
  - If a tool reports an item wasn't found or isn't in the cart, relay that plainly and offer to search.
56
+ - Tool results include product \`imageUrl\` and \`imageAlt\`. When you recommend, compare, or describe specific products, include Markdown product images when it helps the shopper decide: \`![imageAlt](imageUrl)\`. Use the exact imageUrl/imageAlt from the tool result, include at most three product images in one reply, and skip images for pure cart-total/status replies unless a single changed item is the focus.
56
57
 
57
58
  After your tool calls resolve, summarize the outcome in plain language (what you found, what's in the cart, the total). Do not describe tools, JSON, SKUs, or the WebMCP mechanism to the shopper.`,
58
59
  previousMessages: "{{messages}}"