@axiom-lattice/gateway 6.0.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/a2a-standard-DP53K7RC.mjs +3416 -0
- package/dist/a2a-standard-DP53K7RC.mjs.map +1 -0
- package/dist/{chunk-YKTXW6F6.mjs → chunk-2SR4F3ZD.mjs} +65 -1
- package/dist/chunk-2SR4F3ZD.mjs.map +1 -0
- package/dist/{chunk-QUT2DS4R.mjs → chunk-J6B2VFJ7.mjs} +17 -4
- package/dist/chunk-J6B2VFJ7.mjs.map +1 -0
- package/dist/embed/embed-page-AgentDetailSideApp-KNVDO3FZ.js +1 -0
- package/dist/embed/embed-page-AgentGovernanceWorkbench-QSKWVADP.js +1 -0
- package/dist/embed/embed-page-MessageGraph-VGXX4OWU.js +6 -0
- package/dist/embed/embed-page-ReactChart-PIISVBLU.js +1 -0
- package/dist/embed/{embed-page-ReactInfographic-5P36JLSX.js → embed-page-ReactInfographic-677NVKOU.js} +1 -1
- package/dist/embed/embed-page-SkillFlow-JLI5MEZE.js +1 -0
- package/dist/embed/{embed-page-TasksSideApp-DA4LUTMD.js → embed-page-TasksSideApp-D7FFG2OC.js} +1 -1
- package/dist/embed/embed-page-ThreadMaintenancePanel-FSQVVIIG.js +1 -0
- package/dist/embed/{embed-page-TopologyRuntimeView-NFBHAICN.js → embed-page-TopologyRuntimeView-IS6HEO4F.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-43YGTXGF.js → embed-page-WorkflowAutomationView-IDVSQTJB.js} +1 -1
- package/dist/embed/embed-page-all-JEPF6WHD.js +1 -0
- package/dist/embed/{embed-page-architectureDiagram-VXUJARFQ-THUN2PFL.js → embed-page-architectureDiagram-VXUJARFQ-TYJ3NO2K.js} +1 -1
- package/dist/embed/embed-page-aspnet-GIV4ESY6.js +1 -0
- package/dist/embed/{embed-page-blockDiagram-VD42YOAC-K7OX6LIO.js → embed-page-blockDiagram-VD42YOAC-L4J3TZWR.js} +1 -1
- package/dist/embed/{embed-page-c4Diagram-YG6GDRKO-DJDAF5AO.js → embed-page-c4Diagram-YG6GDRKO-CP2IXU3Z.js} +1 -1
- package/dist/embed/{embed-page-chunk-FD2PRLMW.js → embed-page-chunk-2VJ7T35I.js} +1 -1
- package/dist/embed/embed-page-chunk-37LGEEJU.js +21 -0
- package/dist/embed/embed-page-chunk-436REIWY.js +1 -0
- package/dist/embed/embed-page-chunk-4W34QOXT.js +517 -0
- package/dist/embed/{embed-page-chunk-JUZPOR5Y.js → embed-page-chunk-5WWOKLDB.js} +1 -1
- package/dist/embed/{embed-page-chunk-HYPA2PHA.js → embed-page-chunk-6IIMW7OG.js} +1 -1
- package/dist/embed/{embed-page-chunk-XKGF5D6L.js → embed-page-chunk-7CJDHJEH.js} +1 -1
- package/dist/embed/{embed-page-chunk-J5AHS4PO.js → embed-page-chunk-7GLQRV3J.js} +1 -1
- package/dist/embed/{embed-page-chunk-SQ4GANYE.js → embed-page-chunk-AEDAOTEO.js} +1 -1
- package/dist/embed/embed-page-chunk-BANVRQT7.js +322 -0
- package/dist/embed/{embed-page-chunk-C4ZV4IXK.js → embed-page-chunk-BOEX26H7.js} +2 -2
- package/dist/embed/{embed-page-chunk-A2AHDN6K.js → embed-page-chunk-DQJVWZOB.js} +1 -1
- package/dist/embed/embed-page-chunk-EYYKNTX7.js +8 -0
- package/dist/embed/{embed-page-chunk-DTRFJLVZ.js → embed-page-chunk-F5QVZLK5.js} +1 -1
- package/dist/embed/{embed-page-chunk-GKHIPXZ2.js → embed-page-chunk-FEMHLB6I.js} +1 -1
- package/dist/embed/{embed-page-chunk-UHH575CK.js → embed-page-chunk-JFMBLJXY.js} +1 -1
- package/dist/embed/{embed-page-chunk-G2RO6IBN.js → embed-page-chunk-KXVXKWED.js} +1 -1
- package/dist/embed/embed-page-chunk-N66H4DNH.js +6657 -0
- package/dist/embed/{embed-page-chunk-WTOAQDQN.js → embed-page-chunk-NFMLKSPM.js} +1 -1
- package/dist/embed/{embed-page-chunk-PLNJRORR.js → embed-page-chunk-NVFNRWRN.js} +1 -1
- package/dist/embed/{embed-page-chunk-V2GBFWLG.js → embed-page-chunk-S2KVN3RB.js} +1 -1
- package/dist/embed/{embed-page-chunk-QULNM5O2.js → embed-page-chunk-SRMYHWL3.js} +1 -1
- package/dist/embed/{embed-page-chunk-D5GP7FHH.js → embed-page-chunk-TVVAPR7I.js} +1 -1
- package/dist/embed/{embed-page-chunk-WFUFTRWA.js → embed-page-chunk-WK77HIEN.js} +1 -1
- package/dist/embed/{embed-page-chunk-XSKNS3LY.js → embed-page-chunk-WWXRO4ZL.js} +1 -1
- package/dist/embed/{embed-page-chunk-BVSC3MSO.js → embed-page-chunk-XFV3N2LD.js} +1 -1
- package/dist/embed/{embed-page-chunk-VY6MAPHR.js → embed-page-chunk-XSKDYUNQ.js} +1 -1
- package/dist/embed/{embed-page-chunk-V7R2Y72J.js → embed-page-chunk-YJUCDIYK.js} +1 -1
- package/dist/embed/embed-page-chunk-ZQQFWEWO.js +1 -0
- package/dist/embed/embed-page-classDiagram-2ON5EDUG-MHNSVPAN.js +1 -0
- package/dist/embed/embed-page-classDiagram-v2-WZHVMYZB-QCMEVMYH.js +1 -0
- package/dist/embed/{embed-page-code-highlighter-IPU5ZNPJ.js → embed-page-code-highlighter-66CSPTFK.js} +1 -1
- package/dist/embed/embed-page-cshtml-RYMZMLKB.js +1 -0
- package/dist/embed/{embed-page-dagre-6UL2VRFP-UQFZMKYW.js → embed-page-dagre-6UL2VRFP-LTZ2DVVO.js} +1 -1
- package/dist/embed/{embed-page-diagram-PSM6KHXK-4IKXWNA4.js → embed-page-diagram-PSM6KHXK-JHYXSMCB.js} +1 -1
- package/dist/embed/{embed-page-diagram-QEK2KX5R-245T32UF.js → embed-page-diagram-QEK2KX5R-2YGDFFTU.js} +1 -1
- package/dist/embed/{embed-page-diagram-S2PKOQOG-BOA5MJA5.js → embed-page-diagram-S2PKOQOG-6EW6MDJW.js} +1 -1
- package/dist/embed/{embed-page-en-WB2EPS63.js → embed-page-en-2SWQHPAC.js} +1 -1
- package/dist/embed/embed-page-en-3Z4N5KXB.js +1 -0
- package/dist/embed/embed-page-en-7IHJFS63.js +1 -0
- package/dist/embed/embed-page-en-7NF4GCC2.js +1 -0
- package/dist/embed/embed-page-en-BLF5THT6.js +1 -0
- package/dist/embed/embed-page-en-ETUCVCSC.js +1 -0
- package/dist/embed/{embed-page-en-UWBIHR6I.js → embed-page-en-H4P63IAK.js} +1 -1
- package/dist/embed/embed-page-en-WUFULCUS.js +1 -0
- package/dist/embed/{embed-page-en-S4MXFPIU.js → embed-page-en-X6B6RVNL.js} +1 -1
- package/dist/embed/embed-page-en-XUMHP5CL.js +1 -0
- package/dist/embed/{embed-page-erDiagram-Q2GNP2WA-S4J4SQPR.js → embed-page-erDiagram-Q2GNP2WA-KSUS6MHW.js} +1 -1
- package/dist/embed/{embed-page-flowDiagram-NV44I4VS-ZFIJXKMW.js → embed-page-flowDiagram-NV44I4VS-AYXRDKAJ.js} +1 -1
- package/dist/embed/{embed-page-ganttDiagram-JELNMOA3-7MSIEWL4.js → embed-page-ganttDiagram-JELNMOA3-AV7N2N3T.js} +1 -1
- package/dist/embed/{embed-page-gitGraphDiagram-NY62KEGX-F6KE6PZK.js → embed-page-gitGraphDiagram-NY62KEGX-IBVOXVO5.js} +1 -1
- package/dist/embed/embed-page-infoDiagram-WHAUD3N6-ZULKOSOZ.js +2 -0
- package/dist/embed/{embed-page-journeyDiagram-XKPGCS4Q-6VTW6GQ3.js → embed-page-journeyDiagram-XKPGCS4Q-3GILI7Y4.js} +1 -1
- package/dist/embed/{embed-page-kanban-definition-3W4ZIXB7-7IZYCLQZ.js → embed-page-kanban-definition-3W4ZIXB7-UGO3J7IH.js} +1 -1
- package/dist/embed/{embed-page-mermaid-R7ZBUE3D.js → embed-page-mermaid-KEBBKHQH.js} +2 -2
- package/dist/embed/{embed-page-mindmap-definition-VGOIOE7T-GKTOT34A.js → embed-page-mindmap-definition-VGOIOE7T-VXXZJS3Z.js} +1 -1
- package/dist/embed/{embed-page-pieDiagram-ADFJNKIX-VDPALO42.js → embed-page-pieDiagram-ADFJNKIX-ZFAWYA2N.js} +1 -1
- package/dist/embed/{embed-page-requirementDiagram-UZGBJVZJ-LTZH6RTD.js → embed-page-requirementDiagram-UZGBJVZJ-2QBINXR7.js} +1 -1
- package/dist/embed/{embed-page-sequenceDiagram-WL72ISMW-LV6Q4SHW.js → embed-page-sequenceDiagram-WL72ISMW-3MGTESG4.js} +1 -1
- package/dist/embed/{embed-page-stateDiagram-FKZM4ZOC-U4NHQDNP.js → embed-page-stateDiagram-FKZM4ZOC-W6VPIMB5.js} +1 -1
- package/dist/embed/embed-page-stateDiagram-v2-4FDKWEC3-QYJ47QBY.js +1 -0
- package/dist/embed/{embed-page-tsx-PNW7N5T4.js → embed-page-tsx-LGDDERM2.js} +1 -1
- package/dist/embed/{embed-page-xychartDiagram-PRI3JC2R-VZSIXBFK.js → embed-page-xychartDiagram-PRI3JC2R-7XKT4R7V.js} +1 -1
- package/dist/embed/embed-page-zh-D3IC6BGA.js +1 -0
- package/dist/embed/{embed-page-zh-SSMSF5LE.js → embed-page-zh-EQ5X2M32.js} +1 -1
- package/dist/embed/embed-page-zh-G75LDQU4.js +1 -0
- package/dist/embed/embed-page-zh-GXE63PQ7.js +1 -0
- package/dist/embed/{embed-page-zh-ACZNJ4X4.js → embed-page-zh-IB3422D4.js} +1 -1
- package/dist/embed/embed-page-zh-KJXKOUIY.js +1 -0
- package/dist/embed/{embed-page-zh-NKHP3CFU.js → embed-page-zh-N2STRBUG.js} +1 -1
- package/dist/embed/{embed-page-zh-XEYNKCTC.js → embed-page-zh-PRMID3YQ.js} +1 -1
- package/dist/embed/embed-page-zh-RMGMUSDH.js +1 -0
- package/dist/embed/embed-page-zh-RMSS6PXD.js +1 -0
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.d.mts +1513 -252
- package/dist/index.d.ts +1513 -252
- package/dist/index.js +17568 -5813
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31824 -22070
- package/dist/index.mjs.map +1 -1
- package/dist/{open-MDC4VCR7.mjs → open-NTH7AGD3.mjs} +41 -78
- package/dist/open-NTH7AGD3.mjs.map +1 -0
- package/dist/{open-exposure-OX5NKWDG.mjs → open-exposure-AGNG4MC3.mjs} +13 -3
- package/dist/{open-exposure-OX5NKWDG.mjs.map → open-exposure-AGNG4MC3.mjs.map} +1 -1
- package/dist/{open-files-FS5AN6Q6.mjs → open-files-V3R2BFTV.mjs} +4 -4
- package/package.json +9 -8
- package/dist/a2a-standard-3OZFXDCW.mjs +0 -1413
- package/dist/a2a-standard-3OZFXDCW.mjs.map +0 -1
- package/dist/chunk-K32XEQLH.mjs +0 -28
- package/dist/chunk-K32XEQLH.mjs.map +0 -1
- package/dist/chunk-QUT2DS4R.mjs.map +0 -1
- package/dist/chunk-YKTXW6F6.mjs.map +0 -1
- package/dist/embed/embed-page-AgentDetailSideApp-JYVZKSUU.js +0 -1
- package/dist/embed/embed-page-AgentGovernanceWorkbench-SD2EHW2B.js +0 -1
- package/dist/embed/embed-page-MessageGraph-GLQXKAVC.js +0 -6
- package/dist/embed/embed-page-ReactChart-74MHCE2K.js +0 -1
- package/dist/embed/embed-page-SkillFlow-NDAK3GAD.js +0 -1
- package/dist/embed/embed-page-TeamWorkspace-DUB3L6V6.js +0 -748
- package/dist/embed/embed-page-TeamWorkspace-YQFWXDLI.css +0 -1
- package/dist/embed/embed-page-all-NEJVJ4G7.js +0 -1
- package/dist/embed/embed-page-aspnet-SRK67AH2.js +0 -1
- package/dist/embed/embed-page-chunk-2PFKLMTR.js +0 -21
- package/dist/embed/embed-page-chunk-DWIBLGBW.js +0 -2
- package/dist/embed/embed-page-chunk-ESQ5V77Q.js +0 -1
- package/dist/embed/embed-page-chunk-MHGVD4EV.js +0 -525
- package/dist/embed/embed-page-chunk-P477ZTUO.js +0 -7009
- package/dist/embed/embed-page-classDiagram-2ON5EDUG-VYHHMIKZ.js +0 -1
- package/dist/embed/embed-page-classDiagram-v2-WZHVMYZB-5AISLXUF.js +0 -1
- package/dist/embed/embed-page-cshtml-ZY7LJSTH.js +0 -1
- package/dist/embed/embed-page-en-2WLCQIB6.js +0 -1
- package/dist/embed/embed-page-en-7WXWAWGG.js +0 -1
- package/dist/embed/embed-page-en-ICVL5QAC.js +0 -1
- package/dist/embed/embed-page-en-OLZHSUC3.js +0 -1
- package/dist/embed/embed-page-infoDiagram-WHAUD3N6-FQMKXERB.js +0 -2
- package/dist/embed/embed-page-stateDiagram-v2-4FDKWEC3-G3EWQCOW.js +0 -1
- package/dist/embed/embed-page-zh-EYLHUD5G.js +0 -1
- package/dist/embed/embed-page-zh-FPYCTKQK.js +0 -1
- package/dist/embed/embed-page-zh-OPUVZZSQ.js +0 -1
- package/dist/mcpTransportRegistry-VXUVJKBC.mjs +0 -14
- package/dist/mcpTransportRegistry-VXUVJKBC.mjs.map +0 -1
- package/dist/open-MDC4VCR7.mjs.map +0 -1
- /package/dist/embed/{embed-page-chunk-34FVRFPW.js → embed-page-chunk-UH47IEAR.js} +0 -0
- /package/dist/{open-files-FS5AN6Q6.mjs.map → open-files-V3R2BFTV.mjs.map} +0 -0
|
@@ -1,3 +1,57 @@
|
|
|
1
|
+
// src/services/run-cancel/runCancelRuntime.ts
|
|
2
|
+
var runCancelRouter;
|
|
3
|
+
function setRunCancelRouter(router) {
|
|
4
|
+
runCancelRouter = router;
|
|
5
|
+
}
|
|
6
|
+
function getRunCancelRouter() {
|
|
7
|
+
return runCancelRouter;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// src/services/run-task/runTaskQuota.ts
|
|
11
|
+
function resolveRunTaskMaxActivePerTenant(env = process.env) {
|
|
12
|
+
return resolvePositiveInteger(env.RUN_TASK_MAX_ACTIVE_PER_TENANT);
|
|
13
|
+
}
|
|
14
|
+
function resolveRunTaskMaxRunningPerTenant(env = process.env) {
|
|
15
|
+
return resolvePositiveInteger(env.RUN_TASK_MAX_RUNNING_PER_TENANT);
|
|
16
|
+
}
|
|
17
|
+
function resolvePositiveInteger(raw) {
|
|
18
|
+
if (raw === void 0) return void 0;
|
|
19
|
+
const parsed = Number(raw);
|
|
20
|
+
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : void 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/services/run-task/runTaskRuntimeRegistry.ts
|
|
24
|
+
var current;
|
|
25
|
+
var publisher;
|
|
26
|
+
var wakeStatsSource;
|
|
27
|
+
function setRunTaskRuntime(runtime) {
|
|
28
|
+
current = runtime;
|
|
29
|
+
}
|
|
30
|
+
function getRunTaskRuntime() {
|
|
31
|
+
return current;
|
|
32
|
+
}
|
|
33
|
+
function setRunTaskWakePublisher(next) {
|
|
34
|
+
publisher = next;
|
|
35
|
+
}
|
|
36
|
+
function setRunTaskWakeStatsSource(next) {
|
|
37
|
+
wakeStatsSource = next;
|
|
38
|
+
}
|
|
39
|
+
function getRunTaskWakeStatsSource() {
|
|
40
|
+
return wakeStatsSource;
|
|
41
|
+
}
|
|
42
|
+
async function wakeRunTaskQueue() {
|
|
43
|
+
try {
|
|
44
|
+
await current?.wake();
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
const next = publisher;
|
|
48
|
+
if (!next) return;
|
|
49
|
+
try {
|
|
50
|
+
void next.publish().catch(() => void 0);
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
1
55
|
// src/services/workspace-file-service.ts
|
|
2
56
|
import * as fs2 from "fs/promises";
|
|
3
57
|
import * as path2 from "path";
|
|
@@ -174,6 +228,16 @@ function formatFileRefsSection(refs) {
|
|
|
174
228
|
}
|
|
175
229
|
|
|
176
230
|
export {
|
|
231
|
+
setRunCancelRouter,
|
|
232
|
+
getRunCancelRouter,
|
|
233
|
+
resolveRunTaskMaxActivePerTenant,
|
|
234
|
+
resolveRunTaskMaxRunningPerTenant,
|
|
235
|
+
setRunTaskRuntime,
|
|
236
|
+
getRunTaskRuntime,
|
|
237
|
+
setRunTaskWakePublisher,
|
|
238
|
+
setRunTaskWakeStatsSource,
|
|
239
|
+
getRunTaskWakeStatsSource,
|
|
240
|
+
wakeRunTaskQueue,
|
|
177
241
|
PathOutsideRootError,
|
|
178
242
|
isPathWithinRoot,
|
|
179
243
|
resolvePathWithinRoot,
|
|
@@ -183,4 +247,4 @@ export {
|
|
|
183
247
|
saveProjectFile,
|
|
184
248
|
formatFileRefsSection
|
|
185
249
|
};
|
|
186
|
-
//# sourceMappingURL=chunk-
|
|
250
|
+
//# sourceMappingURL=chunk-2SR4F3ZD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/run-cancel/runCancelRuntime.ts","../src/services/run-task/runTaskQuota.ts","../src/services/run-task/runTaskRuntimeRegistry.ts","../src/services/workspace-file-service.ts","../src/utils/path-containment.ts","../src/services/files/task-file-refs.ts"],"sourcesContent":["import type { RunCancelRouter } from \"./RunCancelRouter\";\n\nlet runCancelRouter: RunCancelRouter | undefined;\n\n/**\n * Register the process-wide run cancellation router.\n *\n * @param router - Router available to HTTP controllers, or `undefined` to\n * clear it during shutdown.\n *\n * @remarks\n * The router is only constructed when the gateway uses the Redis chunk source,\n * a Redis URL, and a durable run ledger. Controllers treat a missing router as\n * cancellation being unavailable rather than aborting locally.\n */\nexport function setRunCancelRouter(router?: RunCancelRouter): void {\n runCancelRouter = router;\n}\n\n/**\n * Return the registered run cancellation router, if any.\n *\n * @returns The process-wide router, or `undefined` when cancellation routing\n * is not configured for this replica.\n */\nexport function getRunCancelRouter(): RunCancelRouter | undefined {\n return runCancelRouter;\n}\n\n/**\n * Clear the process-wide run cancellation router between tests.\n *\n * @remarks Test-only helper; production code clears the router through\n * {@link setRunCancelRouter} during shutdown.\n */\nexport function resetRunCancelRouterForTests(): void {\n runCancelRouter = undefined;\n}\n","/**\n * Resolves the optional per-tenant run-queue admission limit.\n *\n * @param env Environment source; defaults to `process.env`.\n * @returns The configured positive safe integer, or `undefined` when unlimited.\n * @remarks Unset, blank, zero, negative, fractional and unsafe values all mean\n * unlimited. This is admission control (pending + running `run_api` rows per\n * tenant); it is not fair scheduling or per-tenant execution concurrency.\n */\nexport function resolveRunTaskMaxActivePerTenant(\n env: NodeJS.ProcessEnv = process.env,\n): number | undefined {\n return resolvePositiveInteger(env.RUN_TASK_MAX_ACTIVE_PER_TENANT);\n}\n\n/**\n * Resolves the optional per-tenant execution concurrency cap.\n *\n * @param env Environment source; defaults to `process.env`.\n * @returns The configured positive safe integer, or `undefined` when unlimited.\n * @remarks Unset, blank, zero, negative, fractional and unsafe values all mean\n * unlimited. This caps `running` `run_api` rows per tenant; it does not admit\n * or reject new work (that is {@link resolveRunTaskMaxActivePerTenant}) and it\n * is not strict round-robin fairness across tenants.\n */\nexport function resolveRunTaskMaxRunningPerTenant(\n env: NodeJS.ProcessEnv = process.env,\n): number | undefined {\n return resolvePositiveInteger(env.RUN_TASK_MAX_RUNNING_PER_TENANT);\n}\n\nfunction resolvePositiveInteger(raw: string | undefined): number | undefined {\n if (raw === undefined) return undefined;\n const parsed = Number(raw);\n return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : undefined;\n}\n","import type {\n RunTaskWakePublisher,\n RunTaskWakeStats,\n} from \"./RedisRunTaskWake\";\nimport type { RunTaskRuntime } from \"./RunTaskRuntime\";\n\n/** Structural source of wake transport posture for process metrics. */\nexport interface RunTaskWakeStatsSource {\n /** Returns a point-in-time wake posture snapshot. */\n stats(): RunTaskWakeStats;\n}\n\nlet current: RunTaskRuntime | undefined;\nlet publisher: RunTaskWakePublisher | undefined;\nlet wakeStatsSource: RunTaskWakeStatsSource | undefined;\n\n/**\n * Registers the process-local run task runtime.\n *\n * @param runtime The running runtime, or `undefined` on shutdown.\n * @remarks The registry is intentionally process-local: it can only wake the\n * worker in this process. Other replicas still discover pending runs through DB\n * polling, which remains authoritative.\n */\nexport function setRunTaskRuntime(runtime?: RunTaskRuntime): void {\n current = runtime;\n}\n\n/**\n * Returns the process-local run task runtime, when this replica runs one.\n *\n * @returns The registered runtime, or `undefined`.\n */\nexport function getRunTaskRuntime(): RunTaskRuntime | undefined {\n return current;\n}\n\n/**\n * Registers the best-effort cross-replica wake publisher.\n *\n * @param next The Redis-backed publisher, or `undefined` on shutdown.\n * @remarks API-only replicas may register a publisher without subscribing. A\n * missing publisher leaves the process-local wake (and DB polling) intact.\n */\nexport function setRunTaskWakePublisher(\n next?: RunTaskWakePublisher,\n): void {\n publisher = next;\n}\n\n/**\n * Registers the process-local wake transport used for metrics.\n *\n * @param next The wake transport, or `undefined` on shutdown.\n * @remarks Kept separate from the publish registry so API-only replicas can\n * expose publisher connection posture even without a local worker.\n */\nexport function setRunTaskWakeStatsSource(\n next?: RunTaskWakeStatsSource,\n): void {\n wakeStatsSource = next;\n}\n\n/**\n * Returns the process-local wake transport registered for metrics.\n *\n * @returns The wake stats source, or `undefined` when no Redis wake exists.\n */\nexport function getRunTaskWakeStatsSource(): RunTaskWakeStatsSource | undefined {\n return wakeStatsSource;\n}\n\n/**\n * Best-effort wake for newly created pending runs.\n *\n * @returns A promise that resolves after the local wake attempt; the Redis\n * publish continues in the background.\n * @remarks Never authoritative and never throws. The local runtime is woken\n * first so a hung or failed publisher cannot suppress it. The cross-replica\n * publish is fire-and-forget and wakes other worker replicas; this replica does\n * not depend on round-tripping its own frame. A missing runtime, missing\n * publisher, or transport failure leaves the durable run to polling.\n */\nexport async function wakeRunTaskQueue(): Promise<void> {\n try {\n await current?.wake();\n } catch {\n // Polling is the durable fallback; wake failures are best-effort.\n }\n const next = publisher;\n if (!next) return;\n try {\n void next.publish().catch(() => undefined);\n } catch {\n // Polling is the durable fallback; wake failures are best-effort.\n }\n}\n","import * as fs from \"fs/promises\";\nimport * as path from \"path\";\nimport { getStoreLattice, getSandBoxManager } from \"@axiom-lattice/core\";\nimport { isPathWithinRoot } from \"../utils/path-containment\";\n\n/** Binary file extensions handled as raw bytes rather than UTF-8 text. */\nconst BINARY_EXTENSIONS = new Set([\n \"pdf\", \"xlsx\", \"xls\", \"docx\", \"doc\", \"pptx\", \"ppt\",\n \"png\", \"jpg\", \"jpeg\", \"gif\", \"bmp\", \"ico\", \"webp\",\n \"mp3\", \"mp4\", \"webm\", \"ogg\", \"wav\", \"avi\", \"mov\",\n \"m4v\", \"mkv\", \"3gp\", \"m4a\", \"aac\", \"flac\", \"opus\", \"oga\", \"wma\", \"aiff\",\n \"zip\", \"tar\", \"gz\", \"rar\", \"7z\",\n]);\n\n/**\n * Whether a filename denotes a binary (non-UTF-8) payload, used to choose the\n * raw-bytes write path in sandbox volume backends.\n */\nexport function isBinaryContentType(filename: string): boolean {\n const ext = filename.split(\".\").pop()?.toLowerCase() || \"\";\n return BINARY_EXTENSIONS.has(ext);\n}\n\n/**\n * Filesystem root directory for a project, mirroring the layout used by the\n * workspace file backend (`/lattice_store/tenants/:tenant/workspaces/:ws/:project`).\n */\nexport function filesystemRootDirectory(\n tenantId: string,\n workspaceId: string,\n projectId: string,\n): string {\n return `/lattice_store/tenants/${tenantId}/workspaces/${workspaceId}/${projectId}`;\n}\n\n/** Raised when a file write request is rejected for path/name safety reasons. */\nexport class ProjectFileValidationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ProjectFileValidationError\";\n }\n}\n\n/** Parameters for writing a file into a project's workspace storage. */\nexport interface SaveProjectFileParams {\n tenantId: string;\n projectId: string;\n /**\n * Pre-resolved workspace id. When omitted it is derived from the project via\n * the project store (needed by callers that only know the project, e.g. A2A).\n */\n workspaceId?: string;\n name: string;\n bytes: Uint8Array;\n mimeType?: string;\n /** Relative subdirectory under the project root; sandbox defaults to `/project/uploads`. */\n path?: string;\n assistantId?: string;\n}\n\n/** Result of a successful project-file write. */\nexport interface SavedProjectFile {\n /** Storage path usable as a `TaskFileRef.uri` (e.g. `/project/uploads/a.pdf`). */\n uri: string;\n name: string;\n size: number;\n}\n\n/**\n * Persist file bytes into a project's workspace storage and return a URI to it.\n *\n * Supports both sandbox-backed workspaces (delegating to the sandbox/volume\n * upload API) and filesystem-backed workspaces (writing under the project root).\n * The returned URI is the storage path agents reference via {@link TaskFileRef}.\n */\nexport async function saveProjectFile(\n params: SaveProjectFileParams,\n): Promise<SavedProjectFile> {\n const workspaceStore = getStoreLattice(\"default\", \"workspace\").store;\n const projectStore = getStoreLattice(\"default\", \"project\").store;\n\n let workspaceId = params.workspaceId;\n if (!workspaceId) {\n const project = await projectStore.getProjectById(\n params.tenantId,\n params.projectId,\n );\n if (!project) {\n throw new Error(\"Project not found\");\n }\n workspaceId = project.workspaceId;\n }\n\n const workspace = await workspaceStore.getWorkspaceById(\n params.tenantId,\n workspaceId,\n );\n if (!workspace) {\n throw new Error(\"Workspace not found\");\n }\n\n const buffer = Buffer.from(params.bytes);\n const filename = params.name || \"file\";\n const pathValue = params.path;\n\n // Validate the untrusted filename before any path join or disk I/O, equally\n // for sandbox and filesystem branches: reject anything that is not a bare\n // basename on either path flavor (blocks \"../../etc/passwd\", \"a\\\\b\", \"..\").\n if (\n path.basename(filename) !== filename ||\n path.posix.basename(filename) !== filename ||\n filename === \"..\"\n ) {\n throw new ProjectFileValidationError(\"Invalid filename\");\n }\n\n if (workspace.storageType === \"sandbox\") {\n const sandboxManager = getSandBoxManager();\n const volumeConfig = {\n assistant_id: params.assistantId || \"\",\n thread_id: \"\",\n tenantId: params.tenantId,\n workspaceId,\n projectId: params.projectId,\n };\n\n const relativePath = pathValue\n ? path.posix.join(pathValue, filename)\n : path.posix.join(\"/project/uploads\", filename);\n\n const isBinary = isBinaryContentType(filename);\n const volumeBackend = await sandboxManager.getVolumeBackendForPath(\n volumeConfig,\n relativePath,\n );\n if (volumeBackend && !isBinary) {\n await volumeBackend.write(relativePath, buffer.toString(\"utf-8\"));\n } else if (volumeBackend && volumeBackend.writeBinary) {\n await volumeBackend.writeBinary(relativePath, buffer);\n } else {\n const sandbox = await sandboxManager.getSandboxFromConfig(volumeConfig);\n await sandbox.file.uploadFile({ file: relativePath, data: buffer });\n }\n\n return { uri: relativePath, name: filename, size: buffer.length };\n }\n\n const rootDir = filesystemRootDirectory(\n params.tenantId,\n workspaceId,\n params.projectId,\n );\n await fs.mkdir(rootDir, { recursive: true });\n const relativeDirectory = pathValue?.replace(/^[/\\\\]+/, \"\") || \".\";\n const targetDir = path.resolve(rootDir, relativeDirectory);\n if (!isPathWithinRoot(path.resolve(rootDir), targetDir)) {\n throw new ProjectFileValidationError(\n \"Upload path must stay within the project directory\",\n );\n }\n await fs.mkdir(targetDir, { recursive: true });\n\n const [resolvedRoot, resolvedTargetDir] = await Promise.all([\n fs.realpath(rootDir),\n fs.realpath(targetDir),\n ]);\n if (!isPathWithinRoot(resolvedRoot, resolvedTargetDir)) {\n throw new ProjectFileValidationError(\n \"Upload path must stay within the project directory\",\n );\n }\n\n const targetPath = path.join(resolvedTargetDir, filename);\n await fs.writeFile(targetPath, buffer);\n const stat = await fs.stat(targetPath);\n\n const uri = path.posix.join(\"/\", relativeDirectory, filename);\n return { uri, name: filename, size: stat.size };\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nexport class PathOutsideRootError extends Error {\n constructor(\n public readonly rootPath: string,\n public readonly targetPath: string,\n ) {\n super(`Path is outside the allowed root: ${targetPath}`);\n this.name = \"PathOutsideRootError\";\n }\n}\n\nexport function isPathWithinRoot(rootPath: string, targetPath: string): boolean {\n const relative = path.relative(rootPath, targetPath);\n return (\n relative === \"\" ||\n (relative !== \"..\" &&\n !relative.startsWith(`..${path.sep}`) &&\n !path.isAbsolute(relative))\n );\n}\n\nexport async function resolvePathWithinRoot(\n rootPath: string,\n targetPath: string,\n): Promise<{ rootPath: string; targetPath: string }> {\n const [resolvedRoot, resolvedTarget] = await Promise.all([\n fs.realpath(rootPath),\n fs.realpath(targetPath),\n ]);\n\n if (!isPathWithinRoot(resolvedRoot, resolvedTarget)) {\n throw new PathOutsideRootError(resolvedRoot, resolvedTarget);\n }\n\n return { rootPath: resolvedRoot, targetPath: resolvedTarget };\n}\n","import type { TaskFileRef } from \"@axiom-lattice/protocols\";\n\n/** Render task file references for Agent-visible message text. */\nexport function formatFileRefsSection(refs: TaskFileRef[]): string {\n const lines = refs.map((ref) => {\n const label = ref.name ?? ref.uri;\n const mime = ref.mimeType ? ` (${ref.mimeType})` : \"\";\n return `- ${label}${mime}: ${ref.uri}`;\n });\n return [\"[附件]\", ...lines].join(\"\\n\");\n}\n"],"mappings":";AAEA,IAAI;AAaG,SAAS,mBAAmB,QAAgC;AACjE,oBAAkB;AACpB;AAQO,SAAS,qBAAkD;AAChE,SAAO;AACT;;;AClBO,SAAS,iCACd,MAAyB,QAAQ,KACb;AACpB,SAAO,uBAAuB,IAAI,8BAA8B;AAClE;AAYO,SAAS,kCACd,MAAyB,QAAQ,KACb;AACpB,SAAO,uBAAuB,IAAI,+BAA+B;AACnE;AAEA,SAAS,uBAAuB,KAA6C;AAC3E,MAAI,QAAQ,OAAW,QAAO;AAC9B,QAAM,SAAS,OAAO,GAAG;AACzB,SAAO,OAAO,cAAc,MAAM,KAAK,SAAS,IAAI,SAAS;AAC/D;;;ACvBA,IAAI;AACJ,IAAI;AACJ,IAAI;AAUG,SAAS,kBAAkB,SAAgC;AAChE,YAAU;AACZ;AAOO,SAAS,oBAAgD;AAC9D,SAAO;AACT;AASO,SAAS,wBACd,MACM;AACN,cAAY;AACd;AASO,SAAS,0BACd,MACM;AACN,oBAAkB;AACpB;AAOO,SAAS,4BAAgE;AAC9E,SAAO;AACT;AAaA,eAAsB,mBAAkC;AACtD,MAAI;AACF,UAAM,SAAS,KAAK;AAAA,EACtB,QAAQ;AAAA,EAER;AACA,QAAM,OAAO;AACb,MAAI,CAAC,KAAM;AACX,MAAI;AACF,SAAK,KAAK,QAAQ,EAAE,MAAM,MAAM,MAAS;AAAA,EAC3C,QAAQ;AAAA,EAER;AACF;;;AChGA,YAAYA,SAAQ;AACpB,YAAYC,WAAU;AACtB,SAAS,iBAAiB,yBAAyB;;;ACFnD,YAAY,QAAQ;AACpB,YAAY,UAAU;AAEf,IAAM,uBAAN,cAAmC,MAAM;AAAA,EAC9C,YACkB,UACA,YAChB;AACA,UAAM,qCAAqC,UAAU,EAAE;AAHvC;AACA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,SAAS,iBAAiB,UAAkB,YAA6B;AAC9E,QAAMC,YAAgB,cAAS,UAAU,UAAU;AACnD,SACEA,cAAa,MACZA,cAAa,QACZ,CAACA,UAAS,WAAW,KAAU,QAAG,EAAE,KACpC,CAAM,gBAAWA,SAAQ;AAE/B;AAEA,eAAsB,sBACpB,UACA,YACmD;AACnD,QAAM,CAAC,cAAc,cAAc,IAAI,MAAM,QAAQ,IAAI;AAAA,IACpD,YAAS,QAAQ;AAAA,IACjB,YAAS,UAAU;AAAA,EACxB,CAAC;AAED,MAAI,CAAC,iBAAiB,cAAc,cAAc,GAAG;AACnD,UAAM,IAAI,qBAAqB,cAAc,cAAc;AAAA,EAC7D;AAEA,SAAO,EAAE,UAAU,cAAc,YAAY,eAAe;AAC9D;;;AD/BA,IAAM,oBAAoB,oBAAI,IAAI;AAAA,EAChC;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAO;AAAA,EAAQ;AAAA,EAC7C;AAAA,EAAO;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAC3C;AAAA,EAAO;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAC3C;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAO;AAAA,EAAO;AAAA,EACjE;AAAA,EAAO;AAAA,EAAO;AAAA,EAAM;AAAA,EAAO;AAC7B,CAAC;AAMM,SAAS,oBAAoB,UAA2B;AAC7D,QAAM,MAAM,SAAS,MAAM,GAAG,EAAE,IAAI,GAAG,YAAY,KAAK;AACxD,SAAO,kBAAkB,IAAI,GAAG;AAClC;AAMO,SAAS,wBACd,UACA,aACA,WACQ;AACR,SAAO,0BAA0B,QAAQ,eAAe,WAAW,IAAI,SAAS;AAClF;AAGO,IAAM,6BAAN,cAAyC,MAAM;AAAA,EACpD,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAkCA,eAAsB,gBACpB,QAC2B;AAC3B,QAAM,iBAAiB,gBAAgB,WAAW,WAAW,EAAE;AAC/D,QAAM,eAAe,gBAAgB,WAAW,SAAS,EAAE;AAE3D,MAAI,cAAc,OAAO;AACzB,MAAI,CAAC,aAAa;AAChB,UAAM,UAAU,MAAM,aAAa;AAAA,MACjC,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AACA,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,mBAAmB;AAAA,IACrC;AACA,kBAAc,QAAQ;AAAA,EACxB;AAEA,QAAM,YAAY,MAAM,eAAe;AAAA,IACrC,OAAO;AAAA,IACP;AAAA,EACF;AACA,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,QAAM,SAAS,OAAO,KAAK,OAAO,KAAK;AACvC,QAAM,WAAW,OAAO,QAAQ;AAChC,QAAM,YAAY,OAAO;AAKzB,MACO,eAAS,QAAQ,MAAM,YACvB,YAAM,SAAS,QAAQ,MAAM,YAClC,aAAa,MACb;AACA,UAAM,IAAI,2BAA2B,kBAAkB;AAAA,EACzD;AAEA,MAAI,UAAU,gBAAgB,WAAW;AACvC,UAAM,iBAAiB,kBAAkB;AACzC,UAAM,eAAe;AAAA,MACnB,cAAc,OAAO,eAAe;AAAA,MACpC,WAAW;AAAA,MACX,UAAU,OAAO;AAAA,MACjB;AAAA,MACA,WAAW,OAAO;AAAA,IACpB;AAEA,UAAM,eAAe,YACZ,YAAM,KAAK,WAAW,QAAQ,IAC9B,YAAM,KAAK,oBAAoB,QAAQ;AAEhD,UAAM,WAAW,oBAAoB,QAAQ;AAC7C,UAAM,gBAAgB,MAAM,eAAe;AAAA,MACzC;AAAA,MACA;AAAA,IACF;AACA,QAAI,iBAAiB,CAAC,UAAU;AAC9B,YAAM,cAAc,MAAM,cAAc,OAAO,SAAS,OAAO,CAAC;AAAA,IAClE,WAAW,iBAAiB,cAAc,aAAa;AACrD,YAAM,cAAc,YAAY,cAAc,MAAM;AAAA,IACtD,OAAO;AACL,YAAM,UAAU,MAAM,eAAe,qBAAqB,YAAY;AACtE,YAAM,QAAQ,KAAK,WAAW,EAAE,MAAM,cAAc,MAAM,OAAO,CAAC;AAAA,IACpE;AAEA,WAAO,EAAE,KAAK,cAAc,MAAM,UAAU,MAAM,OAAO,OAAO;AAAA,EAClE;AAEA,QAAM,UAAU;AAAA,IACd,OAAO;AAAA,IACP;AAAA,IACA,OAAO;AAAA,EACT;AACA,QAAS,UAAM,SAAS,EAAE,WAAW,KAAK,CAAC;AAC3C,QAAM,oBAAoB,WAAW,QAAQ,WAAW,EAAE,KAAK;AAC/D,QAAM,YAAiB,cAAQ,SAAS,iBAAiB;AACzD,MAAI,CAAC,iBAAsB,cAAQ,OAAO,GAAG,SAAS,GAAG;AACvD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,QAAS,UAAM,WAAW,EAAE,WAAW,KAAK,CAAC;AAE7C,QAAM,CAAC,cAAc,iBAAiB,IAAI,MAAM,QAAQ,IAAI;AAAA,IACvD,aAAS,OAAO;AAAA,IAChB,aAAS,SAAS;AAAA,EACvB,CAAC;AACD,MAAI,CAAC,iBAAiB,cAAc,iBAAiB,GAAG;AACtD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,aAAkB,WAAK,mBAAmB,QAAQ;AACxD,QAAS,cAAU,YAAY,MAAM;AACrC,QAAMC,QAAO,MAAS,SAAK,UAAU;AAErC,QAAM,MAAW,YAAM,KAAK,KAAK,mBAAmB,QAAQ;AAC5D,SAAO,EAAE,KAAK,MAAM,UAAU,MAAMA,MAAK,KAAK;AAChD;;;AE/KO,SAAS,sBAAsB,MAA6B;AACjE,QAAM,QAAQ,KAAK,IAAI,CAAC,QAAQ;AAC9B,UAAM,QAAQ,IAAI,QAAQ,IAAI;AAC9B,UAAM,OAAO,IAAI,WAAW,KAAK,IAAI,QAAQ,MAAM;AACnD,WAAO,KAAK,KAAK,GAAG,IAAI,KAAK,IAAI,GAAG;AAAA,EACtC,CAAC;AACD,SAAO,CAAC,kBAAQ,GAAG,KAAK,EAAE,KAAK,IAAI;AACrC;","names":["fs","path","relative","stat"]}
|
|
@@ -11,19 +11,32 @@ function deriveAgentSkills(assistant) {
|
|
|
11
11
|
}
|
|
12
12
|
function buildAgentCardForAssistant(params) {
|
|
13
13
|
const { assistant, baseUrl } = params;
|
|
14
|
-
const jsonRpcUrl = `${baseUrl}
|
|
14
|
+
const jsonRpcUrl = `${baseUrl}${params.jsonRpcPath ?? `/api/a2a/agents/${assistant.id}/jsonrpc`}`;
|
|
15
15
|
return {
|
|
16
16
|
name: assistant.name,
|
|
17
17
|
description: assistant.description ?? "",
|
|
18
18
|
url: jsonRpcUrl,
|
|
19
19
|
protocolVersion: "0.3.0",
|
|
20
20
|
version: "1.0.0",
|
|
21
|
+
supportsAuthenticatedExtendedCard: true,
|
|
21
22
|
defaultInputModes: ["text"],
|
|
22
23
|
defaultOutputModes: ["text"],
|
|
23
24
|
capabilities: {
|
|
24
25
|
streaming: true,
|
|
25
|
-
pushNotifications:
|
|
26
|
-
stateTransitionHistory: true
|
|
26
|
+
pushNotifications: params.pushNotifications ?? true,
|
|
27
|
+
stateTransitionHistory: true,
|
|
28
|
+
extensions: [
|
|
29
|
+
{
|
|
30
|
+
uri: "https://axiom-lattice.dev/a2a/extensions/push-notifications-experimental",
|
|
31
|
+
description: "Push notifications are experimental and best-effort. Delivery is at-most-once; clients should poll tasks/get or use tasks/resubscribe for reliability.",
|
|
32
|
+
params: {
|
|
33
|
+
experimental: true,
|
|
34
|
+
reliable: false,
|
|
35
|
+
delivery: "at-most-once"
|
|
36
|
+
},
|
|
37
|
+
required: false
|
|
38
|
+
}
|
|
39
|
+
]
|
|
27
40
|
},
|
|
28
41
|
skills: deriveAgentSkills(assistant),
|
|
29
42
|
additionalInterfaces: [{ transport: "JSONRPC", url: jsonRpcUrl }],
|
|
@@ -47,4 +60,4 @@ function buildAgentCardForAssistant(params) {
|
|
|
47
60
|
export {
|
|
48
61
|
buildAgentCardForAssistant
|
|
49
62
|
};
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
63
|
+
//# sourceMappingURL=chunk-J6B2VFJ7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/a2a/A2AAgentCardBuilder.ts"],"sourcesContent":["import type { AgentCard, A2ASkill, AgentMiddlewareConfig } from \"@axiom-lattice/protocols\";\n\n/** Minimal assistant shape needed to derive a card from its own definition. */\nexport interface CardAssistant {\n id: string;\n name: string;\n description?: string;\n graphDefinition?: {\n middleware?: AgentMiddlewareConfig[];\n } | null;\n}\n\n/**\n * Parameters for building a per-assistant A2A AgentCard.\n */\nexport interface BuildAgentCardParams {\n assistant: CardAssistant;\n /** Gateway origin, e.g. \"https://gw.example.com\". */\n baseUrl: string;\n /** Optional JSON-RPC endpoint path override (official `/a2a/:id` alias). */\n jsonRpcPath?: string;\n /** Advertise push notification support; defaults to `true`. */\n pushNotifications?: boolean;\n}\n\n/**\n * Derive the card's advertised skills from the agent's own definition: every\n * enabled middleware contributes a skill (id = middleware type, name/description\n * from its config). No manual `a2aExposure` declaration — the card reflects\n * what the agent is actually built from.\n */\nexport function deriveAgentSkills(assistant: CardAssistant): A2ASkill[] {\n const enabled = assistant.graphDefinition?.middleware?.filter((m) => m.enabled) ?? [];\n return enabled.map((m) => ({\n id: m.type || m.id,\n name: m.name || m.type || m.id,\n description: m.description || \"\",\n tags: [],\n examples: [],\n }));\n}\n\n/**\n * Build an A2A 0.3 AgentCard (discovery document) for a single assistant.\n *\n * `url` points at the assistant's JSON-RPC endpoint (also advertised via\n * `additionalInterfaces`). Skills are derived from the agent definition;\n * input/output modes default to text.\n */\nexport function buildAgentCardForAssistant(params: BuildAgentCardParams): AgentCard {\n const { assistant, baseUrl } = params;\n const jsonRpcUrl = `${baseUrl}${\n params.jsonRpcPath ?? `/api/a2a/agents/${assistant.id}/jsonrpc`\n }`;\n\n return {\n name: assistant.name,\n description: assistant.description ?? \"\",\n url: jsonRpcUrl,\n protocolVersion: \"0.3.0\",\n version: \"1.0.0\",\n supportsAuthenticatedExtendedCard: true,\n defaultInputModes: [\"text\"],\n defaultOutputModes: [\"text\"],\n capabilities: {\n streaming: true,\n pushNotifications: params.pushNotifications ?? true,\n stateTransitionHistory: true,\n extensions: [\n {\n uri: \"https://axiom-lattice.dev/a2a/extensions/push-notifications-experimental\",\n description:\n \"Push notifications are experimental and best-effort. Delivery is at-most-once; clients should poll tasks/get or use tasks/resubscribe for reliability.\",\n params: {\n experimental: true,\n reliable: false,\n delivery: \"at-most-once\",\n },\n required: false,\n },\n ],\n },\n skills: deriveAgentSkills(assistant),\n additionalInterfaces: [{ transport: \"JSONRPC\", url: jsonRpcUrl }],\n securitySchemes: {\n bearer: {\n type: \"http\",\n scheme: \"Bearer\",\n description: \"API key sent as an Authorization Bearer token\",\n },\n apiKeyHeader: {\n type: \"apiKey\",\n in: \"header\",\n name: \"x-api-key\",\n description: \"API key sent via the x-api-key header\",\n },\n },\n security: [{ bearer: [] }, { apiKeyHeader: [] }],\n };\n}\n"],"mappings":";AA+BO,SAAS,kBAAkB,WAAsC;AACtE,QAAM,UAAU,UAAU,iBAAiB,YAAY,OAAO,CAAC,MAAM,EAAE,OAAO,KAAK,CAAC;AACpF,SAAO,QAAQ,IAAI,CAAC,OAAO;AAAA,IACzB,IAAI,EAAE,QAAQ,EAAE;AAAA,IAChB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE;AAAA,IAC5B,aAAa,EAAE,eAAe;AAAA,IAC9B,MAAM,CAAC;AAAA,IACP,UAAU,CAAC;AAAA,EACb,EAAE;AACJ;AASO,SAAS,2BAA2B,QAAyC;AAClF,QAAM,EAAE,WAAW,QAAQ,IAAI;AAC/B,QAAM,aAAa,GAAG,OAAO,GAC3B,OAAO,eAAe,mBAAmB,UAAU,EAAE,UACvD;AAEA,SAAO;AAAA,IACL,MAAM,UAAU;AAAA,IAChB,aAAa,UAAU,eAAe;AAAA,IACtC,KAAK;AAAA,IACL,iBAAiB;AAAA,IACjB,SAAS;AAAA,IACT,mCAAmC;AAAA,IACnC,mBAAmB,CAAC,MAAM;AAAA,IAC1B,oBAAoB,CAAC,MAAM;AAAA,IAC3B,cAAc;AAAA,MACZ,WAAW;AAAA,MACX,mBAAmB,OAAO,qBAAqB;AAAA,MAC/C,wBAAwB;AAAA,MACxB,YAAY;AAAA,QACV;AAAA,UACE,KAAK;AAAA,UACL,aACE;AAAA,UACF,QAAQ;AAAA,YACN,cAAc;AAAA,YACd,UAAU;AAAA,YACV,UAAU;AAAA,UACZ;AAAA,UACA,UAAU;AAAA,QACZ;AAAA,MACF;AAAA,IACF;AAAA,IACA,QAAQ,kBAAkB,SAAS;AAAA,IACnC,sBAAsB,CAAC,EAAE,WAAW,WAAW,KAAK,WAAW,CAAC;AAAA,IAChE,iBAAiB;AAAA,MACf,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,aAAa;AAAA,MACf;AAAA,MACA,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA,UAAU,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,cAAc,CAAC,EAAE,CAAC;AAAA,EACjD;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as L}from"./embed-page-chunk-BOEX26H7.js";import"./embed-page-chunk-XFV3N2LD.js";import"./embed-page-chunk-FEMHLB6I.js";import"./embed-page-chunk-JFMBLJXY.js";import"./embed-page-chunk-NFMLKSPM.js";import"./embed-page-chunk-S2KVN3RB.js";import"./embed-page-chunk-S4XZPBRM.js";import"./embed-page-chunk-EYYKNTX7.js";import{T as E,h as P}from"./embed-page-chunk-N66H4DNH.js";import"./embed-page-chunk-BANVRQT7.js";import{a as F}from"./embed-page-chunk-436REIWY.js";import{s as T}from"./embed-page-chunk-37LGEEJU.js";import{a as C}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-SRMYHWL3.js";import{U as p,W as m,oa as b,ua as I,wa as c}from"./embed-page-chunk-4W34QOXT.js";import{a as N}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as u}from"./embed-page-chunk-QBTAJ2YI.js";var n=u(N());var t=u(C()),O={component_key:"workspace_assistants",data:{}},$=d=>{let i=d;if(typeof d=="string")try{i=JSON.parse(d)}catch{return{}}return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{}},W=({data:d})=>{let{assistantId:i,initialTab:R}=d??{},{get:f,put:y,del:A}=F(),e=T(),v=P(),[g,w]=(0,n.useState)(null),[B,h]=(0,n.useState)([]),[_,S]=(0,n.useState)(!1),[j,k]=(0,n.useState)(null),l=(0,n.useCallback)(()=>{v({...O,message:e("governance.detail.listCardMessage")})},[v,e]),o=(0,n.useCallback)(async()=>{S(!0),k(null);try{let s=(await f("/api/assistants")).data?.records??[];h(s),w(s.find(r=>r.id===i)??null)}catch{k(e("governance.detail.loadFailed"))}finally{S(!1)}},[f,i,e]);(0,n.useEffect)(()=>{i&&o()},[o,i]);let x=(0,n.useCallback)(async(a,s)=>{let r=$(a.graphDefinition),D;try{D=await y(`/api/assistants/${a.id}`,{name:s.name!==void 0?s.name:a.name,description:s.description!==void 0?s.description:a.description,graphDefinition:{...r,...s}})}catch(G){throw c.error(e("governance.detail.saveFailed")),G}if(!D.success)throw c.error(e("governance.detail.saveFailed")),new Error("Failed to save agent");c.success(e("common.saved")),await o()},[y,o,e]),z=(0,n.useCallback)(a=>{w(s=>s&&s.id===a.id?a:s),h(s=>s.map(r=>r.id===a.id?a:r))},[]),U=(0,n.useCallback)(async a=>{if(!(await A(`/api/assistants/${a}`)).success)throw new Error("Failed to delete agent");c.success(e("governance.detail.deleted")),l()},[A,l,e]);return i?g?(0,t.jsx)("div",{style:{height:"100%",overflow:"auto"},children:(0,t.jsx)(E,{children:(0,t.jsx)(L,{assistant:g,allAssistants:B,onBack:l,onDeleted:U,onSave:x,onAssistantUpdated:z,onAgentListInvalidated:()=>void o(),initialTab:R})},g.id)}):_?(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,t.jsx)(I,{})}):j?(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(p,{type:"error",showIcon:!0,message:e("governance.detail.loadFailed"),"data-testid":"detail-error",action:(0,t.jsxs)(b,{children:[(0,t.jsx)(m,{size:"small",onClick:()=>void o(),children:e("common.retry")}),(0,t.jsx)(m,{size:"small",type:"primary",onClick:l,children:e("governance.detail.backToList")})]})})}):(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(p,{type:"warning",showIcon:!0,message:e("governance.detail.notFound"),"data-testid":"detail-not-found",action:(0,t.jsx)(m,{size:"small",type:"primary",onClick:l,children:e("governance.detail.backToList")})})}):(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(p,{type:"warning",showIcon:!0,message:e("governance.detail.missingId"),"data-testid":"detail-missing-id"})})};export{W as AgentDetailSideApp};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Ie,b as De,c as kt,d as xt,e as wt,f as Tt,g as It,h as St,i as Ft,j as Rt,k as Dt}from"./embed-page-chunk-BOEX26H7.js";import{a as Ve}from"./embed-page-chunk-XFV3N2LD.js";import"./embed-page-chunk-FEMHLB6I.js";import"./embed-page-chunk-JFMBLJXY.js";import"./embed-page-chunk-NFMLKSPM.js";import{b as Oe,e as _e,f as ft,g as yt,h as ht,i as Ct,l as At,m as bt}from"./embed-page-chunk-S2KVN3RB.js";import{a as ct,b as dt,c as gt,d as pt,e as mt}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import"./embed-page-chunk-EYYKNTX7.js";import{T as vt,e as lt,h as ut,r as Ne}from"./embed-page-chunk-N66H4DNH.js";import{B as et,Ia as st,N as tt,R as nt,Xa as rt,_ as at,la as ot,m as Te,ra as it}from"./embed-page-chunk-BANVRQT7.js";import{a as me}from"./embed-page-chunk-436REIWY.js";import{s as z,z as Ze}from"./embed-page-chunk-37LGEEJU.js";import{a as E}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-SRMYHWL3.js";import{Da as $e,Ga as we,Ha as We,Ia as X,Ra as Ye,W,Yb as Re,_ as xe,aa as je,ea as Fe,ic as Qe,ka as Be,la as Ue,ma as qe,oa as He,ra as D,ta as _,tc as Xe,va as Le,wa as w,xa as pe,zb as Je}from"./embed-page-chunk-4W34QOXT.js";import{a as ge}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as I}from"./embed-page-chunk-QBTAJ2YI.js";var h=I(ge());var te=I(ge());var Z=I(ge());var Pt=I(ge());var se=I(E()),Mt=60,Et=72,Ge=(0,Pt.memo)(({data:i})=>{let l=Ie(i.type),f=Math.min(12+Math.sqrt(i.subAgentCount)*10,48);return(0,se.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,se.jsx)(_e,{type:"target",position:Oe.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:0,height:0},isConnectable:!1}),(0,se.jsx)("div",{title:i.label,style:{width:f,height:f,borderRadius:"50%",background:De(l.color),display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:Math.max(10,f*.4),fontWeight:600,cursor:"pointer",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:i.label.charAt(0).toUpperCase()}),(0,se.jsx)("div",{style:{fontSize:11,maxWidth:120,textAlign:"center",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:4},children:i.label}),(0,se.jsx)(_e,{type:"source",position:Oe.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:0,height:0},isConnectable:!1})]})});Ge.displayName="AgentGraphNode";var ee=I(E()),en=({assistants:i,onNodeClick:l})=>{let[f,c,u]=ht([]),[o,t,C]=Ct([]),[r,m]=(0,Z.useState)(null),S=(0,Z.useMemo)(()=>({agent:Ge}),[]),M=(0,Z.useMemo)(()=>wt(i),[i]);(0,Z.useEffect)(()=>{let k=M.nodes.map(g=>({id:g.id})),R=M.edges.map(g=>({source:g.source,target:g.target})),P=new Map(M.nodes.map(g=>[g.id,g])),$=pt(k).force("link",gt(R).id(g=>g.id).distance(80)).force("charge",mt().strength(-220)).force("center",ct(0,0)).force("collide",dt(45)).stop();for(let g=0;g<300;g++)$.tick();let j=k.map(g=>({id:g.id,type:"agent",data:P.get(g.id),position:{x:g.x-Mt/2,y:g.y-Et/2}})),a=M.edges.map(g=>({id:`e${g.source}-${g.target}`,source:g.source,target:g.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"}));c(j),t(a)},[M,c,t]);let H=(0,Z.useMemo)(()=>r===null?f:f.map(k=>{let R=k.id===r||o.some(P=>P.source===r&&P.target===k.id||P.target===r&&P.source===k.id);return{...k,style:{opacity:R?1:.2,transition:"opacity 0.2s ease"}}}),[f,o,r]),d=(0,Z.useMemo)(()=>r===null?o.map(k=>({...k,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):o.map(k=>{let R=k.source===r||k.target===r;return{...k,style:{stroke:"#1677ff",strokeWidth:R?2.5:1,opacity:R?1:.04,transition:"opacity 0.2s ease"}}}),[o,r]);return(0,ee.jsx)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:(0,ee.jsxs)(yt,{nodes:H,edges:d,onNodesChange:u,onEdgesChange:C,onNodeMouseEnter:(k,R)=>m(R.id),onNodeMouseLeave:()=>m(null),onNodeClick:(k,R)=>l?.(String(R.id)),nodeTypes:S,fitView:!0,fitViewOptions:{padding:.25},children:[(0,ee.jsx)(At,{color:"#eee",gap:20}),(0,ee.jsx)(bt,{})]})})},Kt=i=>(0,ee.jsx)(ft,{children:(0,ee.jsx)(en,{...i})});var T=I(E()),tn=[{key:"all",labelKey:"governance.list.tab.all"},{key:"capability",labelKey:"governance.list.tab.capability"},{key:"orchestrator",labelKey:"governance.list.tab.orchestrator"},{key:"workflow",labelKey:"governance.list.tab.workflow"}],Bt=({items:i,assistants:l=[],loading:f,onItemClick:c,onOpenPlayground:u,onOpenEval:o,onCreate:t,onDelete:C})=>{let r=z(),[m,S]=(0,te.useState)("all"),[M,H]=(0,te.useState)(null),[d,k]=(0,te.useState)(null),R=(0,te.useMemo)(()=>{let a=new Set;return i.forEach(g=>g.tags.forEach(U=>a.add(U))),Array.from(a).map(g=>({value:g,label:g}))},[i]),P=(0,te.useMemo)(()=>i.filter(a=>!(m!=="all"&&a.type!==m||M&&!a.tags.includes(M)||d&&a.status!==d)),[i,m,M,d]),$=[{key:"edit",icon:it,label:r("common.edit"),onClick:a=>c(a.id)},{key:"playground",icon:et,label:r("governance.list.action.playground"),onClick:a=>u(a.id)},{key:"eval",icon:nt,label:r("governance.list.action.eval"),onClick:a=>o(a.id)}];C&&$.push({key:"delete",icon:st,label:r("common.delete"),danger:!0,onClick:a=>C(a.id)});let j=(0,te.useMemo)(()=>[{mode:"graph",icon:ot,label:r("governance.list.viewMode.graph"),render:()=>(0,T.jsx)(Kt,{assistants:l,onNodeClick:c})}],[l,c,r]);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("span",{"data-testid":"agent-list-state","data-loading":String(f),"data-count":P.length,hidden:!0,"aria-hidden":"true"}),(0,T.jsx)(lt,{title:r("governance.list.title"),itemName:"common.item.agent",items:P,loading:f,keyExtractor:a=>a.id,tabs:tn.map(a=>({key:a.key,label:r(a.labelKey)})),activeTab:m,onTabChange:a=>S(a),headerLeft:(0,T.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,T.jsx)(Ne,{value:M,onChange:H,options:R,placeholder:r("governance.list.filter.domain"),allLabel:r("governance.list.filter.allDomains")}),(0,T.jsx)(Ne,{value:d,onChange:k,options:[{value:"enabled",label:r("governance.list.status.enabled")},{value:"draft",label:r("governance.list.status.draft")},{value:"disabled",label:r("governance.list.status.disabled")}],placeholder:r("governance.list.filter.status"),allLabel:r("governance.list.filter.allStatuses")})]}),renderIcon:a=>{let g=De(Ie(a.type).color);return(0,T.jsx)("div",{title:r("governance.list.typeIconTitle",{type:a.type}),style:{width:32,height:32,borderRadius:8,background:`${g}1A`,color:g,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,T.jsx)(Te,{size:18})})},renderPrimary:a=>(0,T.jsx)("span",{"data-testid":"agent-name","data-agent-id":a.id,children:a.name}),renderSecondary:a=>a.description||void 0,renderDetails:a=>(0,T.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,T.jsxs)("div",{style:{display:"flex",gap:4,flexWrap:"wrap",alignItems:"center"},children:[a.tags.map(g=>(0,T.jsx)(we,{color:"magenta",style:{margin:0,borderRadius:10,border:"none"},children:g},g)),(0,T.jsx)(we,{color:Ie(a.type).color,style:{margin:0,borderRadius:10,border:"none"},children:a.type})]}),(0,T.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[(0,T.jsx)(je,{title:r("governance.list.statusTooltip",{status:a.status}),children:(0,T.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",background:kt(a.status),display:"inline-block",cursor:"help"}})}),(0,T.jsx)("span",{style:{fontSize:12,color:"#8c8c8c"},children:a.version})]})]}),itemActions:$,actionsStyle:"icon",actionsPosition:"hover",onItemClick:a=>c(a.id),createLabel:r("governance.list.create"),onCreateClick:t,viewModeExtensions:j,emptyIcon:(0,T.jsx)(Te,{size:48,style:{opacity:.5}}),emptyTitle:r("governance.list.emptyTitle"),emptyDescription:r("governance.list.emptyDescription")})]})};var A=I(ge());var re=I(ge());var ue=I(E()),{Text:nn}=X,Lt=({onSelect:i,value:l,placeholder:f})=>{let c=z(),u=f??c("chatConfig.parentAgent.selectPlaceholder"),[o,t]=(0,re.useState)([]),[C,r]=(0,re.useState)(!1),{get:m}=me(),S=(0,re.useCallback)(async()=>{r(!0);try{let d=await m("/api/assistants");d.success&&t(d.data?.records||[])}catch(d){console.error("Failed to fetch assistants:",d)}finally{r(!1)}},[m]);return(0,re.useEffect)(()=>{S()},[S]),(0,ue.jsx)(xe,{showSearch:!0,allowClear:!0,value:l,placeholder:u,loading:C,onChange:d=>{if(!d){i(null);return}let k=o.find(R=>R.id===d);i(k||null)},onDropdownVisibleChange:d=>{d&&S()},optionFilterProp:"label",style:{width:"100%"},options:o.map(d=>({value:d.id,label:d.name||d.id,description:d.description})),optionRender:d=>(0,ue.jsxs)("div",{children:[(0,ue.jsx)("div",{children:d.label}),d.data.description&&(0,ue.jsx)(nn,{type:"secondary",style:{fontSize:12},children:d.data.description})]})})};var L=I(E()),{Text:Nt}=X,Ot=({subAgentKeys:i,decisions:l,onChange:f})=>{let{token:c}=We.useToken(),u=z(),o=(C,r)=>{let m=l.map(S=>S.originalKey===C?{...S,clone:r,cloneKey:r?`${C}_clone`:void 0}:S);f(m)},t=(C,r)=>{let m=l.map(S=>S.originalKey===C?{...S,cloneKey:r}:S);f(m)};return i.length===0?null:(0,L.jsxs)("div",{children:[(0,L.jsx)(Nt,{type:"secondary",style:{display:"block",marginBottom:8},children:u("chatConfig.subAgentInherit.hint")}),(0,L.jsx)(Le,{size:"small",bordered:!0,dataSource:l,style:{borderRadius:c.borderRadius},renderItem:C=>(0,L.jsxs)(Le.Item,{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:8,padding:"8px 16px"},children:[(0,L.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,L.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.clone?(0,L.jsx)(Re,{style:{color:c.colorPrimary}}):(0,L.jsx)(Qe,{style:{color:c.colorTextSecondary}}),(0,L.jsx)(Nt,{style:{fontFamily:"monospace"},children:C.originalKey})]}),(0,L.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,L.jsx)(we,{color:C.clone?"blue":"default",children:C.clone?u("chatConfig.subAgentInherit.clone"):u("chatConfig.subAgentInherit.reuse")}),(0,L.jsx)($e,{size:"small",checked:C.clone,onChange:r=>o(C.originalKey,r)})]})]}),C.clone&&(0,L.jsx)(_,{size:"small",placeholder:u("chatConfig.subAgentInherit.cloneKeyPlaceholder"),value:C.cloneKey,onChange:r=>t(C.originalKey,r.target.value),style:{fontFamily:"monospace",fontSize:12},addonBefore:u("chatConfig.keyValue.key")})]})})]})};function _t(i,l){return i.mode!=="local"||i.templateKey||typeof i.executable=="string"&&i.executable.trim().length>0?null:l?l("chat.config.executableRequired"):"Choose a template or enter a custom executable"}var n=I(E()),{TextArea:Vt}=_,{Text:ne}=X,Gt="/.well-known/agent-card.json",an=[{value:"http://",label:"http://"},{value:"https://",label:"https://"}],on={react:"chatConfig.createAssistant.typeDesc.react",deep_agent:"chatConfig.createAssistant.typeDesc.deepAgent",processing:"chatConfig.createAssistant.typeDesc.processing",a2a_remote:"chatConfig.createAssistant.typeDesc.a2aRemote"};function zt(i,l,f="https://"){let c=String(i??"").trim();if(!c)return"";let u=l==="http://"||l==="https://"?l:f,t=(/^https?:\/\//i.test(c)?c:`${u}${c.replace(/^\/+/,"")}`).replace(/\/+$/,"");return t.endsWith(Gt)?t:`${t}${Gt}`}function sn(i){try{return new URL(i).port||void 0}catch{return}}function rn(i){return i.some(l=>l==="--port"||l==="-p"||/^--port=/.test(l)||/^-p=/.test(l))}function jt(i,l){let f=[...i.args],c=sn(l);return c&&!rn(f)&&f.push("--port",c),{...i,args:f,...i.env?{env:{...i.env}}:{}}}var Ut=({open:i,onCancel:l,onSuccess:f,initialMode:c,initialValues:u})=>{let[o]=D.useForm(),t=z(),[C,r]=(0,A.useState)(!1),[m,S]=(0,A.useState)("learn"),[M,H]=(0,A.useState)(""),[d,k]=(0,A.useState)(null),[R,P]=(0,A.useState)([]),$=D.useWatch("type",o)||"react",j=$==="a2a_remote",[a,g]=(0,A.useState)("remote"),[U,fe]=(0,A.useState)(void 0),[le,ye]=(0,A.useState)([]),[Se,ce]=(0,A.useState)(!1),ae=(0,A.useRef)(0),[oe,ie]=(0,A.useState)(!1),[Pe,Y]=(0,A.useState)(!1),{get:N,post:J,put:he}=me(),Me=Ze("agent-architect"),{workspaceId:Ce,trainingProjects:Q,loading:de}=rt(),[Ee,Ae]=(0,A.useState)(null),Ke=JSON.stringify(u??null),K=Q.find(e=>e.id===Ee)??Q[0]??null,[be,ve]=(0,A.useState)([]),p=(0,A.useCallback)(()=>{k(null),P([])},[]),b=(0,A.useCallback)(()=>{o.resetFields(),p(),S("learn"),H(""),ve([]),Ae(null),g("remote"),fe(void 0),ye([]),Y(!1),ie(!1)},[o,p]);(0,A.useEffect)(()=>{if(i){b(),S(c??"learn");let e=u?.a2aMode;(e==="remote"||e==="local")&&g(e),o.setFieldsValue({type:"react",agentCardProtocol:"https://",a2aMode:"remote",timeout:3e5,...u})}},[i,o,c,Ke,b]),(0,A.useEffect)(()=>{let e=++ae.current,s=!0;return i&&j?(o.setFieldValue("prompt",""),a==="local"?(ce(!0),N("/api/local-a2a/templates").then(v=>{s&&e===ae.current&&v?.data?.records&&ye(v.data.records)}).catch(()=>{s&&e===ae.current&&ye([])}).finally(()=>{s&&e===ae.current&&ce(!1)})):ce(!1)):ce(!1),()=>{s=!1,ae.current+=1}},[o,j,a,N,i]);let x=le.find(e=>e.key===U),q=(0,A.useCallback)(()=>{let e=_t({mode:a,templateKey:U,executable:o.getFieldValue("commandExecutable")},t);return e?(Y(!0),o.setFields([{name:"commandExecutable",errors:[e]}]),w.warning(e),!1):!0},[a,U,o,t]);(0,A.useEffect)(()=>{x&&o.setFieldsValue({agentCardProtocol:"http://"})},[o,x]);let ke=(0,A.useCallback)(async()=>{if(!q())return;let e=zt(o.getFieldValue("agentCardUrl"),o.getFieldValue("agentCardProtocol"),a==="local"?"http://":"https://");if(!e){w.warning(t("chatConfig.createAssistant.a2aUrlWarning"));return}ie(!0);try{let s={agentCardUrl:e,apiKey:o.getFieldValue("apiKey")};if(a==="local"){let y=x;if(y)s.localRuntime={label:o.getFieldValue("name")||void 0,agentCardUrl:e,command:jt(y.command,e)};else{let B=o.getFieldValue("commandArgs")||"",G=B?B.split(/\s+/).filter(Boolean):[],F=String(o.getFieldValue(["command","cwd"])||"").trim();s.localRuntime={label:o.getFieldValue("name")||void 0,agentCardUrl:e,command:{executable:String(o.getFieldValue("commandExecutable")||"").trim(),args:G,...F?{cwd:F}:{}}}}}let v=await J("/api/a2a/test-connection",s);if(v.data?.reachable){let y=v.data.agentCard;w.success(t("chatConfig.createAssistant.connectedTo",{name:v.data.agentName||e}))}else w.error(v.data?.error||t("chatConfig.createAssistant.connectionFailed"))}catch{w.error(t("chatConfig.createAssistant.connectionTestFailed"))}finally{ie(!1)}},[o,J,a,x,q,t]),$t=(0,A.useCallback)(e=>{if(k(e),!e){o.resetFields(["key","name","description","type","prompt"]),P([]);return}let s=typeof e.graphDefinition=="object"&&e.graphDefinition!==null?e.graphDefinition:{},v=s.key||e.id,y=e.name||s.name||"";o.setFieldsValue({key:`${v}_ext`,name:y?`${y} (Extended)`:"",description:e.description||s.description||"",type:s.type||"react",prompt:s.prompt||""});let B=s.subAgents||[];P(B.map(G=>({originalKey:G,clone:!1})))},[o]),Wt=async(e,s)=>{let v=await N(`/api/assistants/${e}`);if(!v.success)throw new Error(t("chatConfig.createAssistant.cloneFetchFailed",{key:e}));let y=v.data,B=typeof y.graphDefinition=="object"?y.graphDefinition:{},G={id:s,name:`${y.name} (Clone)`,description:y.description||"",graphDefinition:{...B,key:s,name:`${y.name} (Clone)`}},F=await J("/api/assistants",G);if(!F.success)throw new Error(F.message||t("chatConfig.createAssistant.cloneFailed",{key:e}));return F.data},Zt=e=>{let s={id:e.key,name:e.name,description:e.description||"",graphDefinition:{key:e.key,name:e.name,description:e.description||"",type:e.type,prompt:e.prompt||"",tools:[],skills:[],subAgents:e.type==="deep_agent"||e.type==="processing"?[]:void 0,middleware:[]}};if(e.type==="a2a_remote"&&(s.graphDefinition.agentCardUrl=zt(e.agentCardUrl,e.agentCardProtocol,(e.a2aMode||a)==="local"?"http://":"https://"),e.apiKey&&(s.graphDefinition.apiKey=e.apiKey),e.timeout&&(s.graphDefinition.timeout=e.timeout),(e.a2aMode||a)==="local")){let v=x;if(v)s.graphDefinition.localRuntime={label:e.name||void 0,agentCardUrl:s.graphDefinition.agentCardUrl,command:jt(v.command,s.graphDefinition.agentCardUrl)};else{let y=e.commandArgs||"",B=y?y.split(/\s+/).filter(Boolean):[],G=String(e.command?.cwd||"").trim();s.graphDefinition.localRuntime={label:e.name||void 0,agentCardUrl:s.graphDefinition.agentCardUrl,command:{executable:String(e.commandExecutable||"").trim(),args:B,...G?{cwd:G}:{}}}}}return s},Yt=async(e,s)=>{if(!d)throw new Error(t("chatConfig.createAssistant.noParentAgent"));let v=R.filter(F=>F.clone);for(let F of v){if(!F.cloneKey||!F.cloneKey.trim())throw new Error(t("chatConfig.createAssistant.cloneKeyRequired",{key:F.originalKey}));if(!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(F.cloneKey))throw new Error(t("chatConfig.createAssistant.cloneKeyInvalid",{key:F.cloneKey,originalKey:F.originalKey}))}let y=[];for(let F of R)if(F.clone){let Xt=await Wt(F.originalKey,F.cloneKey);s.push(Xt),y.push(F.cloneKey)}else y.push(F.originalKey);let B=typeof d.graphDefinition=="object"?d.graphDefinition:{},G={key:e.key,name:e.name,description:e.description||"",extendsAgent:d.id,type:e.type||B.type};return e.prompt&&e.prompt!==B.prompt&&(G.prompt=e.prompt),(y.length>0||B.subAgents&&B.subAgents.length>0)&&(G.subAgents=y),{id:e.key,name:e.name,description:e.description||"",graphDefinition:G}},Jt=async()=>{if(m==="learn"){let e=M.trim();if(!e){w.error(t("chatConfig.createAssistant.trainingGoalRequired"));return}if(!K){w.error(t("chatConfig.createAssistant.noTrainingProject"));return}r(!0);try{let s=`agent-${It(e+Date.now())}`,v=await J("/api/assistants",{id:s,name:s,graphDefinition:{key:s,name:s,description:"",type:"react",prompt:"To be trained",metadata:{trainingProjectId:K.id,learningPlaceholder:"true",architectureStatus:"undecided"}}});if(!v.data)throw new Error(t("chatConfig.createAssistant.agentCreateFailed"));let{roundTaskId:y}=await Ft({goal:e,targetAgentId:s,workspaceId:Ce??void 0,projectId:K.id,existingThreadId:St(Me.tenantId,s),files:be,post:J,put:he});w.success(t("chatConfig.createAssistant.agentCreated")),H(""),ve([]),S("learn"),f?.(v.data,{initialMessage:Rt({goal:e,roundTaskId:y,targetAgentId:s,targetMode:"placeholder",files:be,projectId:K.id,workspaceId:K.workspaceId??Ce??void 0}),projectId:K.id,initialMessageCustomRunConfig:{execution:{taskId:y}}}),l()}catch(s){w.error(s instanceof Error?s.message:t("chatConfig.createAssistant.agentCreateFailed"))}finally{r(!1)}return}try{if(m==="scratch"&&j&&!q())return;let e=await o.validateFields();r(!0);let s=[],v=m==="scratch"?Zt(e):await Yt(e,s),y=await J("/api/assistants",v);if(y.success){w.success(m==="extend"?t("chatConfig.createAssistant.createdByExtending",{name:d?.name??""}):t("chatConfig.createAssistant.created")),b();for(let B of s)f?.(B);f?.(y.data),l()}else w.error(y.message||t("chatConfig.createAssistant.createFailed"))}catch(e){if(e?.errorFields){let s={key:t("chatConfig.createAssistant.field.key"),name:t("chatConfig.createAssistant.field.name"),description:t("chatConfig.createAssistant.field.description"),prompt:t("chatConfig.createAssistant.field.systemPrompt")},v=e.errorFields.map(y=>s[String((y.name??[])[0])]??String((y.name??[])[0])).filter(Boolean);w.warning(v.length>0?t("chatConfig.createAssistant.requiredFields",{fields:[...new Set(v)].join(", ")}):t("chatConfig.createAssistant.requiredFieldsGeneric"));return}w.error(e.message||t("chatConfig.createAssistant.createError"))}finally{r(!1)}},ze=d?.graphDefinition?.subAgents||[],Qt=m==="extend"&&d&&ze.length>0;return(0,n.jsxs)(pe,{title:t("chatConfig.createAssistant.title"),open:i,onCancel:()=>{b(),l()},footer:[(0,n.jsx)(W,{onClick:()=>{b(),l()},children:t("common.cancel")},"cancel"),(0,n.jsx)(W,{type:"primary",icon:m==="extend"?(0,n.jsx)(Re,{}):m==="learn"?(0,n.jsx)(Je,{}):(0,n.jsx)(Xe,{}),loading:C,disabled:m==="learn"&&(de||!K),onClick:Jt,children:t(m==="extend"?"chatConfig.createAssistant.createExtend":m==="learn"?"chatConfig.createAssistant.startLearning":"common.create")},"submit")],width:760,children:[m==="extend"&&(0,n.jsxs)("div",{style:{marginBottom:20},children:[(0,n.jsx)(ne,{type:"secondary",style:{display:"block",marginBottom:8},children:t("chatConfig.createAssistant.parentAgent")}),(0,n.jsx)(Lt,{value:d?.id,onSelect:$t}),d&&(0,n.jsx)(ne,{type:"secondary",style:{display:"block",marginTop:4,fontSize:12},children:t("chatConfig.createAssistant.inheritHint")})]}),m==="extend"&&d&&(0,n.jsx)(Be,{style:{margin:"12px 0"}}),m==="learn"&&(0,n.jsxs)("div",{children:[(0,n.jsx)(ne,{style:{display:"block",marginBottom:8},children:t("chatConfig.createAssistant.learnHint")}),(0,n.jsx)(_.TextArea,{rows:3,value:M,onChange:e=>H(e.target.value),placeholder:"e.g. Handle price disputes using the price protection policy"}),K&&(0,n.jsxs)("div",{style:{marginTop:12},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:8},children:[(0,n.jsx)(ne,{type:"secondary",children:t("chatConfig.createAssistant.referenceFiles")}),(0,n.jsx)(Ve,{project:K,projects:Q,value:K?.id??null,onChange:Ae,loading:de})]}),(0,n.jsx)(Tt,{projectId:K.id,value:be,onChange:ve}),(0,n.jsx)(ne,{type:"secondary",style:{display:"block",marginTop:6,fontSize:12},children:t("chatConfig.createAssistant.referenceFilesHint")})]}),!K&&!de&&(0,n.jsx)("div",{style:{marginTop:12},children:(0,n.jsx)(Ve,{project:K,projects:Q,value:null,onChange:Ae,loading:de})})]}),m!=="learn"&&(0,n.jsxs)(D,{form:o,layout:"vertical",autoComplete:"off",initialValues:{type:"react",agentCardProtocol:"https://",a2aMode:"remote"},children:[(0,n.jsx)(D.Item,{name:"key",label:t("chatConfig.createAssistant.field.key"),rules:[{required:!0,message:t("chatConfig.createAssistant.validation.keyRequired")},{pattern:/^[a-zA-Z][a-zA-Z0-9_-]*$/,message:t("chatConfig.createAssistant.validation.keyPattern")}],style:{marginBottom:16},children:(0,n.jsx)(_,{placeholder:"e.g., my_assistant"})}),(0,n.jsx)(D.Item,{name:"name",label:t("chatConfig.createAssistant.field.name"),rules:[{required:!0,message:t("chatConfig.createAssistant.validation.nameRequired")}],style:{marginBottom:16},children:(0,n.jsx)(_,{placeholder:"e.g., My Assistant"})}),(0,n.jsx)(D.Item,{name:"description",label:t("chatConfig.createAssistant.field.description"),rules:[{required:!0,message:t("chatConfig.createAssistant.validation.descriptionRequired")}],style:{marginBottom:16},children:(0,n.jsx)(Vt,{placeholder:t("chatConfig.createAssistant.descriptionPlaceholder"),autoSize:{minRows:2,maxRows:4}})}),(0,n.jsx)(D.Item,{name:"type",label:t("chatConfig.createAssistant.field.agentType"),rules:[{required:!0}],style:{marginBottom:16},children:(0,n.jsx)(Ue,{options:[{value:"react",label:t("chatConfig.agentType.executor")},{value:"deep_agent",label:t("chatConfig.agentType.orchestrator")},{value:"processing",label:t("chatConfig.agentType.workflow")},{value:"a2a_remote",label:t("chatConfig.agentType.a2aRemote")}],block:!0})}),(0,n.jsx)(ne,{type:"secondary",style:{fontSize:12,display:"block",marginTop:-12,marginBottom:16,lineHeight:1.5},children:t(on[$]??"chatConfig.createAssistant.typeDesc.react")}),j&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(D.Item,{label:t("chatConfig.createAssistant.field.connectionMode"),style:{marginBottom:16},children:(0,n.jsxs)(Fe.Group,{value:a,onChange:e=>{let s=e.target.value;g(s),o.setFieldValue("a2aMode",s),s==="local"&&o.setFieldValue("agentCardProtocol","http://"),fe(void 0)},optionType:"button",buttonStyle:"solid",children:[(0,n.jsx)(Fe.Button,{value:"remote",children:t("chatConfig.createAssistant.mode.remoteUrl")}),(0,n.jsx)(Fe.Button,{value:"local",children:t("chatConfig.createAssistant.mode.localManaged")})]})}),(0,n.jsx)(D.Item,{name:"a2aMode",noStyle:!0,hidden:!0,children:(0,n.jsx)(_,{})}),a==="local"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(D.Item,{label:t("chatConfig.createAssistant.field.template"),style:{marginBottom:16},children:(0,n.jsx)(xe,{placeholder:t("chatConfig.createAssistant.templatePlaceholder"),allowClear:!0,loading:Se,value:U,onChange:e=>{fe(e),e&&Y(!1)},options:le.map(e=>({value:e.key,label:e.name||e.key})),notFoundContent:Se?void 0:(0,n.jsx)(ne,{type:"secondary",style:{padding:8,display:"block"},children:t("chatConfig.createAssistant.noTemplates")})})}),!U&&(0,n.jsx)(n.Fragment,{children:Pe?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(D.Item,{name:"commandExecutable",label:t("chatConfig.createAssistant.field.executable"),rules:[{required:!0,whitespace:!0,message:t("chatConfig.createAssistant.validation.executableRequired")}],style:{marginBottom:16},children:(0,n.jsx)(_,{placeholder:"e.g. node, opencode, /usr/local/bin/my-server"})}),(0,n.jsx)(D.Item,{name:"commandArgs",label:t("chatConfig.createAssistant.field.arguments"),style:{marginBottom:16},children:(0,n.jsx)(_,{placeholder:"e.g. --serve --port 4301"})}),(0,n.jsx)(D.Item,{name:["command","cwd"],label:t("chatConfig.createAssistant.field.workingDirectory"),style:{marginBottom:16},children:(0,n.jsx)(_,{placeholder:"e.g. /Users/me/project"})}),(0,n.jsx)(W,{type:"link",onClick:()=>{Y(!1),o.setFieldsValue({commandExecutable:"",commandArgs:"",command:{cwd:void 0}})},style:{padding:0,marginBottom:16,display:"block"},children:t("chatConfig.createAssistant.hideCustomCommand")})]}):(0,n.jsx)(W,{type:"link",onClick:()=>Y(!0),style:{padding:0,marginBottom:16,display:"block"},children:t("chatConfig.createAssistant.customCommand")})})]}),(0,n.jsx)(D.Item,{label:t("chatConfig.createAssistant.field.agentCardUrl"),required:!0,style:{marginBottom:16},children:(0,n.jsxs)(He.Compact,{style:{width:"100%"},children:[(0,n.jsx)(D.Item,{name:"agentCardProtocol",noStyle:!0,children:(0,n.jsx)(xe,{style:{width:100},options:an})}),(0,n.jsx)(D.Item,{name:"agentCardUrl",noStyle:!0,rules:[{required:!0,message:t("chatConfig.createAssistant.validation.urlRequired")}],children:(0,n.jsx)(_,{placeholder:a==="local"?"localhost:4301":"host:port or full URL"})}),(0,n.jsx)(W,{icon:(0,n.jsx)(Ye,{}),onClick:ke,loading:oe,children:t("chatConfig.connection.action.test")})]})}),a==="remote"&&(0,n.jsx)(D.Item,{name:"apiKey",label:t("chatConfig.createAssistant.field.apiKeyOptional"),style:{marginBottom:16},children:(0,n.jsx)(_.Password,{placeholder:t("chatConfig.createAssistant.apiKeyPlaceholder")})}),(0,n.jsx)(D.Item,{name:"timeout",label:t("chatConfig.createAssistant.field.timeout"),style:{marginBottom:16},initialValue:3e5,children:(0,n.jsx)(qe,{min:1e3,max:36e5,style:{width:"100%"},placeholder:"300000"})})]}),!j&&(0,n.jsx)(D.Item,{name:"prompt",label:t(m==="extend"&&d?"chatConfig.createAssistant.field.systemPromptInherit":"chatConfig.createAssistant.field.systemPrompt"),rules:m==="scratch"?[{required:!0,message:t("chatConfig.createAssistant.validation.systemPromptRequired")}]:[],children:(0,n.jsx)(Vt,{placeholder:t(m==="extend"&&d?"chatConfig.createAssistant.systemPromptInheritPlaceholder":"chatConfig.createAssistant.systemPromptPlaceholder"),autoSize:{minRows:4,maxRows:8},style:{fontFamily:"monospace",fontSize:13,lineHeight:1.6}})})]}),Qt&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Be,{style:{margin:"12px 0"}}),(0,n.jsx)(ne,{strong:!0,style:{display:"block",marginBottom:8},children:t("chatConfig.createAssistant.subAgents")}),(0,n.jsx)(Ot,{subAgentKeys:ze,decisions:R,onChange:P})]})]})};var O=I(E()),{Paragraph:ln,Text:qt}=X,cn=[{key:"manual",icon:Te,titleKey:"governance.creation.manual.title",descriptionKey:"governance.creation.manual.description"},{key:"external",icon:tt,titleKey:"governance.creation.external.title",descriptionKey:"governance.creation.external.description"},{key:"learn",icon:at,titleKey:"governance.creation.learn.title",descriptionKey:"governance.creation.learn.description"}],Ht=({open:i,onCancel:l,onSelectMethod:f,focusTriggerAfterClose:c=!0})=>{let u=z();return(0,O.jsx)(pe,{title:u("governance.creation.title"),open:i,onCancel:l,footer:null,width:560,centered:!0,destroyOnHidden:!0,focusTriggerAfterClose:c,children:(0,O.jsxs)("div",{style:{padding:"8px 4px 4px"},children:[(0,O.jsx)(ln,{style:{color:"#595959",fontSize:15,margin:"8px 0 24px"},children:u("governance.creation.subtitle")}),(0,O.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:cn.map(o=>{let t=o.icon,C=u(o.titleKey);return(0,O.jsxs)(W,{type:"default",onClick:()=>f(o.key),"aria-label":C,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:16,width:"100%",minHeight:88,height:"auto",padding:16,borderRadius:16,textAlign:"left",whiteSpace:"normal"},children:[(0,O.jsx)("div",{style:{width:40,height:40,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"#6366f1",background:"#eeeeff"},children:(0,O.jsx)(t,{size:19})}),(0,O.jsxs)("div",{style:{minWidth:0},children:[(0,O.jsx)(qt,{strong:!0,style:{display:"block",fontSize:15,marginBottom:3},children:C}),(0,O.jsx)(qt,{style:{color:"#737373",lineHeight:1.5},children:u(o.descriptionKey)})]})]},o.key)})}),(0,O.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,flexWrap:"wrap",marginTop:24},children:(0,O.jsx)(W,{onClick:l,children:u("governance.creation.notNow")})})]})})};var V=I(E()),dn=i=>{let l=i;if(typeof i=="string")try{l=JSON.parse(i)}catch{return{}}return l!==null&&typeof l=="object"&&!Array.isArray(l)?l:{}},va=()=>{let{get:i,del:l,put:f}=me(),c=z(),[u,o]=(0,h.useState)([]),[t,C]=(0,h.useState)(!1),[r,m]=(0,h.useState)(null),[S,M]=(0,h.useState)("graph"),[H,d]=(0,h.useState)(null),[k,R]=(0,h.useState)(null),[P,$]=(0,h.useState)(null),[j,a]=(0,h.useState)(!1),[g,U]=(0,h.useState)(!0),[fe,le]=(0,h.useState)(!1),[ye,Se]=(0,h.useState)("learn"),[ce,ae]=(0,h.useState)({}),[oe,ie]=(0,h.useState)(null),[Pe,Y]=(0,h.useState)(!1),N=(0,h.useCallback)(async()=>{C(!0);try{let p=await i("/api/assistants");p.success&&p.data?.records&&o(p.data.records)}catch{w.error(c("governance.workbench.loadFailed"))}finally{C(!1)}},[i,c]);(0,h.useEffect)(()=>{N()},[N]);let J=h.default.useMemo(()=>xt(u),[u]),he=u.find(p=>p.id===r)??null,Me=(0,h.useCallback)((p,b="graph")=>{m(p),M(b),d(null),$(null)},[]),Ce=ut(),Q=(0,h.useCallback)((p,b)=>{let x=u.find(q=>q.id===p)?.name??c("governance.workbench.agentFallback");Ce({component_key:"agent_detail_side_app",data:{assistantId:p,initialTab:b},message:x})},[u,Ce,c]),de=(0,h.useCallback)(()=>{U(!0),a(!0)},[]),Ee=(0,h.useCallback)(p=>{let x={manual:{mode:"scratch",values:{}},external:{mode:"scratch",values:{type:"a2a_remote"}},learn:{mode:"learn",values:{}}}[p];Se(x.mode),ae(x.values),U(!1),a(!1),le(!0)},[]),Ae=(0,h.useCallback)(async(p,b)=>{let x=dn(p.graphDefinition),q;try{q=await f(`/api/assistants/${p.id}`,{name:b.name!==void 0?b.name:p.name,description:b.description!==void 0?b.description:p.description,graphDefinition:{...x,...b}})}catch(ke){throw w.error(c("governance.detail.saveFailed")),ke}if(!q.success)throw w.error(c("governance.detail.saveFailed")),new Error("Failed to save agent");w.success(c("common.saved")),N()},[f,N,c]),Ke=(0,h.useCallback)(p=>{o(b=>b.map(x=>x.id===p.id?p:x))},[]),K=(0,h.useCallback)(p=>{ie(p)},[]),be=(0,h.useCallback)(async()=>{if(oe){Y(!0);try{(await l(`/api/assistants/${oe}`)).success?(w.success(c("governance.detail.deleted")),o(b=>b.filter(x=>x.id!==oe)),N(),ie(null)):w.error(c("governance.detail.deleteFailed"))}catch{w.error(c("governance.detail.deleteFailed"))}finally{Y(!1)}}},[oe,l,N,c]),ve=(0,h.useCallback)(async p=>{if(!(await l(`/api/assistants/${p}`)).success)throw new Error("Failed to delete agent");w.success(c("governance.detail.deleted")),o(x=>x.filter(q=>q.id!==p)),N()},[l,N,c]);return(0,V.jsxs)("div",{style:{height:"100%",background:"#fafafa",overflow:"hidden"},children:[he?(0,V.jsx)(vt,{defaultProjectId:P??void 0,children:(0,V.jsx)(Dt,{assistant:he,allAssistants:u,onBack:()=>m(null),onDeleted:ve,onSave:Ae,onAssistantUpdated:Ke,onAgentListInvalidated:N,initialTab:S,initialMessage:H,initialMessageCustomRunConfig:k,initialProjectId:P})},he.id):(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(Bt,{items:J,assistants:u,loading:t,onItemClick:p=>Q(p,"graph"),onOpenPlayground:p=>Q(p,"playground"),onOpenEval:p=>Q(p,"eval"),onCreate:de,onDelete:K})}),(0,V.jsx)(Ht,{open:j,onCancel:()=>{U(!0),a(!1)},onSelectMethod:Ee,focusTriggerAfterClose:g}),(0,V.jsx)(Ut,{open:fe,initialMode:ye,initialValues:ce,onCancel:()=>le(!1),onSuccess:(p,b)=>{le(!1),o(x=>x.some(ke=>ke.id===p.id)?x:[p,...x]),Me(p.id,"graph"),d(b?.initialMessage??null),R(b?.initialMessageCustomRunConfig??null),$(b?.projectId??null),N()}}),(0,V.jsx)(pe,{title:c("governance.deleteAgent"),open:oe!==null,onCancel:()=>ie(null),onOk:be,okText:c("common.delete"),okButtonProps:{danger:!0,loading:Pe},cancelText:c("common.cancel"),children:(0,V.jsx)("p",{children:c("governance.delete.irreversible")})})]})};export{va as AgentGovernanceWorkbench};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as $,d as J}from"./embed-page-chunk-NFMLKSPM.js";import{b as R,d as V,e as S}from"./embed-page-chunk-S2KVN3RB.js";import"./embed-page-chunk-S4XZPBRM.js";import{j as N,k as H,l as L,m as U,n as W,x as A,y as K,z as Y}from"./embed-page-chunk-N66H4DNH.js";import"./embed-page-chunk-BANVRQT7.js";import"./embed-page-chunk-436REIWY.js";import{s as w}from"./embed-page-chunk-37LGEEJU.js";import{a as g}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-SRMYHWL3.js";import{Ga as P,Mc as z,Nc as k,Qc as F,W as T,aa as B,cb as E,hb as D,jc as G,yc as _}from"./embed-page-chunk-4W34QOXT.js";import{a as b}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as u}from"./embed-page-chunk-QBTAJ2YI.js";var n=u(b());var I=u(b());var o=u(g());var ae="tracePulse 1.4s ease-in-out infinite",le={running:(0,o.jsx)(G,{style:{color:"#1890ff"}}),success:(0,o.jsx)(E,{style:{color:"#52c41a"}}),error:(0,o.jsx)(D,{style:{color:"#ff4d4f"}})};function de({kind:e}){switch(e){case"human":return(0,o.jsx)(F,{});case"agent":return(0,o.jsx)(z,{});case"tool":return(0,o.jsx)(k,{});case"ai":return(0,o.jsx)(_,{});default:return(0,o.jsx)(k,{})}}var M=I.default.createContext({}),ce=()=>I.default.useContext(M),pe=({data:e,selected:i})=>{let l=w(),{onJumpToMessage:t}=ce(),s=e.isAnswer===!0,a=e.status==="running",p=(e.parallelCount??1)>1,m=!!(t&&e.messageId&&!e.messageId.startsWith("summary:")),v=e.toolCall?L(e.toolCall.name):e.label,y=()=>{if((e.kind==="tool"||e.kind==="agent")&&e.toolCall){let h=U(e.toolCall.response);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(H,{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)(N,{content:h})}),(0,o.jsx)(W,{ui:e.toolCall.ui})]})}return e.content?(0,o.jsx)(N,{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 ${s||i?"#6366f1":a?"#91caff":"#e5e7eb"}`,borderRadius:12,background:s?"#eef2ff":"#fff",boxShadow:a?"0 0 0 2px rgba(24,144,255,0.18)":i?"0 0 0 2px rgba(99,102,241,0.2)":"none",animation:a?ae: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)(de,{kind:e.kind}),(0,o.jsx)("span",{style:{fontWeight:s?700:600,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v}),p&&(0,o.jsx)(P,{color:"purple",style:{marginInlineEnd:0,fontSize:10},children:l("chat.trace.parallelBadge",{count:e.parallelCount??1})}),le[e.status],m&&(0,o.jsx)(T,{type:"text",size:"small",onClick:()=>t?.(e.messageId),children:l("chat.trace.jumpToChat")})]}),(0,o.jsx)("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:12},children:y()})]})},ue=({data:e,selected:i})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(S,{type:"target",position:R.Top}),(0,o.jsx)(pe,{data:e,selected:i}),(0,o.jsx)(S,{type:"source",position:R.Bottom})]}),j={trace:ue};var Z=u(b());var f=u(g()),fe={running:"#1890ff",success:"#52c41a",error:"#ff4d4f"},q=({graph:e,activeNodeId:i,onSelectNode:l})=>{let t=Z.default.useMemo(()=>new Map(e.nodes.map(s=>[s.id,s])),[e.nodes]);return(0,f.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(s=>(0,f.jsxs)("div",{"data-testid":"trace-rail-phase",children:[(0,f.jsx)("div",{style:{fontSize:12,color:"#8c8c8c",marginBottom:4},children:s.title}),(0,f.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:s.nodeIds.map(a=>{let p=t.get(a);if(!p)return null;let m=a===i;return(0,f.jsx)(B,{title:p.data.label,children:(0,f.jsx)("button",{type:"button","data-testid":"trace-rail-tick",onClick:()=>l?.(a),style:{width:m?12:8,height:m?12:8,borderRadius:"50%",border:"none",padding:0,cursor:"pointer",background:fe[p.data.status],outline:m?"2px solid #6366f1":"none"}})},a)})})]},s.id))})};var d=u(g()),Q=3,X=()=>{},me=`
|
|
2
|
+
@keyframes tracePulse {
|
|
3
|
+
0%, 100% { box-shadow: 0 0 0 2px rgba(24,144,255,0.18); }
|
|
4
|
+
50% { box-shadow: 0 0 0 6px rgba(24,144,255,0.05); }
|
|
5
|
+
}
|
|
6
|
+
`;function ge(e){let i=e.nodes.map(t=>({id:t.id,...A[t.data.kind]})),l=e.edges.map(t=>({from:t.from,to:t.to}));return $(i,l,{nodesep:48,ranksep:80,rankdir:"TB"})}function ye({focusNodeId:e,follow:i}){let l=V();return(0,n.useEffect)(()=>{if(!i||!e)return;let t=l.getNode(e);if(!t)return;let s=t.style?.width??0,a=t.style?.height??0;l.setCenter(t.position.x+s/2,t.position.y+a/2,{zoom:1,duration:300})},[e,i,l]),null}var _e=({messages:e,isLoading:i,onJumpToMessage:l})=>{let t=w(),[s,a]=(0,n.useState)(),[p,m]=(0,n.useState)(!1),[v,y]=(0,n.useState)(!0),h=(0,n.useDeferredValue)(e),x=(0,n.useMemo)(()=>K(h,{isLoading:i,t}),[h,i,t]),c=(0,n.useMemo)(()=>p?x:Y(x,Q,t),[x,p,t]),ee=(0,n.useMemo)(()=>`${c.nodes.map(r=>r.id).join(",")}|${c.edges.map(r=>r.id).join(",")}`,[c]),O=(0,n.useMemo)(()=>ge(c),[ee]),oe=(0,n.useMemo)(()=>c.nodes.map(r=>{let C=A[r.data.kind];return{id:r.id,type:"trace",position:O.get(r.id)??{x:0,y:0},data:r.data,draggable:!1,style:{width:C.width,height:C.height}}}),[c,O]),te=(0,n.useMemo)(()=>c.edges.map(r=>({id:r.id,source:r.from,target:r.to,animated:r.kind==="invoke",style:{stroke:r.kind==="invoke"?"#6366f1":r.kind==="result"?"#a5b4fc":"#d9d9d9"}})),[c]),re=c.nodes[c.nodes.length-1]?.id,ne=s??re,se=x.phases.length>Q,ie=(0,n.useMemo)(()=>({onJumpToMessage:l}),[l]);return(0,d.jsxs)(M.Provider,{value:ie,children:[(0,d.jsx)("style",{children:me}),(0,d.jsxs)("div",{style:{display:"flex",height:"100%",minHeight:0,width:"100%"},children:[(0,d.jsx)(q,{graph:c,activeNodeId:s,onSelectNode:a}),(0,d.jsxs)("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column"},children:[(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:4,padding:"4px 8px"},children:[!v&&(0,d.jsx)(T,{size:"small",type:"text",onClick:()=>{a(void 0),y(!0)},children:t("chat.trace.backToCurrent")}),se&&(0,d.jsx)(T,{size:"small",type:"text",onClick:()=>m(r=>!r),children:t(p?"chat.trace.collapseOlder":"chat.trace.expandAll")})]}),(0,d.jsx)("div",{style:{flex:1,minHeight:0},children:(0,d.jsx)(J,{nodes:oe,edges:te,nodeTypes:j,onNodesChange:X,onEdgesChange:X,nodesDraggable:!1,nodesConnectable:!1,fitView:!0,miniMap:{pannable:!0,zoomable:!0},onMoveStart:()=>y(!1),onNodeClick:(r,C)=>{a(C.id),y(!0)},children:(0,d.jsx)(ye,{focusNodeId:ne,follow:v})})})]})]})]})};export{_e as MessageGraph};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as D}from"./embed-page-chunk-UDSGGVJH.js";import{i as E}from"./embed-page-chunk-N66H4DNH.js";import"./embed-page-chunk-BANVRQT7.js";import"./embed-page-chunk-436REIWY.js";import{i as T,s as v}from"./embed-page-chunk-37LGEEJU.js";import{a as C}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-SRMYHWL3.js";import{ga as x}from"./embed-page-chunk-4W34QOXT.js";import{a as w}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as p}from"./embed-page-chunk-QBTAJ2YI.js";var u=p(w());var R=p(T());var y=p(C());function g(l,i){if(!l||l.length===0)return{title:{text:i("genui.chart.title"),left:"left"},tooltip:{trigger:"axis"},legend:{right:0,orient:"vertical"},xAxis:{type:"category",data:[]},yAxis:{type:"value"},series:[{type:"line",name:i("genui.chart.seriesDefault",{n:1}),data:[]}],grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}};let s=l[0],t=Object.keys(s);if(t.length===0)return g([],i);let r=t.filter(e=>{let n=s[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=l.map((a,c)=>a[n]!==void 0?String(a[n]):i("genui.chart.itemDefault",{n:c+1})),f=l.map(a=>{let c=a[e];return typeof c=="number"?c:Number(c)||0});return{title:{text:i("genui.chart.title"),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:f}],grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}}}return{title:{text:i("genui.chart.title"),left:"left"},tooltip:{trigger:"axis"},legend:{right:0,orient:"vertical"},xAxis:{type:"category",data:l.map((e,n)=>i("genui.chart.itemDefault",{n:n+1}))},yAxis:{type:"value"},series:[{type:"bar",name:i("genui.chart.countSeries"),data:l.map(()=>1)}],grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}}}function j(l,i){if(!l||typeof l!="object"||!l.series||!Array.isArray(l.series)||l.series.length===0)return null;let s=l.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||i("genui.chart.seriesDefault",{n:n+1})};if(e.type==="pie"){let f=e.data.map((a,c)=>typeof a=="object"&&a!==null&&"value"in a?{value:a.value,name:a.name||i("genui.chart.itemDefault",{n:c+1})}:typeof a=="number"?{value:a,name:i("genui.chart.itemDefault",{n:c+1})}:null).filter(a=>a!==null);return f.length===0?null:{...o,data:f}}return o}).filter(e=>e!==null);if(s.length===0)return null;let t={...l,series:s},r=s[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=s[0].data;Array.isArray(n)&&n.length>0?Array.isArray(n[0])?e.data=n.map(o=>o[0]):e.data=n.map((o,f)=>i("genui.chart.itemDefault",{n:f+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:i("genui.chart.title"),left:"left"};else if(typeof t.title=="object"){let e=t.title;e.left||(e.left="left"),e.text||(e.text=i("genui.chart.title")),t.title=e}if(t.tooltip||(t.tooltip={trigger:r==="pie"?"item":"axis"}),!t.legend)s.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 O(l,i){let s=null;try{let n=typeof l=="string"?l:l.join("");s=(0,R.parse)(n)}catch(n){return{data:null,error:`Failed to parse JSON: ${n instanceof Error?n.message:String(n)}`}}if(!s||typeof s!="object")return{data:null,error:"Parsed data is not an object"};let t=s.series&&Array.isArray(s.series)&&s.series.length>0,r={table:Array.isArray(s.table)?s.table:void 0},e=null;if(s.echarts?e=s.echarts:t&&(e=s),e){let n=j(e,i);if(n)r.echarts=n;else if(r.table&&r.table.length>0)r.echarts=g(r.table,i);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=g(r.table,i):r.echarts=g([],i);return{data:r,error:null}}var K=l=>{let{children:i}=l,s=v(),t=(0,u.useRef)(null),r=(0,u.useRef)(null),e=(0,u.useRef)(null),[n,o]=(0,u.useState)(null);(0,u.useEffect)(()=>{if(!t.current)return;r.current||(r.current=D(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:c,error:m}=O(a,s);if(m||!c){console.warn("ReactChart failed to parse chart data:",m||"Unknown parse error"),r.current&&r.current.clear(),o(null);return}if(c.table&&Array.isArray(c.table)&&o(c.table),c.echarts)try{r.current.setOption(c.echarts,!0)}catch(d){let A=d instanceof Error?d.message:"Failed to render chart";console.error("Failed to set ECharts option:",d),r.current&&r.current.clear(),o(null)}let h=()=>{r.current&&r.current.resize()};return e.current&&(e.current.disconnect(),e.current=null),t.current&&typeof ResizeObserver<"u"&&(e.current=new ResizeObserver(d=>{requestAnimationFrame(()=>{h()})}),e.current.observe(t.current)),window.addEventListener("resize",h),()=>{e.current&&(e.current.disconnect(),e.current=null),window.removeEventListener("resize",h)}},[i,s]),(0,u.useEffect)(()=>()=>{e.current&&(e.current.disconnect(),e.current=null),r.current&&(r.current.dispose(),r.current=null)},[]);let f=a=>{if(!a||a.length===0)return[];if(Array.isArray(a[0])){let c=a[0];return a.slice(1).map((h,d)=>{let A={};return h.forEach((S,b)=>{A[c[b]||`col_${b}`]=S}),A})}return a};return(0,y.jsxs)(x,{children:[(0,y.jsx)("div",{ref:t,style:{width:"100%",height:"400px",minHeight:"300px"}}),n&&n.length>0&&(0,y.jsx)("div",{style:{marginTop:16},children:(0,y.jsx)(E,{component_key:"chart_table_data",data:{dataSource:f(n),message:s("genui.chart.dataDetails")},interactive:!0,default_open_in_side_app:!0})})]})};export{K as ReactChart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as a1,b as c1,d as Bl,n as l1}from"./embed-page-chunk-
|
|
1
|
+
import{a as a1,b as c1,d as Bl,n as l1}from"./embed-page-chunk-YJUCDIYK.js";import{a as s1}from"./embed-page-chunk-7TH7FFVA.js";import{j as Ss}from"./embed-page-chunk-IGOT476M.js";import"./embed-page-chunk-QLA2XU73.js";import{q as Dl}from"./embed-page-chunk-IJPRKD63.js";import"./embed-page-chunk-IRP2UOPH.js";import{B as gi,C as n1,D as i1,E as o1,f as t1,g as r1,k as gn}from"./embed-page-chunk-DM5ESF6C.js";import{a as Kg,b as Zg,c as Qg,d as Jg,e as e1}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import{a as Ug}from"./embed-page-chunk-QV7QAJ4N.js";import{a as z9}from"./embed-page-chunk-R5QL57JJ.js";import{c as Vg,d as $9,f as Mo}from"./embed-page-chunk-QBTAJ2YI.js";var f9=Vg((k4e,d9)=>{"use strict";var u9=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;d9.exports=function(e,t){t=t||{};var r=1,n=1;function i(k){var R=k.match(/\n/g);R&&(r+=R.length);var G=k.lastIndexOf(`
|
|
2
2
|
`);n=~G?k.length-G:n+k.length}function o(){var k={line:r,column:n};return function(R){return R.position=new s(k),x(),R}}function s(k){this.start=k,this.end={line:r,column:n},this.source=t.source}s.prototype.content=e;var a=[];function c(k){var R=new Error(t.source+":"+r+":"+n+": "+k);if(R.reason=k,R.filename=t.source,R.line=r,R.column=n,R.source=e,t.silent)a.push(R);else throw R}function l(){var k=h();return{type:"stylesheet",stylesheet:{source:t.source,rules:k,parsingErrors:a}}}function u(){return p(/^{\s*/)}function f(){return p(/^}/)}function h(){var k,R=[];for(x(),m(R);e.length&&e.charAt(0)!="}"&&(k=X()||D());)k!==!1&&(R.push(k),m(R));return R}function p(k){var R=k.exec(e);if(R){var G=R[0];return i(G),e=e.slice(G.length),R}}function x(){p(/^\s*/)}function m(k){var R;for(k=k||[];R=g();)R!==!1&&k.push(R);return k}function g(){var k=o();if(!(e.charAt(0)!="/"||e.charAt(1)!="*")){for(var R=2;e.charAt(R)!=""&&(e.charAt(R)!="*"||e.charAt(R+1)!="/");)++R;if(R+=2,e.charAt(R-1)==="")return c("End of comment missing");var G=e.slice(2,R-2);return n+=2,i(G),e=e.slice(R),n+=2,k({type:"comment",comment:G})}}function y(){var k=p(/^([^{]+)/);if(k)return mn(k[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(R){return R.replace(/,/g,"\u200C")}).split(/\s*(?![^(]*\)),\s*/).map(function(R){return R.replace(/\u200C/g,",")})}function b(){var k=o(),R=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(R){if(R=mn(R[0]),!p(/^:\s*/))return c("property missing ':'");var G=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),W=k({type:"declaration",property:R.replace(u9,""),value:G?mn(G[0]).replace(u9,""):""});return p(/^[;\s]*/),W}}function _(){var k=[];if(!u())return c("missing '{'");m(k);for(var R;R=b();)R!==!1&&(k.push(R),m(k));return f()?k:c("missing '}'")}function v(){for(var k,R=[],G=o();k=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)R.push(k[1]),p(/^,\s*/);if(R.length)return G({type:"keyframe",values:R,declarations:_()})}function w(){var k=o(),G=p(/^@([-\w]+)?keyframes\s*/);if(G){var R=G[1],G=p(/^([-\w]+)\s*/);if(!G)return c("@keyframes missing name");var W=G[1];if(!u())return c("@keyframes missing '{'");for(var N,L=m();N=v();)L.push(N),L=L.concat(m());return f()?k({type:"keyframes",name:W,vendor:R,keyframes:L}):c("@keyframes missing '}'")}}function q(){var k=o(),R=p(/^@supports *([^{]+)/);if(R){var G=mn(R[1]);if(!u())return c("@supports missing '{'");var W=m().concat(h());return f()?k({type:"supports",supports:G,rules:W}):c("@supports missing '}'")}}function C(){var k=o(),R=p(/^@host\s*/);if(R){if(!u())return c("@host missing '{'");var G=m().concat(h());return f()?k({type:"host",rules:G}):c("@host missing '}'")}}function S(){var k=o(),R=p(/^@media *([^{]+)/);if(R){var G=mn(R[1]);if(!u())return c("@media missing '{'");var W=m().concat(h());return f()?k({type:"media",media:G,rules:W}):c("@media missing '}'")}}function I(){var k=o(),R=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(R)return k({type:"custom-media",name:mn(R[1]),media:mn(R[2])})}function M(){var k=o(),R=p(/^@page */);if(R){var G=y()||[];if(!u())return c("@page missing '{'");for(var W=m(),N;N=b();)W.push(N),W=W.concat(m());return f()?k({type:"page",selectors:G,declarations:W}):c("@page missing '}'")}}function T(){var k=o(),R=p(/^@([-\w]+)?document *([^{]+)/);if(R){var G=mn(R[1]),W=mn(R[2]);if(!u())return c("@document missing '{'");var N=m().concat(h());return f()?k({type:"document",document:W,vendor:G,rules:N}):c("@document missing '}'")}}function P(){var k=o(),R=p(/^@font-face\s*/);if(R){if(!u())return c("@font-face missing '{'");for(var G=m(),W;W=b();)G.push(W),G=G.concat(m());return f()?k({type:"font-face",declarations:G}):c("@font-face missing '}'")}}var A=H("import"),j=H("charset"),B=H("namespace");function H(k){var R=new RegExp("^@"+k+"\\s*([^;]+);");return function(){var G=o(),W=p(R);if(W){var N={type:k};return N[k]=W[1].trim(),G(N)}}}function X(){if(e[0]=="@")return w()||S()||I()||q()||A()||j()||B()||T()||M()||C()||P()}function D(){var k=o(),R=y();return R?(m(),k({type:"rule",selectors:R,declarations:_()})):c("selector missing")}return Tg(l())};function mn(e){return e?e.replace(/^\s+|\s+$/g,""):""}function Tg(e,t){var r=e&&typeof e.type=="string",n=r?e:t;for(var i in e){var o=e[i];Array.isArray(o)?o.forEach(function(s){Tg(s,n)}):o&&typeof o=="object"&&Tg(o,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}});var _9=Vg((W4e,Lg)=>{"use strict";var kL=Object.prototype.hasOwnProperty,rr="~";function ws(){}Object.create&&(ws.prototype=Object.create(null),new ws().__proto__||(rr=!1));function RL(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function b9(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var o=new RL(r,n||e,i),s=rr?rr+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],o]:e._events[s].push(o):(e._events[s]=o,e._eventsCount++),e}function El(e,t){--e._eventsCount===0?e._events=new ws:delete e._events[t]}function Yt(){this._events=new ws,this._eventsCount=0}Yt.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)kL.call(r,n)&&t.push(rr?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};Yt.prototype.listeners=function(t){var r=rr?rr+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s};Yt.prototype.listenerCount=function(t){var r=rr?rr+t:t,n=this._events[r];return n?n.fn?1:n.length:0};Yt.prototype.emit=function(t,r,n,i,o,s){var a=rr?rr+t:t;if(!this._events[a])return!1;var c=this._events[a],l=arguments.length,u,f;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,o),!0;case 6:return c.fn.call(c.context,r,n,i,o,s),!0}for(f=1,u=new Array(l-1);f<l;f++)u[f-1]=arguments[f];c.fn.apply(c.context,u)}else{var h=c.length,p;for(f=0;f<h;f++)switch(c[f].once&&this.removeListener(t,c[f].fn,void 0,!0),l){case 1:c[f].fn.call(c[f].context);break;case 2:c[f].fn.call(c[f].context,r);break;case 3:c[f].fn.call(c[f].context,r,n);break;case 4:c[f].fn.call(c[f].context,r,n,i);break;default:if(!u)for(p=1,u=new Array(l-1);p<l;p++)u[p-1]=arguments[p];c[f].fn.apply(c[f].context,u)}}return!0};Yt.prototype.on=function(t,r,n){return b9(this,t,r,n,!1)};Yt.prototype.once=function(t,r,n){return b9(this,t,r,n,!0)};Yt.prototype.removeListener=function(t,r,n,i){var o=rr?rr+t:t;if(!this._events[o])return this;if(!r)return El(this,o),this;var s=this._events[o];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&El(this,o);else{for(var a=0,c=[],l=s.length;a<l;a++)(s[a].fn!==r||i&&!s[a].once||n&&s[a].context!==n)&&c.push(s[a]);c.length?this._events[o]=c.length===1?c[0]:c:El(this,o)}return this};Yt.prototype.removeAllListeners=function(t){var r;return t?(r=rr?rr+t:t,this._events[r]&&El(this,r)):(this._events=new ws,this._eventsCount=0),this};Yt.prototype.off=Yt.prototype.removeListener;Yt.prototype.addListener=Yt.prototype.on;Yt.prefixed=rr;Yt.EventEmitter=Yt;typeof Lg<"u"&&(Lg.exports=Yt)});var u1={name:"@antv/infographic",version:"0.2.8",workspaces:["dev","site"],description:"An Infographic Generation and Rendering Framework, bring words to life!",keywords:["antv","infographic","visualization"],repository:"git@github.com:antvis/Infographic.git",license:"MIT",author:"Aarebecca",exports:{".":{types:"./esm/index.d.ts",require:"./lib/index.js",import:"./esm/index.js"},"./jsx-runtime":{types:"./esm/jsx-runtime.d.ts",require:"./lib/jsx-runtime.js",import:"./esm/jsx-runtime.js"},"./jsx-dev-runtime":{types:"./esm/jsx-dev-runtime.d.ts",require:"./lib/jsx-dev-runtime.js",import:"./esm/jsx-dev-runtime.js"},"./ssr":{types:"./lib/ssr/index.d.ts",require:"./lib/ssr/index.js",import:"./esm/ssr/index.js"}},main:"./lib/index.js",jsdelivr:"./dist/infographic.umd.min.js",unpkg:"./dist/infographic.umd.min.js",module:"./esm/index.js",types:"./esm/index.d.ts",files:["lib","esm","dist","src"],scripts:{build:"run-s clean build:esm build:cjs build:umd size","build:cjs":"tsc --module commonjs --outDir lib","build:esm":"tsc --module ESNext --outDir esm","build:site":"npm --prefix site run build:static","build:umd":"vite build","build:watch":"tsc -p tsconfig.json --watch","check:test":"tsc --noEmit -p __tests__",ci:"run-s build test lint",clean:"rimraf esm lib dist tsconfig.tsbuildinfo",dev:"cd dev && npm run dev",format:"prettier --write . --ignore-path ./.gitignore",lint:"run-s lint:root lint:site","lint:root":"eslint . --ext .ts,.tsx --ignore-pattern 'site/**' && npm run check:test","lint:site":"npm --prefix site run lint",prepublishOnly:"npm run ci",size:"size-limit",test:"vitest --run --coverage"},commitlint:{extends:["@commitlint/config-conventional"]},"lint-staged":{"*.{ts,tsx}":["eslint --fix","prettier --write"]},prettier:{plugins:["prettier-plugin-organize-imports","prettier-plugin-packagejson"],singleQuote:!0,overrides:[{files:["*.md","*.mdx"],options:{embeddedLanguageFormatting:"off"}}]},dependencies:{"@antv/hierarchy":"^0.7.0","@antv/layout":"^2.0.0-beta.0",css:"^3.0.0",culori:"^4.0.2",d3:"^7.9.0",eventemitter3:"^5.0.1",flru:"^1.0.2",linkedom:"^0.18.12","lodash-es":"^4.17.21",measury:"^0.1.3",roughjs:"^4.6.6","round-polygon":"^0.6.7",tinycolor2:"^1.6.0"},devDependencies:{"@commitlint/cli":"^19.8.1","@commitlint/config-conventional":"^19.8.1","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^12.3.0","@size-limit/file":"^11.2.0","@types/css":"^0.0.38","@types/culori":"^4.0.1","@types/d3":"^7.4.3","@types/jsdom":"^21.1.7","@types/lodash-es":"^4.17.12","@types/node":"^24.3.1","@types/tinycolor2":"^1.4.6","@vitest/coverage-v8":"^3.2.4","any-skills":"^0.1.1",csstype:"^3.2.2",eslint:"^9.35.0",globals:"^16.4.0","gzip-size":"^7.0.0",husky:"^9.1.7",jiti:"^2.5.1",jsdom:"^27.0.0","lint-staged":"^16.1.6","npm-run-all":"^4.1.5",prettier:"^3.6.2","prettier-plugin-organize-imports":"^4.2.0","prettier-plugin-packagejson":"^2.5.19",rimraf:"^6.1.0",rollup:"^4.53.2","rollup-plugin-visualizer":"^6.0.5","size-limit":"^11.2.0",typescript:"^5.9.2","typescript-eslint":"^8.43.0",vite:"^7.1.5","vite-node":"^3.2.4","vite-tsconfig-paths":"^5.1.4",vitest:"^3.2.4"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/",tag:"latest"},"size-limit":[{gzip:!0,limit:"500 Kb",path:"dist/infographic.min.js"},{limit:"500 Kb",path:"dist/infographic.min.js"}]};var d1=new Map;function Nl(e,t){d1.set(e,t)}function Gl(e){return d1.get(e)}var Ao={edgeType:"curved",edgeColorMode:"gradient",edgeWidth:2,colorMode:"branch",levelGap:80,nodeGap:18},Lo={edgeType:"curved",edgeWidth:2,edgeColorMode:"gradient",colorMode:"level",levelGap:80,nodeGap:18},f1={type:"lined-text",usePaletteColor:!0,showUnderline:!0,underlineThickness:2},h1={type:"capsule-item"},p1={type:"circular-progress"},m1={type:"rounded-rect-node",positionH:"center"},g1={type:"compact-card"},F9=(e,t)=>({type:"hierarchy-mindmap",...t!==void 0?{edgeAlign:t}:{},...e}),Dr=(e,t,r,n)=>[e,{design:{structure:F9(t,n),item:r}}],x1=Object.fromEntries([Dr("hierarchy-mindmap-branch-gradient-lined-palette",Ao,f1,"bottom"),Dr("hierarchy-mindmap-level-gradient-lined-palette",Lo,f1,"bottom"),Dr("hierarchy-mindmap-branch-gradient-capsule-item",Ao,h1),Dr("hierarchy-mindmap-level-gradient-capsule-item",Lo,h1),Dr("hierarchy-mindmap-branch-gradient-circle-progress",Ao,p1,.4),Dr("hierarchy-mindmap-level-gradient-circle-progress",Lo,p1,.4),Dr("hierarchy-mindmap-branch-gradient-rounded-rect",Ao,m1),Dr("hierarchy-mindmap-level-gradient-rounded-rect",Lo,m1),Dr("hierarchy-mindmap-branch-gradient-compact-card",Ao,g1),Dr("hierarchy-mindmap-level-gradient-compact-card",Lo,g1)]);var y1={"hierarchy-structure":{design:{title:"default",structure:{type:"hierarchy-structure"},item:"simple"}},"hierarchy-structure-mirror":{design:{title:"default",structure:{type:"hierarchy-structure",layerLabelPosition:"right"},item:"simple"}}};var j9={"tech-style":{edgeType:"straight",edgeStyle:"solid",edgeColorMode:"gradient",edgeMarker:"arrow",markerSize:12,edgeCornerRadius:5},"dashed-line":{edgeStyle:"dashed",edgeCornerRadius:10,edgeDashPattern:"10,5",edgeColorMode:"gradient",edgeMarker:"dot",markerSize:6,edgeOffset:6},"distributed-origin":{edgeOrigin:"distributed",edgeOriginPadding:30,edgeMarker:"arrow",edgeCornerRadius:10,markerSize:12,edgeColorMode:"gradient"},"curved-line":{edgeType:"curved",edgeColorMode:"gradient",edgeMarker:"none"},"dashed-arrow":{edgeType:"straight",edgeStyle:"dashed",edgeDashPattern:"8,4",edgeMarker:"arrow",markerSize:10,edgeCornerRadius:0}},D9=["capsule-item","rounded-rect-node","compact-card","badge-card","ribbon-card"],Wl={},b1="hierarchy-tree",B9=[{key:""},{key:"bt",orientation:"bottom-top"},{key:"lr",orientation:"left-right"},{key:"rl",orientation:"right-left"}],N9=(e,t,r)=>e?`${b1}-${e}-${t}-${r}`:`${b1}-${t}-${r}`;for(let e of D9)for(let[t,r]of Object.entries(j9))for(let{key:n,orientation:i}of B9){let o=N9(n,t,e);Wl[o]={design:{structure:{type:"hierarchy-tree",...i?{orientation:i}:{},...r},item:{type:e}}}}var _1={"list-zigzag-up-compact-card":{design:{title:"default",structure:{type:"list-zigzag-up"},items:[{type:"compact-card"}]},themeConfig:{colorPrimary:"#17CA2C"}},"list-zigzag-up-simple":{design:{title:"default",structure:{type:"list-zigzag-up"},items:[{type:"simple",usePaletteColor:!0}]},themeConfig:{colorPrimary:"#17CA2C"}},"list-zigzag-down-compact-card":{design:{title:"default",structure:{type:"list-zigzag-down"},items:[{type:"compact-card"}]},themeConfig:{colorPrimary:"#17CA2C"}},"list-zigzag-down-simple":{design:{title:"default",structure:{type:"list-zigzag-down"},items:[{type:"simple",usePaletteColor:!0}]},themeConfig:{colorPrimary:"#17CA2C"}}};var G9={"simple-circle-node":{type:"simple-circle-node"},"badge-card":{type:"badge-card"},capsule:{type:"capsule-item"},"compact-card":{type:"compact-card"}},Es={type:"relation-dagre-flow",edgeColorMode:"gradient",showArrow:!0,arrowType:"triangle",colorMode:"node"},W9={tb:{...Es,rankdir:"TB",edgeRouting:"orth"},lr:{...Es,rankdir:"LR",edgeRouting:"orth"},"tb-animated":{...Es,rankdir:"TB",edgeCornerRadius:12,edgeRouting:"orth",edgeAnimation:"ant-line",edgeDashPattern:"8,4",edgeAnimationSpeed:1},"lr-animated":{...Es,rankdir:"LR",edgeCornerRadius:12,edgeRouting:"orth",edgeAnimation:"ant-line",edgeDashPattern:"8,4",edgeAnimationSpeed:1}},Xl={},X9=["lr-capsule","tb-capsule"];Object.entries(W9).forEach(([e,t])=>{Object.entries(G9).forEach(([r,n])=>{let i=`${e}-${r}`;if(X9.includes(i))return;let o=`relation-dagre-flow-${i}`;Xl[o]={design:{title:"default",structure:t,item:n}}})});var v1={"sequence-stairs-front-pill-badge":{design:{title:"default",structure:{type:"sequence-stairs-front"},items:[{type:"pill-badge"}]}},"sequence-stairs-front-compact-card":{design:{title:"default",structure:{type:"sequence-stairs-front"},items:[{type:"compact-card"}]}},"sequence-stairs-front-simple":{design:{title:"default",structure:{type:"sequence-stairs-front"},items:[{type:"simple",usePaletteColor:!0}]}}};var w1={"chart-wordcloud-rotate":{design:{structure:{type:"chart-wordcloud"},item:"simple"}},"chart-wordcloud":{design:{structure:{type:"chart-wordcloud",enableRotate:!1},item:"simple"}}};var Y9={"compare-hierarchy-left-right-circle-node-pill-badge":{design:{structure:{type:"compare-hierarchy-left-right",decoration:"split-line",surround:!1,groupGap:-20},title:"default",items:[{type:"circle-node",width:240},"pill-badge"]},themeConfig:{}},"compare-hierarchy-left-right-circle-node-plain-text":{design:{title:"default",structure:{type:"compare-hierarchy-left-right",decoration:"dot-line",flipLeaf:!0,groupGap:-10},items:[{type:"circle-node",width:180},{type:"plain-text"}]}},"list-pyramid-rounded-rect-node":{design:{title:"default",structure:{type:"list-pyramid"},items:[{type:"rounded-rect-node"}]}},"list-pyramid-badge-card":{design:{title:"default",structure:{type:"list-pyramid"},items:[{type:"badge-card"}]}},"list-pyramid-compact-card":{design:{title:"default",structure:{type:"list-pyramid"},items:[{type:"compact-card"}]}},"list-column-done-list":{design:{title:"default",structure:{type:"list-column"},items:[{type:"done-list"}]}},"list-column-vertical-icon-arrow":{design:{title:"default",structure:{type:"list-column",gap:-5,zigzag:!0},items:[{type:"vertical-icon-arrow"}]}},"list-grid-badge-card":{design:{title:"default",structure:{type:"list-grid"},items:[{type:"badge-card"}]}},"list-grid-candy-card-lite":{design:{title:"default",structure:{type:"list-grid"},items:[{type:"candy-card-lite"}]}},"chart-column-simple":{design:{title:"default",structure:{type:"chart-column"},items:[{type:"simple",showIcon:!1,usePaletteColor:!0}]}},"list-grid-circular-progress":{design:{title:"default",structure:{type:"list-grid"},items:[{type:"circular-progress"}]}},"list-grid-compact-card":{design:{title:"default",structure:{type:"list-grid"},items:[{type:"compact-card"}]}},"list-grid-done-list":{design:{title:"default",structure:{type:"list-grid"},items:[{type:"done-list"}]}},"list-grid-horizontal-icon-arrow":{design:{title:"default",structure:{type:"list-grid",gap:0,zigzag:!0},items:[{type:"horizontal-icon-arrow"}]}},"list-grid-progress-card":{design:{title:"default",structure:{type:"list-grid"},items:[{type:"progress-card"}]}},"list-grid-ribbon-card":{design:{title:"default",structure:{type:"list-grid"},items:[{type:"ribbon-card"}]}},"list-grid-simple":{design:{title:"default",structure:{type:"list-grid"},items:[{type:"simple"}]}},"list-row-circular-progress":{design:{title:"default",structure:{type:"list-row"},items:[{type:"circular-progress"}]}},"list-row-horizontal-icon-arrow":{design:{title:"default",structure:{type:"list-row",gap:0,zigzag:!0},items:[{type:"horizontal-icon-arrow"}]}},"relation-circle-circular-progress":{design:{title:"default",structure:{type:"relation-circle"},items:[{type:"circular-progress"}]}},"relation-circle-icon-badge":{design:{title:"default",structure:{type:"relation-circle"},items:[{type:"icon-badge"}]}},"sequence-steps-badge-card":{design:{title:"default",structure:{type:"sequence-steps"},items:[{type:"badge-card"}]}},"sequence-steps-simple":{design:{title:"default",structure:{type:"sequence-steps",gap:10},items:[{type:"simple"}]}},"sequence-timeline-done-list":{design:{title:"default",structure:{type:"sequence-timeline"},items:[{type:"done-list"}]}},"sequence-timeline-plain-text":{design:{title:"default",structure:{type:"sequence-timeline"},items:[{type:"plain-text"}]}},"sequence-timeline-rounded-rect-node":{design:{title:"default",structure:{type:"sequence-timeline"},items:[{type:"rounded-rect-node"}]}},"sequence-ascending-steps":{design:{title:"default",structure:{type:"sequence-ascending-steps",vGap:-46,hGap:-20},items:[{type:"l-corner-card"}]}},"sequence-timeline-simple":{design:{title:"default",structure:{type:"sequence-timeline",gap:20},items:[{type:"simple",positionV:"middle"}]}},"sequence-cylinders-3d-simple":{design:{title:"default",structure:{type:"sequence-cylinders-3d",gapY:20},items:[{type:"simple",showIcon:!1,usePaletteColor:!0}]}},"list-column-simple-vertical-arrow":{design:{title:"default",structure:{type:"list-column",gap:0,zigzag:!0},items:[{type:"simple-vertical-arrow"}]}},"list-row-simple-horizontal-arrow":{design:{title:"default",structure:{type:"list-row",gap:0,zigzag:!0},items:[{type:"simple-horizontal-arrow"}]}},"compare-swot":{design:{title:"default",structure:{type:"compare-hierarchy-row",itemGap:32,itemPadding:40,showColumnBackground:!0,columnBackgroundAlpha:.08},items:[{type:"letter-card",showBottomShade:!1},{type:"plain-text",formatter:e=>`\u25CF ${e}`,usePaletteColor:!0}]}},"compare-hierarchy-row-letter-card-compact-card":{design:{title:"default",structure:{type:"compare-hierarchy-row"},items:[{type:"letter-card"},{type:"compact-card"}]}},"compare-hierarchy-row-letter-card-rounded-rect-node":{design:{title:"default",structure:{type:"compare-hierarchy-row"},items:[{type:"letter-card"},{type:"rounded-rect-node"}]}},"sequence-snake-steps-compact-card":{design:{title:"default",structure:{type:"sequence-snake-steps"},items:[{type:"compact-card"}]}},"sequence-snake-steps-pill-badge":{design:{title:"default",structure:{type:"sequence-snake-steps"},items:[{type:"pill-badge"}]}},"sequence-snake-steps-simple":{design:{title:"default",structure:{type:"sequence-snake-steps"},items:[{type:"simple"}]}},"sequence-color-snake-steps-horizontal-icon-line":{design:{title:"default",structure:{type:"sequence-color-snake-steps"},items:[{type:"horizontal-icon-line"}]}},"sequence-pyramid-simple":{design:{title:"default",structure:{type:"sequence-pyramid"},items:[{type:"simple",showIcon:!1,usePaletteColor:!0}]},themeConfig:{colorPrimary:"#1677ff"}},"sequence-funnel-simple":{design:{title:"default",structure:{type:"sequence-funnel"},items:[{type:"simple",showIcon:!1,usePaletteColor:!0}]},themeConfig:{palette:"#1677ff"}},"list-row-horizontal-icon-line":{design:{title:"default",structure:{type:"list-row",gap:0,zigzag:!0},items:[{type:"horizontal-icon-line"}]}},"list-sector-simple":{design:{title:"default",structure:{type:"list-sector"},items:[{type:"simple"}]}},"list-sector-plain-text":{design:{title:"default",structure:{type:"list-sector"},items:[{type:"plain-text"}]}},"list-sector-half-plain-text":{design:{title:"default",structure:{type:"list-sector",startAngle:-180,endAngle:0},items:[{type:"plain-text"}]}},"quadrant-quarter-simple-card":{design:{title:"default",structure:{type:"quadrant"},items:[{type:"quarter-simple-card"}]}},"quadrant-quarter-circular":{design:{title:"default",structure:{type:"quadrant"},items:[{type:"quarter-circular"}]}},"sequence-roadmap-vertical-plain-text":{design:{title:"default",structure:{type:"sequence-roadmap-vertical"},items:[{type:"plain-text"}]}},"sequence-roadmap-vertical-simple":{design:{title:"default",structure:{type:"sequence-roadmap-vertical"},items:[{type:"simple",showIcon:!1}]}},"sequence-roadmap-vertical-badge-card":{design:{title:"default",structure:{type:"sequence-roadmap-vertical"},items:[{type:"badge-card"}]}},"sequence-roadmap-vertical-pill-badge":{design:{title:"default",structure:{type:"sequence-roadmap-vertical"},items:[{type:"pill-badge"}]}},"sequence-roadmap-vertical-quarter-circular":{design:{title:"default",structure:{type:"sequence-roadmap-vertical"},items:[{type:"quarter-circular"}]}},"sequence-roadmap-vertical-quarter-simple-card":{design:{title:"default",structure:{type:"sequence-roadmap-vertical",flipped:!0},items:[{type:"quarter-simple-card"}]}},"sequence-horizontal-zigzag-simple-illus":{design:{title:"default",structure:{type:"sequence-horizontal-zigzag"},items:[{type:"simple-illus"}]}},"sequence-horizontal-zigzag-horizontal-icon-line":{design:{title:"default",structure:{type:"sequence-horizontal-zigzag"},items:[{type:"horizontal-icon-line"}]}},"sequence-horizontal-zigzag-plain-text":{design:{title:"default",structure:{type:"sequence-horizontal-zigzag"},items:[{type:"plain-text"}]}},"sequence-horizontal-zigzag-simple-horizontal-arrow":{design:{title:"default",structure:{type:"sequence-horizontal-zigzag"},items:[{type:"simple-horizontal-arrow"}]}},"sequence-horizontal-zigzag-simple":{design:{title:"default",structure:{type:"sequence-horizontal-zigzag"},items:[{type:"simple"}]}},"list-row-simple-illus":{design:{title:"default",structure:{type:"list-row"},items:[{type:"simple-illus"}]}},"quadrant-simple-illus":{design:{title:"default",structure:{type:"quadrant"},items:[{type:"simple-illus"}]}},"sequence-color-snake-steps-simple-illus":{design:{title:"default",structure:{type:"sequence-color-snake-steps"},items:[{type:"simple-illus"}]}},"sequence-snake-steps-simple-illus":{design:{title:"default",structure:{type:"sequence-snake-steps"},items:[{type:"simple-illus"}]}},"sequence-steps-simple-illus":{design:{title:"default",structure:{type:"sequence-steps"},items:[{type:"simple-illus"}]}},"sequence-timeline-simple-illus":{design:{title:"default",structure:{type:"sequence-timeline"},items:[{type:"simple-illus",usePaletteColor:!0}]}},"sequence-zigzag-steps-underline-text":{design:{title:"default",structure:{type:"sequence-zigzag-steps"},items:[{type:"underline-text"}]}},"sequence-horizontal-zigzag-underline-text":{design:{title:"default",structure:{type:"sequence-horizontal-zigzag"},items:[{type:"underline-text"}]}},"sequence-roadmap-vertical-underline-text":{design:{title:"default",structure:{type:"sequence-roadmap-vertical"},items:[{type:"underline-text"}]}},"sequence-snake-steps-underline-text":{design:{title:"default",structure:{type:"sequence-snake-steps"},items:[{type:"underline-text"}]}},"sequence-circle-arrows-indexed-card":{design:{title:"default",structure:{type:"sequence-circle-arrows"},items:[{type:"indexed-card"}]}},"sequence-zigzag-pucks-3d-simple":{design:{title:"default",structure:{type:"sequence-zigzag-pucks-3d"},items:[{type:"simple",showIcon:!1,usePaletteColor:!0}]}},"sequence-zigzag-pucks-3d-underline-text":{design:{title:"default",structure:{type:"sequence-zigzag-pucks-3d"},items:[{type:"underline-text"}]}},"sequence-zigzag-pucks-3d-indexed-card":{design:{title:"default",structure:{type:"sequence-zigzag-pucks-3d"},items:[{type:"indexed-card"}]}},"sequence-ascending-stairs-3d-simple":{design:{title:"default",structure:{type:"sequence-ascending-stairs-3d"},items:[{type:"simple",showIcon:!1,usePaletteColor:!0}]}},"sequence-ascending-stairs-3d-underline-text":{design:{title:"default",structure:{type:"sequence-ascending-stairs-3d"},items:[{type:"underline-text"}]}},"sequence-circular-underline-text":{design:{title:"default",structure:{type:"sequence-circular"},items:[{type:"underline-text"}]}},"sequence-circular-simple":{design:{title:"default",structure:{type:"sequence-circular"},items:[{type:"simple",showIcon:!1,usePaletteColor:!0}]}},"sequence-filter-mesh-underline-text":{design:{title:"default",structure:{type:"sequence-filter-mesh"},items:[{type:"underline-text"}]}},"sequence-filter-mesh-simple":{design:{title:"default",structure:{type:"sequence-filter-mesh"},items:[{type:"simple",showIcon:!1,usePaletteColor:!0}]}},"sequence-mountain-underline-text":{design:{title:"default",structure:{type:"sequence-mountain"},items:[{type:"underline-text"}]}},"compare-binary-horizontal-simple-fold":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"pros-cons-fold"},items:[{type:"simple",iconType:"circle",iconSize:40}]}},"compare-binary-horizontal-underline-text-fold":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"pros-cons-fold"},items:[{type:"underline-text"}]}},"compare-binary-horizontal-badge-card-fold":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"pros-cons-fold"},items:[{type:"badge-card"}]}},"compare-binary-horizontal-compact-card-fold":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"pros-cons-fold"},items:[{type:"compact-card"}]}},"compare-binary-horizontal-simple-arrow":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"pros-cons-arrow"},items:[{type:"simple",iconType:"circle",iconSize:40}]}},"compare-binary-horizontal-underline-text-arrow":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"pros-cons-arrow"},items:[{type:"underline-text"}]}},"compare-binary-horizontal-badge-card-arrow":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"pros-cons-arrow"},items:[{type:"badge-card"}]}},"compare-binary-horizontal-compact-card-arrow":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"pros-cons-arrow"},items:[{type:"compact-card"}]}},"compare-binary-horizontal-simple-vs":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"vs"},items:[{type:"simple",iconType:"circle",iconSize:40}]}},"compare-binary-horizontal-underline-text-vs":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"vs"},items:[{type:"underline-text"}]}},"compare-binary-horizontal-badge-card-vs":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"vs"},items:[{type:"badge-card"}]}},"compare-binary-horizontal-compact-card-vs":{design:{title:"default",structure:{type:"compare-binary-horizontal",dividerType:"vs"},items:[{type:"compact-card"}]}},"chart-bar-plain-text":{design:{title:"default",structure:{type:"chart-bar"},items:[{type:"plain-text",positionH:"flipped"}]}},"chart-line-plain-text":{design:{title:"default",structure:{type:"chart-line"},items:[{type:"plain-text",lineNumber:2}]}},"chart-pie-plain-text":{design:{title:"default",structure:{type:"chart-pie"},items:[{type:"plain-text"}]}},"chart-pie-compact-card":{design:{title:"default",structure:{type:"chart-pie"},items:[{type:"compact-card"}]}},"chart-pie-pill-badge":{design:{title:"default",structure:{type:"chart-pie"},items:[{type:"pill-badge"}]}},"chart-pie-donut-plain-text":{design:{title:"default",structure:{type:"chart-pie",innerRadius:90},items:[{type:"plain-text"}]}},"chart-pie-donut-compact-card":{design:{title:"default",structure:{type:"chart-pie",innerRadius:90},items:[{type:"compact-card"}]}},"chart-pie-donut-pill-badge":{design:{title:"default",structure:{type:"chart-pie",innerRadius:90},items:[{type:"pill-badge"}]}},...Wl,...x1,...v1,...w1,..._1,...Xl,...y1};Object.entries(Y9).forEach(([e,t])=>{Nl(e,t)});var De=Symbol.for("@antv/infographic/Fragment");function d(e,t={}){return{type:e,props:t}}var E=d;var Is=Symbol.for("@antv/infographic/Defs");function ke(e){return{type:Is,props:e}}function je(e){let{x:t=0,y:r=0,width:n=0,height:i=0}=e;return e.cx??(e.cx=t+n/2),e.cy??(e.cy=r+i/2),e.rx??(e.rx=n/2),e.ry??(e.ry=i/2),{type:"ellipse",props:e}}function O(e){let{x:t=0,y:r=0}=e;return(t||r)&&(e.transform||(e.transform=`translate(${t}, ${r})`)),{type:"g",props:e}}function ae(e){let{x:t,y:r}=e,n={...e};return(t!==void 0||r!==void 0)&&(n.transform=`translate(${t??0}, ${r??0})`),{type:"path",props:n}}function gt({points:e=[],...t}){let{x:r,y:n}=t,i=e.map(({x:a,y:c})=>`${a},${c}`).join(" "),o={...t,points:i};return(r!==void 0||n!==void 0)&&(o.transform=`translate(${r??0}, ${n??0})`+(o.transform||"")),{type:"polygon",props:o}}function we(e){return{type:"rect",props:e}}function Yl(e){return Object.keys(e[0]).reduce((t,r)=>{let n=r;return e.every(i=>i[n]===e[0][n])&&(t[n]=e[0][n]),t},{})}var V9=(e,t)=>{if(typeof e=="number"){if(t===3)return{mode:"rgb",r:(e>>8&15|e>>4&240)/255,g:(e>>4&15|e&240)/255,b:(e&15|e<<4&240)/255};if(t===4)return{mode:"rgb",r:(e>>12&15|e>>8&240)/255,g:(e>>8&15|e>>4&240)/255,b:(e>>4&15|e&240)/255,alpha:(e&15|e<<4&240)/255};if(t===6)return{mode:"rgb",r:(e>>16&255)/255,g:(e>>8&255)/255,b:(e&255)/255};if(t===8)return{mode:"rgb",r:(e>>24&255)/255,g:(e>>16&255)/255,b:(e>>8&255)/255,alpha:(e&255)/255}}},Ts=V9;var U9={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},q1=U9;var K9=e=>Ts(q1[e.toLowerCase()],6),C1=K9;var Z9=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,Q9=e=>{let t;return(t=e.match(Z9))?Ts(parseInt(t[1],16),t[1].length):void 0},S1=Q9;var Zt="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",Dk=`(?:${Zt}|none)`,ti=`${Zt}%`,Bk=`(?:${Zt}%|none)`,ko=`(?:${Zt}%|${Zt})`,J9=`(?:${Zt}%|${Zt}|none)`,E1=`(?:${Zt}(deg|grad|rad|turn)|${Zt})`,Nk=`(?:${Zt}(deg|grad|rad|turn)|${Zt}|none)`,xn="\\s*,\\s*";var Gk=new RegExp("^"+J9+"$");var eq=new RegExp(`^rgba?\\(\\s*${Zt}${xn}${Zt}${xn}${Zt}\\s*(?:,\\s*${ko}\\s*)?\\)$`),tq=new RegExp(`^rgba?\\(\\s*${ti}${xn}${ti}${xn}${ti}\\s*(?:,\\s*${ko}\\s*)?\\)$`),rq=e=>{let t={mode:"rgb"},r;if(r=e.match(eq))r[1]!==void 0&&(t.r=r[1]/255),r[2]!==void 0&&(t.g=r[2]/255),r[3]!==void 0&&(t.b=r[3]/255);else if(r=e.match(tq))r[1]!==void 0&&(t.r=r[1]/100),r[2]!==void 0&&(t.g=r[2]/100),r[3]!==void 0&&(t.b=r[3]/100);else return;return r[4]!==void 0?t.alpha=Math.max(0,Math.min(1,r[4]/100)):r[5]!==void 0&&(t.alpha=Math.max(0,Math.min(1,+r[5]))),t},I1=rq;var nq=(e,t)=>e===void 0?void 0:typeof e!="object"?Qt(e):e.mode!==void 0?e:t?{...e,mode:t}:void 0,T1=nq;var iq=(e="rgb")=>t=>(t=T1(t,e))!==void 0?t.mode===e?t:Rr[t.mode][e]?Rr[t.mode][e](t):e==="rgb"?Rr[t.mode].rgb(t):Rr.rgb[e](Rr[t.mode].rgb(t)):void 0,ri=iq;var Rr={},M1={},Ro=[],Vl={},oq=e=>e,lt=e=>(Rr[e.mode]={...Rr[e.mode],...e.toMode},Object.keys(e.fromMode||{}).forEach(t=>{Rr[t]||(Rr[t]={}),Rr[t][e.mode]=e.fromMode[t]}),e.ranges||(e.ranges={}),e.difference||(e.difference={}),e.channels.forEach(t=>{if(e.ranges[t]===void 0&&(e.ranges[t]=[0,1]),!e.interpolate[t])throw new Error(`Missing interpolator for: ${t}`);typeof e.interpolate[t]=="function"&&(e.interpolate[t]={use:e.interpolate[t]}),e.interpolate[t].fixup||(e.interpolate[t].fixup=oq)}),M1[e.mode]=e,(e.parse||[]).forEach(t=>{A1(t,e.mode)}),ri(e.mode)),Ul=e=>M1[e],A1=(e,t)=>{if(typeof e=="string"){if(!t)throw new Error("'mode' required when 'parser' is a string");Vl[e]=t}else typeof e=="function"&&Ro.indexOf(e)<0&&Ro.push(e)};var Kl=/[^\x00-\x7F]|[a-zA-Z_]/,sq=/[^\x00-\x7F]|[-\w]/,ce={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"},Ne=0;function Ms(e){let t=e[Ne],r=e[Ne+1];return t==="-"||t==="+"?/\d/.test(r)||r==="."&&/\d/.test(e[Ne+2]):t==="."?/\d/.test(r):/\d/.test(t)}function Zl(e){if(Ne>=e.length)return!1;let t=e[Ne];if(Kl.test(t))return!0;if(t==="-"){if(e.length-Ne<2)return!1;let r=e[Ne+1];return!!(r==="-"||Kl.test(r))}return!1}var aq={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function Po(e){let t="";if((e[Ne]==="-"||e[Ne]==="+")&&(t+=e[Ne++]),t+=As(e),e[Ne]==="."&&/\d/.test(e[Ne+1])&&(t+=e[Ne++]+As(e)),(e[Ne]==="e"||e[Ne]==="E")&&((e[Ne+1]==="-"||e[Ne+1]==="+")&&/\d/.test(e[Ne+2])?t+=e[Ne++]+e[Ne++]+As(e):/\d/.test(e[Ne+1])&&(t+=e[Ne++]+As(e))),Zl(e)){let r=Ls(e);return r==="deg"||r==="rad"||r==="turn"||r==="grad"?{type:ce.Hue,value:t*aq[r]}:void 0}return e[Ne]==="%"?(Ne++,{type:ce.Percentage,value:+t}):{type:ce.Number,value:+t}}function As(e){let t="";for(;/\d/.test(e[Ne]);)t+=e[Ne++];return t}function Ls(e){let t="";for(;Ne<e.length&&sq.test(e[Ne]);)t+=e[Ne++];return t}function cq(e){let t=Ls(e);return e[Ne]==="("?(Ne++,{type:ce.Function,value:t}):t==="none"?{type:ce.None,value:void 0}:{type:ce.Ident,value:t}}function lq(e=""){let t=e.trim(),r=[],n;for(Ne=0;Ne<t.length;){if(n=t[Ne++],n===`
|
|
3
3
|
`||n===" "||n===" "){for(;Ne<t.length&&(t[Ne]===`
|
|
4
4
|
`||t[Ne]===" "||t[Ne]===" ");)Ne++;continue}if(n===",")return;if(n===")"){r.push({type:ce.ParenClose});continue}if(n==="+"){if(Ne--,Ms(t)){r.push(Po(t));continue}return}if(n==="-"){if(Ne--,Ms(t)){r.push(Po(t));continue}if(Zl(t)){r.push({type:ce.Ident,value:Ls(t)});continue}return}if(n==="."){if(Ne--,Ms(t)){r.push(Po(t));continue}return}if(n==="/"){for(;Ne<t.length&&(t[Ne]===`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as Z,c as he,e as ee,f as Se,g as xe,h as ve,i as be,l as Te,m as Ce}from"./embed-page-chunk-S2KVN3RB.js";import{a as fe,b as ge,c as me,d as ue,e as ke}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import{a as V,b as we}from"./embed-page-chunk-436REIWY.js";import{E as ne,s as q,z as se}from"./embed-page-chunk-37LGEEJU.js";import{a as K}from"./embed-page-chunk-QV7QAJ4N.js";import{Ga as E,Ha as _,Ia as ae,Pb as pe,W as v,Za as re,bc as ye,ka as ie,mb as ce,nb as de,oa as B,ta as R,tc as U,wa as C,xa as le}from"./embed-page-chunk-4W34QOXT.js";import{a as oe}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-EUOOO2LS.js";import{f as W}from"./embed-page-chunk-QBTAJ2YI.js";var h=W(oe());var k=W(oe());var e=W(K()),{Text:d}=ae,{TextArea:Ne}=R,Ee=({data:b})=>{let s=q(),{token:o}=_.useToken(),{config:w}=ne(),{put:Y}=V(),I=he(t=>t.transform[2])>.6,G=se("__GLOBAL__");if(!b)return null;let{skill:g,onClick:D,onDelete:S}=b;if(!g)return null;let[i,A]=(0,k.useState)(g),O=i.subSkills&&i.subSkills.length>0,m=i.subSkills?.length||0,F=(0,k.useMemo)(()=>Math.min(12+Math.sqrt(m)*10,48),[m]),X=i.metadata&&i.metadata.category||"global",T=(0,k.useMemo)(()=>i.metadata?Object.entries(i.metadata).filter(([t,a])=>t&&a):[],[i.metadata]),P=t=>{if(!t)return"";let a=t instanceof Date?t:new Date(t);return Number.isNaN(a.getTime())?"":a.toLocaleString()},J=t=>{navigator.clipboard.writeText(t)},[z,x]=(0,k.useState)(!1),[p,n]=(0,k.useState)({...g,id:g.name}),[c,u]=(0,k.useState)(T.map(([t,a])=>({key:t,value:a}))),[$,M]=(0,k.useState)(!1),[Q,L]=(0,k.useState)(!1);(0,k.useEffect)(()=>{x(!1),A(g),n({...g,id:g.name}),u(Object.entries(g.metadata||{}).map(([t,a])=>({key:t,value:a})))},[g]);let l=(t,a)=>{if(t==="name"){n(r=>({...r,name:a,id:a}));return}n(r=>({...r,[t]:a}))},H=async t=>{t?.stopPropagation(),t?.preventDefault();try{let a=i.id||i.name;if(!a){C.error(s("chatWorkspace.skillNode.idMissing"));return}await G.skills.delete(a),C.success(s("chatWorkspace.skillNode.deleted")),M(!1),S&&await S()}catch(a){C.error(a?.message||s("chatWorkspace.skillNode.deleteFailed"))}},j=t=>{u(t);let a=t.reduce((r,y)=>(y.key&&(r[y.key]=y.value),r),{});n(r=>({...r,metadata:a}))},te=(t,a,r)=>{let y=[...c];y[t]={...y[t],[a]:r},j(y)},We=()=>{j([...c,{key:"",value:""}])},Be=async()=>{try{L(!0);let t={"Content-Type":"application/json"};w.apiKey&&(t.Authorization=`Bearer ${w.apiKey}`);let a={name:p.name,description:p.description,license:p.license||void 0,compatibility:p.compatibility||void 0,metadata:p.metadata||void 0,content:p.content||void 0,subSkills:p.subSkills||void 0},r=await Y(`/api/skills/${i.id}`,a);if(r.success){C.success(s("chatWorkspace.skillNode.updated"));let y=r.data||p;A(y),n({...y,id:y.name}),u(Object.entries(y.metadata||{}).map(([Fe,Me])=>({key:Fe,value:Me}))),x(!1),D?.(y)}else C.error(r.message||s("chatWorkspace.skillNode.updateFailed"))}catch(t){C.error(t.message||s("chatWorkspace.skillNode.updateError"))}finally{L(!1)}},Re=(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:s("chatWorkspace.skills.field.description")}),(0,e.jsx)(Ne,{value:p.description,onChange:t=>l("description",t.target.value),placeholder:s("chatWorkspace.skills.field.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:s("chatWorkspace.skills.field.license")}),(0,e.jsx)(R,{value:p.license,onChange:t=>l("license",t.target.value),placeholder:s("chatWorkspace.skills.field.license")})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.compatibility")}),(0,e.jsx)(R,{value:p.compatibility,onChange:t=>l("compatibility",t.target.value),placeholder:s("chatWorkspace.skills.field.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:s("chatWorkspace.skills.field.metadata")}),(0,e.jsx)(v,{size:"small",icon:(0,e.jsx)(U,{}),onClick:We,children:s("chatWorkspace.skillNode.add")})]}),(0,e.jsxs)(B,{direction:"vertical",size:8,style:{width:"100%"},children:[c.length===0&&(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary},children:s("chatWorkspace.skillNode.noMetadata")}),c.map((t,a)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextSecondary},children:s("chatWorkspace.skillNode.meta",{index:a+1})}),(0,e.jsxs)(B,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(R,{value:t.key,placeholder:s("chatWorkspace.skillNode.keyPlaceholder"),style:{width:120},onChange:r=>te(a,"key",r.target.value)}),(0,e.jsx)(R,{value:t.value,placeholder:s("chatWorkspace.skillNode.valuePlaceholder"),style:{flex:1,minWidth:160},onChange:r=>te(a,"value",r.target.value)})]})]},a))]})]}),(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:s("chatWorkspace.skills.field.content")}),(0,e.jsx)(Ne,{value:p.content,onChange:t=>l("content",t.target.value),placeholder:s("chatWorkspace.skillNode.contentPlaceholder"),rows:30,style:{fontFamily:"monospace",fontSize:13,flex:1,minHeight:600}})]})]}),Ie=(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)(E,{style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},color:"geekblue",children:X.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?Re:(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,'"']})}),T.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)(ye,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:s("chatWorkspace.skillNode.metadataCount",{count:T.length})})]}),(0,e.jsx)("div",{style:{border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,overflow:"hidden"},children:T.map(([t,a],r)=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"stretch",borderBottom:r===T.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:a})]},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)(re,{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)(B,{size:[8,8],wrap:!0,children:i.subSkills.map((t,a)=>(0,e.jsx)(E,{style:{fontSize:11,padding:"4px 12px",backgroundColor:o.colorFillTertiary,color:o.colorText,border:`1px solid ${o.colorBorderSecondary}`},children:t},a))})]}),(i.license||i.compatibility)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(B,{size:[8,8],wrap:!0,children:[i.license&&(0,e.jsx)(E,{icon:(0,e.jsx)(de,{}),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)(E,{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)(B,{direction:"vertical",size:4,children:[i.createdAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Created: ",P(i.createdAt)]}),i.updatedAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Updated: ",P(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)(pe,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:s("chatWorkspace.skillNode.contentSection")})]}),(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)(ie,{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)(v,{block:!0,onClick:()=>{x(!1),n(g)},style:{flex:1},children:s("common.cancel")}),(0,e.jsx)(v,{type:"primary",block:!0,onClick:Be,loading:Q,style:{flex:1},children:s("common.save")})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v,{type:"primary",block:!0,onClick:()=>x(!0),style:{flex:1},children:s("chatWorkspace.skillNode.edit")}),(0,e.jsx)(v,{danger:!0,onClick:t=>{t.stopPropagation(),H(t)},children:s("common.delete")}),(0,e.jsx)(v,{icon:(0,e.jsx)(ce,{}),onClick:()=>J(i.id),title:s("chatWorkspace.skillNode.copyId")})]})})]});return(0,e.jsxs)("div",{style:{position:"relative",padding:4,overflow:"visible"},children:[(0,e.jsx)(ee,{type:"source",position:Z.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)(ee,{type:"target",position:Z.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:F,height:F,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)"}}),I&&(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)(le,{open:$,onCancel:()=>{M(!1),x(!1),n({...i,id:i.name})},footer:null,width:z?1e3:760,destroyOnClose:!0,title:null,styles:{body:{padding:0}},children:Ie})]})},ze=Ee;var f=W(K()),De=({onNodeClick:b})=>{let s=q(),[o,w,Y]=ve([]),[N,I,G]=be([]),[g,D]=(0,h.useState)(!1),[S,i]=(0,h.useState)([]),[A,O]=(0,h.useState)(!1),[m,F]=(0,h.useState)(null),{token:X}=_.useToken(),{get:T}=V(),P=(0,h.useMemo)(()=>({skill:ze}),[]),J=(0,h.useMemo)(()=>m===null?o:o.map(n=>{let c=n.id===m||N.some(u=>u.source===m&&u.target===n.id||u.target===m&&u.source===n.id);return{...n,style:{opacity:c?1:.2,transition:"opacity 0.2s ease"}}}),[o,N,m]),z=(0,h.useMemo)(()=>m===null?N.map(n=>({...n,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):N.map(n=>{let c=n.source===m||n.target===m;return{...n,style:{stroke:"#1677ff",strokeWidth:c?2.5:1,opacity:c?1:.04,transition:"opacity 0.2s ease"}}}),[N,m]),x=async()=>{O(!0);try{let n=await T("/api/skills");n.success&&n.data&&Array.isArray(n.data.records)&&i(n.data.records)}catch(n){console.error("Failed to fetch skills:",n),i([])}finally{O(!1)}};(0,h.useEffect)(()=>{x()},[]),(0,h.useEffect)(()=>{if(!S||S.length===0){w([]),I([]);return}let n=[],c=new Map,u=[];S.forEach(l=>{c.set(l.name,l),l.subSkills&&l.subSkills.length>0&&l.subSkills.forEach(H=>{S.find(j=>j.name===H)&&u.push({source:l.name,target:H})})});let $=S.map(l=>({id:l.name})),M=u.map(l=>({source:l.source,target:l.target})),Q=ue($).force("link",me(M).id(l=>l.id).distance(80)).force("charge",ke().strength(-300)).force("center",fe(0,0)).force("collide",ge(30)).stop();for(let l=0;l<300;l++)Q.tick();let L=$.map(l=>({id:l.id,type:"skill",data:{skill:c.get(l.id),onClick:()=>b?.(c.get(l.id)),onDelete:x},position:{x:l.x,y:l.y}}));u.forEach(l=>{c.has(l.source)&&c.has(l.target)&&n.push({id:`e${l.source}-${l.target}`,source:l.source,target:l.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"})}),w(L),I(n)},[S,w,I,b]);let p=async()=>{await x()};return A?(0,f.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:s("chat.skills.loading")}):(0,f.jsxs)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:[(0,f.jsxs)(xe,{nodes:J,edges:z,onNodesChange:Y,onEdgesChange:G,onNodeMouseEnter:(n,c)=>F(c.id),onNodeMouseLeave:()=>F(null),nodeTypes:P,fitView:!0,children:[(0,f.jsx)(Te,{color:"#eee",gap:20}),(0,f.jsx)(Ce,{})]}),(0,f.jsx)("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:(0,f.jsx)(v,{type:"primary",size:"large",icon:(0,f.jsx)(U,{}),onClick:()=>D(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:X.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})}),(0,f.jsx)(we,{open:g,onCancel:()=>D(!1),onSuccess:p})]})},Ae=b=>(0,f.jsx)(Se,{children:(0,f.jsx)(De,{...b})}),nt=Ae;export{nt as default};
|
package/dist/embed/{embed-page-TasksSideApp-DA4LUTMD.js → embed-page-TasksSideApp-D7FFG2OC.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ze}from"./embed-page-chunk-
|
|
1
|
+
import{a as Ze}from"./embed-page-chunk-JFMBLJXY.js";import{c as qe,d as Ke}from"./embed-page-chunk-NFMLKSPM.js";import{b as Ne,e as Ie,h as He,i as We}from"./embed-page-chunk-S2KVN3RB.js";import"./embed-page-chunk-S4XZPBRM.js";import{C as Ve,D as Ue,E as ue,F as Re,G as Ye,H as Qe,I as Je,K as Xe,L as et,M as tt,N as ot,r as Ge}from"./embed-page-chunk-N66H4DNH.js";import{H as Fe,Ma as me,Va as q,Xa as _e,m as ce,va as pe}from"./embed-page-chunk-BANVRQT7.js";import"./embed-page-chunk-436REIWY.js";import{s as j,w as Ee,z as Oe}from"./embed-page-chunk-37LGEEJU.js";import{a as A}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-SRMYHWL3.js";import{Da as le,Ga as Me,Ia as de,W as ae,Y as Be,Z as Le,_ as be,la as De,ra as W,ta as Ce,ua as J,xa as ze}from"./embed-page-chunk-4W34QOXT.js";import{a as se}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as T}from"./embed-page-chunk-QBTAJ2YI.js";var n=T(se());var it=T(se());var s=T(A()),Tt=[{key:"pending",color:"#7A7A7A"},{key:"in_progress",color:"#3b82f6"},{key:"failed",color:"#ef4444"},{key:"interrupted",color:"#8b5cf6"},{key:"completed",color:"#22c55e"}],rt={high:"#ef4444",medium:"#f59e0b",low:"#22c55e"};function bt(e){return e==="high"||e==="low"?e:"medium"}function Ct(e,i){let f=typeof e=="string"?new Date(e):e,a=new Date().getTime()-f.getTime(),k=Math.floor(a/1e3),o=Math.floor(k/60),r=Math.floor(o/60),l=Math.floor(r/24);return k<60?i("common.time.justNow"):o<60?i("common.time.minutesAgo",{count:o}):r<24?i("common.time.hoursAgo",{count:r}):l<30?i("common.time.daysAgo",{count:l}):f.toLocaleDateString(i.locale)}var Nt=q(({css:e,token:i})=>({container:e`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100%;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ia as de,J as ce,M as se,Za as ue,db as he,eb as Ae,xa as le}from"./embed-page-chunk-BANVRQT7.js";import{s as re,z as oe}from"./embed-page-chunk-37LGEEJU.js";import{a as ie}from"./embed-page-chunk-QV7QAJ4N.js";import{Fa as L,Ga as S,Ia as c,U as d,W as u,Z as F,ga as te,ma as ne,oa as h,xa as ae,za as C}from"./embed-page-chunk-4W34QOXT.js";import{a as Pe}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-EUOOO2LS.js";import{f as I}from"./embed-page-chunk-QBTAJ2YI.js";var a=I(Pe());var _=I(Ae());var t=I(ie());function f(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Ee(r){if(!f(r))return;let e=r.checkpoint;if(f(e)&&typeof e.checkpoint_id=="string")return e.checkpoint_id;let o=r.config;if(f(o)&&f(o.configurable)){let s=o.configurable.checkpoint_id;if(typeof s=="string")return s}}function ze(r){if(!f(r))return;if(typeof r.createdAt=="string")return r.createdAt;let e=r.checkpoint;if(f(e)&&typeof e.ts=="string")return e.ts}function He(r){switch(r){case"pending":return"blue";case"running":return"processing";case"success":return"green";case"error":case"failed":case"timeout":return"red";case"interrupted":return"orange";default:return}}function Fe(r){return r==="pending"||r==="running"}function Le(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(2)} MB`}var We=({data:r})=>{let e=re(),o=r?.threadId,s=r?.assistantId,l=oe(s||"__no_assistant__"),D=(0,a.useContext)(ue),{closeSideApp:pe}=he(),[m,ge]=(0,a.useState)(null),[T,ye]=(0,a.useState)(null),[fe,me]=(0,a.useState)([]),[Te,Me]=(0,a.useState)([]),[v,R]=(0,a.useState)(!0),[K,M]=(0,a.useState)(null),[Y,O]=(0,a.useState)(null),[p,J]=(0,a.useState)({}),[b,N]=(0,a.useState)(null),[xe,W]=(0,a.useState)(!1),[ke,B]=(0,a.useState)(""),[we,$]=(0,a.useState)(!1),[Ce,G]=(0,a.useState)(!1),[P,Ie]=(0,a.useState)(null),[U,V]=(0,a.useState)(!1),[A,j]=(0,a.useState)(5),E=(0,a.useRef)(0),x=(0,a.useRef)(0),g=(0,a.useCallback)(async()=>{if(!o||!s){R(!1);return}let n=++E.current;R(!0),J({});let[i,k,X,Z]=await Promise.allSettled([l.getThreadStatus(o),l.getThreadStorage(o),l.getThreadHistory(o,{limit:10}),l.runs.list(o,s)]);if(n!==E.current)return;let w={};i.status==="fulfilled"?ge(i.value):w.status=e("chat.threadMaintenance.statusLoadFailed"),k.status==="fulfilled"?ye(k.value):w.storage=e("chat.threadMaintenance.storageLoadFailed"),X.status==="fulfilled"?me(X.value.flatMap(H=>{let ee=Ee(H);return ee===void 0?[]:[{id:ee,createdAt:ze(H),raw:H}]})):w.history=e("chat.threadMaintenance.historyLoadFailed"),Z.status==="fulfilled"?Me(Z.value):w.runs=e("chat.threadMaintenance.runsLoadFailed"),J(w),R(!1)},[s,l,e,o]);(0,a.useEffect)(()=>(g(),()=>{E.current+=1}),[g]);let Se=async n=>{if(!o)return;let i=++x.current;W(!0),$(!0),B("");try{let k=await l.getThreadStateAtCheckpoint(o,n.id);i===x.current&&B(JSON.stringify(k,null,2))}catch{i===x.current&&B(e("chat.threadMaintenance.stateFailed"))}finally{i===x.current&&$(!1)}},ve=()=>{x.current+=1,W(!1)},Re=async()=>{if(o){G(!0),M(null);try{let n=await l.copyThread(o);Ie(n.id)}catch{M(e("chat.threadMaintenance.copyFailed"))}finally{G(!1)}}},q=async n=>{if(!o)return;V(!0),M(null);let i=Math.min(100,Math.max(1,Math.trunc(A)));j(i);try{if(!(await l.pruneThread(o,n==="delete"?{strategy:n}:{strategy:n,keep:i})).pruned){M(e("chat.threadMaintenance.pruneFailed"));return}if(n==="delete"){pe();return}await g()}catch{M(e("chat.threadMaintenance.pruneFailed"))}finally{V(!1)}},z=(0,a.useCallback)(async(n,i)=>{if(!(!o||!s)){N(n),O(null);try{await l.runs.cancel(o,n,{action:i},s),await g()}catch{O(e("chat.threadMaintenance.runCancelFailed"))}finally{N(null)}}},[s,l,g,e,o]),Q=m?.interrupts??[],be=(0,a.useMemo)(()=>[{title:e("chat.threadMaintenance.runStatus"),dataIndex:"status",render:n=>(0,t.jsx)(S,{color:He(n),children:n})},{title:e("chat.threadMaintenance.runId"),dataIndex:"runId",render:n=>(0,t.jsx)(c.Text,{code:!0,ellipsis:{tooltip:n},style:{maxWidth:180},children:n})},{title:e("chat.threadMaintenance.runCreated"),dataIndex:"createdAt",render:n=>(0,_.default)(n).format("YYYY-MM-DD HH:mm:ss")},{title:e("chat.threadMaintenance.runOwner"),key:"owner",render:(n,i)=>(0,t.jsxs)(h,{size:4,children:[(0,t.jsx)(c.Text,{children:i.owner??"\u2014"}),(0,t.jsx)(c.Text,{type:"secondary",children:"/"}),(0,t.jsx)(c.Text,{type:"secondary",children:i.attempts})]})},{key:"actions",render:(n,i)=>Fe(i.status)?(0,t.jsxs)(h,{size:4,children:[(0,t.jsx)(C,{title:e("chat.threadMaintenance.interruptRunConfirm"),okText:e("chat.threadMaintenance.interruptRun"),cancelText:e("common.cancel"),onConfirm:()=>void z(i.runId,"interrupt"),children:(0,t.jsx)(u,{size:"small",type:"link",loading:b===i.runId,children:e("chat.threadMaintenance.interruptRun")})}),(0,t.jsx)(C,{title:e("chat.threadMaintenance.rollbackRunConfirm"),okText:e("chat.threadMaintenance.rollbackRun"),cancelText:e("common.cancel"),onConfirm:()=>void z(i.runId,"rollback"),children:(0,t.jsx)(u,{size:"small",type:"link",danger:!0,loading:b===i.runId,children:e("chat.threadMaintenance.rollbackRun")})})]}):null}],[z,b,e]),Be=(0,a.useMemo)(()=>[{title:e("chat.threadMaintenance.checkpointId"),dataIndex:"id",render:n=>(0,t.jsx)(c.Text,{code:!0,children:n})},{title:e("chat.threadMaintenance.checkpointTime"),dataIndex:"createdAt",render:n=>n?(0,_.default)(n).format("YYYY-MM-DD HH:mm:ss"):e("chat.threadMaintenance.unknown")},{key:"actions",render:(n,i)=>(0,t.jsx)(u,{size:"small",type:"link",onClick:()=>void Se(i),children:e("chat.threadMaintenance.viewState")})}],[e]);return!o||!s?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:e("chat.threadMaintenance.missingContext")}):(0,t.jsxs)(te,{title:(0,t.jsxs)(h,{children:[(0,t.jsx)(se,{size:16}),e("chat.threadMaintenance.title")]}),extra:(0,t.jsxs)(h,{wrap:!0,children:[(0,t.jsx)(u,{icon:(0,t.jsx)(le,{size:14}),onClick:()=>void g(),loading:v,children:e("common.refresh")}),(0,t.jsx)(u,{icon:(0,t.jsx)(ce,{size:14}),loading:Ce,onClick:()=>void Re(),children:e("chat.threadMaintenance.copy")})]}),children:[(0,t.jsxs)(h,{direction:"vertical",size:14,style:{width:"100%"},children:[K?(0,t.jsx)(d,{type:"error",showIcon:!0,message:K}):null,p.status?(0,t.jsx)(d,{type:"error",showIcon:!0,message:p.status}):null,p.storage?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:p.storage}):null,p.history?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:p.history}):null,p.runs?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:p.runs}):null,P?(0,t.jsx)(d,{type:"success",showIcon:!0,message:e("chat.threadMaintenance.copySuccess",{id:P}),action:D?.selectThread?(0,t.jsx)(u,{size:"small",onClick:()=>D.selectThread(P),children:e("chat.threadMaintenance.switchToCopy")}):null}):null,(0,t.jsxs)(h,{wrap:!0,size:16,children:[(0,t.jsx)(y,{label:e("chat.threadMaintenance.status"),children:(0,t.jsx)(S,{color:m?.status==="idle"?"green":m?.status==="error"?"red":"blue",children:m?.status??e("chat.threadMaintenance.unknown")})}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.pendingMessages"),children:m?.pendingMessages??0}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.storage"),children:T?Le(T.totalBytes):e("chat.threadMaintenance.unknown")}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.checkpoints"),children:T?.checkpoints.count??0}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.channelValues"),children:T?.channelValues.count??0}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.pendingWrites"),children:T?.pendingWrites.count??0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{strong:!0,children:e("chat.threadMaintenance.interrupts")}),(0,t.jsx)("div",{style:{marginTop:6},children:Q.length===0?(0,t.jsx)(c.Text,{type:"secondary",children:e("chat.threadMaintenance.noInterrupts")}):(0,t.jsx)(h,{wrap:!0,children:Q.map(n=>(0,t.jsxs)(S,{color:"orange",children:[n.type,": ",n.interruptId]},n.interruptId))})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{strong:!0,children:e("chat.threadMaintenance.runs")}),Y?(0,t.jsx)(d,{type:"error",showIcon:!0,message:Y,style:{marginTop:6}}):null,(0,t.jsx)(L,{rowKey:"runId",size:"small",columns:be,dataSource:Te,pagination:!1,loading:v,locale:{emptyText:(0,t.jsx)(F,{description:e("chat.threadMaintenance.noRuns")})}})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{strong:!0,children:e("chat.threadMaintenance.history")}),(0,t.jsx)(L,{rowKey:"id",size:"small",columns:Be,dataSource:fe,pagination:!1,loading:v,locale:{emptyText:(0,t.jsx)(F,{description:e("chat.threadMaintenance.noHistory")})}})]}),(0,t.jsxs)(h,{wrap:!0,children:[(0,t.jsx)(C,{title:e("chat.threadMaintenance.pruneDeleteTitle"),description:e("chat.threadMaintenance.pruneDeleteConfirm"),okText:e("common.delete"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onConfirm:()=>void q("delete"),children:(0,t.jsx)(u,{danger:!0,icon:(0,t.jsx)(de,{size:14}),loading:U,children:e("chat.threadMaintenance.pruneDelete")})}),(0,t.jsx)(ne,{"aria-label":e("chat.threadMaintenance.keepLabel"),min:1,max:100,precision:0,step:1,value:A,onChange:n=>{j(typeof n=="number"?Math.min(100,Math.max(1,Math.trunc(n))):1)}}),(0,t.jsx)(C,{title:e("chat.threadMaintenance.pruneKeepTitle"),description:e("chat.threadMaintenance.pruneKeepConfirm",{count:A}),okText:e("chat.threadMaintenance.pruneKeepLatest"),cancelText:e("common.cancel"),onConfirm:()=>void q("keep_latest"),children:(0,t.jsx)(u,{loading:U,children:e("chat.threadMaintenance.pruneKeepLatest")})})]})]}),(0,t.jsx)(ae,{open:xe,title:e("chat.threadMaintenance.stateTitle"),footer:null,onCancel:ve,width:720,children:we?(0,t.jsx)(c.Text,{children:e("chat.threadMaintenance.loadingState")}):(0,t.jsx)("pre",{style:{maxHeight:"60vh",overflow:"auto",margin:0},children:ke})})]})},y=({label:r,children:e})=>(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{type:"secondary",style:{display:"block",fontSize:12},children:r}),(0,t.jsx)(c.Text,{strong:!0,children:e})]});export{We as ThreadMaintenancePanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ue,c as fe}from"./embed-page-chunk-
|
|
1
|
+
import{a as ue,c as fe}from"./embed-page-chunk-FEMHLB6I.js";import{a as xe}from"./embed-page-chunk-NFMLKSPM.js";import{a as ie,b as G,e as V,f as U,g as re,h as se,i as ae,k as le,l as de,m as ce,n as pe}from"./embed-page-chunk-S2KVN3RB.js";import"./embed-page-chunk-S4XZPBRM.js";import{j as O}from"./embed-page-chunk-N66H4DNH.js";import{D as $,La as ne,j as te,ja as H,x as L,z as oe}from"./embed-page-chunk-BANVRQT7.js";import{a as j}from"./embed-page-chunk-436REIWY.js";import{s as N}from"./embed-page-chunk-37LGEEJU.js";import{a as D}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-SRMYHWL3.js";import{Da as X,Ga as I,Ia as q,Z as P,aa as B,na as J,oa as F,pb as Q,ua as M,va as K,wc as ee,za as Z}from"./embed-page-chunk-4W34QOXT.js";import{a as Y}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as T}from"./embed-page-chunk-QBTAJ2YI.js";var s=T(Y());var _=T(xe());var ge=T(Y());var ye=T(D()),me=({steps:t,graphDefinition:o,assistantId:r})=>{let n=(0,ge.useMemo)(()=>fe(o),[o]);return(0,ye.jsx)(ue,{dsl:n,steps:t,assistantId:r})};var e=T(D()),ve=`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
from { transform: rotate(0deg); }
|
|
4
4
|
to { transform: rotate(360deg); }
|