@axiom-lattice/gateway 4.8.4 → 4.9.1
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/a2a-BHBLACJV.mjs +17 -0
- package/dist/a2a-BHBLACJV.mjs.map +1 -0
- package/dist/{chunk-NPHK4SZ6.mjs → chunk-FGSFOXIX.mjs} +2 -2
- package/dist/{a2a-FGYX2HH3.mjs → chunk-HYYLYIMH.mjs} +59 -15
- package/dist/chunk-HYYLYIMH.mjs.map +1 -0
- package/dist/{chunk-73QZQQOT.mjs → chunk-MWWLJMYN.mjs} +3 -2
- package/dist/chunk-MWWLJMYN.mjs.map +1 -0
- package/dist/embed/{embed-page-AgentDetailSideApp-S5N76UPU.js → embed-page-AgentDetailSideApp-UMITWVYQ.js} +1 -1
- package/dist/embed/{embed-page-AgentGovernanceWorkbench-QFMP2M73.js → embed-page-AgentGovernanceWorkbench-UD7RE7PT.js} +1 -1
- package/dist/embed/{embed-page-MessageGraph-H3HPZKOH.js → embed-page-MessageGraph-XQWKYDUB.js} +1 -1
- package/dist/embed/{embed-page-ReactChart-ZFMANJCT.js → embed-page-ReactChart-LW3GWMY2.js} +1 -1
- package/dist/embed/{embed-page-SkillFlow-HY7PD43P.js → embed-page-SkillFlow-X3D346DE.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-QKEXMHCT.js → embed-page-TasksSideApp-SUMX2GJF.js} +1 -1
- package/dist/embed/{embed-page-TeamWorkspace-ZFVAFZXZ.js → embed-page-TeamWorkspace-QMIX2TP2.js} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-2BS4OYEZ.js → embed-page-TopologyRuntimeView-ZP6NWNS7.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-WUI7BSQP.js → embed-page-WorkflowAutomationView-4HD3ISK6.js} +1 -1
- package/dist/embed/{embed-page-chunk-4T4QMOUS.js → embed-page-chunk-3VIEL6KL.js} +1 -1
- package/dist/embed/{embed-page-chunk-5WYDCL3B.js → embed-page-chunk-MFFCCHGW.js} +158 -158
- package/dist/embed/{embed-page-chunk-6HM7ZERK.js → embed-page-chunk-QCKYIPFY.js} +1 -1
- package/dist/embed/{embed-page-chunk-XKQ6YPUW.js → embed-page-chunk-QGAGZMX2.js} +1 -1
- package/dist/embed/{embed-page-chunk-VJTO6SG6.js → embed-page-chunk-SX7YO5JA.js} +1 -1
- package/dist/embed/{embed-page-chunk-7ZBZKXBU.js → embed-page-chunk-T7XXE35M.js} +4 -4
- package/dist/embed/{embed-page-chunk-MSHEVUK3.js → embed-page-chunk-YAJUWBF2.js} +1 -1
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.d.mts +431 -5
- package/dist/index.d.ts +431 -5
- package/dist/index.js +2939 -1294
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1811 -211
- package/dist/index.mjs.map +1 -1
- package/dist/{open-UVKMONVE.mjs → open-FJ3BY3CL.mjs} +3 -3
- package/dist/{open-exposure-VU227IO3.mjs → open-exposure-OX5NKWDG.mjs} +6 -6
- package/package.json +7 -7
- package/dist/a2a-FGYX2HH3.mjs.map +0 -1
- package/dist/chunk-73QZQQOT.mjs.map +0 -1
- /package/dist/{chunk-NPHK4SZ6.mjs.map → chunk-FGSFOXIX.mjs.map} +0 -0
- /package/dist/{open-UVKMONVE.mjs.map → open-FJ3BY3CL.mjs.map} +0 -0
- /package/dist/{open-exposure-VU227IO3.mjs.map → open-exposure-OX5NKWDG.mjs.map} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
broadcastA2AKeyChanged,
|
|
3
|
+
refreshStoreKeyMap,
|
|
4
|
+
registerA2ARoutes,
|
|
5
|
+
setA2AAuthService,
|
|
6
|
+
setA2AKeyStore
|
|
7
|
+
} from "./chunk-HYYLYIMH.mjs";
|
|
8
|
+
import "./chunk-GPHOYR3X.mjs";
|
|
9
|
+
import "./chunk-NFEGQTCC.mjs";
|
|
10
|
+
export {
|
|
11
|
+
broadcastA2AKeyChanged,
|
|
12
|
+
refreshStoreKeyMap,
|
|
13
|
+
registerA2ARoutes,
|
|
14
|
+
setA2AAuthService,
|
|
15
|
+
setA2AKeyStore
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=a2a-BHBLACJV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
PluginToolScopeError,
|
|
6
6
|
invokePluginTool
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MWWLJMYN.mjs";
|
|
8
8
|
|
|
9
9
|
// src/services/open/tenantOpenPlugins.ts
|
|
10
10
|
import {
|
|
@@ -154,4 +154,4 @@ export {
|
|
|
154
154
|
mergeOpenCatalog,
|
|
155
155
|
buildTenantOpenPlugins
|
|
156
156
|
};
|
|
157
|
-
//# sourceMappingURL=chunk-
|
|
157
|
+
//# sourceMappingURL=chunk-FGSFOXIX.mjs.map
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A2AAuthError
|
|
3
3
|
} from "./chunk-GPHOYR3X.mjs";
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
// src/routes/a2a.ts
|
|
6
|
+
import { getStoreLattice, getReplicaId } from "@axiom-lattice/core";
|
|
7
|
+
|
|
8
|
+
// src/services/a2aKeySync.ts
|
|
9
|
+
var A2A_KEY_CHANGED_TOPIC = "a2a-key-changed";
|
|
10
|
+
async function publishA2AKeyChanged(outbox, owner, tenantId) {
|
|
11
|
+
if (!tenantId) return;
|
|
12
|
+
try {
|
|
13
|
+
await outbox.append({
|
|
14
|
+
topic: A2A_KEY_CHANGED_TOPIC,
|
|
15
|
+
payload: { tenantId },
|
|
16
|
+
originReplicaId: owner
|
|
17
|
+
});
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function handleA2AKeyChanged(payload, reload) {
|
|
22
|
+
const tenantId = payload?.tenantId;
|
|
23
|
+
if (typeof tenantId !== "string" || tenantId.length === 0) return;
|
|
24
|
+
await reload();
|
|
25
|
+
}
|
|
5
26
|
|
|
6
27
|
// src/routes/a2a.ts
|
|
7
28
|
var _a2aKeyStore = null;
|
|
@@ -15,6 +36,14 @@ function setA2AAuthService(service) {
|
|
|
15
36
|
async function refreshStoreKeyMap() {
|
|
16
37
|
if (_a2aAuthService) await _a2aAuthService.refresh();
|
|
17
38
|
}
|
|
39
|
+
function broadcastA2AKeyChanged(tenantId) {
|
|
40
|
+
if (!tenantId) return;
|
|
41
|
+
try {
|
|
42
|
+
const outbox = getStoreLattice("default", "outbox").store;
|
|
43
|
+
void publishA2AKeyChanged(outbox, getReplicaId(), tenantId);
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
}
|
|
18
47
|
async function requireTenantSession(request, reply) {
|
|
19
48
|
if (!getUserTenantId(request)) {
|
|
20
49
|
await reply.status(401).send({ success: false, error: "Unauthorized" });
|
|
@@ -23,18 +52,18 @@ async function requireTenantSession(request, reply) {
|
|
|
23
52
|
async function authorizeKeyMutation(request, reply) {
|
|
24
53
|
if (!_a2aKeyStore) {
|
|
25
54
|
await reply.status(501).send({ error: "Key store not configured" });
|
|
26
|
-
return
|
|
55
|
+
return null;
|
|
27
56
|
}
|
|
28
57
|
const record = await _a2aKeyStore.findById(request.params.id);
|
|
29
58
|
if (!record) {
|
|
30
59
|
await reply.status(404).send({ success: false, error: "A2A API key not found" });
|
|
31
|
-
return
|
|
60
|
+
return null;
|
|
32
61
|
}
|
|
33
62
|
if (record.tenantId !== getUserTenantId(request)) {
|
|
34
63
|
await reply.status(403).send({ success: false, error: "Forbidden" });
|
|
35
|
-
return
|
|
64
|
+
return null;
|
|
36
65
|
}
|
|
37
|
-
return
|
|
66
|
+
return record;
|
|
38
67
|
}
|
|
39
68
|
function getUserTenantId(request) {
|
|
40
69
|
return request.user?.tenantId;
|
|
@@ -73,6 +102,7 @@ async function handleApiKeyCreate(request, reply) {
|
|
|
73
102
|
label: body.label
|
|
74
103
|
});
|
|
75
104
|
await refreshStoreKeyMap();
|
|
105
|
+
broadcastA2AKeyChanged(tenantId);
|
|
76
106
|
reply.status(201).send({ success: true, data: record });
|
|
77
107
|
} catch (err) {
|
|
78
108
|
if (err instanceof A2AAuthError) {
|
|
@@ -103,6 +133,7 @@ async function handleApiKeyUpdate(request, reply) {
|
|
|
103
133
|
}
|
|
104
134
|
);
|
|
105
135
|
await refreshStoreKeyMap();
|
|
136
|
+
broadcastA2AKeyChanged(tenantId);
|
|
106
137
|
reply.status(200).send({ success: true, data: record });
|
|
107
138
|
} catch (err) {
|
|
108
139
|
if (err instanceof A2AAuthError) {
|
|
@@ -114,28 +145,36 @@ async function handleApiKeyUpdate(request, reply) {
|
|
|
114
145
|
}
|
|
115
146
|
}
|
|
116
147
|
async function handleApiKeyDelete(request, reply) {
|
|
117
|
-
|
|
148
|
+
const record = await authorizeKeyMutation(request, reply);
|
|
149
|
+
if (!record) return;
|
|
118
150
|
await _a2aKeyStore.delete(request.params.id);
|
|
119
151
|
await refreshStoreKeyMap();
|
|
152
|
+
broadcastA2AKeyChanged(record.tenantId);
|
|
120
153
|
reply.status(200).send({ success: true });
|
|
121
154
|
}
|
|
122
155
|
async function handleApiKeyDisable(request, reply) {
|
|
123
|
-
|
|
156
|
+
const record = await authorizeKeyMutation(request, reply);
|
|
157
|
+
if (!record) return;
|
|
124
158
|
await _a2aKeyStore.disable(request.params.id);
|
|
125
159
|
await refreshStoreKeyMap();
|
|
160
|
+
broadcastA2AKeyChanged(record.tenantId);
|
|
126
161
|
reply.status(200).send({ success: true });
|
|
127
162
|
}
|
|
128
163
|
async function handleApiKeyEnable(request, reply) {
|
|
129
|
-
|
|
164
|
+
const record = await authorizeKeyMutation(request, reply);
|
|
165
|
+
if (!record) return;
|
|
130
166
|
await _a2aKeyStore.enable(request.params.id);
|
|
131
167
|
await refreshStoreKeyMap();
|
|
168
|
+
broadcastA2AKeyChanged(record.tenantId);
|
|
132
169
|
reply.status(200).send({ success: true });
|
|
133
170
|
}
|
|
134
171
|
async function handleApiKeyRotate(request, reply) {
|
|
135
|
-
|
|
136
|
-
|
|
172
|
+
const record = await authorizeKeyMutation(request, reply);
|
|
173
|
+
if (!record) return;
|
|
174
|
+
const rotated = await _a2aKeyStore.rotate(request.params.id);
|
|
137
175
|
await refreshStoreKeyMap();
|
|
138
|
-
|
|
176
|
+
broadcastA2AKeyChanged(record.tenantId);
|
|
177
|
+
reply.status(200).send({ success: true, data: rotated });
|
|
139
178
|
}
|
|
140
179
|
function registerA2ARoutes(app) {
|
|
141
180
|
const options = { preHandler: requireTenantSession };
|
|
@@ -177,10 +216,15 @@ function registerA2ARoutes(app) {
|
|
|
177
216
|
);
|
|
178
217
|
}
|
|
179
218
|
}
|
|
219
|
+
|
|
180
220
|
export {
|
|
181
|
-
|
|
182
|
-
|
|
221
|
+
A2A_KEY_CHANGED_TOPIC,
|
|
222
|
+
publishA2AKeyChanged,
|
|
223
|
+
handleA2AKeyChanged,
|
|
224
|
+
setA2AKeyStore,
|
|
183
225
|
setA2AAuthService,
|
|
184
|
-
|
|
226
|
+
refreshStoreKeyMap,
|
|
227
|
+
broadcastA2AKeyChanged,
|
|
228
|
+
registerA2ARoutes
|
|
185
229
|
};
|
|
186
|
-
//# sourceMappingURL=
|
|
230
|
+
//# sourceMappingURL=chunk-HYYLYIMH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/routes/a2a.ts","../src/services/a2aKeySync.ts"],"sourcesContent":["import type { FastifyInstance, FastifyRequest, FastifyReply } from \"fastify\";\nimport type {\n A2AApiKeyRecord,\n A2AApiKeyStore,\n CreateA2AApiKeyInput,\n OutboxStore,\n} from \"@axiom-lattice/protocols\";\nimport { getStoreLattice, getReplicaId } from \"@axiom-lattice/core\";\nimport { A2AAuthError } from \"../services/a2a/A2AAuthService\";\nimport type { A2AAuthService } from \"../services/a2a/A2AAuthService\";\nimport { publishA2AKeyChanged } from \"../services/a2aKeySync\";\n\n// ─── Key Store ────────────────────────────────────────────────────────────\n\nlet _a2aKeyStore: A2AApiKeyStore | null = null;\nlet _a2aAuthService: A2AAuthService | null = null;\n\n/** Inject the A2A key store used by the keys management routes. */\nexport function setA2AKeyStore(store: A2AApiKeyStore): void {\n _a2aKeyStore = store;\n}\n\n/** Inject the A2A auth service used to create keys and refresh the key cache. */\nexport function setA2AAuthService(service: A2AAuthService): void {\n _a2aAuthService = service;\n}\n\n/**\n * Reload cached key maps after a keys CRUD mutation. Delegates to the auth\n * service's key-map cache so authentication reflects the latest keys without\n * hitting the store on every request.\n */\nexport async function refreshStoreKeyMap(): Promise<void> {\n if (_a2aAuthService) await _a2aAuthService.refresh();\n}\n\n/**\n * Best-effort broadcast of an A2A key change so peer replicas reload their key map.\n *\n * @param tenantId Tenant whose keys changed.\n * @remarks Fire-and-forget; never affects the request outcome.\n */\nexport function broadcastA2AKeyChanged(tenantId: string | undefined): void {\n if (!tenantId) return;\n try {\n const outbox = getStoreLattice(\"default\", \"outbox\").store as OutboxStore;\n void publishA2AKeyChanged(outbox, getReplicaId(), tenantId);\n } catch {\n // Best-effort: startup load / the next change corrects a miss.\n }\n}\n\ninterface RequestWithUser extends FastifyRequest {\n user?: { id: string; tenantId?: string };\n}\n\nasync function requireTenantSession(\n request: FastifyRequest,\n reply: FastifyReply,\n): Promise<void> {\n if (!getUserTenantId(request)) {\n await reply.status(401).send({ success: false, error: \"Unauthorized\" });\n }\n}\n\nasync function authorizeKeyMutation(\n request: FastifyRequest<{ Params: { id: string } }>,\n reply: FastifyReply,\n): Promise<A2AApiKeyRecord | null> {\n if (!_a2aKeyStore) {\n await reply.status(501).send({ error: \"Key store not configured\" });\n return null;\n }\n const record = await _a2aKeyStore.findById(request.params.id);\n if (!record) {\n await reply.status(404).send({ success: false, error: \"A2A API key not found\" });\n return null;\n }\n if (record.tenantId !== getUserTenantId(request)) {\n await reply.status(403).send({ success: false, error: \"Forbidden\" });\n return null;\n }\n return record;\n}\n\nfunction getUserTenantId(request: FastifyRequest): string | undefined {\n return (request as RequestWithUser).user?.tenantId;\n}\n\n// ─── API Key Management Handlers ─────────────────────────────────────────\n\nasync function handleApiKeyList(\n request: FastifyRequest<{ Querystring: { tenantId?: string; limit?: string; offset?: string } }>,\n reply: FastifyReply,\n): Promise<void> {\n if (!_a2aKeyStore) {\n reply.status(501).send({ error: \"Key store not configured\" });\n return;\n }\n\n const records = await _a2aKeyStore.list({\n tenantId: getUserTenantId(request),\n limit: request.query.limit ? parseInt(request.query.limit, 10) : undefined,\n offset: request.query.offset ? parseInt(request.query.offset, 10) : undefined,\n });\n\n reply.status(200).send({\n success: true,\n data: {\n records: records.map((r) => ({ ...r, key: r.key.slice(0, 8) + \"...\" })),\n total: records.length,\n },\n });\n}\n\nasync function handleApiKeyCreate(\n request: FastifyRequest<{ Body: Partial<CreateA2AApiKeyInput> }>,\n reply: FastifyReply,\n): Promise<void> {\n if (!_a2aKeyStore || !_a2aAuthService) {\n reply.status(501).send({ error: \"Key store not configured\" });\n return;\n }\n\n const body = request.body as Partial<CreateA2AApiKeyInput>;\n const tenantId = getUserTenantId(request)!;\n\n try {\n const record = await _a2aAuthService.createKeyScoped({\n tenantId,\n projectId: body.projectId,\n assistantIds: body.assistantIds,\n grants: body.grants,\n label: body.label,\n });\n await refreshStoreKeyMap();\n broadcastA2AKeyChanged(tenantId);\n reply.status(201).send({ success: true, data: record });\n } catch (err) {\n if (err instanceof A2AAuthError) {\n reply.status(err.statusCode).send({ success: false, error: err.message });\n return;\n }\n request.log.error({ err }, \"a2a:keys:create\");\n reply.status(500).send({ success: false, error: \"Failed to create key\" });\n }\n}\n\nasync function handleApiKeyUpdate(\n request: FastifyRequest<{ Params: { id: string }; Body: Partial<CreateA2AApiKeyInput> }>,\n reply: FastifyReply,\n): Promise<void> {\n if (!_a2aKeyStore || !_a2aAuthService) {\n reply.status(501).send({ error: \"Key store not configured\" });\n return;\n }\n if (!(await authorizeKeyMutation(request, reply))) return;\n\n const body = request.body as Partial<CreateA2AApiKeyInput>;\n const tenantId = getUserTenantId(request)!;\n try {\n const record = await _a2aAuthService.updateKeyScoped(\n request.params.id,\n tenantId,\n {\n label: body.label,\n projectId: body.projectId,\n assistantIds: body.assistantIds,\n grants: body.grants,\n },\n );\n await refreshStoreKeyMap();\n broadcastA2AKeyChanged(tenantId);\n reply.status(200).send({ success: true, data: record });\n } catch (err) {\n if (err instanceof A2AAuthError) {\n reply.status(err.statusCode).send({ success: false, error: err.message });\n return;\n }\n request.log.error({ err }, \"a2a:keys:update\");\n reply.status(500).send({ success: false, error: \"Failed to update key\" });\n }\n}\n\nasync function handleApiKeyDelete(\n request: FastifyRequest<{ Params: { id: string } }>,\n reply: FastifyReply,\n): Promise<void> {\n const record = await authorizeKeyMutation(request, reply);\n if (!record) return;\n\n await _a2aKeyStore!.delete(request.params.id);\n await refreshStoreKeyMap();\n broadcastA2AKeyChanged(record.tenantId);\n\n reply.status(200).send({ success: true });\n}\n\nasync function handleApiKeyDisable(\n request: FastifyRequest<{ Params: { id: string } }>,\n reply: FastifyReply,\n): Promise<void> {\n const record = await authorizeKeyMutation(request, reply);\n if (!record) return;\n\n await _a2aKeyStore!.disable(request.params.id);\n await refreshStoreKeyMap();\n broadcastA2AKeyChanged(record.tenantId);\n\n reply.status(200).send({ success: true });\n}\n\nasync function handleApiKeyEnable(\n request: FastifyRequest<{ Params: { id: string } }>,\n reply: FastifyReply,\n): Promise<void> {\n const record = await authorizeKeyMutation(request, reply);\n if (!record) return;\n\n await _a2aKeyStore!.enable(request.params.id);\n await refreshStoreKeyMap();\n broadcastA2AKeyChanged(record.tenantId);\n\n reply.status(200).send({ success: true });\n}\n\nasync function handleApiKeyRotate(\n request: FastifyRequest<{ Params: { id: string } }>,\n reply: FastifyReply,\n): Promise<void> {\n const record = await authorizeKeyMutation(request, reply);\n if (!record) return;\n\n const rotated = await _a2aKeyStore!.rotate(request.params.id);\n await refreshStoreKeyMap();\n broadcastA2AKeyChanged(record.tenantId);\n\n reply.status(200).send({ success: true, data: rotated });\n}\n\n// ─── Route Registration ───────────────────────────────────────────────────\n\n/**\n * Register the API key management routes.\n *\n * `/api/keys` is the canonical unified surface; `/api/a2a/keys` remains as a\n * backward-compatible alias for existing clients.\n */\nexport function registerA2ARoutes(app: FastifyInstance): void {\n const options = { preHandler: requireTenantSession };\n for (const base of [\"/api/keys\", \"/api/a2a/keys\"]) {\n app.get<{ Querystring: { tenantId?: string; limit?: string; offset?: string } }>(\n base,\n options,\n handleApiKeyList,\n );\n\n app.post<{ Body: Partial<CreateA2AApiKeyInput> }>(\n base,\n options,\n handleApiKeyCreate,\n );\n\n app.delete<{ Params: { id: string } }>(\n `${base}/:id`,\n options,\n handleApiKeyDelete,\n );\n\n app.post<{ Params: { id: string } }>(\n `${base}/:id/disable`,\n options,\n handleApiKeyDisable,\n );\n\n app.post<{ Params: { id: string } }>(\n `${base}/:id/enable`,\n options,\n handleApiKeyEnable,\n );\n\n app.post<{ Params: { id: string } }>(\n `${base}/:id/rotate`,\n options,\n handleApiKeyRotate,\n );\n app.patch<{ Params: { id: string }; Body: Partial<CreateA2AApiKeyInput> }>(\n `${base}/:id`,\n options,\n handleApiKeyUpdate,\n );\n }\n}\n","import type { OutboxStore } from \"@axiom-lattice/protocols\";\n\n/** Outbox topic carrying cross-replica A2A API-key invalidation. */\nexport const A2A_KEY_CHANGED_TOPIC = \"a2a-key-changed\";\n\n/**\n * Best-effort publish of an A2A key change to the durable outbox.\n *\n * @param outbox Shared outbox store.\n * @param owner This replica id (recorded as the event origin).\n * @param tenantId Tenant whose keys changed.\n * @remarks Never throws; peers fall back to startup load / the next change.\n */\nexport async function publishA2AKeyChanged(\n outbox: OutboxStore,\n owner: string,\n tenantId: string,\n): Promise<void> {\n if (!tenantId) return;\n try {\n await outbox.append({\n topic: A2A_KEY_CHANGED_TOPIC,\n payload: { tenantId },\n originReplicaId: owner,\n });\n } catch {\n // Best-effort: startup load / the next change corrects a miss.\n }\n}\n\n/**\n * Reloads this replica's key map after a foreign key change.\n *\n * @param payload Outbox payload, expected to carry a non-empty `tenantId`.\n * @param reload Store-backed reload callback (refreshes the global key map).\n */\nexport async function handleA2AKeyChanged(\n payload: unknown,\n reload: () => Promise<void>,\n): Promise<void> {\n const tenantId = (payload as { tenantId?: unknown } | null)?.tenantId;\n if (typeof tenantId !== \"string\" || tenantId.length === 0) return;\n await reload();\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/services/plugins/pluginToolExecution.ts
|
|
2
|
+
import { handlerResultText } from "@axiom-lattice/core";
|
|
2
3
|
var PluginToolScopeError = class extends Error {
|
|
3
4
|
/**
|
|
4
5
|
* @param name - Rejected tool name.
|
|
@@ -33,11 +34,11 @@ async function invokePluginTool(deps, tenantId, pluginType, name, args, runConte
|
|
|
33
34
|
maxResultBytes: tool.maxResultBytes
|
|
34
35
|
});
|
|
35
36
|
if (!result.ok) throw new Error(result.error ?? "sandbox plugin execution failed");
|
|
36
|
-
return result.result;
|
|
37
|
+
return result.result === void 0 ? handlerResultText(result) : result.result;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export {
|
|
40
41
|
PluginToolScopeError,
|
|
41
42
|
invokePluginTool
|
|
42
43
|
};
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
44
|
+
//# sourceMappingURL=chunk-MWWLJMYN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/plugins/pluginToolExecution.ts"],"sourcesContent":["/**\n * Shared sandbox plugin tool execution helper.\n *\n * Membership resolution and executor invocation must have exactly one\n * constructor in the gateway: producing the `runConfig`/`context`/handler\n * envelope in two places would let the MCP App UI path and the Open MCP path\n * drift. Both `routes/mcp-apps.ts` (`callPluginTool`) and\n * `services/open/tenantOpenPlugins.ts` delegate here.\n *\n * `SandboxPluginInvokeArgs` is imported from core (the executor's own argument\n * contract) so this seam cannot silently diverge from {@link SandboxPluginExecutor}.\n */\n\nimport type { SandboxPluginManifest } from \"@axiom-lattice/protocols\";\nimport { handlerResultText, type SandboxPluginInvokeArgs } from \"@axiom-lattice/core\";\n\n/**\n * Thrown when a requested tool is not owned by the addressed plugin's validated\n * manifest. Callers map it to a client error (the MCP App route maps it to 403).\n */\nexport class PluginToolScopeError extends Error {\n /** Stable machine-readable code for callers that translate the error. */\n readonly code = \"PLUGIN_TOOL_SCOPE\";\n\n /**\n * @param name - Rejected tool name.\n * @param pluginType - Plugin the request addressed.\n */\n constructor(name: string, pluginType: string) {\n super(`tool \"${name}\" is not owned by plugin \"${pluginType}\"`);\n this.name = \"PluginToolScopeError\";\n }\n}\n\n/** Minimal executor outcome the invocation seam depends on. */\nexport interface PluginToolInvokeResult {\n ok: boolean;\n result?: unknown;\n error?: string;\n /** Raw handler stdout, used as a fallback when `result` is omitted. */\n stdout?: string;\n}\n\n/** The catalog surface required to execute a plugin tool. */\nexport interface PluginToolCatalog {\n /**\n * Validated (normalized) manifest for the plugin.\n *\n * This is the authoritative source for handler paths and tool caps: it is the\n * output of the manifest validator, not a fresh parse of the raw\n * `plugin.json`, so execution cannot diverge from what validation accepted.\n */\n getValidatedManifest(tenantId: string, type: string): Promise<SandboxPluginManifest | undefined>;\n getExecutor(): {\n invoke(args: SandboxPluginInvokeArgs): Promise<PluginToolInvokeResult>;\n };\n}\n\n/** Dependencies injected into {@link invokePluginTool}. */\nexport interface PluginToolExecutionDeps {\n catalog: PluginToolCatalog;\n}\n\n/** Optional run identity and credential payload for a plugin tool invocation. */\nexport interface PluginToolRunContext {\n workspaceId?: string;\n projectId?: string;\n connection?: Record<string, unknown>;\n connections?: Array<{ key: string; config: Record<string, unknown> }>;\n}\n\n/**\n * Execute one of a plugin's own tools through the injected sandbox executor.\n *\n * A tool the plugin does not own is a scope violation\n * ({@link PluginToolScopeError}); a missing plugin, validated manifest, or\n * failed execution is a backend failure.\n *\n * @param deps - Catalog seam exposing the validated manifest and executor.\n * @param tenantId - Tenant scope.\n * @param pluginType - Plugin type addressed by the request.\n * @param name - Tool name requested by the caller.\n * @param args - Tool arguments.\n * @param runContext - Optional run identity (workspace/project) selecting the\n * project-isolated sandbox, plus any connection payload. Undefined identity\n * fields are omitted so the executor falls back to the tenant-level sandbox.\n * @returns The handler result.\n * @throws PluginToolScopeError when the validated manifest does not own the tool.\n * @throws Error when the manifest is missing or execution fails.\n */\nexport async function invokePluginTool(\n deps: PluginToolExecutionDeps,\n tenantId: string,\n pluginType: string,\n name: string,\n args: Record<string, unknown>,\n runContext?: PluginToolRunContext,\n): Promise<unknown> {\n const manifest = await deps.catalog.getValidatedManifest(tenantId, pluginType);\n if (!manifest) throw new Error(`plugin \"${pluginType}\" has no validated manifest`);\n const tool = (manifest.tools ?? []).find((t) => t.name === name);\n if (!tool) throw new PluginToolScopeError(name, pluginType);\n // Spread/omit undefined so the executor sees only the identity it was given:\n // a call with workspace/project resolves the project-isolated sandbox, while a\n // context-less call falls back to the tenant-level sandbox.\n const runConfig = {\n tenantId,\n ...(runContext?.workspaceId === undefined ? {} : { workspaceId: runContext.workspaceId }),\n ...(runContext?.projectId === undefined ? {} : { projectId: runContext.projectId }),\n };\n const result = await deps.catalog.getExecutor().invoke({\n manifest,\n handler: tool.handler,\n input: args,\n ...(runContext?.connection === undefined ? {} : { connection: runContext.connection }),\n ...(runContext?.connections === undefined ? {} : { connections: runContext.connections }),\n context: { tenantId, pluginType, tool: name },\n runConfig,\n timeoutMs: tool.timeoutMs,\n maxResultBytes: tool.maxResultBytes,\n });\n if (!result.ok) throw new Error(result.error ?? \"sandbox plugin execution failed\");\n return result.result === undefined ? handlerResultText(result) : result.result;\n}\n"],"mappings":";AAcA,SAAS,yBAAuD;AAMzD,IAAM,uBAAN,cAAmC,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9C,YAAY,MAAc,YAAoB;AAC5C,UAAM,SAAS,IAAI,6BAA6B,UAAU,GAAG;AAP/D;AAAA,SAAS,OAAO;AAQd,SAAK,OAAO;AAAA,EACd;AACF;AA0DA,eAAsB,iBACpB,MACA,UACA,YACA,MACA,MACA,YACkB;AAClB,QAAM,WAAW,MAAM,KAAK,QAAQ,qBAAqB,UAAU,UAAU;AAC7E,MAAI,CAAC,SAAU,OAAM,IAAI,MAAM,WAAW,UAAU,6BAA6B;AACjF,QAAM,QAAQ,SAAS,SAAS,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AAC/D,MAAI,CAAC,KAAM,OAAM,IAAI,qBAAqB,MAAM,UAAU;AAI1D,QAAM,YAAY;AAAA,IAChB;AAAA,IACA,GAAI,YAAY,gBAAgB,SAAY,CAAC,IAAI,EAAE,aAAa,WAAW,YAAY;AAAA,IACvF,GAAI,YAAY,cAAc,SAAY,CAAC,IAAI,EAAE,WAAW,WAAW,UAAU;AAAA,EACnF;AACA,QAAM,SAAS,MAAM,KAAK,QAAQ,YAAY,EAAE,OAAO;AAAA,IACrD;AAAA,IACA,SAAS,KAAK;AAAA,IACd,OAAO;AAAA,IACP,GAAI,YAAY,eAAe,SAAY,CAAC,IAAI,EAAE,YAAY,WAAW,WAAW;AAAA,IACpF,GAAI,YAAY,gBAAgB,SAAY,CAAC,IAAI,EAAE,aAAa,WAAW,YAAY;AAAA,IACvF,SAAS,EAAE,UAAU,YAAY,MAAM,KAAK;AAAA,IAC5C;AAAA,IACA,WAAW,KAAK;AAAA,IAChB,gBAAgB,KAAK;AAAA,EACvB,CAAC;AACD,MAAI,CAAC,OAAO,GAAI,OAAM,IAAI,MAAM,OAAO,SAAS,iCAAiC;AACjF,SAAO,OAAO,WAAW,SAAY,kBAAkB,MAAM,IAAI,OAAO;AAC1E;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as C}from"./embed-page-chunk-
|
|
1
|
+
import{l as C}from"./embed-page-chunk-3VIEL6KL.js";import"./embed-page-chunk-YAJUWBF2.js";import"./embed-page-chunk-QGAGZMX2.js";import"./embed-page-chunk-SX7YO5JA.js";import"./embed-page-chunk-2U4LKIE3.js";import"./embed-page-chunk-3WRJEEZS.js";import"./embed-page-chunk-S4XZPBRM.js";import"./embed-page-chunk-QCKYIPFY.js";import{Ba as T,nb as B}from"./embed-page-chunk-MFFCCHGW.js";import{y as P}from"./embed-page-chunk-T7XXE35M.js";import{a as I}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-6KCBXVIT.js";import{U as c,W as p,oa as D,va as b,xa as l}from"./embed-page-chunk-FZRTVFHF.js";import{a as U}from"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{e as u}from"./embed-page-chunk-6Y3UYJ6Z.js";var e=u(U());var t=u(I()),G={component_key:"workspace_assistants",data:{},message:"Assistants"},N=r=>{let i=r;if(typeof r=="string")try{i=JSON.parse(r)}catch{return{}}return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{}},H=({data:r})=>{let{assistantId:i,initialTab:F}=r??{},{get:m,put:f,del:A}=P(),y=T(),[g,w]=(0,e.useState)(null),[R,h]=(0,e.useState)([]),[E,v]=(0,e.useState)(!1),[L,S]=(0,e.useState)(null),d=(0,e.useCallback)(()=>{y(G)},[y]),a=(0,e.useCallback)(async()=>{v(!0),S(null);try{let s=(await m("/api/assistants")).data?.records??[];h(s),w(s.find(o=>o.id===i)??null)}catch{S("Failed to load agent")}finally{v(!1)}},[m,i]);(0,e.useEffect)(()=>{i&&a()},[a,i]);let _=(0,e.useCallback)(async(n,s)=>{let o=N(n.graphDefinition),k;try{k=await f(`/api/assistants/${n.id}`,{name:s.name!==void 0?s.name:n.name,description:s.description!==void 0?s.description:n.description,graphDefinition:{...o,...s}})}catch(z){throw l.error("Failed to save agent"),z}if(!k.success)throw l.error("Failed to save agent"),new Error("Failed to save agent");l.success("Saved"),await a()},[f,a]),j=(0,e.useCallback)(n=>{w(s=>s&&s.id===n.id?n:s),h(s=>s.map(o=>o.id===n.id?n:o))},[]),x=(0,e.useCallback)(async n=>{if(!(await A(`/api/assistants/${n}`)).success)throw new Error("Failed to delete agent");l.success("Agent deleted"),d()},[A,d]);return i?g?(0,t.jsx)("div",{style:{height:"100%",overflow:"auto"},children:(0,t.jsx)(B,{children:(0,t.jsx)(C,{assistant:g,allAssistants:R,onBack:d,onDeleted:x,onSave:_,onAssistantUpdated:j,onAgentListInvalidated:()=>void a(),initialTab:F})},g.id)}):E?(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,t.jsx)(b,{})}):L?(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(c,{type:"error",showIcon:!0,message:"Failed to load agent","data-testid":"detail-error",action:(0,t.jsxs)(D,{children:[(0,t.jsx)(p,{size:"small",onClick:()=>void a(),children:"Retry"}),(0,t.jsx)(p,{size:"small",type:"primary",onClick:d,children:"Back to list"})]})})}):(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(c,{type:"warning",showIcon:!0,message:"Agent not found","data-testid":"detail-not-found",action:(0,t.jsx)(p,{size:"small",type:"primary",onClick:d,children:"Back to list"})})}):(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(c,{type:"warning",showIcon:!0,message:"Missing agent id","data-testid":"detail-missing-id"})})};export{H as AgentDetailSideApp};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Re,b as Ne,c as Dt,d as Rt,e as Pt,f as Ft,g as Mt,h as Et,i as Nt,j as Lt,k as Bt,l as Ot}from"./embed-page-chunk-
|
|
1
|
+
import{a as Re,b as Ne,c as Dt,d as Rt,e as Pt,f as Ft,g as Mt,h as Et,i as Nt,j as Lt,k as Bt,l as Ot}from"./embed-page-chunk-3VIEL6KL.js";import"./embed-page-chunk-YAJUWBF2.js";import{a as Ue}from"./embed-page-chunk-QGAGZMX2.js";import"./embed-page-chunk-SX7YO5JA.js";import"./embed-page-chunk-2U4LKIE3.js";import{b as Ge,e as ze,f as xt,g as wt,h as vt,i as kt,l as St,m as It}from"./embed-page-chunk-3WRJEEZS.js";import{a as ft,b as yt,c as ht,d as bt,e as At}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import"./embed-page-chunk-QCKYIPFY.js";import{$ as ct,Aa as ut,Ba as Ct,C as st,F as it,L as lt,Ma as Ve,X as dt,g as De,ka as pt,nb as Tt,ra as mt,s as rt,sa as gt}from"./embed-page-chunk-MFFCCHGW.js";import{t as et,y as ye}from"./embed-page-chunk-T7XXE35M.js";import{a as M}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-6KCBXVIT.js";import{$b as Ee,Cb as nt,Fa as Qe,Ia as Te,Ja as Xe,La as X,Ua as tt,W as J,_ as Se,aa as Ie,ea as Me,ka as Ke,la as Ze,lc as at,ma as Je,oa as Ye,ra as R,ta as V,wa as _e,xa as v,xc as ot,ya as fe}from"./embed-page-chunk-FZRTVFHF.js";import{a as ue}from"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{e as x}from"./embed-page-chunk-6Y3UYJ6Z.js";var u=x(ue());var te=x(ue());var Y=x(ue());var $t=x(ue());var ie=x(M()),Kt=60,_t=72,je=(0,$t.memo)(({data:n})=>{let r=Re(n.type),p=Math.min(12+Math.sqrt(n.subAgentCount)*10,48);return(0,ie.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,ie.jsx)(ze,{type:"target",position:Ge.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:0,height:0},isConnectable:!1}),(0,ie.jsx)("div",{title:n.label,style:{width:p,height:p,borderRadius:"50%",background:Ne(r.color),display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:Math.max(10,p*.4),fontWeight:600,cursor:"pointer",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:n.label.charAt(0).toUpperCase()}),(0,ie.jsx)("div",{style:{fontSize:11,maxWidth:120,textAlign:"center",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:4},children:n.label}),(0,ie.jsx)(ze,{type:"source",position:Ge.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:0,height:0},isConnectable:!1})]})});je.displayName="AgentGraphNode";var ee=x(M()),sn=({assistants:n,onNodeClick:r})=>{let[p,l,g]=vt([]),[o,f,k]=kt([]),[d,S]=(0,Y.useState)(null),H=(0,Y.useMemo)(()=>({agent:je}),[]),m=(0,Y.useMemo)(()=>Pt(n),[n]);(0,Y.useEffect)(()=>{let w=m.nodes.map(i=>({id:i.id})),P=m.edges.map(i=>({source:i.source,target:i.target})),N=new Map(m.nodes.map(i=>[i.id,i])),z=bt(w).force("link",ht(P).id(i=>i.id).distance(80)).force("charge",At().strength(-220)).force("center",ft(0,0)).force("collide",yt(45)).stop();for(let i=0;i<300;i++)z.tick();let F=w.map(i=>({id:i.id,type:"agent",data:N.get(i.id),position:{x:i.x-Kt/2,y:i.y-_t/2}})),s=m.edges.map(i=>({id:`e${i.source}-${i.target}`,source:i.source,target:i.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"}));l(F),f(s)},[m,l,f]);let T=(0,Y.useMemo)(()=>d===null?p:p.map(w=>{let P=w.id===d||o.some(N=>N.source===d&&N.target===w.id||N.target===d&&N.source===w.id);return{...w,style:{opacity:P?1:.2,transition:"opacity 0.2s ease"}}}),[p,o,d]),K=(0,Y.useMemo)(()=>d===null?o.map(w=>({...w,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):o.map(w=>{let P=w.source===d||w.target===d;return{...w,style:{stroke:"#1677ff",strokeWidth:P?2.5:1,opacity:P?1:.04,transition:"opacity 0.2s ease"}}}),[o,d]);return(0,ee.jsx)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:(0,ee.jsxs)(wt,{nodes:T,edges:K,onNodesChange:g,onEdgesChange:k,onNodeMouseEnter:(w,P)=>S(P.id),onNodeMouseLeave:()=>S(null),onNodeClick:(w,P)=>r?.(String(P.id)),nodeTypes:H,fitView:!0,fitViewOptions:{padding:.25},children:[(0,ee.jsx)(St,{color:"#eee",gap:20}),(0,ee.jsx)(It,{})]})})},Vt=n=>(0,ee.jsx)(xt,{children:(0,ee.jsx)(sn,{...n})});var E=x(M()),ln=n=>{if(!n)return"\u2014";let r=Date.now()-new Date(n).getTime(),p=Math.floor(r/6e4);if(p<1)return"just now";if(p<60)return`${p}m ago`;let l=Math.floor(p/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`},dn=n=>n===null?"#d9d9d9":n>=80?"#22c55e":n>=50?"#f59e0b":"#ef4444",cn=mt(({css:n})=>({row:n`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: space-between;
|
|
4
4
|
align-items: flex-end;
|
package/dist/embed/{embed-page-MessageGraph-H3HPZKOH.js → embed-page-MessageGraph-XQWKYDUB.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as W,d as V}from"./embed-page-chunk-2U4LKIE3.js";import{b as N,d as U,e as k}from"./embed-page-chunk-3WRJEEZS.js";import"./embed-page-chunk-S4XZPBRM.js";import{Da as b,Fa as z,Ga as F,Ha as H,Ia as L,Sa as R,Ta as $,Ua as J}from"./embed-page-chunk-
|
|
1
|
+
import{c as W,d as V}from"./embed-page-chunk-2U4LKIE3.js";import{b as N,d as U,e as k}from"./embed-page-chunk-3WRJEEZS.js";import"./embed-page-chunk-S4XZPBRM.js";import{Da as b,Fa as z,Ga as F,Ha as H,Ia as L,Sa as R,Ta as $,Ua as J}from"./embed-page-chunk-MFFCCHGW.js";import"./embed-page-chunk-T7XXE35M.js";import{a as g}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-6KCBXVIT.js";import{Cc as D,Ia as O,Qc as G,Rc as w,Uc as _,W as v,aa as M,fb as P,kb as B,mc as E}from"./embed-page-chunk-FZRTVFHF.js";import{a as C}from"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{e as p}from"./embed-page-chunk-6Y3UYJ6Z.js";var s=p(C());var S=p(C());var o=p(g());var se="tracePulse 1.4s ease-in-out infinite",ie={running:(0,o.jsx)(E,{style:{color:"#1890ff"}}),success:(0,o.jsx)(P,{style:{color:"#52c41a"}}),error:(0,o.jsx)(B,{style:{color:"#ff4d4f"}})};function ae({kind:e}){switch(e){case"human":return(0,o.jsx)(_,{});case"agent":return(0,o.jsx)(G,{});case"tool":return(0,o.jsx)(w,{});case"ai":return(0,o.jsx)(D,{});default:return(0,o.jsx)(w,{})}}var I=S.default.createContext({}),le=()=>S.default.useContext(I),de=({data:e,selected:i})=>{let{onJumpToMessage:a}=le(),t=e.isAnswer===!0,r=e.status==="running",d=(e.parallelCount??1)>1,m=!!(a&&e.messageId&&!e.messageId.startsWith("summary:")),f=e.toolCall?F(e.toolCall.name):e.label,y=()=>{if((e.kind==="tool"||e.kind==="agent")&&e.toolCall){let h=H(e.toolCall.response);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(z,{data:{name:e.toolCall.name,parameters:e.toolCall.args,type:"tool_call"},component_key:`${e.toolCall.id}-params`,interactive:!1}),h&&(0,o.jsx)("div",{style:{marginTop:8},children:(0,o.jsx)(b,{content:h})}),(0,o.jsx)(L,{ui:e.toolCall.ui})]})}return e.content?(0,o.jsx)(b,{content:e.content}):(0,o.jsx)("span",{style:{color:"#8c8c8c"},children:e.label})};return(0,o.jsxs)("div",{"data-testid":"trace-card",style:{height:"100%",display:"flex",flexDirection:"column",border:`1px solid ${t||i?"#6366f1":r?"#91caff":"#e5e7eb"}`,borderRadius:12,background:t?"#eef2ff":"#fff",boxShadow:r?"0 0 0 2px rgba(24,144,255,0.18)":i?"0 0 0 2px rgba(99,102,241,0.2)":"none",animation:r?se:void 0,overflow:"hidden",fontSize:13},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid #f0f0f0",background:"rgba(0,0,0,0.02)"},children:[(0,o.jsx)(ae,{kind:e.kind}),(0,o.jsx)("span",{style:{fontWeight:t?700:600,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f}),d&&(0,o.jsxs)(O,{color:"purple",style:{marginInlineEnd:0,fontSize:10},children:["\u5E76\u53D1 \xD7",e.parallelCount]}),ie[e.status],m&&(0,o.jsx)(v,{type:"text",size:"small",onClick:()=>a?.(e.messageId),children:"\u5BF9\u8BDD"})]}),(0,o.jsx)("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:12},children:y()})]})},ce=({data:e,selected:i})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(k,{type:"target",position:N.Top}),(0,o.jsx)(de,{data:e,selected:i}),(0,o.jsx)(k,{type:"source",position:N.Bottom})]}),K={trace:ce};var Y=p(C());var u=p(g()),pe={running:"#1890ff",success:"#52c41a",error:"#ff4d4f"},Z=({graph:e,activeNodeId:i,onSelectNode:a})=>{let t=Y.default.useMemo(()=>new Map(e.nodes.map(r=>[r.id,r])),[e.nodes]);return(0,u.jsx)("div",{"data-testid":"trace-overview-rail",style:{display:"flex",flexDirection:"column",gap:10,width:160,padding:8,overflowY:"auto",borderRight:"1px solid #f0f0f0"},children:e.phases.map(r=>(0,u.jsxs)("div",{"data-testid":"trace-rail-phase",children:[(0,u.jsx)("div",{style:{fontSize:12,color:"#8c8c8c",marginBottom:4},children:r.title}),(0,u.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:r.nodeIds.map(d=>{let m=t.get(d);if(!m)return null;let f=d===i;return(0,u.jsx)(M,{title:m.data.label,children:(0,u.jsx)("button",{type:"button","data-testid":"trace-rail-tick",onClick:()=>a?.(d),style:{width:f?12:8,height:f?12:8,borderRadius:"50%",border:"none",padding:0,cursor:"pointer",background:pe[m.data.status],outline:f?"2px solid #6366f1":"none"}})},d)})})]},r.id))})};var l=p(g()),j=3,q=()=>{},fe=`
|
|
2
2
|
@keyframes tracePulse {
|
|
3
3
|
0%, 100% { box-shadow: 0 0 0 2px rgba(24,144,255,0.18); }
|
|
4
4
|
50% { box-shadow: 0 0 0 6px rgba(24,144,255,0.05); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as C}from"./embed-page-chunk-OOZDPBUK.js";import{Ca as v}from"./embed-page-chunk-
|
|
1
|
+
import{s as C}from"./embed-page-chunk-OOZDPBUK.js";import{Ca as v}from"./embed-page-chunk-MFFCCHGW.js";import{h as w}from"./embed-page-chunk-T7XXE35M.js";import{a as x}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-6KCBXVIT.js";import{ga as b}from"./embed-page-chunk-FZRTVFHF.js";import{a as D}from"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{e as d}from"./embed-page-chunk-6Y3UYJ6Z.js";var c=d(D());var E=d(w());var f=d(x());function p(s){if(!s||s.length===0)return{title:{text:"Chart",left:"left"},tooltip:{trigger:"axis"},legend:{right:0,orient:"vertical"},xAxis:{type:"category",data:[]},yAxis:{type:"value"},series:[{type:"line",name:"Series 1",data:[]}],grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}};let i=s[0],t=Object.keys(i);if(t.length===0)return p([]);let r=t.filter(e=>{let n=i[e];return typeof n=="number"||!isNaN(Number(n))});if(r.length>0){let e=r[0],n=t.find(a=>!r.includes(a))||t[0],o=s.map((a,l)=>a[n]!==void 0?String(a[n]):`Item ${l+1}`),u=s.map(a=>{let l=a[e];return typeof l=="number"?l:Number(l)||0});return{title:{text:"Chart",left:"left"},tooltip:{trigger:"axis"},legend:{right:0,orient:"vertical",data:[e]},xAxis:{type:"category",data:o},yAxis:{type:"value"},series:[{type:"line",name:e,data:u}],grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}}}return{title:{text:"Chart",left:"left"},tooltip:{trigger:"axis"},legend:{right:0,orient:"vertical"},xAxis:{type:"category",data:s.map((e,n)=>`Item ${n+1}`)},yAxis:{type:"value"},series:[{type:"bar",name:"Count",data:s.map(()=>1)}],grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}}}function S(s){if(!s||typeof s!="object"||!s.series||!Array.isArray(s.series)||s.series.length===0)return null;let i=s.series.map((e,n)=>{if(!e||typeof e!="object"||!e.type||!e.data||!Array.isArray(e.data)||e.data.length===0)return null;let o={...e,name:e.name||`Series ${n+1}`};if(e.type==="pie"){let u=e.data.map((a,l)=>typeof a=="object"&&a!==null&&"value"in a?{value:a.value,name:a.name||`Item ${l+1}`}:typeof a=="number"?{value:a,name:`Item ${l+1}`}:null).filter(a=>a!==null);return u.length===0?null:{...o,data:u}}return o}).filter(e=>e!==null);if(i.length===0)return null;let t={...s,series:i},r=i[0].type;if(r!=="pie"){if(!t.xAxis)t.xAxis={type:"category",data:[]};else if(typeof t.xAxis=="object"&&!Array.isArray(t.xAxis)){let e=t.xAxis;if(e.type||(e.type="category"),e.type==="category"&&!e.data){let n=i[0].data;Array.isArray(n)&&n.length>0?Array.isArray(n[0])?e.data=n.map(o=>o[0]):e.data=n.map((o,u)=>`Item ${u+1}`):e.data=[]}t.xAxis=e}t.yAxis?typeof t.yAxis=="object"&&!Array.isArray(t.yAxis)&&(t.yAxis.type||(t.yAxis.type="value")):t.yAxis={type:"value"}}if(!t.title)t.title={text:"Chart",left:"left"};else if(typeof t.title=="object"){let e=t.title;e.left||(e.left="left"),e.text||(e.text="Chart"),t.title=e}if(t.tooltip||(t.tooltip={trigger:r==="pie"?"item":"axis"}),!t.legend)i.length>1&&(t.legend={right:0,orient:"vertical"});else if(typeof t.legend=="object"){let e=t.legend;t.legend=e}return r!=="pie"&&!t.grid&&(t.grid={left:"3%",right:"4%",bottom:"3%",containLabel:!0}),t}function j(s){let i=null;try{let n=typeof s=="string"?s:s.join("");i=(0,E.parse)(n)}catch(n){return{data:null,error:`Failed to parse JSON: ${n instanceof Error?n.message:String(n)}`}}if(!i||typeof i!="object")return{data:null,error:"Parsed data is not an object"};let t=i.series&&Array.isArray(i.series)&&i.series.length>0,r={table:Array.isArray(i.table)?i.table:void 0},e=null;if(i.echarts?e=i.echarts:t&&(e=i),e){let n=S(e);if(n)r.echarts=n;else if(r.table&&r.table.length>0)r.echarts=p(r.table);else return{data:null,error:"ECharts configuration is invalid or incomplete. Required: series array with at least one series containing type and data."}}else r.table&&r.table.length>0?r.echarts=p(r.table):r.echarts=p([]);return{data:r,error:null}}var T=s=>{let{children:i}=s,t=(0,c.useRef)(null),r=(0,c.useRef)(null),e=(0,c.useRef)(null),[n,o]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!t.current)return;r.current||(r.current=C(t.current));let a=null;if((typeof i=="string"||Array.isArray(i))&&(a=i),!a){r.current&&r.current.clear(),o(null);return}let{data:l,error:g}=j(a);if(g||!l){console.warn("ReactChart failed to parse chart data:",g||"Unknown parse error"),r.current&&r.current.clear(),o(null);return}if(l.table&&Array.isArray(l.table)&&o(l.table),l.echarts)try{r.current.setOption(l.echarts,!0)}catch(h){let m=h instanceof Error?h.message:"Failed to render chart";console.error("Failed to set ECharts option:",h),r.current&&r.current.clear(),o(null)}let y=()=>{r.current&&r.current.resize()};return e.current&&(e.current.disconnect(),e.current=null),t.current&&typeof ResizeObserver<"u"&&(e.current=new ResizeObserver(h=>{requestAnimationFrame(()=>{y()})}),e.current.observe(t.current)),window.addEventListener("resize",y),()=>{e.current&&(e.current.disconnect(),e.current=null),window.removeEventListener("resize",y)}},[i]),(0,c.useEffect)(()=>()=>{e.current&&(e.current.disconnect(),e.current=null),r.current&&(r.current.dispose(),r.current=null)},[]);let u=a=>{if(!a||a.length===0)return[];if(Array.isArray(a[0])){let l=a[0];return a.slice(1).map((y,h)=>{let m={};return y.forEach((R,A)=>{m[l[A]||`col_${A}`]=R}),m})}return a};return(0,f.jsxs)(b,{children:[(0,f.jsx)("div",{ref:t,style:{width:"100%",height:"400px",minHeight:"300px"}}),n&&n.length>0&&(0,f.jsx)("div",{style:{marginTop:16},children:(0,f.jsx)(v,{component_key:"chart_table_data",data:{dataSource:u(n),message:"Data Details"},interactive:!0,default_open_in_side_app:!0})})]})};export{T as ReactChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as J,c as me,e as Q,f as Se,g as he,h as xe,i as ke,l as ve,m as be}from"./embed-page-chunk-3WRJEEZS.js";import{a as pe,b as ye,c as ge,d as fe,e as ue}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import{t as le,x as ne,y as U,z as Te}from"./embed-page-chunk-7ZBZKXBU.js";import{a as _}from"./embed-page-chunk-MB65DZAX.js";import{Ia as D,Ja as j,La as ie,Sb as de,W as k,ab as ae,ec as ce,ka as te,oa as I,pb as re,qb as se,ta as N,xa as T,xc as K,ya as oe}from"./embed-page-chunk-FZRTVFHF.js";import{a as ee}from"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-EUOOO2LS.js";import{e as B}from"./embed-page-chunk-6Y3UYJ6Z.js";var S=B(ee());var m=B(ee());var e=B(_()),{Text:d}=ie,{TextArea:Ce}=N,Me=({data:v})=>{let{token:o}=j.useToken(),{config:C}=ne(),{put:V}=U(),R=me(t=>t.transform[2])>.6,q=le("__GLOBAL__");if(!v)return null;let{skill:g,onClick:F,onDelete:h}=v;if(!g)return null;let[i,A]=(0,m.useState)(g),O=i.subSkills&&i.subSkills.length>0,f=i.subSkills?.length||0,E=(0,m.useMemo)(()=>Math.min(12+Math.sqrt(f)*10,48),[f]),Y=i.metadata&&i.metadata.category||"global",b=(0,m.useMemo)(()=>i.metadata?Object.entries(i.metadata).filter(([t,n])=>t&&n):[],[i.metadata]),L=t=>{if(!t)return"";let n=t instanceof Date?t:new Date(t);return Number.isNaN(n.getTime())?"":n.toLocaleString()},G=t=>{navigator.clipboard.writeText(t)},[z,x]=(0,m.useState)(!1),[c,a]=(0,m.useState)({...g,id:g.name}),[s,u]=(0,m.useState)(b.map(([t,n])=>({key:t,value:n}))),[W,M]=(0,m.useState)(!1),[X,P]=(0,m.useState)(!1);(0,m.useEffect)(()=>{x(!1),A(g),a({...g,id:g.name}),u(Object.entries(g.metadata||{}).map(([t,n])=>({key:t,value:n})))},[g]);let l=(t,n)=>{if(t==="name"){a(r=>({...r,name:n,id:n}));return}a(r=>({...r,[t]:n}))},$=async t=>{t?.stopPropagation(),t?.preventDefault();try{let n=i.id||i.name;if(!n){T.error("Skill ID is missing");return}await q.skills.delete(n),T.success("Skill deleted successfully"),M(!1),h&&await h()}catch(n){T.error(n?.message||"An error occurred while deleting the skill")}},H=t=>{u(t);let n=t.reduce((r,p)=>(p.key&&(r[p.key]=p.value),r),{});a(r=>({...r,metadata:n}))},Z=(t,n,r)=>{let p=[...s];p[t]={...p[t],[n]:r},H(p)},ze=()=>{H([...s,{key:"",value:""}])},Be=async()=>{try{P(!0);let t={"Content-Type":"application/json"};C.apiKey&&(t.Authorization=`Bearer ${C.apiKey}`);let n={name:c.name,description:c.description,license:c.license||void 0,compatibility:c.compatibility||void 0,metadata:c.metadata||void 0,content:c.content||void 0,subSkills:c.subSkills||void 0},r=await V(`/api/skills/${i.id}`,n);if(r.success){T.success("Skill updated successfully");let p=r.data||c;A(p),a({...p,id:p.name}),u(Object.entries(p.metadata||{}).map(([Re,Ee])=>({key:Re,value:Ee}))),x(!1),F?.(p)}else T.error(r.message||"Failed to update skill")}catch(t){T.error(t.message||"An error occurred while updating the skill")}finally{P(!1)}},Ie=(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"row",gap:24},children:[(0,e.jsxs)("div",{style:{flex:"0 0 320px",display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:"Description"}),(0,e.jsx)(Ce,{value:c.description,onChange:t=>l("description",t.target.value),placeholder:"Description",rows:3})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:"License"}),(0,e.jsx)(N,{value:c.license,onChange:t=>l("license",t.target.value),placeholder:"License"})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:"Compatibility"}),(0,e.jsx)(N,{value:c.compatibility,onChange:t=>l("compatibility",t.target.value),placeholder:"Compatibility"})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:"Metadata"}),(0,e.jsx)(k,{size:"small",icon:(0,e.jsx)(K,{}),onClick:ze,children:"Add"})]}),(0,e.jsxs)(I,{direction:"vertical",size:8,style:{width:"100%"},children:[s.length===0&&(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary},children:"No metadata yet. Use Add to create one."}),s.map((t,n)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextSecondary},children:["Meta ",n+1]}),(0,e.jsxs)(I,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(N,{value:t.key,placeholder:"Key",style:{width:120},onChange:r=>Z(n,"key",r.target.value)}),(0,e.jsx)(N,{value:t.value,placeholder:"Value",style:{flex:1,minWidth:160},onChange:r=>Z(n,"value",r.target.value)})]})]},n))]})]}),(0,e.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6,minWidth:400},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:"Content"}),(0,e.jsx)(Ce,{value:c.content,onChange:t=>l("content",t.target.value),placeholder:"Enter skill content here...",rows:30,style:{fontFamily:"monospace",fontSize:13,flex:1,minHeight:600}})]})]}),Ne=(0,e.jsxs)("div",{style:{width:z?960:720,maxHeight:"95vh",overflowY:"auto",padding:24},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:16},children:(0,e.jsxs)("div",{style:{flex:1},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(d,{strong:!0,style:{fontSize:18,fontWeight:600,color:o.colorText},children:i.name}),(0,e.jsx)(D,{style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},color:"geekblue",children:Y.toUpperCase()})]}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6},children:(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:`>_ ${i.id}`})})]})}),z?Ie:(0,e.jsxs)(e.Fragment,{children:[i.description&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.6,fontStyle:"italic"},children:['"',i.description,'"']})}),b.length>0&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(ce,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:["Metadata (",b.length,")"]})]}),(0,e.jsx)("div",{style:{border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,overflow:"hidden"},children:b.map(([t,n],r)=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"stretch",borderBottom:r===b.length-1?"none":`1px solid ${o.colorBorderSecondary}`},children:[(0,e.jsx)("div",{style:{width:140,padding:"8px 10px",background:o.colorFillTertiary,borderRight:`1px solid ${o.colorBorderSecondary}`,fontSize:11,color:o.colorTextSecondary,fontWeight:600,textTransform:"capitalize"},children:t}),(0,e.jsx)("div",{style:{flex:1,padding:"8px 10px",fontSize:11,color:o.colorText,wordBreak:"break-word"},children:n})]},t))})]}),O&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(ae,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:["Sub-Skills (",i.subSkills.length,")"]})]}),(0,e.jsx)(I,{size:[8,8],wrap:!0,children:i.subSkills.map((t,n)=>(0,e.jsx)(D,{style:{fontSize:11,padding:"4px 12px",backgroundColor:o.colorFillTertiary,color:o.colorText,border:`1px solid ${o.colorBorderSecondary}`},children:t},n))})]}),(i.license||i.compatibility)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(I,{size:[8,8],wrap:!0,children:[i.license&&(0,e.jsx)(D,{icon:(0,e.jsx)(se,{}),style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorInfoBg,color:o.colorInfo,border:`1px solid ${o.colorInfoBorder}`,fontWeight:500,lineHeight:"16px"},children:i.license}),i.compatibility&&(0,e.jsx)(D,{style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorSuccessBg,color:o.colorSuccess,border:`1px solid ${o.colorSuccessBorder}`,fontWeight:500,lineHeight:"16px",display:"inline-flex",alignItems:"center",gap:4},children:i.compatibility})]})}),(i.createdAt||i.updatedAt)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(I,{direction:"vertical",size:4,children:[i.createdAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Created: ",L(i.createdAt)]}),i.updatedAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Updated: ",L(i.updatedAt)]})]})}),i.content&&(0,e.jsxs)("div",{style:{marginBottom:0},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(de,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:"CONTENT"})]}),(0,e.jsx)("div",{style:{padding:16,background:o.colorFillTertiary,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,maxHeight:400,overflowY:"auto"},children:(0,e.jsx)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.7,whiteSpace:"pre-wrap",fontFamily:"monospace"},children:i.content})})]})]}),(0,e.jsx)(te,{style:{margin:"16px 0"}}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:z?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(k,{block:!0,onClick:()=>{x(!1),a(g)},style:{flex:1},children:"Cancel"}),(0,e.jsx)(k,{type:"primary",block:!0,onClick:Be,loading:X,style:{flex:1},children:"Save"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(k,{type:"primary",block:!0,onClick:()=>x(!0),style:{flex:1},children:"Edit Skill"}),(0,e.jsx)(k,{danger:!0,onClick:t=>{t.stopPropagation(),$(t)},children:"Delete"}),(0,e.jsx)(k,{icon:(0,e.jsx)(re,{}),onClick:()=>G(i.id),title:"Copy ID"})]})})]});return(0,e.jsxs)("div",{style:{position:"relative",padding:4,overflow:"visible"},children:[(0,e.jsx)(Q,{type:"source",position:J.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsx)(Q,{type:"target",position:J.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",position:"relative"},onClick:()=>M(!0),children:[(0,e.jsx)("div",{style:{width:E,height:E,borderRadius:"50%",background:"#999",flexShrink:0,boxShadow:"0 1px 4px rgba(0,0,0,0.15)",transition:"transform 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.transform="scale(1.15)"},onMouseLeave:t=>{t.currentTarget.style.transform="scale(1)"}}),R&&(0,e.jsx)(d,{style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:4,fontSize:10,color:o.colorTextSecondary,opacity:.45,whiteSpace:"nowrap",pointerEvents:"none",userSelect:"none"},children:i.name})]}),(0,e.jsx)(oe,{open:W,onCancel:()=>{M(!1),x(!1),a({...i,id:i.name})},footer:null,width:z?1e3:760,destroyOnClose:!0,title:null,styles:{body:{padding:0}},children:Ne})]})},we=Me;var y=B(_()),De=({onNodeClick:v})=>{let[o,C,V]=xe([]),[w,R,q]=ke([]),[g,F]=(0,S.useState)(!1),[h,i]=(0,S.useState)([]),[A,O]=(0,S.useState)(!1),[f,E]=(0,S.useState)(null),{token:Y}=j.useToken(),{get:b}=U(),L=(0,S.useMemo)(()=>({skill:we}),[]),G=(0,S.useMemo)(()=>f===null?o:o.map(a=>{let s=a.id===f||w.some(u=>u.source===f&&u.target===a.id||u.target===f&&u.source===a.id);return{...a,style:{opacity:s?1:.2,transition:"opacity 0.2s ease"}}}),[o,w,f]),z=(0,S.useMemo)(()=>f===null?w.map(a=>({...a,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):w.map(a=>{let s=a.source===f||a.target===f;return{...a,style:{stroke:"#1677ff",strokeWidth:s?2.5:1,opacity:s?1:.04,transition:"opacity 0.2s ease"}}}),[w,f]),x=async()=>{O(!0);try{let a=await b("/api/skills");a.success&&a.data&&Array.isArray(a.data.records)&&i(a.data.records)}catch(a){console.error("Failed to fetch skills:",a),i([])}finally{O(!1)}};(0,S.useEffect)(()=>{x()},[]),(0,S.useEffect)(()=>{if(!h||h.length===0){C([]),R([]);return}let a=[],s=new Map,u=[];h.forEach(l=>{s.set(l.name,l),l.subSkills&&l.subSkills.length>0&&l.subSkills.forEach($=>{h.find(H=>H.name===$)&&u.push({source:l.name,target:$})})});let W=h.map(l=>({id:l.name})),M=u.map(l=>({source:l.source,target:l.target})),X=fe(W).force("link",ge(M).id(l=>l.id).distance(80)).force("charge",ue().strength(-300)).force("center",pe(0,0)).force("collide",ye(30)).stop();for(let l=0;l<300;l++)X.tick();let P=W.map(l=>({id:l.id,type:"skill",data:{skill:s.get(l.id),onClick:()=>v?.(s.get(l.id)),onDelete:x},position:{x:l.x,y:l.y}}));u.forEach(l=>{s.has(l.source)&&s.has(l.target)&&a.push({id:`e${l.source}-${l.target}`,source:l.source,target:l.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"})}),C(P),R(a)},[h,C,R,v]);let c=async()=>{await x()};return A?(0,y.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:"Loading skills..."}):(0,y.jsxs)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:[(0,y.jsxs)(he,{nodes:G,edges:z,onNodesChange:V,onEdgesChange:q,onNodeMouseEnter:(a,s)=>E(s.id),onNodeMouseLeave:()=>E(null),nodeTypes:L,fitView:!0,children:[(0,y.jsx)(ve,{color:"#eee",gap:20}),(0,y.jsx)(be,{})]}),(0,y.jsx)("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:(0,y.jsx)(k,{type:"primary",size:"large",icon:(0,y.jsx)(K,{}),onClick:()=>F(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:Y.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})}),(0,y.jsx)(Te,{open:g,onCancel:()=>F(!1),onSuccess:c})]})},Fe=v=>(0,y.jsx)(Se,{children:(0,y.jsx)(De,{...v})}),it=Fe;export{it as default};
|
|
1
|
+
import{b as J,c as me,e as Q,f as Se,g as he,h as xe,i as ke,l as ve,m as be}from"./embed-page-chunk-3WRJEEZS.js";import{a as pe,b as ye,c as ge,d as fe,e as ue}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import{t as le,x as ne,y as U,z as Te}from"./embed-page-chunk-T7XXE35M.js";import{a as _}from"./embed-page-chunk-MB65DZAX.js";import{Ia as D,Ja as j,La as ie,Sb as de,W as k,ab as ae,ec as ce,ka as te,oa as I,pb as re,qb as se,ta as N,xa as T,xc as K,ya as oe}from"./embed-page-chunk-FZRTVFHF.js";import{a as ee}from"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-EUOOO2LS.js";import{e as B}from"./embed-page-chunk-6Y3UYJ6Z.js";var S=B(ee());var m=B(ee());var e=B(_()),{Text:d}=ie,{TextArea:Ce}=N,Me=({data:v})=>{let{token:o}=j.useToken(),{config:C}=ne(),{put:V}=U(),R=me(t=>t.transform[2])>.6,q=le("__GLOBAL__");if(!v)return null;let{skill:g,onClick:F,onDelete:h}=v;if(!g)return null;let[i,A]=(0,m.useState)(g),O=i.subSkills&&i.subSkills.length>0,f=i.subSkills?.length||0,E=(0,m.useMemo)(()=>Math.min(12+Math.sqrt(f)*10,48),[f]),Y=i.metadata&&i.metadata.category||"global",b=(0,m.useMemo)(()=>i.metadata?Object.entries(i.metadata).filter(([t,n])=>t&&n):[],[i.metadata]),L=t=>{if(!t)return"";let n=t instanceof Date?t:new Date(t);return Number.isNaN(n.getTime())?"":n.toLocaleString()},G=t=>{navigator.clipboard.writeText(t)},[z,x]=(0,m.useState)(!1),[c,a]=(0,m.useState)({...g,id:g.name}),[s,u]=(0,m.useState)(b.map(([t,n])=>({key:t,value:n}))),[W,M]=(0,m.useState)(!1),[X,P]=(0,m.useState)(!1);(0,m.useEffect)(()=>{x(!1),A(g),a({...g,id:g.name}),u(Object.entries(g.metadata||{}).map(([t,n])=>({key:t,value:n})))},[g]);let l=(t,n)=>{if(t==="name"){a(r=>({...r,name:n,id:n}));return}a(r=>({...r,[t]:n}))},$=async t=>{t?.stopPropagation(),t?.preventDefault();try{let n=i.id||i.name;if(!n){T.error("Skill ID is missing");return}await q.skills.delete(n),T.success("Skill deleted successfully"),M(!1),h&&await h()}catch(n){T.error(n?.message||"An error occurred while deleting the skill")}},H=t=>{u(t);let n=t.reduce((r,p)=>(p.key&&(r[p.key]=p.value),r),{});a(r=>({...r,metadata:n}))},Z=(t,n,r)=>{let p=[...s];p[t]={...p[t],[n]:r},H(p)},ze=()=>{H([...s,{key:"",value:""}])},Be=async()=>{try{P(!0);let t={"Content-Type":"application/json"};C.apiKey&&(t.Authorization=`Bearer ${C.apiKey}`);let n={name:c.name,description:c.description,license:c.license||void 0,compatibility:c.compatibility||void 0,metadata:c.metadata||void 0,content:c.content||void 0,subSkills:c.subSkills||void 0},r=await V(`/api/skills/${i.id}`,n);if(r.success){T.success("Skill updated successfully");let p=r.data||c;A(p),a({...p,id:p.name}),u(Object.entries(p.metadata||{}).map(([Re,Ee])=>({key:Re,value:Ee}))),x(!1),F?.(p)}else T.error(r.message||"Failed to update skill")}catch(t){T.error(t.message||"An error occurred while updating the skill")}finally{P(!1)}},Ie=(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"row",gap:24},children:[(0,e.jsxs)("div",{style:{flex:"0 0 320px",display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:"Description"}),(0,e.jsx)(Ce,{value:c.description,onChange:t=>l("description",t.target.value),placeholder:"Description",rows:3})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:"License"}),(0,e.jsx)(N,{value:c.license,onChange:t=>l("license",t.target.value),placeholder:"License"})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:"Compatibility"}),(0,e.jsx)(N,{value:c.compatibility,onChange:t=>l("compatibility",t.target.value),placeholder:"Compatibility"})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:"Metadata"}),(0,e.jsx)(k,{size:"small",icon:(0,e.jsx)(K,{}),onClick:ze,children:"Add"})]}),(0,e.jsxs)(I,{direction:"vertical",size:8,style:{width:"100%"},children:[s.length===0&&(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary},children:"No metadata yet. Use Add to create one."}),s.map((t,n)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextSecondary},children:["Meta ",n+1]}),(0,e.jsxs)(I,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(N,{value:t.key,placeholder:"Key",style:{width:120},onChange:r=>Z(n,"key",r.target.value)}),(0,e.jsx)(N,{value:t.value,placeholder:"Value",style:{flex:1,minWidth:160},onChange:r=>Z(n,"value",r.target.value)})]})]},n))]})]}),(0,e.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6,minWidth:400},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:"Content"}),(0,e.jsx)(Ce,{value:c.content,onChange:t=>l("content",t.target.value),placeholder:"Enter skill content here...",rows:30,style:{fontFamily:"monospace",fontSize:13,flex:1,minHeight:600}})]})]}),Ne=(0,e.jsxs)("div",{style:{width:z?960:720,maxHeight:"95vh",overflowY:"auto",padding:24},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:16},children:(0,e.jsxs)("div",{style:{flex:1},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(d,{strong:!0,style:{fontSize:18,fontWeight:600,color:o.colorText},children:i.name}),(0,e.jsx)(D,{style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},color:"geekblue",children:Y.toUpperCase()})]}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6},children:(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:`>_ ${i.id}`})})]})}),z?Ie:(0,e.jsxs)(e.Fragment,{children:[i.description&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.6,fontStyle:"italic"},children:['"',i.description,'"']})}),b.length>0&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(ce,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:["Metadata (",b.length,")"]})]}),(0,e.jsx)("div",{style:{border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,overflow:"hidden"},children:b.map(([t,n],r)=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"stretch",borderBottom:r===b.length-1?"none":`1px solid ${o.colorBorderSecondary}`},children:[(0,e.jsx)("div",{style:{width:140,padding:"8px 10px",background:o.colorFillTertiary,borderRight:`1px solid ${o.colorBorderSecondary}`,fontSize:11,color:o.colorTextSecondary,fontWeight:600,textTransform:"capitalize"},children:t}),(0,e.jsx)("div",{style:{flex:1,padding:"8px 10px",fontSize:11,color:o.colorText,wordBreak:"break-word"},children:n})]},t))})]}),O&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(ae,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:["Sub-Skills (",i.subSkills.length,")"]})]}),(0,e.jsx)(I,{size:[8,8],wrap:!0,children:i.subSkills.map((t,n)=>(0,e.jsx)(D,{style:{fontSize:11,padding:"4px 12px",backgroundColor:o.colorFillTertiary,color:o.colorText,border:`1px solid ${o.colorBorderSecondary}`},children:t},n))})]}),(i.license||i.compatibility)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(I,{size:[8,8],wrap:!0,children:[i.license&&(0,e.jsx)(D,{icon:(0,e.jsx)(se,{}),style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorInfoBg,color:o.colorInfo,border:`1px solid ${o.colorInfoBorder}`,fontWeight:500,lineHeight:"16px"},children:i.license}),i.compatibility&&(0,e.jsx)(D,{style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorSuccessBg,color:o.colorSuccess,border:`1px solid ${o.colorSuccessBorder}`,fontWeight:500,lineHeight:"16px",display:"inline-flex",alignItems:"center",gap:4},children:i.compatibility})]})}),(i.createdAt||i.updatedAt)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(I,{direction:"vertical",size:4,children:[i.createdAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Created: ",L(i.createdAt)]}),i.updatedAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Updated: ",L(i.updatedAt)]})]})}),i.content&&(0,e.jsxs)("div",{style:{marginBottom:0},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(de,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:"CONTENT"})]}),(0,e.jsx)("div",{style:{padding:16,background:o.colorFillTertiary,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,maxHeight:400,overflowY:"auto"},children:(0,e.jsx)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.7,whiteSpace:"pre-wrap",fontFamily:"monospace"},children:i.content})})]})]}),(0,e.jsx)(te,{style:{margin:"16px 0"}}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:z?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(k,{block:!0,onClick:()=>{x(!1),a(g)},style:{flex:1},children:"Cancel"}),(0,e.jsx)(k,{type:"primary",block:!0,onClick:Be,loading:X,style:{flex:1},children:"Save"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(k,{type:"primary",block:!0,onClick:()=>x(!0),style:{flex:1},children:"Edit Skill"}),(0,e.jsx)(k,{danger:!0,onClick:t=>{t.stopPropagation(),$(t)},children:"Delete"}),(0,e.jsx)(k,{icon:(0,e.jsx)(re,{}),onClick:()=>G(i.id),title:"Copy ID"})]})})]});return(0,e.jsxs)("div",{style:{position:"relative",padding:4,overflow:"visible"},children:[(0,e.jsx)(Q,{type:"source",position:J.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsx)(Q,{type:"target",position:J.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",position:"relative"},onClick:()=>M(!0),children:[(0,e.jsx)("div",{style:{width:E,height:E,borderRadius:"50%",background:"#999",flexShrink:0,boxShadow:"0 1px 4px rgba(0,0,0,0.15)",transition:"transform 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.transform="scale(1.15)"},onMouseLeave:t=>{t.currentTarget.style.transform="scale(1)"}}),R&&(0,e.jsx)(d,{style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:4,fontSize:10,color:o.colorTextSecondary,opacity:.45,whiteSpace:"nowrap",pointerEvents:"none",userSelect:"none"},children:i.name})]}),(0,e.jsx)(oe,{open:W,onCancel:()=>{M(!1),x(!1),a({...i,id:i.name})},footer:null,width:z?1e3:760,destroyOnClose:!0,title:null,styles:{body:{padding:0}},children:Ne})]})},we=Me;var y=B(_()),De=({onNodeClick:v})=>{let[o,C,V]=xe([]),[w,R,q]=ke([]),[g,F]=(0,S.useState)(!1),[h,i]=(0,S.useState)([]),[A,O]=(0,S.useState)(!1),[f,E]=(0,S.useState)(null),{token:Y}=j.useToken(),{get:b}=U(),L=(0,S.useMemo)(()=>({skill:we}),[]),G=(0,S.useMemo)(()=>f===null?o:o.map(a=>{let s=a.id===f||w.some(u=>u.source===f&&u.target===a.id||u.target===f&&u.source===a.id);return{...a,style:{opacity:s?1:.2,transition:"opacity 0.2s ease"}}}),[o,w,f]),z=(0,S.useMemo)(()=>f===null?w.map(a=>({...a,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):w.map(a=>{let s=a.source===f||a.target===f;return{...a,style:{stroke:"#1677ff",strokeWidth:s?2.5:1,opacity:s?1:.04,transition:"opacity 0.2s ease"}}}),[w,f]),x=async()=>{O(!0);try{let a=await b("/api/skills");a.success&&a.data&&Array.isArray(a.data.records)&&i(a.data.records)}catch(a){console.error("Failed to fetch skills:",a),i([])}finally{O(!1)}};(0,S.useEffect)(()=>{x()},[]),(0,S.useEffect)(()=>{if(!h||h.length===0){C([]),R([]);return}let a=[],s=new Map,u=[];h.forEach(l=>{s.set(l.name,l),l.subSkills&&l.subSkills.length>0&&l.subSkills.forEach($=>{h.find(H=>H.name===$)&&u.push({source:l.name,target:$})})});let W=h.map(l=>({id:l.name})),M=u.map(l=>({source:l.source,target:l.target})),X=fe(W).force("link",ge(M).id(l=>l.id).distance(80)).force("charge",ue().strength(-300)).force("center",pe(0,0)).force("collide",ye(30)).stop();for(let l=0;l<300;l++)X.tick();let P=W.map(l=>({id:l.id,type:"skill",data:{skill:s.get(l.id),onClick:()=>v?.(s.get(l.id)),onDelete:x},position:{x:l.x,y:l.y}}));u.forEach(l=>{s.has(l.source)&&s.has(l.target)&&a.push({id:`e${l.source}-${l.target}`,source:l.source,target:l.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"})}),C(P),R(a)},[h,C,R,v]);let c=async()=>{await x()};return A?(0,y.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:"Loading skills..."}):(0,y.jsxs)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:[(0,y.jsxs)(he,{nodes:G,edges:z,onNodesChange:V,onEdgesChange:q,onNodeMouseEnter:(a,s)=>E(s.id),onNodeMouseLeave:()=>E(null),nodeTypes:L,fitView:!0,children:[(0,y.jsx)(ve,{color:"#eee",gap:20}),(0,y.jsx)(be,{})]}),(0,y.jsx)("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:(0,y.jsx)(k,{type:"primary",size:"large",icon:(0,y.jsx)(K,{}),onClick:()=>F(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:Y.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})}),(0,y.jsx)(Te,{open:g,onCancel:()=>F(!1),onSuccess:c})]})},Fe=v=>(0,y.jsx)(Se,{children:(0,y.jsx)(De,{...v})}),it=Fe;export{it as default};
|
package/dist/embed/{embed-page-TasksSideApp-QKEXMHCT.js → embed-page-TasksSideApp-SUMX2GJF.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Je}from"./embed-page-chunk-
|
|
1
|
+
import{a as Je}from"./embed-page-chunk-YAJUWBF2.js";import{c as Ge,d as We}from"./embed-page-chunk-2U4LKIE3.js";import{b as be,e as Ce,h as _e,i as Fe}from"./embed-page-chunk-3WRJEEZS.js";import"./embed-page-chunk-S4XZPBRM.js";import{$a as Ne,Ma as He,Ya as Ve,Za as qe,_a as pe,ab as Ke,bb as Ue,ca as de,cb as Ye,eb as Qe,fb as Xe,g as le,gb as Ze,hb as et,ma as ce,ra as G,sa as Oe,y as ze}from"./embed-page-chunk-MFFCCHGW.js";import{q as Me,t as Ee}from"./embed-page-chunk-T7XXE35M.js";import{a as $}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-6KCBXVIT.js";import{Fa as ae,Ia as De,La as se,W as ne,Y as Ae,Z as Be,_ as we,la as je,ra as F,ta as Te,va as Y,ya as Le}from"./embed-page-chunk-FZRTVFHF.js";import{a as ie}from"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{e as v}from"./embed-page-chunk-6Y3UYJ6Z.js";var i=v(ie());var ot=v(ie());var a=v($()),vt=[{key:"pending",label:"Pending",color:"#7A7A7A"},{key:"in_progress",label:"In Progress",color:"#3b82f6"},{key:"review",label:"Review",color:"#f59e0b"},{key:"failed",label:"Failed",color:"#ef4444"},{key:"interrupted",label:"Interrupted",color:"#8b5cf6"},{key:"completed",label:"Completed",color:"#22c55e"}],tt={high:{label:"High",color:"#ef4444"},medium:{label:"Medium",color:"#f59e0b"},low:{label:"Low",color:"#22c55e"}};function wt(e){let o=typeof e=="string"?new Date(e):e,u=new Date().getTime()-o.getTime(),n=Math.floor(u/1e3),g=Math.floor(n/60),s=Math.floor(g/60),r=Math.floor(s/24);return n<60?"just now":g<60?`${g}m ago`:s<24?`${s}h ago`:r<30?`${r}d ago`:o.toLocaleDateString("en-US")}var Tt=G(({css:e,token:o})=>({container:e`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100%;
|
package/dist/embed/{embed-page-TeamWorkspace-ZFVAFZXZ.js → embed-page-TeamWorkspace-QMIX2TP2.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as Pe,f as Ge,g as Be,h as _e,i as Fe,l as We,m as je}from"./embed-page-chunk-3WRJEEZS.js";import"./embed-page-chunk-S4XZPBRM.js";import{E as Ce,Ea as Ee,J as Se,N as $e,P as Ne,Q as Ie,S as we,T as Me,U as B,V as oe,W as De,Wa as Oe,X as Ae,Xa as He,c as he,ea as Le,j as J,k as ve,l as Te,m as Q,ma as se,n as O,na as Re,p as G,ra as I,v as be,va as ze,w as ye,y as Z}from"./embed-page-chunk-
|
|
1
|
+
import{d as Pe,f as Ge,g as Be,h as _e,i as Fe,l as We,m as je}from"./embed-page-chunk-3WRJEEZS.js";import"./embed-page-chunk-S4XZPBRM.js";import{E as Ce,Ea as Ee,J as Se,N as $e,P as Ne,Q as Ie,S as we,T as Me,U as B,V as oe,W as De,Wa as Oe,X as Ae,Xa as He,c as he,ea as Le,j as J,k as ve,l as Te,m as Q,ma as se,n as O,na as Re,p as G,ra as I,v as be,va as ze,w as ye,y as Z}from"./embed-page-chunk-MFFCCHGW.js";import"./embed-page-chunk-T7XXE35M.js";import{a as N}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-6KCBXVIT.js";import{Da as re,Ea as V,Ia as E,Ka as xe,La as R,W as ce,Z as X,aa as z,da as K,fa as me,ga as W,ja as j,ka as pe,oa as q,ua as ge,va as fe,ya as ue}from"./embed-page-chunk-FZRTVFHF.js";import{a as H}from"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{e as h}from"./embed-page-chunk-6Y3UYJ6Z.js";var ie=h(H());var ee=h(H());var f=h(N()),pt=I(({token:e,css:t})=>({container:t`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ce,c as pe}from"./embed-page-chunk-
|
|
1
|
+
import{a as ce,c as pe}from"./embed-page-chunk-SX7YO5JA.js";import{a as xe}from"./embed-page-chunk-2U4LKIE3.js";import{a as ne,b as O,e as j,f as G,g as oe,h as ie,i as re,k as se,l as ae,m as le,n as de}from"./embed-page-chunk-3WRJEEZS.js";import"./embed-page-chunk-S4XZPBRM.js";import{Da as H,U as L,d as Q,la as te,o as F,q as ee,u as M}from"./embed-page-chunk-MFFCCHGW.js";import{y as $}from"./embed-page-chunk-T7XXE35M.js";import{a as I}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-6KCBXVIT.js";import{Aa as J,Ac as K,Fa as Z,Ia as D,La as X,Z as E,aa as P,na as _,oa as A,sb as q,va as B,wa as Y}from"./embed-page-chunk-FZRTVFHF.js";import{a as U}from"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{e as k}from"./embed-page-chunk-6Y3UYJ6Z.js";var r=k(U());var V=k(xe());var ue=k(U());var ge=k(I()),fe=({steps:t,graphDefinition:o,assistantId:n})=>{let l=(0,ue.useMemo)(()=>pe(o),[o]);return(0,ge.jsx)(ce,{dsl:l,steps:t,assistantId:n})};var e=k(I()),ve=`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
from { transform: rotate(0deg); }
|
|
4
4
|
to { transform: rotate(360deg); }
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as Fe,b as qe}from"./embed-page-chunk-
|
|
1
|
+
import{a as Fe,b as qe}from"./embed-page-chunk-QGAGZMX2.js";import{b as He,c as fe}from"./embed-page-chunk-SX7YO5JA.js";import"./embed-page-chunk-2U4LKIE3.js";import{f as _e}from"./embed-page-chunk-3WRJEEZS.js";import"./embed-page-chunk-S4XZPBRM.js";import{B as le,Da as Ne,G as Te,I as de,K as ce,O as De,S as Le,W as Pe,da as je,e as Me,h as se,ha as _,i as Ae,ia as ge,ja as Oe,mb as Be,na as pe,oa as X,pa as Ee,sa as J,y as ae}from"./embed-page-chunk-MFFCCHGW.js";import{y as V}from"./embed-page-chunk-T7XXE35M.js";import{a as P}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-6KCBXVIT.js";import{Aa as Se,Fc as We,La as U,W as q,Z as H,aa as Y,ec as ze,ga as Ce,oc as Ie,ra as $,sb as Re,ta as K,va as re,xc as ie,ya as G}from"./embed-page-chunk-FZRTVFHF.js";import{a as oe}from"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{e as W}from"./embed-page-chunk-6Y3UYJ6Z.js";var i=W(oe());var Q=W(oe());var L=W(P());function st(o){let s=o.split(/[\n\r.。;;!!??]+/).filter(Boolean)[0]?.trim()||"";return s=s.replace(/[,,]+$/,"").trim(),s.length>50&&(s=s.slice(0,50)),s||(s=o.slice(0,50).trim()),s}function at(o){let e=5381;for(let s=0;s<o.length;s++)e=(e<<5)+e+o.charCodeAt(s)>>>0;return e.toString(36).slice(0,6)}var ue=({open:o,onCancel:e,onCreated:s,type:m="processing"})=>{let{post:d}=V(),{trainingProjects:p,loading:b}=J(),[f,M]=(0,Q.useState)(null),[y]=$.useForm(),u=p.find(w=>w.id===f)??p[0]??null;return(0,Q.useEffect)(()=>{o&&(y.resetFields(),M(null))},[o,y]),(0,L.jsx)(G,{title:m==="workflow"?"New Workflow":"New Processing Workflow",open:o,onCancel:e,onOk:async()=>{if(m==="workflow"&&!u)return;let x=((await y.validateFields()).purpose||"").trim(),z=st(x),I=`wf-${at(x+Date.now())}`,g=m==="workflow"?{key:I,name:z,description:x,type:"workflow",prompt:"Complete the assigned task accurately and concisely.",metadata:{trainingProjectId:u?.id},workflowYaml:`name: ${I}
|
|
2
2
|
steps: []
|
|
3
3
|
`}:{key:I,name:z,description:x,type:"processing",prompt:`You are the orchestrator for workflow "${z}". Purpose: ${x}. Follow the topology to delegate tasks to sub-agents.`,tools:[],skills:[],subAgents:[],middleware:[{id:"topology",type:"topology",name:"Topology",description:"Workflow topology",enabled:!0,config:{edges:[]}}]};await d("/api/assistants",{id:I,name:z,description:x,graphDefinition:g}),y.resetFields(),s(I,x,m==="workflow"?u?.id:void 0)},okText:"Create",okButtonProps:{disabled:m==="workflow"&&(b||!u)},destroyOnClose:!0,children:(0,L.jsxs)($,{form:y,layout:"vertical",initialValues:{purpose:""},children:[(0,L.jsx)($.Item,{name:"purpose",label:"Purpose",rules:[{required:!0,message:"Please describe the workflow purpose"}],children:(0,L.jsx)(K.TextArea,{placeholder:"Describe what this workflow should do. Name and key will be generated automatically.",rows:4})}),m==="workflow"&&(0,L.jsx)(Fe,{project:u,projects:p,value:u?.id??null,onChange:M,loading:b})]})})};var Ke=W(oe());var t=W(P()),{Text:be}=U;function lt(o){if(!o||typeof o!="object")return null;let e=o;return{modelKey:e.modelKey||e.model||void 0,tools:Array.isArray(e.tools)?e.tools:[],middleware:Array.isArray(e.middleware)?e.middleware.filter(s=>s&&typeof s=="object"&&s.type):[],subAgents:Array.isArray(e.subAgents)?e.subAgents:[],skillCategories:Array.isArray(e.skillCategories)?e.skillCategories:[],runConfig:e.runConfig&&typeof e.runConfig=="object"?e.runConfig:void 0}}var dt={filesystem:(0,t.jsx)(Te,{size:12}),code_eval:(0,t.jsx)(Oe,{size:12}),browser:(0,t.jsx)(ce,{size:12}),sql:(0,t.jsx)(le,{size:12}),skill:(0,t.jsx)(ge,{size:12}),http:(0,t.jsx)(Le,{size:12}),scheduler:(0,t.jsx)(ae,{size:12}),metrics:(0,t.jsx)(Me,{size:12}),topology:(0,t.jsx)(de,{size:12}),ask_user_to_clarify:(0,t.jsx)(Pe,{size:12}),widget:(0,t.jsx)(se,{size:12}),date:(0,t.jsx)(Ae,{size:12}),task:(0,t.jsx)(de,{size:12}),custom:(0,t.jsx)(je,{size:12}),claw:(0,t.jsx)(_,{size:12}),collection:(0,t.jsx)(De,{size:12})},ct={filesystem:{bg:"rgba(34,197,94,0.08)",text:"#16a34a",border:"rgba(34,197,94,0.2)"},code_eval:{bg:"rgba(99,102,241,0.08)",text:"#4f46e5",border:"rgba(99,102,241,0.2)"},browser:{bg:"rgba(59,130,246,0.08)",text:"#2563eb",border:"rgba(59,130,246,0.2)"},sql:{bg:"rgba(249,115,22,0.08)",text:"#ea580c",border:"rgba(249,115,22,0.2)"},skill:{bg:"rgba(168,85,247,0.08)",text:"#9333ea",border:"rgba(168,85,247,0.2)"},http:{bg:"rgba(20,184,166,0.08)",text:"#0d9488",border:"rgba(20,184,166,0.2)"},scheduler:{bg:"rgba(245,158,11,0.08)",text:"#d97706",border:"rgba(245,158,11,0.2)"},metrics:{bg:"rgba(236,72,153,0.08)",text:"#db2777",border:"rgba(236,72,153,0.2)"},topology:{bg:"rgba(99,102,241,0.08)",text:"#4f46e5",border:"rgba(99,102,241,0.2)"},ask_user_to_clarify:{bg:"rgba(245,158,11,0.08)",text:"#d97706",border:"rgba(245,158,11,0.2)"},widget:{bg:"rgba(20,184,166,0.08)",text:"#0d9488",border:"rgba(20,184,166,0.2)"},date:{bg:"rgba(139,92,246,0.08)",text:"#7c3aed",border:"rgba(139,92,246,0.2)"},task:{bg:"rgba(99,102,241,0.08)",text:"#4f46e5",border:"rgba(99,102,241,0.2)"},custom:{bg:"rgba(107,114,128,0.08)",text:"#4b5563",border:"rgba(107,114,128,0.2)"},claw:{bg:"rgba(107,114,128,0.08)",text:"#4b5563",border:"rgba(107,114,128,0.2)"},collection:{bg:"rgba(6,182,212,0.08)",text:"#0891b2",border:"rgba(6,182,212,0.2)"}},gt={bg:"rgba(107,114,128,0.08)",text:"#4b5563",border:"rgba(107,114,128,0.2)"};function pt(o){let e=o.split(/[_-]+/).filter(Boolean);return e.length===1?e[0].slice(0,2).toUpperCase():e.map(s=>s[0]).join("").toUpperCase().slice(0,2)}var Ye=[{bg:"rgba(99,102,241,0.1)",text:"#6366f1"},{bg:"rgba(34,197,94,0.1)",text:"#22c55e"},{bg:"rgba(245,158,11,0.1)",text:"#f59e0b"},{bg:"rgba(59,130,246,0.1)",text:"#3b82f6"},{bg:"rgba(239,68,68,0.1)",text:"#ef4444"},{bg:"rgba(168,85,247,0.1)",text:"#a855f7"},{bg:"rgba(20,184,166,0.1)",text:"#14b8a6"},{bg:"rgba(236,72,153,0.1)",text:"#ec4899"}];function $e(o){return Ye[o%Ye.length]}var B=({icon:o,label:e,count:s,children:m})=>(0,t.jsxs)("div",{style:{marginBottom:10},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[(0,t.jsx)("span",{style:{color:"#6366f1",display:"flex",alignItems:"center"},children:o}),(0,t.jsx)(be,{strong:!0,style:{fontSize:11,color:"#52525b",textTransform:"uppercase",letterSpacing:"0.3px"},children:e}),(0,t.jsx)("span",{style:{fontSize:9,fontWeight:600,color:"#a1a1aa",background:"rgba(0,0,0,0.04)",borderRadius:8,padding:"1px 6px",lineHeight:"16px"},children:s})]}),m]}),Ge=({graphDef:o})=>{let e=(0,Ke.useMemo)(()=>lt(o),[o]);if(!e)return null;let s=e.middleware.filter(d=>d.enabled!==!1),m=!1;return e.tools.length===0&&s.length===0&&e.subAgents.length===0?null:(0,t.jsx)("div",{style:{pointerEvents:"auto"},children:(0,t.jsxs)("div",{style:{background:"rgba(255,255,255,0.5)",borderRadius:8,width:250,transition:"all 0.25s ease",overflow:"hidden"},children:[(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:"rgba(99,102,241,0.02)",borderBottom:"1px solid rgba(0,0,0,0.03)"},children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,t.jsx)("div",{style:{width:24,height:24,borderRadius:6,background:"rgba(99,102,241,0.05)",display:"flex",alignItems:"center",justifyContent:"center",color:"#6366f1"},children:(0,t.jsx)(_,{size:13})}),(0,t.jsx)(be,{strong:!0,style:{fontSize:12,color:"#1a1a1a"},children:"Environment"})]})}),(0,t.jsxs)("div",{style:{padding:"10px 12px 12px",maxHeight:"calc(60vh - 48px)",overflowY:"auto"},children:[e.tools.length>0&&(0,t.jsx)(B,{icon:(0,t.jsx)(Ee,{size:12}),label:"Tools",count:e.tools.length,children:(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:e.tools.map((d,p)=>{let b=$e(p);return(0,t.jsx)(Y,{title:d,placement:"top",children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:b.text,background:b.bg,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,t.jsx)("span",{style:{fontWeight:700,fontSize:9,opacity:.7},children:pt(d)}),(0,t.jsx)("span",{children:d})]})},d)})})}),s.length>0&&(0,t.jsx)(B,{icon:(0,t.jsx)(se,{size:12}),label:"Capabilities",count:s.length,children:(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:s.map(d=>{let p=ct[d.type]||gt,b=dt[d.type]||(0,t.jsx)(_,{size:12});return(0,t.jsx)(Y,{title:d.name||d.type,placement:"top",children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:p.text,background:p.bg,border:`1px solid ${p.border}`,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[b,(0,t.jsx)("span",{children:d.name||d.type})]})},d.type)})})}),e.subAgents.length>0&&(0,t.jsx)(B,{icon:(0,t.jsx)(pe,{size:12}),label:"Sub-agents",count:e.subAgents.length,children:(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:e.subAgents.map((d,p)=>{let b=$e(p+3);return(0,t.jsx)(Y,{title:d,placement:"top",children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:b.text,background:b.bg,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,t.jsx)(pe,{size:10}),(0,t.jsx)("span",{children:d})]})},d)})})}),(e.modelKey||e.runConfig)&&(0,t.jsx)(B,{icon:(0,t.jsx)(ae,{size:12}),label:"Runtime",count:e.modelKey?1:0,children:(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[e.modelKey&&(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:"#4f46e5",background:"rgba(99,102,241,0.08)",border:"1px solid rgba(99,102,241,0.2)",cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,t.jsx)(_,{size:10}),(0,t.jsxs)("span",{children:["Model: ",e.modelKey]})]}),!!e.runConfig?.databaseKey&&(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:"#ea580c",background:"rgba(249,115,22,0.08)",border:"1px solid rgba(249,115,22,0.2)",cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,t.jsx)(le,{size:10}),(0,t.jsxs)("span",{children:["DB: ",String(e.runConfig?.databaseKey)]})]}),e.skillCategories&&e.skillCategories.length>0&&(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:"#9333ea",background:"rgba(168,85,247,0.08)",border:"1px solid rgba(168,85,247,0.2)",cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,t.jsx)(ge,{size:10}),(0,t.jsxs)("span",{children:["Skills: ",e.skillCategories.join(", ")]})]})]})}),m&&(0,t.jsx)(B,{icon:(0,t.jsx)(ce,{size:12}),label:"Channels",count:0,children:(0,t.jsx)(be,{type:"secondary",style:{fontSize:10,fontStyle:"italic"},children:"No channels configured"})})]})]})})};var n=W(P()),{Text:F}=U;function Ue(o){if(typeof o=="string")try{let e=JSON.parse(o);return e&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}return o&&typeof o=="object"&&!Array.isArray(o)?o:null}function ft(o){let e=null;if(typeof o=="string")try{e=JSON.parse(o)}catch{return null}else o&&typeof o=="object"&&(e=o);if(!e)return null;if(e.type!=="workflow")return console.warn("[extractDSL] type is not 'workflow':",e.type),null;if(typeof e.workflowYaml!="string")return console.warn("[extractDSL] workflowYaml not found or not a string, keys:",Object.keys(e)),null;try{return fe(e.workflowYaml)}catch(s){return console.error("[extractDSL] expandWorkflow failed:",s.message,s),null}}function ut({workflows:o,selectedId:e,onSelect:s,onCreate:m,onDelete:d,dsl:p,agentNameMap:b,onSpecClick:f,environmentConfig:M}){let y=o.find(g=>g.id===e),[u,S]=(0,i.useState)(!0),[w,x]=(0,i.useState)(""),z=(0,i.useMemo)(()=>{let g=w.trim().toLowerCase();return g?o.filter(h=>h.name.toLowerCase().includes(g)||h.description.toLowerCase().includes(g)):o},[o,w]);(0,i.useEffect)(()=>{e?S(!1):(S(!0),x(""))},[e]);let I=g=>{s(g),S(!1)};return(0,n.jsx)("div",{style:{display:"flex",height:"100%",width:"100%"},children:(0,n.jsxs)("div",{style:{flex:1,position:"relative"},children:[y?(0,n.jsxs)(n.Fragment,{children:[p?(0,n.jsx)(He,{dsl:p,agentNameMap:b}):(0,n.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,n.jsx)(re,{tip:"Loading workflow DSL..."})}),!u&&(0,n.jsx)("div",{style:{position:"absolute",top:12,left:12,zIndex:10},children:(0,n.jsx)(q,{type:"default",icon:(0,n.jsx)(Ie,{}),onClick:()=>S(!0),style:{width:32,height:32,borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0",background:"rgba(255,255,255,0.95)",color:"#6366f1",display:"flex",alignItems:"center",justifyContent:"center"}})}),(0,n.jsxs)("div",{style:{position:"absolute",top:12,left:u?12:56,zIndex:10,display:"flex",alignItems:"center",gap:6,height:32,padding:"0 14px",background:"rgba(255,255,255,0.95)",borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0"},children:[(0,n.jsx)(X,{size:16,color:"#6366f1"}),(0,n.jsx)(F,{strong:!0,style:{fontSize:13},children:y.name}),(0,n.jsx)(ze,{style:{color:"#6366f1",cursor:"pointer",fontSize:15},onClick:f})]}),(0,n.jsx)("div",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"flex",alignItems:"center",height:32,padding:"0 14px",background:"rgba(255,255,255,0.95)",borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0"},children:(0,n.jsx)(Se,{title:"Delete workflow",description:"This will permanently delete this workflow agent.",onConfirm:()=>d(y.id),okText:"Delete",cancelText:"Cancel",okButtonProps:{danger:!0},children:(0,n.jsx)(Re,{style:{color:"#ff4d4f",cursor:"pointer",fontSize:15}})})}),!u&&(0,n.jsx)("div",{style:{position:"absolute",top:52,left:u?12:56,zIndex:20},children:(0,n.jsx)(Ge,{graphDef:M},y.id)})]}):(0,n.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,n.jsx)(H,{description:"Select a workflow to view its graph"})}),u&&(0,n.jsxs)(n.Fragment,{children:[e&&(0,n.jsx)("div",{onClick:()=>S(!1),style:{position:"absolute",inset:0,zIndex:25,background:"transparent"}}),(0,n.jsxs)(Ce,{size:"small",title:(0,n.jsx)(F,{strong:!0,style:{fontSize:15,color:"#1a1a1a"},children:"Workflows"}),extra:(0,n.jsx)(q,{type:"text",size:"small",icon:(0,n.jsx)(ie,{}),onClick:m,style:{color:"#6366f1"}}),styles:{body:{padding:"12px 16px 16px"},header:{padding:"14px 16px 10px",borderBottom:"1px solid rgba(0,0,0,0.04)"}},style:{position:"absolute",left:16,top:e?56:48,bottom:16,width:300,zIndex:30,borderRadius:16,boxShadow:"0 4px 24px rgba(0,0,0,0.12)",border:"1px solid #f0f0f0",overflow:"auto",background:"rgba(255, 255, 255, 0.92)"},children:[(0,n.jsx)("div",{style:{marginBottom:12},children:(0,n.jsx)(K,{prefix:(0,n.jsx)(We,{style:{color:"#bbb"}}),placeholder:"Filter workflows...",value:w,onChange:g=>x(g.target.value),allowClear:!0,size:"small",style:{borderRadius:10,border:"1px solid rgba(0,0,0,0.06)"}})}),z.length===0?(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",color:"#bbb"},children:[(0,n.jsx)(X,{size:28,style:{marginBottom:10,opacity:.4}}),(0,n.jsx)(F,{type:"secondary",style:{fontSize:13},children:w.trim()?"No workflows match your search":"No workflows yet"})]}):z.map(g=>{let h=e===g.id;return(0,n.jsxs)("div",{onClick:()=>I(g.id),style:{display:"flex",alignItems:"center",gap:12,padding:"13px 15px",borderRadius:12,cursor:"pointer",transition:"all 0.2s ease",background:h?"rgba(99, 102, 241, 0.07)":"rgba(255, 255, 255, 0.5)",border:h?"1px solid rgba(99, 102, 241, 0.25)":"1px solid transparent",marginBottom:6},onMouseEnter:C=>{h||(C.currentTarget.style.background="rgba(255, 255, 255, 0.92)",C.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.05)",C.currentTarget.style.transform="translateY(-1px)",C.currentTarget.style.borderColor="rgba(0,0,0,0.06)")},onMouseLeave:C=>{h||(C.currentTarget.style.background="rgba(255, 255, 255, 0.5)",C.currentTarget.style.boxShadow="none",C.currentTarget.style.transform="translateY(0)",C.currentTarget.style.borderColor="transparent")},children:[(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:38,height:38,borderRadius:10,background:h?"rgba(99, 102, 241, 0.12)":"rgba(0, 0, 0, 0.04)",flexShrink:0,transition:"background 0.2s ease"},children:(0,n.jsx)(X,{size:18,color:h?"#6366f1":"#888"})}),(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)(F,{strong:!0,ellipsis:{tooltip:g.name},style:{fontSize:14,color:h?"#6366f1":"#1a1a1a",transition:"color 0.2s ease"},children:g.name}),g.description&&(0,n.jsx)("div",{style:{fontSize:12,color:"#999",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:3,lineHeight:"18px"},children:g.description})]})]},g.id)})]})]})]})})}var bt=()=>{let{get:o,del:e}=V(),{workspaceId:s,trainingProjects:m,loading:d}=J(),[p,b]=(0,i.useState)([]),[f,M]=(0,i.useState)(null),[y,u]=(0,i.useState)(null),[S,w]=(0,i.useState)(null),[x,z]=(0,i.useState)([]),[I,g]=(0,i.useState)(new Map),h=(0,i.useCallback)(async()=>{try{let r=await o("/api/assistants");if(r.success&&r.data?.records){let c=[],a=new Map;for(let l of r.data.records){if(l.id&&l.name){let k=typeof l.graphDefinition=="object"&&l.graphDefinition!==null?l.graphDefinition:void 0;a.set(l.id,{name:l.name,type:k?.type??"unknown"})}if(l.graphDefinition)if(typeof l.graphDefinition=="string")try{c.push(JSON.parse(l.graphDefinition))}catch{}else typeof l.graphDefinition=="object"&&c.push(l.graphDefinition)}z(c),g(a)}}catch{}},[o]),[C,me]=(0,i.useState)(!0),[Z,Xe]=(0,i.useState)(420),j=(0,i.useRef)(null),[Je,Ve]=(0,i.useState)(!0),[ye,we]=(0,i.useState)(null),[Qe,xe]=(0,i.useState)(!1),[he,O]=(0,i.useState)(!1),[Ze,ke]=(0,i.useState)(null),et=(0,i.useMemo)(()=>["create_workflow","update_workflow","validate_workflow","create_agent","update_agent","delete_agent"],[]),T=(0,i.useCallback)(async()=>{let r=await o("/api/assistants");if(r.success&&r.data?.records){let c=r.data.records.filter(a=>(Ue(a.graphDefinition)??void 0)?.type==="workflow").map(a=>{let l=Ue(a.graphDefinition)??void 0,k=typeof l?.workflowYaml=="string"?l.workflowYaml:"",E=l?.metadata,N=0;try{N=fe(k).nodes.filter(R=>R.type!=="terminal").length}catch{}return{id:a.id,name:a.name,description:a.description||"",type:"workflow",stepCount:N,trainingProjectId:typeof E?.trainingProjectId=="string"?E.trainingProjectId:void 0}});b(c)}we(null)},[o]),ee=(0,i.useCallback)(async r=>{try{let c=await o(`/api/assistants/${r}`);if(c.success&&c.data){let a=c.data.graphDefinition,l=ft(a);if(u(l),!a)w(null);else if(typeof a=="string")try{w(JSON.parse(a))}catch{w(null)}else w(typeof a=="object"?a:null)}}catch{u(null),w(null)}},[o]);(0,i.useEffect)(()=>{let r=!1;return(async()=>{try{await T(),await h()}catch(a){r||we(a instanceof Error?a.message:"Failed to load workflows")}finally{r||Ve(!1)}})(),()=>{r=!0}},[T]),(0,i.useEffect)(()=>{f?ee(f):u(null)},[f,ee]);let tt=(0,i.useCallback)(r=>{r.preventDefault(),j.current={startX:r.clientX,startWidth:Z}},[Z]);(0,i.useEffect)(()=>{let r=a=>{if(!j.current)return;let l=j.current.startX-a.clientX,k=Math.min(900,Math.max(400,j.current.startWidth+l));Xe(k)},c=()=>{j.current=null};return window.addEventListener("mousemove",r),window.addEventListener("mouseup",c),()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",c)}},[]);let nt=(0,i.useCallback)(r=>{M(r)},[]),ve=(0,i.useCallback)((r,c,a)=>{O(!1),T().then(()=>{M(r),a&&b(l=>l.map(k=>k.id===r?{...k,trainingProjectId:a}:k)),c&&ke({requestId:r,content:c})})},[T]),ot=(0,i.useCallback)(async r=>{await e(`/api/assistants/${r}`),f===r&&M(null),await T()},[e,T,f]),D=(0,i.useMemo)(()=>p.find(r=>r.id===f)||null,[p,f]),te=D?.trainingProjectId??m[0]?.id??null,rt=(0,i.useMemo)(()=>f&&D?{id:f,name:D.name,type:"workflow"}:null,[f,D]),it=(0,i.useMemo)(()=>{let r=y?.nodes.filter(v=>v.type!=="terminal"&&v.ref).map(v=>v.ref).filter((v,R,A)=>A.indexOf(v)===R)??[];if(r.length===0)return S;let c=x.filter(v=>{let R=v.key;return R&&r.includes(R)});if(c.length===0)return S;let a={...S??{}},l=new Set(a.tools??[]),k=[...a.middleware??[]],E=new Set(a.subAgents??[]),N=new Set(k.map(v=>v.type).filter(Boolean));for(let v of c){let R=v;for(let A of R.tools??[])l.add(A);for(let A of R.middleware??[]){let ne=A.type;ne&&!N.has(ne)&&(k.push(A),N.add(ne))}for(let A of R.subAgents??[])E.add(A)}return a.tools=Array.from(l),a.middleware=k,a.subAgents=Array.from(E),a},[y,S,x]);return Je?(0,n.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,n.jsx)(re,{size:"large",tip:"Loading workflows..."})}):ye?(0,n.jsx)(H,{description:ye}):p.length===0?(0,n.jsxs)("div",{style:{width:"100%",height:"100%"},children:[(0,n.jsx)(ue,{open:he,onCancel:()=>O(!1),onCreated:ve,type:"workflow"}),(0,n.jsx)(H,{description:"No workflow definitions found.",children:(0,n.jsx)(q,{type:"primary",icon:(0,n.jsx)(ie,{}),onClick:()=>O(!0),children:"Create Workflow"})})]}):(0,n.jsxs)("div",{style:{width:"100%",height:"100%"},children:[(0,n.jsx)(ue,{open:he,onCancel:()=>O(!1),onCreated:ve,type:"workflow"}),(0,n.jsx)(G,{title:D?.name,open:Qe,onCancel:()=>xe(!1),footer:null,width:"85vw",centered:!0,styles:{body:{maxHeight:"calc(85vh - 120px)",overflow:"auto",padding:"12px 24px 24px"}},children:D?.description?(0,n.jsx)(Ne,{content:D.description}):(0,n.jsx)(F,{type:"secondary",children:"No description set."})}),(0,n.jsx)(_e,{children:(0,n.jsxs)("div",{style:{height:"100%",width:"100%",position:"relative",overflow:"hidden"},children:[(0,n.jsx)(ut,{workflows:p,selectedId:f,onSelect:nt,onCreate:()=>O(!0),onDelete:ot,dsl:y,agentNameMap:I,onSpecClick:()=>xe(!0),environmentConfig:it}),!C&&f&&(0,n.jsx)("div",{style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",zIndex:20},children:(0,n.jsx)("div",{onClick:()=>me(!0),style:{writingMode:"vertical-rl",textOrientation:"mixed",padding:"16px 8px",background:"#6366f1",color:"#fff",borderRadius:"8px 0 0 8px",cursor:"pointer",fontSize:12,fontWeight:500,userSelect:"none"},children:"Copilot"})}),C&&f&&te&&!d&&(0,n.jsxs)("div",{style:{position:"absolute",right:16,top:48,bottom:12,zIndex:15,width:Z,borderRadius:16,overflow:"hidden",boxShadow:"0 4px 24px rgba(0,0,0,0.12)"},children:[(0,n.jsx)("div",{onMouseDown:tt,style:{position:"absolute",left:0,top:0,bottom:0,width:6,cursor:"ew-resize",zIndex:2,background:"transparent"}}),(0,n.jsx)(Be,{defaultWorkspaceId:s??void 0,defaultProjectId:te??void 0,children:(0,n.jsx)(qe,{workflowContext:rt,onClose:()=>me(!1),onToolCompleted:r=>{et.includes(r)&&(T(),f&&ee(f))},initialMessageRequest:Ze,onInitialMessageSubmitted:r=>ke(c=>c?.requestId===r?null:c)})},`${s??"default"}:${te??"default"}`)]})]})})]})},qt=bt;export{bt as WorkflowAutomationView,qt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ko}from"./embed-page-chunk-
|
|
1
|
+
import{a as ko}from"./embed-page-chunk-YAJUWBF2.js";import{a as lr,b as In}from"./embed-page-chunk-QGAGZMX2.js";import{b as zi,c as Bi}from"./embed-page-chunk-SX7YO5JA.js";import{c as ho,d as bo}from"./embed-page-chunk-2U4LKIE3.js";import{b as it,c as Ai,d as mo,e as xt,f as yo,g as Ei,h as xn,i as Tn,j as Pi,l as Di,m as Li}from"./embed-page-chunk-3WRJEEZS.js";import{a as Wi,b as ji}from"./embed-page-chunk-QCKYIPFY.js";import{A as li,Aa as Ti,C as di,D as ci,Da as kn,F as co,Ja as wn,Ka as go,L as ui,La as Ri,Oa as Ii,Pa as Ci,Qa as Si,Ra as fo,Y as pi,Z as gi,_ as fi,aa as mi,ba as yi,d as oi,db as Ni,eb as vo,f as ri,fb as wo,g as Bn,ga as hi,gb as xo,hb as Mi,ib as To,jb as Oi,ka as bi,kb as _i,lb as Ro,mb as Rn,oa as uo,ob as sr,p as ii,pa as vi,pb as Fi,qa as ki,ra as wi,sa as Lt,x as ai,xa as xi,z as si,za as po}from"./embed-page-chunk-MFFCCHGW.js";import{i as Ur,p as Zr,q as Vr,t as mt,x as ao,y as Xe}from"./embed-page-chunk-T7XXE35M.js";import{a as M}from"./embed-page-chunk-MB65DZAX.js";import{Bb as vn,Cb as Jr,Cc as ei,Ec as ti,Fc as ir,Gc as ar,Ha as io,Ia as qe,Ja as Hr,La as We,Ma as Kr,Rc as ni,Sb as rr,U as Vt,W as V,Wa as Qr,Y as bn,Z as Bt,_ as ot,aa as Qt,ca as nr,da as or,eb as Yr,ec as lo,fa as Gr,ia as sn,la as $r,lb as zn,na as qr,nb as Xr,oa as Pt,ra as pe,sb as so,ta as De,va as wt,xa as rt,xc as Dt,ya as _e}from"./embed-page-chunk-FZRTVFHF.js";import{a as xe}from"./embed-page-chunk-4BKXE5ON.js";import{e as R}from"./embed-page-chunk-6Y3UYJ6Z.js";var Gs={react:{label:"capability",color:"blue"},capability:{label:"capability",color:"blue"},deep_agent:{label:"orchestrator",color:"orange"},orchestrator:{label:"orchestrator",color:"orange"},team:{label:"team",color:"green"},processing:{label:"workflow",color:"purple"},workflow:{label:"workflow",color:"purple"},a2a_remote:{label:"remote",color:"cyan"},remote:{label:"remote",color:"cyan"}};function Cn(e){return Gs[e]??{label:"capability",color:"blue"}}var $s={enabled:"green",draft:"orange",disabled:"default"};function $i(e){return $s[e]??"default"}var Gi={blue:"#3b82f6",orange:"#f59e0b",green:"#22c55e",purple:"#a855f7",cyan:"#06b6d4"};function jn(e){return Gi[e]??Gi.cyan}function $d(e){let t={enabled:"#22c55e",draft:"#f59e0b",disabled:"#d9d9d9"};return t[e]??t.disabled}function Sn(e){return typeof e.graphDefinition=="object"&&e.graphDefinition!==null?e.graphDefinition:{}}function cr(e){return((Sn(e).metadata??{}).tags??"").split(",").map(r=>r.trim()).filter(Boolean)}function ur(e){let o=(Sn(e).metadata??{}).version;return o?o.startsWith("v")?o:`v${o}`:"v1"}function pr(e){let o=(Sn(e).metadata??{}).status??"enabled";return o==="draft"||o==="disabled"?o:"enabled"}function dr(e){let n=Sn(e).subAgents??[],o=Array.isArray(n)?n.filter(Boolean):[];return Array.from(new Set(o))}function qd(e){return e.map(t=>{let n=Sn(t),o=String(n.type??"react");return{id:t.id,name:t.name,description:t.description,type:Cn(o).label,tags:cr(t),version:ur(t),status:pr(t),subAgents:dr(t)}})}function Hd(e){let t=new Set(e.map(r=>r.id)),n=e.map(r=>({id:r.id,label:r.name,type:Cn(String(Sn(r).type??"react")).label,subAgentCount:dr(r).length})),o=[];for(let r of e)for(let i of dr(r))t.has(i)&&o.push({source:r.id,target:i});return{nodes:n,edges:o}}var Re=R(xe());var te=R(xe());var b=R(M()),{TextArea:qs}=De,{Text:Tt}=We,qi=["data","execution","workflow","assistant"],Hs={data:"Data & Knowledge",execution:"Execution & Interaction",workflow:"Workflow & Orchestration",assistant:"Assistant & Evaluation",other:"Other"},Gn=(e,t)=>{if(Array.isArray(e)){let n=e.map(o=>Gn(o));return(t==="tools"||t==="subAgents")&&n.every(o=>typeof o=="string")?[...n].sort():n}return e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([n],[o])=>n.localeCompare(o)).map(([n,o])=>[n,Gn(o,n)])):e},Hi=e=>{if(typeof e!="string")return Gn(e??null);try{return Gn(JSON.parse(e))}catch{return e}},Ki=e=>JSON.stringify(Gn({...e,tools:[...e.tools].sort(),subAgents:[...e.subAgents].sort()})),Ks=wi(({token:e,css:t})=>({modalBody:t`
|
|
2
2
|
padding: 0;
|
|
3
3
|
height: 92vh;
|
|
4
4
|
width: 100%;
|