@particle-academy/agent-integrations 0.16.0 → 0.17.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.
@@ -1,4 +1,4 @@
1
- import { ShareControls, AgentCursor, AgentActivityHighlight, AgentPanel } from './chunk-GJSKBUOH.js';
1
+ import { ShareControls, AgentCursor, AgentActivityHighlight, AgentPanel } from './chunk-YEEOTIGY.js';
2
2
  import { createSessionDescriptor, attachSseRelay } from './chunk-CPNOF4HI.js';
3
3
  import { attachInProcess } from './chunk-AFUULW5E.js';
4
4
  import { registerWhiteboardBridge } from './chunk-3QJSOS7G.js';
package/dist/index.cjs CHANGED
@@ -2940,16 +2940,21 @@ function ShareControls({
2940
2940
  className,
2941
2941
  style
2942
2942
  }) {
2943
- const [tab, setTab] = react.useState("url");
2943
+ const [tab, setTab] = react.useState("prompt");
2944
2944
  if (!session) {
2945
2945
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["fai-share fai-share--idle", className ?? ""].filter(Boolean).join(" "), style, children: [
2946
2946
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "fai-share__start", onClick: onStart, children: "Start shared session" }),
2947
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "fai-share__hint", children: "Generates a session id + secret token. Share the URL with humans, or hand the JSON config to an MCP-capable agent." })
2947
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "fai-share__hint", children: [
2948
+ "Generates a session id + secret token. Hand the ",
2949
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Agent prompt" }),
2950
+ " to an AI agent, share the URL with humans, or give the JSON config to an MCP-capable client."
2951
+ ] })
2948
2952
  ] });
2949
2953
  }
2950
2954
  const url = buildShareUrl(session, shareBaseUrl);
2951
2955
  const config = buildShareConfig(session);
2952
2956
  const curl = buildCurlRecipe(session);
2957
+ const prompt = buildAgentPrompt(url);
2953
2958
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["fai-share fai-share--active", className ?? ""].filter(Boolean).join(" "), style, children: [
2954
2959
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fai-share__header", children: [
2955
2960
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -2970,11 +2975,20 @@ function ShareControls({
2970
2975
  ] })
2971
2976
  ] }),
2972
2977
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fai-share__tabs", role: "tablist", children: [
2978
+ /* @__PURE__ */ jsxRuntime.jsx(TabButton, { tab: "prompt", active: tab, setTab, children: "Agent prompt" }),
2973
2979
  /* @__PURE__ */ jsxRuntime.jsx(TabButton, { tab: "url", active: tab, setTab, children: "URL" }),
2974
2980
  /* @__PURE__ */ jsxRuntime.jsx(TabButton, { tab: "json", active: tab, setTab, children: "JSON" }),
2975
2981
  /* @__PURE__ */ jsxRuntime.jsx(TabButton, { tab: "curl", active: tab, setTab, children: "cURL recipe" })
2976
2982
  ] }),
2977
2983
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fai-share__panel", children: [
2984
+ tab === "prompt" && /* @__PURE__ */ jsxRuntime.jsx(
2985
+ CopyBox,
2986
+ {
2987
+ label: "Paste this straight into an AI agent \u2014 it connects over MCP, no browser",
2988
+ value: prompt,
2989
+ multiline: true
2990
+ }
2991
+ ),
2978
2992
  tab === "url" && /* @__PURE__ */ jsxRuntime.jsx(CopyBox, { label: "Open this URL in another tab to join the session", value: url }),
2979
2993
  tab === "json" && /* @__PURE__ */ jsxRuntime.jsx(
2980
2994
  CopyBox,
@@ -3025,6 +3039,33 @@ function CopyBox({ label, value, multiline }) {
3025
3039
  ] })
3026
3040
  ] });
3027
3041
  }
3042
+ function buildAgentPrompt(url) {
3043
+ return [
3044
+ `You're joining a live Human+ co-browsing session on a web app. This is an MCP`,
3045
+ `(Model Context Protocol) session \u2014 NOT a website to visit. Do NOT open the URL`,
3046
+ `in a browser and do NOT use any browser/Playwright tool. You drive the real,`,
3047
+ `running app through MCP tools while a human watches and can take over.`,
3048
+ ``,
3049
+ `Session link (carries the session id + token \u2014 treat it as a secret):`,
3050
+ ` ${url}`,
3051
+ ``,
3052
+ `Connect by running the relay client as an MCP server (zero install):`,
3053
+ ` npx -y mcp-relay-client "${url}"`,
3054
+ ``,
3055
+ `That exposes the app's own tools (e.g. page_describe, page_read, nav_visit,`,
3056
+ `page_click, page_set_field, page_submit, plus surface tools like whiteboard_*).`,
3057
+ `Then:`,
3058
+ ` 1. Call page_describe first to see the current page and its interactive handles.`,
3059
+ ` 2. Act only on the STABLE HANDLES the tools return \u2014 never guess DOM selectors.`,
3060
+ ` 3. Navigate with nav_visit, type with page_set_field, click with page_click.`,
3061
+ ` Submits and destructive clicks are staged for the human to confirm.`,
3062
+ ``,
3063
+ `If you can't register an MCP server but can run a shell, drive it directly:`,
3064
+ ` curl -O https://raw.githubusercontent.com/Particle-Academy/mcp-relay-client/main/connect.sh`,
3065
+ ` bash connect.sh "${url}" tools`,
3066
+ ` bash connect.sh "${url}" call page_describe '{}'`
3067
+ ].join("\n");
3068
+ }
3028
3069
  function buildCurlRecipe(session) {
3029
3070
  const base = typeof window !== "undefined" ? `${window.location.protocol}//${window.location.host}` : "http://localhost";
3030
3071
  const inbox = `${base}/agent-relay/${session.id}/inbox?token=${session.token}`;
@@ -3588,6 +3629,7 @@ exports.WrenchMark = WrenchMark;
3588
3629
  exports.attachInProcess = attachInProcess;
3589
3630
  exports.attachRelay = attachRelay;
3590
3631
  exports.attachSseRelay = attachSseRelay;
3632
+ exports.buildAgentPrompt = buildAgentPrompt;
3591
3633
  exports.buildCursorDeeplink = buildCursorDeeplink;
3592
3634
  exports.buildManualConfig = buildManualConfig;
3593
3635
  exports.buildManualConfigSnippet = buildManualConfigSnippet;