local-operator-ui 0.31.4 → 0.31.6
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/out/main/index.js +306 -9
- package/out/renderer/assets/{_basePickBy-BvA0R9aO.js → _basePickBy-CGLVGNHn.js} +1 -1
- package/out/renderer/assets/{_baseUniq-CuCBbqlv.js → _baseUniq-6RtLbuuN.js} +1 -1
- package/out/renderer/assets/agent-details-page-Dq1-pmjJ.js +6 -0
- package/out/renderer/assets/agent-hub-page-DDslXUso.js +6 -0
- package/out/renderer/assets/agents-page-Cn5t3IkR.js +2 -0
- package/out/renderer/assets/arc-CqB6YrvF.js +1 -0
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-BuJFZzQV.js → architectureDiagram-IEHRJDOE-BsWj-SB2.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-1Js6oRtL.js → blockDiagram-JOT3LUYC-DjuQQrO2.js} +1 -1
- package/out/renderer/assets/{book-open-CscvRSv1.js → book-open-DI1UBxnn.js} +1 -1
- package/out/renderer/assets/browser-page-C8W7mUVJ.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-D8ZUsOEd.js → browser-webauthn-prompt-CpHuczqZ.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-DaEBw_bt.js → c4Diagram-VJAJSXHY-DfqMyqGt.js} +1 -1
- package/out/renderer/assets/channel-DG4irCIe.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-BlsCa7mN.js → chunk-4BMEZGHF-B7fJK-xk.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-PHONBXFa.js → chunk-A2AXSNBT-CYCL2Vnh.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-hI_3yxaw.js → chunk-AEK57VVT-07JQHm7w.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-B_zdD5n2.js → chunk-D6G4REZN-Dk1JIt6P.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-h1quHfAq.js → chunk-RZ5BOZE2-BLq7IQcw.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-CZJGNYTU.js → chunk-XZIHB7SX-sn_IP0cx.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-Bn3g2tY9.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-Bn3g2tY9.js +1 -0
- package/out/renderer/assets/clone-hlCMGtcg.js +1 -0
- package/out/renderer/assets/{console-mirror-xI4NiEdB.js → console-mirror-CpiNswSB.js} +11 -11
- package/out/renderer/assets/{consoleCapture-DwEjUp-u.js → consoleCapture-Dawe559T.js} +1 -1
- package/out/renderer/assets/{dagre-OKDRZEBW-Bs5WW3I0.js → dagre-OKDRZEBW-BH1-vZrD.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-CUSMuwUT.js → diagram-SSKATNLV-BB2zhdj2.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-CvtogGAv.js → diagram-VNBRO52H-DoIDnsFj.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-BcrJnVyh.js → erDiagram-Q7BY3M3F-CFI6DH5z.js} +1 -1
- package/out/renderer/assets/{error-boundary-Cq8l_9ne.js → error-boundary-DtDjc7C4.js} +2 -2
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-Ck6R8XQ5.js → flowDiagram-4HSFHLVR-R35rZly5.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-BzXTlyRq.js → ganttDiagram-APWFNJXF-BwH-YH2d.js} +4 -4
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-BggsYkwd.js → gitGraphDiagram-7IBYFJ6S-B9Ij_MPV.js} +1 -1
- package/out/renderer/assets/{graph-D4DvEzHi.js → graph-B6vab2kN.js} +1 -1
- package/out/renderer/assets/{index--uvFZXvg.js → index-30UPLouO.js} +1 -1
- package/out/renderer/assets/index-CBxomwo0.js +7 -0
- package/out/renderer/assets/{index-Bqow9yvu.js → index-gd7H8-q6.js} +402 -392
- package/out/renderer/assets/index-rZRMapOd.css +1 -0
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-B7YsyJrm.js → infoDiagram-PH2N3AL5-BoFC5xGX.js} +1 -1
- package/out/renderer/assets/{installer-CDhZJagu.js → installer-DrfIP-VV.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-CeAOs0Tr.js → journeyDiagram-U35MCT3I-D8hZEZM9.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-CbHPFYHw.js → kanban-definition-NDS4AKOZ-CfK7CfsY.js} +1 -1
- package/out/renderer/assets/{layout-B82PXyIO.js → layout-9INEUX4j.js} +1 -1
- package/out/renderer/assets/legacy-agents-page-DYFr_Ms9.js +38 -0
- package/out/renderer/assets/{mermaid.core-eaHWSi6d.js → mermaid.core-J-3igmgd.js} +19 -19
- package/out/renderer/assets/mesh-page-BR-tHXFg.js +1 -0
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BXVWlQix.js → mindmap-definition-ALO5MXBD-BiJ-Ieo8.js} +1 -1
- package/out/renderer/assets/org-surface-gate-Dvz4sPXB.js +1 -0
- package/out/renderer/assets/{page-header-CQXWBlNb.js → page-header-B9QalVj7.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-BNLDxb4-.js → pieDiagram-IB7DONF6-Cjt4ER3c.js} +1 -1
- package/out/renderer/assets/projects-page-CMQ2URwK.js +11 -0
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DTgxLJRn.js → quadrantDiagram-7GDLP6J5--_022w7n.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-CyaNGDPi.js → radar-MK3ICKWK-m7dr7eu0.js} +1 -1
- package/out/renderer/assets/radient-auth-buttons-BCb9PgbG.js +1 -0
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-BFsG7B_F.js → requirementDiagram-KVF5MWMF-BAi8whQW.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-CI8vU4w6.js → sankeyDiagram-QLVOVGJD-BuunvXYL.js} +1 -1
- package/out/renderer/assets/{schedules-page-xvskvLwZ.js → schedules-page-fhJg4v1A.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-Bb1WLeft.js → sequenceDiagram-X6HHIX6F-DROalkBZ.js} +1 -1
- package/out/renderer/assets/{settings-page-fOcSNsvW.js → settings-page-UoDbqEse.js} +9 -9
- package/out/renderer/assets/settings-section-BTFkBz1F.js +6 -0
- package/out/renderer/assets/{stateDiagram-DGXRK772-ClaeI48Z.js → stateDiagram-DGXRK772-I2ycj_Cg.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Bt6AfJJN.js +1 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-Jpk9IHr4.js → timeline-definition-BDJGKUSR-CXcA6v6z.js} +1 -1
- package/out/renderer/assets/use-download-agent-mutation-wvsX88DW.js +61 -0
- package/out/renderer/assets/use-memberships-query-7cBHUXI2.js +1 -0
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-Bpj5DeLB.js → xychartDiagram-VJFVF3MP-TPcfOSE-.js} +3 -3
- package/out/renderer/console-capture.html +4 -4
- package/out/renderer/index.html +5 -5
- package/out/renderer/installer.html +4 -4
- package/package.json +2 -2
- package/out/renderer/assets/agent-details-page-D-PbMYqp.js +0 -6
- package/out/renderer/assets/agent-hub-page-dUpTBcnT.js +0 -6
- package/out/renderer/assets/agents-page-CjKR_4Ls.js +0 -2
- package/out/renderer/assets/arc-DyLGZMVy.js +0 -1
- package/out/renderer/assets/browser-page-DCFiVVI6.js +0 -1
- package/out/renderer/assets/channel-Dq9UBstL.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BENj_anP.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BENj_anP.js +0 -1
- package/out/renderer/assets/clone-iiTkr306.js +0 -1
- package/out/renderer/assets/compact-pagination-ChkpTfbr.js +0 -1
- package/out/renderer/assets/index-CC_zZpXH.js +0 -7
- package/out/renderer/assets/index-DC7Ouhg5.css +0 -1
- package/out/renderer/assets/legacy-agents-page-C1Vlqr8r.js +0 -38
- package/out/renderer/assets/publication-validation-DpSnrP1l.js +0 -1
- package/out/renderer/assets/radient-auth-buttons-DNX48s8x.js +0 -6
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-C72wRPYs.js +0 -1
- package/out/renderer/assets/use-download-agent-mutation-Cw6gpKru.js +0 -61
- /package/out/renderer/assets/{index-VaCWHEAZ.js → index-CSEVqIl1.js} +0 -0
package/out/main/index.js
CHANGED
|
@@ -234,7 +234,19 @@ const publicationDocument = zod.z.object({
|
|
|
234
234
|
const catalogueScopeKind = zod.z.enum(["team", "agent"]);
|
|
235
235
|
const catalogueScopeName = zod.z.string().min(1).max(64);
|
|
236
236
|
const catalogueCursor = zod.z.string().min(1).max(256);
|
|
237
|
-
const
|
|
237
|
+
const PROJECT_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
238
|
+
const projectName = zod.z.string().regex(PROJECT_NAME_PATTERN, {
|
|
239
|
+
message: "Letters, digits, dot, underscore and dash; no spaces."
|
|
240
|
+
});
|
|
241
|
+
const PROJECT_STATUSES = ["active", "paused", "done", "archived"];
|
|
242
|
+
const projectStatus = zod.z.enum(PROJECT_STATUSES);
|
|
243
|
+
const projectDate = zod.z.string().regex(/^$|^\d{4}-\d{2}-\d{2}$/, "Dates are YYYY-MM-DD, or empty to clear.");
|
|
244
|
+
const projectTags = zod.z.array(zod.z.string().min(1).max(24)).max(8);
|
|
245
|
+
const projectKey = zod.z.string().min(1).max(64);
|
|
246
|
+
const PROJECT_PROGRESS_MAX_CHARS = 1e3;
|
|
247
|
+
const PROJECT_DESCRIPTION_MAX_CHARS = 240;
|
|
248
|
+
const PROJECT_MILESTONE_NAME_MAX_CHARS = 80;
|
|
249
|
+
const desktopRequestUnion = zod.z.discriminatedUnion("op", [
|
|
238
250
|
zod.z.object({ op: zod.z.literal("capabilities") }).strict(),
|
|
239
251
|
zod.z.object({ op: zod.z.literal("profiles.list") }).strict(),
|
|
240
252
|
zod.z.object({ op: zod.z.literal("profiles.get"), name: profileName }).strict(),
|
|
@@ -783,7 +795,29 @@ const desktopRequestSchema = zod.z.discriminatedUnion("op", [
|
|
|
783
795
|
zod.z.object({
|
|
784
796
|
op: zod.z.literal("agent.publish"),
|
|
785
797
|
agentId: id$1,
|
|
786
|
-
document: publicationDocument.optional()
|
|
798
|
+
document: publicationDocument.optional(),
|
|
799
|
+
/*
|
|
800
|
+
* The publication TARGET (§4.4/§4.7). Both travel together or neither does,
|
|
801
|
+
* and the rule is a `superRefine` on the whole UNION (below) rather than a
|
|
802
|
+
* `.refine` here — a refined member becomes a `ZodEffects`, which cannot be a
|
|
803
|
+
* member of a discriminated union; measured, it does not compile.
|
|
804
|
+
*
|
|
805
|
+
* WHY THE COMMENT CHANGED (security review round 1, S-1). It used to say a
|
|
806
|
+
* half-specified target was "refused there rather than silently published to
|
|
807
|
+
* the public hub". The local server's route does refuse one, but
|
|
808
|
+
* `desktopEndpoint` dropped an unpaired half before the request was composed,
|
|
809
|
+
* so what reached the server was indistinguishable from a deliberate public
|
|
810
|
+
* publication: the documented guarantee held at neither boundary, and it
|
|
811
|
+
* failed OPEN on a privacy-relevant target. Measured at the previous head:
|
|
812
|
+
* each half parsed on its own and `desktopEndpoint({visibility: "org"})`
|
|
813
|
+
* composed a plain `/publish` with no query at all.
|
|
814
|
+
*
|
|
815
|
+
* Absent means the public hub, which is exactly what every caller did before
|
|
816
|
+
* this field existed — so the rule is "one half is an error", not "absent is
|
|
817
|
+
* an error".
|
|
818
|
+
*/
|
|
819
|
+
visibility: zod.z.literal("org").optional(),
|
|
820
|
+
tenantId: id$1.optional()
|
|
787
821
|
}).strict(),
|
|
788
822
|
zod.z.object({
|
|
789
823
|
op: zod.z.literal("agent.republish"),
|
|
@@ -793,7 +827,35 @@ const desktopRequestSchema = zod.z.discriminatedUnion("op", [
|
|
|
793
827
|
// republish that did not name one would have to guess which public row to
|
|
794
828
|
// overwrite — and guessing here overwrites somebody's listing.
|
|
795
829
|
hubAgentId: id$1,
|
|
796
|
-
document: publicationDocument.optional()
|
|
830
|
+
document: publicationDocument.optional(),
|
|
831
|
+
/** The publication target, on the same terms as `agent.publish` above. */
|
|
832
|
+
visibility: zod.z.literal("org").optional(),
|
|
833
|
+
tenantId: id$1.optional()
|
|
834
|
+
}).strict(),
|
|
835
|
+
/*
|
|
836
|
+
* Pulling a published organization team into this machine's local registry
|
|
837
|
+
* (§4.5/§8.4's "list + pull action").
|
|
838
|
+
*
|
|
839
|
+
* The id is the HUB document's id, not a local row's: the pull addresses what
|
|
840
|
+
* was published, and the local copy gets its own fresh id (the local server's
|
|
841
|
+
* `GET /v1/teams/pull/{team_id}` reconstructs it, renaming on a local id
|
|
842
|
+
* clash through the registry's own convention). `tenantId` is OPTIONAL and is
|
|
843
|
+
* the caller's statement of which organization owns the document, not part of
|
|
844
|
+
* the address: §4.5's pull path is org-agnostic by id, the local server
|
|
845
|
+
* verifies the claim and refuses a document owned by another tenant, and the
|
|
846
|
+
* credential that reads it is the one the local server already holds.
|
|
847
|
+
*/
|
|
848
|
+
zod.z.object({
|
|
849
|
+
op: zod.z.literal("team.pull"),
|
|
850
|
+
teamId: id$1,
|
|
851
|
+
/*
|
|
852
|
+
* The caller's statement of which organization owns the document. The local
|
|
853
|
+
* server verifies it and refuses a document owned by another tenant rather
|
|
854
|
+
* than storing it under the wrong expectation, so sending it is a stronger
|
|
855
|
+
* read where the caller knows the org — and omitting it is still legal
|
|
856
|
+
* (§4.5's pull path is org-agnostic by id).
|
|
857
|
+
*/
|
|
858
|
+
tenantId: id$1.optional()
|
|
797
859
|
}).strict(),
|
|
798
860
|
zod.z.object({
|
|
799
861
|
op: zod.z.literal("agent.nameAvailability"),
|
|
@@ -1256,13 +1318,25 @@ const desktopRequestSchema = zod.z.discriminatedUnion("op", [
|
|
|
1256
1318
|
"comments.create",
|
|
1257
1319
|
"comments.update",
|
|
1258
1320
|
"comments.delete",
|
|
1259
|
-
"account.agents"
|
|
1321
|
+
"account.agents",
|
|
1322
|
+
/*
|
|
1323
|
+
* The organization operations (design §4.7). They are named here as well as
|
|
1324
|
+
* in `shared/api/radient/proxy.ts` because this schema is what validates the
|
|
1325
|
+
* request the renderer actually sends: an op in one list and not the other
|
|
1326
|
+
* is a request that never leaves the renderer. `team_id` is the published
|
|
1327
|
+
* team document an `org_team.get` pull names.
|
|
1328
|
+
*/
|
|
1329
|
+
"memberships.list",
|
|
1330
|
+
"org_agents.list",
|
|
1331
|
+
"org_team.get",
|
|
1332
|
+
"org_teams.list"
|
|
1260
1333
|
]),
|
|
1261
1334
|
request_id: requestId.optional(),
|
|
1262
1335
|
tenant_id: id$1.optional(),
|
|
1263
1336
|
account_id: id$1.optional(),
|
|
1264
1337
|
agent_id: id$1.optional(),
|
|
1265
1338
|
comment_id: id$1.optional(),
|
|
1339
|
+
team_id: id$1.optional(),
|
|
1266
1340
|
query: zod.z.record(zod.z.union([zod.z.string().max(1024), zod.z.number().int()])).optional(),
|
|
1267
1341
|
payload: zod.z.record(zod.z.unknown()).optional(),
|
|
1268
1342
|
confirmed: zod.z.boolean().optional()
|
|
@@ -1301,8 +1375,112 @@ const desktopRequestSchema = zod.z.discriminatedUnion("op", [
|
|
|
1301
1375
|
op: zod.z.literal("credentials.update"),
|
|
1302
1376
|
key: settingKey,
|
|
1303
1377
|
value: secret
|
|
1378
|
+
}).strict(),
|
|
1379
|
+
/*
|
|
1380
|
+
* THE MESH READS (`features.peers`).
|
|
1381
|
+
*
|
|
1382
|
+
* Both reach a peer only THROUGH this app's one backend: the renderer never dials
|
|
1383
|
+
* a peer, never learns an address to dial and holds no mesh credential, because a
|
|
1384
|
+
* UI that could would have to re-implement the relay's authorisation model in
|
|
1385
|
+
* JavaScript.
|
|
1386
|
+
*
|
|
1387
|
+
* THE MUTATING MESH OPS ARE NOT HERE YET, deliberately: slice 1 of the Mesh tab is
|
|
1388
|
+
* a read surface, and a request schema entry with no caller is a capability this
|
|
1389
|
+
* app advertises but cannot exercise. `networks.invite`,
|
|
1390
|
+
* `networks.member.remove` and `sessions.transfer` land with the surfaces that use
|
|
1391
|
+
* them (the invite action, the member table, the drag layer).
|
|
1392
|
+
*/
|
|
1393
|
+
zod.z.object({ op: zod.z.literal("peers.list") }).strict(),
|
|
1394
|
+
zod.z.object({ op: zod.z.literal("networks.list") }).strict(),
|
|
1395
|
+
/*
|
|
1396
|
+
* The Projects surface (`/v1/desktop/projects*`), APPENDED to the union
|
|
1397
|
+
* rather than inserted beside the other catalogue ops: the backend serves
|
|
1398
|
+
* these routes from its own release, and an older daemon that has never
|
|
1399
|
+
* heard of the op is a backend this app must be able to gate against —
|
|
1400
|
+
* which it does through the `projects` capability key, not through this
|
|
1401
|
+
* schema (a request this client refuses to build is not a negotiation).
|
|
1402
|
+
*
|
|
1403
|
+
* One op per route; the wipe and the milestone routes are the two shapes
|
|
1404
|
+
* that do not fit the plain CRUD, and both exist because the backend
|
|
1405
|
+
* declared them separately (a milestone is add-or-update-by-name, and a
|
|
1406
|
+
* removal is a DELETE with the name in the path). `projects.update` carries
|
|
1407
|
+
* its editable fields as a NESTED `fields` object for the same reason the
|
|
1408
|
+
* profile ops do: the fields differ per surface, and a flat op would put
|
|
1409
|
+
* every future field at the top level of a union member.
|
|
1410
|
+
*/
|
|
1411
|
+
zod.z.object({ op: zod.z.literal("projects.list") }).strict(),
|
|
1412
|
+
zod.z.object({ op: zod.z.literal("projects.get"), key: projectKey }).strict(),
|
|
1413
|
+
zod.z.object({
|
|
1414
|
+
op: zod.z.literal("projects.create"),
|
|
1415
|
+
name: projectName,
|
|
1416
|
+
description: zod.z.string().max(PROJECT_DESCRIPTION_MAX_CHARS).optional(),
|
|
1417
|
+
status: projectStatus.optional(),
|
|
1418
|
+
tags: projectTags.optional()
|
|
1419
|
+
}).strict(),
|
|
1420
|
+
zod.z.object({
|
|
1421
|
+
op: zod.z.literal("projects.update"),
|
|
1422
|
+
key: projectKey,
|
|
1423
|
+
/*
|
|
1424
|
+
* Only the keys the caller includes travel; an omitted key leaves the
|
|
1425
|
+
* field alone, and `""` clears a date or the progress snippet (the
|
|
1426
|
+
* route forwards `model_fields_set`, and this client mirrors it).
|
|
1427
|
+
*/
|
|
1428
|
+
fields: zod.z.object({
|
|
1429
|
+
name: projectName.optional(),
|
|
1430
|
+
description: zod.z.string().max(PROJECT_DESCRIPTION_MAX_CHARS).optional(),
|
|
1431
|
+
status: projectStatus.optional(),
|
|
1432
|
+
progress: zod.z.string().max(PROJECT_PROGRESS_MAX_CHARS).optional(),
|
|
1433
|
+
tags: projectTags.optional(),
|
|
1434
|
+
start_date: projectDate.optional(),
|
|
1435
|
+
target_date: projectDate.optional(),
|
|
1436
|
+
completed_at: projectDate.optional(),
|
|
1437
|
+
estimate: zod.z.number().positive().max(1e3).optional(),
|
|
1438
|
+
estimate_unit: zod.z.enum(["points", "days"]).optional()
|
|
1439
|
+
}).strict()
|
|
1440
|
+
}).strict(),
|
|
1441
|
+
zod.z.object({
|
|
1442
|
+
op: zod.z.literal("projects.delete"),
|
|
1443
|
+
key: projectKey,
|
|
1444
|
+
confirmed_name: projectName
|
|
1445
|
+
}).strict(),
|
|
1446
|
+
zod.z.object({
|
|
1447
|
+
op: zod.z.literal("projects.link"),
|
|
1448
|
+
key: projectKey,
|
|
1449
|
+
sessionId
|
|
1450
|
+
}).strict(),
|
|
1451
|
+
zod.z.object({
|
|
1452
|
+
op: zod.z.literal("projects.unlink"),
|
|
1453
|
+
key: projectKey,
|
|
1454
|
+
sessionId
|
|
1455
|
+
}).strict(),
|
|
1456
|
+
zod.z.object({
|
|
1457
|
+
op: zod.z.literal("projects.milestone"),
|
|
1458
|
+
key: projectKey,
|
|
1459
|
+
name: zod.z.string().min(1).max(PROJECT_MILESTONE_NAME_MAX_CHARS),
|
|
1460
|
+
/** `""` clears it; omitted leaves it alone. */
|
|
1461
|
+
targetDate: projectDate.optional(),
|
|
1462
|
+
/** `true` stamps today, `false` clears; omitted leaves it alone. */
|
|
1463
|
+
completed: zod.z.boolean().optional()
|
|
1464
|
+
}).strict(),
|
|
1465
|
+
zod.z.object({
|
|
1466
|
+
op: zod.z.literal("projects.milestone.remove"),
|
|
1467
|
+
key: projectKey,
|
|
1468
|
+
name: zod.z.string().min(1).max(PROJECT_MILESTONE_NAME_MAX_CHARS)
|
|
1304
1469
|
}).strict()
|
|
1305
1470
|
]);
|
|
1471
|
+
const desktopRequestSchema = desktopRequestUnion.superRefine(
|
|
1472
|
+
(request, ctx) => {
|
|
1473
|
+
if (request.op !== "agent.publish" && request.op !== "agent.republish") {
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
if (Boolean(request.visibility === "org") !== Boolean(request.tenantId)) {
|
|
1477
|
+
ctx.addIssue({
|
|
1478
|
+
code: zod.z.ZodIssueCode.custom,
|
|
1479
|
+
message: 'A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.'
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
);
|
|
1306
1484
|
const DESKTOP_REFUSAL_CODE = {
|
|
1307
1485
|
/**
|
|
1308
1486
|
* This app holds no token for the daemon it can see, so main refused to send
|
|
@@ -1381,9 +1559,14 @@ const LEDGER_READ_OPS = /* @__PURE__ */ new Set([
|
|
|
1381
1559
|
"sessions.report"
|
|
1382
1560
|
]);
|
|
1383
1561
|
const PROVIDER_READ_OPS = /* @__PURE__ */ new Set(["usage.get"]);
|
|
1562
|
+
const MESH_READ_OPS = /* @__PURE__ */ new Set([
|
|
1563
|
+
"networks.list",
|
|
1564
|
+
"peers.list"
|
|
1565
|
+
]);
|
|
1384
1566
|
const LONG_READ_OPS = /* @__PURE__ */ new Set([
|
|
1385
1567
|
...LEDGER_READ_OPS,
|
|
1386
|
-
...PROVIDER_READ_OPS
|
|
1568
|
+
...PROVIDER_READ_OPS,
|
|
1569
|
+
...MESH_READ_OPS
|
|
1387
1570
|
]);
|
|
1388
1571
|
function desktopRequestDeadlineMs(op) {
|
|
1389
1572
|
return LONG_READ_OPS.has(op) ? DESKTOP_LONG_READ_DEADLINE_MS : DESKTOP_CONTROL_DEADLINE_MS;
|
|
@@ -1414,6 +1597,8 @@ const READ_ONLY_OPS = /* @__PURE__ */ new Set([
|
|
|
1414
1597
|
"mcp.catalog",
|
|
1415
1598
|
"mcp.list",
|
|
1416
1599
|
"models.catalogue",
|
|
1600
|
+
"networks.list",
|
|
1601
|
+
"peers.list",
|
|
1417
1602
|
"profiles.get",
|
|
1418
1603
|
"profiles.list",
|
|
1419
1604
|
"providers.list",
|
|
@@ -1435,6 +1620,8 @@ const READ_ONLY_OPS = /* @__PURE__ */ new Set([
|
|
|
1435
1620
|
const PANEL_READ_OPS = /* @__PURE__ */ new Set([
|
|
1436
1621
|
"analytics.get",
|
|
1437
1622
|
"analytics.models",
|
|
1623
|
+
"networks.list",
|
|
1624
|
+
"peers.list",
|
|
1438
1625
|
"usage.get",
|
|
1439
1626
|
"sessions.report",
|
|
1440
1627
|
"info.get",
|
|
@@ -1481,10 +1668,27 @@ function wakeTiming(request) {
|
|
|
1481
1668
|
...request.limit !== void 0 ? { limit: request.limit } : {}
|
|
1482
1669
|
};
|
|
1483
1670
|
}
|
|
1671
|
+
function assertPairedPublicationTarget(request) {
|
|
1672
|
+
if (Boolean(request.visibility === "org") !== Boolean(request.tenantId)) {
|
|
1673
|
+
throw new Error(
|
|
1674
|
+
'A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.'
|
|
1675
|
+
);
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1484
1678
|
function desktopEndpoint(request) {
|
|
1485
1679
|
switch (request.op) {
|
|
1486
1680
|
case "capabilities":
|
|
1487
1681
|
return { path: "/v1/capabilities", method: "GET" };
|
|
1682
|
+
/*
|
|
1683
|
+
* The mesh reads. Both are plain GETs with no parameters at all - the backend
|
|
1684
|
+
* reads THIS device's own relay, so there is nothing for the client to scope it
|
|
1685
|
+
* by, and a network NAME would be the wrong thing to send anyway (a device in
|
|
1686
|
+
* two networks asks once and gets both).
|
|
1687
|
+
*/
|
|
1688
|
+
case "peers.list":
|
|
1689
|
+
return { path: "/v1/desktop/peers", method: "GET" };
|
|
1690
|
+
case "networks.list":
|
|
1691
|
+
return { path: "/v1/desktop/networks", method: "GET" };
|
|
1488
1692
|
case "profiles.list":
|
|
1489
1693
|
return { path: "/v1/desktop/profiles", method: "GET" };
|
|
1490
1694
|
case "profiles.get":
|
|
@@ -1815,9 +2019,16 @@ function desktopEndpoint(request) {
|
|
|
1815
2019
|
};
|
|
1816
2020
|
case "legacy.agent.upload":
|
|
1817
2021
|
return { path: `/v1/agents/${request.agentId}/upload`, method: "POST" };
|
|
1818
|
-
case "agent.publish":
|
|
2022
|
+
case "agent.publish": {
|
|
2023
|
+
assertPairedPublicationTarget(request);
|
|
2024
|
+
const query = new URLSearchParams();
|
|
2025
|
+
if (request.visibility === "org" && request.tenantId) {
|
|
2026
|
+
query.set("visibility", "org");
|
|
2027
|
+
query.set("tenant_id", request.tenantId);
|
|
2028
|
+
}
|
|
2029
|
+
const search = query.toString();
|
|
1819
2030
|
return {
|
|
1820
|
-
path: `/v1/agents/${request.agentId}/publish`,
|
|
2031
|
+
path: `/v1/agents/${request.agentId}/publish${search ? `?${search}` : ""}`,
|
|
1821
2032
|
method: "POST",
|
|
1822
2033
|
// The route's own body shape: a partial override of the document the
|
|
1823
2034
|
// backend builds from the local row. `{}` rather than `undefined` when
|
|
@@ -1826,15 +2037,33 @@ function desktopEndpoint(request) {
|
|
|
1826
2037
|
// answer 422.
|
|
1827
2038
|
body: { document: request.document ?? {} }
|
|
1828
2039
|
};
|
|
1829
|
-
|
|
2040
|
+
}
|
|
2041
|
+
case "agent.republish": {
|
|
2042
|
+
assertPairedPublicationTarget(request);
|
|
2043
|
+
const query = new URLSearchParams();
|
|
2044
|
+
if (request.visibility === "org" && request.tenantId) {
|
|
2045
|
+
query.set("visibility", "org");
|
|
2046
|
+
query.set("tenant_id", request.tenantId);
|
|
2047
|
+
}
|
|
2048
|
+
const search = query.toString();
|
|
1830
2049
|
return {
|
|
1831
|
-
path: `/v1/agents/${request.agentId}/publish`,
|
|
2050
|
+
path: `/v1/agents/${request.agentId}/publish${search ? `?${search}` : ""}`,
|
|
1832
2051
|
method: "PUT",
|
|
1833
2052
|
body: {
|
|
1834
2053
|
hub_agent_id: request.hubAgentId,
|
|
1835
2054
|
document: request.document ?? {}
|
|
1836
2055
|
}
|
|
1837
2056
|
};
|
|
2057
|
+
}
|
|
2058
|
+
case "team.pull": {
|
|
2059
|
+
const query = new URLSearchParams();
|
|
2060
|
+
if (request.tenantId) query.set("tenant_id", request.tenantId);
|
|
2061
|
+
const search = query.toString();
|
|
2062
|
+
return {
|
|
2063
|
+
path: `/v1/teams/pull/${request.teamId}${search ? `?${search}` : ""}`,
|
|
2064
|
+
method: "GET"
|
|
2065
|
+
};
|
|
2066
|
+
}
|
|
1838
2067
|
case "agent.nameAvailability": {
|
|
1839
2068
|
const query = new URLSearchParams({ name: request.name });
|
|
1840
2069
|
return { path: `/v1/agent-name-availability?${query}`, method: "GET" };
|
|
@@ -2229,6 +2458,74 @@ function desktopEndpoint(request) {
|
|
|
2229
2458
|
method: "PATCH",
|
|
2230
2459
|
body: { key: request.key, value: request.value }
|
|
2231
2460
|
};
|
|
2461
|
+
/*
|
|
2462
|
+
* The Projects routes, in the store's own wire vocabulary: snake_case
|
|
2463
|
+
* bodies, the typed NAME in `confirm` for the delete (the route compares
|
|
2464
|
+
* it case-insensitively against the row it resolved), and every key
|
|
2465
|
+
* URL-encoded because it is user text — a project name may carry dots
|
|
2466
|
+
* and dashes, and a milestone name is free text up to 80 chars.
|
|
2467
|
+
*/
|
|
2468
|
+
case "projects.list":
|
|
2469
|
+
return { path: "/v1/desktop/projects", method: "GET" };
|
|
2470
|
+
case "projects.get":
|
|
2471
|
+
return {
|
|
2472
|
+
path: `/v1/desktop/projects/${encodeURIComponent(request.key)}`,
|
|
2473
|
+
method: "GET"
|
|
2474
|
+
};
|
|
2475
|
+
case "projects.create":
|
|
2476
|
+
return {
|
|
2477
|
+
path: "/v1/desktop/projects",
|
|
2478
|
+
method: "POST",
|
|
2479
|
+
// Absent fields are OMITTED: the route's own defaults are the
|
|
2480
|
+
// answer for "no status, no tags, no description".
|
|
2481
|
+
body: {
|
|
2482
|
+
name: request.name,
|
|
2483
|
+
...request.description !== void 0 ? { description: request.description } : {},
|
|
2484
|
+
...request.status !== void 0 ? { status: request.status } : {},
|
|
2485
|
+
...request.tags !== void 0 ? { tags: request.tags } : {}
|
|
2486
|
+
}
|
|
2487
|
+
};
|
|
2488
|
+
case "projects.update":
|
|
2489
|
+
return {
|
|
2490
|
+
path: `/v1/desktop/projects/${encodeURIComponent(request.key)}`,
|
|
2491
|
+
method: "PATCH",
|
|
2492
|
+
// Exactly the keys the caller included travel, so an omitted key
|
|
2493
|
+
// leaves its field alone and `""` clears a date (the route
|
|
2494
|
+
// forwards `model_fields_set` into the store's edit model).
|
|
2495
|
+
body: { ...request.fields }
|
|
2496
|
+
};
|
|
2497
|
+
case "projects.delete":
|
|
2498
|
+
return {
|
|
2499
|
+
path: `/v1/desktop/projects/${encodeURIComponent(request.key)}`,
|
|
2500
|
+
method: "DELETE",
|
|
2501
|
+
body: { confirm: request.confirmed_name }
|
|
2502
|
+
};
|
|
2503
|
+
case "projects.link":
|
|
2504
|
+
return {
|
|
2505
|
+
path: `/v1/desktop/projects/${encodeURIComponent(request.key)}/links`,
|
|
2506
|
+
method: "POST",
|
|
2507
|
+
body: { session_id: request.sessionId }
|
|
2508
|
+
};
|
|
2509
|
+
case "projects.unlink":
|
|
2510
|
+
return {
|
|
2511
|
+
path: `/v1/desktop/projects/${encodeURIComponent(request.key)}/links/${encodeURIComponent(request.sessionId)}`,
|
|
2512
|
+
method: "DELETE"
|
|
2513
|
+
};
|
|
2514
|
+
case "projects.milestone":
|
|
2515
|
+
return {
|
|
2516
|
+
path: `/v1/desktop/projects/${encodeURIComponent(request.key)}/milestones`,
|
|
2517
|
+
method: "POST",
|
|
2518
|
+
body: {
|
|
2519
|
+
name: request.name,
|
|
2520
|
+
...request.targetDate !== void 0 ? { target_date: request.targetDate } : {},
|
|
2521
|
+
...request.completed !== void 0 ? { completed: request.completed } : {}
|
|
2522
|
+
}
|
|
2523
|
+
};
|
|
2524
|
+
case "projects.milestone.remove":
|
|
2525
|
+
return {
|
|
2526
|
+
path: `/v1/desktop/projects/${encodeURIComponent(request.key)}/milestones/${encodeURIComponent(request.name)}`,
|
|
2527
|
+
method: "DELETE"
|
|
2528
|
+
};
|
|
2232
2529
|
}
|
|
2233
2530
|
}
|
|
2234
2531
|
const MAX_PROBE_PATHS = 64;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as o,c as b,g as v,k as O,h as P,j as p,l as w,m as A,n as x,t as c,o as N}from"./_baseUniq-
|
|
1
|
+
import{e as o,c as b,g as v,k as O,h as P,j as p,l as w,m as A,n as x,t as c,o as N}from"./_baseUniq-6RtLbuuN.js";import{as as g,aa as y,at as E,au as F,av as M,aw as I,ax as _,ay as $,az as B,aA as T}from"./mermaid.core-J-3igmgd.js";var S=/\s/;function z(n){for(var r=n.length;r--&&S.test(n.charAt(r)););return r}var G=/^\s+/;function H(n){return n&&n.slice(0,z(n)+1).replace(G,"")}var m=NaN,L=/^[-+]0x[0-9a-f]+$/i,R=/^0b[01]+$/i,q=/^0o[0-7]+$/i,C=parseInt;function K(n){if(typeof n=="number")return n;if(o(n))return m;if(g(n)){var r=typeof n.valueOf=="function"?n.valueOf():n;n=g(r)?r+"":r}if(typeof n!="string")return n===0?n:+n;n=H(n);var t=R.test(n);return t||q.test(n)?C(n.slice(2),t?2:8):L.test(n)?m:+n}var W=1/0,X=17976931348623157e292;function Y(n){if(!n)return n===0?n:0;if(n=K(n),n===W||n===-1/0){var r=n<0?-1:1;return r*X}return n===n?n:0}function D(n){var r=Y(n),t=r%1;return r===r?t?r-t:r:0}function fn(n){var r=n==null?0:n.length;return r?b(n):[]}var l=Object.prototype,J=l.hasOwnProperty,dn=y(function(n,r){n=Object(n);var t=-1,e=r.length,a=e>2?r[2]:void 0;for(a&&E(r[0],r[1],a)&&(e=1);++t<e;)for(var f=r[t],i=F(f),s=-1,d=i.length;++s<d;){var u=i[s],h=n[u];(h===void 0||M(h,l[u])&&!J.call(n,u))&&(n[u]=f[u])}return n});function un(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}function Q(n){return function(r,t,e){var a=Object(r);if(!I(r)){var f=v(t);r=O(r),t=function(s){return f(a[s],s,a)}}var i=n(r,t,e);return i>-1?a[f?r[i]:i]:void 0}}var U=Math.max;function Z(n,r,t){var e=n==null?0:n.length;if(!e)return-1;var a=t==null?0:D(t);return a<0&&(a=U(e+a,0)),P(n,v(r),a)}var hn=Q(Z);function V(n,r){var t=-1,e=I(n)?Array(n.length):[];return p(n,function(a,f,i){e[++t]=r(a,f,i)}),e}function gn(n,r){var t=_(n)?w:V;return t(n,v(r))}var j=Object.prototype,k=j.hasOwnProperty;function nn(n,r){return n!=null&&k.call(n,r)}function vn(n,r){return n!=null&&A(n,r,nn)}function rn(n,r){return n<r}function tn(n,r,t){for(var e=-1,a=n.length;++e<a;){var f=n[e],i=r(f);if(i!=null&&(s===void 0?i===i&&!o(i):t(i,s)))var s=i,d=f}return d}function mn(n){return n&&n.length?tn(n,$,rn):void 0}function an(n,r,t,e){if(!g(n))return n;r=x(r,n);for(var a=-1,f=r.length,i=f-1,s=n;s!=null&&++a<f;){var d=c(r[a]),u=t;if(d==="__proto__"||d==="constructor"||d==="prototype")return n;if(a!=i){var h=s[d];u=void 0,u===void 0&&(u=g(h)?h:B(r[a+1])?[]:{})}T(s,d,u),s=s[d]}return n}function on(n,r,t){for(var e=-1,a=r.length,f={};++e<a;){var i=r[e],s=N(n,i);t(s,i)&&an(f,x(i,n),s)}return f}export{rn as a,tn as b,V as c,on as d,mn as e,fn as f,hn as g,vn as h,dn as i,D as j,un as l,gn as m,Y as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aH as S,aI as Rn,ax as T,aJ as w,aK as xn,aL as Mn,aw as sn,aM as mn,aN as un,aO as x,au as U,aP as Cn,aQ as on,aR as Fn,aS as E,aF as gn,aT as R,as as ln,aU as Dn,aV as D,aW as Gn,aX as Un,aY as _,aA as Nn,aZ as Bn,av as Kn,a_ as X,a$ as Hn,b0 as jn,az as Yn,ay as cn,aD as Zn,b1 as m}from"./mermaid.core-eaHWSi6d.js";var qn="[object Symbol]";function N(n){return typeof n=="symbol"||S(n)&&Rn(n)==qn}function dn(n,r){for(var e=-1,t=n==null?0:n.length,a=Array(t);++e<t;)a[e]=r(n[e],e,n);return a}var J=w?w.prototype:void 0,Q=J?J.toString:void 0;function pn(n){if(typeof n=="string")return n;if(T(n))return dn(n,pn)+"";if(N(n))return Q?Q.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function Xn(){}function An(n,r){for(var e=-1,t=n==null?0:n.length;++e<t&&r(n[e],e,n)!==!1;);return n}function Jn(n,r,e,t){for(var a=n.length,i=e+-1;++i<a;)if(r(n[i],i,n))return i;return-1}function Qn(n){return n!==n}function Wn(n,r,e){for(var t=e-1,a=n.length;++t<a;)if(n[t]===r)return t;return-1}function zn(n,r,e){return r===r?Wn(n,r,e):Jn(n,Qn,e)}function Vn(n,r){var e=n==null?0:n.length;return!!e&&zn(n,r,0)>-1}function $(n){return sn(n)?xn(n):Mn(n)}var kn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nr=/^\w*$/;function B(n,r){if(T(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||N(n)?!0:nr.test(n)||!kn.test(n)||r!=null&&n in Object(r)}var rr=500;function er(n){var r=mn(n,function(t){return e.size===rr&&e.clear(),t}),e=r.cache;return r}var tr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ir=/\\(\\)?/g,ar=er(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(tr,function(e,t,a,i){r.push(a?i.replace(ir,"$1"):t||e)}),r});function fr(n){return n==null?"":pn(n)}function yn(n,r){return T(n)?n:B(n,r)?[n]:ar(fr(n))}function M(n){if(typeof n=="string"||N(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function bn(n,r){r=yn(r,n);for(var e=0,t=r.length;n!=null&&e<t;)n=n[M(r[e++])];return e&&e==t?n:void 0}function sr(n,r,e){var t=n==null?void 0:bn(n,r);return t===void 0?e:t}function K(n,r){for(var e=-1,t=r.length,a=n.length;++e<t;)n[a+e]=r[e];return n}var W=w?w.isConcatSpreadable:void 0;function ur(n){return T(n)||un(n)||!!(W&&n&&n[W])}function Ot(n,r,e,t,a){var i=-1,f=n.length;for(e||(e=ur),a||(a=[]);++i<f;){var s=n[i];e(s)?K(a,s):t||(a[a.length]=s)}return a}function or(n,r,e,t){var a=-1,i=n==null?0:n.length;for(t&&i&&(e=n[++a]);++a<i;)e=r(e,n[a],a,n);return e}function gr(n,r){return n&&x(r,$(r),n)}function lr(n,r){return n&&x(r,U(r),n)}function Tn(n,r){for(var e=-1,t=n==null?0:n.length,a=0,i=[];++e<t;){var f=n[e];r(f,e,n)&&(i[a++]=f)}return i}function hn(){return[]}var cr=Object.prototype,dr=cr.propertyIsEnumerable,z=Object.getOwnPropertySymbols,H=z?function(n){return n==null?[]:(n=Object(n),Tn(z(n),function(r){return dr.call(n,r)}))}:hn;function pr(n,r){return x(n,H(n),r)}var Ar=Object.getOwnPropertySymbols,wn=Ar?function(n){for(var r=[];n;)K(r,H(n)),n=Cn(n);return r}:hn;function yr(n,r){return x(n,wn(n),r)}function On(n,r,e){var t=r(n);return T(n)?t:K(t,e(n))}function G(n){return On(n,$,H)}function br(n){return On(n,U,wn)}var Tr=Object.prototype,hr=Tr.hasOwnProperty;function wr(n){var r=n.length,e=new n.constructor(r);return r&&typeof n[0]=="string"&&hr.call(n,"index")&&(e.index=n.index,e.input=n.input),e}function Or(n,r){var e=r?on(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}var $r=/\w*$/;function _r(n){var r=new n.constructor(n.source,$r.exec(n));return r.lastIndex=n.lastIndex,r}var V=w?w.prototype:void 0,k=V?V.valueOf:void 0;function Sr(n){return k?Object(k.call(n)):{}}var Er="[object Boolean]",Ir="[object Date]",Pr="[object Map]",vr="[object Number]",Lr="[object RegExp]",Rr="[object Set]",xr="[object String]",Mr="[object Symbol]",mr="[object ArrayBuffer]",Cr="[object DataView]",Fr="[object Float32Array]",Dr="[object Float64Array]",Gr="[object Int8Array]",Ur="[object Int16Array]",Nr="[object Int32Array]",Br="[object Uint8Array]",Kr="[object Uint8ClampedArray]",Hr="[object Uint16Array]",jr="[object Uint32Array]";function Yr(n,r,e){var t=n.constructor;switch(r){case mr:return on(n);case Er:case Ir:return new t(+n);case Cr:return Or(n,e);case Fr:case Dr:case Gr:case Ur:case Nr:case Br:case Kr:case Hr:case jr:return Fn(n,e);case Pr:return new t;case vr:case xr:return new t(n);case Lr:return _r(n);case Rr:return new t;case Mr:return Sr(n)}}var Zr="[object Map]";function qr(n){return S(n)&&E(n)==Zr}var nn=R&&R.isMap,Xr=nn?gn(nn):qr,Jr="[object Set]";function Qr(n){return S(n)&&E(n)==Jr}var rn=R&&R.isSet,Wr=rn?gn(rn):Qr,zr=1,Vr=2,kr=4,$n="[object Arguments]",ne="[object Array]",re="[object Boolean]",ee="[object Date]",te="[object Error]",_n="[object Function]",ie="[object GeneratorFunction]",ae="[object Map]",fe="[object Number]",Sn="[object Object]",se="[object RegExp]",ue="[object Set]",oe="[object String]",ge="[object Symbol]",le="[object WeakMap]",ce="[object ArrayBuffer]",de="[object DataView]",pe="[object Float32Array]",Ae="[object Float64Array]",ye="[object Int8Array]",be="[object Int16Array]",Te="[object Int32Array]",he="[object Uint8Array]",we="[object Uint8ClampedArray]",Oe="[object Uint16Array]",$e="[object Uint32Array]",g={};g[$n]=g[ne]=g[ce]=g[de]=g[re]=g[ee]=g[pe]=g[Ae]=g[ye]=g[be]=g[Te]=g[ae]=g[fe]=g[Sn]=g[se]=g[ue]=g[oe]=g[ge]=g[he]=g[we]=g[Oe]=g[$e]=!0;g[te]=g[_n]=g[le]=!1;function C(n,r,e,t,a,i){var f,s=r&zr,u=r&Vr,d=r&kr;if(f!==void 0)return f;if(!ln(n))return n;var l=T(n);if(l){if(f=wr(n),!s)return Dn(n,f)}else{var o=E(n),c=o==_n||o==ie;if(D(n))return Gn(n,s);if(o==Sn||o==$n||c&&!a){if(f=u||c?{}:Un(n),!s)return u?yr(n,lr(f,n)):pr(n,gr(f,n))}else{if(!g[o])return a?n:{};f=Yr(n,o,s)}}i||(i=new _);var h=i.get(n);if(h)return h;i.set(n,f),Wr(n)?n.forEach(function(p){f.add(C(p,r,e,p,n,i))}):Xr(n)&&n.forEach(function(p,A){f.set(A,C(p,r,e,A,n,i))});var y=d?u?br:G:u?U:$,b=l?void 0:y(n);return An(b||n,function(p,A){b&&(A=p,p=n[A]),Nn(f,A,C(p,r,e,A,n,i))}),f}var _e="__lodash_hash_undefined__";function Se(n){return this.__data__.set(n,_e),this}function Ee(n){return this.__data__.has(n)}function I(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new Bn;++r<e;)this.add(n[r])}I.prototype.add=I.prototype.push=Se;I.prototype.has=Ee;function Ie(n,r){for(var e=-1,t=n==null?0:n.length;++e<t;)if(r(n[e],e,n))return!0;return!1}function En(n,r){return n.has(r)}var Pe=1,ve=2;function In(n,r,e,t,a,i){var f=e&Pe,s=n.length,u=r.length;if(s!=u&&!(f&&u>s))return!1;var d=i.get(n),l=i.get(r);if(d&&l)return d==r&&l==n;var o=-1,c=!0,h=e&ve?new I:void 0;for(i.set(n,r),i.set(r,n);++o<s;){var y=n[o],b=r[o];if(t)var p=f?t(b,y,o,r,n,i):t(y,b,o,n,r,i);if(p!==void 0){if(p)continue;c=!1;break}if(h){if(!Ie(r,function(A,O){if(!En(h,O)&&(y===A||a(y,A,e,t,i)))return h.push(O)})){c=!1;break}}else if(!(y===b||a(y,b,e,t,i))){c=!1;break}}return i.delete(n),i.delete(r),c}function Le(n){var r=-1,e=Array(n.size);return n.forEach(function(t,a){e[++r]=[a,t]}),e}function j(n){var r=-1,e=Array(n.size);return n.forEach(function(t){e[++r]=t}),e}var Re=1,xe=2,Me="[object Boolean]",me="[object Date]",Ce="[object Error]",Fe="[object Map]",De="[object Number]",Ge="[object RegExp]",Ue="[object Set]",Ne="[object String]",Be="[object Symbol]",Ke="[object ArrayBuffer]",He="[object DataView]",en=w?w.prototype:void 0,F=en?en.valueOf:void 0;function je(n,r,e,t,a,i,f){switch(e){case He:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case Ke:return!(n.byteLength!=r.byteLength||!i(new X(n),new X(r)));case Me:case me:case De:return Kn(+n,+r);case Ce:return n.name==r.name&&n.message==r.message;case Ge:case Ne:return n==r+"";case Fe:var s=Le;case Ue:var u=tℜif(s||(s=j),n.size!=r.size&&!u)return!1;var d=f.get(n);if(d)return d==r;t|=xe,f.set(n,r);var l=In(s(n),s(r),t,a,i,f);return f.delete(n),l;case Be:if(F)return F.call(n)==F.call(r)}return!1}var Ye=1,Ze=Object.prototype,qe=Ze.hasOwnProperty;function Xe(n,r,e,t,a,i){var f=e&Ye,s=G(n),u=s.length,d=G(r),l=d.length;if(u!=l&&!f)return!1;for(var o=u;o--;){var c=s[o];if(!(f?c in r:qe.call(r,c)))return!1}var h=i.get(n),y=i.get(r);if(h&&y)return h==r&&y==n;var b=!0;i.set(n,r),i.set(r,n);for(var p=f;++o<u;){c=s[o];var A=n[c],O=r[c];if(t)var q=f?t(O,A,c,r,n,i):t(A,O,c,n,r,i);if(!(q===void 0?A===O||a(A,O,e,t,i):q)){b=!1;break}p||(p=c=="constructor")}if(b&&!p){var P=n.constructor,v=r.constructor;P!=v&&"constructor"in n&&"constructor"in r&&!(typeof P=="function"&&P instanceof P&&typeof v=="function"&&v instanceof v)&&(b=!1)}return i.delete(n),i.delete(r),b}var Je=1,tn="[object Arguments]",an="[object Array]",L="[object Object]",Qe=Object.prototype,fn=Qe.hasOwnProperty;function We(n,r,e,t,a,i){var f=T(n),s=T(r),u=f?an:E(n),d=s?an:E(r);u=u==tn?L:u,d=d==tn?L:d;var l=u==L,o=d==L,c=u==d;if(c&&D(n)){if(!D(r))return!1;f=!0,l=!1}if(c&&!l)return i||(i=new _),f||Hn(n)?In(n,r,e,t,a,i):je(n,r,u,e,t,a,i);if(!(e&Je)){var h=l&&fn.call(n,"__wrapped__"),y=o&&fn.call(r,"__wrapped__");if(h||y){var b=h?n.value():n,p=y?r.value():r;return i||(i=new _),a(b,p,e,t,i)}}return c?(i||(i=new _),Xe(n,r,e,t,a,i)):!1}function Y(n,r,e,t,a){return n===r?!0:n==null||r==null||!S(n)&&!S(r)?n!==n&&r!==r:We(n,r,e,t,Y,a)}var ze=1,Ve=2;function ke(n,r,e,t){var a=e.length,i=a;if(n==null)return!i;for(n=Object(n);a--;){var f=e[a];if(f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++a<i;){f=e[a];var s=f[0],u=n[s],d=f[1];if(f[2]){if(u===void 0&&!(s in n))return!1}else{var l=new _,o;if(!(o===void 0?Y(d,u,ze|Ve,t,l):o))return!1}}return!0}function Pn(n){return n===n&&!ln(n)}function nt(n){for(var r=$(n),e=r.length;e--;){var t=r[e],a=n[t];r[e]=[t,a,Pn(a)]}return r}function vn(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function rt(n){var r=nt(n);return r.length==1&&r[0][2]?vn(r[0][0],r[0][1]):function(e){return e===n||ke(e,n,r)}}function et(n,r){return n!=null&&r in Object(n)}function tt(n,r,e){r=yn(r,n);for(var t=-1,a=r.length,i=!1;++t<a;){var f=M(r[t]);if(!(i=n!=null&&e(n,f)))break;n=n[f]}return i||++t!=a?i:(a=n==null?0:n.length,!!a&&jn(a)&&Yn(f,a)&&(T(n)||un(n)))}function it(n,r){return n!=null&&tt(n,r,et)}var at=1,ft=2;function st(n,r){return B(n)&&Pn(r)?vn(M(n),r):function(e){var t=sr(e,n);return t===void 0&&t===r?it(e,n):Y(r,t,at|ft)}}function ut(n){return function(r){return r?.[n]}}function ot(n){return function(r){return bn(r,n)}}function gt(n){return B(n)?ut(M(n)):ot(n)}function Ln(n){return typeof n=="function"?n:n==null?cn:typeof n=="object"?T(n)?st(n[0],n[1]):rt(n):gt(n)}function lt(n,r){return n&&Zn(n,r,$)}function ct(n,r){return function(e,t){if(e==null)return e;if(!sn(e))return n(e,t);for(var a=e.length,i=-1,f=Object(e);++i<a&&t(f[i],i,f)!==!1;);return e}}var Z=ct(lt);function dt(n){return typeof n=="function"?n:cn}function $t(n,r){var e=T(n)?An:Z;return e(n,dt(r))}function pt(n,r){var e=[];return Z(n,function(t,a,i){r(t,a,i)&&e.push(t)}),e}function _t(n,r){var e=T(n)?Tn:pt;return e(n,Ln(r))}function At(n,r){return dn(r,function(e){return n[e]})}function St(n){return n==null?[]:At(n,$(n))}function Et(n){return n===void 0}function yt(n,r,e,t,a){return a(n,function(i,f,s){e=t?(t=!1,i):r(e,i,f,s)}),e}function It(n,r,e){var t=T(n)?or:yt,a=arguments.length<3;return t(n,Ln(r),e,a,Z)}var bt=1/0,Tt=m&&1/j(new m([,-0]))[1]==bt?function(n){return new m(n)}:Xn,ht=200;function Pt(n,r,e){var t=-1,a=Vn,i=n.length,f=!0,s=[],u=s;if(i>=ht){var d=r?null:Tt(n);if(d)return j(d);f=!1,a=En,u=new I}else u=r?[]:s;n:for(;++t<i;){var l=n[t],o=r?r(l):l;if(l=l!==0?l:0,f&&o===o){for(var c=u.length;c--;)if(u[c]===o)continue n;r&&u.push(o),s.push(l)}else a(u,o,e)||(u!==s&&u.push(o),s.push(l))}return s}export{Tn as A,pt as B,Ie as C,Xn as D,I as S,Pt as a,C as b,Ot as c,$t as d,N as e,_t as f,Ln as g,Jn as h,Et as i,Z as j,$ as k,dn as l,tt as m,yn as n,bn as o,dt as p,lt as q,It as r,it as s,M as t,fr as u,St as v,Vn as w,En as x,zn as y,br as z};
|
|
1
|
+
import{aH as S,aI as Rn,ax as T,aJ as w,aK as xn,aL as Mn,aw as sn,aM as mn,aN as un,aO as x,au as U,aP as Cn,aQ as on,aR as Fn,aS as E,aF as gn,aT as R,as as ln,aU as Dn,aV as D,aW as Gn,aX as Un,aY as _,aA as Nn,aZ as Bn,av as Kn,a_ as X,a$ as Hn,b0 as jn,az as Yn,ay as cn,aD as Zn,b1 as m}from"./mermaid.core-J-3igmgd.js";var qn="[object Symbol]";function N(n){return typeof n=="symbol"||S(n)&&Rn(n)==qn}function dn(n,r){for(var e=-1,t=n==null?0:n.length,a=Array(t);++e<t;)a[e]=r(n[e],e,n);return a}var J=w?w.prototype:void 0,Q=J?J.toString:void 0;function pn(n){if(typeof n=="string")return n;if(T(n))return dn(n,pn)+"";if(N(n))return Q?Q.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function Xn(){}function An(n,r){for(var e=-1,t=n==null?0:n.length;++e<t&&r(n[e],e,n)!==!1;);return n}function Jn(n,r,e,t){for(var a=n.length,i=e+-1;++i<a;)if(r(n[i],i,n))return i;return-1}function Qn(n){return n!==n}function Wn(n,r,e){for(var t=e-1,a=n.length;++t<a;)if(n[t]===r)return t;return-1}function zn(n,r,e){return r===r?Wn(n,r,e):Jn(n,Qn,e)}function Vn(n,r){var e=n==null?0:n.length;return!!e&&zn(n,r,0)>-1}function $(n){return sn(n)?xn(n):Mn(n)}var kn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nr=/^\w*$/;function B(n,r){if(T(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||N(n)?!0:nr.test(n)||!kn.test(n)||r!=null&&n in Object(r)}var rr=500;function er(n){var r=mn(n,function(t){return e.size===rr&&e.clear(),t}),e=r.cache;return r}var tr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ir=/\\(\\)?/g,ar=er(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(tr,function(e,t,a,i){r.push(a?i.replace(ir,"$1"):t||e)}),r});function fr(n){return n==null?"":pn(n)}function yn(n,r){return T(n)?n:B(n,r)?[n]:ar(fr(n))}function M(n){if(typeof n=="string"||N(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function bn(n,r){r=yn(r,n);for(var e=0,t=r.length;n!=null&&e<t;)n=n[M(r[e++])];return e&&e==t?n:void 0}function sr(n,r,e){var t=n==null?void 0:bn(n,r);return t===void 0?e:t}function K(n,r){for(var e=-1,t=r.length,a=n.length;++e<t;)n[a+e]=r[e];return n}var W=w?w.isConcatSpreadable:void 0;function ur(n){return T(n)||un(n)||!!(W&&n&&n[W])}function Ot(n,r,e,t,a){var i=-1,f=n.length;for(e||(e=ur),a||(a=[]);++i<f;){var s=n[i];e(s)?K(a,s):t||(a[a.length]=s)}return a}function or(n,r,e,t){var a=-1,i=n==null?0:n.length;for(t&&i&&(e=n[++a]);++a<i;)e=r(e,n[a],a,n);return e}function gr(n,r){return n&&x(r,$(r),n)}function lr(n,r){return n&&x(r,U(r),n)}function Tn(n,r){for(var e=-1,t=n==null?0:n.length,a=0,i=[];++e<t;){var f=n[e];r(f,e,n)&&(i[a++]=f)}return i}function hn(){return[]}var cr=Object.prototype,dr=cr.propertyIsEnumerable,z=Object.getOwnPropertySymbols,H=z?function(n){return n==null?[]:(n=Object(n),Tn(z(n),function(r){return dr.call(n,r)}))}:hn;function pr(n,r){return x(n,H(n),r)}var Ar=Object.getOwnPropertySymbols,wn=Ar?function(n){for(var r=[];n;)K(r,H(n)),n=Cn(n);return r}:hn;function yr(n,r){return x(n,wn(n),r)}function On(n,r,e){var t=r(n);return T(n)?t:K(t,e(n))}function G(n){return On(n,$,H)}function br(n){return On(n,U,wn)}var Tr=Object.prototype,hr=Tr.hasOwnProperty;function wr(n){var r=n.length,e=new n.constructor(r);return r&&typeof n[0]=="string"&&hr.call(n,"index")&&(e.index=n.index,e.input=n.input),e}function Or(n,r){var e=r?on(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}var $r=/\w*$/;function _r(n){var r=new n.constructor(n.source,$r.exec(n));return r.lastIndex=n.lastIndex,r}var V=w?w.prototype:void 0,k=V?V.valueOf:void 0;function Sr(n){return k?Object(k.call(n)):{}}var Er="[object Boolean]",Ir="[object Date]",Pr="[object Map]",vr="[object Number]",Lr="[object RegExp]",Rr="[object Set]",xr="[object String]",Mr="[object Symbol]",mr="[object ArrayBuffer]",Cr="[object DataView]",Fr="[object Float32Array]",Dr="[object Float64Array]",Gr="[object Int8Array]",Ur="[object Int16Array]",Nr="[object Int32Array]",Br="[object Uint8Array]",Kr="[object Uint8ClampedArray]",Hr="[object Uint16Array]",jr="[object Uint32Array]";function Yr(n,r,e){var t=n.constructor;switch(r){case mr:return on(n);case Er:case Ir:return new t(+n);case Cr:return Or(n,e);case Fr:case Dr:case Gr:case Ur:case Nr:case Br:case Kr:case Hr:case jr:return Fn(n,e);case Pr:return new t;case vr:case xr:return new t(n);case Lr:return _r(n);case Rr:return new t;case Mr:return Sr(n)}}var Zr="[object Map]";function qr(n){return S(n)&&E(n)==Zr}var nn=R&&R.isMap,Xr=nn?gn(nn):qr,Jr="[object Set]";function Qr(n){return S(n)&&E(n)==Jr}var rn=R&&R.isSet,Wr=rn?gn(rn):Qr,zr=1,Vr=2,kr=4,$n="[object Arguments]",ne="[object Array]",re="[object Boolean]",ee="[object Date]",te="[object Error]",_n="[object Function]",ie="[object GeneratorFunction]",ae="[object Map]",fe="[object Number]",Sn="[object Object]",se="[object RegExp]",ue="[object Set]",oe="[object String]",ge="[object Symbol]",le="[object WeakMap]",ce="[object ArrayBuffer]",de="[object DataView]",pe="[object Float32Array]",Ae="[object Float64Array]",ye="[object Int8Array]",be="[object Int16Array]",Te="[object Int32Array]",he="[object Uint8Array]",we="[object Uint8ClampedArray]",Oe="[object Uint16Array]",$e="[object Uint32Array]",g={};g[$n]=g[ne]=g[ce]=g[de]=g[re]=g[ee]=g[pe]=g[Ae]=g[ye]=g[be]=g[Te]=g[ae]=g[fe]=g[Sn]=g[se]=g[ue]=g[oe]=g[ge]=g[he]=g[we]=g[Oe]=g[$e]=!0;g[te]=g[_n]=g[le]=!1;function C(n,r,e,t,a,i){var f,s=r&zr,u=r&Vr,d=r&kr;if(f!==void 0)return f;if(!ln(n))return n;var l=T(n);if(l){if(f=wr(n),!s)return Dn(n,f)}else{var o=E(n),c=o==_n||o==ie;if(D(n))return Gn(n,s);if(o==Sn||o==$n||c&&!a){if(f=u||c?{}:Un(n),!s)return u?yr(n,lr(f,n)):pr(n,gr(f,n))}else{if(!g[o])return a?n:{};f=Yr(n,o,s)}}i||(i=new _);var h=i.get(n);if(h)return h;i.set(n,f),Wr(n)?n.forEach(function(p){f.add(C(p,r,e,p,n,i))}):Xr(n)&&n.forEach(function(p,A){f.set(A,C(p,r,e,A,n,i))});var y=d?u?br:G:u?U:$,b=l?void 0:y(n);return An(b||n,function(p,A){b&&(A=p,p=n[A]),Nn(f,A,C(p,r,e,A,n,i))}),f}var _e="__lodash_hash_undefined__";function Se(n){return this.__data__.set(n,_e),this}function Ee(n){return this.__data__.has(n)}function I(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new Bn;++r<e;)this.add(n[r])}I.prototype.add=I.prototype.push=Se;I.prototype.has=Ee;function Ie(n,r){for(var e=-1,t=n==null?0:n.length;++e<t;)if(r(n[e],e,n))return!0;return!1}function En(n,r){return n.has(r)}var Pe=1,ve=2;function In(n,r,e,t,a,i){var f=e&Pe,s=n.length,u=r.length;if(s!=u&&!(f&&u>s))return!1;var d=i.get(n),l=i.get(r);if(d&&l)return d==r&&l==n;var o=-1,c=!0,h=e&ve?new I:void 0;for(i.set(n,r),i.set(r,n);++o<s;){var y=n[o],b=r[o];if(t)var p=f?t(b,y,o,r,n,i):t(y,b,o,n,r,i);if(p!==void 0){if(p)continue;c=!1;break}if(h){if(!Ie(r,function(A,O){if(!En(h,O)&&(y===A||a(y,A,e,t,i)))return h.push(O)})){c=!1;break}}else if(!(y===b||a(y,b,e,t,i))){c=!1;break}}return i.delete(n),i.delete(r),c}function Le(n){var r=-1,e=Array(n.size);return n.forEach(function(t,a){e[++r]=[a,t]}),e}function j(n){var r=-1,e=Array(n.size);return n.forEach(function(t){e[++r]=t}),e}var Re=1,xe=2,Me="[object Boolean]",me="[object Date]",Ce="[object Error]",Fe="[object Map]",De="[object Number]",Ge="[object RegExp]",Ue="[object Set]",Ne="[object String]",Be="[object Symbol]",Ke="[object ArrayBuffer]",He="[object DataView]",en=w?w.prototype:void 0,F=en?en.valueOf:void 0;function je(n,r,e,t,a,i,f){switch(e){case He:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case Ke:return!(n.byteLength!=r.byteLength||!i(new X(n),new X(r)));case Me:case me:case De:return Kn(+n,+r);case Ce:return n.name==r.name&&n.message==r.message;case Ge:case Ne:return n==r+"";case Fe:var s=Le;case Ue:var u=tℜif(s||(s=j),n.size!=r.size&&!u)return!1;var d=f.get(n);if(d)return d==r;t|=xe,f.set(n,r);var l=In(s(n),s(r),t,a,i,f);return f.delete(n),l;case Be:if(F)return F.call(n)==F.call(r)}return!1}var Ye=1,Ze=Object.prototype,qe=Ze.hasOwnProperty;function Xe(n,r,e,t,a,i){var f=e&Ye,s=G(n),u=s.length,d=G(r),l=d.length;if(u!=l&&!f)return!1;for(var o=u;o--;){var c=s[o];if(!(f?c in r:qe.call(r,c)))return!1}var h=i.get(n),y=i.get(r);if(h&&y)return h==r&&y==n;var b=!0;i.set(n,r),i.set(r,n);for(var p=f;++o<u;){c=s[o];var A=n[c],O=r[c];if(t)var q=f?t(O,A,c,r,n,i):t(A,O,c,n,r,i);if(!(q===void 0?A===O||a(A,O,e,t,i):q)){b=!1;break}p||(p=c=="constructor")}if(b&&!p){var P=n.constructor,v=r.constructor;P!=v&&"constructor"in n&&"constructor"in r&&!(typeof P=="function"&&P instanceof P&&typeof v=="function"&&v instanceof v)&&(b=!1)}return i.delete(n),i.delete(r),b}var Je=1,tn="[object Arguments]",an="[object Array]",L="[object Object]",Qe=Object.prototype,fn=Qe.hasOwnProperty;function We(n,r,e,t,a,i){var f=T(n),s=T(r),u=f?an:E(n),d=s?an:E(r);u=u==tn?L:u,d=d==tn?L:d;var l=u==L,o=d==L,c=u==d;if(c&&D(n)){if(!D(r))return!1;f=!0,l=!1}if(c&&!l)return i||(i=new _),f||Hn(n)?In(n,r,e,t,a,i):je(n,r,u,e,t,a,i);if(!(e&Je)){var h=l&&fn.call(n,"__wrapped__"),y=o&&fn.call(r,"__wrapped__");if(h||y){var b=h?n.value():n,p=y?r.value():r;return i||(i=new _),a(b,p,e,t,i)}}return c?(i||(i=new _),Xe(n,r,e,t,a,i)):!1}function Y(n,r,e,t,a){return n===r?!0:n==null||r==null||!S(n)&&!S(r)?n!==n&&r!==r:We(n,r,e,t,Y,a)}var ze=1,Ve=2;function ke(n,r,e,t){var a=e.length,i=a;if(n==null)return!i;for(n=Object(n);a--;){var f=e[a];if(f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++a<i;){f=e[a];var s=f[0],u=n[s],d=f[1];if(f[2]){if(u===void 0&&!(s in n))return!1}else{var l=new _,o;if(!(o===void 0?Y(d,u,ze|Ve,t,l):o))return!1}}return!0}function Pn(n){return n===n&&!ln(n)}function nt(n){for(var r=$(n),e=r.length;e--;){var t=r[e],a=n[t];r[e]=[t,a,Pn(a)]}return r}function vn(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function rt(n){var r=nt(n);return r.length==1&&r[0][2]?vn(r[0][0],r[0][1]):function(e){return e===n||ke(e,n,r)}}function et(n,r){return n!=null&&r in Object(n)}function tt(n,r,e){r=yn(r,n);for(var t=-1,a=r.length,i=!1;++t<a;){var f=M(r[t]);if(!(i=n!=null&&e(n,f)))break;n=n[f]}return i||++t!=a?i:(a=n==null?0:n.length,!!a&&jn(a)&&Yn(f,a)&&(T(n)||un(n)))}function it(n,r){return n!=null&&tt(n,r,et)}var at=1,ft=2;function st(n,r){return B(n)&&Pn(r)?vn(M(n),r):function(e){var t=sr(e,n);return t===void 0&&t===r?it(e,n):Y(r,t,at|ft)}}function ut(n){return function(r){return r?.[n]}}function ot(n){return function(r){return bn(r,n)}}function gt(n){return B(n)?ut(M(n)):ot(n)}function Ln(n){return typeof n=="function"?n:n==null?cn:typeof n=="object"?T(n)?st(n[0],n[1]):rt(n):gt(n)}function lt(n,r){return n&&Zn(n,r,$)}function ct(n,r){return function(e,t){if(e==null)return e;if(!sn(e))return n(e,t);for(var a=e.length,i=-1,f=Object(e);++i<a&&t(f[i],i,f)!==!1;);return e}}var Z=ct(lt);function dt(n){return typeof n=="function"?n:cn}function $t(n,r){var e=T(n)?An:Z;return e(n,dt(r))}function pt(n,r){var e=[];return Z(n,function(t,a,i){r(t,a,i)&&e.push(t)}),e}function _t(n,r){var e=T(n)?Tn:pt;return e(n,Ln(r))}function At(n,r){return dn(r,function(e){return n[e]})}function St(n){return n==null?[]:At(n,$(n))}function Et(n){return n===void 0}function yt(n,r,e,t,a){return a(n,function(i,f,s){e=t?(t=!1,i):r(e,i,f,s)}),e}function It(n,r,e){var t=T(n)?or:yt,a=arguments.length<3;return t(n,Ln(r),e,a,Z)}var bt=1/0,Tt=m&&1/j(new m([,-0]))[1]==bt?function(n){return new m(n)}:Xn,ht=200;function Pt(n,r,e){var t=-1,a=Vn,i=n.length,f=!0,s=[],u=s;if(i>=ht){var d=r?null:Tt(n);if(d)return j(d);f=!1,a=En,u=new I}else u=r?[]:s;n:for(;++t<i;){var l=n[t],o=r?r(l):l;if(l=l!==0?l:0,f&&o===o){for(var c=u.length;c--;)if(u[c]===o)continue n;r&&u.push(o),s.push(l)}else a(u,o,e)||(u!==s&&u.push(o),s.push(l))}return s}export{Tn as A,pt as B,Ie as C,Xn as D,I as S,Pt as a,C as b,Ot as c,$t as d,N as e,_t as f,Ln as g,Jn as h,Et as i,Z as j,$ as k,dn as l,tt as m,yn as n,bn as o,dt as p,lt as q,It as r,it as s,M as t,fr as u,St as v,Vn as w,En as x,zn as y,br as z};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{r as E,j as e,c as Z}from"./index-CSEVqIl1.js";import{l as me,c as he,u as xe,d as ge,g as je,i as fe,a as pe,b as ye,e as ve}from"./use-memberships-query-7cBHUXI2.js";import{g as ne,f as I,aI as b,aJ as K,au as Y,aK as O,aL as we,aM as be,aN as ie,h as re,u as Ce,av as Ne,aO as Ae,B as ke,aP as Se,aQ as De,aR as G,at as Te,aS as Ee,aT as Fe}from"./index-gd7H8-q6.js";import{c as Pe,L as _e,T as ee,B as l,S as z,b as oe,d as L,e as M,a as v,X as qe,f as w,A as te,g as se,h as ae}from"./error-boundary-DtDjc7C4.js";import{f as W,u as Le,i as Me,a as ze,b as Ie,c as Ke,O as Oe,H as Qe,A as Be}from"./use-download-agent-mutation-wvsX88DW.js";import"./console-mirror-CpiNswSB.js";import"./en-US-BkS8Ixxl.js";import"./book-open-DI1UBxnn.js";/**
|
|
2
|
+
* @license lucide-react v0.507.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Ue=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],Re=Pe("message-circle",Ue),F={all:["agent-comments"],list:t=>[...F.all,"list",t]},$e=({agentId:t,enabled:r=!0})=>ne({queryKey:F.list(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch comments.");return(await me(t)).result},enabled:!!t&&r,staleTime:2*60*1e3,gcTime:5*60*1e3,refetchOnWindowFocus:!0}),We=()=>{const t=I(),{isAuthenticated:r}=b();return K({mutationFn:async a=>{const{agentId:i,data:s}=a;if(!r)throw new Error("Authentication required.");return he(i,s)},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:F.list(i.agentId)}),O("Comment posted")},onError:a=>{Y(`Failed to post comment: ${a.message}`)}})},Ye=()=>{const t=I(),{isAuthenticated:r}=b();return K({mutationFn:async a=>{const{agentId:i,commentId:s,data:c}=a;if(!r)throw new Error("Authentication required.");return xe(i,s,c)},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:F.list(i.agentId)}),O("Comment updated")},onError:a=>{Y(`Failed to update comment: ${a.message}`)}})},He=()=>{const t=I(),{isAuthenticated:r}=b();return K({mutationFn:async a=>{const{agentId:i,commentId:s}=a;if(!r)throw new Error("Authentication required.");return ge(i,s)},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:F.list(i.agentId)}),O("Comment deleted")},onError:a=>{Y(`Failed to delete comment: ${a.message}`)}})},Je=({agentId:t})=>{const{isAuthenticated:r,user:a}=b(),[i,s]=E.useState(""),[c,f]=E.useState(null),[h,C]=E.useState(""),{data:d,isLoading:P,error:N}=$e({agentId:t}),p=d?.records??[],A=We(),k=Ye(),S=He(),Q=async n=>{if(n.preventDefault(),!(!i.trim()||!r||!t))try{await A.mutateAsync({agentId:t,data:{text:i}}),s("")}catch(o){console.error("Submit comment error caught in component:",o)}},u=(n,o)=>{f(n),C(o)},x=()=>{f(null),C("")},y=async()=>{if(!(!c||!h.trim()||!r||!t))try{await k.mutateAsync({agentId:t,commentId:c,data:{text:h}}),x()}catch(n){console.error("Update comment error caught in component:",n)}},B=async n=>{if(!(!r||!t)&&window.confirm("Are you sure you want to delete this comment?"))try{await S.mutateAsync({agentId:t,commentId:n})}catch(o){console.error("Delete comment error caught in component:",o)}},U=n=>r&&a?.radientUser?.account?.id===n.account_id;return e.jsxs("div",{className:"mt-6",children:[e.jsx("h2",{className:"mb-4 font-semibold text-heading text-ink",children:"Comments"}),r?e.jsxs("div",{className:"mb-4 flex flex-col gap-1.5",children:[e.jsxs(_e,{htmlFor:"new-comment",children:[e.jsx(Re,{size:14,"aria-hidden":"true"}),"Leave a comment"]}),e.jsxs("form",{onSubmit:Q,className:"flex flex-col gap-3",children:[e.jsx(ee,{id:"new-comment",placeholder:"Share your thoughts...",rows:3,value:i,onChange:n=>s(n.target.value),required:!0}),e.jsx(l,{type:"submit",variant:"primary",disabled:A.isPending||!i.trim(),className:"self-end",children:A.isPending?e.jsx(z,{size:"sm",label:"Posting comment"}):"Post comment"})]})]}):e.jsx("p",{className:"mt-6 mb-4 text-body-sm text-ink-muted",children:"Sign in to leave comments."}),e.jsx(oe,{className:"my-6"}),P&&e.jsx("ul",{className:"flex flex-col",children:[...Array(3)].map((n,o)=>e.jsxs("li",{className:"flex gap-3 pb-6",children:[e.jsx(L,{children:e.jsx(M,{children:e.jsx(v,{className:"size-full"})})}),e.jsxs("div",{className:"flex w-full flex-col gap-1.5",children:[e.jsx(v,{className:"h-3.5 w-24"}),e.jsx(v,{className:"h-3 w-15"}),e.jsx(v,{className:"mt-2 h-3.5 w-full"}),e.jsx(v,{className:"h-3.5 w-4/5"})]})]},`skeleton-${o}`))}),N&&e.jsxs("p",{role:"alert",className:"my-6 text-body-sm text-danger",children:["Failed to load comments: ",N.message]}),!P&&!N&&e.jsx("ul",{className:"flex flex-col gap-6",children:p.length===0?e.jsx("li",{className:"text-body-sm text-ink-muted",children:"No comments yet. Yours would be the first."}):p.map(n=>c===n.id?e.jsxs("li",{className:"flex gap-3",children:[e.jsx(L,{children:e.jsx(M,{children:n.account_metadata?.name?.charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"flex w-full flex-col gap-2",children:[e.jsx(ee,{rows:3,value:h,onChange:o=>C(o.target.value),autoFocus:!0,"aria-label":"Edit comment"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(l,{variant:"secondary",size:"sm",onClick:x,children:[e.jsx(qe,{}),"Cancel"]}),e.jsxs(l,{variant:"primary",size:"sm",onClick:y,disabled:k.isPending||!h.trim(),children:[k.isPending?e.jsx(z,{size:"xs",label:"Saving comment"}):e.jsx(we,{}),"Save"]})]})]})]},n.id):e.jsxs("li",{className:"flex gap-3",children:[e.jsx(L,{children:e.jsx(M,{children:n.account_metadata?.name?.charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-body text-ink",children:n.account_metadata?.name||"Anonymous"}),e.jsxs("p",{className:"text-ink-muted text-meta",children:[W(new Date(n.created_at))," ","ago"]})]}),U(n)&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx(w,{content:"Edit comment",children:e.jsx(l,{variant:"ghost",size:"icon-sm",onClick:()=>u(n.id,n.text),disabled:!!c,"aria-label":"Edit comment",children:e.jsx(be,{})})}),e.jsx(w,{content:"Delete comment",children:e.jsx(l,{variant:"ghost",size:"icon-sm",onClick:()=>B(n.id),disabled:!!c,"aria-label":"Delete comment",children:e.jsx(ie,{})})})]})]}),e.jsx("p",{className:"mt-2 text-body-sm text-ink whitespace-pre-wrap",children:n.text})]})]},n.id))})]})},H={all:["agent-details"],detail:t=>[...H.all,t]},Ve=({agentId:t,enabled:r=!0})=>ne({queryKey:H.detail(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch details.");return await je(t)},select:i=>i.result,enabled:!!t&&r,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1}),Xe=()=>{const t=I(),r=re(),{isAuthenticated:a}=b();return K({mutationFn:async({agentId:s})=>{if(!a)throw new Error("Authentication required to delist an agent.");if(!s)throw new Error("Agent ID is required to delist.");return pe(s)},onSuccess:(s,c)=>{O("Agent delisted"),t.invalidateQueries({queryKey:H.detail(c.agentId)}),fe(t),r("/agent-hub")},onError:s=>{console.error("Delist agent error:",s)}})},Ze={like:"The like did not go through",favourite:"The favourite did not go through",download:"The download did not start",delist:"The agent was not delisted"},$=({children:t})=>e.jsx("span",{className:"inline-flex h-4 min-w-5 items-center text-meta text-ink-muted",children:t}),ot=()=>{const{agentId:t}=Ce(),r=re(),{isAuthenticated:a,user:i}=b(),{data:s,isLoading:c,isFetching:f,error:h,refetch:C}=Ve({agentId:t??"",enabled:!!t}),d=s?.visibility==="org",{memberships:P}=ye({enabled:d}),N=d?P.find(ue=>ue.tenant_id===s?.tenant_id)?.tenant_name??null:null,{statuses:p,isKnown:A,isError:k,isFetching:S,refetch:Q}=Le({agentIds:t&&!d?[t]:[]}),u=Me(A,p,t),x=u&&p[t??""]?.liked===!0,y=u&&p[t??""]?.favourited===!0,B=s?.like_count??0,U=s?.favourite_count??0,n=s?.download_count??0,o=ze(),_=Ie(),D=Ke(),g=Xe(),[le,q]=E.useState(!1),[j,m]=E.useState(null),R=!!i&&!!s&&i.radientUser?.account?.id===s.account_id,J=()=>{!t||!a||o.isPending||(m(null),o.mutate({agentId:t,isCurrentlyLiked:x},{onError:()=>m("like")}))},V=()=>{!t||!a||_.isPending||(m(null),_.mutate({agentId:t,isCurrentlyFavourited:y},{onError:()=>m("favourite")}))},X=()=>{!t||!s||D.isPending||(m(null),D.mutate({agentId:s.id,agentName:s.name},{onError:()=>m("download")}))},ce=()=>{!t||!R||g.isPending||(m(null),g.mutate({agentId:t},{onError:()=>m("delist")}),q(!1))},T=j?j==="like"?{action:"like",error:o.error,retry:J}:j==="favourite"?{action:"favourite",error:_.error,retry:V}:j==="download"?{action:"download",error:D.error,retry:X}:{action:"delist",error:g.error,retry:void 0}:null,de=()=>{r("/agent-hub")};return c?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(z,{label:"Loading agent details"})}):h?e.jsx("div",{className:"flex h-full items-center justify-center p-6",children:e.jsxs(te,{variant:"danger",className:"max-w-2xl",children:[e.jsx(se,{children:"This agent could not be loaded"}),e.jsx(ae,{children:Ne("The Radient agent catalogue did not answer.",h)}),e.jsx("div",{className:"mt-2",children:e.jsx(l,{variant:"outline",size:"sm",onClick:()=>void C(),disabled:f,"aria-busy":f,children:f?"Trying…":"Try again"})})]})}):s?e.jsxs("div",{className:"m-6 flex flex-1 flex-col rounded-lg border border-hairline bg-surface p-8",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[e.jsx(l,{variant:"ghost",size:"icon",onClick:de,"aria-label":"Back to Agent hub",children:e.jsx(Ae,{})}),e.jsx(L,{className:"size-11 shrink-0",children:e.jsx(M,{children:e.jsx(ke,{size:22,"aria-hidden":"true"})})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("h1",{className:"truncate text-display text-ink",children:s.name}),d&&e.jsx(Oe,{orgName:N})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!d&&e.jsxs(e.Fragment,{children:[e.jsx(w,{content:"Sign in to Radient to use this feature",disabled:a,children:e.jsx("span",{children:e.jsxs(l,{variant:"ghost",size:"sm",onClick:J,disabled:!a||o.isPending||!u,"aria-label":u?x?"Unlike agent":"Like agent":"Like state unavailable",className:Z(x&&"text-danger"),children:[e.jsx(Qe,{fill:x?"currentColor":"none"}),e.jsx($,{children:B})]})})}),e.jsx(w,{content:"Sign in to Radient to use this feature",disabled:a,children:e.jsx("span",{children:e.jsxs(l,{variant:"ghost",size:"sm",onClick:V,disabled:!a||_.isPending||!u,"aria-label":u?y?"Unfavourite agent":"Favourite agent":"Favourite state unavailable",className:Z(y&&"text-warning"),children:[e.jsx(Se,{fill:y?"currentColor":"none"}),e.jsx($,{children:U})]})})})]}),e.jsx(w,{content:"Download agent to your computer",children:e.jsx("span",{children:e.jsxs(l,{variant:"ghost",size:"icon",onClick:X,disabled:D.isPending,"aria-label":"Download agent",className:"ml-1",children:[e.jsx(De,{}),e.jsx($,{children:D.isPending?e.jsx(v,{className:"h-3.5 w-5"}):n})]})})}),R&&!d&&e.jsx(w,{content:"Permanently delist this agent from Agent hub",children:e.jsx("span",{children:e.jsx(l,{variant:"ghost",size:"icon",onClick:()=>q(!0),disabled:g.isPending,"aria-label":"Delist agent",className:"ml-1 text-danger hover:bg-danger-wash hover:text-danger",children:e.jsx(ie,{})})})})]})]}),a&&k&&!j&&!d&&e.jsxs("output",{className:"mb-6 flex flex-wrap items-center gap-2 text-meta text-warning","data-testid":"agent-details-status-unknown",children:[e.jsx("span",{children:"Your likes and favourites could not be read, so this agent's viewer state is not shown."}),e.jsx(l,{variant:"ghost",size:"sm",onClick:()=>void Q(),disabled:S,"aria-busy":S,children:S?"Trying…":"Try again"})]}),T&&j&&e.jsxs(te,{variant:"danger",className:"mb-6","data-testid":"agent-details-error",children:[e.jsx(se,{children:Ze[j]}),e.jsx(ae,{children:ve(T.action,T.error,s.name)}),T.retry&&e.jsx("div",{className:"mt-2",children:e.jsx(l,{variant:"outline",size:"sm",onClick:T.retry,children:"Try again"})})]}),e.jsx(Be,{tags:s.tags,categories:s.categories}),e.jsxs("div",{className:"mt-4 mb-6 flex flex-col gap-2 text-body-sm text-ink-muted",children:[e.jsxs("p",{children:["Created by: ",s.account_metadata?.name??"Unknown"," (",s.account_metadata?.email??"No email",")"]}),e.jsxs("p",{children:["Created: ",W(new Date(s.created_at))," ago (",G(s.created_at),")"]}),e.jsxs("p",{children:["Last modified: ",W(new Date(s.updated_at))," ","ago (",G(s.updated_at),")"]})]}),e.jsx("div",{className:"mt-2 mb-8 leading-relaxed text-body text-ink",children:s.description||"No description provided."}),e.jsx(oe,{className:"my-6"}),!d&&e.jsx(Je,{agentId:s.id}),e.jsx(Te,{open:le,onClose:()=>q(!1),title:"Delist this agent?",maxWidth:"xs",actions:e.jsxs(e.Fragment,{children:[e.jsx(Ee,{onClick:()=>q(!1),children:"Cancel"}),e.jsx(Fe,{onClick:()=>{!t||!R||g.isPending||ce()},disabled:g.isPending,children:g.isPending?e.jsx(z,{size:"sm",label:"Delisting agent"}):"Delist"})]}),dialogProps:{"aria-describedby":"delist-dialog-description"},children:e.jsxs("div",{id:"delist-dialog-description",className:"text-body text-ink-muted",children:['This takes "',s.name,'" off the hub straight away, and nobody will be able to download it. You can upload it again later.']})})]}):e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-body text-ink",children:"Agent not found."})})};export{ot as AgentDetailsPage};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{r as i,j as e,c as F}from"./index-CSEVqIl1.js";import{h as pe,aI as ie,aP as Ee,aQ as he,aU as Ie,r as Le,g as Fe,aD as Me,f as $e,aJ as De,aV as Ue,aK as Ye,aW as ge,aX as Ve,aw as qe,av as be,b as Qe,am as Be,aY as He}from"./index-gd7H8-q6.js";import{o as je,u as We,a as Ge,C as Je,b as Ke}from"./org-surface-gate-Dvz4sPXB.js";import{P as Xe}from"./page-header-B9QalVj7.js";import{c as Ze,f as q,B as N,a as m,A as H,g as W,h as G,k as se,l as te,m as ne,n as re,o as Q,I as ea}from"./error-boundary-DtDjc7C4.js";import{R as aa,u as sa}from"./radient-auth-buttons-BCb9PgbG.js";import{e as ta,f as na,p as ra,P as ia,b as la,h as oa}from"./use-memberships-query-7cBHUXI2.js";import{O as ca,A as da,f as ua,H as ma,a as ha,b as ga,c as xa,d as ve,C as fa,u as pa,i as ba}from"./use-download-agent-mutation-wvsX88DW.js";import"./console-mirror-CpiNswSB.js";import"./en-US-BkS8Ixxl.js";import"./book-open-DI1UBxnn.js";/**
|
|
2
|
+
* @license lucide-react v0.507.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ja=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]],va=Ze("circle-ellipsis",ja),Na=({agent:a,isLiked:t,isFavourited:n,onLikeToggle:r,onFavouriteToggle:o,onDownload:c,isLikeActionLoading:h=!1,isFavouriteActionLoading:y=!1,isDownloading:x=!1,actionError:d=null,onRetryAction:p,showActions:b=!0,viewerStateKnown:f=!0,orgName:j=null})=>{const k=pe(),{isAuthenticated:u}=ie(),_=a.description??"",[P,R]=i.useState(!1),l=i.useRef(null),v=i.useCallback(g=>{if(l.current?.disconnect(),l.current=null,!g)return;const S=()=>R(g.scrollHeight-g.clientHeight>1);S();const D=new ResizeObserver(S);D.observe(g),l.current=D},[]),M=u?f?t?"Unlike agent":"Like agent":"Your likes could not be read, so this is not shown as unliked.":"Log in to Radient to like agents",$=u?f?n?"Unfavourite agent":"Favourite agent":"Your favourites could not be read, so this is not shown as unfavourited.":"Log in to Radient to favourite agents",z=f?t?"Unlike agent":"Like agent":"Like state unavailable",O=f?n?"Unfavourite agent":"Favourite agent":"Favourite state unavailable",E=a.visibility==="org";return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden rounded-lg border border-hairline bg-surface transition-colors duration-fast ease-out-quart hover:border-control",children:[e.jsxs("button",{type:"button",onClick:()=>k(`/agent-hub/${a.id}`),className:"flex min-h-0 flex-1 cursor-pointer flex-col gap-2 p-4 text-left","aria-label":`View details for ${a.name}`,children:[e.jsx("h3",{className:"truncate font-medium text-heading text-ink",children:a.name}),E&&e.jsx(ca,{orgName:j}),e.jsx(q,{content:P?_:"",children:e.jsx("span",{ref:v,className:"line-clamp-3 min-h-0 text-body-sm text-ink-muted",children:_})}),e.jsxs("div",{className:"mt-auto flex flex-col gap-2 pt-2",children:[e.jsx(da,{tags:a.tags,categories:a.categories}),e.jsxs("p",{className:"truncate text-ink-dim text-meta",children:[a.account_metadata?.name??"Unknown author",e.jsx("span",{"aria-hidden":"true",className:"mx-1.5",children:"·"}),"updated ",ua(new Date(a.updated_at))," ago"]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-hairline px-3 py-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-0.5","data-viewer-state":E?"org":u?f?"known":"unknown":"signed-out",children:[!E&&e.jsxs(e.Fragment,{children:[e.jsx(q,{content:M,children:e.jsx("span",{children:e.jsxs(N,{variant:"ghost",size:"sm",onClick:u&&f?()=>r(a.id):void 0,disabled:h||!u||!f,"aria-label":z,className:F(t&&"text-danger"),children:[e.jsx(ma,{fill:t?"currentColor":"none","data-testid":"agent-like-heart"}),e.jsx("span",{"data-testid":"agent-like-count",className:"inline-flex h-4 min-w-4 items-center font-mono text-mono-sm text-ink-muted",children:a.like_count??0})]})})}),e.jsx(q,{content:$,children:e.jsx("span",{children:e.jsxs(N,{variant:"ghost",size:"sm",onClick:u?()=>o(a.id):void 0,disabled:y||!u||!f,"aria-label":O,className:F(n&&"text-warning"),children:[e.jsx(Ee,{fill:n?"currentColor":"none","data-testid":"agent-favourite-star"}),e.jsx("span",{"data-testid":"agent-favourite-count",className:"inline-flex h-4 min-w-4 items-center font-mono text-mono-sm text-ink-muted",children:a.favourite_count??0})]})})})]}),e.jsx(q,{content:"Downloads",children:e.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 pr-1 text-ink-dim",children:[e.jsx(he,{"aria-hidden":"true",className:"size-3.5"}),e.jsx("span",{className:"inline-flex h-4 min-w-6 items-center font-mono text-mono-sm",children:x?e.jsx(m,{className:"h-3 w-6"}):(a.download_count??0).toLocaleString()})]})})]}),b&&c&&e.jsx("div",{className:"ml-auto flex shrink-0 items-center",children:e.jsxs(N,{variant:"secondary",size:"sm",onClick:()=>c(a),disabled:x,"aria-label":`Download ${a.name}`,"data-tour-tag":"agent-hub-download-button",children:[e.jsx(he,{"data-testid":"agent-download"}),"Get"]})})]}),d&&e.jsxs("output",{"data-testid":"agent-card-error",className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-hairline px-3 py-2 text-body-sm text-danger",children:[e.jsx("span",{className:"min-w-0 flex-1",children:d}),p&&e.jsx(N,{variant:"ghost",size:"sm",onClick:p,children:"Try again"})]})]})},ya=({agent:a,status:t,viewerStateKnown:n=!0,orgName:r=null})=>{const{isAuthenticated:o}=ie(),[c,h]=i.useState(null),y=t?.liked??!1,x=t?.favourited??!1,d=ha(),p=ga(),b=xa(),f=()=>{!o||d.isPending||(h(null),d.mutate({agentId:a.id,isCurrentlyLiked:y},{onError:()=>h("like")}))},j=()=>{!o||p.isPending||(h(null),p.mutate({agentId:a.id,isCurrentlyFavourited:x},{onError:()=>h("favourite")}))},k=()=>{b.isPending||(h(null),b.mutate({agentId:a.id,agentName:a.name},{onError:()=>h("download")}))},u=c?c==="like"?{action:"like",error:d.error,retry:f}:c==="favourite"?{action:"favourite",error:p.error,retry:j}:{action:"download",error:b.error,retry:k}:null;return e.jsx(Na,{agent:a,isLiked:o&&y,isFavourited:o&&x,onLikeToggle:f,onFavouriteToggle:j,onDownload:k,isLikeActionLoading:d.isPending,isFavouriteActionLoading:p.isPending,isDownloading:b.isPending,viewerStateKnown:n,orgName:r,actionError:u?ta(u.action,u.error,a.name):null,onRetryAction:u?.retry})},xe=({selected:a,onClick:t,children:n,...r})=>e.jsx("button",{type:"button",onClick:t,"aria-pressed":a,className:F("flex w-full cursor-pointer items-center gap-2.5 rounded-sm px-3 py-1.5 text-left","text-body-sm transition-colors duration-fast ease-out-quart",a?Le:"text-ink hover:bg-row-hover"),...r,children:n}),fe=Object.keys(fa),wa=a=>[...a].sort((t,n)=>{const r=fe.indexOf(t),o=fe.indexOf(n);return r!==-1&&o!==-1?r-o:r!==-1?-1:o!==-1?1:t.localeCompare(n)}),ka=({selectedCategory:a,onSelectCategory:t,categories:n})=>{const r=wa(a&&!n.includes(a)?[...n,a]:n);return e.jsxs("div",{className:"flex h-full flex-col overflow-y-auto",children:[e.jsx("h2",{className:"mb-2 px-3 font-medium text-ink-dim text-meta",children:"Categories"}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs(xe,{selected:a===null,onClick:()=>t(null),"data-testid":"category-all",children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:e.jsx(Ie,{size:16,"aria-hidden":"true"})}),"All categories"]}),r.map(o=>{const c=ve(o),h=o==="other"?e.jsx(va,{size:16}):c.icon;return e.jsxs(xe,{selected:a===o,onClick:()=>t(o),"data-testid":`category-${o}`,children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:h}),c.label]},o)})]})]})},Ne={all:["org-teams"],list:a=>[...Ne.all,"list",a]},Ca=({tenantId:a,enabled:t=!0})=>{const n=Fe({queryKey:Ne.list(a??""),queryFn:async()=>(await na(a)).result??{teams:[]},enabled:t&&!!a,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retry:Me});return{...n,teams:n.data?.teams??[]}},Sa=(a,t)=>{const n=a?.name?.trim()||t?.trim()||"Team",r=a?.renamed_from?.trim()||null;return a?.invalid_name===!0&&r?{level:"warning",message:`Pulled "${n}". The published name "${r}" is not usable locally, so the team was stored as "${n}".`}:r?{level:"success",message:`Pulled "${n}" (you already have a team called "${r}").`}:{level:"success",message:`Pulled team "${n}".`}},Ta=()=>{const a=$e();return De({mutationFn:async({teamId:t,tenantId:n})=>{if(!ge.baseUrl)throw new Error("Local Operator API URL is not configured.");return Ve.pullOrgTeamFromRadient(ge.baseUrl,t,n)},onSuccess:(t,n)=>{const r=Sa(t.result,n.name);r.level==="warning"?Ue(r.message):Ye(r.message),a.invalidateQueries({queryKey:["desktop","teams"]})},onError:t=>{console.error("Pulling an organization team failed:",t)}})},Aa=["refresh-hub","retry","sign-in"],_a=({tenantId:a,orgName:t})=>{const{teams:n,isLoading:r,isFetching:o,isError:c,error:h,refetch:y}=Ca({tenantId:a}),x=je(h),d=Ta(),[p,b]=i.useState(null),[f,j]=i.useState(null),[k,u]=i.useState(!1),_=i.useMemo(()=>{if(!qe(d.error))return null;const l=n.find(v=>v.id===p);return ra({code:d.error.code,message:d.error.message,details:d.error.details},{name:l?.name??"this team",hubAgentId:null,surface:"pull"})},[d.error,p,n]),P=(l,v)=>{switch(l){case"refresh-hub":y();break;case"retry":R(v);break;case"sign-in":u(!0);break}},R=l=>{d.isPending||(b(null),j(l.id),d.mutate({teamId:l.id,tenantId:a,name:l.name},{onSettled:()=>j(null),onError:()=>b(l.id)}))};return e.jsxs("section",{className:"mb-6 rounded-lg border border-hairline bg-surface","aria-labelledby":"org-teams-heading","data-testid":"org-teams",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2 px-4 pt-3 pb-2",children:[e.jsx("h2",{id:"org-teams-heading",className:"font-medium text-heading text-ink",children:"Teams"}),!r&&!c&&e.jsxs("p",{className:"text-meta text-ink-dim","data-testid":"org-teams-count",children:[n.length," ",n.length===1?"team":"teams"," shared with"," ",t??"this organization"]})]}),r&&e.jsxs("div",{className:"flex flex-col gap-2 px-4 pb-4","data-testid":"org-teams-loading",children:[e.jsx("span",{className:"sr-only",children:"Loading teams…"}),e.jsxs("div",{"aria-hidden":"true",className:"flex flex-col gap-2",children:[e.jsx(m,{className:"h-4.5 w-40"}),e.jsx(m,{className:"h-3.5 w-64"})]})]}),!r&&c&&e.jsxs(H,{variant:x?"warning":"danger",className:"mx-4 mb-4","data-testid":"org-teams-error",children:[e.jsx(W,{children:x==="plan"?"That organization needs an active Team plan":x==="no_access"?"You do not have access to that organization":"Teams could not be loaded"}),e.jsx(G,{children:x==="plan"?`Reading an organization's teams is part of the Team plan. An owner of ${t??"this organization"} can activate it in the Radient console, and then its teams will be listed here.`:x==="no_access"?`You are not a member of ${t??"that organization"}, so its teams are not listed here. An owner can invite you again.`:be("The teams shared with this organization could not be read.",h)}),x!=="no_access"&&e.jsx("div",{className:"mt-2",children:e.jsx(N,{variant:"primary",size:"sm",onClick:()=>void y(),disabled:o,"aria-busy":o,children:o?"Trying…":"Try again"})})]}),!r&&!c&&n.length===0&&e.jsx("p",{className:"px-4 pb-4 text-body-sm text-ink-muted","data-testid":"org-teams-empty",children:"No teams have been shared with this organization yet."}),!r&&!c&&n.length>0&&e.jsx("ul",{className:"flex flex-col divide-y divide-hairline border-t border-hairline",children:n.map(l=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-4 py-2.5",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("span",{className:"truncate font-medium text-body text-ink",children:l.name}),e.jsxs("span",{className:"truncate text-meta text-ink-muted",children:[l.project||"No project",e.jsx("span",{"aria-hidden":"true",className:"mx-1.5",children:"·"}),Pa(l),l.version?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",className:"mx-1.5",children:"·"}),"v",l.version]}):null]}),p===l.id&&e.jsxs("div",{className:"mt-1 flex flex-col items-start gap-1","data-testid":"org-team-pull-error",children:[e.jsx("output",{className:"text-meta text-danger",children:_?.body??d.error?.message??`"${l.name}" could not be pulled.`}),_?.actions.filter(v=>Aa.includes(v)).map(v=>e.jsx(N,{variant:"primary",size:"sm",onClick:()=>P(v,l),children:ia[v]},v)),k&&e.jsx("div",{className:"mt-1","data-testid":"org-team-pull-reauth",children:e.jsx(aa,{titleText:"Sign in again",descriptionText:"",onSignInSuccess:()=>{u(!1),b(null),y()}})})]})]}),e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>R(l),disabled:d.isPending,"aria-label":`Pull team ${l.name}`,children:f===l.id?"Pulling…":"Pull"})]},l.id))})]})},Pa=a=>a.members.length===0?"No members":a.members.map(t=>t.count>1?`${t.role} ×${t.count}`:t.role).join(", "),Ra=(a,t)=>{const[n,r]=i.useState(a);return i.useEffect(()=>{const o=setTimeout(()=>r(a),t);return()=>clearTimeout(o)},[a,t]),n},B=[{value:"download_count:desc",label:"Most downloaded",sort:"download_count",order:"desc"},{value:"like_count:desc",label:"Most liked",sort:"like_count",order:"desc"},{value:"favourite_count:desc",label:"Most favourited",sort:"favourite_count",order:"desc"},{value:"created_at:desc",label:"Newest",sort:"created_at",order:"desc"},{value:"updated_at:desc",label:"Recently updated",sort:"updated_at",order:"desc"},{value:"name:asc",label:"Name (A to Z)",sort:"name",order:"asc"}],za=[{value:"name",label:"Name"},{value:"description",label:"Description"}],Oa=300,L="public",Ea=()=>e.jsxs("div",{className:"flex h-full flex-col overflow-hidden rounded-lg border border-hairline bg-surface",children:[e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 p-4",children:[e.jsx(m,{className:"h-5.5 w-2/3"}),e.jsx(m,{className:"h-3.5 w-full"}),e.jsx(m,{className:"h-3.5 w-full"}),e.jsx(m,{className:"h-3.5 w-1/2"}),e.jsxs("div",{className:"mt-auto flex flex-col gap-2 pt-2",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(m,{className:"h-5.5 w-24"}),e.jsx(m,{className:"h-5.5 w-20"})]}),e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx(m,{className:"h-5.5 w-24"})})]}),e.jsx(m,{className:"h-4.5 w-32"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-hairline px-3 py-2",children:[e.jsx(m,{className:"size-4"}),e.jsx(m,{className:"h-4 w-6"}),e.jsx(m,{className:"size-4"}),e.jsx(m,{className:"h-4 w-6"}),e.jsx(m,{className:"ml-auto h-7 w-16"})]})]}),Ba=()=>{const a=pe(),{isAuthenticated:t}=ie(),[n,r]=i.useState(1),[o]=i.useState(12),[c,h]=i.useState(null),[y,x]=i.useState(""),[d,p]=i.useState("name"),[b,f]=i.useState(B[0].value),[j,k]=i.useState(L),[u,_]=i.useState([]),P=Ra(y,Oa),R=B.find(s=>s.value===b)??B[0],l=Qe(),v=sa(),M=Be(l.data,"radient_org"),$=t?Ge(M,v):null,{memberships:z}=la({enabled:Ke(M)}),O=i.useMemo(()=>We(z),[z]),E=j===L||O.some(s=>s.tenant_id===j);i.useEffect(()=>{E||k(L)},[E]);const g=j===L?null:O.find(s=>s.tenant_id===j)??null,S=g?.tenant_id,D=g?.role==="owner"||g?.role==="admin",ye=i.useMemo(()=>new Map(z.map(s=>[s.tenant_id,s.tenant_name])),[z]),{data:U,agents:we,isLoading:ke,isFetching:C,error:T,refetch:le,pagination:A}=oa({page:n,perPage:o,categories:c?[c]:void 0,name:d==="name"&&P||void 0,description:d==="description"&&P||void 0,sort:R.sort,order:R.order,tenantId:S}),I=g?je(T):null,Y=we??[],oe=C&&U!==void 0,{statuses:ce,isKnown:Ce,isError:Se,isFetching:J,refetch:Te}=pa({agentIds:S?[]:Y.map(s=>s.id)}),K=i.useRef(null),X=i.useRef(null),[de,Ae]=i.useState(0);i.useEffect(()=>{de!==0&&(K.current??X.current)?.focus()},[de]);const ue=i.useRef(null),Z=i.useRef(!1),ee=i.useMemo(()=>[...new Set((U?.records??[]).flatMap(s=>s.categories??[]))],[U]);i.useEffect(()=>{_(s=>ee.every(ae=>s.includes(ae))?s:[...new Set([...s,...ee])])},[ee]);const V=c!==null||P!=="",_e=()=>{h(null),x(""),r(1),Ae(s=>s+1)},w=(ke||C)&&U===void 0,me=!w&&!V&&(T!==null||Y.length===0);i.useEffect(()=>{!Z.current||w||(Z.current=!1,T?ue.current?.focus():(K.current??X.current)?.focus())},[w,T]);const Pe=s=>{r(s)},Re=s=>{h(s),r(1)},ze=s=>{x(s),r(1)},Oe=s=>{p(s),r(1)};return e.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[e.jsx(Xe,{title:"Agent hub",subtitle:"Discover and download community agents on Radient",icon:He}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-row overflow-hidden",children:[e.jsx("div",{className:"mr-6 hidden w-60 shrink-0 rounded-md bg-surface p-2 md:block","data-tour-tag":"agent-hub-sidebar-container",children:!me&&e.jsx(ka,{selectedCategory:c,onSelectCategory:Re,categories:u})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto",children:[$&&e.jsxs(H,{variant:"warning",className:"mb-3 max-w-2xl","data-testid":"agent-hub-org-unavailable",children:[e.jsx(W,{children:"Organizations are unavailable"}),e.jsx(G,{children:$})]}),O.length>0&&e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:"agent-hub-scope-label",className:"text-meta text-ink-muted",children:"Showing"}),e.jsxs(se,{value:j,onValueChange:s=>{k(s),r(1)},children:[e.jsx(te,{className:"w-56","aria-labelledby":"agent-hub-scope-label","data-testid":"agent-hub-scope",children:e.jsx(ne,{})}),e.jsxs(re,{children:[e.jsx(Q,{value:L,children:"Public hub"}),O.map(s=>e.jsx(Q,{value:s.tenant_id,children:s.tenant_name||"Organization"},s.tenant_id))]})]})]}),!me&&e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:F("flex min-w-56 flex-1 items-center rounded-sm border border-control bg-surface","transition-colors duration-fast ease-out-quart","has-[:focus-visible]:outline-solid has-[:focus-visible]:outline-2","has-[:focus-visible]:outline-accent has-[:focus-visible]:outline-offset-2"),children:[e.jsx(ea,{ref:K,type:"search",value:y,onChange:s=>ze(s.target.value),placeholder:"Search agents","aria-label":"Search agents",className:"h-8 min-w-0 flex-1 border-0 bg-transparent outline-none","data-testid":"agent-hub-search"}),e.jsxs(se,{value:d,onValueChange:Oe,children:[e.jsx(te,{className:"w-auto shrink-0 border-y-0 border-l border-hairline border-r-0 bg-transparent pl-2 outline-none","aria-label":"Search in","data-testid":"agent-hub-search-scope",children:e.jsx(ne,{})}),e.jsx(re,{children:za.map(s=>e.jsx(Q,{value:s.value,children:s.label},s.value))})]})]}),e.jsxs(se,{value:b,onValueChange:f,children:[e.jsx(te,{className:"w-48","aria-label":"Sort agents","data-testid":"agent-hub-sort",children:e.jsx(ne,{})}),e.jsx(re,{children:B.map(s=>e.jsx(Q,{value:s.value,children:s.label},s.value))})]})]}),e.jsxs("p",{"aria-live":"polite",className:"mb-3 text-meta text-ink-dim","data-testid":"agent-hub-status",children:[w?"Loading agents…":A?`${A.totalRecords} ${A.totalRecords===1?"agent":"agents"}`:"",oe?e.jsx(e.Fragment,{children:" Updating…"}):null]}),t&&Se&&e.jsxs("output",{className:"mb-3 flex flex-wrap items-center gap-2 text-meta text-warning","data-testid":"agent-hub-status-unknown",children:[e.jsx("span",{children:"Your likes and favourites could not be read, so no card shows a viewer state."}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>void Te(),disabled:J,"aria-busy":J,children:J?"Trying…":"Try again"})]}),w&&e.jsx("div",{"data-testid":"agent-hub-loading",className:"grid grid-cols-[repeat(auto-fill,minmax(17.5rem,1fr))] gap-6",children:Array.from({length:6},(s,ae)=>e.jsx(Ea,{},ae))}),w&&A===void 0&&e.jsx("div",{"aria-hidden":"true",className:"mt-6 flex min-h-13 items-center justify-center","data-testid":"agent-hub-pager-placeholder",children:e.jsx(m,{className:"h-4 w-24"})}),e.jsx("output",{"aria-live":"polite","data-testid":"agent-hub-outage",className:F(!w&&T&&!I?"block":"sr-only"),children:!w&&T&&!I&&e.jsxs(H,{variant:"danger",className:"max-w-2xl","aria-busy":C,"data-testid":"agent-hub-error",children:[e.jsx(W,{children:t?"The hub could not be loaded":"Sign in to use the hub"}),e.jsx(G,{children:t?be("The agent list could not be loaded.",T):"You are not signed in to Radient, so the hub has no credential to read the agent list with. Sign in on the settings page, then try again."}),e.jsx("div",{className:"mt-2",children:e.jsx(N,{ref:ue,variant:"outline",size:"sm",onClick:()=>{Z.current=!0,le()},disabled:C,"aria-busy":C,children:C?"Trying…":"Try again"})})]})}),!w&&I&&g&&e.jsxs(H,{variant:"warning",className:"max-w-2xl","data-testid":"agent-hub-org-no-access",children:[e.jsx(W,{children:I==="plan"?"That organization needs an active Team plan":"You do not have access to that organization"}),e.jsx(G,{children:I==="plan"?`Sharing agents inside an organization is part of the Team plan. An owner of ${g.tenant_name||"this organization"} can activate it in the Radient console, and then its agents will be listed here.`:`You are not a member of ${g.tenant_name||"that organization"}, so its agents are not listed here. An owner can invite you again.`}),I==="plan"&&e.jsx("div",{className:"mt-2",children:e.jsx(N,{variant:"primary",size:"sm",onClick:()=>void le(),disabled:C,"aria-busy":C,children:C?"Trying…":"Try again"})})]}),!w&&!T&&e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(17.5rem,1fr))] gap-6","aria-busy":oe,children:Y.length===0?e.jsxs("div",{"data-testid":"agent-hub-empty",className:"col-span-full w-full max-w-2xl justify-self-center flex flex-col items-center gap-2 rounded-lg border border-hairline bg-surface px-6 py-10 text-center",children:[e.jsx("p",{className:"text-heading text-ink",children:S?"This organization has no shared agents yet.":c?`No agents in ${ve(c).label}.`:V?"No agents match that search.":"The hub is empty."}),e.jsx("p",{className:"max-w-md text-body-sm text-ink-muted",children:S?`Agents published into ${g?.tenant_name||"this organization"} appear here for its members.`:c?"Nothing in this category yet. Clear the filter to see the whole hub.":V?"No agent's name or description carries that. Clear it to see the whole hub.":"Nobody has published an agent yet. Yours could be the first."}),e.jsx("div",{className:"mt-2 flex flex-wrap items-center justify-center gap-2",children:V?e.jsx(N,{variant:"secondary",onClick:_e,children:c?"Clear filter":"Clear search"}):S&&!D?null:e.jsx(N,{ref:X,variant:"secondary",onClick:()=>a("/agents"),children:"Publish an agent"})})]}):Y.map(s=>e.jsx(ya,{agent:s,status:t?ce[s.id]:void 0,viewerStateKnown:t&&ba(Ce,ce,s.id),orgName:s.visibility==="org"?ye.get(s.tenant_id)??null:null},s.id))}),!w&&A&&A.totalPages>1&&e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx(Je,{count:A.totalPages,page:A.page,onChange:Pe})}),g&&e.jsx(_a,{tenantId:g.tenant_id,orgName:g.tenant_name||null})]})]})]})};export{Ba as AgentHubPage};
|