@particle-academy/agent-integrations 0.37.0 → 0.39.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/bridges/grid.d.cts +87 -0
- package/dist/bridges/grid.d.ts +87 -0
- package/dist/bridges-grid.cjs +329 -0
- package/dist/bridges-grid.cjs.map +1 -0
- package/dist/bridges-grid.js +7 -0
- package/dist/bridges-grid.js.map +1 -0
- package/dist/chunk-MJ2S25ON.js +209 -0
- package/dist/chunk-MJ2S25ON.js.map +1 -0
- package/dist/{chunk-ABP2THQV.js → chunk-QYWPCRT2.js} +43 -13
- package/dist/chunk-QYWPCRT2.js.map +1 -0
- package/dist/components-shared-whiteboard.cjs +41 -11
- package/dist/components-shared-whiteboard.cjs.map +1 -1
- package/dist/components-shared-whiteboard.js +1 -1
- package/dist/index.cjs +268 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/styles.css +35 -1
- package/dist/styles.css.map +1 -1
- package/package.json +17 -5
- package/dist/chunk-ABP2THQV.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShareControls, AgentCursor, AgentActivityHighlight, AgentPanel } from './chunk-
|
|
1
|
+
import { ShareControls, AgentCursor, AgentActivityHighlight, AgentPanel } from './chunk-QYWPCRT2.js';
|
|
2
2
|
import { createSessionDescriptor, attachSseRelay } from './chunk-JDCB2NMM.js';
|
|
3
3
|
import { attachInProcess } from './chunk-AFUULW5E.js';
|
|
4
4
|
import { registerWhiteboardBridge } from './chunk-2U5JB6ZA.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1365,13 +1365,215 @@ function registerChartsBridge(host, options) {
|
|
|
1365
1365
|
};
|
|
1366
1366
|
}
|
|
1367
1367
|
|
|
1368
|
-
// src/bridges/
|
|
1368
|
+
// src/bridges/grid.ts
|
|
1369
1369
|
var DEFAULT_AGENT5 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
1370
|
-
function
|
|
1370
|
+
function registerGridBridge(host, options) {
|
|
1371
1371
|
const { adapter } = options;
|
|
1372
1372
|
const agent = { ...DEFAULT_AGENT5, ...options.agent ?? {} };
|
|
1373
1373
|
const disposers = [];
|
|
1374
1374
|
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
1375
|
+
const target = (part) => ({
|
|
1376
|
+
kind: "grid",
|
|
1377
|
+
screenId: adapter.screenId,
|
|
1378
|
+
elementId: part ? `${adapter.id}:${part}` : adapter.id,
|
|
1379
|
+
label: part ? `${adapter.title ?? adapter.id} \u2192 ${part}` : adapter.title ?? adapter.id
|
|
1380
|
+
});
|
|
1381
|
+
const reg = (name, description, properties, required, handler, isMutation, partFromArgs) => {
|
|
1382
|
+
const wrapped = async (args) => {
|
|
1383
|
+
try {
|
|
1384
|
+
return await handler(args);
|
|
1385
|
+
} catch (e) {
|
|
1386
|
+
return errorResult(e instanceof Error ? e.message : String(e));
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
const final = isMutation ? wrapToolWithActivity(wrapped, {
|
|
1390
|
+
toolName: name,
|
|
1391
|
+
agent,
|
|
1392
|
+
kind: "grid",
|
|
1393
|
+
screenId: adapter.screenId,
|
|
1394
|
+
resolveTarget: ({ args }) => target(partFromArgs?.(args))
|
|
1395
|
+
}) : wrapped;
|
|
1396
|
+
disposers.push(
|
|
1397
|
+
host.registerTool(
|
|
1398
|
+
{
|
|
1399
|
+
name,
|
|
1400
|
+
description,
|
|
1401
|
+
inputSchema: { type: "object", properties, required, additionalProperties: false }
|
|
1402
|
+
},
|
|
1403
|
+
final
|
|
1404
|
+
)
|
|
1405
|
+
);
|
|
1406
|
+
};
|
|
1407
|
+
const assertColumn = (id) => {
|
|
1408
|
+
const known = adapter.getColumnIds?.();
|
|
1409
|
+
if (known && !known.includes(id)) {
|
|
1410
|
+
throw new Error(`Unknown column "${id}". Available: ${known.join(", ")}`);
|
|
1411
|
+
}
|
|
1412
|
+
};
|
|
1413
|
+
const commit = (next, action, label, previous) => {
|
|
1414
|
+
adapter.setState(next);
|
|
1415
|
+
fancyAutoCommon.pushUndoEntry(agent.id, {
|
|
1416
|
+
timestamp: Date.now(),
|
|
1417
|
+
bridgeId: `grid:${adapter.id}`,
|
|
1418
|
+
action,
|
|
1419
|
+
label,
|
|
1420
|
+
undo: () => adapter.setState(previous),
|
|
1421
|
+
redo: () => adapter.setState(next)
|
|
1422
|
+
});
|
|
1423
|
+
};
|
|
1424
|
+
reg(
|
|
1425
|
+
"grid_get",
|
|
1426
|
+
"Read the grid's view state \u2014 sorting, filters, selected row ids, pagination \u2014 plus the addressable column and row ids.",
|
|
1427
|
+
{},
|
|
1428
|
+
[],
|
|
1429
|
+
() => {
|
|
1430
|
+
const state = adapter.getState();
|
|
1431
|
+
return textResult(
|
|
1432
|
+
JSON.stringify(
|
|
1433
|
+
{
|
|
1434
|
+
id: adapter.id,
|
|
1435
|
+
title: adapter.title,
|
|
1436
|
+
sorting: state.sorting ?? [],
|
|
1437
|
+
filters: state.filters ?? [],
|
|
1438
|
+
selectedRowIds: Object.entries(state.rowSelection ?? {}).filter(([, on]) => on).map(([id]) => id),
|
|
1439
|
+
pagination: state.pagination,
|
|
1440
|
+
columnIds: adapter.getColumnIds?.() ?? null,
|
|
1441
|
+
rowIds: adapter.getRowIds?.() ?? null,
|
|
1442
|
+
editable: Boolean(adapter.editCell)
|
|
1443
|
+
},
|
|
1444
|
+
null,
|
|
1445
|
+
2
|
|
1446
|
+
)
|
|
1447
|
+
);
|
|
1448
|
+
},
|
|
1449
|
+
false
|
|
1450
|
+
);
|
|
1451
|
+
reg(
|
|
1452
|
+
"grid_sort",
|
|
1453
|
+
"Sort the grid. Pass an empty array to clear sorting. Multiple entries sort by each in order.",
|
|
1454
|
+
{
|
|
1455
|
+
sorting: {
|
|
1456
|
+
type: "array",
|
|
1457
|
+
description: 'e.g. [{ "id": "createdAt", "desc": true }]',
|
|
1458
|
+
items: {
|
|
1459
|
+
type: "object",
|
|
1460
|
+
properties: { id: { type: "string" }, desc: { type: "boolean" } },
|
|
1461
|
+
required: ["id"],
|
|
1462
|
+
additionalProperties: false
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
},
|
|
1466
|
+
["sorting"],
|
|
1467
|
+
(args) => {
|
|
1468
|
+
const raw = Array.isArray(args.sorting) ? args.sorting : [];
|
|
1469
|
+
const sorting = raw.map((s) => {
|
|
1470
|
+
assertColumn(String(s.id));
|
|
1471
|
+
return { id: String(s.id), desc: Boolean(s.desc) };
|
|
1472
|
+
});
|
|
1473
|
+
const previous = adapter.getState();
|
|
1474
|
+
commit({ ...previous, sorting }, "grid_sort", `Sorted by ${sorting.map((s) => s.id).join(", ") || "nothing"}`, previous);
|
|
1475
|
+
return textResult(`Sorted by ${sorting.map((s) => `${s.id}${s.desc ? " desc" : ""}`).join(", ") || "nothing"}.`);
|
|
1476
|
+
},
|
|
1477
|
+
true,
|
|
1478
|
+
(args) => Array.isArray(args.sorting) && args.sorting[0] ? String(args.sorting[0].id) : void 0
|
|
1479
|
+
);
|
|
1480
|
+
reg(
|
|
1481
|
+
"grid_filter",
|
|
1482
|
+
"Filter the grid. Pass an empty array to clear all filters.",
|
|
1483
|
+
{
|
|
1484
|
+
filters: {
|
|
1485
|
+
type: "array",
|
|
1486
|
+
description: 'e.g. [{ "id": "status", "value": "open" }]',
|
|
1487
|
+
items: {
|
|
1488
|
+
type: "object",
|
|
1489
|
+
properties: { id: { type: "string" }, value: { type: "string" } },
|
|
1490
|
+
required: ["id", "value"],
|
|
1491
|
+
additionalProperties: false
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
},
|
|
1495
|
+
["filters"],
|
|
1496
|
+
(args) => {
|
|
1497
|
+
const raw = Array.isArray(args.filters) ? args.filters : [];
|
|
1498
|
+
const filters = raw.map((f) => {
|
|
1499
|
+
assertColumn(String(f.id));
|
|
1500
|
+
return { id: String(f.id), value: String(f.value) };
|
|
1501
|
+
});
|
|
1502
|
+
const previous = adapter.getState();
|
|
1503
|
+
commit({ ...previous, filters }, "grid_filter", `Filtered ${filters.map((f) => f.id).join(", ") || "cleared"}`, previous);
|
|
1504
|
+
return textResult(`Filtering on ${filters.map((f) => `${f.id}=${f.value}`).join(", ") || "nothing"}.`);
|
|
1505
|
+
},
|
|
1506
|
+
true,
|
|
1507
|
+
(args) => Array.isArray(args.filters) && args.filters[0] ? String(args.filters[0].id) : void 0
|
|
1508
|
+
);
|
|
1509
|
+
reg(
|
|
1510
|
+
"grid_select_rows",
|
|
1511
|
+
"Replace the grid's row selection with the given row ids. Pass an empty array to clear.",
|
|
1512
|
+
{ rowIds: { type: "array", items: { type: "string" }, description: "Row ids, per the grid's getRowId." } },
|
|
1513
|
+
["rowIds"],
|
|
1514
|
+
(args) => {
|
|
1515
|
+
const ids = Array.isArray(args.rowIds) ? args.rowIds.map(String) : [];
|
|
1516
|
+
const known = adapter.getRowIds?.();
|
|
1517
|
+
if (known) {
|
|
1518
|
+
const missing = ids.filter((id) => !known.includes(id));
|
|
1519
|
+
if (missing.length) {
|
|
1520
|
+
throw new Error(`Row id(s) not on this page: ${missing.join(", ")}`);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
const previous = adapter.getState();
|
|
1524
|
+
const rowSelection = {};
|
|
1525
|
+
for (const id of ids) rowSelection[id] = true;
|
|
1526
|
+
commit({ ...previous, rowSelection }, "grid_select_rows", `Selected ${ids.length} row${ids.length === 1 ? "" : "s"}`, previous);
|
|
1527
|
+
return textResult(`Selected ${ids.length} row${ids.length === 1 ? "" : "s"}.`);
|
|
1528
|
+
},
|
|
1529
|
+
true
|
|
1530
|
+
);
|
|
1531
|
+
if (adapter.editCell) {
|
|
1532
|
+
reg(
|
|
1533
|
+
"grid_edit_cell",
|
|
1534
|
+
"Write one cell. This changes DATA, not just the view.",
|
|
1535
|
+
{
|
|
1536
|
+
rowId: { type: "string" },
|
|
1537
|
+
columnId: { type: "string" },
|
|
1538
|
+
value: { description: "New value. Any JSON scalar or object the column accepts." }
|
|
1539
|
+
},
|
|
1540
|
+
["rowId", "columnId"],
|
|
1541
|
+
async (args) => {
|
|
1542
|
+
const rowId = String(args.rowId);
|
|
1543
|
+
const columnId = String(args.columnId);
|
|
1544
|
+
assertColumn(columnId);
|
|
1545
|
+
const apply = async () => {
|
|
1546
|
+
await adapter.editCell?.(rowId, columnId, args.value);
|
|
1547
|
+
};
|
|
1548
|
+
if (options.pendingMode) {
|
|
1549
|
+
const id = `grid-edit-${Date.now().toString(36)}`;
|
|
1550
|
+
options.onPending?.({ id, label: `set ${columnId} on row ${rowId}`, apply });
|
|
1551
|
+
return textResult(`Staged: set ${columnId} on row ${rowId}. Awaiting confirmation.`);
|
|
1552
|
+
}
|
|
1553
|
+
await apply();
|
|
1554
|
+
return textResult(`Set ${columnId} on row ${rowId}.`);
|
|
1555
|
+
},
|
|
1556
|
+
true,
|
|
1557
|
+
(args) => `${String(args.rowId)}:${String(args.columnId)}`
|
|
1558
|
+
);
|
|
1559
|
+
}
|
|
1560
|
+
return {
|
|
1561
|
+
id: `grid:${adapter.id}`,
|
|
1562
|
+
title: adapter.title ?? adapter.id,
|
|
1563
|
+
dispose: () => {
|
|
1564
|
+
for (const d of disposers) d();
|
|
1565
|
+
disposers.length = 0;
|
|
1566
|
+
}
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
// src/bridges/scene.ts
|
|
1571
|
+
var DEFAULT_AGENT6 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
1572
|
+
function registerSceneBridge(host, options) {
|
|
1573
|
+
const { adapter } = options;
|
|
1574
|
+
const agent = { ...DEFAULT_AGENT6, ...options.agent ?? {} };
|
|
1575
|
+
const disposers = [];
|
|
1576
|
+
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
1375
1577
|
const target = (objectId) => ({
|
|
1376
1578
|
kind: "scene",
|
|
1377
1579
|
screenId: adapter.screenId,
|
|
@@ -1564,10 +1766,10 @@ function parseTriple(v) {
|
|
|
1564
1766
|
}
|
|
1565
1767
|
|
|
1566
1768
|
// src/bridges/screens.ts
|
|
1567
|
-
var
|
|
1769
|
+
var DEFAULT_AGENT7 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
1568
1770
|
function registerScreensBridge(host, options) {
|
|
1569
1771
|
const { adapter } = options;
|
|
1570
|
-
const agent = { ...
|
|
1772
|
+
const agent = { ...DEFAULT_AGENT7, ...options.agent ?? {} };
|
|
1571
1773
|
const disposers = [];
|
|
1572
1774
|
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
1573
1775
|
const target = (screenId) => ({
|
|
@@ -1739,10 +1941,10 @@ function registerScreensBridge(host, options) {
|
|
|
1739
1941
|
}
|
|
1740
1942
|
|
|
1741
1943
|
// src/bridges/slides.ts
|
|
1742
|
-
var
|
|
1944
|
+
var DEFAULT_AGENT8 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
1743
1945
|
function registerSlidesBridge(host, options) {
|
|
1744
1946
|
const { adapter } = options;
|
|
1745
|
-
const agent = { ...
|
|
1947
|
+
const agent = { ...DEFAULT_AGENT8, ...options.agent ?? {} };
|
|
1746
1948
|
const disposers = [];
|
|
1747
1949
|
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
1748
1950
|
const deckTarget = () => ({
|
|
@@ -2182,13 +2384,13 @@ function firstTextContent(slide) {
|
|
|
2182
2384
|
}
|
|
2183
2385
|
|
|
2184
2386
|
// src/bridges/map.ts
|
|
2185
|
-
var
|
|
2387
|
+
var DEFAULT_AGENT9 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
2186
2388
|
var num2 = (v, fallback) => typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
2187
2389
|
var str2 = (v, fallback = "") => typeof v === "string" ? v : fallback;
|
|
2188
2390
|
var newId = (prefix) => `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`;
|
|
2189
2391
|
function registerMapBridge(host, options) {
|
|
2190
2392
|
const { adapter } = options;
|
|
2191
|
-
const agent = { ...
|
|
2393
|
+
const agent = { ...DEFAULT_AGENT9, ...options.agent ?? {} };
|
|
2192
2394
|
const disposers = [];
|
|
2193
2395
|
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
2194
2396
|
const mTarget = (args, result) => ({
|
|
@@ -2596,7 +2798,7 @@ function registerGitBridge(host, options) {
|
|
|
2596
2798
|
}
|
|
2597
2799
|
|
|
2598
2800
|
// src/bridges/files.ts
|
|
2599
|
-
var
|
|
2801
|
+
var DEFAULT_AGENT10 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
2600
2802
|
var MAX_SNAPSHOT_DEPTH = 8;
|
|
2601
2803
|
function assertPathWithinRoot(root, path) {
|
|
2602
2804
|
const segments = path.replace(/[\\/]+/g, "/").split("/");
|
|
@@ -2626,7 +2828,7 @@ var asPaths = (v) => {
|
|
|
2626
2828
|
};
|
|
2627
2829
|
function registerFilesBridge(host, options) {
|
|
2628
2830
|
const { adapter } = options;
|
|
2629
|
-
const agent = { ...
|
|
2831
|
+
const agent = { ...DEFAULT_AGENT10, ...options.agent ?? {} };
|
|
2630
2832
|
const disposers = [];
|
|
2631
2833
|
const guard = (path) => {
|
|
2632
2834
|
if (options.root !== void 0) assertPathWithinRoot(options.root, path);
|
|
@@ -2826,10 +3028,10 @@ function registerFilesBridge(host, options) {
|
|
|
2826
3028
|
}
|
|
2827
3029
|
|
|
2828
3030
|
// src/bridges/terminal.ts
|
|
2829
|
-
var
|
|
3031
|
+
var DEFAULT_AGENT11 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
2830
3032
|
var truncate = (s, n = 60) => s.length > n ? s.slice(0, n) + "\u2026" : s;
|
|
2831
3033
|
function registerTerminalBridge(host, options) {
|
|
2832
|
-
const agent = { ...
|
|
3034
|
+
const agent = { ...DEFAULT_AGENT11, ...options.agent ?? {} };
|
|
2833
3035
|
const pendingMode = options.pendingMode ?? true;
|
|
2834
3036
|
const screenId = options.screenId ?? options.adapter?.screenId;
|
|
2835
3037
|
const disposers = [];
|
|
@@ -3119,10 +3321,10 @@ function registerTerminalBridge(host, options) {
|
|
|
3119
3321
|
}
|
|
3120
3322
|
|
|
3121
3323
|
// src/bridges/navigation.ts
|
|
3122
|
-
var
|
|
3324
|
+
var DEFAULT_AGENT12 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
3123
3325
|
function registerNavigationBridge(host, options) {
|
|
3124
3326
|
const { adapter } = options;
|
|
3125
|
-
const agent = { ...
|
|
3327
|
+
const agent = { ...DEFAULT_AGENT12, ...options.agent ?? {} };
|
|
3126
3328
|
const pendingMode = options.pendingMode ?? true;
|
|
3127
3329
|
const disposers = [];
|
|
3128
3330
|
let groundedRevision = null;
|
|
@@ -3383,12 +3585,12 @@ function registerNavigationBridge(host, options) {
|
|
|
3383
3585
|
}
|
|
3384
3586
|
|
|
3385
3587
|
// src/bridges/catalog.ts
|
|
3386
|
-
var
|
|
3588
|
+
var DEFAULT_AGENT13 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
3387
3589
|
var str4 = (v, fallback = "") => typeof v === "string" ? v : fallback;
|
|
3388
3590
|
var num4 = (v, fallback = 0) => typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
3389
3591
|
function registerCatalogBridge(host, options) {
|
|
3390
3592
|
const { adapter } = options;
|
|
3391
|
-
const agent = { ...
|
|
3593
|
+
const agent = { ...DEFAULT_AGENT13, ...options.agent ?? {} };
|
|
3392
3594
|
const pendingMode = options.pendingMode ?? true;
|
|
3393
3595
|
const catalogId = adapter.id ?? "catalog";
|
|
3394
3596
|
const disposers = [];
|
|
@@ -3684,12 +3886,12 @@ function registerCatalogBridge(host, options) {
|
|
|
3684
3886
|
}
|
|
3685
3887
|
|
|
3686
3888
|
// src/bridges/features.ts
|
|
3687
|
-
var
|
|
3889
|
+
var DEFAULT_AGENT14 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
3688
3890
|
var str5 = (v, fallback = "") => typeof v === "string" ? v : fallback;
|
|
3689
3891
|
var num5 = (v, fallback = 0) => typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
3690
3892
|
function registerFeaturesBridge(host, options) {
|
|
3691
3893
|
const { adapter } = options;
|
|
3692
|
-
const agent = { ...
|
|
3894
|
+
const agent = { ...DEFAULT_AGENT14, ...options.agent ?? {} };
|
|
3693
3895
|
const pendingMode = options.pendingMode ?? true;
|
|
3694
3896
|
const featuresId = adapter.id ?? "features";
|
|
3695
3897
|
const disposers = [];
|
|
@@ -3898,7 +4100,7 @@ function registerFeaturesBridge(host, options) {
|
|
|
3898
4100
|
}
|
|
3899
4101
|
|
|
3900
4102
|
// src/bridges/passkeys.ts
|
|
3901
|
-
var
|
|
4103
|
+
var DEFAULT_AGENT15 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
3902
4104
|
var str6 = (v, fallback = "") => typeof v === "string" ? v : fallback;
|
|
3903
4105
|
function toSummary(record) {
|
|
3904
4106
|
return {
|
|
@@ -3921,7 +4123,7 @@ var PASSKEY_BRIDGE_TOOLS = [
|
|
|
3921
4123
|
];
|
|
3922
4124
|
function registerPasskeyBridge(host, options) {
|
|
3923
4125
|
const { adapter } = options;
|
|
3924
|
-
const agent = { ...
|
|
4126
|
+
const agent = { ...DEFAULT_AGENT15, ...options.agent ?? {} };
|
|
3925
4127
|
const surfaceId = adapter.id ?? "passkeys";
|
|
3926
4128
|
const disposers = [];
|
|
3927
4129
|
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
@@ -4082,10 +4284,10 @@ function registerPasskeyBridge(host, options) {
|
|
|
4082
4284
|
}
|
|
4083
4285
|
};
|
|
4084
4286
|
}
|
|
4085
|
-
var
|
|
4287
|
+
var DEFAULT_AGENT16 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
4086
4288
|
function registerDocBridge(host, options) {
|
|
4087
4289
|
const { adapter, surface } = options;
|
|
4088
|
-
const agent = { ...
|
|
4290
|
+
const agent = { ...DEFAULT_AGENT16, ...options.agent ?? {} };
|
|
4089
4291
|
const reducer = options.reducer ?? fancyDocCommons.treeReducer();
|
|
4090
4292
|
const stage = options.stagePolicy ?? fancyDocCommons.autoApply;
|
|
4091
4293
|
const makeNode = options.makeNode ?? (({ id, type, parent, order }, props) => ({ id, type, parent, order, props }));
|
|
@@ -4744,11 +4946,11 @@ function attachSseRelay(server, options) {
|
|
|
4744
4946
|
|
|
4745
4947
|
// src/sharing/use-co-browse-session.ts
|
|
4746
4948
|
init_registry();
|
|
4747
|
-
var
|
|
4949
|
+
var DEFAULT_AGENT17 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
4748
4950
|
var USER = { id: "human", name: "You" };
|
|
4749
4951
|
function useCoBrowseSession(options) {
|
|
4750
4952
|
const { adapter, extraBridges } = options;
|
|
4751
|
-
const agent = { ...
|
|
4953
|
+
const agent = { ...DEFAULT_AGENT17, ...options.agent ?? {} };
|
|
4752
4954
|
const relayBaseUrl = options.relayBaseUrl ?? "/agent-relay";
|
|
4753
4955
|
const serverRef = react.useRef(null);
|
|
4754
4956
|
const relayRef = react.useRef(null);
|
|
@@ -4892,17 +5094,47 @@ function AgentPanel({ agent, activity, onSubmit, busy, actions, className, style
|
|
|
4892
5094
|
}
|
|
4893
5095
|
function ActivityRow({ item }) {
|
|
4894
5096
|
const time = formatTime(item.at);
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
5097
|
+
const status = item.status ?? (item.kind === "error" ? "error" : "ok");
|
|
5098
|
+
const isCall = item.kind === "tool" && (item.args !== void 0 || item.result !== void 0 || item.durationMs !== void 0);
|
|
5099
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5100
|
+
"div",
|
|
5101
|
+
{
|
|
5102
|
+
className: `fai-row fai-row--${item.kind}${isCall ? ` fai-row--${status}` : ""}`,
|
|
5103
|
+
"data-fai-row": "",
|
|
5104
|
+
"data-kind": item.kind,
|
|
5105
|
+
"data-status": isCall ? status : void 0,
|
|
5106
|
+
children: [
|
|
5107
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fai-row__meta", children: [
|
|
5108
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "fai-row__source", children: item.source }),
|
|
5109
|
+
isCall && item.args !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "fai-row__args", "data-fai-args": "", children: [
|
|
5110
|
+
"(",
|
|
5111
|
+
inline(item.args),
|
|
5112
|
+
")"
|
|
5113
|
+
] }),
|
|
5114
|
+
isCall && item.durationMs !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "fai-row__latency", "data-fai-latency": "", children: [
|
|
5115
|
+
"\xB7 ",
|
|
5116
|
+
item.durationMs,
|
|
5117
|
+
"ms"
|
|
5118
|
+
] }),
|
|
5119
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "fai-row__time", children: time })
|
|
5120
|
+
] }),
|
|
5121
|
+
isCall && item.result !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fai-row__result", "data-fai-result": "", children: [
|
|
5122
|
+
"\u2192 ",
|
|
5123
|
+
inline(item.result)
|
|
5124
|
+
] }),
|
|
5125
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "fai-row__text", children: item.text }),
|
|
5126
|
+
item.detail !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("details", { className: "fai-row__detail", children: [
|
|
5127
|
+
/* @__PURE__ */ jsxRuntime.jsx("summary", { children: "details" }),
|
|
5128
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { children: safeJson(item.detail) })
|
|
5129
|
+
] })
|
|
5130
|
+
]
|
|
5131
|
+
}
|
|
5132
|
+
);
|
|
5133
|
+
}
|
|
5134
|
+
function inline(v, max = 80) {
|
|
5135
|
+
if (typeof v === "string") return v.length > max ? `${v.slice(0, max)}\u2026` : v;
|
|
5136
|
+
const json = safeJson(v).replace(/\s+/g, " ");
|
|
5137
|
+
return json.length > max ? `${json.slice(0, max)}\u2026` : json;
|
|
4906
5138
|
}
|
|
4907
5139
|
function formatTime(at) {
|
|
4908
5140
|
const d = new Date(at);
|
|
@@ -6050,6 +6282,7 @@ exports.registerFeaturesBridge = registerFeaturesBridge;
|
|
|
6050
6282
|
exports.registerFilesBridge = registerFilesBridge;
|
|
6051
6283
|
exports.registerFormBridge = registerFormBridge;
|
|
6052
6284
|
exports.registerGitBridge = registerGitBridge;
|
|
6285
|
+
exports.registerGridBridge = registerGridBridge;
|
|
6053
6286
|
exports.registerMapBridge = registerMapBridge;
|
|
6054
6287
|
exports.registerNavigationBridge = registerNavigationBridge;
|
|
6055
6288
|
exports.registerPasskeyBridge = registerPasskeyBridge;
|