@runtypelabs/persona-proxy 3.31.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.
package/dist/index.d.cts CHANGED
@@ -107,6 +107,43 @@ declare const WEBMCP_STOREFRONT_FLOW: RuntypeFlowConfig;
107
107
  */
108
108
  declare const WEBMCP_CALENDAR_FLOW: RuntypeFlowConfig;
109
109
 
110
+ /**
111
+ * WebMCP slide-editor flow for the Deck Copilot demo
112
+ * (`examples/embedded-app/webmcp-slides.html`).
113
+ *
114
+ * Like the other WebMCP flows, this agent owns **no** tools of its own — the
115
+ * demo page registers them on `document.modelContext` and the widget snapshots
116
+ * them every turn into `clientTools[]`. What makes this flow different is that
117
+ * the page's tool set is *dynamic*: selection-scoped tools
118
+ * (`style_selection`, `align_selection`) only exist while the user has 2+
119
+ * elements selected, and entering presenter mode replaces the entire editing
120
+ * set with show controls (`next_slide`, `prev_slide`, `jump_to_slide`,
121
+ * `exit_presenter_mode`). The system prompt teaches the model to treat the
122
+ * current tool list as authoritative rather than assuming a fixed catalog.
123
+ *
124
+ * The page also ships live editor state as `{{slides_context}}` via the
125
+ * widget's `contextProviders` + `requestMiddleware` (moved from
126
+ * `payload.context` into `inputs`): current slide, mode, and the user's
127
+ * selection with ids and bounding boxes — so "align these" resolves without a
128
+ * round-trip.
129
+ */
130
+ declare const WEBMCP_SLIDES_FLOW: RuntypeFlowConfig;
131
+
132
+ /**
133
+ * WebMCP docked-dashboard flow for the docked panel demo
134
+ * (`examples/embedded-app/docked-panel-demo.html`).
135
+ *
136
+ * Like the other WebMCP flows, this agent owns **no** tools of its own. The
137
+ * demo page registers four workspace tools on `document.modelContext` via
138
+ * WebMCP (`get_workspace_overview`, `switch_section`, `set_dock_layout`,
139
+ * `log_activity`); the widget snapshots them every turn and the proxy
140
+ * forwards them on the dispatch payload as `clientTools[]`. The model calls
141
+ * them by name and the widget executes them **on the page**, posting results
142
+ * back via `/resume` — so the dashboard (and even the assistant's own dock
143
+ * placement) updates live.
144
+ */
145
+ declare const WEBMCP_DOCKED_FLOW: RuntypeFlowConfig;
146
+
110
147
  /**
111
148
  * Page-aware shopping assistant that can both *describe* and *act on* the page.
112
149
  *
@@ -228,4 +265,4 @@ type ChatProxyOptions = {
228
265
  declare const createChatProxyApp: (options?: ChatProxyOptions) => Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
229
266
  declare const createVercelHandler: (options?: ChatProxyOptions) => (req: Request) => Response | Promise<Response>;
230
267
 
231
- export { BAKERY_ASSISTANT_FLOW, COMPONENT_FLOW, CONVERSATIONAL_FLOW, type ChatProxyOptions, type CheckoutItem, type CheckoutSessionResponse, type CreateCheckoutSessionOptions, FORM_DIRECTIVE_FLOW, type FeedbackHandler, type FeedbackPayload, PAGE_CONTEXT_FLOW, type RuntypeFlowConfig, type RuntypeFlowStep, SHOPPING_ASSISTANT_FLOW, SHOPPING_ASSISTANT_METADATA_FLOW, STOREFRONT_ASSISTANT_FLOW, WEBMCP_CALENDAR_FLOW, WEBMCP_STOREFRONT_FLOW, createChatProxyApp, createCheckoutSession, createVercelHandler, createChatProxyApp as default };
268
+ export { BAKERY_ASSISTANT_FLOW, COMPONENT_FLOW, CONVERSATIONAL_FLOW, type ChatProxyOptions, type CheckoutItem, type CheckoutSessionResponse, type CreateCheckoutSessionOptions, FORM_DIRECTIVE_FLOW, type FeedbackHandler, type FeedbackPayload, PAGE_CONTEXT_FLOW, type RuntypeFlowConfig, type RuntypeFlowStep, SHOPPING_ASSISTANT_FLOW, SHOPPING_ASSISTANT_METADATA_FLOW, STOREFRONT_ASSISTANT_FLOW, WEBMCP_CALENDAR_FLOW, WEBMCP_DOCKED_FLOW, WEBMCP_SLIDES_FLOW, WEBMCP_STOREFRONT_FLOW, createChatProxyApp, createCheckoutSession, createVercelHandler, createChatProxyApp as default };
package/dist/index.d.ts CHANGED
@@ -107,6 +107,43 @@ declare const WEBMCP_STOREFRONT_FLOW: RuntypeFlowConfig;
107
107
  */
108
108
  declare const WEBMCP_CALENDAR_FLOW: RuntypeFlowConfig;
109
109
 
110
+ /**
111
+ * WebMCP slide-editor flow for the Deck Copilot demo
112
+ * (`examples/embedded-app/webmcp-slides.html`).
113
+ *
114
+ * Like the other WebMCP flows, this agent owns **no** tools of its own — the
115
+ * demo page registers them on `document.modelContext` and the widget snapshots
116
+ * them every turn into `clientTools[]`. What makes this flow different is that
117
+ * the page's tool set is *dynamic*: selection-scoped tools
118
+ * (`style_selection`, `align_selection`) only exist while the user has 2+
119
+ * elements selected, and entering presenter mode replaces the entire editing
120
+ * set with show controls (`next_slide`, `prev_slide`, `jump_to_slide`,
121
+ * `exit_presenter_mode`). The system prompt teaches the model to treat the
122
+ * current tool list as authoritative rather than assuming a fixed catalog.
123
+ *
124
+ * The page also ships live editor state as `{{slides_context}}` via the
125
+ * widget's `contextProviders` + `requestMiddleware` (moved from
126
+ * `payload.context` into `inputs`): current slide, mode, and the user's
127
+ * selection with ids and bounding boxes — so "align these" resolves without a
128
+ * round-trip.
129
+ */
130
+ declare const WEBMCP_SLIDES_FLOW: RuntypeFlowConfig;
131
+
132
+ /**
133
+ * WebMCP docked-dashboard flow for the docked panel demo
134
+ * (`examples/embedded-app/docked-panel-demo.html`).
135
+ *
136
+ * Like the other WebMCP flows, this agent owns **no** tools of its own. The
137
+ * demo page registers four workspace tools on `document.modelContext` via
138
+ * WebMCP (`get_workspace_overview`, `switch_section`, `set_dock_layout`,
139
+ * `log_activity`); the widget snapshots them every turn and the proxy
140
+ * forwards them on the dispatch payload as `clientTools[]`. The model calls
141
+ * them by name and the widget executes them **on the page**, posting results
142
+ * back via `/resume` — so the dashboard (and even the assistant's own dock
143
+ * placement) updates live.
144
+ */
145
+ declare const WEBMCP_DOCKED_FLOW: RuntypeFlowConfig;
146
+
110
147
  /**
111
148
  * Page-aware shopping assistant that can both *describe* and *act on* the page.
112
149
  *
@@ -228,4 +265,4 @@ type ChatProxyOptions = {
228
265
  declare const createChatProxyApp: (options?: ChatProxyOptions) => Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
229
266
  declare const createVercelHandler: (options?: ChatProxyOptions) => (req: Request) => Response | Promise<Response>;
230
267
 
231
- export { BAKERY_ASSISTANT_FLOW, COMPONENT_FLOW, CONVERSATIONAL_FLOW, type ChatProxyOptions, type CheckoutItem, type CheckoutSessionResponse, type CreateCheckoutSessionOptions, FORM_DIRECTIVE_FLOW, type FeedbackHandler, type FeedbackPayload, PAGE_CONTEXT_FLOW, type RuntypeFlowConfig, type RuntypeFlowStep, SHOPPING_ASSISTANT_FLOW, SHOPPING_ASSISTANT_METADATA_FLOW, STOREFRONT_ASSISTANT_FLOW, WEBMCP_CALENDAR_FLOW, WEBMCP_STOREFRONT_FLOW, createChatProxyApp, createCheckoutSession, createVercelHandler, createChatProxyApp as default };
268
+ export { BAKERY_ASSISTANT_FLOW, COMPONENT_FLOW, CONVERSATIONAL_FLOW, type ChatProxyOptions, type CheckoutItem, type CheckoutSessionResponse, type CreateCheckoutSessionOptions, FORM_DIRECTIVE_FLOW, type FeedbackHandler, type FeedbackPayload, PAGE_CONTEXT_FLOW, type RuntypeFlowConfig, type RuntypeFlowStep, SHOPPING_ASSISTANT_FLOW, SHOPPING_ASSISTANT_METADATA_FLOW, STOREFRONT_ASSISTANT_FLOW, WEBMCP_CALENDAR_FLOW, WEBMCP_DOCKED_FLOW, WEBMCP_SLIDES_FLOW, WEBMCP_STOREFRONT_FLOW, createChatProxyApp, createCheckoutSession, createVercelHandler, createChatProxyApp as default };
package/dist/index.js CHANGED
@@ -619,6 +619,102 @@ After your tool calls resolve, summarize the outcome in plain language. Do not d
619
619
  ]
620
620
  };
621
621
 
622
+ // src/flows/webmcp-slides.ts
623
+ var WEBMCP_SLIDES_FLOW = {
624
+ name: "WebMCP Slides Flow",
625
+ description: "Deck Copilot \u2014 drives a slide editor's page-provided WebMCP tools (clientTools[])",
626
+ steps: [
627
+ {
628
+ id: "webmcp_slides_prompt",
629
+ name: "WebMCP Slides Prompt",
630
+ type: "prompt",
631
+ enabled: true,
632
+ config: {
633
+ model: "nemotron-3-ultra-550b-a55b",
634
+ reasoning: false,
635
+ responseFormat: "markdown",
636
+ outputVariable: "prompt_result",
637
+ userPrompt: "{{user_message}}",
638
+ systemPrompt: `You are the Deck Copilot inside a live slide-deck editor. You build, restyle, align, and present slides \u2014 the canvas on the page updates instantly as your tools run, and the user is watching.
639
+
640
+ Voice: concise and design-literate. A sentence or two around the actions you take; never narrate every tool call.
641
+
642
+ ## Your tools come from the page \u2014 and they change
643
+
644
+ The editor exposes its own tools to you, and the set is dynamic:
645
+ - 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.
646
+ - 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.
647
+
648
+ Treat the tool list you currently see as authoritative. Never invent slide ids, element ids, or theme ids \u2014 read them from tool results.
649
+
650
+ ## Read before you write
651
+
652
+ - Call get_deck_overview to orient yourself when you need the deck's shape; call get_slide before editing a slide's elements.
653
+ - Mutations return the ids they created or touched \u2014 chain on those instead of re-reading the deck.
654
+ - 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) \u2014 do not guess.
655
+
656
+ ## Geometry and style conventions
657
+
658
+ - 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.
659
+ - 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 \u2014 hex values do not.
660
+ - 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.
661
+
662
+ ## Etiquette
663
+
664
+ - Destructive or deck-wide tools (delete_slide, delete_elements, apply_theme) ask the user for confirmation \u2014 if the user declines, accept it and move on.
665
+ - 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.
666
+ - After mutations, confirm briefly what changed \u2014 the user can see the canvas, so don't re-describe slides in detail.
667
+ - If a tool reports an error (unknown id, too few elements selected), relay it plainly and suggest the fix.
668
+ - Never mention JSON, ids, tool schemas, or the WebMCP mechanism unless the user asks.
669
+
670
+ ## Live editor state
671
+
672
+ {{slides_context}}`,
673
+ previousMessages: "{{messages}}"
674
+ }
675
+ }
676
+ ]
677
+ };
678
+
679
+ // src/flows/webmcp-docked.ts
680
+ var WEBMCP_DOCKED_FLOW = {
681
+ name: "WebMCP Docked Dashboard Flow",
682
+ description: "Dashboard copilot \u2014 drives page-provided WebMCP workspace tools (clientTools[])",
683
+ steps: [
684
+ {
685
+ id: "webmcp_docked_prompt",
686
+ name: "WebMCP Docked Prompt",
687
+ type: "prompt",
688
+ enabled: true,
689
+ config: {
690
+ model: "nemotron-3-ultra-550b-a55b",
691
+ reasoning: false,
692
+ responseFormat: "markdown",
693
+ outputVariable: "prompt_result",
694
+ userPrompt: "{{user_message}}",
695
+ systemPrompt: `You are Copilot, a dashboard assistant docked beside an operations workspace. You help the user read what's on the dashboard, move around it, jot activity notes, and even reposition your own panel \u2014 the page updates live as your tools run.
696
+
697
+ Voice: helpful, concise, plain language. Keep replies short \u2014 a sentence or two around the actions you take.
698
+
699
+ ## Your tools come from the page
700
+
701
+ The dashboard exposes its own tools to you. Always **use the tools** to read or change the workspace \u2014 never invent metrics, cards, sections, or activity from memory.
702
+
703
+ Rules:
704
+ - Call **get_workspace_overview** before answering questions about the dashboard \u2014 it returns the sections, the active section, the highlight cards, and the recent-activity feed.
705
+ - **switch_section** changes which workspace section is highlighted in the side nav. Use the exact section names from the overview.
706
+ - **set_dock_layout** moves and resizes YOUR own panel (side left/right, width, reveal style, animation). When the user says "move yourself" or "dock on the left", this is the tool. Confirm what changed afterward.
707
+ - **log_activity** appends an entry to the Recent activity feed. Use it when the user asks you to note, record, or log something. Keep titles short; put detail in the body.
708
+ - After a mutation, confirm briefly what changed \u2014 the page renders the result, so don't repeat the full dashboard unless asked.
709
+ - If a tool reports an error (unknown section, invalid width), relay it plainly and suggest a fix.
710
+
711
+ After your tool calls resolve, summarize the outcome in plain language. Do not describe tools, JSON, or the WebMCP mechanism to the user unless they ask.`,
712
+ previousMessages: "{{messages}}"
713
+ }
714
+ }
715
+ ]
716
+ };
717
+
622
718
  // src/flows/page-context.ts
623
719
  var PAGE_CONTEXT_FLOW = {
624
720
  name: "Page Context Assistant Flow",
@@ -1076,6 +1172,8 @@ export {
1076
1172
  SHOPPING_ASSISTANT_METADATA_FLOW,
1077
1173
  STOREFRONT_ASSISTANT_FLOW,
1078
1174
  WEBMCP_CALENDAR_FLOW,
1175
+ WEBMCP_DOCKED_FLOW,
1176
+ WEBMCP_SLIDES_FLOW,
1079
1177
  WEBMCP_STOREFRONT_FLOW,
1080
1178
  createChatProxyApp,
1081
1179
  createCheckoutSession,