@particle-academy/agent-integrations 0.25.0 → 0.26.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-charts.cjs +77 -0
- package/dist/bridges-charts.cjs.map +1 -1
- package/dist/bridges-charts.js +2 -1
- package/dist/bridges-code.cjs +77 -0
- package/dist/bridges-code.cjs.map +1 -1
- package/dist/bridges-code.js +2 -1
- package/dist/bridges-files.cjs +1 -1
- package/dist/bridges-files.cjs.map +1 -1
- package/dist/bridges-files.js +1 -1
- package/dist/bridges-flow.cjs +77 -0
- package/dist/bridges-flow.cjs.map +1 -1
- package/dist/bridges-flow.js +2 -0
- package/dist/bridges-flow.js.map +1 -1
- package/dist/bridges-forms.cjs +77 -0
- package/dist/bridges-forms.cjs.map +1 -1
- package/dist/bridges-forms.js +2 -1
- package/dist/bridges-map.cjs +1 -1
- package/dist/bridges-map.cjs.map +1 -1
- package/dist/bridges-map.js +1 -1
- package/dist/bridges-scene.cjs +77 -0
- package/dist/bridges-scene.cjs.map +1 -1
- package/dist/bridges-scene.js +2 -1
- package/dist/bridges-screens.cjs +77 -0
- package/dist/bridges-screens.cjs.map +1 -1
- package/dist/bridges-screens.js +2 -1
- package/dist/bridges-sheets.cjs +77 -0
- package/dist/bridges-sheets.cjs.map +1 -1
- package/dist/bridges-sheets.js +2 -1
- package/dist/bridges-slides.cjs +77 -0
- package/dist/bridges-slides.cjs.map +1 -1
- package/dist/bridges-slides.js +2 -1
- package/dist/{chunk-DR7X4TWE.js → chunk-46H4C5AP.js} +4 -2
- package/dist/chunk-46H4C5AP.js.map +1 -0
- package/dist/{chunk-5AD35HS5.js → chunk-775LJJTJ.js} +4 -2
- package/dist/chunk-775LJJTJ.js.map +1 -0
- package/dist/{chunk-UOMSY7MZ.js → chunk-CLFDQ2BW.js} +3 -3
- package/dist/{chunk-UOMSY7MZ.js.map → chunk-CLFDQ2BW.js.map} +1 -1
- package/dist/{chunk-SJ7H242B.js → chunk-EP3G4LYW.js} +4 -2
- package/dist/chunk-EP3G4LYW.js.map +1 -0
- package/dist/{chunk-VUMFO2UW.js → chunk-K3S6WSHZ.js} +4 -2
- package/dist/chunk-K3S6WSHZ.js.map +1 -0
- package/dist/{chunk-3VRQGDKV.js → chunk-NKRSLCS7.js} +3 -3
- package/dist/{chunk-3VRQGDKV.js.map → chunk-NKRSLCS7.js.map} +1 -1
- package/dist/{chunk-FYGMFIY5.js → chunk-QDF37J3V.js} +4 -2
- package/dist/chunk-QDF37J3V.js.map +1 -0
- package/dist/{chunk-HIMTURWL.js → chunk-V5BXBX7U.js} +4 -2
- package/dist/chunk-V5BXBX7U.js.map +1 -0
- package/dist/{chunk-CKK4QKD2.js → chunk-YMX7G3XM.js} +4 -2
- package/dist/chunk-YMX7G3XM.js.map +1 -0
- package/dist/index.cjs +85 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -10
- package/package.json +1 -1
- package/dist/chunk-5AD35HS5.js.map +0 -1
- package/dist/chunk-CKK4QKD2.js.map +0 -1
- package/dist/chunk-DR7X4TWE.js.map +0 -1
- package/dist/chunk-FYGMFIY5.js.map +0 -1
- package/dist/chunk-HIMTURWL.js.map +0 -1
- package/dist/chunk-SJ7H242B.js.map +0 -1
- package/dist/chunk-VUMFO2UW.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -285,12 +285,89 @@ function extractMeta(result) {
|
|
|
285
285
|
return void 0;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
// src/undo/undo-tools.ts
|
|
289
|
+
var installedHosts = /* @__PURE__ */ new WeakSet();
|
|
290
|
+
function ensureUndoToolsRegistered(host, options = {}) {
|
|
291
|
+
if (installedHosts.has(host)) return;
|
|
292
|
+
installedHosts.add(host);
|
|
293
|
+
registerUndoTools(host, options);
|
|
294
|
+
}
|
|
295
|
+
function registerUndoTools(host, options = {}) {
|
|
296
|
+
const defaultAgent = options.defaultAgentId ?? "agent";
|
|
297
|
+
const disposers = [];
|
|
298
|
+
const agentOf = (args) => typeof args?.agentId === "string" ? args.agentId : defaultAgent;
|
|
299
|
+
disposers.push(
|
|
300
|
+
host.registerTool(
|
|
301
|
+
{
|
|
302
|
+
name: "agent_undo",
|
|
303
|
+
description: "Undo the most recent action on the agent's stack. Optional agentId targets a specific agent.",
|
|
304
|
+
inputSchema: {
|
|
305
|
+
type: "object",
|
|
306
|
+
properties: { agentId: { type: "string" } },
|
|
307
|
+
additionalProperties: false
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
async (args) => {
|
|
311
|
+
const entry = await fancyAutoCommon.undoOne(agentOf(args));
|
|
312
|
+
if (!entry) return errorResult("Nothing to undo.");
|
|
313
|
+
return textResult(`Undid: ${entry.label}`, { entry: serialize(entry) });
|
|
314
|
+
}
|
|
315
|
+
)
|
|
316
|
+
);
|
|
317
|
+
disposers.push(
|
|
318
|
+
host.registerTool(
|
|
319
|
+
{
|
|
320
|
+
name: "agent_redo",
|
|
321
|
+
description: "Redo the most recently undone action.",
|
|
322
|
+
inputSchema: {
|
|
323
|
+
type: "object",
|
|
324
|
+
properties: { agentId: { type: "string" } },
|
|
325
|
+
additionalProperties: false
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
async (args) => {
|
|
329
|
+
const entry = await fancyAutoCommon.redoOne(agentOf(args));
|
|
330
|
+
if (!entry) return errorResult("Nothing to redo.");
|
|
331
|
+
return textResult(`Redid: ${entry.label}`, { entry: serialize(entry) });
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
);
|
|
335
|
+
disposers.push(
|
|
336
|
+
host.registerTool(
|
|
337
|
+
{
|
|
338
|
+
name: "agent_history",
|
|
339
|
+
description: "List the agent's undo stack (oldest first). Useful for understanding what's reversible.",
|
|
340
|
+
inputSchema: {
|
|
341
|
+
type: "object",
|
|
342
|
+
properties: { agentId: { type: "string" } },
|
|
343
|
+
additionalProperties: false
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
async (args) => {
|
|
347
|
+
const history = fancyAutoCommon.readHistory(agentOf(args)).map(serialize);
|
|
348
|
+
const text = history.map((e) => `${new Date(e.timestamp).toISOString()} ${e.bridgeId} ${e.action}: ${e.label}`).join("\n");
|
|
349
|
+
return textResult(text || "(empty)", history);
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
);
|
|
353
|
+
return () => disposers.forEach((d) => d());
|
|
354
|
+
}
|
|
355
|
+
function serialize(entry) {
|
|
356
|
+
return {
|
|
357
|
+
timestamp: entry.timestamp,
|
|
358
|
+
bridgeId: entry.bridgeId,
|
|
359
|
+
action: entry.action,
|
|
360
|
+
label: entry.label
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
|
|
288
364
|
// src/bridges/forms.ts
|
|
289
365
|
var DEFAULT_AGENT = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
290
366
|
function registerFormBridge(host, options) {
|
|
291
367
|
const { adapter } = options;
|
|
292
368
|
const agent = { ...DEFAULT_AGENT, ...options.agent ?? {} };
|
|
293
369
|
const disposers = [];
|
|
370
|
+
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
294
371
|
const formId = adapter.id;
|
|
295
372
|
const target = (args) => ({
|
|
296
373
|
kind: "form",
|
|
@@ -443,6 +520,7 @@ function registerSheetsBridge(host, options) {
|
|
|
443
520
|
const { adapter } = options;
|
|
444
521
|
const agent = { ...DEFAULT_AGENT2, ...options.agent ?? {} };
|
|
445
522
|
const disposers = [];
|
|
523
|
+
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
446
524
|
const target = (sheetId, address) => ({
|
|
447
525
|
kind: "sheet",
|
|
448
526
|
screenId: adapter.screenId,
|
|
@@ -789,6 +867,7 @@ function registerCodeBridge(host, options) {
|
|
|
789
867
|
const { adapter } = options;
|
|
790
868
|
const agent = { ...DEFAULT_AGENT3, ...options.agent ?? {} };
|
|
791
869
|
const disposers = [];
|
|
870
|
+
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
792
871
|
const target = {
|
|
793
872
|
kind: "code",
|
|
794
873
|
screenId: adapter.screenId,
|
|
@@ -955,6 +1034,7 @@ function registerChartsBridge(host, options) {
|
|
|
955
1034
|
const { adapter } = options;
|
|
956
1035
|
const agent = { ...DEFAULT_AGENT4, ...options.agent ?? {} };
|
|
957
1036
|
const disposers = [];
|
|
1037
|
+
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
958
1038
|
const target = {
|
|
959
1039
|
kind: "chart",
|
|
960
1040
|
screenId: adapter.screenId,
|
|
@@ -1069,6 +1149,7 @@ function registerSceneBridge(host, options) {
|
|
|
1069
1149
|
const { adapter } = options;
|
|
1070
1150
|
const agent = { ...DEFAULT_AGENT5, ...options.agent ?? {} };
|
|
1071
1151
|
const disposers = [];
|
|
1152
|
+
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
1072
1153
|
const target = (objectId) => ({
|
|
1073
1154
|
kind: "scene",
|
|
1074
1155
|
screenId: adapter.screenId,
|
|
@@ -1266,6 +1347,7 @@ function registerScreensBridge(host, options) {
|
|
|
1266
1347
|
const { adapter } = options;
|
|
1267
1348
|
const agent = { ...DEFAULT_AGENT6, ...options.agent ?? {} };
|
|
1268
1349
|
const disposers = [];
|
|
1350
|
+
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
1269
1351
|
const target = (screenId) => ({
|
|
1270
1352
|
kind: "screens",
|
|
1271
1353
|
screenId,
|
|
@@ -1440,6 +1522,7 @@ function registerSlidesBridge(host, options) {
|
|
|
1440
1522
|
const { adapter } = options;
|
|
1441
1523
|
const agent = { ...DEFAULT_AGENT7, ...options.agent ?? {} };
|
|
1442
1524
|
const disposers = [];
|
|
1525
|
+
ensureUndoToolsRegistered(host, { defaultAgentId: agent.id });
|
|
1443
1526
|
const deckTarget = () => ({
|
|
1444
1527
|
kind: "deck",
|
|
1445
1528
|
screenId: adapter.screenId,
|
|
@@ -1876,84 +1959,8 @@ function firstTextContent(slide) {
|
|
|
1876
1959
|
return void 0;
|
|
1877
1960
|
}
|
|
1878
1961
|
|
|
1879
|
-
// src/undo/undo-tools.ts
|
|
1880
|
-
var installedHosts = /* @__PURE__ */ new WeakSet();
|
|
1881
|
-
function ensureUndoToolsRegistered(host, options = {}) {
|
|
1882
|
-
if (installedHosts.has(host)) return;
|
|
1883
|
-
installedHosts.add(host);
|
|
1884
|
-
registerUndoTools(host, options);
|
|
1885
|
-
}
|
|
1886
|
-
function registerUndoTools(host, options = {}) {
|
|
1887
|
-
const defaultAgent = options.defaultAgentId ?? "agent";
|
|
1888
|
-
const disposers = [];
|
|
1889
|
-
const agentOf = (args) => typeof args?.agentId === "string" ? args.agentId : defaultAgent;
|
|
1890
|
-
disposers.push(
|
|
1891
|
-
host.registerTool(
|
|
1892
|
-
{
|
|
1893
|
-
name: "agent_undo",
|
|
1894
|
-
description: "Undo the most recent action on the agent's stack. Optional agentId targets a specific agent.",
|
|
1895
|
-
inputSchema: {
|
|
1896
|
-
type: "object",
|
|
1897
|
-
properties: { agentId: { type: "string" } },
|
|
1898
|
-
additionalProperties: false
|
|
1899
|
-
}
|
|
1900
|
-
},
|
|
1901
|
-
async (args) => {
|
|
1902
|
-
const entry = await fancyAutoCommon.undoOne(agentOf(args));
|
|
1903
|
-
if (!entry) return errorResult("Nothing to undo.");
|
|
1904
|
-
return textResult(`Undid: ${entry.label}`, { entry: serialize(entry) });
|
|
1905
|
-
}
|
|
1906
|
-
)
|
|
1907
|
-
);
|
|
1908
|
-
disposers.push(
|
|
1909
|
-
host.registerTool(
|
|
1910
|
-
{
|
|
1911
|
-
name: "agent_redo",
|
|
1912
|
-
description: "Redo the most recently undone action.",
|
|
1913
|
-
inputSchema: {
|
|
1914
|
-
type: "object",
|
|
1915
|
-
properties: { agentId: { type: "string" } },
|
|
1916
|
-
additionalProperties: false
|
|
1917
|
-
}
|
|
1918
|
-
},
|
|
1919
|
-
async (args) => {
|
|
1920
|
-
const entry = await fancyAutoCommon.redoOne(agentOf(args));
|
|
1921
|
-
if (!entry) return errorResult("Nothing to redo.");
|
|
1922
|
-
return textResult(`Redid: ${entry.label}`, { entry: serialize(entry) });
|
|
1923
|
-
}
|
|
1924
|
-
)
|
|
1925
|
-
);
|
|
1926
|
-
disposers.push(
|
|
1927
|
-
host.registerTool(
|
|
1928
|
-
{
|
|
1929
|
-
name: "agent_history",
|
|
1930
|
-
description: "List the agent's undo stack (oldest first). Useful for understanding what's reversible.",
|
|
1931
|
-
inputSchema: {
|
|
1932
|
-
type: "object",
|
|
1933
|
-
properties: { agentId: { type: "string" } },
|
|
1934
|
-
additionalProperties: false
|
|
1935
|
-
}
|
|
1936
|
-
},
|
|
1937
|
-
async (args) => {
|
|
1938
|
-
const history = fancyAutoCommon.readHistory(agentOf(args)).map(serialize);
|
|
1939
|
-
const text = history.map((e) => `${new Date(e.timestamp).toISOString()} ${e.bridgeId} ${e.action}: ${e.label}`).join("\n");
|
|
1940
|
-
return textResult(text || "(empty)", history);
|
|
1941
|
-
}
|
|
1942
|
-
)
|
|
1943
|
-
);
|
|
1944
|
-
return () => disposers.forEach((d) => d());
|
|
1945
|
-
}
|
|
1946
|
-
function serialize(entry) {
|
|
1947
|
-
return {
|
|
1948
|
-
timestamp: entry.timestamp,
|
|
1949
|
-
bridgeId: entry.bridgeId,
|
|
1950
|
-
action: entry.action,
|
|
1951
|
-
label: entry.label
|
|
1952
|
-
};
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
1962
|
// src/bridges/map.ts
|
|
1956
|
-
var DEFAULT_AGENT8 = { id: "agent", name: "Agent", color: "#
|
|
1963
|
+
var DEFAULT_AGENT8 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
1957
1964
|
var num2 = (v, fallback) => typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
1958
1965
|
var str2 = (v, fallback = "") => typeof v === "string" ? v : fallback;
|
|
1959
1966
|
var newId = (prefix) => `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`;
|
|
@@ -2280,7 +2287,7 @@ function registerMapBridge(host, options) {
|
|
|
2280
2287
|
}
|
|
2281
2288
|
|
|
2282
2289
|
// src/bridges/files.ts
|
|
2283
|
-
var DEFAULT_AGENT9 = { id: "agent", name: "Agent", color: "#
|
|
2290
|
+
var DEFAULT_AGENT9 = { id: "agent", name: "Agent", color: "#a855f7" };
|
|
2284
2291
|
var str3 = (v, fallback = "") => typeof v === "string" ? v : fallback;
|
|
2285
2292
|
var num3 = (v, fallback) => typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
2286
2293
|
var asPaths = (v) => {
|