xaq-cli 0.0.0 → 0.1.0-nightly.71
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/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/admin-5gThRwgj.js +162 -0
- package/dist/admin-5gThRwgj.js.map +1 -0
- package/dist/admin-Btrm8mCd.js +218 -0
- package/dist/admin-Btrm8mCd.js.map +1 -0
- package/dist/admin-CWofnT_Q.js +2 -0
- package/dist/api-BFpElwqK.js +89 -0
- package/dist/api-BFpElwqK.js.map +1 -0
- package/dist/audit-BB7jK9Z5.js +2 -0
- package/dist/audit-BVYknW2i.js +79 -0
- package/dist/audit-BVYknW2i.js.map +1 -0
- package/dist/auth-CXmBdMqw.js +2 -0
- package/dist/auth-D-GmwNv-.js +550 -0
- package/dist/auth-D-GmwNv-.js.map +1 -0
- package/dist/brand--ZB8jTn1.js +32 -0
- package/dist/brand--ZB8jTn1.js.map +1 -0
- package/dist/bus-Cz0flS37.js +12 -0
- package/dist/bus-Cz0flS37.js.map +1 -0
- package/dist/bus-OKIGut72.js +2 -0
- package/dist/cli.js +234 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands-BNVLjYXA.js +167 -0
- package/dist/commands-BNVLjYXA.js.map +1 -0
- package/dist/commands-CdA6-WE7.js +112 -0
- package/dist/commands-CdA6-WE7.js.map +1 -0
- package/dist/config-C9XmYZWO.js +94 -0
- package/dist/config-C9XmYZWO.js.map +1 -0
- package/dist/config-CNVi0v5t.js +2 -0
- package/dist/connect-TtJ9n0Rw.js +362 -0
- package/dist/connect-TtJ9n0Rw.js.map +1 -0
- package/dist/content-C1lKMxFS.js +1170 -0
- package/dist/content-C1lKMxFS.js.map +1 -0
- package/dist/content-worker.js +28 -0
- package/dist/content-worker.js.map +1 -0
- package/dist/crypto-fv2fj3S8.js +75 -0
- package/dist/crypto-fv2fj3S8.js.map +1 -0
- package/dist/db-BEUEUPyP.js +561 -0
- package/dist/db-BEUEUPyP.js.map +1 -0
- package/dist/db-Q5BQuwga.js +2 -0
- package/dist/errors-FbMS3QBo.js +39 -0
- package/dist/errors-FbMS3QBo.js.map +1 -0
- package/dist/filter-Ck6OMxvu.js +158 -0
- package/dist/filter-Ck6OMxvu.js.map +1 -0
- package/dist/hermes-CKyzt1mH.js +3 -0
- package/dist/hermes-DHnDTYJp.js +1023 -0
- package/dist/hermes-DHnDTYJp.js.map +1 -0
- package/dist/import-DsN5NZT3.js +910 -0
- package/dist/import-DsN5NZT3.js.map +1 -0
- package/dist/instance-CwWbFbJ8.js +2 -0
- package/dist/instance-Dj9TpJB2.js +195 -0
- package/dist/instance-Dj9TpJB2.js.map +1 -0
- package/dist/listen-B9iO7HgQ.js +1568 -0
- package/dist/listen-B9iO7HgQ.js.map +1 -0
- package/dist/listen-CXVKG9XD.js +2 -0
- package/dist/manage-Bo6COB4p.js +477 -0
- package/dist/manage-Bo6COB4p.js.map +1 -0
- package/dist/manage-DoXqvjnU.js +2 -0
- package/dist/mcpheader-B8c5YO1B.js +2 -0
- package/dist/mcpheader-C9H4vudu.js +185 -0
- package/dist/mcpheader-C9H4vudu.js.map +1 -0
- package/dist/mcpsetup-BnHudwpq.js +2 -0
- package/dist/mcpsetup-DXXo2qjf.js +1053 -0
- package/dist/mcpsetup-DXXo2qjf.js.map +1 -0
- package/dist/node-check-CjTk6VNL.js +24 -0
- package/dist/node-check-CjTk6VNL.js.map +1 -0
- package/dist/paths-d-C2kdjo.js +2 -0
- package/dist/paths-yzOKD6ow.js +46 -0
- package/dist/paths-yzOKD6ow.js.map +1 -0
- package/dist/profile-CcMZ4hn7.js +2 -0
- package/dist/profile-NmMKAczz.js +222 -0
- package/dist/profile-NmMKAczz.js.map +1 -0
- package/dist/prompt-CKMQx_MJ.js +114 -0
- package/dist/prompt-CKMQx_MJ.js.map +1 -0
- package/dist/recipes-C7TIDlRj.js +3 -0
- package/dist/recipes-DG_-doGq.js +314 -0
- package/dist/recipes-DG_-doGq.js.map +1 -0
- package/dist/send-Dk-t8ia-.js +108 -0
- package/dist/send-Dk-t8ia-.js.map +1 -0
- package/dist/server-CDqDp1q3.js +20640 -0
- package/dist/server-CDqDp1q3.js.map +1 -0
- package/dist/service-BVn3soZZ.js +766 -0
- package/dist/service-BVn3soZZ.js.map +1 -0
- package/dist/service-BaWGPmSd.js +2 -0
- package/dist/service-C7jfo-Ex.js +457 -0
- package/dist/service-C7jfo-Ex.js.map +1 -0
- package/dist/service-DxDyKDQ-.js +2 -0
- package/dist/settings-B5qSHxRM.js +134 -0
- package/dist/settings-B5qSHxRM.js.map +1 -0
- package/dist/settings-DQvZaMN1.js +2 -0
- package/dist/setup-token-CwuSzfLK.js +48 -0
- package/dist/setup-token-CwuSzfLK.js.map +1 -0
- package/dist/skill/SKILL.md +445 -0
- package/dist/skill-1UQj3qgW.js +69 -0
- package/dist/skill-1UQj3qgW.js.map +1 -0
- package/dist/skill-pelq18JQ.js +2 -0
- package/dist/ssrf-BlVpGZ7C.js +181 -0
- package/dist/ssrf-BlVpGZ7C.js.map +1 -0
- package/dist/types-BhJDbSzE.js +135 -0
- package/dist/types-BhJDbSzE.js.map +1 -0
- package/dist/ui-B8Sd4Y7Y.js +81 -0
- package/dist/ui-B8Sd4Y7Y.js.map +1 -0
- package/dist/urls-Dp8pBGMU.js +2 -0
- package/dist/urls-U_LfYV61.js +27 -0
- package/dist/urls-U_LfYV61.js.map +1 -0
- package/dist/version-BxH7OuWD.js +20 -0
- package/dist/version-BxH7OuWD.js.map +1 -0
- package/dist/web/assets/_agentId-DonOCOlC.js +1 -0
- package/dist/web/assets/_app-B7t5lEia.js +1 -0
- package/dist/web/assets/_app-DMTGqYpM.js +65 -0
- package/dist/web/assets/_connectionId-DR5vFXOg.js +1 -0
- package/dist/web/assets/_webhookId-LfUlsULp.js +1 -0
- package/dist/web/assets/account-status-CEszs13C.js +1 -0
- package/dist/web/assets/accounts-5m7aiXuZ.js +1 -0
- package/dist/web/assets/accounts-list-YfJzThZa.js +1 -0
- package/dist/web/assets/activity-DOIe7SAg.js +1 -0
- package/dist/web/assets/add-connection-C8JR-13R.js +1 -0
- package/dist/web/assets/agent-create-form-CPxnPYH4.js +1 -0
- package/dist/web/assets/agents-B2Qj5KxT.js +1 -0
- package/dist/web/assets/approvals-BGaVaoFy.js +1 -0
- package/dist/web/assets/approve._id-BLrQnzPM.js +1 -0
- package/dist/web/assets/arrow-left-DZVAXoKj.js +1 -0
- package/dist/web/assets/arrow-right-C2zcqRr2.js +1 -0
- package/dist/web/assets/attention-gO9Nw5uW.js +1 -0
- package/dist/web/assets/audit-BPXXre8S.js +1 -0
- package/dist/web/assets/audit-bits-CGyIprzK.js +1 -0
- package/dist/web/assets/bell-ring-ig3zn1iS.js +1 -0
- package/dist/web/assets/bot-Zk76q_39.js +1 -0
- package/dist/web/assets/calendar-notice-DsCfq3VJ.js +1 -0
- package/dist/web/assets/calendar-plus-Cycfkk0y.js +1 -0
- package/dist/web/assets/calendar-setup-Pn61Wj1n.js +2 -0
- package/dist/web/assets/card-GSO5o-Ug.js +1 -0
- package/dist/web/assets/check-check-Ds1bPIGv.js +1 -0
- package/dist/web/assets/checkbox-B937U-Fd.js +1 -0
- package/dist/web/assets/chevron-right-Cqh4mDk1.js +1 -0
- package/dist/web/assets/chips-input-2xWDofmE.js +1 -0
- package/dist/web/assets/choice-cards-CgAIqBGX.js +1 -0
- package/dist/web/assets/circle-x-DcU-0zVh.js +1 -0
- package/dist/web/assets/command-khhto70y.js +1 -0
- package/dist/web/assets/common-BPZV8TFb.js +1 -0
- package/dist/web/assets/connect-agent-guide-CJdw31p2.js +1 -0
- package/dist/web/assets/connect-host-lr2c3xWh.js +6 -0
- package/dist/web/assets/connection-row-DYx_5o0c.js +1 -0
- package/dist/web/assets/connections-C4NOFb5R.js +1 -0
- package/dist/web/assets/data-table-kW1pkRB5.js +1 -0
- package/dist/web/assets/empty-DzTDioBP.js +1 -0
- package/dist/web/assets/events-C9zJnPKK.js +1 -0
- package/dist/web/assets/eye-B9gT1QSq.js +1 -0
- package/dist/web/assets/eye-off-Diktqz_g.js +1 -0
- package/dist/web/assets/field-C6ejurju.js +1 -0
- package/dist/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/web/assets/get-started-C38bq1gZ.js +2 -0
- package/dist/web/assets/hidden-chars-Dr9TxfvF.js +1 -0
- package/dist/web/assets/index-DGzo3kGh.js +11 -0
- package/dist/web/assets/index-zKOCQLGX.css +2 -0
- package/dist/web/assets/input-CWwJgozn.js +1 -0
- package/dist/web/assets/input-group-HG8OXcJ4.js +1 -0
- package/dist/web/assets/label-multi-select-sH8mllw8.js +1 -0
- package/dist/web/assets/labels-B5UqVwFo.js +1 -0
- package/dist/web/assets/laptop-BxJ4Nbj7.js +1 -0
- package/dist/web/assets/last-call-D-O5O94z.js +1 -0
- package/dist/web/assets/listener-handled-HNCuVrQ7.js +1 -0
- package/dist/web/assets/login-DaeKclcf.js +1 -0
- package/dist/web/assets/mail-C5fm2pTC.js +1 -0
- package/dist/web/assets/mcp-call-UoOTPFyh.js +1 -0
- package/dist/web/assets/mcp-call-card-Cr-OEDX2.js +3 -0
- package/dist/web/assets/message-square-quote-se8Bf3RP.js +1 -0
- package/dist/web/assets/mutations-CLPqJ6cj.js +1 -0
- package/dist/web/assets/network-igNw0VVx.js +1 -0
- package/dist/web/assets/pairing-XjuaVr2u.js +1 -0
- package/dist/web/assets/pairing-notifier-KPzOEZSO.js +1 -0
- package/dist/web/assets/paperclip-znS4iTrg.js +1 -0
- package/dist/web/assets/password-input-DV3aqcNf.js +1 -0
- package/dist/web/assets/pause-o-dK3khK.js +1 -0
- package/dist/web/assets/pencil-DkPFAhEq.js +1 -0
- package/dist/web/assets/play-DvCHND93.js +1 -0
- package/dist/web/assets/plug-CXAniEiR.js +1 -0
- package/dist/web/assets/plug-zap-BwR-l5wb.js +1 -0
- package/dist/web/assets/plus-B_TUslu3.js +1 -0
- package/dist/web/assets/preload-helper-Cc_aKyUb.js +1 -0
- package/dist/web/assets/public-url-rF2Xjyel.js +1 -0
- package/dist/web/assets/queries-Cv3nXx0U.js +42 -0
- package/dist/web/assets/refresh-cw-Ch5FNrby.js +1 -0
- package/dist/web/assets/revealed-keys-C_9NtJPY.js +1 -0
- package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/web/assets/rotate-ccw-B-mzPDk0.js +1 -0
- package/dist/web/assets/search-CTVKGomS.js +1 -0
- package/dist/web/assets/select-Bb806bpq.js +1 -0
- package/dist/web/assets/send-DuMVuYs1.js +1 -0
- package/dist/web/assets/settings-BWauhfFf.js +1 -0
- package/dist/web/assets/setup-B7bNKQOp.js +1 -0
- package/dist/web/assets/sheet-CYPwpUsH.js +1 -0
- package/dist/web/assets/shield-alert-CSYB-ThV.js +1 -0
- package/dist/web/assets/shield-check-BulpsYqK.js +1 -0
- package/dist/web/assets/sparkles-CUTiob4K.js +1 -0
- package/dist/web/assets/stamp-BNXUGNa3.js +1 -0
- package/dist/web/assets/step-url-51aMNak-.js +1 -0
- package/dist/web/assets/stream-Du7fY5_Y.js +1 -0
- package/dist/web/assets/tag-I5_-1jFL.js +1 -0
- package/dist/web/assets/terminal-BvxDFTJc.js +1 -0
- package/dist/web/assets/test-email-button-DYi7V_6X.js +1 -0
- package/dist/web/assets/toggle-group-Bdo1gmQ1.js +1 -0
- package/dist/web/assets/trash-Ci0aICEl.js +1 -0
- package/dist/web/assets/use-delivery-speed-BBh7W2q6.js +1 -0
- package/dist/web/assets/use-label-names-BXicesnP.js +1 -0
- package/dist/web/assets/use-sign-out-CPrY_oVO.js +1 -0
- package/dist/web/assets/useInfiniteQuery-DJLIM8yJ.js +1 -0
- package/dist/web/assets/useQuery-MrTwwNy5.js +1 -0
- package/dist/web/assets/useRouterState-D4OBK8l5.js +1 -0
- package/dist/web/assets/webhook-DjeeZiNC.js +1 -0
- package/dist/web/assets/webhook-bits-jw-y2D3u.js +1 -0
- package/dist/web/assets/webhook-sheet-B8h0skDe.js +34 -0
- package/dist/web/assets/webhooks-Cfsdpoyd.js +1 -0
- package/dist/web/assets/x-MF2TZ9aG.js +1 -0
- package/dist/web/favicon.svg +1 -0
- package/dist/web/index.html +27 -0
- package/package.json +98 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-B8Sd4Y7Y.js","names":[],"sources":["../server/listen/ui.ts"],"sourcesContent":["import pc from \"picocolors\";\n\n/** Visible width of a string (ignores ANSI colour codes). */\n// eslint-disable-next-line no-control-regex\nconst visible = (s: string) => s.replace(/\\x1b\\[[0-9;]*m/g, \"\").length;\n\n/** Draws a rounded box around lines of text. */\nexport function box(lines: string[], color: (s: string) => string = pc.cyan): string {\n const width = Math.max(...lines.map(visible));\n const top = color(`╭${\"─\".repeat(width + 4)}╮`);\n const bottom = color(`╰${\"─\".repeat(width + 4)}╯`);\n const body = lines.map((l) => `${color(\"│\")} ${l}${\" \".repeat(width - visible(l))} ${color(\"│\")}`);\n return [top, ...body, bottom].join(\"\\n\");\n}\n\n/** Makes untrusted text (email subjects, senders, command output) safe to print to a terminal: no escape sequences or control characters. */\nexport const safeText = (s: string, max = 200): string => {\n // eslint-disable-next-line no-control-regex\n const cleaned = s.replace(/[\\u0000-\\u001f\\u007f-\\u009f---]/g, \" \").replace(/\\s+/g, \" \").trim();\n return cleaned.length > max ? `${cleaned.slice(0, max - 1)}…` : cleaned;\n};\n\nexport function formatDuration(ms: number): string {\n const s = Math.max(0, Math.round(ms / 1000));\n if (s < 60) return `${s}s`;\n const m = Math.floor(s / 60);\n if (m < 60) return `${m}m ${String(s % 60).padStart(2, \"0\")}s`;\n return `${Math.floor(m / 60)}h ${String(m % 60).padStart(2, \"0\")}m`;\n}\n\nconst FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\n/**\n * A one-line status that redraws in place on a TTY. Without a TTY (CI, an agent capturing output,\n * a log file) it prints a plain line only when the text changes meaningfully, at most every `plainEveryMs`.\n */\nexport class StatusLine {\n private frame = 0;\n private timer: NodeJS.Timeout | null = null;\n private lastPlain = 0;\n private text = \"\";\n constructor(\n private readonly out: NodeJS.WriteStream = process.stderr,\n private readonly plainEveryMs = 30_000,\n ) {}\n\n get tty(): boolean {\n return !!this.out.isTTY && !process.env.CI;\n }\n\n start(render: () => string): void {\n const tick = () => {\n this.text = render();\n if (this.tty) {\n this.out.write(`\\r\\x1b[2K${pc.cyan(FRAMES[this.frame++ % FRAMES.length]!)} ${this.text}`);\n } else if (Date.now() - this.lastPlain >= this.plainEveryMs) {\n this.lastPlain = Date.now();\n this.out.write(`${this.text}\\n`);\n }\n };\n tick();\n this.timer = setInterval(tick, this.tty ? 100 : 1000);\n this.timer.unref();\n }\n\n stop(): void {\n if (this.timer) clearInterval(this.timer);\n this.timer = null;\n if (this.tty) this.out.write(\"\\r\\x1b[2K\");\n }\n}\n"],"mappings":";;;;AAIA,MAAM,WAAW,MAAc,EAAE,QAAQ,mBAAmB,EAAE,CAAC,CAAC;;AAGhE,SAAgB,IAAI,OAAiB,QAA+B,GAAG,MAAc;CACnF,MAAM,QAAQ,KAAK,IAAI,GAAG,MAAM,IAAI,OAAO,CAAC;CAC5C,MAAM,MAAM,MAAM,IAAI,IAAI,OAAO,QAAQ,CAAC,EAAE,EAAE;CAC9C,MAAM,SAAS,MAAM,IAAI,IAAI,OAAO,QAAQ,CAAC,EAAE,EAAE;CAEjD,OAAO;EAAC;EAAK,GADA,MAAM,KAAK,MAAM,GAAG,MAAM,GAAG,EAAE,IAAI,IAAI,IAAI,OAAO,QAAQ,QAAQ,CAAC,CAAC,EAAE,IAAI,MAAM,GAAG,GAC7E;EAAG;CAAM,CAAC,CAAC,KAAK,IAAI;AACzC;;AAGA,MAAa,YAAY,GAAW,MAAM,QAAgB;CAExD,MAAM,UAAU,EAAE,QAAQ,0CAA0C,GAAG,CAAC,CAAC,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK;CACnG,OAAO,QAAQ,SAAS,MAAM,GAAG,QAAQ,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK;AAClE;AAEA,SAAgB,eAAe,IAAoB;CACjD,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,GAAI,CAAC;CAC3C,IAAI,IAAI,IAAI,OAAO,GAAG,EAAE;CACxB,MAAM,IAAI,KAAK,MAAM,IAAI,EAAE;CAC3B,IAAI,IAAI,IAAI,OAAO,GAAG,EAAE,IAAI,OAAO,IAAI,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE;CAC5D,OAAO,GAAG,KAAK,MAAM,IAAI,EAAE,EAAE,IAAI,OAAO,IAAI,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE;AACnE;AAEA,MAAM,SAAS;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG;;;;;AAMhE,IAAa,aAAb,MAAwB;CAMH;CACA;CANnB,QAAgB;CAChB,QAAuC;CACvC,YAAoB;CACpB,OAAe;CACf,YACE,MAA2C,QAAQ,QACnD,eAAgC,KAChC;EAFiB,KAAA,MAAA;EACA,KAAA,eAAA;CAChB;CAEH,IAAI,MAAe;EACjB,OAAO,CAAC,CAAC,KAAK,IAAI,SAAS,CAAC,QAAQ,IAAI;CAC1C;CAEA,MAAM,QAA4B;EAChC,MAAM,aAAa;GACjB,KAAK,OAAO,OAAO;GACnB,IAAI,KAAK,KACP,KAAK,IAAI,MAAM,YAAY,GAAG,KAAK,OAAO,KAAK,UAAU,OAAO,OAAQ,EAAE,GAAG,KAAK,MAAM;QACnF,IAAI,KAAK,IAAI,IAAI,KAAK,aAAa,KAAK,cAAc;IAC3D,KAAK,YAAY,KAAK,IAAI;IAC1B,KAAK,IAAI,MAAM,GAAG,KAAK,KAAK,GAAG;GACjC;EACF;EACA,KAAK;EACL,KAAK,QAAQ,YAAY,MAAM,KAAK,MAAM,MAAM,GAAI;EACpD,KAAK,MAAM,MAAM;CACnB;CAEA,OAAa;EACX,IAAI,KAAK,OAAO,cAAc,KAAK,KAAK;EACxC,KAAK,QAAQ;EACb,IAAI,KAAK,KAAK,KAAK,IAAI,MAAM,WAAW;CAC1C;AACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { networkInterfaces } from "node:os";
|
|
3
|
+
//#region server/urls.ts
|
|
4
|
+
/** This machine's IPv4 addresses other clients can reach it at (LAN, VPN, tailnet). */
|
|
5
|
+
function networkAddresses() {
|
|
6
|
+
return Object.values(networkInterfaces()).flat().filter((i) => i && i.family === "IPv4" && !i.internal).map((i) => i.address);
|
|
7
|
+
}
|
|
8
|
+
const isWildcardHost = (host) => host === "0.0.0.0" || host === "::" || host === "";
|
|
9
|
+
/** URLs the server is reachable at: localhost first, then LAN addresses when bound to all interfaces. */
|
|
10
|
+
function consoleUrls(host, port) {
|
|
11
|
+
if (!isWildcardHost(host)) return [`http://${host.includes(":") ? `[${host}]` : host}:${port}`];
|
|
12
|
+
return [`http://localhost:${port}`, ...networkAddresses().map((a) => `http://${a}:${port}`)];
|
|
13
|
+
}
|
|
14
|
+
/** A URL this machine can use to reach its own server (for health checks after `service install`). */
|
|
15
|
+
function loopbackUrl(host, port) {
|
|
16
|
+
if (isWildcardHost(host)) return `http://127.0.0.1:${port}`;
|
|
17
|
+
return `http://${host.includes(":") ? `[${host}]` : host}:${port}`;
|
|
18
|
+
}
|
|
19
|
+
/** RFC 1918, CGNAT, link-local and loopback IPv4: not reachable from the internet. */
|
|
20
|
+
function isPrivateIPv4(ip) {
|
|
21
|
+
const [a = -1, b = -1] = ip.split(".").map(Number);
|
|
22
|
+
return a === 10 || a === 127 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { networkAddresses as a, loopbackUrl as i, isPrivateIPv4 as n, isWildcardHost as r, consoleUrls as t };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=urls-U_LfYV61.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urls-U_LfYV61.js","names":[],"sources":["../server/urls.ts"],"sourcesContent":["import { networkInterfaces } from \"node:os\";\n\n/** This machine's IPv4 addresses other clients can reach it at (LAN, VPN, tailnet). */\nexport function networkAddresses(): string[] {\n return Object.values(networkInterfaces())\n .flat()\n .filter((i) => i && i.family === \"IPv4\" && !i.internal)\n .map((i) => i!.address);\n}\n\nexport const isWildcardHost = (host: string) => host === \"0.0.0.0\" || host === \"::\" || host === \"\";\n\n/** URLs the server is reachable at: localhost first, then LAN addresses when bound to all interfaces. */\nexport function consoleUrls(host: string, port: number): string[] {\n if (!isWildcardHost(host)) return [`http://${host.includes(\":\") ? `[${host}]` : host}:${port}`];\n return [`http://localhost:${port}`, ...networkAddresses().map((a) => `http://${a}:${port}`)];\n}\n\n/** A URL this machine can use to reach its own server (for health checks after `service install`). */\nexport function loopbackUrl(host: string, port: number): string {\n if (isWildcardHost(host)) return `http://127.0.0.1:${port}`;\n return `http://${host.includes(\":\") ? `[${host}]` : host}:${port}`;\n}\n\n/** RFC 1918, CGNAT, link-local and loopback IPv4: not reachable from the internet. */\nexport function isPrivateIPv4(ip: string): boolean {\n const [a = -1, b = -1] = ip.split(\".\").map(Number);\n return a === 10 || a === 127 || (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168) || (a === 100 && b >= 64 && b <= 127) || (a === 169 && b === 254);\n}\n"],"mappings":";;;;AAGA,SAAgB,mBAA6B;CAC3C,OAAO,OAAO,OAAO,kBAAkB,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,QAAQ,MAAM,KAAK,EAAE,WAAW,UAAU,CAAC,EAAE,QAAQ,CAAC,CACtD,KAAK,MAAM,EAAG,OAAO;AAC1B;AAEA,MAAa,kBAAkB,SAAiB,SAAS,aAAa,SAAS,QAAQ,SAAS;;AAGhG,SAAgB,YAAY,MAAc,MAAwB;CAChE,IAAI,CAAC,eAAe,IAAI,GAAG,OAAO,CAAC,UAAU,KAAK,SAAS,GAAG,IAAI,IAAI,KAAK,KAAK,KAAK,GAAG,MAAM;CAC9F,OAAO,CAAC,oBAAoB,QAAQ,GAAG,iBAAiB,CAAC,CAAC,KAAK,MAAM,UAAU,EAAE,GAAG,MAAM,CAAC;AAC7F;;AAGA,SAAgB,YAAY,MAAc,MAAsB;CAC9D,IAAI,eAAe,IAAI,GAAG,OAAO,oBAAoB;CACrD,OAAO,UAAU,KAAK,SAAS,GAAG,IAAI,IAAI,KAAK,KAAK,KAAK,GAAG;AAC9D;;AAGA,SAAgB,cAAc,IAAqB;CACjD,MAAM,CAAC,IAAI,IAAI,IAAI,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACjD,OAAO,MAAM,MAAM,MAAM,OAAQ,MAAM,OAAO,KAAK,MAAM,KAAK,MAAQ,MAAM,OAAO,MAAM,OAAS,MAAM,OAAO,KAAK,MAAM,KAAK,OAAS,MAAM,OAAO,MAAM;AAC7J"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { f as NPM_PACKAGE } from "./types-BhJDbSzE.js";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
//#region server/listen/version.ts
|
|
6
|
+
/** How printed instructions invoke the CLI without a global install. */
|
|
7
|
+
const NPX = `npx ${NPM_PACKAGE}`;
|
|
8
|
+
/** package.json sits above dist/ (bundled) or two levels above server/listen/ (source). */
|
|
9
|
+
function readVersion() {
|
|
10
|
+
for (const rel of ["..", "../.."]) try {
|
|
11
|
+
const pkg = JSON.parse(readFileSync(join(import.meta.dirname, rel, "package.json"), "utf8"));
|
|
12
|
+
if (pkg.name === "xaq-cli" && pkg.version) return pkg.version;
|
|
13
|
+
} catch {}
|
|
14
|
+
return "0.0.0";
|
|
15
|
+
}
|
|
16
|
+
const version = readVersion();
|
|
17
|
+
//#endregion
|
|
18
|
+
export { version as n, NPX as t };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=version-BxH7OuWD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-BxH7OuWD.js","names":[],"sources":["../server/listen/version.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { NPM_PACKAGE } from \"../../shared/types.ts\";\n\n/** How printed instructions invoke the CLI without a global install. */\nexport const NPX = `npx ${NPM_PACKAGE}`;\n\n/** package.json sits above dist/ (bundled) or two levels above server/listen/ (source). */\nfunction readVersion(): string {\n for (const rel of [\"..\", \"../..\"]) {\n try {\n const pkg = JSON.parse(readFileSync(join(import.meta.dirname, rel, \"package.json\"), \"utf8\")) as { name?: string; version?: string };\n if (pkg.name === NPM_PACKAGE && pkg.version) return pkg.version;\n } catch {\n // Try the next candidate.\n }\n }\n return \"0.0.0\";\n}\n\nexport const version = readVersion();\n"],"mappings":";;;;;;AAMA,MAAa,MAAM,OAAO;;AAG1B,SAAS,cAAsB;CAC7B,KAAK,MAAM,OAAO,CAAC,MAAM,OAAO,GAC9B,IAAI;EACF,MAAM,MAAM,KAAK,MAAM,aAAa,KAAK,YAAY,SAAS,KAAK,cAAc,GAAG,MAAM,CAAC;EAC3F,IAAI,IAAI,SAAA,aAAwB,IAAI,SAAS,OAAO,IAAI;CAC1D,QAAQ,CAER;CAEF,OAAO;AACT;AAEA,MAAa,UAAU,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{D as t,N as n,Ut as r,Wt as i,_t as a,a as o,bt as s,ft as c,i as l,n as u,p as d,s as f,t as p,w as m,yt as h}from"./queries-Cv3nXx0U.js";import{t as g}from"./useQuery-MrTwwNy5.js";import{t as ee}from"./arrow-left-DZVAXoKj.js";import{t as te}from"./arrow-right-C2zcqRr2.js";import{c as ne}from"./pairing-XjuaVr2u.js";import{t as re}from"./bell-ring-ig3zn1iS.js";import{a as _,c as ie,i as ae,l as oe,n as se,o as v,r as ce,s as le,u as ue}from"./connect-agent-guide-CJdw31p2.js";import{t as de}from"./check-check-Ds1bPIGv.js";import{i as fe,n as pe,o as me,s as he,t as ge}from"./select-Bb806bpq.js";import{t as _e}from"./chevron-right-Cqh4mDk1.js";import{i as y,n as b,o as x,r as S,s as C,t as w}from"./card-GSO5o-Ug.js";import{t as ve}from"./circle-x-DcU-0zVh.js";import{F as ye,I as T,L as be,T as xe,d as E,f as D,i as Se,s as O,u as Ce}from"./common-BPZV8TFb.js";import{i as k,r as A,t as we}from"./audit-bits-CGyIprzK.js";import{n as Te,t as j}from"./trash-Ci0aICEl.js";import{t as Ee}from"./eye-off-Diktqz_g.js";import{n as De}from"./send-DuMVuYs1.js";import{n as Oe}from"./accounts-list-YfJzThZa.js";import{t as ke}from"./pencil-DkPFAhEq.js";import{t as Ae}from"./plug-zap-BwR-l5wb.js";import{t as M}from"./plus-B_TUslu3.js";import{a as N,i as je,l as Me,t as P}from"./field-C6ejurju.js";import{n as Ne}from"./chips-input-2xWDofmE.js";import{Dt as Pe,Et as Fe,P as Ie,ct as Le,dt as Re,ft as ze,i as Be,it as F,j as I,kt as L,lt as R,ut as z}from"./index-DGzo3kGh.js";import{a as B,i as Ve,n as V,o as H,r as U,s as W,t as G}from"./mutations-CLPqJ6cj.js";import{n as He,t as Ue}from"./input-CWwJgozn.js";import{i as We,n as Ge,r as Ke}from"./revealed-keys-C_9NtJPY.js";import{n as qe}from"./add-connection-C8JR-13R.js";import{m as Je}from"./labels-B5UqVwFo.js";import{i as Ye,n as Xe,r as K,t as Ze}from"./last-call-D-O5O94z.js";import{s as q}from"./mcp-call-UoOTPFyh.js";import{t as Qe}from"./use-delivery-speed-BBh7W2q6.js";import{t as J}from"./command-khhto70y.js";import{n as $e,r as et}from"./webhook-bits-jw-y2D3u.js";var Y={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};Y.node;var tt=a(Y),X=e(i(),1),Z=r();function nt({agentId:e}){let t=g(u.recentAudit(e)),r=t.data?.items.filter(t=>Xe(t,e)).slice(0,10)??[];return(0,Z.jsxs)(w,{children:[(0,Z.jsxs)(x,{children:[(0,Z.jsx)(C,{children:`Recent tool calls`}),(0,Z.jsx)(y,{children:`Tool calls this agent made, including anything a guardrail blocked.`}),(0,Z.jsx)(b,{children:(0,Z.jsx)(n,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(h,{to:`/audit`,search:{agentId:e},children:[`Full log `,(0,Z.jsx)(te,{})]})})})]}),(0,Z.jsx)(S,{children:t.isPending?(0,Z.jsx)(`div`,{className:`space-y-2`,children:[0,1,2].map(e=>(0,Z.jsx)(T,{className:`h-8`},e))}):t.isError?(0,Z.jsx)(O,{error:t.error,onRetry:()=>void t.refetch()}):r.length===0?(0,Z.jsx)(`p`,{className:`py-4 text-center text-sm text-muted-foreground`,children:`No tool calls yet. They appear here as soon as the agent uses its key.`}):(0,Z.jsx)(`ul`,{className:`divide-y`,children:r.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 py-2 text-sm`,children:[(0,Z.jsx)(we,{action:e.action}),(0,Z.jsx)(k,{outcome:e.outcome}),e.outcome===`denied`&&(0,Z.jsx)(A,{reason:e.reason}),(0,Z.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:(0,Z.jsx)(E,{date:e.ts})})]},e.id))})})]})}function rt({agentId:e}){let t=g(u.agentConnections(e)),r=g(u.approvalRules(e));return(0,Z.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`connections-heading`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap items-end justify-between gap-2`,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`connections-heading`,className:`text-lg font-semibold tracking-tight`,children:`Connections`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`What this agent may do with each connection. xaq enforces it on every call.`})]})}),t.isPending?(0,Z.jsx)(T,{className:`h-20 rounded-xl`}):t.isError?(0,Z.jsx)(O,{error:t.error,onRetry:()=>void t.refetch()}):t.data.length===0?(0,Z.jsx)(w,{children:(0,Z.jsxs)(S,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No connections yet. Add Notion, WHOOP or any MCP server for your agents.`}),(0,Z.jsxs)(n,{variant:`outline`,onClick:()=>qe(),children:[(0,Z.jsx)(M,{}),` Add connection`]})]})}):(0,Z.jsx)(w,{className:`gap-0 py-0`,children:(0,Z.jsx)(`ul`,{className:`divide-y`,children:t.data.map(t=>(0,Z.jsx)(it,{agentId:e,c:t},t.connectionId))})}),(0,Z.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-sm font-semibold`,children:[(0,Z.jsx)(de,{className:`size-4 text-muted-foreground`}),` Always allowed`]}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Calls you chose “Always allow this” for. They run without asking. Remove one to be asked again.`}),r.isPending?(0,Z.jsx)(T,{className:`h-12 rounded-xl`}):r.isError?(0,Z.jsx)(O,{error:r.error,onRetry:()=>void r.refetch()}):r.data.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:`Nothing yet.`}):(0,Z.jsx)(w,{className:`gap-0 py-0`,children:(0,Z.jsx)(`ul`,{className:`divide-y`,children:r.data.map(e=>(0,Z.jsx)(at,{r:e,connectionName:t.data?.find(t=>t.connectionId===e.connectionId)?.name??`a connection`},e.id))})})]})]})}function it({agentId:e,c:n}){let r=ye(6e4),i=f({...n,statusReason:null,expiresAt:null},r),a=G({mutationFn:async r=>{let i=`/api/connections/${encodeURIComponent(n.connectionId)}/grants`,a=await t(i);return t(i,{method:`PUT`,body:d(a,e,r)})},invalidate:[p.agentConnections(e),p.connections,p.approvalRules],success:(e,t)=>`${n.name}: ${o[t].label.toLowerCase()}`,errorTitle:`Couldn't change the access`});return(0,Z.jsxs)(`li`,{className:`flex flex-col gap-2 p-4 sm:flex-row sm:items-center`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(h,{to:`/connections/$connectionId`,params:{connectionId:n.connectionId},className:`font-medium hover:underline`,children:n.name}),n.status!==`active`&&(0,Z.jsx)(D,{tone:i.tone,children:i.label})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o[n.level].description})]}),(0,Z.jsxs)(ge,{value:n.level,onValueChange:e=>a.mutate(e),disabled:a.isPending,children:[(0,Z.jsx)(me,{className:`w-full sm:w-60`,"aria-label":`Access to ${n.name}`,children:(0,Z.jsx)(he,{})}),(0,Z.jsx)(pe,{children:l.map(e=>(0,Z.jsx)(fe,{value:e,children:o[e].label},e))})]})]})}function at({r:e,connectionName:r}){let i=G({mutationFn:()=>t(`/api/approval-rules/${encodeURIComponent(e.id)}`,{method:`DELETE`}),invalidate:[p.approvalRules],success:`Removed. It asks again next time.`,errorTitle:`Couldn't remove the rule`});return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`break-all`,children:[(0,Z.jsx)(`span`,{className:`font-mono font-medium`,children:q(e.tool,!0)}),` `,(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[`on `,r]})]}),(0,Z.jsxs)(`div`,{className:`text-xs break-all text-muted-foreground`,children:[e.targetPath?(0,Z.jsxs)(Z.Fragment,{children:[`Only for `,(0,Z.jsx)(`span`,{className:`font-mono`,children:q(e.targetPath,!0)}),` = `,(0,Z.jsx)(`span`,{className:`font-mono text-foreground`,children:q(e.targetValue??``,!0)})]}):`Any target`,` `,`· added `,(0,Z.jsx)(E,{date:e.createdAt})]})]}),(0,Z.jsx)(n,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove the rule for ${e.tool}`,disabled:i.isPending,onClick:()=>i.mutate(),children:(0,Z.jsx)(j,{})})]})}function ot({agent:e}){let r=s(),[i,a]=(0,X.useState)(!1),[o,c]=(0,X.useState)(),l=`/api/agents/${encodeURIComponent(e.id)}`,u=G({mutationFn:e=>t(l,{method:`PATCH`,body:e}),invalidate:[p.agents],success:(e,t)=>t.disabled===void 0?`Agent updated`:t.disabled?`${e.name} disabled`:`${e.name} enabled`,errorTitle:`Couldn't update the agent`}),d=G({mutationFn:()=>t(`${l}/rotate-key`,{method:`POST`}),invalidate:[p.agents],success:`New key created. The old key no longer works.`,errorTitle:!1,onSuccess:t=>{Ke(e.id,t.apiKey),c(t)}}),f=G({mutationFn:()=>t(l,{method:`DELETE`}),invalidate:[p.agents,p.webhooks,p.setupState,p.overview],success:`Agent "${e.name}" deleted`,errorTitle:!1,onSuccess:()=>{Ge(e.id),r({to:`/agents`})}});return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(n,{variant:`ghost`,size:`sm`,asChild:!0,className:`-ml-2 text-muted-foreground`,children:(0,Z.jsxs)(h,{to:`/agents`,children:[(0,Z.jsx)(ee,{}),` Agents`]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-2xl font-semibold tracking-tight`,children:e.name}),e.disabled&&(0,Z.jsx)(D,{tone:`idle`,children:`Disabled`})]}),e.description&&(0,Z.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:e.description}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 pt-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono`,children:[(0,Z.jsx)(De,{className:`size-3.5`}),` `,e.keyPrefix,`…`]}),(0,Z.jsxs)(`span`,{children:[`Last used `,(0,Z.jsx)(E,{date:e.lastUsedAt,fallback:`never`})]}),(0,Z.jsxs)(`span`,{children:[`Created `,(0,Z.jsx)(E,{date:e.createdAt})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ne,{id:`agent-enabled`,checked:!e.disabled,disabled:u.isPending,onCheckedChange:e=>u.mutate({disabled:!e})}),(0,Z.jsx)(Me,{htmlFor:`agent-enabled`,className:`text-sm`,children:e.disabled?`Disabled`:`Enabled`})]}),(0,Z.jsxs)(Le,{children:[(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(n,{variant:`outline`,size:`icon`,"aria-label":`Agent actions`,children:(0,Z.jsx)(Te,{})})}),(0,Z.jsxs)(R,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(z,{onSelect:()=>a(!0),children:[(0,Z.jsx)(ke,{}),` Edit name & description`]}),(0,Z.jsxs)(z,{onSelect:()=>F({title:`Rotate this agent's API key?`,description:`A new key is created and the current one stops working immediately. Update the agent's MCP configuration with the new key.`,confirmLabel:`Rotate key`,onConfirm:()=>d.mutateAsync()}),children:[(0,Z.jsx)(Pe,{}),` Rotate API key…`]}),(0,Z.jsx)(Re,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>F({title:`Delete ${e.name}?`,description:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{children:`Its API key stops working, and its grants and webhooks are deleted. Pending approvals it requested are rejected.`}),(0,Z.jsx)(`p`,{children:`Audit log entries are kept.`})]}),confirmLabel:`Delete agent`,destructive:!0,onConfirm:()=>f.mutateAsync()}),children:[(0,Z.jsx)(j,{}),` Delete agent…`]})]})]})]})]}),e.disabled&&(0,Z.jsx)(`p`,{className:`rounded-lg border border-dashed px-3 py-2 text-sm text-muted-foreground`,children:`This agent is disabled: its key is refused and its webhooks don't fire. Its permissions are kept for when you enable it again.`}),i&&(0,Z.jsx)(st,{agent:e,onOpenChange:a,onSave:e=>u.mutateAsync(e).then(()=>a(!1)),pending:u.isPending}),(0,Z.jsx)(V,{open:!!o,children:(0,Z.jsxs)(U,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-2xl`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsxs)(W,{children:[`New API key for `,e.name]}),(0,Z.jsx)(Ve,{children:`The previous key has stopped working. Update your agent's configuration with this one.`})]}),o&&(0,Z.jsx)(ie,{res:o}),(0,Z.jsx)(B,{children:(0,Z.jsx)(n,{onClick:()=>c(void 0),children:`I've saved the key`})})]})})]})}function st({agent:e,onOpenChange:t,onSave:r,pending:i}){let[a,o]=(0,X.useState)(e.name),[s,c]=(0,X.useState)(e.description??``);return(0,Z.jsx)(V,{open:!0,onOpenChange:t,children:(0,Z.jsx)(U,{children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),a.trim()&&r({name:a.trim(),description:s.trim()||null}).catch(()=>{})},className:`space-y-4`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(W,{children:`Edit agent`})}),(0,Z.jsxs)(je,{children:[(0,Z.jsxs)(P,{children:[(0,Z.jsx)(N,{htmlFor:`edit-name`,children:`Name`}),(0,Z.jsx)(Ue,{id:`edit-name`,value:a,onChange:e=>o(e.target.value),"aria-invalid":!a.trim()})]}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(N,{htmlFor:`edit-desc`,children:`Description`}),(0,Z.jsx)(He,{id:`edit-desc`,rows:3,value:s,onChange:e=>c(e.target.value)})]})]}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(n,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsxs)(n,{type:`submit`,disabled:!a.trim()||i,children:[i&&(0,Z.jsx)(m,{}),` Save`]})]})]})})})}function ct({agent:e}){let t=g(u.settings()),n=K(e),[r,i]=(0,X.useState)(null),a=r??n.tool??`claude-code`,[o,s]=(0,X.useState)(!1),c=t.data?.publicUrl??window.location.origin,l=I(c,a,o),d=[...e.listeners].sort((e,t)=>Number(t.connected)-Number(e.connected));return(0,Z.jsxs)(w,{children:[(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(re,{className:`size-4 text-muted-foreground`}),` Listeners`]}),(0,Z.jsxs)(y,{children:[`A listener keeps an outbound connection open from the agent's machine and wakes the agent `,(0,Z.jsx)(Qe,{of:`new mail arriving`,neutral:`when new mail arrives`}),`. No open ports or public URL needed on that machine.`]})]}),(0,Z.jsxs)(S,{className:`space-y-5`,children:[d.length>0?(0,Z.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,Z.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Z.jsx)(`thead`,{className:`bg-muted/40 text-left text-xs text-muted-foreground`,children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Status`}),(0,Z.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Machine`}),(0,Z.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Consumer`}),(0,Z.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Last seen`}),(0,Z.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Handled up to`})]})}),(0,Z.jsx)(`tbody`,{className:`divide-y`,children:d.map(e=>(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`td`,{className:`px-3 py-2.5 whitespace-nowrap`,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ce,{tone:e.connected?`good`:`idle`,pulse:e.connected}),e.connected?`Connected`:`Offline`]})}),(0,Z.jsxs)(`td`,{className:`px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:e.client.hostname??`Unknown host`}),(0,Z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:[e.client.platform,e.client.version&&`CLI ${e.client.version}`].filter(Boolean).join(` · `)||`—`})]}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 font-mono text-xs`,children:e.consumer}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 whitespace-nowrap`,children:e.connected?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`now`}):(0,Z.jsx)(E,{date:e.lastSeenAt,fallback:`never`})}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 text-right whitespace-nowrap text-muted-foreground tabular`,children:e.ackedSeq?`event #${xe(e.ackedSeq)}`:`nothing yet`})]},e.consumer))})]})}):(0,Z.jsx)(`p`,{className:`rounded-lg border border-dashed px-3 py-2.5 text-sm text-muted-foreground`,children:`No listener has connected for this agent yet.`}),(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium`,children:d.length?`Add or update a listener`:`Start a listener`}),(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Run these on the machine where this agent was connected with `,(0,Z.jsx)(`code`,{className:`font-mono text-foreground`,children:`npx xaq-cli connect`}),`: the listener uses the key connect saved there. For an agent created here with a copied key, use a webhook instead.`]}),(0,Z.jsx)(_,{value:a,onChange:i}),(0,Z.jsx)(se,{publicUrl:c,accepted:o,onAcceptedChange:s}),(0,Z.jsx)(ce,{c:l,tool:a})]})]})]})}function Q({agentId:e,className:r}){let[i,a]=(0,X.useState)(),[o,s]=(0,X.useState)(),[l,u]=(0,X.useState)(!1);return(0,Z.jsxs)(`div`,{className:c(`space-y-3`,r),children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(n,{variant:`outline`,onClick:async()=>{u(!0),s(void 0);try{a(await t(`/api/agents/${encodeURIComponent(e)}/test`,{method:`POST`}))}catch(e){a(void 0),s(e)}finally{u(!1)}},disabled:l,"aria-describedby":`test-${e}-hint`,children:[l?(0,Z.jsx)(m,{}):(0,Z.jsx)(Ae,{}),` Check key and tools (from the server)`]}),(0,Z.jsx)(`span`,{id:`test-${e}-hint`,className:`text-xs text-muted-foreground`,children:`Lists the tools this agent's access allows, as seen from the server. It doesn't reach your agent: that shows above once it calls xaq.`})]}),o!==void 0&&(0,Z.jsx)(Se,{error:o,title:`Check failed`}),(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,children:i&&(0,Z.jsxs)(`div`,{className:c(`space-y-2 rounded-lg border p-3`,i.ok?`border-success/30 bg-success/5`:`border-destructive/30 bg-destructive/5`),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[i.ok?(0,Z.jsx)(L,{className:`size-4 text-success`}):(0,Z.jsx)(ve,{className:`size-4 text-destructive`}),i.message]}),i.tools.length>0&&(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[i.tools.length,` tools available to this agent:`]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.tools.map(e=>(0,Z.jsx)(be,{variant:`secondary`,className:`font-mono font-normal`,children:e},e))})]})]})})]})}function $({agent:e,label:t}){let{calls:n,connectedAt:r}=Ye(e),i=Ze(n,Je);return(0,Z.jsx)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm`,children:i?(0,Z.jsxs)(Z.Fragment,{children:[i.ok?(0,Z.jsx)(L,{className:`size-4 shrink-0 text-success`}):(0,Z.jsx)(Fe,{className:`size-4 shrink-0 text-warning`}),(0,Z.jsxs)(`span`,{children:[`Last tool call `,(0,Z.jsx)(E,{date:i.call.ts}),` `,(0,Z.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`(`,i.call.action,`)`]}),i.note&&(0,Z.jsxs)(`span`,{className:`text-warning`,children:[`, `,i.note]})]})]}):r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{className:`size-4 shrink-0 text-success`}),(0,Z.jsxs)(`span`,{children:[`Connected `,(0,Z.jsx)(E,{date:r}),`, no tool calls yet`]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(tt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Not called yet: `,t,` hasn't used xaq's tools with this agent's key.`]})]})})}function lt({agent:e,apiKey:t}){let n=K(e);return n.known?n.paired&&!t?(0,Z.jsx)(ut,{agent:e,initialTool:n.tool}):(0,Z.jsx)(dt,{agent:e,apiKey:t}):null}function ut({agent:e,initialTool:t}){let{publicUrl:n}=le(),[r,i]=(0,X.useState)(null),a=r??t??`claude-code`,o=I(n,a),s=v(a);return(0,Z.jsxs)(w,{children:[(0,Z.jsxs)(x,{children:[(0,Z.jsx)(C,{children:`Give it the tools`}),(0,Z.jsx)(y,{children:`This agent was connected from its terminal, so its key is saved on that machine. Register xaq in its tool from there; the key is never shown.`})]}),(0,Z.jsxs)(S,{className:`space-y-5`,children:[(0,Z.jsx)($,{agent:e,label:t?v(t):`the agent`}),(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(_,{value:a,onChange:i}),a===`other`?(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Point your agent's MCP client at `,(0,Z.jsxs)(`code`,{className:`font-mono break-all text-foreground`,children:[n,`/mcp`]}),` with the header`,` `,(0,Z.jsx)(`code`,{className:`font-mono text-foreground`,children:`Authorization: Bearer <key>`}),`. The key is the "apiKey" field in`,` `,(0,Z.jsx)(`code`,{className:`font-mono break-all text-foreground`,children:`~/.config/xaq/profiles/default.json`}),` on that machine.`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Run on the machine where you ran `,(0,Z.jsx)(`code`,{className:`font-mono text-foreground`,children:`connect`}),` (skip it if you used --setup-mcp), then restart `,s,`:`]}),(0,Z.jsx)(J,{code:o.setupMcp,label:`setup-mcp command`}),o.mcpCheck&&(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Check that `,s,` has it: `,(0,Z.jsx)(`code`,{className:`font-mono text-foreground`,children:o.mcpCheck}),` lists`,` `,(0,Z.jsx)(`span`,{className:`font-mono text-foreground`,children:`xaq`}),`.`]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(ae,{})})]}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Teach it the rules with the xaq skill:`}),(0,Z.jsx)(J,{code:o.skillInstall,label:`skill install command`})]}),(0,Z.jsx)(Q,{agentId:e.id})]})]})}function dt({agent:e,apiKey:t}){return(0,Z.jsxs)(w,{children:[(0,Z.jsxs)(x,{children:[(0,Z.jsx)(C,{children:`Give it the tools`}),(0,Z.jsx)(y,{children:`Add xaq as an MCP server in your agent with this agent's key.`})]}),(0,Z.jsxs)(S,{className:`space-y-5`,children:[(0,Z.jsx)($,{agent:e,label:`your agent`}),(0,Z.jsx)(ue,{apiKey:t}),(0,Z.jsx)(Q,{agentId:e.id})]})]})}function ft({agentId:e}){let t=g(u.webhooks(e));return(0,Z.jsxs)(w,{children:[(0,Z.jsxs)(x,{children:[(0,Z.jsx)(C,{children:`Webhooks`}),(0,Z.jsx)(y,{children:`Push mail events to this agent as they happen, instead of it polling for them.`}),(0,Z.jsx)(b,{children:(0,Z.jsx)(n,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(h,{to:`/webhooks`,search:{new:e},children:[(0,Z.jsx)(M,{}),` Add webhook`]})})})]}),(0,Z.jsx)(S,{children:t.isPending?(0,Z.jsx)(T,{className:`h-14`}):t.isError?(0,Z.jsx)(O,{error:t.error,onRetry:()=>void t.refetch()}):t.data.length===0?(0,Z.jsxs)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:[`No webhooks. The agent can still pull events with the `,(0,Z.jsx)(`code`,{className:`font-mono text-foreground`,children:`wait_for_events`}),` MCP tool.`]}):(0,Z.jsx)(`ul`,{className:`-mx-2 divide-y`,children:t.data.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(h,{to:`/webhooks/$webhookId`,params:{webhookId:e.id},className:`flex items-center gap-3 rounded-md px-2 py-2.5 outline-none hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),(0,Z.jsx)($e,{enabled:e.enabled})]}),(0,Z.jsx)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.url}),(0,Z.jsx)(et,{webhook:e})]}),(0,Z.jsx)(_e,{className:`size-4 shrink-0 text-muted-foreground`})]})},e.id))})})]})}function pt(){let{agentId:e}=Be.useParams(),t=g(u.agent(e)),r=g(u.accounts()),i=We(e),[a,o]=(0,X.useState)(!1),s=Ie();if(t.isPending)return(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(T,{className:`h-16 w-80`}),(0,Z.jsx)(T,{className:`h-40`}),(0,Z.jsx)(T,{className:`h-64`})]});if(t.isError)return(0,Z.jsx)(O,{error:t.error,onRetry:()=>void t.refetch()});let c=t.data;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ot,{agent:c}),i&&!a&&(0,Z.jsxs)(w,{children:[(0,Z.jsxs)(x,{children:[(0,Z.jsx)(C,{children:`API key`}),(0,Z.jsx)(y,{children:`Visible until you leave or reload this page.`}),(0,Z.jsx)(b,{children:(0,Z.jsxs)(n,{variant:`ghost`,size:`sm`,onClick:()=>o(!0),children:[(0,Z.jsx)(Ee,{}),` Hide`]})})]}),(0,Z.jsx)(S,{children:(0,Z.jsx)(oe,{apiKey:i})})]}),(0,Z.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`access-heading`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`access-heading`,className:`text-lg font-semibold tracking-tight`,children:`Mailbox access`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`What this agent may do in each Gmail account. Guardrails are enforced by xaq; the agent can't bypass them.`})]}),r.isPending?(0,Z.jsx)(T,{className:`h-20 rounded-xl`}):r.isError?(0,Z.jsx)(O,{error:r.error,onRetry:()=>void r.refetch()}):r.data.length===0?(0,Z.jsx)(w,{children:(0,Z.jsxs)(S,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a Gmail account to give this agent something to work with.`}),(0,Z.jsx)(Oe,{variant:`outline`})]})}):(0,Z.jsx)(`div`,{className:`space-y-3`,children:r.data.map(e=>(0,Z.jsx)(ne,{agentId:c.id,account:e,grant:c.grants.find(t=>t.accountId===e.id),defaultOpen:r.data.length===1},e.id))})]}),s&&(0,Z.jsx)(rt,{agentId:c.id}),(0,Z.jsx)(lt,{agent:c,apiKey:i}),(0,Z.jsx)(ct,{agent:c}),(0,Z.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,Z.jsx)(ft,{agentId:c.id}),(0,Z.jsx)(nt,{agentId:c.id})]})]})}export{pt as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ct as t,E as n,Et as r,Ht as i,N as a,St as o,Ut as s,Wt as c,_t as l,bt as u,ft as d,n as f,pt as p,st as m,t as h,yt as g}from"./queries-Cv3nXx0U.js";import{t as _}from"./useQuery-MrTwwNy5.js";import{t as ee}from"./useRouterState-D4OBK8l5.js";import{t as te}from"./activity-DOIe7SAg.js";import{t as ne}from"./bot-Zk76q_39.js";import{i as re,n as ie,r as ae,t as oe}from"./use-sign-out-CPrY_oVO.js";import{t as se,u as ce}from"./common-BPZV8TFb.js";import{t as le}from"./mail-C5fm2pTC.js";import{t as ue}from"./connect-host-lr2c3xWh.js";import{t as v}from"./plug-CXAniEiR.js";import{t as de}from"./stamp-BNXUGNa3.js";import{t as fe}from"./webhook-DjeeZiNC.js";import{a as pe}from"./connection-row-DYx_5o0c.js";import"./field-C6ejurju.js";import{At as me,P as he,nt as y,ot as ge,p as _e,rt as b,st as x,tt as S,u as C}from"./index-DGzo3kGh.js";import{c as w,i as T,n as E,o as D,r as O,s as k}from"./mutations-CLPqJ6cj.js";import{r as A,t as j}from"./stream-Du7fY5_Y.js";import"./input-CWwJgozn.js";import{a as M,n as N,o as P,r as F,t as I}from"./sheet-CYPwpUsH.js";import{t as ve}from"./revealed-keys-C_9NtJPY.js";import{t as ye}from"./calendar-setup-Pn61Wj1n.js";import{t as be}from"./add-connection-C8JR-13R.js";import{t as xe}from"./pairing-notifier-KPzOEZSO.js";function Se(e){let n=r();return t(n.stores.location,o(e,n))}var L={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};L.node;var Ce=l(L),R={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};R.node;var we=l(R),z={name:`panel-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]],aliases:[`sidebar`]};z.node;var Te=l(z),B={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};B.node;var Ee=l(B),V={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};V.node;var H=l(V),U=e(c(),1),W=s();function De({version:e,service:t}){let{data:n}=_(f.systemLatest());return!n?.updateAvailable||!n.latest?(0,W.jsxs)(`span`,{className:`flex items-center gap-2 px-2 py-1 text-xs text-muted-foreground group-data-[collapsible=icon]:hidden`,children:[(0,W.jsx)(Ce,{className:`size-3.5`}),`xaq `,e??n?.current??``]}):(0,W.jsxs)(E,{children:[(0,W.jsx)(w,{asChild:!0,children:(0,W.jsxs)(`button`,{className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs text-chart-1 hover:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none group-data-[collapsible=icon]:hidden`,children:[(0,W.jsx)(re,{className:`size-3.5`}),(0,W.jsx)(`span`,{className:`flex-1`,children:`Update available`}),(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:n.latest})]})}),(0,W.jsx)(Oe,{current:n.current,latest:n.latest,command:n.command,service:t})]})}function Oe({current:e,latest:t,command:n,service:r}){return(0,W.jsxs)(O,{children:[(0,W.jsxs)(D,{children:[(0,W.jsx)(k,{children:`Update xaq`}),(0,W.jsxs)(T,{children:[`You're on `,e,`; the latest release is `,t,`.`,` `,r?`Run this on the server. It reinstalls the service with the latest version and keeps your data, accounts and agents.`:`Stop xaq, then run this on the server to start the latest version. Your data is kept.`]})]}),(0,W.jsx)(se,{code:n})]})}var G=`(max-width: 767px)`;function ke(e){let t=window.matchMedia(G);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function Ae(){return(0,U.useSyncExternalStore)(ke,()=>window.matchMedia(G).matches)}var je=`sidebar_state`,Me=604800,Ne=`16rem`,Pe=`18rem`,Fe=`3rem`,Ie=`b`,K=U.createContext(null);function q(){let e=U.useContext(K);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Le({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=Ae(),[c,l]=U.useState(!1),[u,f]=U.useState(e),p=t??u,m=U.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${je}=${t}; path=/; max-age=${Me}`},[n,p]),h=U.useCallback(()=>s?l(e=>!e):m(e=>!e),[s,m,l]);U.useEffect(()=>{let e=e=>{e.key===Ie&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=U.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:h}),[g,p,m,s,c,l,h]);return(0,W.jsx)(K.Provider,{value:_,children:(0,W.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Ne,"--sidebar-width-icon":Fe,...i},className:d(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function Re({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=q();return n===`none`?(0,W.jsx)(`div`,{"data-slot":`sidebar`,className:d(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,W.jsx)(I,{open:l,onOpenChange:u,...o,children:(0,W.jsxs)(N,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":Pe},side:e,children:[(0,W.jsxs)(M,{className:`sr-only`,children:[(0,W.jsx)(P,{children:`Sidebar`}),(0,W.jsx)(F,{children:`Displays the mobile sidebar.`})]}),(0,W.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,W.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,W.jsx)(`div`,{"data-slot":`sidebar-gap`,className:d(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,W.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:d(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,W.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function ze({className:e,onClick:t,...n}){let{toggleSidebar:r}=q();return(0,W.jsxs)(a,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:d(e),onClick:e=>{t?.(e),r()},...n,children:[(0,W.jsx)(Te,{}),(0,W.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function Be({className:e,...t}){return(0,W.jsx)(`main`,{"data-slot":`sidebar-inset`,className:d(`relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,e),...t})}function Ve({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:d(`flex flex-col gap-2 p-2`,e),...t})}function He({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:d(`flex flex-col gap-2 p-2`,e),...t})}function Ue({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:d(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function J({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:d(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function We({className:e,asChild:t=!1,...n}){let r=t?m:`div`;return(0,W.jsx)(r,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:d(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e),...n})}function Y({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:d(`w-full text-sm`,e),...t})}function X({className:e,...t}){return(0,W.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:d(`flex w-full min-w-0 flex-col gap-0`,e),...t})}function Z({className:e,...t}){return(0,W.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:d(`group/menu-item relative`,e),...t})}var Ge=p(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function Q({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o}){let s=e?m:`button`,{isMobile:c,state:l}=q(),u=(0,W.jsx)(s,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:d(Ge({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,W.jsxs)(S,{children:[(0,W.jsx)(b,{asChild:!0,children:u}),(0,W.jsx)(y,{side:`right`,align:`center`,hidden:l!==`collapsed`||c,...i})]})):u}function $({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`sidebar-menu-badge`,"data-sidebar":`menu-badge`,className:d(`pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground`,e),...t})}var Ke=[{label:`Monitor`,items:[{to:`/`,label:`Overview`,icon:we},{to:`/approvals`,label:`Approvals`,icon:de},{to:`/events`,label:`Live events`,icon:te},{to:`/audit`,label:`Audit log`,icon:Ee}]},{label:`Manage`,items:[{to:`/accounts`,label:`Gmail accounts`,icon:le},{to:`/connections`,label:`Connections`,icon:v,broker:!0},{to:`/agents`,label:`Agents`,icon:ne},{to:`/webhooks`,label:`Webhooks`,icon:fe},{to:`/settings`,label:`Settings`,icon:H}]}];function qe(){let e=Se({select:e=>e.pathname}),{setOpenMobile:t}=q(),n=()=>t(!1),{data:r}=_(f.approvals(`pending`)),{data:i}=_(f.system()),a=C(),{data:o}=_(f.pairings(`pending`)),s=(r?.length??0)+(o?.length??0),c=oe(),l=he();return(0,W.jsxs)(Re,{variant:`inset`,collapsible:`icon`,children:[(0,W.jsx)(Ve,{children:(0,W.jsx)(X,{children:(0,W.jsx)(Z,{children:(0,W.jsx)(Q,{size:`lg`,asChild:!0,children:(0,W.jsxs)(g,{to:`/`,onClick:n,children:[(0,W.jsx)(ge,{className:`size-8 shrink-0`}),(0,W.jsxs)(`div`,{className:`grid flex-1 text-left leading-tight`,children:[(0,W.jsx)(`span`,{className:`truncate font-semibold`,children:`xaq`}),(0,W.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:`Gmail for your agents`})]})]})})})})}),(0,W.jsxs)(Ue,{children:[_e(!!a.state,a.allDone,e)&&(0,W.jsx)(J,{children:(0,W.jsx)(Y,{children:(0,W.jsx)(X,{children:(0,W.jsxs)(Z,{children:[(0,W.jsx)(Q,{asChild:!0,tooltip:`Get started`,isActive:e.startsWith(`/get-started`),children:(0,W.jsxs)(g,{to:`/get-started`,onClick:n,children:[(0,W.jsx)(ie,{}),(0,W.jsx)(`span`,{children:`Get started`})]})}),(0,W.jsxs)($,{className:`tabular`,children:[a.finished,`/`,a.total]})]})})})}),Ke.map(t=>(0,W.jsxs)(J,{children:[(0,W.jsx)(We,{children:t.label}),(0,W.jsx)(Y,{children:(0,W.jsx)(X,{children:t.items.filter(e=>!e.broker||l).map(t=>(0,W.jsxs)(Z,{children:[(0,W.jsx)(Q,{asChild:!0,tooltip:t.label,isActive:t.to===`/`?e===`/`:e.startsWith(t.to),children:(0,W.jsxs)(g,{to:t.to,onClick:n,children:[(0,W.jsx)(t.icon,{}),(0,W.jsx)(`span`,{children:t.label})]})}),t.to===`/approvals`&&s>0&&(0,W.jsx)($,{className:`rounded-full bg-warning/20 px-1.5 text-foreground tabular`,"aria-label":`${s} pending`,children:s})]},t.to))})})]},t.label))]}),(0,W.jsx)(He,{children:(0,W.jsxs)(X,{children:[(0,W.jsx)(Z,{children:(0,W.jsxs)(Q,{tooltip:`Sign out`,onClick:c,children:[(0,W.jsx)(ae,{}),(0,W.jsx)(`span`,{children:`Sign out`})]})}),(0,W.jsx)(Z,{children:(0,W.jsx)(De,{version:i?.version,service:i?.service})})]})})]})}var Je={open:{tone:`good`,label:`Live`,tip:`Receiving live updates from the server.`},connecting:{tone:`idle`,label:`Connecting`,tip:`Opening the live update stream…`},reconnecting:{tone:`warn`,label:`Reconnecting`,tip:`The live stream dropped. Retrying; pages refresh once it's back.`},offline:{tone:`bad`,label:`Offline`,tip:`Can't reach the server for live updates. Retrying in the background.`}};function Ye(){let e=A(),t=Je[e];return(0,W.jsxs)(S,{children:[(0,W.jsx)(b,{asChild:!0,children:(0,W.jsxs)(`span`,{role:`status`,className:`flex items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,W.jsx)(ce,{tone:t.tone,pulse:e===`reconnecting`}),(0,W.jsx)(`span`,{className:`hidden sm:inline`,children:t.label}),(0,W.jsx)(`span`,{className:`sr-only sm:hidden`,children:t.label})]})}),(0,W.jsx)(y,{children:t.tip})]})}function Xe(){let e=u(),t=i(),r=ee({select:e=>e.location.href});return(0,U.useEffect)(()=>{let i=()=>{ve(),t.setQueryData(h.setupStatus,{claimed:!0,authenticated:!1}),e({to:`/login`,search:{redirect:r}})};return window.addEventListener(n,i),()=>window.removeEventListener(n,i)},[e,t,r]),(0,W.jsxs)(j,{children:[(0,W.jsxs)(Le,{defaultOpen:window.matchMedia(`(min-width: 1024px)`).matches,children:[(0,W.jsx)(`a`,{href:`#main`,className:`sr-only z-50 rounded-md bg-background px-3 py-2 text-sm font-medium focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:ring-2 focus:ring-ring`,children:`Skip to content`}),(0,W.jsx)(qe,{}),(0,W.jsxs)(Be,{className:`min-w-0`,children:[(0,W.jsxs)(`header`,{className:`sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 rounded-t-xl border-b bg-background/80 px-4 backdrop-blur`,children:[(0,W.jsx)(ze,{className:`-ml-1`}),(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsx)(Ye,{}),(0,W.jsx)(x,{})]}),(0,W.jsx)(`main`,{id:`main`,tabIndex:-1,className:`mx-auto w-full max-w-6xl min-w-0 flex-1 space-y-6 p-4 outline-none md:p-6 lg:p-8`,children:(0,W.jsx)(me,{})})]})]}),(0,W.jsx)(ue,{}),(0,W.jsx)(ye,{}),(0,W.jsx)(be,{}),(0,W.jsx)(pe,{}),(0,W.jsx)(xe,{})]})}export{Xe as component};
|