@solidxai/core-ui 0.1.22-beta.4 → 0.1.22

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.
Files changed (108) hide show
  1. package/dist/adapters/auth/adminEmbedSession.d.ts +16 -0
  2. package/dist/adapters/auth/adminEmbedSession.d.ts.map +1 -0
  3. package/dist/adapters/auth/adminEmbedSession.js +72 -0
  4. package/dist/adapters/auth/adminEmbedSession.js.map +1 -0
  5. package/dist/adapters/auth/adminEmbedSession.ts +67 -0
  6. package/dist/adapters/auth/getSession.d.ts.map +1 -1
  7. package/dist/adapters/auth/getSession.js +4 -1
  8. package/dist/adapters/auth/getSession.js.map +1 -1
  9. package/dist/adapters/auth/getSession.ts +4 -1
  10. package/dist/adapters/auth/storage.d.ts +1 -0
  11. package/dist/adapters/auth/storage.d.ts.map +1 -1
  12. package/dist/adapters/auth/storage.js +9 -3
  13. package/dist/adapters/auth/storage.js.map +1 -1
  14. package/dist/adapters/auth/storage.ts +10 -2
  15. package/dist/components/common/Link.d.ts.map +1 -1
  16. package/dist/components/common/Link.js +3 -2
  17. package/dist/components/common/Link.js.map +1 -1
  18. package/dist/components/common/Link.tsx +3 -2
  19. package/dist/components/core/form/SolidFormFooter.js +2 -2
  20. package/dist/components/core/form/SolidFormFooter.js.map +1 -1
  21. package/dist/components/core/form/SolidFormFooter.tsx +2 -2
  22. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
  23. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +17 -15
  24. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
  25. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +7 -5
  26. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
  27. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +13 -11
  28. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
  29. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +8 -6
  30. package/dist/components/core/solid-agent/browser/AgentBrowser.module.css +170 -0
  31. package/dist/components/core/solid-agent/browser/AgentBrowserScreen.d.ts +13 -0
  32. package/dist/components/core/solid-agent/browser/AgentBrowserScreen.d.ts.map +1 -0
  33. package/dist/components/core/solid-agent/browser/AgentBrowserScreen.js +138 -0
  34. package/dist/components/core/solid-agent/browser/AgentBrowserScreen.js.map +1 -0
  35. package/dist/components/core/solid-agent/browser/AgentBrowserScreen.tsx +162 -0
  36. package/dist/components/core/solid-agent/browser/DefaultAgentBrowserPanelWidget.d.ts +9 -0
  37. package/dist/components/core/solid-agent/browser/DefaultAgentBrowserPanelWidget.d.ts.map +1 -0
  38. package/dist/components/core/solid-agent/browser/DefaultAgentBrowserPanelWidget.js +59 -0
  39. package/dist/components/core/solid-agent/browser/DefaultAgentBrowserPanelWidget.js.map +1 -0
  40. package/dist/components/core/solid-agent/browser/DefaultAgentBrowserPanelWidget.tsx +159 -0
  41. package/dist/components/core/solid-agent/browser/useAgentBrowser.d.ts +6 -0
  42. package/dist/components/core/solid-agent/browser/useAgentBrowser.d.ts.map +1 -0
  43. package/dist/components/core/solid-agent/browser/useAgentBrowser.js +37 -0
  44. package/dist/components/core/solid-agent/browser/useAgentBrowser.js.map +1 -0
  45. package/dist/components/core/solid-agent/browser/useAgentBrowser.ts +38 -0
  46. package/dist/components/core/solid-agent/client/agentBrowser.d.ts +128 -0
  47. package/dist/components/core/solid-agent/client/agentBrowser.d.ts.map +1 -0
  48. package/dist/components/core/solid-agent/client/agentBrowser.js +474 -0
  49. package/dist/components/core/solid-agent/client/agentBrowser.js.map +1 -0
  50. package/dist/components/core/solid-agent/client/agentBrowser.ts +342 -0
  51. package/dist/components/core/solid-agent/toolFiles.d.ts +13 -0
  52. package/dist/components/core/solid-agent/toolFiles.d.ts.map +1 -0
  53. package/dist/components/core/solid-agent/toolFiles.js +54 -0
  54. package/dist/components/core/solid-agent/toolFiles.js.map +1 -0
  55. package/dist/components/core/solid-agent/toolFiles.ts +42 -0
  56. package/dist/components/core/solid-agent/widgets/AgentToolFiles.d.ts +9 -0
  57. package/dist/components/core/solid-agent/widgets/AgentToolFiles.d.ts.map +1 -0
  58. package/dist/components/core/solid-agent/widgets/AgentToolFiles.js +37 -0
  59. package/dist/components/core/solid-agent/widgets/AgentToolFiles.js.map +1 -0
  60. package/dist/components/core/solid-agent/widgets/AgentToolFiles.tsx +46 -0
  61. package/dist/components/core/solid-agent/widgets/SolidQuestionChatWidget.d.ts.map +1 -1
  62. package/dist/components/core/solid-agent/widgets/SolidQuestionChatWidget.js +3 -2
  63. package/dist/components/core/solid-agent/widgets/SolidQuestionChatWidget.js.map +1 -1
  64. package/dist/components/core/solid-agent/widgets/SolidQuestionChatWidget.tsx +3 -2
  65. package/dist/dummy.d.ts +2 -0
  66. package/dist/dummy.d.ts.map +1 -0
  67. package/dist/dummy.js +3 -0
  68. package/dist/dummy.js.map +1 -0
  69. package/dist/dummy.ts +2 -0
  70. package/dist/helpers/modelViewPersistence.d.ts +1 -1
  71. package/dist/helpers/modelViewPersistence.d.ts.map +1 -1
  72. package/dist/helpers/modelViewPersistence.js +5 -4
  73. package/dist/helpers/modelViewPersistence.js.map +1 -1
  74. package/dist/helpers/modelViewPersistence.ts +6 -4
  75. package/dist/hooks/useRouter.d.ts.map +1 -1
  76. package/dist/hooks/useRouter.js +5 -3
  77. package/dist/hooks/useRouter.js.map +1 -1
  78. package/dist/hooks/useRouter.ts +5 -3
  79. package/dist/resources/solid-custom.css +14 -1
  80. package/dist/routes/AppEventListener.js +1 -1
  81. package/dist/routes/AppEventListener.js.map +1 -1
  82. package/dist/routes/AppEventListener.tsx +1 -1
  83. package/dist/routes/pages/admin/core/AgentDeploymentPanel.d.ts +3 -4
  84. package/dist/routes/pages/admin/core/AgentDeploymentPanel.d.ts.map +1 -1
  85. package/dist/routes/pages/admin/core/AgentDeploymentPanel.js +13 -83
  86. package/dist/routes/pages/admin/core/AgentDeploymentPanel.js.map +1 -1
  87. package/dist/routes/pages/admin/core/AgentDeploymentPanel.tsx +22 -43
  88. package/dist/routes/pages/admin/core/AgentJobsInboxPage.d.ts.map +1 -1
  89. package/dist/routes/pages/admin/core/AgentJobsInboxPage.js +157 -34
  90. package/dist/routes/pages/admin/core/AgentJobsInboxPage.js.map +1 -1
  91. package/dist/routes/pages/admin/core/AgentJobsInboxPage.module.css +88 -12
  92. package/dist/routes/pages/admin/core/AgentJobsInboxPage.tsx +238 -26
  93. package/dist/routes/pages/admin/core/AgentRegistryEditorPage.css +6 -0
  94. package/dist/routes/pages/admin/core/AgentRegistryEditorPage.d.ts.map +1 -1
  95. package/dist/routes/pages/admin/core/AgentRegistryEditorPage.js +56 -49
  96. package/dist/routes/pages/admin/core/AgentRegistryEditorPage.js.map +1 -1
  97. package/dist/routes/pages/admin/core/AgentRegistryEditorPage.tsx +13 -6
  98. package/dist/routes/pages/embed/AdminEmbedPage.d.ts +7 -0
  99. package/dist/routes/pages/embed/AdminEmbedPage.d.ts.map +1 -0
  100. package/dist/routes/pages/embed/AdminEmbedPage.js +104 -0
  101. package/dist/routes/pages/embed/AdminEmbedPage.js.map +1 -0
  102. package/dist/routes/pages/embed/AdminEmbedPage.module.css +9 -0
  103. package/dist/routes/pages/embed/AdminEmbedPage.tsx +128 -0
  104. package/dist/routes/solidRoutes.d.ts.map +1 -1
  105. package/dist/routes/solidRoutes.js +2 -0
  106. package/dist/routes/solidRoutes.js.map +1 -1
  107. package/dist/routes/solidRoutes.tsx +2 -0
  108. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentBrowserScreen.js","sourceRoot":"","sources":["../../../../../src/components/core/solid-agent/browser/AgentBrowserScreen.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAQ/C,IAAM,OAAO,GAAG,CAAC,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CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,8BAA8B;QACzF,CAAC,CAAC,IAAI,CAAC;IAEX,OAAO,CACH,eAAK,SAAS,EAAE,UAAG,MAAM,CAAC,MAAM,cAAI,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,cAAI,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAE,EAC5F,KAAK,EAAE,EAAE,kBAAkB,EAAE,UAAG,KAAK,gBAAM,MAAM,CAAE,EAAyB,aAC5E,iBACI,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAClB,WAAW,CAAC,CAAC,CAAC,qEAAqE,CAAC,CAAC,CAAC,yBAAyB,EAC3H,IAAI,EAAC,KAAK,EACV,WAAW,EAAE,WAAW,CAAC,cAAc,CAAC,EACxC,SAAS,EAAE,WAAW,CAAC,eAAe,CAAC,EACvC,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,UAAC,KAAK,IAAO,IAAI,WAAW;oBAAE,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EACtE,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,GAClB,EACD,WAAW,IAAI,cAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,EAAE,IAAI,EAAC,QAAQ,YAAE,WAAW,GAAO,IACzF,CACT,CAAC;AACN,CAAC","sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport type { AgentBrowserChannel, AgentBrowserView } from \"../client/agentBrowser\";\nimport type { AgentBrowserInputEvent } from \"../types\";\nimport styles from \"./AgentBrowser.module.css\";\n\ntype Props = {\n channel: AgentBrowserChannel;\n view: AgentBrowserView;\n className?: string;\n};\n\nconst BUTTONS = [\"left\", \"middle\", \"right\"] as const;\n\nfunction modifiers(event: { altKey: boolean; ctrlKey: boolean; metaKey: boolean; shiftKey: boolean }) {\n return (event.altKey ? 1 : 0) | (event.ctrlKey ? 2 : 0) | (event.metaKey ? 4 : 0) | (event.shiftKey ? 8 : 0);\n}\n\n/**\n * Viewport pixels for a pointer position. The canvas letterboxes the page (object-fit: contain), so\n * the scale and offsets come from the drawn area, not the element box.\n */\nfunction viewportPoint(canvas: HTMLCanvasElement, clientX: number, clientY: number) {\n const box = canvas.getBoundingClientRect();\n const scale = Math.min(box.width / canvas.width, box.height / canvas.height) || 1;\n const left = box.left + (box.width - canvas.width * scale) / 2;\n const top = box.top + (box.height - canvas.height * scale) / 2;\n const clamp = (value: number, max: number) => Math.max(0, Math.min(max, Math.round(value)));\n return { x: clamp((clientX - left) / scale, canvas.width), y: clamp((clientY - top) / scale, canvas.height) };\n}\n\nfunction keyEvent(type: \"keyDown\" | \"keyUp\" | \"char\", event: React.KeyboardEvent, text?: string): AgentBrowserInputEvent {\n return {\n kind: \"key\", type, key: event.key.slice(0, 32), code: event.code.slice(0, 32),\n keyCode: event.keyCode > 255 ? 0 : event.keyCode, modifiers: modifiers(event),\n ...(text ? { text } : {}),\n };\n}\n\n/**\n * The agent's browser, drawn from live-view frames. While the user has control, the canvas takes the\n * pointer and the keyboard and forwards them as viewport-pixel input events.\n */\nexport function AgentBrowserScreen({ channel, view, className }: Props) {\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const drawnSeq = useRef(0);\n const moveQueued = useRef<AgentBrowserInputEvent | null>(null);\n const interactive = view.control.mode === \"human\";\n const { width, height } = view.viewport;\n\n useEffect(() => channel.watch(), [channel]);\n\n useEffect(() => {\n drawnSeq.current = 0;\n const draw = (frame: { data: string; format: string; seq: number }) => {\n const picture = new Image();\n picture.onload = () => {\n const canvas = canvasRef.current;\n // A newer frame may have been drawn while this one decoded.\n if (!canvas || frame.seq < drawnSeq.current) return;\n drawnSeq.current = frame.seq;\n canvas.getContext(\"2d\")?.drawImage(picture, 0, 0, canvas.width, canvas.height);\n };\n picture.src = `data:image/${frame.format};base64,${frame.data}`;\n };\n const latest = channel.latestFrame;\n if (latest) draw(latest);\n return channel.onFrame(draw);\n // Resizing the canvas clears it, so the latest frame is drawn again for a new viewport.\n }, [channel, width, height]);\n\n useEffect(() => {\n if (!view.hasFrame) {\n const canvas = canvasRef.current;\n canvas?.getContext(\"2d\")?.clearRect(0, 0, canvas.width, canvas.height);\n drawnSeq.current = 0;\n }\n }, [view.hasFrame]);\n\n useEffect(() => {\n if (interactive) canvasRef.current?.focus({ preventScroll: true });\n }, [interactive]);\n\n useEffect(() => {\n const canvas = canvasRef.current;\n if (!canvas || !interactive) return;\n // React attaches wheel listeners as passive, so scrolling the page could not be prevented.\n const onWheel = (event: WheelEvent) => {\n event.preventDefault();\n const scale = event.deltaMode === 1 ? 40 : event.deltaMode === 2 ? canvas.height : 1;\n channel.sendInput({\n kind: \"wheel\", ...viewportPoint(canvas, event.clientX, event.clientY),\n deltaX: Math.round(event.deltaX * scale), deltaY: Math.round(event.deltaY * scale), modifiers: modifiers(event),\n });\n };\n canvas.addEventListener(\"wheel\", onWheel, { passive: false });\n return () => canvas.removeEventListener(\"wheel\", onWheel);\n }, [channel, interactive]);\n\n const mouseButton = (type: \"mousePressed\" | \"mouseReleased\") => (event: React.MouseEvent<HTMLCanvasElement>) => {\n if (!interactive) return;\n event.preventDefault();\n event.currentTarget.focus({ preventScroll: true });\n channel.sendInput({\n kind: \"mouse\", type, ...viewportPoint(event.currentTarget, event.clientX, event.clientY),\n button: BUTTONS[event.button] ?? \"left\", clickCount: Math.min(3, event.detail || 1), modifiers: modifiers(event),\n });\n };\n\n const onMouseMove = (event: React.MouseEvent<HTMLCanvasElement>) => {\n if (!interactive) return;\n const pressed = event.buttons & 1 ? \"left\" : event.buttons & 4 ? \"middle\" : event.buttons & 2 ? \"right\" : \"none\";\n const first = moveQueued.current === null;\n moveQueued.current = { kind: \"mouse\", type: \"mouseMoved\", ...viewportPoint(event.currentTarget, event.clientX, event.clientY), button: pressed, modifiers: modifiers(event) };\n // One move per animation frame is plenty and keeps the socket quiet.\n if (first) requestAnimationFrame(() => {\n if (moveQueued.current) channel.sendInput(moveQueued.current);\n moveQueued.current = null;\n });\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLCanvasElement>) => {\n if (!interactive) return;\n event.preventDefault();\n event.stopPropagation();\n channel.sendInput(keyEvent(\"keyDown\", event, event.key === \"Enter\" ? \"\\r\" : undefined));\n // Printable keys also send the character, as a keyboard would; shortcuts with Ctrl or Meta do not.\n if (event.key.length === 1 && !event.ctrlKey && !event.metaKey) channel.sendInput(keyEvent(\"char\", event, event.key));\n };\n\n const onKeyUp = (event: React.KeyboardEvent<HTMLCanvasElement>) => {\n if (!interactive) return;\n event.preventDefault();\n event.stopPropagation();\n channel.sendInput(keyEvent(\"keyUp\", event));\n };\n\n const placeholder = !view.hasFrame\n ? view.state === \"starting\" ? \"The browser is starting…\" : \"Connecting to the live view…\"\n : null;\n\n return (\n <div className={`${styles.screen} ${interactive ? styles.screenDriving : \"\"} ${className ?? \"\"}`}\n style={{ \"--browser-aspect\": `${width} / ${height}` } as React.CSSProperties}>\n <canvas\n ref={canvasRef}\n className={styles.canvas}\n width={width}\n height={height}\n tabIndex={interactive ? 0 : -1}\n aria-label={interactive ? \"Agent browser. You have control: mouse and keyboard go to the page.\" : \"Agent browser live view\"}\n role=\"img\"\n onMouseDown={mouseButton(\"mousePressed\")}\n onMouseUp={mouseButton(\"mouseReleased\")}\n onMouseMove={onMouseMove}\n onContextMenu={(event) => { if (interactive) event.preventDefault(); }}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n />\n {placeholder && <div className={styles.screenPlaceholder} role=\"status\">{placeholder}</div>}\n </div>\n );\n}\n"]}
@@ -0,0 +1,162 @@
1
+ import React, { useEffect, useRef } from "react";
2
+ import type { AgentBrowserChannel, AgentBrowserView } from "../client/agentBrowser";
3
+ import type { AgentBrowserInputEvent } from "../types";
4
+ import styles from "./AgentBrowser.module.css";
5
+
6
+ type Props = {
7
+ channel: AgentBrowserChannel;
8
+ view: AgentBrowserView;
9
+ className?: string;
10
+ };
11
+
12
+ const BUTTONS = ["left", "middle", "right"] as const;
13
+
14
+ function modifiers(event: { altKey: boolean; ctrlKey: boolean; metaKey: boolean; shiftKey: boolean }) {
15
+ return (event.altKey ? 1 : 0) | (event.ctrlKey ? 2 : 0) | (event.metaKey ? 4 : 0) | (event.shiftKey ? 8 : 0);
16
+ }
17
+
18
+ /**
19
+ * Viewport pixels for a pointer position. The canvas letterboxes the page (object-fit: contain), so
20
+ * the scale and offsets come from the drawn area, not the element box.
21
+ */
22
+ function viewportPoint(canvas: HTMLCanvasElement, clientX: number, clientY: number) {
23
+ const box = canvas.getBoundingClientRect();
24
+ const scale = Math.min(box.width / canvas.width, box.height / canvas.height) || 1;
25
+ const left = box.left + (box.width - canvas.width * scale) / 2;
26
+ const top = box.top + (box.height - canvas.height * scale) / 2;
27
+ const clamp = (value: number, max: number) => Math.max(0, Math.min(max, Math.round(value)));
28
+ return { x: clamp((clientX - left) / scale, canvas.width), y: clamp((clientY - top) / scale, canvas.height) };
29
+ }
30
+
31
+ function keyEvent(type: "keyDown" | "keyUp" | "char", event: React.KeyboardEvent, text?: string): AgentBrowserInputEvent {
32
+ return {
33
+ kind: "key", type, key: event.key.slice(0, 32), code: event.code.slice(0, 32),
34
+ keyCode: event.keyCode > 255 ? 0 : event.keyCode, modifiers: modifiers(event),
35
+ ...(text ? { text } : {}),
36
+ };
37
+ }
38
+
39
+ /**
40
+ * The agent's browser, drawn from live-view frames. While the user has control, the canvas takes the
41
+ * pointer and the keyboard and forwards them as viewport-pixel input events.
42
+ */
43
+ export function AgentBrowserScreen({ channel, view, className }: Props) {
44
+ const canvasRef = useRef<HTMLCanvasElement>(null);
45
+ const drawnSeq = useRef(0);
46
+ const moveQueued = useRef<AgentBrowserInputEvent | null>(null);
47
+ const interactive = view.control.mode === "human";
48
+ const { width, height } = view.viewport;
49
+
50
+ useEffect(() => channel.watch(), [channel]);
51
+
52
+ useEffect(() => {
53
+ drawnSeq.current = 0;
54
+ const draw = (frame: { data: string; format: string; seq: number }) => {
55
+ const picture = new Image();
56
+ picture.onload = () => {
57
+ const canvas = canvasRef.current;
58
+ // A newer frame may have been drawn while this one decoded.
59
+ if (!canvas || frame.seq < drawnSeq.current) return;
60
+ drawnSeq.current = frame.seq;
61
+ canvas.getContext("2d")?.drawImage(picture, 0, 0, canvas.width, canvas.height);
62
+ };
63
+ picture.src = `data:image/${frame.format};base64,${frame.data}`;
64
+ };
65
+ const latest = channel.latestFrame;
66
+ if (latest) draw(latest);
67
+ return channel.onFrame(draw);
68
+ // Resizing the canvas clears it, so the latest frame is drawn again for a new viewport.
69
+ }, [channel, width, height]);
70
+
71
+ useEffect(() => {
72
+ if (!view.hasFrame) {
73
+ const canvas = canvasRef.current;
74
+ canvas?.getContext("2d")?.clearRect(0, 0, canvas.width, canvas.height);
75
+ drawnSeq.current = 0;
76
+ }
77
+ }, [view.hasFrame]);
78
+
79
+ useEffect(() => {
80
+ if (interactive) canvasRef.current?.focus({ preventScroll: true });
81
+ }, [interactive]);
82
+
83
+ useEffect(() => {
84
+ const canvas = canvasRef.current;
85
+ if (!canvas || !interactive) return;
86
+ // React attaches wheel listeners as passive, so scrolling the page could not be prevented.
87
+ const onWheel = (event: WheelEvent) => {
88
+ event.preventDefault();
89
+ const scale = event.deltaMode === 1 ? 40 : event.deltaMode === 2 ? canvas.height : 1;
90
+ channel.sendInput({
91
+ kind: "wheel", ...viewportPoint(canvas, event.clientX, event.clientY),
92
+ deltaX: Math.round(event.deltaX * scale), deltaY: Math.round(event.deltaY * scale), modifiers: modifiers(event),
93
+ });
94
+ };
95
+ canvas.addEventListener("wheel", onWheel, { passive: false });
96
+ return () => canvas.removeEventListener("wheel", onWheel);
97
+ }, [channel, interactive]);
98
+
99
+ const mouseButton = (type: "mousePressed" | "mouseReleased") => (event: React.MouseEvent<HTMLCanvasElement>) => {
100
+ if (!interactive) return;
101
+ event.preventDefault();
102
+ event.currentTarget.focus({ preventScroll: true });
103
+ channel.sendInput({
104
+ kind: "mouse", type, ...viewportPoint(event.currentTarget, event.clientX, event.clientY),
105
+ button: BUTTONS[event.button] ?? "left", clickCount: Math.min(3, event.detail || 1), modifiers: modifiers(event),
106
+ });
107
+ };
108
+
109
+ const onMouseMove = (event: React.MouseEvent<HTMLCanvasElement>) => {
110
+ if (!interactive) return;
111
+ const pressed = event.buttons & 1 ? "left" : event.buttons & 4 ? "middle" : event.buttons & 2 ? "right" : "none";
112
+ const first = moveQueued.current === null;
113
+ moveQueued.current = { kind: "mouse", type: "mouseMoved", ...viewportPoint(event.currentTarget, event.clientX, event.clientY), button: pressed, modifiers: modifiers(event) };
114
+ // One move per animation frame is plenty and keeps the socket quiet.
115
+ if (first) requestAnimationFrame(() => {
116
+ if (moveQueued.current) channel.sendInput(moveQueued.current);
117
+ moveQueued.current = null;
118
+ });
119
+ };
120
+
121
+ const onKeyDown = (event: React.KeyboardEvent<HTMLCanvasElement>) => {
122
+ if (!interactive) return;
123
+ event.preventDefault();
124
+ event.stopPropagation();
125
+ channel.sendInput(keyEvent("keyDown", event, event.key === "Enter" ? "\r" : undefined));
126
+ // Printable keys also send the character, as a keyboard would; shortcuts with Ctrl or Meta do not.
127
+ if (event.key.length === 1 && !event.ctrlKey && !event.metaKey) channel.sendInput(keyEvent("char", event, event.key));
128
+ };
129
+
130
+ const onKeyUp = (event: React.KeyboardEvent<HTMLCanvasElement>) => {
131
+ if (!interactive) return;
132
+ event.preventDefault();
133
+ event.stopPropagation();
134
+ channel.sendInput(keyEvent("keyUp", event));
135
+ };
136
+
137
+ const placeholder = !view.hasFrame
138
+ ? view.state === "starting" ? "The browser is starting…" : "Connecting to the live view…"
139
+ : null;
140
+
141
+ return (
142
+ <div className={`${styles.screen} ${interactive ? styles.screenDriving : ""} ${className ?? ""}`}
143
+ style={{ "--browser-aspect": `${width} / ${height}` } as React.CSSProperties}>
144
+ <canvas
145
+ ref={canvasRef}
146
+ className={styles.canvas}
147
+ width={width}
148
+ height={height}
149
+ tabIndex={interactive ? 0 : -1}
150
+ aria-label={interactive ? "Agent browser. You have control: mouse and keyboard go to the page." : "Agent browser live view"}
151
+ role="img"
152
+ onMouseDown={mouseButton("mousePressed")}
153
+ onMouseUp={mouseButton("mouseReleased")}
154
+ onMouseMove={onMouseMove}
155
+ onContextMenu={(event) => { if (interactive) event.preventDefault(); }}
156
+ onKeyDown={onKeyDown}
157
+ onKeyUp={onKeyUp}
158
+ />
159
+ {placeholder && <div className={styles.screenPlaceholder} role="status">{placeholder}</div>}
160
+ </div>
161
+ );
162
+ }
@@ -0,0 +1,9 @@
1
+ import type { SolidAgentBrowserPanelWidgetProps } from "../../../../types/solid-core";
2
+ /**
3
+ * Default browser panel of the AgentHub chat: live view, tabs, and control of the agent's browser.
4
+ * Register another `agentBrowserPanelWidget` (metadata `agentBrowserPanel: true`, optional `agents`)
5
+ * to replace it; the chat keeps the layout (side pane, stacked panel, large view) and passes the
6
+ * ready-wired `screen`.
7
+ */
8
+ export declare const DefaultAgentBrowserPanelWidget: ({ browser, handoff, layout, connected, collapsed, screen, takeControl, giveBack, navigate, navigation, dismissError, onToggleCollapsed, onExpand, onClose, }: SolidAgentBrowserPanelWidgetProps) => import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=DefaultAgentBrowserPanelWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultAgentBrowserPanelWidget.d.ts","sourceRoot":"","sources":["../../../../../src/components/core/solid-agent/browser/DefaultAgentBrowserPanelWidget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AAgBtF;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,iKAGxC,iCAAiC,4CAmInC,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { ArrowLeft, ArrowRight, ChevronDown, ChevronUp, Globe, Hand, Maximize2, PanelRightClose, RotateCw, X } from "lucide-react";
4
+ import { useSecondTicker } from "./useAgentBrowser";
5
+ import styles from "./AgentBrowser.module.css";
6
+ /** How long the "restored your earlier browser session" note and an error stay visible. */
7
+ var RESTORED_NOTICE_MS = 15000;
8
+ var ERROR_NOTICE_MS = 8000;
9
+ function timeLeft(expiresAt, now) {
10
+ if (!expiresAt)
11
+ return null;
12
+ var end = Date.parse(expiresAt);
13
+ if (Number.isNaN(end))
14
+ return null;
15
+ var seconds = Math.max(0, Math.round((end - now) / 1000));
16
+ return "".concat(Math.floor(seconds / 60), ":").concat(String(seconds % 60).padStart(2, "0"), " left");
17
+ }
18
+ /**
19
+ * Default browser panel of the AgentHub chat: live view, tabs, and control of the agent's browser.
20
+ * Register another `agentBrowserPanelWidget` (metadata `agentBrowserPanel: true`, optional `agents`)
21
+ * to replace it; the chat keeps the layout (side pane, stacked panel, large view) and passes the
22
+ * ready-wired `screen`.
23
+ */
24
+ export var DefaultAgentBrowserPanelWidget = function (_a) {
25
+ var _b, _c, _d, _e;
26
+ var browser = _a.browser, handoff = _a.handoff, layout = _a.layout, connected = _a.connected, collapsed = _a.collapsed, screen = _a.screen, takeControl = _a.takeControl, giveBack = _a.giveBack, navigate = _a.navigate, navigation = _a.navigation, dismissError = _a.dismissError, onToggleCollapsed = _a.onToggleCollapsed, onExpand = _a.onExpand, onClose = _a.onClose;
27
+ var human = browser.control.mode === "human";
28
+ var live = browser.state === "live";
29
+ var _f = useState(""), note = _f[0], setNote = _f[1];
30
+ var _g = useState((_b = browser.url) !== null && _b !== void 0 ? _b : ""), address = _g[0], setAddress = _g[1];
31
+ var _h = useState(false), editingAddress = _h[0], setEditingAddress = _h[1];
32
+ var now = useSecondTicker(!!browser.control.expiresAt || !!browser.restoredAt || !!browser.error);
33
+ useEffect(function () {
34
+ var _a;
35
+ if (!editingAddress)
36
+ setAddress((_a = browser.url) !== null && _a !== void 0 ? _a : "");
37
+ }, [browser.url, editingAddress]);
38
+ useEffect(function () {
39
+ if (!human)
40
+ setNote("");
41
+ }, [human]);
42
+ var remaining = human || handoff ? timeLeft(browser.control.expiresAt, now) : null;
43
+ var restored = browser.restoredAt !== null && now - browser.restoredAt < RESTORED_NOTICE_MS;
44
+ var error = browser.error && now - browser.error.at < ERROR_NOTICE_MS ? browser.error : null;
45
+ var reason = (_c = browser.control.reason) !== null && _c !== void 0 ? _c : (handoff && handoff.toolName !== "browser_takeover" ? handoff.question : null);
46
+ var stateLabel = human ? "You have control"
47
+ : browser.control.pending ? "Waiting for the agent"
48
+ : browser.state === "starting" ? "Starting" : live ? "Agent in control" : "Not running";
49
+ var tabs = browser.tabs.length > 1 ? browser.tabs : [];
50
+ return (_jsxs("section", { className: "".concat(styles.panel, " ").concat((_d = styles["panel_".concat(layout)]) !== null && _d !== void 0 ? _d : ""), "aria-label": "Agent browser", children: [_jsxs("header", { className: styles.panelHeader, children: [_jsx(Globe, { size: 14, className: styles.panelIcon, "aria-hidden": "true" }), _jsx("span", { className: "".concat(styles.stateBadge, " ").concat(human ? styles.stateHuman : live ? styles.stateLive : ""), children: stateLabel }), _jsx("span", { className: styles.panelTitle, title: (_e = browser.url) !== null && _e !== void 0 ? _e : undefined, children: browser.title || browser.url || "Agent browser" }), remaining && _jsx("span", { className: styles.timer, title: "Control returns to the agent when this runs out", children: remaining }), onExpand && (_jsx("button", { type: "button", className: styles.iconBtn, title: "Open in a larger view", "aria-label": "Open the browser in a larger view", onClick: onExpand, children: _jsx(Maximize2, { size: 14 }) })), onToggleCollapsed && layout === "stacked" && (_jsx("button", { type: "button", className: styles.iconBtn, title: collapsed ? "Show the browser" : "Collapse the browser", "aria-label": collapsed ? "Show the browser" : "Collapse the browser", "aria-expanded": !collapsed, onClick: onToggleCollapsed, children: collapsed ? _jsx(ChevronDown, { size: 15 }) : _jsx(ChevronUp, { size: 15 }) })), onToggleCollapsed && layout === "side" && (_jsx("button", { type: "button", className: styles.iconBtn, title: "Hide the browser", "aria-label": "Hide the browser", onClick: onToggleCollapsed, children: _jsx(PanelRightClose, { size: 15 }) })), onClose && (_jsx("button", { type: "button", className: styles.iconBtn, title: "Close the larger view", "aria-label": "Close the larger view", onClick: onClose, children: _jsx(X, { size: 15 }) }))] }), !collapsed && (_jsxs(_Fragment, { children: [tabs.length > 0 && (_jsx("ul", { className: styles.tabs, "aria-label": "Browser tabs", children: tabs.map(function (tab) {
51
+ var _a;
52
+ return (_jsx("li", { className: tab.tab === browser.activeTab ? styles.tabActive : styles.tab, title: (_a = tab.url) !== null && _a !== void 0 ? _a : undefined, "aria-current": tab.tab === browser.activeTab ? "page" : undefined, children: tab.title || tab.url || tab.tab }, tab.tab));
53
+ }) })), human && (_jsxs("form", { className: styles.navBar, onSubmit: function (event) { event.preventDefault(); if (navigate(address))
54
+ setEditingAddress(false); }, children: [_jsx("button", { type: "button", className: styles.iconBtn, title: "Back", "aria-label": "Back", onClick: function () { return navigation("back"); }, children: _jsx(ArrowLeft, { size: 14 }) }), _jsx("button", { type: "button", className: styles.iconBtn, title: "Forward", "aria-label": "Forward", onClick: function () { return navigation("forward"); }, children: _jsx(ArrowRight, { size: 14 }) }), _jsx("button", { type: "button", className: styles.iconBtn, title: "Reload", "aria-label": "Reload", onClick: function () { return navigation("refresh"); }, children: _jsx(RotateCw, { size: 13 }) }), _jsx("input", { className: styles.address, value: address, "aria-label": "Address", spellCheck: false, autoComplete: "off", onFocus: function () { return setEditingAddress(true); }, onBlur: function () { return setEditingAddress(false); }, onChange: function (event) { return setAddress(event.target.value); } })] })), restored && _jsx("div", { className: styles.notice, role: "status", children: "The agent reopened your earlier browser session, so sign-ins from last time are still there." }), reason && !human && handoff && _jsxs("div", { className: styles.callout, children: [_jsx("strong", { children: "The agent asks:" }), " ", reason] }), reason && human && browser.control.reason && _jsxs("div", { className: styles.callout, children: [_jsx("strong", { children: "The agent asked:" }), " ", reason] }), screen, error && (_jsxs("div", { className: styles.error, role: "alert", children: [_jsx("span", { children: error.message }), _jsx("button", { type: "button", className: styles.linkBtn, onClick: dismissError, children: "Dismiss" })] })), _jsx("footer", { className: styles.controls, children: human ? (_jsxs(_Fragment, { children: [_jsx("textarea", { className: styles.note, rows: 2, value: note, maxLength: 2000, placeholder: "Tell the agent what you did (optional)", "aria-label": "Note for the agent", onChange: function (event) { return setNote(event.target.value); } }), _jsxs("div", { className: styles.controlRow, children: [_jsx("span", { className: styles.hint, children: "Your mouse and keyboard go to the page." }), _jsx("button", { type: "button", className: "".concat(styles.btn, " ").concat(styles.btnPrimary), disabled: !connected, onClick: function () { if (giveBack(note))
55
+ setNote(""); }, children: "Give back control" })] })] })) : (_jsxs("div", { className: styles.controlRow, children: [_jsx("span", { className: styles.hint, children: !browser.controllable ? "Watching the agent's browser."
56
+ : handoff ? "The agent is waiting for you in the browser." : browser.control.pending
57
+ ? "You get the browser when the agent finishes its current step." : "Watch the agent work, or take over the browser." }), handoff && (_jsx("button", { type: "button", className: styles.btn, disabled: !connected, onClick: function () { return giveBack(); }, children: "Continue without taking control" })), browser.controllable && (_jsxs("button", { type: "button", className: "".concat(styles.btn, " ").concat(handoff ? styles.btnPrimary : ""), disabled: !connected || !live || browser.control.pending, onClick: takeControl, children: [_jsx(Hand, { size: 13, "aria-hidden": "true" }), browser.control.pending ? "Waiting for the agent's step…" : "Take control"] }))] })) })] }))] }));
58
+ };
59
+ //# sourceMappingURL=DefaultAgentBrowserPanelWidget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultAgentBrowserPanelWidget.js","sourceRoot":"","sources":["../../../../../src/components/core/solid-agent/browser/DefaultAgentBrowserPanelWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,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AQ,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,cAAM,OAAA,QAAQ,EAAE,EAAV,CAAU,gDAEnF,CACZ,EACA,OAAO,CAAC,YAAY,IAAI,CACrB,kBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,UAAG,MAAM,CAAC,GAAG,cAAI,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAE,EAChF,QAAQ,EAAE,CAAC,SAAS,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,aAC9E,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,EACpC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,cAAc,IACtE,CACZ,IACC,CACT,GACI,IACV,CACN,IACK,CACb,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { useEffect, useState } from \"react\";\nimport { ArrowLeft, ArrowRight, ChevronDown, ChevronUp, Globe, Hand, Maximize2, PanelRightClose, RotateCw, X } from \"lucide-react\";\nimport type { SolidAgentBrowserPanelWidgetProps } from \"../../../../types/solid-core\";\nimport { useSecondTicker } from \"./useAgentBrowser\";\nimport styles from \"./AgentBrowser.module.css\";\n\n/** How long the \"restored your earlier browser session\" note and an error stay visible. */\nconst RESTORED_NOTICE_MS = 15_000;\nconst ERROR_NOTICE_MS = 8_000;\n\nfunction timeLeft(expiresAt: string | null, now: number): string | null {\n if (!expiresAt) return null;\n const end = Date.parse(expiresAt);\n if (Number.isNaN(end)) return null;\n const seconds = Math.max(0, Math.round((end - now) / 1000));\n return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, \"0\")} left`;\n}\n\n/**\n * Default browser panel of the AgentHub chat: live view, tabs, and control of the agent's browser.\n * Register another `agentBrowserPanelWidget` (metadata `agentBrowserPanel: true`, optional `agents`)\n * to replace it; the chat keeps the layout (side pane, stacked panel, large view) and passes the\n * ready-wired `screen`.\n */\nexport const DefaultAgentBrowserPanelWidget = ({\n browser, handoff, layout, connected, collapsed, screen,\n takeControl, giveBack, navigate, navigation, dismissError, onToggleCollapsed, onExpand, onClose,\n}: SolidAgentBrowserPanelWidgetProps) => {\n const human = browser.control.mode === \"human\";\n const live = browser.state === \"live\";\n const [note, setNote] = useState(\"\");\n const [address, setAddress] = useState(browser.url ?? \"\");\n const [editingAddress, setEditingAddress] = useState(false);\n const now = useSecondTicker(!!browser.control.expiresAt || !!browser.restoredAt || !!browser.error);\n\n useEffect(() => {\n if (!editingAddress) setAddress(browser.url ?? \"\");\n }, [browser.url, editingAddress]);\n useEffect(() => {\n if (!human) setNote(\"\");\n }, [human]);\n\n const remaining = human || handoff ? timeLeft(browser.control.expiresAt, now) : null;\n const restored = browser.restoredAt !== null && now - browser.restoredAt < RESTORED_NOTICE_MS;\n const error = browser.error && now - browser.error.at < ERROR_NOTICE_MS ? browser.error : null;\n const reason = browser.control.reason ?? (handoff && handoff.toolName !== \"browser_takeover\" ? handoff.question : null);\n const stateLabel = human ? \"You have control\"\n : browser.control.pending ? \"Waiting for the agent\"\n : browser.state === \"starting\" ? \"Starting\" : live ? \"Agent in control\" : \"Not running\";\n const tabs = browser.tabs.length > 1 ? browser.tabs : [];\n\n return (\n <section className={`${styles.panel} ${styles[`panel_${layout}`] ?? \"\"}`} aria-label=\"Agent browser\">\n <header className={styles.panelHeader}>\n <Globe size={14} className={styles.panelIcon} aria-hidden=\"true\" />\n <span className={`${styles.stateBadge} ${human ? styles.stateHuman : live ? styles.stateLive : \"\"}`}>{stateLabel}</span>\n <span className={styles.panelTitle} title={browser.url ?? undefined}>{browser.title || browser.url || \"Agent browser\"}</span>\n {remaining && <span className={styles.timer} title=\"Control returns to the agent when this runs out\">{remaining}</span>}\n {onExpand && (\n <button type=\"button\" className={styles.iconBtn} title=\"Open in a larger view\" aria-label=\"Open the browser in a larger view\" onClick={onExpand}>\n <Maximize2 size={14} />\n </button>\n )}\n {onToggleCollapsed && layout === \"stacked\" && (\n <button type=\"button\" className={styles.iconBtn} title={collapsed ? \"Show the browser\" : \"Collapse the browser\"}\n aria-label={collapsed ? \"Show the browser\" : \"Collapse the browser\"} aria-expanded={!collapsed} onClick={onToggleCollapsed}>\n {collapsed ? <ChevronDown size={15} /> : <ChevronUp size={15} />}\n </button>\n )}\n {onToggleCollapsed && layout === \"side\" && (\n <button type=\"button\" className={styles.iconBtn} title=\"Hide the browser\" aria-label=\"Hide the browser\" onClick={onToggleCollapsed}>\n <PanelRightClose size={15} />\n </button>\n )}\n {onClose && (\n <button type=\"button\" className={styles.iconBtn} title=\"Close the larger view\" aria-label=\"Close the larger view\" onClick={onClose}>\n <X size={15} />\n </button>\n )}\n </header>\n\n {!collapsed && (\n <>\n {tabs.length > 0 && (\n <ul className={styles.tabs} aria-label=\"Browser tabs\">\n {tabs.map((tab) => (\n <li key={tab.tab} className={tab.tab === browser.activeTab ? styles.tabActive : styles.tab} title={tab.url ?? undefined}\n aria-current={tab.tab === browser.activeTab ? \"page\" : undefined}>\n {tab.title || tab.url || tab.tab}\n </li>\n ))}\n </ul>\n )}\n\n {human && (\n <form className={styles.navBar} onSubmit={(event) => { event.preventDefault(); if (navigate(address)) setEditingAddress(false); }}>\n <button type=\"button\" className={styles.iconBtn} title=\"Back\" aria-label=\"Back\" onClick={() => navigation(\"back\")}><ArrowLeft size={14} /></button>\n <button type=\"button\" className={styles.iconBtn} title=\"Forward\" aria-label=\"Forward\" onClick={() => navigation(\"forward\")}><ArrowRight size={14} /></button>\n <button type=\"button\" className={styles.iconBtn} title=\"Reload\" aria-label=\"Reload\" onClick={() => navigation(\"refresh\")}><RotateCw size={13} /></button>\n <input className={styles.address} value={address} aria-label=\"Address\" spellCheck={false} autoComplete=\"off\"\n onFocus={() => setEditingAddress(true)} onBlur={() => setEditingAddress(false)}\n onChange={(event) => setAddress(event.target.value)} />\n </form>\n )}\n\n {restored && <div className={styles.notice} role=\"status\">The agent reopened your earlier browser session, so sign-ins from last time are still there.</div>}\n {reason && !human && handoff && <div className={styles.callout}><strong>The agent asks:</strong> {reason}</div>}\n {reason && human && browser.control.reason && <div className={styles.callout}><strong>The agent asked:</strong> {reason}</div>}\n\n {screen}\n\n {error && (\n <div className={styles.error} role=\"alert\">\n <span>{error.message}</span>\n <button type=\"button\" className={styles.linkBtn} onClick={dismissError}>Dismiss</button>\n </div>\n )}\n\n <footer className={styles.controls}>\n {human ? (\n <>\n <textarea className={styles.note} rows={2} value={note} maxLength={2000}\n placeholder=\"Tell the agent what you did (optional)\" aria-label=\"Note for the agent\"\n onChange={(event) => setNote(event.target.value)} />\n <div className={styles.controlRow}>\n <span className={styles.hint}>Your mouse and keyboard go to the page.</span>\n <button type=\"button\" className={`${styles.btn} ${styles.btnPrimary}`} disabled={!connected}\n onClick={() => { if (giveBack(note)) setNote(\"\"); }}>\n Give back control\n </button>\n </div>\n </>\n ) : (\n <div className={styles.controlRow}>\n <span className={styles.hint}>\n {!browser.controllable ? \"Watching the agent's browser.\"\n : handoff ? \"The agent is waiting for you in the browser.\" : browser.control.pending\n ? \"You get the browser when the agent finishes its current step.\" : \"Watch the agent work, or take over the browser.\"}\n </span>\n {handoff && (\n <button type=\"button\" className={styles.btn} disabled={!connected} onClick={() => giveBack()}>\n Continue without taking control\n </button>\n )}\n {browser.controllable && (\n <button type=\"button\" className={`${styles.btn} ${handoff ? styles.btnPrimary : \"\"}`}\n disabled={!connected || !live || browser.control.pending} onClick={takeControl}>\n <Hand size={13} aria-hidden=\"true\" />\n {browser.control.pending ? \"Waiting for the agent's step…\" : \"Take control\"}\n </button>\n )}\n </div>\n )}\n </footer>\n </>\n )}\n </section>\n );\n};\n"]}
@@ -0,0 +1,159 @@
1
+ import { useEffect, useState } from "react";
2
+ import { ArrowLeft, ArrowRight, ChevronDown, ChevronUp, Globe, Hand, Maximize2, PanelRightClose, RotateCw, X } from "lucide-react";
3
+ import type { SolidAgentBrowserPanelWidgetProps } from "../../../../types/solid-core";
4
+ import { useSecondTicker } from "./useAgentBrowser";
5
+ import styles from "./AgentBrowser.module.css";
6
+
7
+ /** How long the "restored your earlier browser session" note and an error stay visible. */
8
+ const RESTORED_NOTICE_MS = 15_000;
9
+ const ERROR_NOTICE_MS = 8_000;
10
+
11
+ function timeLeft(expiresAt: string | null, now: number): string | null {
12
+ if (!expiresAt) return null;
13
+ const end = Date.parse(expiresAt);
14
+ if (Number.isNaN(end)) return null;
15
+ const seconds = Math.max(0, Math.round((end - now) / 1000));
16
+ return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")} left`;
17
+ }
18
+
19
+ /**
20
+ * Default browser panel of the AgentHub chat: live view, tabs, and control of the agent's browser.
21
+ * Register another `agentBrowserPanelWidget` (metadata `agentBrowserPanel: true`, optional `agents`)
22
+ * to replace it; the chat keeps the layout (side pane, stacked panel, large view) and passes the
23
+ * ready-wired `screen`.
24
+ */
25
+ export const DefaultAgentBrowserPanelWidget = ({
26
+ browser, handoff, layout, connected, collapsed, screen,
27
+ takeControl, giveBack, navigate, navigation, dismissError, onToggleCollapsed, onExpand, onClose,
28
+ }: SolidAgentBrowserPanelWidgetProps) => {
29
+ const human = browser.control.mode === "human";
30
+ const live = browser.state === "live";
31
+ const [note, setNote] = useState("");
32
+ const [address, setAddress] = useState(browser.url ?? "");
33
+ const [editingAddress, setEditingAddress] = useState(false);
34
+ const now = useSecondTicker(!!browser.control.expiresAt || !!browser.restoredAt || !!browser.error);
35
+
36
+ useEffect(() => {
37
+ if (!editingAddress) setAddress(browser.url ?? "");
38
+ }, [browser.url, editingAddress]);
39
+ useEffect(() => {
40
+ if (!human) setNote("");
41
+ }, [human]);
42
+
43
+ const remaining = human || handoff ? timeLeft(browser.control.expiresAt, now) : null;
44
+ const restored = browser.restoredAt !== null && now - browser.restoredAt < RESTORED_NOTICE_MS;
45
+ const error = browser.error && now - browser.error.at < ERROR_NOTICE_MS ? browser.error : null;
46
+ const reason = browser.control.reason ?? (handoff && handoff.toolName !== "browser_takeover" ? handoff.question : null);
47
+ const stateLabel = human ? "You have control"
48
+ : browser.control.pending ? "Waiting for the agent"
49
+ : browser.state === "starting" ? "Starting" : live ? "Agent in control" : "Not running";
50
+ const tabs = browser.tabs.length > 1 ? browser.tabs : [];
51
+
52
+ return (
53
+ <section className={`${styles.panel} ${styles[`panel_${layout}`] ?? ""}`} aria-label="Agent browser">
54
+ <header className={styles.panelHeader}>
55
+ <Globe size={14} className={styles.panelIcon} aria-hidden="true" />
56
+ <span className={`${styles.stateBadge} ${human ? styles.stateHuman : live ? styles.stateLive : ""}`}>{stateLabel}</span>
57
+ <span className={styles.panelTitle} title={browser.url ?? undefined}>{browser.title || browser.url || "Agent browser"}</span>
58
+ {remaining && <span className={styles.timer} title="Control returns to the agent when this runs out">{remaining}</span>}
59
+ {onExpand && (
60
+ <button type="button" className={styles.iconBtn} title="Open in a larger view" aria-label="Open the browser in a larger view" onClick={onExpand}>
61
+ <Maximize2 size={14} />
62
+ </button>
63
+ )}
64
+ {onToggleCollapsed && layout === "stacked" && (
65
+ <button type="button" className={styles.iconBtn} title={collapsed ? "Show the browser" : "Collapse the browser"}
66
+ aria-label={collapsed ? "Show the browser" : "Collapse the browser"} aria-expanded={!collapsed} onClick={onToggleCollapsed}>
67
+ {collapsed ? <ChevronDown size={15} /> : <ChevronUp size={15} />}
68
+ </button>
69
+ )}
70
+ {onToggleCollapsed && layout === "side" && (
71
+ <button type="button" className={styles.iconBtn} title="Hide the browser" aria-label="Hide the browser" onClick={onToggleCollapsed}>
72
+ <PanelRightClose size={15} />
73
+ </button>
74
+ )}
75
+ {onClose && (
76
+ <button type="button" className={styles.iconBtn} title="Close the larger view" aria-label="Close the larger view" onClick={onClose}>
77
+ <X size={15} />
78
+ </button>
79
+ )}
80
+ </header>
81
+
82
+ {!collapsed && (
83
+ <>
84
+ {tabs.length > 0 && (
85
+ <ul className={styles.tabs} aria-label="Browser tabs">
86
+ {tabs.map((tab) => (
87
+ <li key={tab.tab} className={tab.tab === browser.activeTab ? styles.tabActive : styles.tab} title={tab.url ?? undefined}
88
+ aria-current={tab.tab === browser.activeTab ? "page" : undefined}>
89
+ {tab.title || tab.url || tab.tab}
90
+ </li>
91
+ ))}
92
+ </ul>
93
+ )}
94
+
95
+ {human && (
96
+ <form className={styles.navBar} onSubmit={(event) => { event.preventDefault(); if (navigate(address)) setEditingAddress(false); }}>
97
+ <button type="button" className={styles.iconBtn} title="Back" aria-label="Back" onClick={() => navigation("back")}><ArrowLeft size={14} /></button>
98
+ <button type="button" className={styles.iconBtn} title="Forward" aria-label="Forward" onClick={() => navigation("forward")}><ArrowRight size={14} /></button>
99
+ <button type="button" className={styles.iconBtn} title="Reload" aria-label="Reload" onClick={() => navigation("refresh")}><RotateCw size={13} /></button>
100
+ <input className={styles.address} value={address} aria-label="Address" spellCheck={false} autoComplete="off"
101
+ onFocus={() => setEditingAddress(true)} onBlur={() => setEditingAddress(false)}
102
+ onChange={(event) => setAddress(event.target.value)} />
103
+ </form>
104
+ )}
105
+
106
+ {restored && <div className={styles.notice} role="status">The agent reopened your earlier browser session, so sign-ins from last time are still there.</div>}
107
+ {reason && !human && handoff && <div className={styles.callout}><strong>The agent asks:</strong> {reason}</div>}
108
+ {reason && human && browser.control.reason && <div className={styles.callout}><strong>The agent asked:</strong> {reason}</div>}
109
+
110
+ {screen}
111
+
112
+ {error && (
113
+ <div className={styles.error} role="alert">
114
+ <span>{error.message}</span>
115
+ <button type="button" className={styles.linkBtn} onClick={dismissError}>Dismiss</button>
116
+ </div>
117
+ )}
118
+
119
+ <footer className={styles.controls}>
120
+ {human ? (
121
+ <>
122
+ <textarea className={styles.note} rows={2} value={note} maxLength={2000}
123
+ placeholder="Tell the agent what you did (optional)" aria-label="Note for the agent"
124
+ onChange={(event) => setNote(event.target.value)} />
125
+ <div className={styles.controlRow}>
126
+ <span className={styles.hint}>Your mouse and keyboard go to the page.</span>
127
+ <button type="button" className={`${styles.btn} ${styles.btnPrimary}`} disabled={!connected}
128
+ onClick={() => { if (giveBack(note)) setNote(""); }}>
129
+ Give back control
130
+ </button>
131
+ </div>
132
+ </>
133
+ ) : (
134
+ <div className={styles.controlRow}>
135
+ <span className={styles.hint}>
136
+ {!browser.controllable ? "Watching the agent's browser."
137
+ : handoff ? "The agent is waiting for you in the browser." : browser.control.pending
138
+ ? "You get the browser when the agent finishes its current step." : "Watch the agent work, or take over the browser."}
139
+ </span>
140
+ {handoff && (
141
+ <button type="button" className={styles.btn} disabled={!connected} onClick={() => giveBack()}>
142
+ Continue without taking control
143
+ </button>
144
+ )}
145
+ {browser.controllable && (
146
+ <button type="button" className={`${styles.btn} ${handoff ? styles.btnPrimary : ""}`}
147
+ disabled={!connected || !live || browser.control.pending} onClick={takeControl}>
148
+ <Hand size={13} aria-hidden="true" />
149
+ {browser.control.pending ? "Waiting for the agent's step…" : "Take control"}
150
+ </button>
151
+ )}
152
+ </div>
153
+ )}
154
+ </footer>
155
+ </>
156
+ )}
157
+ </section>
158
+ );
159
+ };
@@ -0,0 +1,6 @@
1
+ import type { AgentBrowserChannel, AgentBrowserView } from "../client/agentBrowser";
2
+ /** The browser view of a chat's runtime; an empty, unavailable view before the runtime exists. */
3
+ export declare function useAgentBrowser(channel: AgentBrowserChannel | null | undefined): AgentBrowserView;
4
+ /** The current time, refreshed every second while `active` (countdowns and short-lived notices). */
5
+ export declare function useSecondTicker(active: boolean): number;
6
+ //# sourceMappingURL=useAgentBrowser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAgentBrowser.d.ts","sourceRoot":"","sources":["../../../../../src/components/core/solid-agent/browser/useAgentBrowser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAqBpF,kGAAkG;AAClG,wBAAgB,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAAG,gBAAgB,CAEjG;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CASvD"}
@@ -0,0 +1,37 @@
1
+ import { useEffect, useState, useSyncExternalStore } from "react";
2
+ var EMPTY_VIEW = {
3
+ sessionId: null,
4
+ available: false,
5
+ state: "none",
6
+ viewport: { width: 1280, height: 800 },
7
+ url: null,
8
+ title: null,
9
+ tabs: [],
10
+ activeTab: null,
11
+ control: { mode: "agent", pending: false, reason: null, expiresAt: null },
12
+ restoredAt: null,
13
+ watching: false,
14
+ hasFrame: false,
15
+ error: null,
16
+ controllable: true,
17
+ };
18
+ var noSubscription = function () { return function () { }; };
19
+ var emptyView = function () { return EMPTY_VIEW; };
20
+ /** The browser view of a chat's runtime; an empty, unavailable view before the runtime exists. */
21
+ export function useAgentBrowser(channel) {
22
+ var _a, _b, _c;
23
+ return useSyncExternalStore((_a = channel === null || channel === void 0 ? void 0 : channel.subscribe) !== null && _a !== void 0 ? _a : noSubscription, (_b = channel === null || channel === void 0 ? void 0 : channel.getView) !== null && _b !== void 0 ? _b : emptyView, (_c = channel === null || channel === void 0 ? void 0 : channel.getView) !== null && _c !== void 0 ? _c : emptyView);
24
+ }
25
+ /** The current time, refreshed every second while `active` (countdowns and short-lived notices). */
26
+ export function useSecondTicker(active) {
27
+ var _a = useState(function () { return Date.now(); }), now = _a[0], setNow = _a[1];
28
+ useEffect(function () {
29
+ if (!active)
30
+ return;
31
+ setNow(Date.now());
32
+ var timer = window.setInterval(function () { return setNow(Date.now()); }, 1000);
33
+ return function () { return window.clearInterval(timer); };
34
+ }, [active]);
35
+ return now;
36
+ }
37
+ //# sourceMappingURL=useAgentBrowser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAgentBrowser.js","sourceRoot":"","sources":["../../../../../src/components/core/solid-agent/browser/useAgentBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAGlE,IAAM,UAAU,GA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G,MAAM,CAAC,WAAW,CAAC,cAAM,OAAA,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAlB,CAAkB,EAAE,IAAI,CAAC,CAAC;QACjE,OAAO,cAAM,OAAA,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAA3B,CAA2B,CAAC;IAC7C,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACb,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import { useEffect, useState, useSyncExternalStore } from \"react\";\nimport type { AgentBrowserChannel, AgentBrowserView } from \"../client/agentBrowser\";\n\nconst EMPTY_VIEW: AgentBrowserView = {\n sessionId: null,\n available: false,\n state: \"none\",\n viewport: { width: 1280, height: 800 },\n url: null,\n title: null,\n tabs: [],\n activeTab: null,\n control: { mode: \"agent\", pending: false, reason: null, expiresAt: null },\n restoredAt: null,\n watching: false,\n hasFrame: false,\n error: null,\n controllable: true,\n};\nconst noSubscription = () => () => {};\nconst emptyView = () => EMPTY_VIEW;\n\n/** The browser view of a chat's runtime; an empty, unavailable view before the runtime exists. */\nexport function useAgentBrowser(channel: AgentBrowserChannel | null | undefined): AgentBrowserView {\n return useSyncExternalStore(channel?.subscribe ?? noSubscription, channel?.getView ?? emptyView, channel?.getView ?? emptyView);\n}\n\n/** The current time, refreshed every second while `active` (countdowns and short-lived notices). */\nexport function useSecondTicker(active: boolean): number {\n const [now, setNow] = useState(() => Date.now());\n useEffect(() => {\n if (!active) return;\n setNow(Date.now());\n const timer = window.setInterval(() => setNow(Date.now()), 1000);\n return () => window.clearInterval(timer);\n }, [active]);\n return now;\n}\n"]}
@@ -0,0 +1,38 @@
1
+ import { useEffect, useState, useSyncExternalStore } from "react";
2
+ import type { AgentBrowserChannel, AgentBrowserView } from "../client/agentBrowser";
3
+
4
+ const EMPTY_VIEW: AgentBrowserView = {
5
+ sessionId: null,
6
+ available: false,
7
+ state: "none",
8
+ viewport: { width: 1280, height: 800 },
9
+ url: null,
10
+ title: null,
11
+ tabs: [],
12
+ activeTab: null,
13
+ control: { mode: "agent", pending: false, reason: null, expiresAt: null },
14
+ restoredAt: null,
15
+ watching: false,
16
+ hasFrame: false,
17
+ error: null,
18
+ controllable: true,
19
+ };
20
+ const noSubscription = () => () => {};
21
+ const emptyView = () => EMPTY_VIEW;
22
+
23
+ /** The browser view of a chat's runtime; an empty, unavailable view before the runtime exists. */
24
+ export function useAgentBrowser(channel: AgentBrowserChannel | null | undefined): AgentBrowserView {
25
+ return useSyncExternalStore(channel?.subscribe ?? noSubscription, channel?.getView ?? emptyView, channel?.getView ?? emptyView);
26
+ }
27
+
28
+ /** The current time, refreshed every second while `active` (countdowns and short-lived notices). */
29
+ export function useSecondTicker(active: boolean): number {
30
+ const [now, setNow] = useState(() => Date.now());
31
+ useEffect(() => {
32
+ if (!active) return;
33
+ setNow(Date.now());
34
+ const timer = window.setInterval(() => setNow(Date.now()), 1000);
35
+ return () => window.clearInterval(timer);
36
+ }, [active]);
37
+ return now;
38
+ }