@rubytech/create-maxy-code 0.1.453 → 0.1.454
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/package.json +1 -1
- package/payload/platform/lib/graph-style/dist/index.d.ts +19 -0
- package/payload/platform/lib/graph-style/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/graph-style/dist/index.js +111 -0
- package/payload/platform/lib/graph-style/dist/index.js.map +1 -1
- package/payload/platform/lib/graph-style/src/__tests__/icons.test.ts +63 -0
- package/payload/platform/lib/graph-style/src/index.ts +112 -0
- package/payload/platform/plugins/admin/PLUGIN.md +1 -1
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +3 -1
- package/payload/platform/plugins/docs/references/admin-ui.md +2 -0
- package/payload/platform/plugins/whatsapp/PLUGIN.md +1 -1
- package/payload/platform/plugins/whatsapp/mcp/dist/index.js +3 -3
- package/payload/platform/plugins/whatsapp/mcp/dist/index.js.map +1 -1
- package/payload/platform/scripts/lib/__tests__/account-settings-askgate.test.sh +144 -0
- package/payload/platform/scripts/lib/account-settings-askgate.sh +98 -0
- package/payload/platform/scripts/setup-account.sh +14 -0
- package/payload/platform/services/claude-session-manager/dist/index.js +54 -6
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/interactive-wedge.d.ts +17 -0
- package/payload/platform/services/claude-session-manager/dist/interactive-wedge.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/interactive-wedge.js +14 -0
- package/payload/platform/services/claude-session-manager/dist/interactive-wedge.js.map +1 -1
- package/payload/server/public/assets/{AdminLoginScreens-Bvf4HKmq.js → AdminLoginScreens-5R0A40Is.js} +1 -1
- package/payload/server/public/assets/AdminShell-B2HeKInP.js +2 -0
- package/payload/server/public/assets/{Checkbox-2SswiICc.js → Checkbox-yjCERU3B.js} +1 -1
- package/payload/server/public/assets/{admin-B7GPCzpr.js → admin-BDio0OER.js} +1 -1
- package/payload/server/public/assets/{browser-CodHC_MO.js → browser-bSeWXhod.js} +1 -1
- package/payload/server/public/assets/{calendar-DH7cyXKF.js → calendar-MNAmsxL3.js} +1 -1
- package/payload/server/public/assets/chat-Bq4Uq3Ht.js +1 -0
- package/payload/server/public/assets/chevron-left-D5XwUM2x.js +1 -0
- package/payload/server/public/assets/data-DY10qHOy.js +1 -0
- package/payload/server/public/assets/{graph-BToB78LG.js → graph-DRWRwsUZ.js} +7 -7
- package/payload/server/public/assets/graph-labels-Cy7GyGln.js +1 -0
- package/payload/server/public/assets/{maximize-2-CEQRv64B.js → maximize-2-BRHW5pKh.js} +1 -1
- package/payload/server/public/assets/{operator-Cx8cq2wf.js → operator-Dv2k2JaW.js} +1 -1
- package/payload/server/public/assets/{page-TCsQy4eP.js → page-BZRZZcqM.js} +1 -1
- package/payload/server/public/assets/{page-D6kzsk18.js → page-CoBzMOIg.js} +2 -2
- package/payload/server/public/assets/{public-B61xcmAr.js → public-CirpatD6.js} +1 -1
- package/payload/server/public/assets/{rotate-ccw-7_3ol0Z4.js → rotate-ccw-tv1JxnBS.js} +1 -1
- package/payload/server/public/assets/{tasks-BY9ajKXf.js → tasks-B8iXIZ3w.js} +1 -1
- package/payload/server/public/assets/{time-entry-format-DmNhIJnM.js → time-entry-format-MGC9wMbZ.js} +1 -1
- package/payload/server/public/assets/{useCopyFeedback-C5-GOl5l.js → useCopyFeedback-DdwMdpa-.js} +1 -1
- package/payload/server/public/assets/{useSelectionMode-UOUVnP9B.js → useSelectionMode-DyoyGg7d.js} +1 -1
- package/payload/server/public/assets/useSubAccountSwitcher-CMi8n_8S.css +1 -0
- package/payload/server/public/assets/{useVoiceRecorder-BAP3yGxs.js → useVoiceRecorder-BDtJhfh_.js} +1 -1
- package/payload/server/public/browser.html +5 -5
- package/payload/server/public/calendar.html +6 -6
- package/payload/server/public/chat.html +12 -12
- package/payload/server/public/data.html +10 -10
- package/payload/server/public/graph.html +11 -11
- package/payload/server/public/index.html +13 -13
- package/payload/server/public/operator.html +14 -14
- package/payload/server/public/public.html +12 -12
- package/payload/server/public/tasks.html +5 -5
- package/payload/server/server.js +168 -21
- package/payload/server/public/assets/AdminShell-CaGc8ODG.js +0 -2
- package/payload/server/public/assets/chat-BQyPAEMv.js +0 -1
- package/payload/server/public/assets/chevron-left-Cmev0R9v.js +0 -1
- package/payload/server/public/assets/data-DWxZzMfL.js +0 -1
- package/payload/server/public/assets/graph-labels-JRGrstzM.js +0 -1
- package/payload/server/public/assets/useSubAccountSwitcher-DgM1ergs.css +0 -1
- /package/payload/server/public/assets/{useSubAccountSwitcher-DF6bohQA.js → useSubAccountSwitcher-B_zj_dY-.js} +0 -0
package/payload/server/server.js
CHANGED
|
@@ -520,6 +520,8 @@ var require_dist3 = __commonJS({
|
|
|
520
520
|
exports.pickDisplayLabel = pickDisplayLabel2;
|
|
521
521
|
exports.colourForLabel = colourForLabel2;
|
|
522
522
|
exports.shapeForLabel = shapeForLabel2;
|
|
523
|
+
exports.iconForLabel = iconForLabel2;
|
|
524
|
+
exports.nodeImageDataUri = nodeImageDataUri2;
|
|
523
525
|
exports.resolveNodeColour = resolveNodeColour2;
|
|
524
526
|
exports.formatRunTimestamp = formatRunTimestamp;
|
|
525
527
|
exports.formatMessageTimestamp = formatMessageTimestamp;
|
|
@@ -669,6 +671,81 @@ var require_dist3 = __commonJS({
|
|
|
669
671
|
function shapeForLabel2(label) {
|
|
670
672
|
return SHAPE_BY_LABEL[label] ?? exports.FALLBACK_LABEL_SHAPE;
|
|
671
673
|
}
|
|
674
|
+
var LABEL_ICONS = {
|
|
675
|
+
LocalBusiness: '<path d="M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5"></path><path d="M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244"></path><path d="M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05"></path>',
|
|
676
|
+
Service: '<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"></path>',
|
|
677
|
+
PriceSpecification: '<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"></path><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"></circle>',
|
|
678
|
+
OpeningHoursSpecification: '<circle cx="12" cy="12" r="10"></circle><path d="M12 6v6l4 2"></path>',
|
|
679
|
+
Listing: '<rect width="8" height="4" x="8" y="2" rx="1" ry="1"></rect><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><path d="M12 11h4"></path><path d="M12 16h4"></path><path d="M8 11h.01"></path><path d="M8 16h.01"></path>',
|
|
680
|
+
Property: '<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"></path><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>',
|
|
681
|
+
Viewing: '<path d="M8 2v4"></path><path d="M16 2v4"></path><rect width="18" height="18" x="3" y="4" rx="2"></rect><path d="M3 10h18"></path><path d="m9 16 2 2 4-4"></path>',
|
|
682
|
+
Offer: '<path d="M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17"></path><path d="m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9"></path><path d="m2 16 6 6"></path><circle cx="16" cy="9" r="2.9"></circle><circle cx="6" cy="5" r="3"></circle>',
|
|
683
|
+
Job: '<path d="M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"></path><rect width="20" height="14" x="2" y="6" rx="2"></rect>',
|
|
684
|
+
Quote: '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"></path><path d="M14 2v5a1 1 0 0 0 1 1h5"></path><path d="M10 9H8"></path><path d="M16 13H8"></path><path d="M16 17H8"></path>',
|
|
685
|
+
Invoice: '<path d="M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z"></path><path d="M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"></path><path d="M12 17.5v-11"></path>',
|
|
686
|
+
InboundInvoice: '<path d="M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-1"></path><path d="M14 2v5a1 1 0 0 0 1 1h5"></path><path d="M2 15h10"></path><path d="m9 18 3-3-3-3"></path>',
|
|
687
|
+
WhatsAppGroup: '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path><path d="M16 3.128a4 4 0 0 1 0 7.744"></path><path d="M22 21v-2a4 4 0 0 0-3-3.87"></path><circle cx="9" cy="7" r="4"></circle>',
|
|
688
|
+
Customer: '<path d="M16 2v2"></path><path d="M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2"></path><path d="M8 2v2"></path><circle cx="12" cy="11" r="3"></circle><rect x="3" y="4" width="18" height="18" rx="2"></rect>',
|
|
689
|
+
Site: '<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"></path><circle cx="12" cy="10" r="3"></circle>',
|
|
690
|
+
Asset: '<path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"></path><path d="M12 22V12"></path><polyline points="3.29 7 12 12 20.71 7"></polyline><path d="m7.5 4.27 9 5.15"></path>',
|
|
691
|
+
Visit: '<path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2"></path><path d="M15 18H9"></path><path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14"></path><circle cx="17" cy="18" r="2"></circle><circle cx="7" cy="18" r="2"></circle>',
|
|
692
|
+
Part: '<path d="M11 10.27 7 3.34"></path><path d="m11 13.73-4 6.93"></path><path d="M12 22v-2"></path><path d="M12 2v2"></path><path d="M14 12h8"></path><path d="m17 20.66-1-1.73"></path><path d="m17 3.34-1 1.73"></path><path d="M2 12h2"></path><path d="m20.66 17-1.73-1"></path><path d="m20.66 7-1.73 1"></path><path d="m3.34 17 1.73-1"></path><path d="m3.34 7 1.73 1"></path><circle cx="12" cy="12" r="2"></circle><circle cx="12" cy="12" r="8"></circle>',
|
|
693
|
+
PurchaseOrder: '<circle cx="8" cy="21" r="1"></circle><circle cx="19" cy="21" r="1"></circle><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"></path>',
|
|
694
|
+
PpmContract: '<path d="m18.226 5.226-2.52-2.52A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.351"></path><path d="M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z"></path><path d="M8 18h1"></path>',
|
|
695
|
+
Note: '<path d="M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z"></path><path d="M15 3v5a1 1 0 0 0 1 1h5"></path>',
|
|
696
|
+
Organization: '<path d="M12 10h.01"></path><path d="M12 14h.01"></path><path d="M12 6h.01"></path><path d="M16 10h.01"></path><path d="M16 14h.01"></path><path d="M16 6h.01"></path><path d="M8 10h.01"></path><path d="M8 14h.01"></path><path d="M8 6h.01"></path><path d="M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"></path><rect x="4" y="2" width="16" height="20" rx="2"></rect>',
|
|
697
|
+
Person: '<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle>',
|
|
698
|
+
UserProfile: '<path d="M16 10h2"></path><path d="M16 14h2"></path><path d="M6.17 15a3 3 0 0 1 5.66 0"></path><circle cx="9" cy="11" r="2"></circle><rect x="2" y="5" width="20" height="14" rx="2"></rect>',
|
|
699
|
+
Preference: '<path d="M10 5H3"></path><path d="M12 19H3"></path><path d="M14 3v4"></path><path d="M16 17v4"></path><path d="M21 12h-9"></path><path d="M21 19h-5"></path><path d="M21 5h-7"></path><path d="M8 10v4"></path><path d="M8 12H3"></path>',
|
|
700
|
+
AdminUser: '<path d="M10 15H6a4 4 0 0 0-4 4v2"></path><path d="m14.305 16.53.923-.382"></path><path d="m15.228 13.852-.923-.383"></path><path d="m16.852 12.228-.383-.923"></path><path d="m16.852 17.772-.383.924"></path><path d="m19.148 12.228.383-.923"></path><path d="m19.53 18.696-.382-.924"></path><path d="m20.772 13.852.924-.383"></path><path d="m20.772 16.148.924.383"></path><circle cx="18" cy="15" r="3"></circle><circle cx="9" cy="7" r="4"></circle>',
|
|
701
|
+
AccessGrant: '<path d="M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z"></path><circle cx="16.5" cy="7.5" r=".5" fill="currentColor"></circle>',
|
|
702
|
+
KnowledgeDocument: '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"></path><path d="M14 2v5a1 1 0 0 0 1 1h5"></path><path d="M10 9H8"></path><path d="M16 13H8"></path><path d="M16 17H8"></path>',
|
|
703
|
+
ConversationArchive: '<rect width="20" height="5" x="2" y="3" rx="1"></rect><path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"></path><path d="M10 12h4"></path>',
|
|
704
|
+
Section: '<rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="M21 9H3"></path><path d="M21 15H3"></path>',
|
|
705
|
+
Chunk: '<path d="M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z"></path>',
|
|
706
|
+
DigitalDocument: '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"></path><path d="M14 2v5a1 1 0 0 0 1 1h5"></path>',
|
|
707
|
+
CreativeWork: '<path d="M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z"></path><path d="m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18"></path><path d="m2.3 2.3 7.286 7.286"></path><circle cx="11" cy="11" r="2"></circle>',
|
|
708
|
+
Question: '<circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><path d="M12 17h.01"></path>',
|
|
709
|
+
FAQPage: '<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"></path><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><path d="M12 17h.01"></path>',
|
|
710
|
+
DefinedTerm: '<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"></path><path d="m8 13 4-7 4 7"></path><path d="M9.1 11h5.7"></path>',
|
|
711
|
+
Review: '<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"></path>',
|
|
712
|
+
ImageObject: '<rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path>',
|
|
713
|
+
Conversation: '<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"></path>',
|
|
714
|
+
AdminConversation: '<path d="M22 8.5V5a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v16.286a.71.71 0 0 0 1.212.502l2.202-2.202A2 2 0 0 1 6.828 19H10"></path><path d="M20 15v-2a2 2 0 0 0-4 0v2"></path><rect x="14" y="15" width="8" height="5" rx="1"></rect>',
|
|
715
|
+
PublicConversation: '<path d="M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"></path><path d="M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1"></path>',
|
|
716
|
+
Message: '<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"></path>',
|
|
717
|
+
UserMessage: '<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"></path>',
|
|
718
|
+
AssistantMessage: '<path d="M12 8V4H8"></path><rect width="16" height="12" x="4" y="8" rx="2"></rect><path d="M2 14h2"></path><path d="M20 14h2"></path><path d="M15 13v2"></path><path d="M9 13v2"></path>',
|
|
719
|
+
ToolCall: '<path d="M12 19h8"></path><path d="m4 17 6-6-6-6"></path>',
|
|
720
|
+
Task: '<rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="m9 12 2 2 4-4"></path>',
|
|
721
|
+
Project: '<path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"></path><path d="M8 10v4"></path><path d="M12 10v2"></path><path d="M16 10v6"></path>',
|
|
722
|
+
Event: '<path d="M8 2v4"></path><path d="M16 2v4"></path><rect width="18" height="18" x="3" y="4" rx="2"></rect><path d="M3 10h18"></path>',
|
|
723
|
+
Workflow: '<rect width="8" height="8" x="3" y="3" rx="2"></rect><path d="M7 11v4a2 2 0 0 0 2 2h4"></path><rect width="8" height="8" x="13" y="13" rx="2"></rect>',
|
|
724
|
+
WorkflowStep: '<path d="M13 5h8"></path><path d="M13 12h8"></path><path d="M13 19h8"></path><path d="m3 17 2 2 4-4"></path><path d="m3 7 2 2 4-4"></path>',
|
|
725
|
+
WorkflowRun: '<path d="M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z"></path><circle cx="12" cy="12" r="10"></circle>',
|
|
726
|
+
StepResult: '<circle cx="12" cy="12" r="10"></circle><path d="m9 12 2 2 4-4"></path>',
|
|
727
|
+
Email: '<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"></path><rect x="2" y="4" width="20" height="16" rx="2"></rect>',
|
|
728
|
+
EmailAccount: '<circle cx="12" cy="12" r="4"></circle><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"></path>',
|
|
729
|
+
Agent: '<path d="M12 8V4H8"></path><rect width="16" height="12" x="4" y="8" rx="2"></rect><path d="M2 14h2"></path><path d="M20 14h2"></path><path d="M15 13v2"></path><path d="M9 13v2"></path>',
|
|
730
|
+
Objective: '<circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="6"></circle><circle cx="12" cy="12" r="2"></circle>',
|
|
731
|
+
KeyResult: '<path d="M16 7h6v6"></path><path d="m22 7-8.5 8.5-5-5L2 17"></path>',
|
|
732
|
+
Decision: '<circle cx="12" cy="18" r="3"></circle><circle cx="6" cy="6" r="3"></circle><circle cx="18" cy="6" r="3"></circle><path d="M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"></path><path d="M12 12v3"></path>',
|
|
733
|
+
Risk: '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"></path><path d="M12 9v4"></path><path d="M12 17h.01"></path>',
|
|
734
|
+
Source: '<path d="M12 7v14"></path><path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"></path>',
|
|
735
|
+
Finding: '<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"></path><path d="M9 18h6"></path><path d="M10 22h4"></path>',
|
|
736
|
+
Hypothesis: '<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"></path><path d="M6.453 15h11.094"></path><path d="M8.5 2h7"></path>'
|
|
737
|
+
};
|
|
738
|
+
function iconForLabel2(label) {
|
|
739
|
+
return Object.prototype.hasOwnProperty.call(LABEL_ICONS, label) ? LABEL_ICONS[label] : null;
|
|
740
|
+
}
|
|
741
|
+
function nodeImageDataUri2(label) {
|
|
742
|
+
const inner = iconForLabel2(label);
|
|
743
|
+
if (inner === null)
|
|
744
|
+
return null;
|
|
745
|
+
const colour = colourForLabel2(label);
|
|
746
|
+
const svg = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='12' fill='" + colour + "'/><g transform='translate(4.8 4.8) scale(0.6)' fill='none' stroke='#fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' color='#fff'>" + inner + "</g></svg>";
|
|
747
|
+
return "data:image/svg+xml," + encodeURIComponent(svg);
|
|
748
|
+
}
|
|
672
749
|
function resolveNodeColour2(labels) {
|
|
673
750
|
const displayLabel = pickDisplayLabel2(labels);
|
|
674
751
|
const colour = displayLabel ? colourForLabel2(displayLabel) : exports.FALLBACK_LABEL_COLOUR;
|
|
@@ -2590,6 +2667,23 @@ function stripWhatsAppPrefix(value) {
|
|
|
2590
2667
|
if (candidate === before) return candidate;
|
|
2591
2668
|
}
|
|
2592
2669
|
}
|
|
2670
|
+
function normalizeTarget(value) {
|
|
2671
|
+
const candidate = stripWhatsAppPrefix(value);
|
|
2672
|
+
if (!candidate) return null;
|
|
2673
|
+
if (isGroupJid(candidate)) {
|
|
2674
|
+
const localPart = candidate.slice(0, candidate.length - "@g.us".length);
|
|
2675
|
+
return `${localPart}@g.us`;
|
|
2676
|
+
}
|
|
2677
|
+
if (isUserJid(candidate)) {
|
|
2678
|
+
const phone = jidToE164(candidate);
|
|
2679
|
+
if (!phone) return null;
|
|
2680
|
+
const normalized2 = normalizeE164(phone);
|
|
2681
|
+
return normalized2.length > 1 ? normalized2 : null;
|
|
2682
|
+
}
|
|
2683
|
+
if (candidate.includes("@")) return null;
|
|
2684
|
+
const normalized = normalizeE164(candidate);
|
|
2685
|
+
return normalized.length > 1 ? normalized : null;
|
|
2686
|
+
}
|
|
2593
2687
|
function phonesMatch(a, b) {
|
|
2594
2688
|
const na = normalizeE164(a);
|
|
2595
2689
|
const nb = normalizeE164(b);
|
|
@@ -8313,26 +8407,30 @@ app2.post("/send-admin", async (c) => {
|
|
|
8313
8407
|
return c.json({ error: "No account configured." }, 500);
|
|
8314
8408
|
}
|
|
8315
8409
|
const adminPhones = readAdminPhones(account.accountDir);
|
|
8316
|
-
|
|
8410
|
+
const isAdmin = isAdminPhone(phone, adminPhones);
|
|
8411
|
+
const managerMatch = isAdmin ? null : managedAccountFor(readAccountManagers(account.accountDir), phone);
|
|
8412
|
+
if (!isAdmin && !managerMatch) {
|
|
8317
8413
|
console.error(`[whatsapp:outbound] op=send-refused reason=not-admin-phone to=${phone}`);
|
|
8318
8414
|
return c.json(
|
|
8319
|
-
{ error: `Refused: ${phone} is not
|
|
8415
|
+
{ error: `Refused: ${phone} is not a registered admin phone or account manager for this install. Only a number registered with whatsapp-config (add-admin-phone or add-account-manager) can receive an agent-initiated send.` },
|
|
8320
8416
|
403
|
|
8321
8417
|
);
|
|
8322
8418
|
}
|
|
8323
|
-
const
|
|
8324
|
-
const
|
|
8419
|
+
const via = isAdmin ? "admin-phone" : "account-manager";
|
|
8420
|
+
const houseAccountId = account.accountId;
|
|
8421
|
+
const res = resolveSocket(houseAccountId);
|
|
8325
8422
|
if (!res.ok) {
|
|
8326
8423
|
if (res.reason === "key-miss") {
|
|
8327
|
-
console.error(`[whatsapp:outbound] op=socket-key-miss accountId=${
|
|
8328
|
-
return c.json({ error: `No WhatsApp socket is registered for account "${
|
|
8424
|
+
console.error(`[whatsapp:outbound] op=socket-key-miss accountId=${houseAccountId} presentKeys=${res.presentKeys.join(",") || "none"}`);
|
|
8425
|
+
return c.json({ error: `No WhatsApp socket is registered for account "${houseAccountId}" (present: ${res.presentKeys.join(", ") || "none"}). This is an account-keying mismatch, not a dropped connection.` }, 503);
|
|
8329
8426
|
}
|
|
8330
|
-
return c.json({ error: `WhatsApp account "${
|
|
8427
|
+
return c.json({ error: `WhatsApp account "${houseAccountId}" is registered but its socket is disconnected.` }, 503);
|
|
8331
8428
|
}
|
|
8332
8429
|
const result = await sendTextMessage(res.sock, normalizeE164(phone), text, { accountId: res.accountId });
|
|
8333
8430
|
if (!result.success) {
|
|
8334
8431
|
return c.json({ error: result.error ?? "send failed" }, 500);
|
|
8335
8432
|
}
|
|
8433
|
+
console.error(`[whatsapp:outbound] op=send-admin-ok via=${via} to=${phone}`);
|
|
8336
8434
|
return c.json({ success: true, messageId: result.messageId });
|
|
8337
8435
|
} catch (err) {
|
|
8338
8436
|
console.error(`${TAG21} send-admin error: ${String(err)}`);
|
|
@@ -23513,12 +23611,16 @@ var WaGateway = class {
|
|
|
23513
23611
|
}
|
|
23514
23612
|
/** Handle one inbound admin WhatsApp message. */
|
|
23515
23613
|
async handleInbound(input) {
|
|
23614
|
+
const senderId = normalizeTarget(input.senderId) ?? input.senderId;
|
|
23615
|
+
if (senderId !== input.senderId) {
|
|
23616
|
+
console.error(`[whatsapp-native] op=sender-key raw=${input.senderId} canonical=${senderId}`);
|
|
23617
|
+
}
|
|
23516
23618
|
if (input.passive) {
|
|
23517
23619
|
const msgId = `wa-${++this.seq}`;
|
|
23518
23620
|
await this.deps.ensureChannelSession({
|
|
23519
23621
|
accountId: input.accountId,
|
|
23520
23622
|
effectiveAccountId: input.effectiveAccountId,
|
|
23521
|
-
senderId
|
|
23623
|
+
senderId,
|
|
23522
23624
|
// agentType stays 'admin'; the constraint rides the passive flag.
|
|
23523
23625
|
role: "admin",
|
|
23524
23626
|
personId: null,
|
|
@@ -23532,13 +23634,13 @@ var WaGateway = class {
|
|
|
23532
23634
|
return;
|
|
23533
23635
|
}
|
|
23534
23636
|
const bytes = Buffer.byteLength(input.text, "utf8");
|
|
23535
|
-
const hadSubscriber = this.hub.hasSubscriber(
|
|
23536
|
-
const willDeliverNow = this.hub.isReady(
|
|
23637
|
+
const hadSubscriber = this.hub.hasSubscriber(senderId);
|
|
23638
|
+
const willDeliverNow = this.hub.isReady(senderId);
|
|
23537
23639
|
const openable = input.media.filter((m) => m.type !== "audio");
|
|
23538
23640
|
const mediaField = openable.length > 0 ? `media=${openable.map((m) => m.type).join(",")} mediaPaths=${openable.map((m) => m.path).join(",")}` : input.media.some((m) => m.type === "audio") ? "media=audio mediaPath=transcribed" : "media=none";
|
|
23539
23641
|
const source = input.source ?? "user";
|
|
23540
|
-
this.replies.set(
|
|
23541
|
-
this.docContexts.set(
|
|
23642
|
+
this.replies.set(senderId, input.reply);
|
|
23643
|
+
this.docContexts.set(senderId, { accountId: input.accountId, maxyAccountId: input.effectiveAccountId });
|
|
23542
23644
|
let standingRules;
|
|
23543
23645
|
if (this.deps.fetchStandingRules) {
|
|
23544
23646
|
const res = await this.deps.fetchStandingRules(input.effectiveAccountId);
|
|
@@ -23551,7 +23653,7 @@ var WaGateway = class {
|
|
|
23551
23653
|
}
|
|
23552
23654
|
this.hub.deliver(
|
|
23553
23655
|
{
|
|
23554
|
-
senderId
|
|
23656
|
+
senderId,
|
|
23555
23657
|
text: input.text,
|
|
23556
23658
|
waMessageId: `wa-${++this.seq}`,
|
|
23557
23659
|
media: input.media,
|
|
@@ -23562,21 +23664,21 @@ var WaGateway = class {
|
|
|
23562
23664
|
Date.now()
|
|
23563
23665
|
);
|
|
23564
23666
|
console.error(
|
|
23565
|
-
`[whatsapp-native] op=inbound senderId=${
|
|
23667
|
+
`[whatsapp-native] op=inbound senderId=${senderId} accountId=${input.accountId} bytes=${bytes} ${mediaField} source=${source} delivery=${willDeliverNow ? "immediate" : "queued"}`
|
|
23566
23668
|
);
|
|
23567
|
-
if (source === "schedule" && (hadSubscriber || this.spawning.has(
|
|
23669
|
+
if (source === "schedule" && (hadSubscriber || this.spawning.has(senderId))) {
|
|
23568
23670
|
console.error(
|
|
23569
|
-
`[whatsapp-native] op=coalesced-onto-live-session eventId=${input.scheduleProvenance?.eventId ?? "-"} senderId=${
|
|
23671
|
+
`[whatsapp-native] op=coalesced-onto-live-session eventId=${input.scheduleProvenance?.eventId ?? "-"} senderId=${senderId} droppedSeat=${input.scheduledSessionId ?? "-"} reason=${hadSubscriber ? "live-subscriber" : "spawn-in-flight"}`
|
|
23570
23672
|
);
|
|
23571
23673
|
}
|
|
23572
|
-
if (!hadSubscriber && !this.spawning.has(
|
|
23573
|
-
this.spawning.add(
|
|
23574
|
-
console.error(`[whatsapp-native] op=spawn-trigger senderId=${
|
|
23674
|
+
if (!hadSubscriber && !this.spawning.has(senderId)) {
|
|
23675
|
+
this.spawning.add(senderId);
|
|
23676
|
+
console.error(`[whatsapp-native] op=spawn-trigger senderId=${senderId}`);
|
|
23575
23677
|
try {
|
|
23576
23678
|
await this.deps.ensureChannelSession({
|
|
23577
23679
|
accountId: input.accountId,
|
|
23578
23680
|
effectiveAccountId: input.effectiveAccountId,
|
|
23579
|
-
senderId
|
|
23681
|
+
senderId,
|
|
23580
23682
|
role: input.role ?? "admin",
|
|
23581
23683
|
personId: input.personId ?? null,
|
|
23582
23684
|
gatewayUrl: this.deps.gatewayUrl,
|
|
@@ -23588,7 +23690,7 @@ var WaGateway = class {
|
|
|
23588
23690
|
ownerSelfPhone: input.ownerSelfPhone
|
|
23589
23691
|
});
|
|
23590
23692
|
} finally {
|
|
23591
|
-
this.spawning.delete(
|
|
23693
|
+
this.spawning.delete(senderId);
|
|
23592
23694
|
}
|
|
23593
23695
|
}
|
|
23594
23696
|
}
|
|
@@ -23607,6 +23709,31 @@ var WaGateway = class {
|
|
|
23607
23709
|
}
|
|
23608
23710
|
};
|
|
23609
23711
|
|
|
23712
|
+
// app/lib/whatsapp/gateway/duplicate-sender-audit.ts
|
|
23713
|
+
function findDuplicateSenderGroups(records) {
|
|
23714
|
+
const buckets2 = /* @__PURE__ */ new Map();
|
|
23715
|
+
for (const r of records) {
|
|
23716
|
+
if (r.channel !== "whatsapp" || !r.senderId) continue;
|
|
23717
|
+
const canonical = normalizeTarget(r.senderId);
|
|
23718
|
+
if (!canonical) continue;
|
|
23719
|
+
const key = `${r.accountId ?? ""} ${canonical}`;
|
|
23720
|
+
let group = buckets2.get(key);
|
|
23721
|
+
if (!group) {
|
|
23722
|
+
group = { accountId: r.accountId, canonical, ids: [] };
|
|
23723
|
+
buckets2.set(key, group);
|
|
23724
|
+
}
|
|
23725
|
+
group.ids.push(r.sessionId);
|
|
23726
|
+
}
|
|
23727
|
+
return [...buckets2.values()].filter((g) => g.ids.length > 1).map((g) => ({ ...g, ids: [...g.ids].sort() })).sort((a, b) => a.canonical.localeCompare(b.canonical));
|
|
23728
|
+
}
|
|
23729
|
+
function logDuplicateSenderGroups(groups) {
|
|
23730
|
+
for (const g of groups) {
|
|
23731
|
+
console.error(
|
|
23732
|
+
`[whatsapp-native] op=duplicate-sender-sessions account=${g.accountId ?? "-"} canonical=${g.canonical} count=${g.ids.length} ids=${g.ids.join(",")}`
|
|
23733
|
+
);
|
|
23734
|
+
}
|
|
23735
|
+
}
|
|
23736
|
+
|
|
23610
23737
|
// app/lib/whatsapp/gateway/spawn-request.ts
|
|
23611
23738
|
function buildWaSpawnRequest(input) {
|
|
23612
23739
|
const personId = input.role === "public" && input.personId ? input.personId : void 0;
|
|
@@ -25829,6 +25956,26 @@ var waGateway = new WaGateway({
|
|
|
25829
25956
|
});
|
|
25830
25957
|
app62.route("/", waGateway.routes());
|
|
25831
25958
|
waGateway.startSweeper();
|
|
25959
|
+
function runDuplicateSenderAudit() {
|
|
25960
|
+
try {
|
|
25961
|
+
const configDir2 = process.env.CLAUDE_CONFIG_DIR;
|
|
25962
|
+
if (!configDir2) return;
|
|
25963
|
+
const projectsRoot = join38(configDir2, "projects");
|
|
25964
|
+
const records = [];
|
|
25965
|
+
for (const { path: jsonlPath, isSubagent, archived } of enumerateJsonls(projectsRoot)) {
|
|
25966
|
+
if (isSubagent || archived) continue;
|
|
25967
|
+
const sessionId = jsonlPath.slice(jsonlPath.lastIndexOf("/") + 1).replace(/\.jsonl$/, "");
|
|
25968
|
+
const metaPath = jsonlPath.replace(/\.jsonl$/, ".meta.json");
|
|
25969
|
+
const meta = readSidecarMeta(metaPath);
|
|
25970
|
+
records.push({ sessionId, channel: meta.channel, senderId: meta.senderId, accountId: meta.accountId });
|
|
25971
|
+
}
|
|
25972
|
+
logDuplicateSenderGroups(findDuplicateSenderGroups(records));
|
|
25973
|
+
} catch (err) {
|
|
25974
|
+
console.error(`[whatsapp-native] op=duplicate-sender-audit-error error=${err instanceof Error ? err.message : String(err)}`);
|
|
25975
|
+
}
|
|
25976
|
+
}
|
|
25977
|
+
setTimeout(runDuplicateSenderAudit, 0).unref();
|
|
25978
|
+
setInterval(runDuplicateSenderAudit, 15 * 6e4).unref();
|
|
25832
25979
|
var webchatGateway = new WebchatGateway({
|
|
25833
25980
|
fetchStandingRules: fetchAccountStandingRules,
|
|
25834
25981
|
gatewayUrl: webchatGatewayUrl(),
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-Ck5AOu5v.js";import{E as t,T as n,_ as r,a as i,b as a,d as o,g as s,i as c,l,m as u,n as d,o as f,p,s as m,t as h,u as g,x as ee}from"./useSubAccountSwitcher-DF6bohQA.js";import{c as te,d as ne,f as _,h as re,m as ie,o as ae,p as oe,r as se,s as v,t as ce,u as y}from"./useSelectionMode-UOUVnP9B.js";async function b(){try{let e=await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`logout`})});return e.ok?(await e.json().catch(()=>({})))?.logged_out===!0:(console.error(`[admin-ui] claude-logout http-status=${e.status}`),!1)}catch(e){return console.error(`[admin-ui] claude-logout fetch failed: ${e instanceof Error?e.message:String(e)}`),!1}}var x=e(t(),1),S=ee(),C={sm:14,md:16,lg:18},le={sm:30,md:38,lg:46};function w({variant:e=`primary`,size:t=`md`,icon:n,iconPosition:r=`leading`,loading:i=!1,fullWidth:a=!1,disabled:o=!1,type:s=`button`,onClick:c,"aria-label":l,style:u,className:d,children:f}){let p=[`btn`,`btn--${e}`,t===`md`?``:`btn--${t}`,a?`btn--full`:``,d].filter(Boolean).join(` `),m=C[t],h={...e===`send`?{width:le[t],height:le[t]}:{},...u},g=Object.keys(h).length>0;return(0,S.jsxs)(`button`,{type:s,className:p,disabled:i||o,onClick:c,"aria-label":l,style:g?h:void 0,children:[(0,S.jsxs)(`span`,{className:`btn__content`,style:{visibility:i?`hidden`:`visible`},children:[n&&r===`leading`&&(0,S.jsx)(n,{size:m}),f,n&&r===`trailing`&&(0,S.jsx)(n,{size:m})]}),i&&(0,S.jsx)(`span`,{className:`btn__spinner`,children:`✱`})]})}var T=s(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),E=s(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ue=s(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),de=s(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),D=s(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),fe=s(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),pe=s(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),O=s(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),me=s(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),he=s(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),k=`maxy-shell-side-px`;function A(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function j(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-A());return Math.min(Math.max(e,248),n)}function ge(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(k);if(!e)return 264;let t=parseInt(e,10);if(!Number.isFinite(t))return console.warn(`[admin-ui] sidebar-width-parse-failed stored=${JSON.stringify(e)} fallback=264`),264;if(t>=248)return j(t)}catch{}return 264}function M({targetSelector:e=`.platform`}){let t=(0,x.useRef)(null),[n,r]=(0,x.useState)(()=>ge()),i=(0,x.useRef)(n);(0,x.useLayoutEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--side-px`,`${n}px`),i.current=n)},[n,e]);let a=(0,x.useCallback)(()=>{r(e=>{let t=j(e);return t===e?e:t})},[]);(0,x.useEffect)(()=>{a(),window.addEventListener(`resize`,a);let t=document.querySelector(e),n=null;return t instanceof HTMLElement&&(n=new MutationObserver(a),n.observe(t,{attributes:!0,attributeFilter:[`data-artefact`,`class`]})),()=>{window.removeEventListener(`resize`,a),n?.disconnect()}},[a,e]);let o=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let a=!1,o=e=>{a=!0,r(j(Math.round(e.clientX)))},s=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),!a)return;let t=i.current;try{window.localStorage.setItem(k,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=j(264);r(e);try{window.localStorage.removeItem(k)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,S.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var _e=n();function ve({anchorRef:e,onClose:t,className:n,role:r,ariaLabel:i,children:a}){let o=(0,x.useRef)(null),[s,c]=(0,x.useState)({position:`fixed`,visibility:`hidden`}),l=(0,x.useCallback)(()=>{let t=e.current,n=o.current;if(!t||!n)return;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=r.right-i.width;a<4&&(a=4);let s=window.innerHeight-r.bottom<i.height+8&&r.top>i.height+8?r.top-i.height:r.bottom;c({position:`fixed`,left:a,top:s,visibility:`visible`})},[e]);return(0,x.useLayoutEffect)(()=>{if(l(),typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>l());return o.current&&e.observe(o.current),()=>e.disconnect()},[l]),(0,x.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()},r=n=>{let r=n.target;e.current?.contains(r)||o.current?.contains(r)||t()},i=n=>{let r=e.current;r&&n.target instanceof Node&&n.target.contains(r)&&t()},a=()=>t();return document.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r),window.addEventListener(`scroll`,i,!0),window.addEventListener(`resize`,a),()=>{document.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r),window.removeEventListener(`scroll`,i,!0),window.removeEventListener(`resize`,a)}},[e,t]),(0,_e.createPortal)((0,S.jsx)(`div`,{ref:o,className:n,role:r,"aria-label":i,style:s,children:a}),document.body)}function ye({actions:e,disabled:t}){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(null),o=(0,x.useRef)(null),s=(0,x.useCallback)(()=>{r(!1),a(null)},[]);return(0,S.jsxs)(`div`,{className:`conv-actions`,children:[(0,S.jsx)(`button`,{ref:o,type:`button`,className:`conv-action conv-actions-overflow`,onClick:()=>r(e=>!e),disabled:t,"aria-haspopup":`menu`,"aria-expanded":n,"aria-label":`Session actions`,title:`Session actions`,children:(0,S.jsx)(g,{size:12})}),n&&(0,S.jsx)(ve,{anchorRef:o,onClose:s,className:`conv-actions-menu`,role:`menu`,children:e.map(e=>e.panel?(0,S.jsxs)(`div`,{className:`conv-actions-menu-disclosure`,children:[(0,S.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-haspopup":`dialog`,"aria-expanded":i===e.key,disabled:t,onClick:()=>a(t=>t===e.key?null:e.key),children:[e.icon,(0,S.jsx)(`span`,{children:e.menuLabel})]}),i===e.key&&(0,S.jsx)(`div`,{className:`conv-actions-menu-panel`,children:e.panel()})]},e.key):(0,S.jsxs)(`button`,{type:`button`,role:`menuitem`,className:e.danger?`conv-action-danger`:void 0,"aria-busy":e.busy,disabled:t,onClick:t=>{e.onClick?.(t),s()},children:[e.icon,(0,S.jsx)(`span`,{children:e.menuLabel})]},e.key))})]})}var N=`claude-opus-4-8[1m]`,be=`claude-sonnet-5`,P=`claude-haiku-4-5`,F={[N]:`Opus 4.8 (1M context)`,[be]:`Sonnet 5`,[P]:`Haiku 4.5`};function I(e){return F[e]??e}var xe=[N,be,P];function L(e){return e.replace(/\[1m\]$/,``)}function Se(e){return xe.find(t=>L(t)===L(e))??e}var R=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],z=[`low`,`medium`,`high`,`xhigh`];[...R],[...z],[...z];var B=[N,be,P],Ce={default:`Ask permissions`,acceptEdits:`Accept edits`,plan:`Plan mode`,auto:`Auto mode`,bypassPermissions:`Bypass permissions`},we=R.map(e=>({value:e,label:Ce[e]??e})),Te={low:`Low`,medium:`Medium`,high:`High`,xhigh:`Highest`},V=z.map(e=>({value:e,label:Te[e]??e}));function H(e){if(e){let t=B.find(t=>L(t)===L(e));if(t)return t}return N}function Ee({row:e,adminFetch:t,onError:n}){let[r,i]=(0,x.useState)(()=>H(e.model)),[a,s]=(0,x.useState)(``),[c,l]=(0,x.useState)(``),[u,d]=(0,x.useState)(!1),f=(0,x.useRef)(!1);(0,x.useEffect)(()=>{i(H(e.model))},[e.model]);let p=async()=>{if(!f.current){f.current=!0,d(!0);try{let i=await t(`/api/admin/session-reseat`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fromSessionId:e.sessionId,model:r,...a?{permissionMode:a}:{},...c?{effort:c}:{}})});if(!i.ok){n(`Could not reset ${e.title} (status ${i.status})`),console.error(`[admin-ui] dashboard-reseat-failed sessionId=${e.sessionId} status=${i.status}`),f.current=!1,d(!1);return}let o=await i.json().catch(()=>({}));o.target?window.location.assign(o.target):(n(`Reset of ${e.title} returned no target`),f.current=!1,d(!1))}catch(t){n(`Could not reset ${e.title} (network error)`),console.error(`[admin-ui] dashboard-reseat-failed sessionId=${e.sessionId} error=${t instanceof Error?t.message:String(t)}`),f.current=!1,d(!1)}}};return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`label`,{className:`reseat-field`,children:[(0,S.jsx)(`span`,{children:`Model`}),(0,S.jsx)(`select`,{"data-kind":`model`,value:r,disabled:u,onChange:e=>i(e.target.value),children:B.map(e=>(0,S.jsx)(`option`,{value:e,children:I(e)},e))})]}),(0,S.jsxs)(`label`,{className:`reseat-field`,children:[(0,S.jsx)(`span`,{children:`Mode`}),(0,S.jsxs)(`select`,{"data-kind":`mode`,value:a,disabled:u,onChange:e=>s(e.target.value),children:[(0,S.jsx)(`option`,{value:``,children:`Keep current`}),we.map(e=>(0,S.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,S.jsxs)(`label`,{className:`reseat-field`,children:[(0,S.jsx)(`span`,{children:`Effort`}),(0,S.jsxs)(`select`,{"data-kind":`effort`,value:c,disabled:u,onChange:e=>l(e.target.value),children:[(0,S.jsx)(`option`,{value:``,children:`Keep current`}),V.map(e=>(0,S.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,S.jsx)(`button`,{type:`button`,className:`reseat-apply`,disabled:u,"aria-busy":u,onClick:()=>void p(),children:u?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o,{size:12,className:`spin`,"aria-hidden":`true`}),`Resetting…`]}):`Reset`})]})}function De(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;return n>0?`${t}m ${n}s`:`${t}m`}function U(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Oe({target:e,onConfirm:t,onCancel:n}){return e?(0,S.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,S.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Confirm delete session`,children:[(0,S.jsxs)(`div`,{className:`claude-info-header`,children:[(0,S.jsx)(`span`,{children:`Delete this conversation?`}),(0,S.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,S.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[`This permanently removes the transcript. It is not moved to Archive and cannot be recovered.`,e.live&&(0,S.jsx)(`div`,{style:{marginTop:`8px`},children:`This session is running; deleting stops it first.`})]}),(0,S.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,S.jsx)(w,{variant:`danger`,size:`sm`,style:{flex:1},onClick:t,children:`Delete`}),(0,S.jsx)(w,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:n,children:`Cancel`})]})]})}):null}var ke=`auth-refresh-failed`;function Ae({error:e,onClose:t}){if(!e)return null;let n=e.reason===ke,r=n?`Claude sign-in expired`:`Session didn’t open`,i=n?`Your claude.ai login has expired. Re-authenticate to resume sessions.`:`The session did not bind within 60 seconds, so there is no live conversation to open.`;return(0,S.jsx)(`div`,{className:`claude-info-overlay`,onClick:t,children:(0,S.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Session could not be opened`,children:[(0,S.jsxs)(`div`,{className:`claude-info-header`,children:[(0,S.jsx)(`span`,{children:r}),(0,S.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:`✕`})]}),(0,S.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[i,(0,S.jsxs)(`div`,{className:`claude-info-row`,style:{marginTop:`8px`},children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Reason`}),(0,S.jsx)(`span`,{className:`claude-info-value`,children:e.reason})]}),e.sessionId&&(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,S.jsxs)(`span`,{className:`claude-info-value`,children:[e.sessionId.slice(0,8),`…`]})]})]})]})})}function je(e){let{show:t,onClose:n,claudeInfo:r,messages:i,sessionElapsed:a,sessionId:o,cacheKey:s}=e,[c,l]=(0,x.useState)(null);if(!t)return null;let u=i.flatMap(e=>e.events?.filter(e=>e.type===`usage`)??[]),d=u.at(-1),f=d?.peak_request_pct==null?d?.context_window?Math.round((d.input_tokens+d.cache_creation_tokens+d.cache_read_tokens)/d.context_window*100):0:Math.round(d.peak_request_pct*100),p=u.reduce((e,t)=>e+t.input_tokens+t.cache_creation_tokens+t.cache_read_tokens+t.output_tokens,0),m=i.flatMap(e=>e.events?.filter(e=>e.type===`rate_limit`)??[]).at(-1),h=u.reduce((e,t)=>e+(t.total_cost_usd??0),0),g=r?.account?.subscriptionType,ee=e=>{let t=e*1e3-Date.now();if(t<=0)return`now`;let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h ${r}m`:`${r}m`};return(0,S.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,S.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`claude-info-header`,children:[(0,S.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`claude-info-icon`}),(0,S.jsx)(`span`,{children:`Claude Code`}),(0,S.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,S.jsxs)(`div`,{className:`claude-info-section`,children:[(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Version`}),(0,S.jsx)(`span`,{className:`claude-info-value`,children:r?r.version:`…`})]}),(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Email`}),(0,S.jsx)(`span`,{className:`claude-info-value`,children:r?.account?.email??`…`})]})]}),(g||m||h>0)&&(0,S.jsxs)(`div`,{className:`claude-info-section`,children:[g&&(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Plan`}),(0,S.jsx)(`span`,{className:`claude-info-value`,style:{textTransform:`capitalize`},children:g})]}),m&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Usage`}),(0,S.jsxs)(`span`,{className:`claude-info-value`,children:[Math.round(m.utilization*100),`%`]})]}),(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Resets in`}),(0,S.jsx)(`span`,{className:`claude-info-value`,children:ee(m.resetsAt)})]}),m.isUsingOverage&&(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Overage`}),(0,S.jsx)(`span`,{className:`claude-info-value`,children:`Active`})]})]}),h>0&&(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Session cost`}),(0,S.jsxs)(`span`,{className:`claude-info-value`,children:[`$`,h<.01?h.toFixed(4):h.toFixed(2)]})]})]}),(0,S.jsxs)(`div`,{className:`claude-info-section`,children:[(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Model`}),(0,S.jsx)(`span`,{className:`claude-info-value`,children:r?.model??`…`})]}),(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Context used`}),(0,S.jsx)(`span`,{className:`claude-info-value`,children:f>0?`${f}%`:`—`})]}),(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Tokens`}),(0,S.jsx)(`span`,{className:`claude-info-value`,children:p>0?U(p):`—`})]}),(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,S.jsx)(`span`,{className:`claude-info-value`,children:De(a)})]}),(o||s)&&(()=>{let e=o??s??``;return(0,S.jsxs)(`div`,{className:`claude-info-row`,children:[(0,S.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,S.jsx)(`button`,{type:`button`,className:`claude-info-value claude-info-id-copy`,title:`${e} (${o?`flushed`:`pre-flush`}) — click to copy`,onClick:async()=>{l(await ce(e)?`copied`:`failed`),setTimeout(()=>l(null),1200)},children:c===`copied`?`copied ✓`:c===`failed`?`copy failed ✕`:`${e.slice(0,8)}…`})]})})()]})]})})}function Me({open:e,onConnect:t,onClose:n}){return e?(0,S.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,S.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Claude is not connected`,children:[(0,S.jsxs)(`div`,{className:`claude-info-header`,children:[(0,S.jsx)(`span`,{children:`Claude isn’t connected`}),(0,S.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,S.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`,display:`flex`,flexDirection:`column`,gap:`10px`},children:[(0,S.jsx)(`span`,{children:`This needs Claude, which is currently disconnected. Connect to continue — the rest of the dashboard stays available either way.`}),(0,S.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,S.jsx)(w,{variant:`primary`,size:`sm`,onClick:t,children:`Connect Claude`}),(0,S.jsx)(`button`,{type:`button`,className:`claude-info-close`,style:{fontSize:`11px`},onClick:n,children:`Not now`})]})]})]})}):null}function W(e){let t=Math.round(e/6e4),n=Math.floor(t/60),r=t%60;return`${n}h ${String(r).padStart(2,`0`)}m`}function Ne(e){return e.activeMs.thinking+e.activeMs.messaging+e.activeMs.toolUse}function G(e){return e.toLocaleString(`en-GB`)}function K(e){return`£${e.toFixed(2)}`}function Pe(e){let t=[`Day`,`Active`,`Output tokens`,`Input tokens`,`Cache write`,`Cache read`,`Opus 4.8 (GBP)`,`Sonnet 4.6 (GBP)`],n=(e,t)=>[e,W(Ne(t)),String(t.tokens.output),String(t.tokens.input),String(t.tokens.cacheWrite),String(t.tokens.cacheRead),t.costGBP.opus.toFixed(2),t.costGBP.sonnet.toFixed(2)];return[t,...e.days.map(e=>n(e.date,e)),n(`TOTAL (${e.days.length} d)`,e.totals)].map(e=>e.join(`,`)).join(`
|
|
2
|
-
`)}function Fe({label:e,d:t,bold:n}){let r=n?`th`:`td`;return(0,S.jsxs)(`tr`,{className:n?`usage-total-row`:void 0,children:[(0,S.jsx)(r,{className:`usage-day`,children:e}),(0,S.jsx)(r,{children:W(Ne(t))}),(0,S.jsx)(r,{children:G(t.tokens.output)}),(0,S.jsx)(r,{children:G(t.tokens.input)}),(0,S.jsx)(r,{children:G(t.tokens.cacheWrite)}),(0,S.jsx)(r,{children:G(t.tokens.cacheRead)}),(0,S.jsx)(r,{children:K(t.costGBP.opus)}),(0,S.jsx)(r,{children:K(t.costGBP.sonnet)})]})}function Ie({show:e,onClose:t,sessionId:n,summary:r,loading:a,error:o}){if(!e)return null;let s=!!r&&r.days.length>0,c=()=>{if(!r)return;let e=new Blob([Pe(r)],{type:`text/csv;charset=utf-8`}),t=URL.createObjectURL(e),i=document.createElement(`a`);i.href=t,i.download=`usage-${n?n.slice(0,8):`session`}.csv`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(t)};return(0,S.jsx)(`div`,{className:`claude-info-overlay`,onClick:t,children:(0,S.jsxs)(`div`,{className:`claude-info-modal usage-modal`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Session usage and cost`,children:[(0,S.jsxs)(`div`,{className:`claude-info-header`,children:[(0,S.jsxs)(`span`,{children:[`Usage & cost`,n?` · ${n.slice(0,8)}`:``]}),s&&(0,S.jsx)(`button`,{className:`usage-download`,onClick:c,"aria-label":`Download as CSV`,title:`Download as CSV`,children:(0,S.jsx)(re,{size:14})}),(0,S.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:(0,S.jsx)(i,{size:14})})]}),(0,S.jsxs)(`div`,{className:`claude-info-section usage-body`,children:[a&&(0,S.jsx)(`div`,{className:`usage-note`,children:`Computing usage…`}),!a&&o&&(0,S.jsx)(`div`,{className:`usage-note usage-error`,children:o}),!a&&!o&&r&&r.days.length===0&&(0,S.jsx)(`div`,{className:`usage-note`,children:`No usage recorded for this session yet.`}),!a&&!o&&r&&r.days.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`usage-table-scroll`,children:(0,S.jsxs)(`table`,{className:`usage-table`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{className:`usage-day`,children:`Day`}),(0,S.jsx)(`th`,{children:`Active`}),(0,S.jsx)(`th`,{children:`Output tok`}),(0,S.jsx)(`th`,{children:`Input tok`}),(0,S.jsx)(`th`,{children:`Cache write`}),(0,S.jsx)(`th`,{children:`Cache read`}),(0,S.jsx)(`th`,{children:`Opus 4.8 (£)`}),(0,S.jsx)(`th`,{children:`Sonnet 4.6 (£)`})]})}),(0,S.jsxs)(`tbody`,{children:[r.days.map(e=>(0,S.jsx)(Fe,{label:e.date,d:e},e.date)),(0,S.jsx)(Fe,{label:`TOTAL (${r.days.length} d)`,d:r.totals,bold:!0})]})]})}),(0,S.jsxs)(`div`,{className:`usage-note usage-caveats`,children:[`Prices dated `,r.pricing.opusPriceDate,` · £/$ `,r.pricing.usdPerGbp,` · Sonnet tokenizer factor `,r.pricing.tokenizerFactor,`. Idle human-wait dominates the calendar span; cache-read tokens dominate cost; Sonnet is a tokenizer-adjusted estimate.`]})]})]})]})})}var Le=`https://claude.ai/code`,Re=200,ze=[500,1e3,1500,2e3,2500,3e3,3e3];function Be(e,t,n){if(e&&n.target)return{kind:`navigate`,url:n.target,sameOrigin:!0};let r=n.slug??n.bridgeSessionId??null;if(e&&r)return{kind:`navigate`,url:`${Le}/${r}`,sameOrigin:!1};let i=n.reason||n.error||`status ${t}`;return{kind:`error`,sessionId:n.sessionId??null,reason:i}}function Ve(e){if(!e)return``;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):``}function He(e){let{businessName:t,cacheKey:n,onConnectClaude:i,role:o,userName:s,userAvatar:d,onSelectProjects:h,onSelectPeople:g,onSelectTasks:ee,onSelectAgents:ce,onCloseMobileDrawer:b,collapsed:C,selectedWhatsappId:le,onSelectWhatsappConversation:w,initialWhatsappSurface:k=!1,onSelectData:A,onCloseData:j,initialDataSurface:ge=!1}=e,M=c(n),_e=(0,x.useCallback)(e=>({key:`reseat`,label:`Reset session ${e.title} (model, mode, effort)`,menuLabel:`Reset`,title:`Reset — move this session onto a chosen model, mode, and effort`,icon:(0,S.jsx)(me,{size:12}),panel:()=>(0,S.jsx)(Ee,{row:e,adminFetch:M,onError:e=>H({message:e,failed:!0})})}),[M]),ve=r.productName,N=typeof s==`string`?s:s===null?`name unavailable`:t||ve,be=(N.trim().charAt(0)||`?`).toUpperCase(),[P,F]=(0,x.useState)(ge?`data`:k?`whatsapp`:`sessions`),[I,xe]=(0,x.useState)([]),[L,Se]=(0,x.useState)(!1),[R,z]=(0,x.useState)(null),[B,Ce]=(0,x.useState)(!1),[we,Te]=(0,x.useState)(`file`),[V,H]=(0,x.useState)(null),[De,U]=(0,x.useState)(null),[ke,je]=(0,x.useState)(!1),[W,Ne]=(0,x.useState)([]),[G]=(0,x.useState)(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`session`)),[K,Pe]=(0,x.useState)(!1),[Fe,Le]=(0,x.useState)(null),[He,Ue]=(0,x.useState)(!1),[q,qe]=(0,x.useState)(!1),[J,Je]=(0,x.useState)(!1),[Ye,Xe]=(0,x.useState)(null),[Y,Ze]=(0,x.useState)(new Set),[Qe,$e]=(0,x.useState)(null),[et,tt]=(0,x.useState)(new Set),[nt,rt]=(0,x.useState)(new Set),[it,at]=(0,x.useState)(new Set),[X,ot]=(0,x.useState)(null),[st,Z]=(0,x.useState)(``),[ct,lt]=(0,x.useState)(!1),[ut,dt]=(0,x.useState)(null),[ft,pt]=(0,x.useState)(null),[mt,ht]=(0,x.useState)(!1),[gt,_t]=(0,x.useState)(null),[vt,yt]=(0,x.useState)(!1),bt=(0,x.useRef)(0),[xt,St]=(0,x.useState)([]),[Ct,wt]=(0,x.useState)(!1),[Tt,Et]=(0,x.useState)(null),[Dt,Ot]=(0,x.useState)(`whatsapp`),kt=(0,x.useCallback)(e=>{if(b(),!n){console.error(`[admin-ui] artefact-download-blocked id=${e.id} reason=no-cache-key`),H({message:`Session not ready — try again`,failed:!0});return}if(!e.downloadPath){console.error(`[admin-ui] artefact-download-blocked id=${e.id} reason=not-downloadable`),H({message:`${e.name} can’t be downloaded`,failed:!0});return}console.info(`[admin-ui] artefact-download id=${e.id} root=${e.downloadRoot??`data`} path=${e.downloadPath}`),se(n,e.downloadPath,e.downloadRoot??`data`),H({message:`Downloading ${e.name}`,failed:!1})},[n,b]);(0,x.useEffect)(()=>{if(!V)return;let e=setTimeout(()=>H(null),2500);return()=>clearTimeout(e)},[V]);let At=G!=null&&W.some(e=>e.sessionId===G);(0,x.useEffect)(()=>{G==null||!K||console.info(`[sidebar-sessions] op=select-highlight session=${G.slice(0,8)} matched=${At}`)},[G,At,K]);let jt=(0,x.useCallback)(async()=>{if(n){Ce(!0),z(null);try{let e=await M(`/api/admin/sidebar-artefacts`);if(!e.ok)throw Error(`status ${e.status}`);xe((await e.json()).artefacts??[]),Se(!0)}catch(e){let t=e instanceof Error?e.message:String(e);z(`Failed to load artefacts: ${t}`),console.error(`[admin-ui] sidebar-artefacts fetch failed: ${t}`)}finally{Ce(!1)}}},[n,M]),Q=(0,x.useCallback)(async()=>{if(!n)return null;let e=++bt.current;Ue(!0),Le(null);try{let t=await M(`/api/admin/sidebar-sessions`);if(!t.ok)throw Error(`status ${t.status}`);let n=await t.json(),r=n.sessions??[];return e===bt.current?(Ne(r),Xe(n.accountId??null),Pe(!0),r):(console.info(`[admin-ui] sidebar-sessions-stale-response-dropped token=${e}`),r)}catch(t){let n=t instanceof Error?t.message:String(t);return e===bt.current&&Le(`Failed to load sessions: ${n}`),console.error(`[admin-ui] sidebar-sessions fetch failed: ${n}`),null}finally{e===bt.current&&Ue(!1)}},[n,M]),Mt=(0,x.useCallback)(async()=>{if(n){Et(null);try{let e=await M(`/api/whatsapp-reader/conversations`);if(!e.ok)throw Error(`status ${e.status}`);St((await e.json()).conversations??[]),wt(!0)}catch(e){let t=e instanceof Error?e.message:String(e);Et(`Couldn't load conversations.`),console.error(`[admin-ui] channel-convos fetch failed: ${t}`)}}},[n,M]);(0,x.useEffect)(()=>{!n||K||Q()},[n,K,Q]),(0,x.useEffect)(()=>{if(!n)return;let e=null;return Mt(),e=setInterval(()=>{Mt()},We),()=>{e!==null&&clearInterval(e)}},[n,Mt]),(0,x.useEffect)(()=>{if(!n)return;let e=null;function t(){console.info(`[admin-ui] sidebar-refresh surface=sessions trigger=poll`),Q()}function r(){e===null&&(e=setInterval(t,Ge))}function i(){e!==null&&(clearInterval(e),e=null)}function a(){document.hidden?i():(t(),r())}return document.hidden||r(),document.addEventListener(`visibilitychange`,a),()=>{i(),document.removeEventListener(`visibilitychange`,a)}},[n,Q]);let Nt=(0,x.useMemo)(()=>{let e=new Map;for(let t of v)e.set(t,[]);for(let t of xt)e.get(t.channel)?.push(t);for(let t of v)console.info(`[admin-ui] sidebar-nav surface=${t} count=${e.get(t).length}`);return e},[xt]),Pt={whatsapp:`WhatsApp`,telegram:`Telegram`,webchat:`Webchat`},Ft=()=>{w(null),F(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${L?I.length:0} collapsed=${C}`),jt()},$=1.5,It=()=>{console.info(`[admin-ui] sidebar-refresh surface=artefacts`),jt()},Lt=()=>{w(null),F(`sessions`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${K?W.length:0} collapsed=${C}`),K||Q()},Rt=()=>{console.info(`[admin-ui] sidebar-refresh surface=sessions trigger=manual`),Q()},zt=()=>{F(`data`),console.info(`[admin-ui] sidebar-nav surface=data collapsed=${C}`),A(),b()},Bt=e=>{j?.(),F(`whatsapp`),Ot(e),console.info(`[admin-ui] sidebar-nav surface=${e} count=${Nt.get(e)?.length??0} collapsed=${C}`)},Vt=(0,x.useCallback)(async e=>{if(et.has(e.sessionId))return;tt(t=>{let n=new Set(t);return n.add(e.sessionId),n});let t=window.open(``,`_blank`);try{let n=await M(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId,name:e.title||e.sessionId,...e.accountId?{targetAccountId:e.accountId}:{}})}),r=await n.json().catch(()=>({})),i=Be(n.ok,n.status,{...r,sessionId:r.sessionId??e.sessionId});console.info(`[admin-ui] sidebar-session-resume sessionId=${e.sessionId} status=${n.status} outcome=${i.kind} slug=${r.slug??r.bridgeSessionId??`none`}`),i.kind===`navigate`?(b(),t?t.location.href=i.url:window.open(i.url,`_blank`)):(t?.close(),console.error(`[admin-ui] sidebar-session-resume-failed sessionId=${e.sessionId} status=${n.status} reason=${i.reason}`),U(i))}catch(n){t?.close();let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] sidebar-session-resume-failed sessionId=${e.sessionId} error=${r}`),U({sessionId:e.sessionId,reason:r})}finally{tt(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}},[M,b,et]),Ht=(0,x.useCallback)(async e=>{let t=e.slice(0,8);for(let n=1;n<=ze.length;n++){await new Promise(e=>setTimeout(e,ze[n-1]));let r=await Q();if(r&&r.some(t=>t.sessionId===e)){console.info(`[admin-ui] sidebar-new-session-converged sessionId=${t} via=retry attempts=${n}`);return}}console.error(`[admin-ui] sidebar-new-session-converge-timeout sessionId=${t}`)},[Q]),Ut=(0,x.useCallback)(async()=>{if(!vt){yt(!0);try{let e=await M(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})}),t=await e.json().catch(()=>({})),n=Be(e.ok,e.status,t);console.info(`[admin-ui] sidebar-new-session-spawned status=${e.status} outcome=${n.kind} slug=${t.slug??t.bridgeSessionId??`none`}`),n.kind===`navigate`?n.sameOrigin?window.location.assign(n.url):(window.open(n.url,`_blank`),t.sessionId?Ht(t.sessionId):console.error(`[admin-ui] sidebar-new-session-converge-skipped reason=no-session-id`)):e.status===503||n.reason===`claude-auth-dead`?(console.info(`[admin-ui] op=llm-action-blocked action=spawn reason=claude-disconnected`),je(!0)):(console.error(`[admin-ui] sidebar-new-session-failed status=${e.status} reason=${n.reason}`),U(n))}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-new-session-failed error=${t}`),U({sessionId:null,reason:t})}finally{yt(!1)}}},[M,vt,Ht]),Wt=(0,x.useCallback)((e,t)=>{e.stopPropagation(),$e(t)},[]),Gt=(0,x.useCallback)(async(e,t)=>{e.stopPropagation(),dt(t),pt(null),_t(null),ht(!0);try{let e=await M(`/api/admin/session-usage?sessionId=${encodeURIComponent(t.sessionId)}`),n=await e.json().catch(()=>({}));e.ok?pt(n):_t(n.error??`status ${e.status}`)}catch(e){_t(e instanceof Error?e.message:String(e))}finally{ht(!1)}},[M]),Kt=(0,x.useCallback)(async e=>{if(!Y.has(e.sessionId)){Ze(t=>{let n=new Set(t);return n.add(e.sessionId),n});try{let t=await M(`/api/admin/session-delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId})});if(!t.ok){let n=await t.json().catch(()=>({}));console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${e.sessionId} status=${t.status} error=${n.error??`unknown`}`),H({message:`Delete failed: ${n.error??`status ${t.status}`}`,failed:!0});return}let n=await t.json();console.info(`[admin-ui] sidebar-session-delete sessionId=${e.sessionId} live=${e.live} confirmed=true pidKilled=${n.pidKilled??`?`} deleted=${n.deleted??`?`}`),Ne(t=>t.filter(t=>t.sessionId!==e.sessionId)),Q()}catch(t){let n=t instanceof Error?t.message:String(t);console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${e.sessionId} error=${n}`),H({message:`Delete failed: ${n}`,failed:!0})}finally{Ze(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}}},[M,Y,Q]),qt=(0,x.useCallback)(async(e,t)=>{if(e.stopPropagation(),!nt.has(t.sessionId)){rt(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await M(`/api/admin/session-stop`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t.sessionId})});if(!e.ok){let n=await e.json().catch(()=>({}));console.error(`[admin-ui] sidebar-session-stop-failed sessionId=${t.sessionId} status=${e.status} error=${n.error??`unknown`}`),H({message:`Stop failed: ${n.error??`status ${e.status}`}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-stop sessionId=${t.sessionId}`),Q()}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-stop-failed sessionId=${t.sessionId} error=${n}`),H({message:`Stop failed: ${n}`,failed:!0})}finally{rt(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[M,nt,Q]),Jt=(0,x.useCallback)(async(e,t,n)=>{if(e.stopPropagation(),!it.has(t.sessionId)){at(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await M(`/api/admin/session-archive`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t.sessionId,mode:n})});if(!e.ok){let r=await e.json().catch(()=>({})),i=r.detail??r.error??`status ${e.status}`;console.error(`[admin-ui] sidebar-session-archive-failed sessionId=${t.sessionId} mode=${n} status=${e.status} error=${r.error??`unknown`}`),H({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${i}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-archive sessionId=${t.sessionId} mode=${n}`),Q()}catch(e){let r=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-archive-failed sessionId=${t.sessionId} mode=${n} error=${r}`),H({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${r}`,failed:!0})}finally{at(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[M,it,Q]),Yt=(0,x.useCallback)(async e=>{let t=st.trim();if(!t){H({message:`Title can’t be empty`,failed:!0});return}if(t.length>Re){H({message:`Title too long (max ${Re})`,failed:!0});return}lt(!0);try{let n=await M(`/api/admin/session-rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId,title:t})});if(!n.ok){let t=await n.json().catch(()=>({})),r=t.reason??t.error??`status ${n.status}`;console.error(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=rejected reason=${r}`),H({message:`Rename failed: ${r}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=ok`),ot(null),Z(``),Q()}catch(t){let n=t instanceof Error?t.message:String(t);console.error(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=rejected reason=${n}`),H({message:`Rename failed: ${n}`,failed:!0})}finally{lt(!1)}},[M,st,Q]);return(0,S.jsxs)(`aside`,{className:`side`,children:[(0,S.jsx)(`div`,{className:`side-new-session-row`,children:(0,S.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:Ut,disabled:vt,"aria-busy":vt,children:[(0,S.jsx)(oe,{size:14}),(0,S.jsx)(`span`,{children:vt?`Spawning…`:`New session`})]})}),(0,S.jsxs)(`nav`,{className:`side-nav`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),g(),b()},children:[(0,S.jsx)(he,{size:20,strokeWidth:$}),(0,S.jsx)(`span`,{className:`label`,children:`People`}),(0,S.jsx)(`span`,{className:`kbd`})]}),(0,S.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),ce(),b()},children:[(0,S.jsx)(ue,{size:20,strokeWidth:$}),(0,S.jsx)(`span`,{className:`label`,children:`Agents`}),(0,S.jsx)(`span`,{className:`kbd`})]}),(0,S.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),h(),b()},children:[(0,S.jsx)(de,{size:20,strokeWidth:$}),(0,S.jsx)(`span`,{className:`label`,children:a().term}),(0,S.jsx)(`span`,{className:`kbd`})]}),(0,S.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),ee(),b()},children:[(0,S.jsx)(pe,{size:20,strokeWidth:$}),(0,S.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,S.jsx)(`span`,{className:`kbd`})]}),(0,S.jsxs)(`button`,{type:`button`,className:`nav-row${P===`artefacts`?` active`:``}`,onClick:Ft,children:[(0,S.jsx)(ie,{size:20,strokeWidth:$}),(0,S.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,S.jsx)(`span`,{className:`kbd`})]}),(0,S.jsxs)(`button`,{type:`button`,className:`nav-row${P===`sessions`?` active`:``}`,onClick:Lt,children:[(0,S.jsx)(fe,{size:20,strokeWidth:$}),(0,S.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,S.jsx)(`span`,{className:`kbd`})]}),(0,S.jsxs)(`button`,{type:`button`,className:`nav-row${P===`data`?` active`:``}`,onClick:zt,children:[(0,S.jsx)(u,{size:20,strokeWidth:$}),(0,S.jsx)(`span`,{className:`label`,children:`Data`}),(0,S.jsx)(`span`,{className:`kbd`})]}),Ct&&v.filter(e=>Nt.get(e).length>0).map(e=>(0,S.jsxs)(`button`,{type:`button`,className:`nav-row${P===`whatsapp`&&Dt===e?` active`:``}`,onClick:()=>Bt(e),children:[(0,S.jsx)(y,{channel:e,size:16}),(0,S.jsx)(`span`,{className:`label`,children:Pt[e]}),(0,S.jsx)(`span`,{className:`kbd`})]},e)),Tt&&(0,S.jsx)(`div`,{className:`nav-row`,style:{color:`var(--text-tertiary)`,cursor:`default`},"aria-disabled":`true`,children:(0,S.jsx)(`span`,{className:`label`,children:Tt})})]}),P===`artefacts`&&(0,S.jsxs)(`div`,{className:`side-list`,children:[(0,S.jsxs)(`div`,{className:`group-head`,children:[(0,S.jsx)(`span`,{children:`Artefacts`}),(0,S.jsxs)(`span`,{className:`group-head-meta`,children:[(0,S.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh artefacts`,"aria-label":`Refresh artefacts`,onClick:It,disabled:B,children:(0,S.jsx)(_,{size:12,className:B?`spinning`:void 0})}),(0,S.jsx)(`span`,{children:B?`…`:String(I.length)})]})]}),R&&(0,S.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:R}),L&&!R&&I.length>0&&(()=>{let e=I.filter(e=>e.kind===`agent-template`).length,t=I.length-e;return(0,S.jsx)(`div`,{className:`artefact-filter-chips`,children:[{key:`all`,label:`All`,count:I.length},{key:`agent`,label:`Agents`,count:e},{key:`file`,label:`Files`,count:t}].map(e=>(0,S.jsxs)(`button`,{type:`button`,className:`artefact-filter-chip${we===e.key?` active`:``}`,onClick:()=>Te(e.key),disabled:e.count===0&&e.key!==`all`,children:[e.label,(0,S.jsx)(`span`,{className:`artefact-filter-chip-count`,children:e.count})]},e.key))})})(),L&&!R&&I.length===0&&(0,S.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),I.filter(e=>we===`all`?!0:we===`agent`?e.kind===`agent-template`:e.kind!==`agent-template`).map(e=>{let t=e.kind===`agent-template`,n=t?ue:ie,r=Ve(e.updatedAt),i=e.downloadPath!==null;return(0,S.jsxs)(`button`,{type:`button`,className:`conv`,onClick:()=>kt(e),disabled:!i,style:i?void 0:{cursor:`default`},title:i?`Download ${e.name}`:`${e.name} can’t be downloaded`,children:[(0,S.jsx)(n,{size:14,className:`conv-icon`,"data-kind":t?`agent`:`file`,"aria-label":t?`agent template`:`file`}),(0,S.jsxs)(`span`,{className:`conv-stack`,children:[(0,S.jsx)(`span`,{className:`conv-name-line`,children:(0,S.jsx)(`span`,{className:`conv-name`,children:e.name})}),r&&(0,S.jsx)(`span`,{className:`conv-timestamp`,children:r})]}),i&&(0,S.jsx)(re,{size:12,className:`conv-rc-icon`,"aria-hidden":`true`})]},e.id)})]}),P===`sessions`&&(()=>{let e=W.filter(e=>q?!0:!e.isSubagent).filter(e=>J?!0:!e.archived),t=W.some(e=>e.isSubagent),n=W.some(e=>e.archived);return(0,S.jsxs)(`div`,{className:`side-list`,children:[(0,S.jsxs)(`div`,{className:`group-head`,children:[(0,S.jsx)(`span`,{children:`Sessions`}),(0,S.jsxs)(`span`,{className:`group-head-meta`,children:[(0,S.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh sessions`,"aria-label":`Refresh sessions`,onClick:Rt,disabled:He,children:(0,S.jsx)(_,{size:12,className:He?`spinning`:void 0})}),(0,S.jsx)(`span`,{children:He?`…`:String(e.length)})]})]}),Ye&&(0,S.jsx)(`div`,{className:`side-account-id`,title:`This install's accountId. The first 8 characters match the truncated UUID label on the live Remote Control daemon entry in claude.ai/code.`,children:(0,S.jsx)(`code`,{children:Ye})}),(t||n)&&(0,S.jsxs)(`div`,{className:`artefact-filter-chips`,children:[t&&(0,S.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${q?` active`:``}`,"aria-pressed":q,onClick:()=>qe(e=>!e),title:q?`Hide subagent sessions`:`Show subagent sessions`,children:`Subagents`}),n&&(0,S.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${J?` active`:``}`,"aria-pressed":J,onClick:()=>Je(e=>!e),title:J?`Hide archived sessions`:`Show archived sessions`,children:`Archived`})]}),Fe&&(0,S.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:Fe}),K&&!Fe&&e.length===0&&(0,S.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No sessions yet`}),e.map(e=>{let t=Ve(e.startedAt),n=et.has(e.sessionId),r=Y.has(e.sessionId),i=nt.has(e.sessionId),a=it.has(e.sessionId),o=n||r||i||a,s=()=>{window.location.assign(`/chat?session=${e.sessionId}`)},c=[{key:`open`,label:`Resume session ${e.title} in claude.ai/code`,menuLabel:`Resume in claude.ai/code`,title:`Resume in a fresh local Remote Control PTY`,icon:(0,S.jsx)(p,{size:12}),busy:n,onClick:()=>{Vt(e)}},{key:`message`,label:`Open session ${e.title} in admin webchat`,menuLabel:`Open in webchat`,title:`Open in admin webchat (/chat) — sending resumes this session`,icon:(0,S.jsx)(O,{size:12}),onClick:()=>{s()}},{key:`usage`,label:`Usage and cost for session ${e.title}`,menuLabel:`Usage & cost`,title:`Per-day active time, tokens, and estimated GBP cost`,icon:(0,S.jsx)(D,{size:12}),onClick:t=>{Gt(t,e)}},...e.live?[{key:`stop`,label:`Stop session ${e.title}`,menuLabel:`Stop`,title:`Stop session process (keeps the conversation, can resume later)`,icon:(0,S.jsx)(m,{size:12}),busy:i,onClick:t=>{qt(t,e)}}]:[],e.archived?{key:`unarchive`,label:`Unarchive session ${e.title}`,menuLabel:`Unarchive`,title:`Unarchive (move back to the active list)`,icon:(0,S.jsx)(T,{size:12}),busy:a,onClick:t=>{Jt(t,e,`unarchive`)}}:{key:`archive`,label:`Archive session ${e.title}`,menuLabel:`Archive`,title:`Archive (hide from the list, keeps the conversation resumable)`,icon:(0,S.jsx)(E,{size:12}),busy:a,onClick:t=>{Jt(t,e,`archive`)}},{key:`rename`,label:`Rename session ${e.title}`,menuLabel:`Rename`,title:`Rename this session`,icon:(0,S.jsx)(l,{size:12}),busy:ct&&X===e.sessionId,onClick:t=>{t.stopPropagation(),ot(e.sessionId),Z(e.personName??e.title)}},{key:`delete`,label:`Delete session ${e.title}`,menuLabel:`Delete`,title:`Delete session (stops the process, removes the conversation)`,icon:(0,S.jsx)(f,{size:12}),danger:!0,busy:r,onClick:t=>{Wt(t,e)}},_e({sessionId:e.sessionId,model:e.model??null,title:e.personName??e.title})],u=e.channel===`whatsapp`?` conv-channel-whatsapp`:e.channel===`telegram`?` conv-channel-telegram`:``,d=e.channel===`whatsapp`||e.channel===`telegram`||e.channel===`webchat`,h=v.includes(e.channel??``)&&e.senderId&&e.titleSource===`prefix`?ae({operatorName:e.personName??null,whatsappName:null,senderId:e.senderId,title:e.title}):e.personName??e.title;return(0,S.jsxs)(`div`,{className:`conv conv-with-actions${u}${e.sessionId===G?` active`:``}`,children:[(0,S.jsxs)(`div`,{className:`conv-main-static conv-main-clickable`,role:`button`,tabIndex:0,"aria-label":`Open ${h} in webchat`,onClick:()=>{X!==e.sessionId&&s()},onKeyDown:t=>{X!==e.sessionId&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),s())},children:[(0,S.jsx)(`span`,{className:`conv-live-dot`,"data-live":e.live?`1`:`0`,"aria-label":e.live?`live session`:`ended session`}),(0,S.jsxs)(`span`,{className:`conv-stack`,children:[(0,S.jsxs)(`span`,{className:`conv-name-line`,children:[d&&(0,S.jsx)(ne,{channel:e.channel,size:13}),X===e.sessionId?(0,S.jsx)(`input`,{className:`conv-name conv-name-edit`,autoFocus:!0,value:st,disabled:ct,"aria-label":`New title for session ${e.title}`,onChange:e=>Z(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),Yt(e)):t.key===`Escape`&&(t.preventDefault(),ot(null),Z(``))},onBlur:()=>{X===e.sessionId&&!ct&&(ot(null),Z(``))}}):(0,S.jsx)(`span`,{className:`conv-name`,title:h,children:h})]}),(0,S.jsxs)(`span`,{className:`conv-timestamp`,children:[(0,S.jsx)(`code`,{className:`conv-session-id`,title:`First 8 characters of this session's id — distinguishes rows with identical auto-titles. The resume/delete buttons act on the full id.`,children:e.sessionId.slice(0,8)}),t&&(0,S.jsxs)(`span`,{children:[` · `,t]})]})]})]}),(0,S.jsx)(ye,{actions:c,disabled:o})]},e.sessionId)})]})})(),P===`whatsapp`&&(0,S.jsxs)(`div`,{className:`side-list`,children:[(0,S.jsxs)(`div`,{className:`group-head`,children:[(0,S.jsx)(`span`,{children:Pt[Dt]}),(0,S.jsxs)(`span`,{className:`group-head-meta`,children:[(0,S.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh conversations`,"aria-label":`Refresh conversations`,onClick:()=>{Mt()},children:(0,S.jsx)(_,{size:12})}),(0,S.jsx)(`span`,{children:String(Nt.get(Dt).length)})]})]}),Nt.get(Dt).map(e=>{let t=Ve(e.lastMessageAt),n=te(e);return(0,S.jsxs)(`div`,{className:`conv conv-with-actions${e.source===`store`?e.scope===`admin`?` conv-scope-admin`:` conv-scope-public`:``}${le===n?` active`:``}`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`conv-main-static conv-main-btn`,onClick:()=>{w(e),b()},title:e.title,children:[(0,S.jsx)(y,{channel:e.channel,size:14}),(0,S.jsxs)(`span`,{className:`conv-stack`,children:[(0,S.jsx)(`span`,{className:`conv-name-line`,children:(0,S.jsx)(`span`,{className:`conv-name`,children:ae(e)})}),t&&(0,S.jsx)(`span`,{className:`conv-timestamp`,children:t})]})]}),e.source===`session`&&(0,S.jsx)(ye,{actions:[_e({sessionId:e.sessionId,model:e.model,title:e.title})],disabled:!1})]},n)})]}),(0,S.jsx)(Ke,{}),(0,S.jsxs)(`div`,{className:`side-foot`,children:[(0,S.jsx)(`div`,{className:`avatar`,children:d?(0,S.jsx)(`img`,{src:d,alt:N}):be}),(0,S.jsxs)(`div`,{className:`who`,children:[(0,S.jsx)(`span`,{className:`name`,children:N}),(0,S.jsx)(`span`,{className:`role`,children:o??`operator`})]})]}),V&&(0,S.jsx)(`div`,{className:`copy-toast${V.failed?` copy-toast-failed`:``}`,role:`status`,children:V.message}),(0,S.jsx)(Ae,{error:De,onClose:()=>U(null)}),(0,S.jsx)(Me,{open:ke,onConnect:()=>{je(!1),i?.()},onClose:()=>je(!1)}),(0,S.jsx)(Oe,{target:Qe,onCancel:()=>$e(null),onConfirm:()=>{let e=Qe;$e(null),e&&Kt(e)}}),(0,S.jsx)(Ie,{show:ut!==null,onClose:()=>{dt(null),pt(null),_t(null)},sessionId:ut?.sessionId??null,summary:ft,loading:mt,error:gt})]})}var Ue=5e3,We=3e4,Ge=3e4;function Ke(){let[e,t]=(0,x.useState)(null);if((0,x.useEffect)(()=>{let e=!1,n=null;async function r(){try{let n=await fetch(`/api/admin/system-stats`);if(!n.ok){console.error(`[admin-ui] system-stats-fetch-failed status=${n.status}`);return}let r=await n.json();e||t(r)}catch(e){console.error(`[admin-ui] system-stats-fetch-failed reason=${e instanceof Error?e.message:String(e)}`)}}function i(){n===null&&(r(),n=setInterval(()=>{r()},Ue))}function a(){n!==null&&(clearInterval(n),n=null)}function o(){document.hidden?a():i()}return document.hidden||i(),document.addEventListener(`visibilitychange`,o),()=>{e=!0,a(),document.removeEventListener(`visibilitychange`,o)}},[]),!e||e.platform===`darwin`)return null;let n=e.cpuPct,r=e.memUsedPct,i=n!==null&&n>=.9,a=n!==null&&n>=.98,o=r!==null&&r>=.9,s=r!==null&&r>=.98,c=i||o,l=a||s,u=e=>e===null?`—`:`${Math.round(e*100)}%`,d=e=>{if(e===null)return{width:`0%`,background:`var(--text-tertiary)`};let t=Math.min(1,Math.max(0,e)),n=Math.round(140*(1-t));return{width:`${Math.round(t*100)}%`,background:`hsl(${n}, 65%, 45%)`}},f=[`system-stats`];return c&&f.push(`system-stats--warn`),l&&f.push(`system-stats--crit`),(0,S.jsxs)(`div`,{className:f.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,S.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,S.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),(0,S.jsx)(`div`,{className:`system-stats__bar`,children:(0,S.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(n)})})]}),(0,S.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,S.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]}),(0,S.jsx)(`div`,{className:`system-stats__bar`,children:(0,S.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(r)})})]})]})}var q=`admin-sidebar-collapsed`,qe=`admin-sidebar-drawer-open`;function J(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(q)===`1`}catch{return!1}}function Je(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(q,`1`):window.sessionStorage.removeItem(q)}catch{}}function Ye(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(qe)===`1`}catch{return!1}}function Xe(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(qe,`1`):window.sessionStorage.removeItem(qe)}catch{}}function Y(e){let[t,n]=(0,x.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(e).matches);return(0,x.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var Ze=720;function Qe(e,t){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?wa=${encodeURIComponent(t.remoteJid??``)}&acct=${encodeURIComponent(t.accountId??``)}`}}function $e(e){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?data=1`}}function et(e,t){if(e!==`/`)return null;let n=new URLSearchParams(t),r=n.get(`wa`),i=n.get(`acct`);return!r||!i?null:{sessionId:``,projectDir:``,title:``,senderId:null,startedAt:``,channel:`whatsapp`,role:`public`,operatorName:null,whatsappName:null,lastMessageAt:null,modelGated:!1,model:null,source:`store`,accountId:i,remoteJid:r}}function tt(e,t){return e===`/`?new URLSearchParams(t).has(`data`):!1}function nt(e,t){return t===`operator`&&e===`chat`||e===`dashboard`?`/`:e===`data`?`/data`:e===`graph`?`/graph`:e===`calendar`?`/calendar`:e===`chat`?`/chat`:`/browser`}function rt(e){let{cacheKey:t,businessName:n,variant:r=`admin`,onLogout:i,onDisconnect:o,disconnecting:s,claudeConnected:c,onConnectClaude:l,userName:u,userAvatar:f,role:p,onOpenConversations:m,children:g,footer:ee}=e,{subAccounts:ne,activeAccountId:_,switching:re,switchAccount:ie,refreshAccounts:ae}=h(t),[oe,se]=(0,x.useState)(!0);(0,x.useEffect)(()=>{if(c!==void 0||r!==`admin`)return;let e=!1,t=async()=>{try{let t=await fetch(`/api/health`);if(!t.ok)return;let n=await t.json();e||se(n.auth_status!==`dead`&&n.auth_status!==`missing`)}catch{}};t();let n=setInterval(t,6e4);return()=>{e=!0,clearInterval(n)}},[c,r]);let v=c??oe,ce=l??(()=>{window.location.assign(`/?connect=claude`)}),[y,b]=(0,x.useState)(()=>J()),[C,le]=(0,x.useState)(()=>Ye()),w=Y(`(max-width: ${Ze}px)`),[T,E]=(0,x.useState)(()=>typeof window>`u`||tt(window.location.pathname,window.location.search)?null:et(window.location.pathname,window.location.search)),[ue]=(0,x.useState)(()=>T!==null),[de,D]=(0,x.useState)(()=>typeof window>`u`?!1:tt(window.location.pathname,window.location.search)),[fe]=(0,x.useState)(()=>de),pe=(0,x.useCallback)(e=>{Je(e),b(e)},[]),O=(0,x.useCallback)(e=>{Xe(e),le(e)},[]);(0,x.useEffect)(()=>{if(typeof window>`u`)return;let e=window.location?.pathname??``;console.info(`[admin-ui] shell-mount route=${e} variant=${r} sidebar=${r===`operator`?`none`:`present`} collapsed=${y} drawer=${C}`)},[]),(0,x.useEffect)(()=>{typeof window>`u`||!T||(console.info(`[admin-ui] wa-hydrate route=/ remoteJid=${T.remoteJid??``}`),window.history.replaceState(null,``,`/`))},[]),(0,x.useEffect)(()=>{typeof window>`u`||!de||(console.info(`[admin-ui] data-hydrate route=/`),window.history.replaceState(null,``,`/`))},[]);let me=(0,x.useCallback)(e=>{if(D(!1),e===null){E(null);return}let t=typeof window<`u`?window.location.pathname:`/`,n=Qe(t,e);console.info(`[admin-ui] wa-open route=${t} via=${n.via} sessionId=${e.sessionId.slice(0,8)}`),n.via===`in-place`?E(e):window.location.href=n.href},[]),he=(0,x.useCallback)(()=>{let e=typeof window<`u`?window.location.pathname:`/`,t=$e(e);if(console.info(`[admin-ui] data-open route=${e} via=${t.via}`),t.via===`navigate`){window.location.href=t.href;return}E(null),D(!0)},[]),k=w?C:!y,A=(0,x.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${Ze}px)`).matches){let e=C;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),O(!e)}else{let e=y;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),pe(!e)}},[y,C,pe,O]),j=(0,x.useCallback)(e=>{let t=nt(e,r);console.info(`[admin-ui] header-menu-nav target=${e} dest=${t}`),window.location.href=t},[r]),ge={collapsed:y,mobileDrawerOpen:C,sidebarOpen:k,onToggleSidebar:A,setMobileDrawerOpen:O,selectedWhatsapp:T,onClearWhatsapp:()=>E(null),dataOpen:de};return r===`operator`?(0,S.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,S.jsx)(d,{businessName:n,variant:r,onNavigate:j,onOpenConversations:m,onToggleSidebar:A,sidebarOpen:k,onLogout:i,onDisconnect:o,disconnecting:s,cacheKey:t,subAccounts:ne,activeAccountId:_,switchingAccount:re,onSwitchAccount:ie,refreshAccounts:ae}),(0,S.jsx)(`div`,{className:`platform platform-operator`,children:typeof g==`function`?g(ge):g}),ee]}):(0,S.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,S.jsx)(d,{businessName:n,variant:r,onNavigate:j,onOpenConversations:m,onToggleSidebar:A,sidebarOpen:k,onLogout:i,onDisconnect:o,disconnecting:s,claudeConnected:v,onConnectClaude:ce,cacheKey:t,subAccounts:ne,activeAccountId:_,switchingAccount:re,onSwitchAccount:ie,refreshAccounts:ae}),(0,S.jsxs)(`div`,{className:`platform${C?` menu-open`:``}${y?` sidebar-collapsed`:``}`,"data-artefact":`closed`,children:[(0,S.jsx)(He,{businessName:n,cacheKey:t,onConnectClaude:ce,role:p??null,userName:u,userAvatar:f??null,onSelectProjects:()=>{window.location.href=`/graph?label=${a().label}`},onSelectPeople:()=>{window.location.href=`/graph?label=Person`},onSelectTasks:()=>{window.location.href=`/tasks`},onSelectAgents:()=>{window.location.href=`/graph?label=Agent`},onCloseMobileDrawer:()=>O(!1),collapsed:y,mobileDrawerOpen:C,selectedWhatsappId:T?te(T):null,onSelectWhatsappConversation:me,initialWhatsappSurface:ue,onSelectData:he,onCloseData:()=>D(!1),initialDataSurface:fe}),!w&&(0,S.jsx)(M,{}),typeof g==`function`?g(ge):g]}),C&&(0,S.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>O(!1)}),ee]})}export{T as _,je as a,be as c,he as d,me as f,E as g,ue as h,Me as i,Se as l,D as m,Y as n,P as o,pe as p,Be as r,N as s,rt as t,I as u,w as v,b as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as e,x as t}from"./useSubAccountSwitcher-DF6bohQA.js";import"./useVoiceRecorder-BAP3yGxs.js";import"./AdminShell-CaGc8ODG.js";import{n}from"./page-D6kzsk18.js";import"./useCopyFeedback-C5-GOl5l.js";import"./useSelectionMode-UOUVnP9B.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e}from"./useSubAccountSwitcher-DF6bohQA.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as e,x as t}from"./useSubAccountSwitcher-DF6bohQA.js";import"./useVoiceRecorder-BAP3yGxs.js";import{t as n}from"./page-TCsQy4eP.js";import"./useSelectionMode-UOUVnP9B.js";import"./graph-labels-JRGrstzM.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./chunk-Ck5AOu5v.js";import{g as t}from"./useSubAccountSwitcher-DF6bohQA.js";var n=t(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),r=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FALLBACK_LABEL_SHAPE=e.EXTERNAL_LABEL_SHAPES=e.ALL_GRAPH_LABELS=e.FALLBACK_LABEL_COLOUR=e.GRAPH_LABEL_COLOURS=void 0,e.pickDisplayLabel=t,e.colourForLabel=n,e.shapeForLabel=i,e.resolveNodeColour=a,e.formatRunTimestamp=c,e.formatMessageTimestamp=l,e.pickShortLabel=u,e.pickDisplayName=d,e.GRAPH_LABEL_COLOURS={LocalBusiness:`#4F6B8A`,Service:`#6B85A0`,PriceSpecification:`#8AA0B8`,OpeningHoursSpecification:`#A8BACE`,Listing:`#3F5670`,Property:`#5C7A99`,Viewing:`#D4A574`,Offer:`#B08850`,Job:`#8C3B2E`,Quote:`#A65A4A`,Invoice:`#6E4A1F`,InboundInvoice:`#6B2A20`,WhatsAppGroup:`#D4A096`,Customer:`#B5503C`,Site:`#C56B4A`,Asset:`#9E4A35`,Visit:`#C77A4E`,Part:`#7A3326`,PurchaseOrder:`#B07050`,PpmContract:`#8A4A3A`,Note:`#5E6B73`,Organization:`#8A6B47`,Person:`#B86E4A`,UserProfile:`#D08960`,Preference:`#DFA67A`,AdminUser:`#8C5230`,AccessGrant:`#66381F`,KnowledgeDocument:`#6E8A5A`,ConversationArchive:`#4F6B3E`,Section:`#8AA876`,Chunk:`#A6C194`,DigitalDocument:`#5A7548`,CreativeWork:`#B5C9A2`,Question:`#C7D6B5`,FAQPage:`#95B385`,DefinedTerm:`#76906A`,Review:`#3F5A2E`,ImageObject:`#A0BB8C`,Conversation:`#6B5A85`,AdminConversation:`#4F4070`,PublicConversation:`#8A75A8`,Message:`#6B7280`,UserMessage:`#DFA67A`,AssistantMessage:`#C9A876`,ToolCall:`#B5ABCB`,Task:`#B0617A`,Project:`#8E4A60`,Event:`#C68095`,Workflow:`#3A6F77`,WorkflowStep:`#5A8E96`,WorkflowRun:`#7AAAB2`,StepResult:`#9CC4CB`,Email:`#6F7F4A`,EmailAccount:`#91A063`,Agent:`#B8893D`,Objective:`#3D5A98`,KeyResult:`#5E7BC4`,Decision:`#7E60B0`,Risk:`#C15B57`,Source:`#2F8FA6`,Finding:`#4FA389`,Hypothesis:`#9A8C3E`},e.FALLBACK_LABEL_COLOUR=`#94A3B8`,e.ALL_GRAPH_LABELS=Object.freeze(Object.keys(e.GRAPH_LABEL_COLOURS));function t(t){for(let n=1;n<t.length;n++)if(Object.prototype.hasOwnProperty.call(e.GRAPH_LABEL_COLOURS,t[n]))return t[n];return t[0]??null}function n(t){return e.GRAPH_LABEL_COLOURS[t]??e.FALLBACK_LABEL_COLOUR}e.EXTERNAL_LABEL_SHAPES=[`dot`,`triangle`,`square`,`diamond`,`star`,`triangleDown`,`hexagon`],e.FALLBACK_LABEL_SHAPE=`dot`;var r=(()=>{let t={};return e.ALL_GRAPH_LABELS.forEach((n,r)=>{t[n]=e.EXTERNAL_LABEL_SHAPES[r%e.EXTERNAL_LABEL_SHAPES.length]}),t})();function i(t){return r[t]??e.FALLBACK_LABEL_SHAPE}function a(r){let i=t(r),a=i?n(i):e.FALLBACK_LABEL_COLOUR,o=0;for(let t=1;t<r.length;t++)Object.prototype.hasOwnProperty.call(e.GRAPH_LABEL_COLOURS,r[t])&&o++;return{displayLabel:i,colour:a,driftCandidates:o}}var o=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/,s=/^\d{4}-\d{2}-\d{2}T(\d{2}:\d{2}:\d{2})/;function c(e){let t=e.match(o);return t?`${t[1]} ${t[2]}`:null}function l(e){let t=e.match(s);return t?t[1]:null}function u(e){let t=e.properties,n=e.labels[0];if(n===`ToolCall`){let e=t.toolName;if(typeof e==`string`&&e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`WorkflowRun`){let e=t.startedAt;if(typeof e==`string`&&e.length>0){let t=c(e);if(t)return t}}else if(n===`WorkflowStep`){let e=t.label;if(typeof e==`string`&&e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`Person`){let e=[typeof t.givenName==`string`?t.givenName:``,typeof t.familyName==`string`?t.familyName:``].filter(e=>e.length>0).join(` `);if(e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`Agent`){let e=typeof t.displayName==`string`?t.displayName:``,n=typeof t.slug==`string`?t.slug:``,r=e.length>0?e:n;if(r.length>0)return r.length>24?r.slice(0,24)+`…`:r}else if(n===`Job`){let e=typeof t.client==`string`?t.client:``,n=typeof t.jobId==`string`?t.jobId:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r.length>24?r.slice(0,24)+`…`:r}else if(n===`Quote`){let e=typeof t.ref==`string`?t.ref:``;if(e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`InboundInvoice`){let e=typeof t.supplier==`string`?t.supplier:``,n=typeof t.confirmationNumber==`string`?t.confirmationNumber:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r.length>24?r.slice(0,24)+`…`:r}else if(n===`WhatsAppGroup`){let e=typeof t.clientName==`string`?t.clientName:``;if(e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`Message`){let e=typeof t.role==`string`?t.role:``,n=e===`user`?`user`:e===`assistant`?`asst`:e===`system`?`sys`:e===`tool`?`tool`:null,r=typeof t.createdAt==`string`?t.createdAt:``;if(n&&r){let e=l(r);if(e)return`${n} ${e}`}}for(let e of[`name`,`title`,`summary`,`givenName`,`subject`,`text`]){let n=t[e];if(typeof n==`string`&&n.length>0)return n.length>24?n.slice(0,24)+`…`:n}if(n===`Conversation`){let e=typeof t.sessionId==`string`?t.sessionId:null;if(e)return`Conv ${e.slice(0,8)}`}return n??`…`}function d(e){let t=e.properties,n=e.labels[0];if(n===`ToolCall`){let e=t.toolName;if(typeof e==`string`&&e.length>0)return e}else if(n===`WorkflowRun`){let e=t.startedAt;if(typeof e==`string`&&e.length>0){let t=c(e);if(t)return t}}else if(n===`WorkflowStep`){let e=t.label;if(typeof e==`string`&&e.length>0)return e}else if(n===`Person`){let e=[typeof t.givenName==`string`?t.givenName:``,typeof t.familyName==`string`?t.familyName:``].filter(e=>e.length>0).join(` `);if(e.length>0)return e}else if(n===`Agent`){let e=typeof t.displayName==`string`?t.displayName:``,n=typeof t.slug==`string`?t.slug:``,r=e.length>0?e:n;if(r.length>0)return r}else if(n===`Job`){let e=typeof t.client==`string`?t.client:``,n=typeof t.jobId==`string`?t.jobId:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r}else if(n===`Quote`){let e=typeof t.ref==`string`?t.ref:``;if(e.length>0)return e}else if(n===`InboundInvoice`){let e=typeof t.supplier==`string`?t.supplier:``,n=typeof t.confirmationNumber==`string`?t.confirmationNumber:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r}else if(n===`WhatsAppGroup`){let e=typeof t.clientName==`string`?t.clientName:``;if(e.length>0)return e}for(let e of[`name`,`title`,`summary`,`givenName`,`subject`,`text`]){let n=t[e];if(typeof n==`string`&&n.length>0)return n}if(n===`Conversation`){let e=typeof t.sessionId==`string`?t.sessionId:null;if(e)return`Conv ${e.slice(0,8)}`}return n??`…`}})),i=r();Object.freeze(new Set([`Chunk`,`GraphPreference`]));var a=Object.freeze(new Set(`LocalBusiness.Service.PriceSpecification.OpeningHoursSpecification.Organization.Person.UserProfile.Preference.AdminUser.AccessGrant.KnowledgeDocument.DigitalDocument.CreativeWork.Question.FAQPage.DefinedTerm.Review.ImageObject.Listing.Property.Viewing.Offer.Job.Quote.Invoice.InboundInvoice.WhatsAppGroup.Customer.Site.Asset.Visit.Part.PurchaseOrder.PpmContract.Task.Project.Event.Workflow.Email.EmailAccount.Agent.Objective.KeyResult.Decision.Risk.Source.Finding.Hypothesis`.split(`.`)));Object.freeze(new Set([`ToolCall`,`StepResult`,`WorkflowStep`,`WorkflowRun`])),Object.freeze(new Set([`HAS_TOOL_CALL`,`RUN_OF`,`HAS_STEP`,`HAS_RESULT`]));export{n as i,i as n,r,a as t};
|