@ultrst-armada/floks 1.8.1 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "packageName": "@ultrst-armada/floks",
4
- "version": "1.8.1",
5
- "sourceCommit": "cc26728887521251261425d6cfd9d35a95078721",
4
+ "version": "1.10.0",
5
+ "sourceCommit": "7443a15bf0ce496cf0dbefabf1a06be2c3faaae6",
6
6
  "releaseWorkflow": "npm Release",
7
- "workflowRunId": "41013413417"
7
+ "workflowRunId": "41028751168"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultrst-armada/floks",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -4,6 +4,7 @@ interface AikoIntelligenceSpec {
4
4
  [key: string]: unknown;
5
5
  }
6
6
  interface AikoAgentDefinition {
7
+ schemaVersion?: '1.0.0' | string;
7
8
  id: string;
8
9
  name: string;
9
10
  description?: string;
@@ -13,6 +14,15 @@ interface AikoAgentDefinition {
13
14
  intelligenceSpecId?: string;
14
15
  sourceKind?: 'endpoint' | 'fod-flow' | 'gutts-api' | 'custom';
15
16
  sourceId?: string;
17
+ allowedToolIds?: string[];
18
+ custom?: boolean;
19
+ }
20
+ interface AikoCapability {
21
+ id: string;
22
+ name: string;
23
+ description?: string;
24
+ sourceKind?: 'endpoint' | 'fod-flow' | 'gutts-api' | 'custom';
25
+ sourceId?: string;
16
26
  }
17
27
  interface AikoKey {
18
28
  id: string;
@@ -29,10 +39,18 @@ interface AikoRuntimeLike {
29
39
  listKeys(): Promise<AikoKey[]>;
30
40
  getActiveKey(providerId: string): Promise<AikoKey | null>;
31
41
  rotateKey(providerId: string): Promise<AikoKey | null>;
42
+ addKey?(input: {
43
+ providerId: string;
44
+ label: string;
45
+ key: string;
46
+ emailGroup?: string;
47
+ }): Promise<unknown>;
32
48
  syncFromAikoEngine(): Promise<{
33
49
  synced: number;
34
50
  message?: string;
35
51
  }>;
52
+ listCapabilities?(): Promise<AikoCapability[]>;
53
+ createCustomAgent?(name: string, capabilityIds: string[], specId?: string): Promise<AikoAgentDefinition>;
36
54
  }
37
55
  interface AikoModuleProps {
38
56
  runtime: AikoRuntimeLike;
@@ -44,4 +62,4 @@ declare namespace AikoModule {
44
62
  var displayName: string;
45
63
  }
46
64
 
47
- export { type AikoAgentDefinition, type AikoIntelligenceSpec, type AikoKey, AikoModule, type AikoModuleProps, type AikoRuntimeLike };
65
+ export { type AikoAgentDefinition, type AikoCapability, type AikoIntelligenceSpec, type AikoKey, AikoModule, type AikoModuleProps, type AikoRuntimeLike };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AikoModule
3
- } from "../chunk-2WMWGF5G.js";
3
+ } from "../chunk-OHAFLB3O.js";
4
4
  export {
5
5
  AikoModule
6
6
  };
@@ -0,0 +1,157 @@
1
+ // src/aiko/AikoModule.tsx
2
+ import { useEffect, useMemo, useState } from "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ function AikoModule({ runtime, workspaceId, className }) {
5
+ const [agents, setAgents] = useState([]);
6
+ const [capabilities, setCapabilities] = useState([]);
7
+ const [keys, setKeys] = useState([]);
8
+ const [activeAgent, setActiveAgent] = useState("");
9
+ const [input, setInput] = useState("");
10
+ const [result, setResult] = useState("");
11
+ const [busy, setBusy] = useState(false);
12
+ const [message, setMessage] = useState("");
13
+ const [provider, setProvider] = useState("");
14
+ const [label, setLabel] = useState("");
15
+ const [secret, setSecret] = useState("");
16
+ const [group, setGroup] = useState("");
17
+ const [customName, setCustomName] = useState("");
18
+ const [customCapIds, setCustomCapIds] = useState([]);
19
+ const [customSpecId, setCustomSpecId] = useState("");
20
+ const refresh = async () => {
21
+ const [nextAgents, nextKeys, nextCaps] = await Promise.all([
22
+ runtime.listAgents(),
23
+ runtime.listKeys(),
24
+ runtime.listCapabilities ? runtime.listCapabilities() : Promise.resolve([])
25
+ ]);
26
+ setAgents(nextAgents);
27
+ setKeys(nextKeys);
28
+ setCapabilities(nextCaps);
29
+ if (!activeAgent && nextAgents[0]) setActiveAgent(nextAgents[0].id);
30
+ };
31
+ useEffect(() => {
32
+ void refresh();
33
+ }, [workspaceId]);
34
+ const groups = useMemo(() => {
35
+ const map = /* @__PURE__ */ new Map();
36
+ for (const agent of agents) {
37
+ const key = agent.sourceKind ?? "custom";
38
+ const list = map.get(key) ?? [];
39
+ list.push(agent);
40
+ map.set(key, list);
41
+ }
42
+ return [...map.entries()];
43
+ }, [agents]);
44
+ const execute = async () => {
45
+ if (!activeAgent || !input.trim()) return;
46
+ setBusy(true);
47
+ try {
48
+ setResult(JSON.stringify(await runtime.executeAgent(activeAgent, input), null, 2));
49
+ } catch (error) {
50
+ setResult(error instanceof Error ? error.message : String(error));
51
+ } finally {
52
+ setBusy(false);
53
+ }
54
+ };
55
+ const addKey = async () => {
56
+ if (!runtime.addKey || !provider || !label || !secret) return;
57
+ await runtime.addKey({ providerId: provider, label, key: secret, emailGroup: group || void 0 });
58
+ setSecret("");
59
+ await refresh();
60
+ };
61
+ const sync = async () => {
62
+ setBusy(true);
63
+ try {
64
+ const response = await runtime.syncFromAikoEngine();
65
+ setMessage(response.message ?? "Synced " + response.synced + " keys");
66
+ await refresh();
67
+ } catch (error) {
68
+ setMessage(error instanceof Error ? error.message : String(error));
69
+ } finally {
70
+ setBusy(false);
71
+ }
72
+ };
73
+ const createCustomAgent = async () => {
74
+ if (!runtime.createCustomAgent || !customName.trim() || customCapIds.length === 0) return;
75
+ setBusy(true);
76
+ try {
77
+ const created = await runtime.createCustomAgent(customName.trim(), customCapIds, customSpecId.trim() || void 0);
78
+ setCustomName("");
79
+ setCustomCapIds([]);
80
+ setCustomSpecId("");
81
+ await refresh();
82
+ setActiveAgent(created.id);
83
+ setMessage(`Created custom agent ${created.name}`);
84
+ } catch (error) {
85
+ setMessage(error instanceof Error ? error.message : String(error));
86
+ } finally {
87
+ setBusy(false);
88
+ }
89
+ };
90
+ return /* @__PURE__ */ jsxs("div", { className, "data-aiko-module": "true", style: { display: "grid", gridTemplateColumns: "280px 1fr", gridTemplateRows: "48px 1fr", height: "100%", minHeight: 500 }, children: [
91
+ /* @__PURE__ */ jsxs("header", { style: { gridColumn: "1 / -1", display: "flex", alignItems: "center", gap: 8, padding: 8, borderBottom: "1px solid var(--skipo-border,#333)" }, children: [
92
+ /* @__PURE__ */ jsx("strong", { children: "AIKO" }),
93
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void sync(), disabled: busy, children: "Fetch from Aiko Engine" }),
94
+ /* @__PURE__ */ jsx("span", { children: message })
95
+ ] }),
96
+ /* @__PURE__ */ jsxs("aside", { style: { overflow: "auto", padding: 10, borderRight: "1px solid var(--skipo-border,#333)" }, children: [
97
+ /* @__PURE__ */ jsx("h4", { children: "Agents" }),
98
+ groups.map(([groupName, list]) => /* @__PURE__ */ jsxs("section", { children: [
99
+ /* @__PURE__ */ jsx("strong", { children: groupName }),
100
+ list.map((agent) => /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveAgent(agent.id), style: { display: "block", width: "100%", textAlign: "left", margin: "4px 0" }, children: [
101
+ agent.name,
102
+ " ",
103
+ agent.custom ? "(custom)" : ""
104
+ ] }, agent.id))
105
+ ] }, groupName)),
106
+ runtime.createCustomAgent && /* @__PURE__ */ jsxs("section", { style: { margin: "12px 0", padding: 8, border: "1px solid var(--skipo-border,#333)", borderRadius: 4 }, children: [
107
+ /* @__PURE__ */ jsx("h5", { children: "Create Custom Agent" }),
108
+ /* @__PURE__ */ jsx("input", { value: customName, onChange: (e) => setCustomName(e.target.value), placeholder: "Agent name", style: { width: "100%", marginBottom: 4 } }),
109
+ /* @__PURE__ */ jsx("input", { value: customSpecId, onChange: (e) => setCustomSpecId(e.target.value), placeholder: "Optional Spec ID", style: { width: "100%", marginBottom: 4 } }),
110
+ /* @__PURE__ */ jsx("div", { style: { maxHeight: 90, overflow: "auto", fontSize: 12, margin: "4px 0" }, children: capabilities.map((cap) => /* @__PURE__ */ jsxs("label", { style: { display: "block" }, children: [
111
+ /* @__PURE__ */ jsx(
112
+ "input",
113
+ {
114
+ type: "checkbox",
115
+ checked: customCapIds.includes(cap.id),
116
+ onChange: (e) => {
117
+ setCustomCapIds((prev) => e.target.checked ? [...prev, cap.id] : prev.filter((id) => id !== cap.id));
118
+ }
119
+ }
120
+ ),
121
+ " ",
122
+ cap.name
123
+ ] }, cap.id)) }),
124
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void createCustomAgent(), disabled: busy || !customName.trim() || customCapIds.length === 0, children: "Create Custom Agent" })
125
+ ] }),
126
+ /* @__PURE__ */ jsx("h4", { children: "API Keys" }),
127
+ /* @__PURE__ */ jsxs("div", { children: [
128
+ /* @__PURE__ */ jsx("input", { value: provider, onChange: (event) => setProvider(event.target.value), placeholder: "Provider" }),
129
+ /* @__PURE__ */ jsx("input", { value: label, onChange: (event) => setLabel(event.target.value), placeholder: "Label" }),
130
+ /* @__PURE__ */ jsx("input", { value: group, onChange: (event) => setGroup(event.target.value), placeholder: "Email group" }),
131
+ /* @__PURE__ */ jsx("input", { value: secret, onChange: (event) => setSecret(event.target.value), placeholder: "API key", type: "password" }),
132
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void addKey(), children: "Add key" })
133
+ ] }),
134
+ keys.map((key) => /* @__PURE__ */ jsxs("div", { children: [
135
+ key.providerId,
136
+ ": ",
137
+ key.label,
138
+ " ",
139
+ key.isActive ? "(active)" : "",
140
+ " ",
141
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void runtime.rotateKey(key.providerId), children: "Rotate" })
142
+ ] }, key.id))
143
+ ] }),
144
+ /* @__PURE__ */ jsx("main", { style: { padding: 16, overflow: "auto" }, children: activeAgent ? /* @__PURE__ */ jsxs(Fragment, { children: [
145
+ /* @__PURE__ */ jsx("h3", { children: agents.find((agent) => agent.id === activeAgent)?.name }),
146
+ /* @__PURE__ */ jsx("pre", { children: JSON.stringify(agents.find((agent) => agent.id === activeAgent)?.intelligenceSpec, null, 2) }),
147
+ /* @__PURE__ */ jsx("textarea", { value: input, onChange: (event) => setInput(event.target.value), placeholder: "Describe what you want the agent to do", rows: 5, style: { width: "100%" } }),
148
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void execute(), disabled: busy || !input.trim(), children: "Execute" }),
149
+ /* @__PURE__ */ jsx("pre", { style: { whiteSpace: "pre-wrap" }, children: result })
150
+ ] }) : /* @__PURE__ */ jsx("p", { children: "No Aiko agent selected." }) })
151
+ ] });
152
+ }
153
+ AikoModule.displayName = "AikoModule";
154
+
155
+ export {
156
+ AikoModule
157
+ };
@@ -12,7 +12,7 @@ export { CanvasBackground2D, CanvasErrorBoundary, ContainerNode2D, EffectNode2D,
12
12
  export { PredictiveGhostNodeCard, PredictiveGhostNodeCardProps, PredictiveHudToolbar, PredictiveLayer2D, PredictiveLayer2DProps, UsePredictiveGraph2DProps, UseViewer2DPredictiveProps, usePredictiveGraph2D } from './predictive/index.js';
13
13
  export { AuthoringAssetRef, UIAuthoringContext, UIAuthoringNode, UIAuthoringNodeKind, UIAuthoringSession, UiAuthoringBindingEditor, UiAuthoringComponentRenderer, UiAuthoringInspector, UiAuthoringPreview, UiAuthoringTree, UiAuthoringValidationPanel, UiAuthoringWorkspace, getAuthoringChildren, getAuthoringDepth, getAuthoringSubtreeIds } from './authoring/index.js';
14
14
  export { FodModule, FodModuleProps, FodRuntimeLike } from './fod/index.js';
15
- export { AikoAgentDefinition, AikoIntelligenceSpec, AikoKey, AikoModule, AikoModuleProps, AikoRuntimeLike } from './aiko/index.js';
15
+ export { AikoAgentDefinition, AikoCapability, AikoIntelligenceSpec, AikoKey, AikoModule, AikoModuleProps, AikoRuntimeLike } from './aiko/index.js';
16
16
  import '@ultrst-armada/kloks/contracts';
17
17
 
18
18
  interface MidpointWidgetsProps {
@@ -14,6 +14,12 @@ import {
14
14
  useCanvas2DCoordinates,
15
15
  useCanvas2DMagnetic
16
16
  } from "./chunk-XVAHT5WE.js";
17
+ import {
18
+ Tile,
19
+ TileCreateButton,
20
+ TileGrid,
21
+ useTileMenu
22
+ } from "./chunk-SA3JADUG.js";
17
23
  import {
18
24
  PredictiveGhostNodeCard,
19
25
  PredictiveHudToolbar,
@@ -29,15 +35,9 @@ import {
29
35
  getSocketScreenPosition,
30
36
  renderSpriteIcon
31
37
  } from "./chunk-U2SC3RMJ.js";
32
- import {
33
- Tile,
34
- TileCreateButton,
35
- TileGrid,
36
- useTileMenu
37
- } from "./chunk-SA3JADUG.js";
38
38
  import {
39
39
  AikoModule
40
- } from "./chunk-2WMWGF5G.js";
40
+ } from "./chunk-OHAFLB3O.js";
41
41
  import {
42
42
  UiAuthoringBindingEditor,
43
43
  UiAuthoringInspector,
@@ -63,6 +63,18 @@
63
63
  "requiredServices": [
64
64
  "fod"
65
65
  ]
66
+ },
67
+ {
68
+ "id": "AikoModule",
69
+ "name": "Aiko Application Module",
70
+ "export": "AikoModule",
71
+ "subpath": "aiko",
72
+ "targetTypes": [
73
+ "Main.tabs.aiko"
74
+ ],
75
+ "requiredServices": [
76
+ "aiko"
77
+ ]
66
78
  }
67
79
  ]
68
80
  }
@@ -70,7 +70,8 @@
70
70
  }
71
71
  },
72
72
  "scripts": {
73
- "build": "tsup src/index.ts src/canvas/index.ts src/dock/index.ts src/tile-menu/index.ts src/editor/index.ts src/authoring/index.ts src/graph-2d/index.ts src/predictive/index.ts src/frnl-editable-node-graph/index.ts src/fod/index.ts src/aiko/index.ts --format esm --dts --clean --external react --external react-dom --external lucide-react --external @floks/ui --external @ultrst-armada/frnlts --external @kloks/state-graph --external @kloks/audio-midi --external monaco-editor --external @dnd-kit/core --external @dnd-kit/sortable --external @dnd-kit/utilities"
73
+ "build": "tsup src/index.ts src/canvas/index.ts src/dock/index.ts src/tile-menu/index.ts src/editor/index.ts src/authoring/index.ts src/graph-2d/index.ts src/predictive/index.ts src/frnl-editable-node-graph/index.ts src/fod/index.ts src/aiko/index.ts --format esm --dts --clean --external react --external react-dom --external lucide-react --external @floks/ui --external @ultrst-armada/frnlts --external @kloks/state-graph --external @kloks/audio-midi --external monaco-editor --external @dnd-kit/core --external @dnd-kit/sortable --external @dnd-kit/utilities",
74
+ "typecheck": "tsc --noEmit"
74
75
  },
75
76
  "dependencies": {
76
77
  "@floks/ui": "workspace:*",
@@ -1,87 +0,0 @@
1
- // src/aiko/AikoModule.tsx
2
- import { useEffect, useMemo, useState } from "react";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- function AikoModule({ runtime, workspaceId, className }) {
5
- const [agents, setAgents] = useState([]);
6
- const [keys, setKeys] = useState([]);
7
- const [activeAgent, setActiveAgent] = useState("");
8
- const [input, setInput] = useState("");
9
- const [result, setResult] = useState("");
10
- const [busy, setBusy] = useState(false);
11
- const [message, setMessage] = useState("");
12
- const refresh = async () => {
13
- const [nextAgents, nextKeys] = await Promise.all([runtime.listAgents(), runtime.listKeys()]);
14
- setAgents(nextAgents);
15
- setKeys(nextKeys);
16
- if (!activeAgent && nextAgents[0]) setActiveAgent(nextAgents[0].id);
17
- };
18
- useEffect(() => {
19
- void refresh();
20
- }, [workspaceId]);
21
- const groups = useMemo(() => {
22
- const map = /* @__PURE__ */ new Map();
23
- for (const agent of agents) {
24
- const key = agent.sourceKind ?? "custom";
25
- const list = map.get(key) ?? [];
26
- list.push(agent);
27
- map.set(key, list);
28
- }
29
- return [...map.entries()];
30
- }, [agents]);
31
- const execute = async () => {
32
- if (!activeAgent || !input.trim()) return;
33
- setBusy(true);
34
- try {
35
- setResult(JSON.stringify(await runtime.executeAgent(activeAgent, input), null, 2));
36
- } catch (error) {
37
- setResult(error instanceof Error ? error.message : String(error));
38
- } finally {
39
- setBusy(false);
40
- }
41
- };
42
- const sync = async () => {
43
- setBusy(true);
44
- try {
45
- const response = await runtime.syncFromAikoEngine();
46
- setMessage(response.message ?? "Synced " + response.synced + " keys");
47
- await refresh();
48
- } catch (error) {
49
- setMessage(error instanceof Error ? error.message : String(error));
50
- } finally {
51
- setBusy(false);
52
- }
53
- };
54
- return /* @__PURE__ */ jsxs("div", { className, "data-aiko-module": "true", style: { display: "grid", gridTemplateColumns: "260px 1fr", gridTemplateRows: "48px 1fr", height: "100%", minHeight: 500 }, children: [
55
- /* @__PURE__ */ jsxs("header", { style: { gridColumn: "1 / -1", display: "flex", alignItems: "center", gap: 8, padding: 8, borderBottom: "1px solid var(--skipo-border,#333)" }, children: [
56
- /* @__PURE__ */ jsx("strong", { children: "AIKO" }),
57
- /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void sync(), disabled: busy, children: "Fetch from Aiko Engine" }),
58
- /* @__PURE__ */ jsx("span", { children: message })
59
- ] }),
60
- /* @__PURE__ */ jsxs("aside", { style: { overflow: "auto", padding: 10, borderRight: "1px solid var(--skipo-border,#333)" }, children: [
61
- /* @__PURE__ */ jsx("h4", { children: "Agents" }),
62
- groups.map(([group, list]) => /* @__PURE__ */ jsxs("section", { children: [
63
- /* @__PURE__ */ jsx("strong", { children: group }),
64
- list.map((agent) => /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setActiveAgent(agent.id), style: { display: "block", width: "100%", textAlign: "left", margin: "4px 0" }, children: agent.name }, agent.id))
65
- ] }, group)),
66
- /* @__PURE__ */ jsx("h4", { children: "API Keys" }),
67
- keys.map((key) => /* @__PURE__ */ jsxs("div", { children: [
68
- key.providerId,
69
- ": ",
70
- key.label,
71
- " ",
72
- key.isActive ? "(active)" : ""
73
- ] }, key.id))
74
- ] }),
75
- /* @__PURE__ */ jsx("main", { style: { padding: 16, overflow: "auto" }, children: activeAgent ? /* @__PURE__ */ jsxs(Fragment, { children: [
76
- /* @__PURE__ */ jsx("h3", { children: agents.find((agent) => agent.id === activeAgent)?.name }),
77
- /* @__PURE__ */ jsx("textarea", { value: input, onChange: (event) => setInput(event.target.value), placeholder: "Describe what you want the agent to do", rows: 5, style: { width: "100%" } }),
78
- /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void execute(), disabled: busy || !input.trim(), children: "Execute" }),
79
- /* @__PURE__ */ jsx("pre", { style: { whiteSpace: "pre-wrap" }, children: result })
80
- ] }) : /* @__PURE__ */ jsx("p", { children: "No Aiko agent selected." }) })
81
- ] });
82
- }
83
- AikoModule.displayName = "AikoModule";
84
-
85
- export {
86
- AikoModule
87
- };