@particle-academy/agent-integrations 0.15.0 → 0.16.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.cjs +61 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +62 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4,6 +4,7 @@ var fancyAutoCommon = require('@particle-academy/fancy-auto-common');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var fancySlides = require('@particle-academy/fancy-slides');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var reactDom = require('react-dom');
|
|
7
8
|
|
|
8
9
|
var __defProp = Object.defineProperty;
|
|
9
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -2342,12 +2343,13 @@ function registerNavigationBridge(host, options) {
|
|
|
2342
2343
|
},
|
|
2343
2344
|
[],
|
|
2344
2345
|
(args) => {
|
|
2346
|
+
const handle = typeof args.handle === "string" ? args.handle : void 0;
|
|
2345
2347
|
adapter.scrollTo({
|
|
2346
|
-
handle
|
|
2348
|
+
handle,
|
|
2347
2349
|
x: typeof args.x === "number" ? args.x : void 0,
|
|
2348
2350
|
y: typeof args.y === "number" ? args.y : void 0
|
|
2349
2351
|
});
|
|
2350
|
-
return textResult("Scrolled");
|
|
2352
|
+
return textResult("Scrolled", handle ? { handle, rect: adapter.rectFor?.(handle) ?? void 0 } : void 0);
|
|
2351
2353
|
},
|
|
2352
2354
|
() => target("Scroll")
|
|
2353
2355
|
);
|
|
@@ -2374,7 +2376,7 @@ function registerNavigationBridge(host, options) {
|
|
|
2374
2376
|
const handle = String(args.handle ?? "");
|
|
2375
2377
|
const res = adapter.setField(handle, args.value);
|
|
2376
2378
|
if (!res.ok) return errorResult(res.error ?? `Could not set ${handle}`);
|
|
2377
|
-
return textResult(`${handle} \u2190 ${JSON.stringify(args.value)}`, { handle, value: args.value });
|
|
2379
|
+
return textResult(`${handle} \u2190 ${JSON.stringify(args.value)}`, { handle, value: args.value, rect: adapter.rectFor?.(handle) ?? void 0 });
|
|
2378
2380
|
},
|
|
2379
2381
|
(args) => target(`Set ${String(args.handle ?? "")}`, String(args.handle ?? ""))
|
|
2380
2382
|
);
|
|
@@ -2386,13 +2388,14 @@ function registerNavigationBridge(host, options) {
|
|
|
2386
2388
|
async (args) => {
|
|
2387
2389
|
const handle = String(args.handle ?? "");
|
|
2388
2390
|
const action = adapter.describe().actions.find((a) => a.handle === handle);
|
|
2391
|
+
const rect = adapter.rectFor?.(handle) ?? void 0;
|
|
2389
2392
|
if (pendingMode && action?.destructive && adapter.confirm) {
|
|
2390
2393
|
const ok = await adapter.confirm({ action: "click", handle, label: action.label });
|
|
2391
2394
|
if (!ok) return errorResult("Declined by user");
|
|
2392
2395
|
}
|
|
2393
2396
|
const res = adapter.click(handle);
|
|
2394
2397
|
if (!res.ok) return errorResult(res.error ?? `Could not click ${handle}`);
|
|
2395
|
-
return textResult(`Clicked ${handle}`, { handle });
|
|
2398
|
+
return textResult(`Clicked ${handle}`, { handle, rect });
|
|
2396
2399
|
},
|
|
2397
2400
|
(args) => target(`Click ${String(args.handle ?? "")}`, String(args.handle ?? ""))
|
|
2398
2401
|
);
|
|
@@ -2403,13 +2406,14 @@ function registerNavigationBridge(host, options) {
|
|
|
2403
2406
|
["handle"],
|
|
2404
2407
|
async (args) => {
|
|
2405
2408
|
const handle = String(args.handle ?? "");
|
|
2409
|
+
const rect = adapter.rectFor?.(handle) ?? void 0;
|
|
2406
2410
|
if (pendingMode && adapter.confirm) {
|
|
2407
2411
|
const ok = await adapter.confirm({ action: "submit", handle, label: handle });
|
|
2408
2412
|
if (!ok) return errorResult("Declined by user");
|
|
2409
2413
|
}
|
|
2410
2414
|
const res = await adapter.submit(handle);
|
|
2411
2415
|
if (!res.ok) return errorResult(res.error ?? "Submit failed");
|
|
2412
|
-
return textResult(`Submitted ${handle}`, { handle });
|
|
2416
|
+
return textResult(`Submitted ${handle}`, { handle, rect });
|
|
2413
2417
|
},
|
|
2414
2418
|
(args) => target(`Submit ${String(args.handle ?? "")}`, String(args.handle ?? ""))
|
|
2415
2419
|
);
|
|
@@ -3383,6 +3387,57 @@ function CoBrowsePresence({ session, connectUrl, shareBaseUrl, className }) {
|
|
|
3383
3387
|
] });
|
|
3384
3388
|
}
|
|
3385
3389
|
CoBrowsePresence.displayName = "CoBrowsePresence";
|
|
3390
|
+
function CoBrowseCursorLayer({ active = true, zIndex = 2147483e3 }) {
|
|
3391
|
+
const { latest } = useAgentActivity(void 0, { capacity: 12 });
|
|
3392
|
+
const [cursor, setCursor] = react.useState(
|
|
3393
|
+
null
|
|
3394
|
+
);
|
|
3395
|
+
const [pulse, setPulse] = react.useState(null);
|
|
3396
|
+
react.useEffect(() => {
|
|
3397
|
+
if (!latest || (latest.source ?? "agent") === "user") return;
|
|
3398
|
+
const color = latest.agentColor ?? "#a855f7";
|
|
3399
|
+
const name = latest.agentName ?? "Agent";
|
|
3400
|
+
const status = latest.target?.label ?? latest.action;
|
|
3401
|
+
const rect = latest.meta?.rect;
|
|
3402
|
+
if (rect) {
|
|
3403
|
+
setCursor({ x: rect.x + rect.width / 2, y: rect.y + rect.height / 2, name, color, status });
|
|
3404
|
+
setPulse({ rect, color, key: latest.timestamp });
|
|
3405
|
+
} else {
|
|
3406
|
+
setCursor(
|
|
3407
|
+
(prev) => prev ? { ...prev, status, name, color } : { x: window.innerWidth / 2, y: window.innerHeight / 2, name, color, status }
|
|
3408
|
+
);
|
|
3409
|
+
}
|
|
3410
|
+
}, [latest?.timestamp]);
|
|
3411
|
+
if (!active || !cursor || typeof document === "undefined") return null;
|
|
3412
|
+
return reactDom.createPortal(
|
|
3413
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-co-browse-cursor-layer": "", style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex }, children: [
|
|
3414
|
+
pulse && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3415
|
+
AgentActivityHighlight,
|
|
3416
|
+
{
|
|
3417
|
+
x: pulse.rect.x,
|
|
3418
|
+
y: pulse.rect.y,
|
|
3419
|
+
width: pulse.rect.width,
|
|
3420
|
+
height: pulse.rect.height,
|
|
3421
|
+
color: pulse.color,
|
|
3422
|
+
pulseKey: pulse.key
|
|
3423
|
+
}
|
|
3424
|
+
),
|
|
3425
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3426
|
+
AgentCursor,
|
|
3427
|
+
{
|
|
3428
|
+
x: cursor.x,
|
|
3429
|
+
y: cursor.y,
|
|
3430
|
+
name: cursor.name,
|
|
3431
|
+
color: cursor.color,
|
|
3432
|
+
status: cursor.status,
|
|
3433
|
+
style: { transition: "left .35s cubic-bezier(.22,.61,.36,1), top .35s cubic-bezier(.22,.61,.36,1)" }
|
|
3434
|
+
}
|
|
3435
|
+
)
|
|
3436
|
+
] }),
|
|
3437
|
+
document.body
|
|
3438
|
+
);
|
|
3439
|
+
}
|
|
3440
|
+
CoBrowseCursorLayer.displayName = "CoBrowseCursorLayer";
|
|
3386
3441
|
|
|
3387
3442
|
// src/presence/index.ts
|
|
3388
3443
|
init_registry();
|
|
@@ -3512,6 +3567,7 @@ exports.CLAUDE_CONNECTORS_URL = CLAUDE_CONNECTORS_URL;
|
|
|
3512
3567
|
exports.CONNECTOR_GLYPHS = CONNECTOR_GLYPHS;
|
|
3513
3568
|
exports.CONNECTOR_TARGETS = CONNECTOR_TARGETS;
|
|
3514
3569
|
exports.ClaudeMark = ClaudeMark;
|
|
3570
|
+
exports.CoBrowseCursorLayer = CoBrowseCursorLayer;
|
|
3515
3571
|
exports.CoBrowsePresence = CoBrowsePresence;
|
|
3516
3572
|
exports.ConnectorButtons = ConnectorButtons;
|
|
3517
3573
|
exports.CursorMark = CursorMark;
|