xaq-cli 0.1.0-nightly.73 → 0.1.0-nightly.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/dist/{commands-BXSQe3Za.js → commands-DsKEU8Pe.js} +7 -7
- package/dist/{commands-BXSQe3Za.js.map → commands-DsKEU8Pe.js.map} +1 -1
- package/dist/{import-D0af7Fv-.js → import-CjXjx6hA.js} +2 -2
- package/dist/{import-D0af7Fv-.js.map → import-CjXjx6hA.js.map} +1 -1
- package/dist/{manage-Bo6COB4p.js → manage-BlGiqPRV.js} +1 -2
- package/dist/{manage-Bo6COB4p.js.map → manage-BlGiqPRV.js.map} +1 -1
- package/dist/{manage-DoXqvjnU.js → manage-Dx5Ok81O.js} +1 -1
- package/dist/{server-BlOM8g-z.js → server-W9kGk9Jl.js} +532 -375
- package/dist/server-W9kGk9Jl.js.map +1 -0
- package/dist/settings-B5qSHxRM.js.map +1 -1
- package/dist/types-BhJDbSzE.js.map +1 -1
- package/dist/web/assets/_agentId-CzDPPzI9.js +1 -0
- package/dist/web/assets/_app-CUHQ4lt-.js +1 -0
- package/dist/web/assets/_app-DwRF-8UM.js +65 -0
- package/dist/web/assets/_connectionId-Bytsf1s4.js +1 -0
- package/dist/web/assets/{_webhookId-LfUlsULp.js → _webhookId-CyJq1ex_.js} +1 -1
- package/dist/web/assets/{account-status-CEszs13C.js → account-status-BrI33qHO.js} +1 -1
- package/dist/web/assets/{accounts-5m7aiXuZ.js → accounts-CtbNxDYa.js} +1 -1
- package/dist/web/assets/{accounts-list-YfJzThZa.js → accounts-list-DMVQW73C.js} +1 -1
- package/dist/web/assets/{activity-DOIe7SAg.js → activity-5HloXw1J.js} +1 -1
- package/dist/web/assets/add-connection-D_xU8Bs7.js +1 -0
- package/dist/web/assets/{agent-create-form-CPxnPYH4.js → agent-create-form-DvoQ8zk8.js} +1 -1
- package/dist/web/assets/{agents-B2Qj5KxT.js → agents-DDfJUZiR.js} +1 -1
- package/dist/web/assets/approvals-CgidTfXl.js +1 -0
- package/dist/web/assets/{approve._id-BLrQnzPM.js → approve._id-D8B03Cm1.js} +1 -1
- package/dist/web/assets/{arrow-left-DZVAXoKj.js → arrow-left-hEWj9kVI.js} +1 -1
- package/dist/web/assets/{arrow-right-C2zcqRr2.js → arrow-right-BEX9zqlZ.js} +1 -1
- package/dist/web/assets/{attention-gO9Nw5uW.js → attention-DxIYpy30.js} +1 -1
- package/dist/web/assets/{audit-BPXXre8S.js → audit-BX0zWXAZ.js} +1 -1
- package/dist/web/assets/{audit-bits-CGyIprzK.js → audit-bits-Do9LM2uY.js} +1 -1
- package/dist/web/assets/{bell-ring-ig3zn1iS.js → bell-ring-Dio7hQe2.js} +1 -1
- package/dist/web/assets/{bot-Zk76q_39.js → bot-DZvchThv.js} +1 -1
- package/dist/web/assets/{calendar-notice-DsCfq3VJ.js → calendar-notice-BwPSpDUE.js} +1 -1
- package/dist/web/assets/{calendar-plus-Cycfkk0y.js → calendar-plus-B4tRXTSf.js} +1 -1
- package/dist/web/assets/{calendar-setup-Pn61Wj1n.js → calendar-setup-CBtKgisk.js} +2 -2
- package/dist/web/assets/{card-GSO5o-Ug.js → card-BafVKmUQ.js} +1 -1
- package/dist/web/assets/{check-check-Ds1bPIGv.js → check-check-ByPkearG.js} +1 -1
- package/dist/web/assets/checkbox-BVmgUwsC.js +1 -0
- package/dist/web/assets/chevron-right-BIcES4fV.js +1 -0
- package/dist/web/assets/chips-input-DFeNsKwp.js +1 -0
- package/dist/web/assets/choice-cards-nixEe9y6.js +1 -0
- package/dist/web/assets/{circle-x-DcU-0zVh.js → circle-x-BgjeHqFg.js} +1 -1
- package/dist/web/assets/{command-khhto70y.js → command-B3_qWyNm.js} +1 -1
- package/dist/web/assets/{common-BPZV8TFb.js → common-DyzW6XHZ.js} +1 -1
- package/dist/web/assets/{connect-agent-guide-CJdw31p2.js → connect-agent-guide-BFwR-Ktv.js} +1 -1
- package/dist/web/assets/{connect-host-lr2c3xWh.js → connect-host-BSdhx8Mf.js} +2 -2
- package/dist/web/assets/connection-row-DxiW2ihZ.js +1 -0
- package/dist/web/assets/{connections-C4NOFb5R.js → connections-cMUsnxYf.js} +1 -1
- package/dist/web/assets/{data-table-kW1pkRB5.js → data-table-r8CYhCoC.js} +1 -1
- package/dist/web/assets/{empty-DzTDioBP.js → empty-CMTUeOtP.js} +1 -1
- package/dist/web/assets/events-PfrvkK0M.js +1 -0
- package/dist/web/assets/{eye-B9gT1QSq.js → eye-dgyFMt2X.js} +1 -1
- package/dist/web/assets/{eye-off-Diktqz_g.js → eye-off-Dqjd8vH5.js} +1 -1
- package/dist/web/assets/{field-C6ejurju.js → field-YgyXnSJq.js} +1 -1
- package/dist/web/assets/{get-started-C38bq1gZ.js → get-started-C0qSiXVI.js} +2 -2
- package/dist/web/assets/{hidden-chars-Dr9TxfvF.js → hidden-chars-C9ApeGqc.js} +1 -1
- package/dist/web/assets/index-CXE-zE4L.css +2 -0
- package/dist/web/assets/index-DlwjDobb.js +11 -0
- package/dist/web/assets/{input-CWwJgozn.js → input-Cc_xnlxT.js} +1 -1
- package/dist/web/assets/{input-group-HG8OXcJ4.js → input-group-pUr4oVx8.js} +1 -1
- package/dist/web/assets/label-multi-select-23SFetjr.js +1 -0
- package/dist/web/assets/{labels-B5UqVwFo.js → labels-B7I1pGV-.js} +1 -1
- package/dist/web/assets/{laptop-BxJ4Nbj7.js → laptop-CDlw2qRK.js} +1 -1
- package/dist/web/assets/{last-call-D-O5O94z.js → last-call-DWZSstxl.js} +1 -1
- package/dist/web/assets/{listener-handled-HNCuVrQ7.js → listener-handled-_1JR7i0-.js} +1 -1
- package/dist/web/assets/{login-DaeKclcf.js → login-BaE2JuVt.js} +1 -1
- package/dist/web/assets/{mail-C5fm2pTC.js → mail-C1sJjv_g.js} +1 -1
- package/dist/web/assets/{mcp-call-UoOTPFyh.js → mcp-call-9wGuKXyg.js} +1 -1
- package/dist/web/assets/mcp-call-card-Dxlb5yPL.js +3 -0
- package/dist/web/assets/{message-square-quote-se8Bf3RP.js → message-square-quote-DZ0468t4.js} +1 -1
- package/dist/web/assets/mutations-eDLDZNIB.js +1 -0
- package/dist/web/assets/{network-igNw0VVx.js → network-BruufyeY.js} +1 -1
- package/dist/web/assets/{pairing-XjuaVr2u.js → pairing-BM7P3m4E.js} +1 -1
- package/dist/web/assets/{pairing-notifier-KPzOEZSO.js → pairing-notifier-D_pN7Oqp.js} +1 -1
- package/dist/web/assets/{paperclip-znS4iTrg.js → paperclip-B6A8HRMb.js} +1 -1
- package/dist/web/assets/{password-input-DV3aqcNf.js → password-input-BJDsiP3o.js} +1 -1
- package/dist/web/assets/{pause-o-dK3khK.js → pause-CODF88Yo.js} +1 -1
- package/dist/web/assets/{pencil-DkPFAhEq.js → pencil-BJpilI3p.js} +1 -1
- package/dist/web/assets/{play-DvCHND93.js → play-x6-8X3Kt.js} +1 -1
- package/dist/web/assets/{plug-CXAniEiR.js → plug-DkmrHlD0.js} +1 -1
- package/dist/web/assets/{plug-zap-BwR-l5wb.js → plug-zap-BBY_UzfP.js} +1 -1
- package/dist/web/assets/plus-BdMlQV2O.js +1 -0
- package/dist/web/assets/{preload-helper-Cc_aKyUb.js → preload-helper-BLaPE9uF.js} +1 -1
- package/dist/web/assets/{public-url-rF2Xjyel.js → public-url-BTMfSn9y.js} +1 -1
- package/dist/web/assets/{queries-Cv3nXx0U.js → queries-CB1guBkM.js} +1 -1
- package/dist/web/assets/{refresh-cw-Ch5FNrby.js → refresh-cw-DLHNfQAr.js} +1 -1
- package/dist/web/assets/{revealed-keys-C_9NtJPY.js → revealed-keys-Crwan_Ge.js} +1 -1
- package/dist/web/assets/{rotate-ccw-B-mzPDk0.js → rotate-ccw-BSIBBSIr.js} +1 -1
- package/dist/web/assets/{search-CTVKGomS.js → search-_FwJ7zPJ.js} +1 -1
- package/dist/web/assets/select-BKebY75t.js +1 -0
- package/dist/web/assets/{send-DuMVuYs1.js → send-CMwtbuuP.js} +1 -1
- package/dist/web/assets/{settings-BWauhfFf.js → settings-SiwMHnpM.js} +1 -1
- package/dist/web/assets/setup-BJFzNXoH.js +1 -0
- package/dist/web/assets/{sheet-CYPwpUsH.js → sheet-gk49trYs.js} +1 -1
- package/dist/web/assets/{shield-alert-CSYB-ThV.js → shield-alert-BY8kDPfb.js} +1 -1
- package/dist/web/assets/{shield-check-BulpsYqK.js → shield-check-BBsCZ5UG.js} +1 -1
- package/dist/web/assets/{sparkles-CUTiob4K.js → sparkles-BDkS9XlA.js} +1 -1
- package/dist/web/assets/{stamp-BNXUGNa3.js → stamp-Cp2QXu24.js} +1 -1
- package/dist/web/assets/step-url-Dc554JOM.js +1 -0
- package/dist/web/assets/{stream-Du7fY5_Y.js → stream-ujzoo-JH.js} +1 -1
- package/dist/web/assets/{tag-I5_-1jFL.js → tag-6-LZsW72.js} +1 -1
- package/dist/web/assets/{terminal-BvxDFTJc.js → terminal-D46pEiJl.js} +1 -1
- package/dist/web/assets/test-email-button-DHLZl2vZ.js +1 -0
- package/dist/web/assets/toggle-group-BR5I8zPO.js +1 -0
- package/dist/web/assets/{trash-Ci0aICEl.js → trash-DTYsgeJY.js} +1 -1
- package/dist/web/assets/{use-delivery-speed-BBh7W2q6.js → use-delivery-speed-Byr_ASvB.js} +1 -1
- package/dist/web/assets/{use-label-names-BXicesnP.js → use-label-names-BGbSyz4r.js} +1 -1
- package/dist/web/assets/{use-sign-out-CPrY_oVO.js → use-sign-out-Bc7uFp-A.js} +1 -1
- package/dist/web/assets/{useInfiniteQuery-DJLIM8yJ.js → useInfiniteQuery-BMG2NU-Q.js} +1 -1
- package/dist/web/assets/{useQuery-MrTwwNy5.js → useQuery-6iC3scCF.js} +1 -1
- package/dist/web/assets/useRouterState-_3MPjKI3.js +1 -0
- package/dist/web/assets/{webhook-DjeeZiNC.js → webhook-BgWBopPN.js} +1 -1
- package/dist/web/assets/{webhook-bits-jw-y2D3u.js → webhook-bits-Cffr1ZuA.js} +1 -1
- package/dist/web/assets/{webhook-sheet-B8h0skDe.js → webhook-sheet-MMZXrVA4.js} +2 -2
- package/dist/web/assets/{webhooks-Cfsdpoyd.js → webhooks-CmK_pm2A.js} +1 -1
- package/dist/web/assets/{x-MF2TZ9aG.js → x-ChPOraw0.js} +1 -1
- package/dist/web/index.html +5 -5
- package/package.json +1 -1
- package/dist/server-BlOM8g-z.js.map +0 -1
- package/dist/web/assets/_agentId-DonOCOlC.js +0 -1
- package/dist/web/assets/_app-B7t5lEia.js +0 -1
- package/dist/web/assets/_app-DMTGqYpM.js +0 -65
- package/dist/web/assets/_connectionId-DR5vFXOg.js +0 -1
- package/dist/web/assets/add-connection-C8JR-13R.js +0 -1
- package/dist/web/assets/approvals-BGaVaoFy.js +0 -1
- package/dist/web/assets/checkbox-B937U-Fd.js +0 -1
- package/dist/web/assets/chevron-right-Cqh4mDk1.js +0 -1
- package/dist/web/assets/chips-input-2xWDofmE.js +0 -1
- package/dist/web/assets/choice-cards-CgAIqBGX.js +0 -1
- package/dist/web/assets/connection-row-DYx_5o0c.js +0 -1
- package/dist/web/assets/events-C9zJnPKK.js +0 -1
- package/dist/web/assets/index-DGzo3kGh.js +0 -11
- package/dist/web/assets/index-zKOCQLGX.css +0 -2
- package/dist/web/assets/label-multi-select-sH8mllw8.js +0 -1
- package/dist/web/assets/mcp-call-card-Cr-OEDX2.js +0 -3
- package/dist/web/assets/mutations-CLPqJ6cj.js +0 -1
- package/dist/web/assets/plus-B_TUslu3.js +0 -1
- package/dist/web/assets/select-Bb806bpq.js +0 -1
- package/dist/web/assets/setup-B7bNKQOp.js +0 -1
- package/dist/web/assets/step-url-51aMNak-.js +0 -1
- package/dist/web/assets/test-email-button-DYi7V_6X.js +0 -1
- package/dist/web/assets/toggle-group-Bdo1gmQ1.js +0 -1
- package/dist/web/assets/useRouterState-D4OBK8l5.js +0 -1
package/dist/cli.js
CHANGED
|
@@ -59,7 +59,7 @@ const SERVER_GROUP = "Run xaq:";
|
|
|
59
59
|
const AGENT_GROUP = "On an agent's machine:";
|
|
60
60
|
withServerOptions(program.command("start", { isDefault: true }).description("run xaq in this terminal and print the setup link (the default command)").summary("run it in this terminal (the default command)").helpGroup(SERVER_GROUP)).option("--no-open", "don't open a browser on first run").option("--dev", "development: API only, the console runs on Vite (:5173)").allowExcessArguments().action(async (o, cmd) => {
|
|
61
61
|
if (cmd.args.length) throw new Error(unknownCommand(cmd.args[0]));
|
|
62
|
-
const { runForeground } = await import("./server-
|
|
62
|
+
const { runForeground } = await import("./server-W9kGk9Jl.js");
|
|
63
63
|
await runForeground({
|
|
64
64
|
...configInput(o),
|
|
65
65
|
dev: !!o.dev,
|
|
@@ -140,7 +140,7 @@ program.command("reset-password").description("forgot the console password? Remo
|
|
|
140
140
|
});
|
|
141
141
|
const { registerListenCommands } = await import("./commands-tyhvFqiJ.js");
|
|
142
142
|
registerListenCommands(program);
|
|
143
|
-
const { registerConnectionsCommands } = await import("./commands-
|
|
143
|
+
const { registerConnectionsCommands } = await import("./commands-DsKEU8Pe.js");
|
|
144
144
|
registerConnectionsCommands(program);
|
|
145
145
|
const AGENT_SUMMARIES = {
|
|
146
146
|
connect: "pair an agent; you approve it in the console",
|
|
@@ -50,23 +50,23 @@ Examples:
|
|
|
50
50
|
${NPX} connections add notion
|
|
51
51
|
${NPX} connections add https://mcp.example.com/mcp --access read
|
|
52
52
|
${NPX} connections add http://127.0.0.1:8787/mcp # asks before allowing a server on this machine`).action(async (target, o) => {
|
|
53
|
-
const { addConnection } = await import("./manage-
|
|
53
|
+
const { addConnection } = await import("./manage-Dx5Ok81O.js");
|
|
54
54
|
process.exitCode = await withApi(o, (deps) => addConnection(target, o, deps));
|
|
55
55
|
});
|
|
56
56
|
dataOption(connections.command("list").description("list connections with their status and access")).action(async (o) => {
|
|
57
|
-
const { listConnections } = await import("./manage-
|
|
57
|
+
const { listConnections } = await import("./manage-Dx5Ok81O.js");
|
|
58
58
|
process.exitCode = await withApi(o, (deps) => listConnections(deps));
|
|
59
59
|
});
|
|
60
60
|
dataOption(connections.command("reconnect").description("sign in again (OAuth) or replace the key (header)").argument("<name>", "the connection's name")).option("--paste", "paste the address the browser lands on (automatic over SSH)").option("--header <name>", "header connections: the header's name (default: asks, Authorization)").action(async (slug, o) => {
|
|
61
|
-
const { reconnectConnection } = await import("./manage-
|
|
61
|
+
const { reconnectConnection } = await import("./manage-Dx5Ok81O.js");
|
|
62
62
|
process.exitCode = await withApi(o, (deps) => reconnectConnection(slug, o, deps));
|
|
63
63
|
});
|
|
64
64
|
dataOption(connections.command("disable").description("turn a connection off at once (the kill switch); turn it back on in the console").argument("<name>", "the connection's name")).option("-y, --yes", "don't ask").action(async (slug, o) => {
|
|
65
|
-
const { disableConnection } = await import("./manage-
|
|
65
|
+
const { disableConnection } = await import("./manage-Dx5Ok81O.js");
|
|
66
66
|
process.exitCode = await withApi(o, (deps) => disableConnection(slug, deps));
|
|
67
67
|
});
|
|
68
68
|
dataOption(connections.command("remove").description("remove a connection and delete its credentials").argument("<name>", "the connection's name")).option("-y, --yes", "don't ask").action(async (slug, o) => {
|
|
69
|
-
const { removeConnection } = await import("./manage-
|
|
69
|
+
const { removeConnection } = await import("./manage-Dx5Ok81O.js");
|
|
70
70
|
process.exitCode = await withApi(o, (deps) => removeConnection(slug, deps));
|
|
71
71
|
});
|
|
72
72
|
dataOption(program.command("import", { hidden: false }).description("move an agent tool's MCP servers into xaq: one connection each, credentials moved into xaq").summary("import MCP servers from Hermes, Claude Code, Cursor or Codex").helpGroup(GROUP).requiredOption("--from <client>", "hermes, claude-code, cursor or codex")).option("--dry-run", "print exactly what would be created and changed, and change nothing").option("--access <level>", "for every imported connection: full, ask (the default) or read").option("--agent <name>", "an agent that gets them (repeatable; default: all agents; \"all\")", collect).option("--profile <name>", "the agent profile setup-mcp uses for the single xaq entry (default \"default\")").option("--allow-private <origin>", "allow this exact scheme://host:port on this machine or a private network without asking (repeatable; --yes never does)", collect).option("-y, --yes", "answer yes to the confirmations (scripts); never to a private-network allow or a project's .mcp.json servers").addHelpText("after", `
|
|
@@ -81,7 +81,7 @@ with the single xaq entry, after a timestamped backup. The entry keeps the name
|
|
|
81
81
|
Examples:
|
|
82
82
|
${NPX} import --from hermes --dry-run
|
|
83
83
|
${NPX} import --from hermes`).action(async (o) => {
|
|
84
|
-
const { runImport } = await import("./import-
|
|
84
|
+
const { runImport } = await import("./import-CjXjx6hA.js");
|
|
85
85
|
const self = await selfOrigins(dataDirOf(o));
|
|
86
86
|
if (o.dryRun) {
|
|
87
87
|
const { TerminalPrompter } = await import("./prompt-CKMQx_MJ.js");
|
|
@@ -109,4 +109,4 @@ Examples:
|
|
|
109
109
|
//#endregion
|
|
110
110
|
export { registerConnectionsCommands };
|
|
111
111
|
|
|
112
|
-
//# sourceMappingURL=commands-
|
|
112
|
+
//# sourceMappingURL=commands-DsKEU8Pe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands-BXSQe3Za.js","names":[],"sources":["../server/connections-cli/commands.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { NPX } from \"../listen/version.ts\";\nimport { LEGACY_PRODUCT } from \"../brand.ts\";\nimport { resolveDataDir } from \"../config.ts\";\n\n/**\n * `connections …` and `import --from …`: run on the daemon's machine, talking to its admin API through the\n * one-time local admin session (admin.ts). Listed in --help since the console (#65) shipped; while the daemon's\n * `brokerUpstreams` setting is off they say so (CONNECTIONS_VISIBLE).\n */\nexport const CONNECTIONS_VISIBLE = true;\nconst GROUP = \"MCP connections (on xaq's machine):\";\n\nconst collect = (value: string, previous: string[] | undefined) => [...(previous ?? []), value];\n// --data, else XAQ_DATA (AGENTINBOX_DATA), else ~/.xaq or an existing pre-rename ~/.agentinbox (config.ts; rename-xaq: keep).\nconst dataDirOf = (o: { data?: string }) => resolveDataDir(o.data, { quiet: true });\nconst dataOption = (cmd: Command) => cmd.option(\"-d, --data <dir>\", `xaq's data directory (default ~/.xaq, or an existing ~/.${LEGACY_PRODUCT}; env XAQ_DATA)`);\n\nasync function withApi<T>(o: { data?: string; yes?: boolean }, run: (deps: { api: import(\"./api.ts\").ConnectionsApi; prompter: import(\"./prompt.ts\").Prompter }) => Promise<T>): Promise<T> {\n const { CLEANUP_SIGNALS, openAdminChannel } = await import(\"./admin.ts\");\n const { ConnectionsApi } = await import(\"./api.ts\");\n const { TerminalPrompter } = await import(\"./prompt.ts\");\n const channel = openAdminChannel({ dataDir: dataDirOf(o) });\n const handlers = CLEANUP_SIGNALS.map((sig) => {\n const h = () => {\n channel.close();\n process.exit(sig === \"SIGINT\" ? 130 : 128 + (sig === \"SIGTERM\" ? 15 : 1));\n };\n process.once(sig, h);\n return [sig, h] as const;\n });\n try {\n return await run({ api: new ConnectionsApi(channel), prompter: new TerminalPrompter(!!o.yes) });\n } finally {\n for (const [sig, h] of handlers) process.removeListener(sig, h);\n channel.close();\n }\n}\n\n/** This xaq's own MCP origins, so `import` never imports its own entry. */\nasync function selfOrigins(dataDir: string): Promise<string[]> {\n const { runningInstance } = await import(\"../instance.ts\");\n const { daemonOrigin } = await import(\"./admin.ts\");\n const running = runningInstance(dataDir);\n if (!running) return [];\n return [daemonOrigin(running), `http://localhost:${running.port}`, `http://127.0.0.1:${running.port}`, `http://[::1]:${running.port}`];\n}\n\nexport function registerConnectionsCommands(program: Command): void {\n const connections = program\n .command(\"connections\", { hidden: !CONNECTIONS_VISIBLE })\n .description(\"the MCP servers xaq connects agents to (Notion, WHOOP, any MCP URL); run on xaq's machine\")\n .summary(\"add, list, reconnect or remove connected MCP servers\")\n .helpGroup(GROUP);\n\n dataOption(\n connections\n .command(\"add\")\n .description(\"connect an integration (notion, whoop) or any MCP server URL, interactively\")\n .argument(\"<integration-or-url>\", \"notion, whoop, or an MCP server URL such as https://mcp.example.com/mcp\"),\n )\n .option(\"--slug <name>\", \"its name: agents see its tools as <name>__<tool>\")\n .option(\"--access <level>\", \"full, ask (ask before risky actions; the default) or read\")\n .option(\"--agent <name>\", 'an agent that gets it (repeatable; default: all agents; \"all\")', collect)\n .option(\"--header <name>\", \"header for a server that wants a static key (default Authorization)\")\n .option(\"--paste\", \"paste the address the browser lands on after signing in, instead of waiting for the redirect (automatic over SSH)\")\n .option(\"--allow-private <origin>\", \"allow this exact scheme://host:port on this machine or a private network without asking (--yes never does)\")\n .option(\"-y, --yes\", \"answer yes to confirmations and take the defaults (never to a private-network allow)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n ${NPX} connections add notion\n ${NPX} connections add https://mcp.example.com/mcp --access read\n ${NPX} connections add http://127.0.0.1:8787/mcp # asks before allowing a server on this machine`,\n )\n .action(async (target: string, o: import(\"./manage.ts\").AddFlags & { data?: string }) => {\n const { addConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => addConnection(target, o, deps));\n });\n\n dataOption(connections.command(\"list\").description(\"list connections with their status and access\")).action(async (o: { data?: string }) => {\n const { listConnections } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => listConnections(deps));\n });\n\n dataOption(connections.command(\"reconnect\").description(\"sign in again (OAuth) or replace the key (header)\").argument(\"<name>\", \"the connection's name\"))\n .option(\"--paste\", \"paste the address the browser lands on (automatic over SSH)\")\n .option(\"--header <name>\", \"header connections: the header's name (default: asks, Authorization)\")\n .action(async (slug: string, o: { data?: string; paste?: boolean; header?: string }) => {\n const { reconnectConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => reconnectConnection(slug, o, deps));\n });\n\n dataOption(connections.command(\"disable\").description(\"turn a connection off at once (the kill switch); turn it back on in the console\").argument(\"<name>\", \"the connection's name\"))\n .option(\"-y, --yes\", \"don't ask\")\n .action(async (slug: string, o: { data?: string; yes?: boolean }) => {\n const { disableConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => disableConnection(slug, deps));\n });\n\n dataOption(connections.command(\"remove\").description(\"remove a connection and delete its credentials\").argument(\"<name>\", \"the connection's name\"))\n .option(\"-y, --yes\", \"don't ask\")\n .action(async (slug: string, o: { data?: string; yes?: boolean }) => {\n const { removeConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => removeConnection(slug, deps));\n });\n\n dataOption(\n program\n .command(\"import\", { hidden: !CONNECTIONS_VISIBLE })\n .description(\"move an agent tool's MCP servers into xaq: one connection each, credentials moved into xaq\")\n .summary(\"import MCP servers from Hermes, Claude Code, Cursor or Codex\")\n .helpGroup(GROUP)\n .requiredOption(\"--from <client>\", \"hermes, claude-code, cursor or codex\"),\n )\n .option(\"--dry-run\", \"print exactly what would be created and changed, and change nothing\")\n .option(\"--access <level>\", \"for every imported connection: full, ask (the default) or read\")\n .option(\"--agent <name>\", 'an agent that gets them (repeatable; default: all agents; \"all\")', collect)\n .option(\"--profile <name>\", \"the agent profile setup-mcp uses for the single xaq entry (default \\\"default\\\")\")\n .option(\"--allow-private <origin>\", \"allow this exact scheme://host:port on this machine or a private network without asking (repeatable; --yes never does)\", collect)\n .option(\"-y, --yes\", \"answer yes to the confirmations (scripts); never to a private-network allow or a project's .mcp.json servers\")\n .addHelpText(\n \"after\",\n `\nReads: hermes ~/.hermes/config.yaml mcp_servers (+ ~/.hermes/.env) · claude-code ~/.claude.json and ./.mcp.json ·\ncursor ~/.cursor/mcp.json · codex ~/.codex/config.toml. Static headers move into xaq (encrypted); OAuth\nservers are created needing Connect (their tokens stay in the client); local (stdio) servers aren't supported yet\nand stay where they are. Servers on this machine or a private network are created only after you confirm the exact\nhost:port. Then it offers setup-mcp --tool <client>, which replaces the entries that now work through xaq\nwith the single xaq entry, after a timestamped backup. The entry keeps the name the profile already uses (\"xaq\", or\n\"${LEGACY_PRODUCT}\" for a profile set up before the rename), so Hermes routes and cron jobs confined to it keep working.\n\nExamples:\n ${NPX} import --from hermes --dry-run\n ${NPX} import --from hermes`,\n )\n .action(async (o: import(\"./import.ts\").ImportFlags & { data?: string }) => {\n const { runImport } = await import(\"./import.ts\");\n const self = await selfOrigins(dataDirOf(o));\n if (o.dryRun) {\n // Read-only: the admin channel (when the daemon runs) only lists existing connections.\n const { TerminalPrompter } = await import(\"./prompt.ts\");\n const { openAdminChannel } = await import(\"./admin.ts\");\n const { ConnectionsApi } = await import(\"./api.ts\");\n let channel: import(\"./admin.ts\").AdminChannel | null = null;\n try {\n process.exitCode = await runImport(o, {\n prompter: new TerminalPrompter(!!o.yes),\n openApi: () => new ConnectionsApi((channel = openAdminChannel({ dataDir: dataDirOf(o) }))),\n selfOrigins: self,\n });\n } finally {\n (channel as import(\"./admin.ts\").AdminChannel | null)?.close();\n }\n return;\n }\n process.exitCode = await withApi(o, (deps) => runImport(o, { prompter: deps.prompter, openApi: () => deps.api, selfOrigins: self }));\n });\n}\n"],"mappings":";;;;;AAWA,MAAM,QAAQ;AAEd,MAAM,WAAW,OAAe,aAAmC,CAAC,GAAI,YAAY,CAAC,GAAI,KAAK;AAE9F,MAAM,aAAa,MAAyB,eAAe,EAAE,MAAM,EAAE,OAAO,KAAK,CAAC;AAClF,MAAM,cAAc,QAAiB,IAAI,OAAO,oBAAoB,2DAA2D,eAAe,gBAAgB;AAE9J,eAAe,QAAW,GAAqC,KAA6H;CAC1L,MAAM,EAAE,iBAAiB,qBAAqB,MAAM,OAAO;CAC3D,MAAM,EAAE,mBAAmB,MAAM,OAAO;CACxC,MAAM,EAAE,qBAAqB,MAAM,OAAO;CAC1C,MAAM,UAAU,iBAAiB,EAAE,SAAS,UAAU,CAAC,EAAE,CAAC;CAC1D,MAAM,WAAW,gBAAgB,KAAK,QAAQ;EAC5C,MAAM,UAAU;GACd,QAAQ,MAAM;GACd,QAAQ,KAAK,QAAQ,WAAW,MAAM,OAAO,QAAQ,YAAY,KAAK,EAAE;EAC1E;EACA,QAAQ,KAAK,KAAK,CAAC;EACnB,OAAO,CAAC,KAAK,CAAC;CAChB,CAAC;CACD,IAAI;EACF,OAAO,MAAM,IAAI;GAAE,KAAK,IAAI,eAAe,OAAO;GAAG,UAAU,IAAI,iBAAiB,CAAC,CAAC,EAAE,GAAG;EAAE,CAAC;CAChG,UAAU;EACR,KAAK,MAAM,CA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EAAgE,CAAC,CAC5F,OAAO,kBAAkB,sEAAoE,OAAO,CAAC,CACrG,OAAO,oBAAoB,iFAAiF,CAAC,CAC7G,OAAO,4BAA4B,0HAA0H,OAAO,CAAC,CACrK,OAAO,aAAa,8GAA8G,CAAC,CACnI,YACC,SACA;;;;;;;GAOH,eAAe;;;IAGd,IAAI;IACJ,IAAI,sBACJ,CAAC,CACA,OAAO,OAAO,MAA6D;EAC1E,MAAM,EAAE,cAAc,MAAM,OAAO;EACnC,MAAM,OAAO,MAAM,YAAY,UAAU,CAAC,CAAC;EAC3C,IAAI,EAAE,QAAQ;GAEZ,MAAM,EAAE,qBAAqB,MAAM,OAAO;GAC1C,MAAM,EAAE,qBAAqB,MAAM,OAAO;GAC1C,MAAM,EAAE,mBAAmB,MAAM,OAAO;GACxC,IAAI,UAAoD;GACxD,IAAI;IACF,QAAQ,WAAW,MAAM,UAAU,GAAG;KACpC,UAAU,IAAI,iBAAiB,CAAC,CAAC,EAAE,GAAG;KACtC,eAAe,IAAI,eAAgB,UAAU,iBAAiB,EAAE,SAAS,UAAU,CAAC,EAAE,CAAC,CAAE;KACzF,aAAa;IACf,CAAC;GACH,UAAU;IACR,SAAuD,MAAM;GAC/D;GACA;EACF;EACA,QAAQ,WAAW,MAAM,QAAQ,IAAI,SAAS,UAAU,GAAG;GAAE,UAAU,KAAK;GAAU,eAAe,KAAK;GAAK,aAAa;EAAK,CAAC,CAAC;CACrI,CAAC;AACL"}
|
|
1
|
+
{"version":3,"file":"commands-DsKEU8Pe.js","names":[],"sources":["../server/connections-cli/commands.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { NPX } from \"../listen/version.ts\";\nimport { LEGACY_PRODUCT } from \"../brand.ts\";\nimport { resolveDataDir } from \"../config.ts\";\n\n/**\n * `connections …` and `import --from …`: run on the daemon's machine, talking to its admin API through the\n * one-time local admin session (admin.ts). Listed in --help since the console (#65) shipped; while the daemon's\n * `brokerUpstreams` setting is off they say so (CONNECTIONS_VISIBLE).\n */\nexport const CONNECTIONS_VISIBLE = true;\nconst GROUP = \"MCP connections (on xaq's machine):\";\n\nconst collect = (value: string, previous: string[] | undefined) => [...(previous ?? []), value];\n// --data, else XAQ_DATA (AGENTINBOX_DATA), else ~/.xaq or an existing pre-rename ~/.agentinbox (config.ts; rename-xaq: keep).\nconst dataDirOf = (o: { data?: string }) => resolveDataDir(o.data, { quiet: true });\nconst dataOption = (cmd: Command) => cmd.option(\"-d, --data <dir>\", `xaq's data directory (default ~/.xaq, or an existing ~/.${LEGACY_PRODUCT}; env XAQ_DATA)`);\n\nasync function withApi<T>(o: { data?: string; yes?: boolean }, run: (deps: { api: import(\"./api.ts\").ConnectionsApi; prompter: import(\"./prompt.ts\").Prompter }) => Promise<T>): Promise<T> {\n const { CLEANUP_SIGNALS, openAdminChannel } = await import(\"./admin.ts\");\n const { ConnectionsApi } = await import(\"./api.ts\");\n const { TerminalPrompter } = await import(\"./prompt.ts\");\n const channel = openAdminChannel({ dataDir: dataDirOf(o) });\n const handlers = CLEANUP_SIGNALS.map((sig) => {\n const h = () => {\n channel.close();\n process.exit(sig === \"SIGINT\" ? 130 : 128 + (sig === \"SIGTERM\" ? 15 : 1));\n };\n process.once(sig, h);\n return [sig, h] as const;\n });\n try {\n return await run({ api: new ConnectionsApi(channel), prompter: new TerminalPrompter(!!o.yes) });\n } finally {\n for (const [sig, h] of handlers) process.removeListener(sig, h);\n channel.close();\n }\n}\n\n/** This xaq's own MCP origins, so `import` never imports its own entry. */\nasync function selfOrigins(dataDir: string): Promise<string[]> {\n const { runningInstance } = await import(\"../instance.ts\");\n const { daemonOrigin } = await import(\"./admin.ts\");\n const running = runningInstance(dataDir);\n if (!running) return [];\n return [daemonOrigin(running), `http://localhost:${running.port}`, `http://127.0.0.1:${running.port}`, `http://[::1]:${running.port}`];\n}\n\nexport function registerConnectionsCommands(program: Command): void {\n const connections = program\n .command(\"connections\", { hidden: !CONNECTIONS_VISIBLE })\n .description(\"the MCP servers xaq connects agents to (Notion, WHOOP, any MCP URL); run on xaq's machine\")\n .summary(\"add, list, reconnect or remove connected MCP servers\")\n .helpGroup(GROUP);\n\n dataOption(\n connections\n .command(\"add\")\n .description(\"connect an integration (notion, whoop) or any MCP server URL, interactively\")\n .argument(\"<integration-or-url>\", \"notion, whoop, or an MCP server URL such as https://mcp.example.com/mcp\"),\n )\n .option(\"--slug <name>\", \"its name: agents see its tools as <name>__<tool>\")\n .option(\"--access <level>\", \"full, ask (ask before risky actions; the default) or read\")\n .option(\"--agent <name>\", 'an agent that gets it (repeatable; default: all agents; \"all\")', collect)\n .option(\"--header <name>\", \"header for a server that wants a static key (default Authorization)\")\n .option(\"--paste\", \"paste the address the browser lands on after signing in, instead of waiting for the redirect (automatic over SSH)\")\n .option(\"--allow-private <origin>\", \"allow this exact scheme://host:port on this machine or a private network without asking (--yes never does)\")\n .option(\"-y, --yes\", \"answer yes to confirmations and take the defaults (never to a private-network allow)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n ${NPX} connections add notion\n ${NPX} connections add https://mcp.example.com/mcp --access read\n ${NPX} connections add http://127.0.0.1:8787/mcp # asks before allowing a server on this machine`,\n )\n .action(async (target: string, o: import(\"./manage.ts\").AddFlags & { data?: string }) => {\n const { addConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => addConnection(target, o, deps));\n });\n\n dataOption(connections.command(\"list\").description(\"list connections with their status and access\")).action(async (o: { data?: string }) => {\n const { listConnections } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => listConnections(deps));\n });\n\n dataOption(connections.command(\"reconnect\").description(\"sign in again (OAuth) or replace the key (header)\").argument(\"<name>\", \"the connection's name\"))\n .option(\"--paste\", \"paste the address the browser lands on (automatic over SSH)\")\n .option(\"--header <name>\", \"header connections: the header's name (default: asks, Authorization)\")\n .action(async (slug: string, o: { data?: string; paste?: boolean; header?: string }) => {\n const { reconnectConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => reconnectConnection(slug, o, deps));\n });\n\n dataOption(connections.command(\"disable\").description(\"turn a connection off at once (the kill switch); turn it back on in the console\").argument(\"<name>\", \"the connection's name\"))\n .option(\"-y, --yes\", \"don't ask\")\n .action(async (slug: string, o: { data?: string; yes?: boolean }) => {\n const { disableConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => disableConnection(slug, deps));\n });\n\n dataOption(connections.command(\"remove\").description(\"remove a connection and delete its credentials\").argument(\"<name>\", \"the connection's name\"))\n .option(\"-y, --yes\", \"don't ask\")\n .action(async (slug: string, o: { data?: string; yes?: boolean }) => {\n const { removeConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => removeConnection(slug, deps));\n });\n\n dataOption(\n program\n .command(\"import\", { hidden: !CONNECTIONS_VISIBLE })\n .description(\"move an agent tool's MCP servers into xaq: one connection each, credentials moved into xaq\")\n .summary(\"import MCP servers from Hermes, Claude Code, Cursor or Codex\")\n .helpGroup(GROUP)\n .requiredOption(\"--from <client>\", \"hermes, claude-code, cursor or codex\"),\n )\n .option(\"--dry-run\", \"print exactly what would be created and changed, and change nothing\")\n .option(\"--access <level>\", \"for every imported connection: full, ask (the default) or read\")\n .option(\"--agent <name>\", 'an agent that gets them (repeatable; default: all agents; \"all\")', collect)\n .option(\"--profile <name>\", \"the agent profile setup-mcp uses for the single xaq entry (default \\\"default\\\")\")\n .option(\"--allow-private <origin>\", \"allow this exact scheme://host:port on this machine or a private network without asking (repeatable; --yes never does)\", collect)\n .option(\"-y, --yes\", \"answer yes to the confirmations (scripts); never to a private-network allow or a project's .mcp.json servers\")\n .addHelpText(\n \"after\",\n `\nReads: hermes ~/.hermes/config.yaml mcp_servers (+ ~/.hermes/.env) · claude-code ~/.claude.json and ./.mcp.json ·\ncursor ~/.cursor/mcp.json · codex ~/.codex/config.toml. Static headers move into xaq (encrypted); OAuth\nservers are created needing Connect (their tokens stay in the client); local (stdio) servers aren't supported yet\nand stay where they are. Servers on this machine or a private network are created only after you confirm the exact\nhost:port. Then it offers setup-mcp --tool <client>, which replaces the entries that now work through xaq\nwith the single xaq entry, after a timestamped backup. The entry keeps the name the profile already uses (\"xaq\", or\n\"${LEGACY_PRODUCT}\" for a profile set up before the rename), so Hermes routes and cron jobs confined to it keep working.\n\nExamples:\n ${NPX} import --from hermes --dry-run\n ${NPX} import --from hermes`,\n )\n .action(async (o: import(\"./import.ts\").ImportFlags & { data?: string }) => {\n const { runImport } = await import(\"./import.ts\");\n const self = await selfOrigins(dataDirOf(o));\n if (o.dryRun) {\n // Read-only: the admin channel (when the daemon runs) only lists existing connections.\n const { TerminalPrompter } = await import(\"./prompt.ts\");\n const { openAdminChannel } = await import(\"./admin.ts\");\n const { ConnectionsApi } = await import(\"./api.ts\");\n let channel: import(\"./admin.ts\").AdminChannel | null = null;\n try {\n process.exitCode = await runImport(o, {\n prompter: new TerminalPrompter(!!o.yes),\n openApi: () => new ConnectionsApi((channel = openAdminChannel({ dataDir: dataDirOf(o) }))),\n selfOrigins: self,\n });\n } finally {\n (channel as import(\"./admin.ts\").AdminChannel | null)?.close();\n }\n return;\n }\n process.exitCode = await withApi(o, (deps) => runImport(o, { prompter: deps.prompter, openApi: () => deps.api, selfOrigins: self }));\n });\n}\n"],"mappings":";;;;;AAWA,MAAM,QAAQ;AAEd,MAAM,WAAW,OAAe,aAAmC,CAAC,GAAI,YAAY,CAAC,GAAI,KAAK;AAE9F,MAAM,aAAa,MAAyB,eAAe,EAAE,MAAM,EAAE,OAAO,KAAK,CAAC;AAClF,MAAM,cAAc,QAAiB,IAAI,OAAO,oBAAoB,2DAA2D,eAAe,gBAAgB;AAE9J,eAAe,QAAW,GAAqC,KAA6H;CAC1L,MAAM,EAAE,iBAAiB,qBAAqB,MAAM,OAAO;CAC3D,MAAM,EAAE,mBAAmB,MAAM,OAAO;CACxC,MAAM,EAAE,qBAAqB,MAAM,OAAO;CAC1C,MAAM,UAAU,iBAAiB,EAAE,SAAS,UAAU,CAAC,EAAE,CAAC;CAC1D,MAAM,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AAa;EAAK,CAAC,CAAC;CACrI,CAAC;AACL"}
|
|
@@ -5,7 +5,7 @@ import { a as mcpServerName, n as loadProfile, r as profileExists } from "./prof
|
|
|
5
5
|
import "./recipes-D_quZbpA.js";
|
|
6
6
|
import { i as safeText } from "./ui-B8Sd4Y7Y.js";
|
|
7
7
|
import { _ as readTomlMcpServers, a as cursorConfigFile, c as mcpTarget, g as UNREADABLE$1, h as readTopMap, i as codexConfigFile, m as readMcpServers, n as claudeConfigFile, p as UNREADABLE, s as hermesHome, u as setupMcp } from "./mcpsetup-DjMhHnJo.js";
|
|
8
|
-
import { _ as chooseAccess, a as isWorking, d as waitWorking, f as reconnectHint, g as agentsLabel, h as accessLabel, m as checkTarget, p as slugify, v as chooseAgents, y as parseAccess } from "./manage-
|
|
8
|
+
import { _ as chooseAccess, a as isWorking, d as waitWorking, f as reconnectHint, g as agentsLabel, h as accessLabel, m as checkTarget, p as slugify, v as chooseAgents, y as parseAccess } from "./manage-BlGiqPRV.js";
|
|
9
9
|
import { existsSync, readFileSync } from "node:fs";
|
|
10
10
|
import { join } from "node:path";
|
|
11
11
|
import pc from "picocolors";
|
|
@@ -907,4 +907,4 @@ async function offerSetup(deps, api, client, who, working, pending, code) {
|
|
|
907
907
|
//#endregion
|
|
908
908
|
export { runImport };
|
|
909
909
|
|
|
910
|
-
//# sourceMappingURL=import-
|
|
910
|
+
//# sourceMappingURL=import-CjXjx6hA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-D0af7Fv-.js","names":["YAML_UNREADABLE","TOML_UNREADABLE"],"sources":["../server/connections-cli/routes.ts","../server/connections-cli/clients.ts","../server/connections-cli/import.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { hermesHome } from \"../listen/mcpsetup.ts\";\nimport type { ImportClient } from \"./clients.ts\";\nimport { readTopMap, UNREADABLE, type YamlValue } from \"./yaml.ts\";\n\n/**\n * Places in a client's config that confine something to the xaq MCP server alone: Hermes platform toolsets,\n * webhook routes (`toolsets: [\"mcp-<server>\", …]`) and cron jobs (`enabled_toolsets: [\"<server>\"]`). Once the\n * imported servers are served through xaq, each of these also sees their tools, so `import` warns before\n * replacing anything (docs/listen.md: an email-triggered route confined to xaq).\n */\nexport function confinedRoutes(client: ImportClient, serverName: string, env: NodeJS.ProcessEnv = process.env): string[] {\n if (client !== \"hermes\") return [];\n const home = hermesHome(env);\n const names = new Set([serverName, `mcp-${serverName}`]);\n const confines = (v: unknown) => Array.isArray(v) && v.some((x) => typeof x === \"string\" && names.has(x));\n const out: string[] = [];\n const read = (file: string): unknown => {\n try {\n return existsSync(file) ? JSON.parse(readFileSync(file, \"utf8\").replace(/^/, \"\")) : null;\n } catch {\n return null;\n }\n };\n try {\n const config = join(home, \"config.yaml\");\n if (existsSync(config)) {\n const yaml = readFileSync(config, \"utf8\");\n const platforms = readTopMap(yaml, \"platform_toolsets\") ?? {};\n for (const [platform, toolsets] of Object.entries(platforms)) if (confines(toolsets)) out.push(`platform_toolsets.${platform} (config.yaml)`);\n // Static webhook routes: platforms.webhook.extra.routes, a map of name → route or a list of routes.\n const get = (v: YamlValue | undefined, k: string): YamlValue | undefined => (v && typeof v === \"object\" && !Array.isArray(v) ? (v as Record<string, YamlValue>)[k] : undefined);\n const routes = get(get(get(readTopMap(yaml, \"platforms\") ?? undefined, \"webhook\"), \"extra\"), \"routes\");\n if (routes === UNREADABLE || (Array.isArray(routes) && routes.some((r) => r === UNREADABLE))) {\n out.push(\"webhook routes in config.yaml (platforms.webhook.extra.routes: couldn't be read, so check their toolsets)\");\n } else if (Array.isArray(routes)) {\n routes.forEach((r, i) => {\n if (confines(get(r, \"toolsets\"))) out.push(`webhook route ${String(get(r, \"name\") ?? `#${i + 1}`)} (config.yaml)`);\n });\n } else if (routes && typeof routes === \"object\") {\n for (const [name, r] of Object.entries(routes as Record<string, YamlValue>)) if (confines(get(r, \"toolsets\"))) out.push(`webhook route ${name} (config.yaml)`);\n }\n }\n } catch {\n // Unreadable: nothing to warn about from it.\n }\n const subs = read(join(home, \"webhook_subscriptions.json\"));\n if (subs && typeof subs === \"object\" && !Array.isArray(subs)) {\n for (const [route, r] of Object.entries(subs as Record<string, { toolsets?: unknown }>)) if (confines(r?.toolsets)) out.push(`webhook route ${route}`);\n }\n const cron = read(join(home, \"cron\", \"jobs.json\"));\n const jobs = (Array.isArray(cron) ? cron : ((cron as { jobs?: unknown } | null)?.jobs ?? [])) as { id?: unknown; name?: unknown; enabled_toolsets?: unknown }[];\n if (Array.isArray(jobs)) for (const j of jobs) if (confines(j?.enabled_toolsets)) out.push(`cron job ${String(j.name ?? j.id ?? \"?\")}`);\n return out;\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { claudeConfigFile, codexConfigFile, cursorConfigFile, hermesHome } from \"../listen/mcpsetup.ts\";\nimport { readTomlMcpServers, type TomlTable, UNREADABLE as TOML_UNREADABLE } from \"./toml.ts\";\nimport { readMcpServers, UNREADABLE as YAML_UNREADABLE, type YamlMap } from \"./yaml.ts\";\n\n/** Reads the MCP servers an agent's own tool is configured with (for `import --from`). */\n\nexport const IMPORT_CLIENTS = [\"hermes\", \"claude-code\", \"cursor\", \"codex\"] as const;\nexport type ImportClient = (typeof IMPORT_CLIENTS)[number];\n\nexport const CLIENT_LABELS: Record<ImportClient, string> = { hermes: \"Hermes\", \"claude-code\": \"Claude Code\", cursor: \"Cursor\", codex: \"Codex\" };\n\nexport interface ClientEntry {\n name: string;\n /** The file it's defined in. */\n file: string;\n /** Claude Code: which scope (user: ~/.claude.json; local: its projects[cwd]; project: ./.mcp.json). */\n scope?: \"user\" | \"local\" | \"project\";\n /** Claude Code local/project scope: the project directory (where `claude mcp remove` must run). */\n projectDir?: string;\n transport: \"http\" | \"sse\" | \"stdio\";\n url?: string;\n /** Static headers, with ${VAR} references resolved. Secret: never printed. */\n headers: Record<string, string>;\n /** Names of environment variables the headers came from (for the \"you can remove it from .env\" note). */\n headerVars: string[];\n /** Per header: the environment variables its value was built from (shown in the plan next to the destination). */\n headerSources: Record<string, string[]>;\n /**\n * Defined in a file the project ships (Claude Code's ./.mcp.json), not by the user: anyone who can commit to the\n * repository wrote it. Imported only when Claude Code approved it, and only after its own confirmation.\n */\n fromProject?: boolean;\n /** Client-side settings the broker doesn't carry over: tool filters and timeouts. */\n dropped?: DroppedSettings;\n /** The client says it uses OAuth (Hermes `auth: oauth`, an oauth block). Its tokens stay in the client. */\n oauth: boolean;\n enabled: boolean;\n /** Why it can't be imported as it is. */\n problem?: string;\n /** stdio: the command line, for the listing. */\n command?: string;\n}\n\nexport interface DroppedSettings {\n /** Tools the client hides from its agent (Hermes tools.exclude, Codex disabled_tools). */\n exclude?: string[];\n /** The only tools the client shows (Hermes tools.include, Codex enabled_tools). */\n include?: string[];\n /** Other settings by name, e.g. timeout, connect_timeout. */\n settings: string[];\n}\n\nconst strings = (v: unknown) => (Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : undefined);\n\nfunction droppedFrom(e: Record<string, unknown>, filters: { include: unknown; exclude: unknown }, settingKeys: string[]): DroppedSettings | undefined {\n const d: DroppedSettings = { settings: settingKeys.filter((k) => e[k] !== undefined && e[k] !== null) };\n const inc = strings(filters.include);\n const exc = strings(filters.exclude);\n if (inc?.length) d.include = inc;\n if (exc?.length) d.exclude = exc;\n return d.include || d.exclude || d.settings.length ? d : undefined;\n}\n\nexport interface ClientConfig {\n client: ImportClient;\n files: string[];\n entries: ClientEntry[];\n}\n\nexport interface ReadOptions {\n env?: NodeJS.ProcessEnv;\n cwd?: string;\n}\n\n/** Parses a dotenv file (KEY=VALUE, optional `export`, quotes). */\nexport function parseDotenv(text: string): Record<string, string> {\n const out: Record<string, string> = {};\n for (const raw of text.split(\"\\n\")) {\n const m = /^\\s*(?:export\\s+)?([A-Za-z_][A-Za-z0-9_]*)\\s*=\\s*(.*?)\\s*$/.exec(raw);\n if (!m) continue;\n let v = m[2]!;\n if ((v.startsWith('\"') && v.endsWith('\"') && v.length >= 2) || (v.startsWith(\"'\") && v.endsWith(\"'\") && v.length >= 2)) v = v.slice(1, -1);\n else v = v.replace(/\\s+#.*$/, \"\");\n out[m[1]!] = v;\n }\n return out;\n}\n\ntype Expanded = { value: string; vars: string[] } | { missing: string };\n\n/** `${VAR}` (and `${VAR:-default}`, `${env:VAR}`) from `vars`. */\nexport function expandVars(value: string, vars: Record<string, string | undefined>): Expanded {\n const used: string[] = [];\n let missing: string | null = null;\n const out = value.replace(/\\$\\{(?:env:)?([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\\}/g, (_m, name: string, def: string | undefined) => {\n const v = vars[name];\n if (v !== undefined && v !== \"\") {\n used.push(name);\n return v;\n }\n if (def !== undefined) return def;\n missing ??= name;\n return \"\";\n });\n return missing ? { missing } : { value: out, vars: used };\n}\n\nconst isObj = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\nconst readJson = (file: string): Record<string, unknown> | null => {\n if (!existsSync(file)) return null;\n const text = readFileSync(file, \"utf8\");\n if (!text.trim()) return {};\n try {\n const doc = JSON.parse(text) as unknown;\n if (!isObj(doc)) throw new Error(\"not an object\");\n return doc;\n } catch {\n throw new Error(`${file} isn't plain JSON (comments?), so it can't be read automatically.`);\n }\n};\n\n/** Shared by the JSON-shaped clients (Claude Code, Cursor): one `mcpServers` entry. */\nfunction jsonEntry(name: string, raw: unknown, file: string, vars: Record<string, string | undefined>, extra: Partial<ClientEntry> = {}): ClientEntry {\n const base: ClientEntry = { name, file, transport: \"http\", headers: {}, headerVars: [], headerSources: {}, oauth: false, enabled: true, ...extra };\n if (!isObj(raw)) return { ...base, problem: \"this entry isn't an object\" };\n if (raw.disabled === true || raw.enabled === false) base.enabled = false;\n const type = typeof raw.type === \"string\" ? raw.type.toLowerCase() : null;\n if (type === \"stdio\" || (typeof raw.command === \"string\" && !raw.url)) {\n const args = Array.isArray(raw.args) ? raw.args.map(String) : [];\n return { ...base, transport: \"stdio\", command: [String(raw.command ?? \"\"), ...args].join(\" \").trim() };\n }\n if (typeof raw.url !== \"string\") return { ...base, problem: \"no url\" };\n const url = expandVars(raw.url, vars);\n if (\"missing\" in url) return { ...base, problem: `its url uses \\${${url.missing}}, which isn't set here` };\n const entry: ClientEntry = { ...base, url: url.value, transport: type === \"sse\" ? \"sse\" : \"http\" };\n if (raw.headersHelper !== undefined || raw.headers_helper !== undefined) return { ...entry, problem: \"it gets its headers from a helper command, which the broker can't run\" };\n if (raw.oauth !== undefined || raw.auth !== undefined) entry.oauth = true;\n return withHeaders(entry, raw.headers, vars);\n}\n\nfunction withHeaders(entry: ClientEntry, headers: unknown, vars: Record<string, string | undefined>): ClientEntry {\n if (headers === undefined || headers === null) return entry;\n if (!isObj(headers)) return { ...entry, problem: \"its headers can't be read\" };\n for (const [k, v] of Object.entries(headers)) {\n if (typeof v !== \"string\") return { ...entry, problem: `its ${k} header can't be read` };\n const x = expandVars(v, vars);\n if (\"missing\" in x) return { ...entry, problem: `its ${k} header uses \\${${x.missing}}, which isn't set here` };\n entry.headers[k] = x.value;\n entry.headerVars.push(...x.vars);\n entry.headerSources[k] = x.vars;\n }\n return entry;\n}\n\n// ───────────── Hermes ─────────────\n\nexport function hermesFiles(env: NodeJS.ProcessEnv = process.env): { config: string; env: string } {\n const home = hermesHome(env);\n return { config: join(home, \"config.yaml\"), env: join(home, \".env\") };\n}\n\nfunction readHermes(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const files = hermesFiles(env);\n const result: ClientConfig = { client: \"hermes\", files: [files.config], entries: [] };\n if (!existsSync(files.config)) return result;\n const servers = readMcpServers(readFileSync(files.config, \"utf8\"));\n if (!servers) throw new Error(`${files.config} has an mcp_servers layout this can't read (flow style, several blocks, or tabs). Nothing was changed.`);\n // Hermes loads ~/.hermes/.env into its environment: the secrets its ${VAR} headers name live there.\n const vars = { ...env, ...(existsSync(files.env) ? parseDotenv(readFileSync(files.env, \"utf8\")) : {}) };\n for (const [name, raw] of Object.entries(servers)) {\n if (name.startsWith(\"\\u0000\")) continue;\n const base: ClientEntry = { name, file: files.config, transport: \"http\", headers: {}, headerVars: [], headerSources: {}, oauth: false, enabled: true };\n if (!raw || raw === YAML_UNREADABLE || typeof raw !== \"object\" || Array.isArray(raw)) {\n result.entries.push({ ...base, problem: \"this entry can't be read\" });\n continue;\n }\n const e = raw as YamlMap;\n const unreadable = [\"url\", \"headers\", \"command\", \"auth\", \"transport\", \"enabled\"].find((k) => e[k] === YAML_UNREADABLE);\n if (unreadable) {\n result.entries.push({ ...base, problem: `its ${unreadable} can't be read` });\n continue;\n }\n if (e.enabled === false || (typeof e.enabled === \"string\" && [\"false\", \"no\", \"off\", \"0\"].includes(e.enabled.toLowerCase()))) base.enabled = false;\n if (typeof e.command === \"string\") {\n const args = Array.isArray(e.args) ? e.args.filter((a) => typeof a === \"string\") : [];\n result.entries.push({ ...base, transport: \"stdio\", command: [e.command, ...args].join(\" \") });\n continue;\n }\n if (typeof e.url !== \"string\") {\n result.entries.push({ ...base, problem: \"no url\" });\n continue;\n }\n const url = expandVars(e.url, vars);\n if (\"missing\" in url) {\n result.entries.push({ ...base, problem: `its url uses \\${${url.missing}}, which isn't set in ${files.env}` });\n continue;\n }\n const tools = isObj(e.tools) ? (e.tools as Record<string, unknown>) : {};\n const entry: ClientEntry = {\n ...base,\n url: url.value,\n transport: e.transport === \"sse\" ? \"sse\" : \"http\",\n oauth: e.auth === \"oauth\" || isObj(e.oauth),\n dropped: droppedFrom(e as Record<string, unknown>, { include: tools.include, exclude: tools.exclude }, [\"timeout\", \"connect_timeout\"]),\n };\n if (e.client_cert !== undefined || e.identity_header !== undefined) {\n result.entries.push({ ...entry, problem: \"it uses a client certificate or identity header, which the broker doesn't support yet\" });\n continue;\n }\n result.entries.push(withHeaders(entry, e.headers ?? undefined, vars));\n }\n return result;\n}\n\n// ───────────── Claude Code ─────────────\n\nfunction readClaude(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const cwd = opts.cwd ?? process.cwd();\n const userFile = claudeConfigFile();\n const projectFile = join(cwd, \".mcp.json\");\n const result: ClientConfig = { client: \"claude-code\", files: [userFile, projectFile].filter(existsSync), entries: [] };\n const seen = new Set<string>();\n const add = (e: ClientEntry) => {\n // Claude Code's precedence: local, then project, then user. A shadowed one isn't what the agent uses.\n if (seen.has(e.name)) return;\n seen.add(e.name);\n result.entries.push(e);\n };\n const doc = readJson(userFile);\n const proj = doc && isObj(doc.projects) && isObj(doc.projects[cwd]) ? (doc.projects[cwd] as Record<string, unknown>) : {};\n const local = proj.mcpServers;\n if (isObj(local)) for (const [n, raw] of Object.entries(local)) add(jsonEntry(n, raw, userFile, env, { scope: \"local\", projectDir: cwd }));\n const project = readJson(projectFile);\n if (project && isObj(project.mcpServers)) {\n // ./.mcp.json comes with the repository. Claude Code itself only uses the servers the user approved for this\n // project (kept in ~/.claude.json, which the repository can't write); a project's own .claude/settings*.json\n // isn't trusted for this.\n const list = (v: unknown) => (Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : []);\n const enabled = new Set(list(proj.enabledMcpjsonServers));\n const disabled = new Set(list(proj.disabledMcpjsonServers));\n const all = proj.enableAllProjectMcpServers === true;\n for (const [n, raw] of Object.entries(project.mcpServers)) {\n const e = jsonEntry(n, raw, projectFile, env, { scope: \"project\", projectDir: cwd, fromProject: true });\n const why = disabled.has(n) ? \"turned off for this project in Claude Code\" : !all && !enabled.has(n) ? \"not approved in Claude Code\" : null;\n // An unapproved one isn't what Claude Code uses, so it doesn't shadow a user-scope server of the same name.\n if (why) result.entries.push({ ...e, problem: why });\n else add(e);\n }\n }\n if (doc && isObj(doc.mcpServers)) for (const [n, raw] of Object.entries(doc.mcpServers)) add(jsonEntry(n, raw, userFile, env, { scope: \"user\" }));\n return result;\n}\n\n// ───────────── Cursor ─────────────\n\nfunction readCursor(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const file = cursorConfigFile();\n const result: ClientConfig = { client: \"cursor\", files: [file], entries: [] };\n const doc = readJson(file);\n if (doc && isObj(doc.mcpServers)) for (const [n, raw] of Object.entries(doc.mcpServers)) result.entries.push(jsonEntry(n, raw, file, env));\n return result;\n}\n\n// ───────────── Codex ─────────────\n\nfunction readCodex(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const file = codexConfigFile();\n const result: ClientConfig = { client: \"codex\", files: [file], entries: [] };\n if (!existsSync(file)) return result;\n for (const [name, raw] of Object.entries(readTomlMcpServers(readFileSync(file, \"utf8\")))) {\n const base: ClientEntry = { name, file, transport: \"http\", headers: {}, headerVars: [], headerSources: {}, oauth: false, enabled: true };\n if (raw === TOML_UNREADABLE) {\n result.entries.push({ ...base, problem: \"this entry can't be read\" });\n continue;\n }\n const e = raw as TomlTable;\n if (e.enabled === false) base.enabled = false;\n if (typeof e.command === \"string\") {\n const args = Array.isArray(e.args) ? e.args.filter((a): a is string => typeof a === \"string\") : [];\n result.entries.push({ ...base, transport: \"stdio\", command: [e.command, ...args].join(\" \") });\n continue;\n }\n if (typeof e.url !== \"string\") {\n result.entries.push({ ...base, problem: \"no url\" });\n continue;\n }\n const entry: ClientEntry = {\n ...base,\n url: e.url,\n oauth: isObj(e.oauth) || e.auth === \"oauth\",\n dropped: droppedFrom(e, { include: e.enabled_tools, exclude: e.disabled_tools }, [\"tool_timeout_sec\", \"startup_timeout_sec\"]),\n };\n if (e.http_headers_helper !== undefined) {\n result.entries.push({ ...entry, problem: \"it gets its headers from a helper command, which the broker can't run\" });\n continue;\n }\n // Codex has no ${VAR} expansion: env_http_headers and bearer_token_env_var name variables instead.\n const headers: Record<string, string> = {};\n let problem: string | undefined;\n if (e.http_headers !== undefined) {\n if (!isObj(e.http_headers) || Object.values(e.http_headers).some((v) => typeof v !== \"string\")) problem = \"its http_headers can't be read\";\n else {\n Object.assign(headers, e.http_headers);\n for (const h of Object.keys(e.http_headers)) entry.headerSources[h] = [];\n }\n }\n const fromEnv: Record<string, unknown> = isObj(e.env_http_headers) ? { ...e.env_http_headers } : {};\n if (e.bearer_token_env_var !== undefined) fromEnv.Authorization = e.bearer_token_env_var;\n for (const [h, varName] of Object.entries(fromEnv)) {\n if (typeof varName !== \"string\") problem ??= `its ${h} header can't be read`;\n else if (!env[varName]) problem ??= `its ${h} header comes from $${varName}, which isn't set here`;\n else {\n headers[h] = h === \"Authorization\" && e.bearer_token_env_var === varName ? `Bearer ${env[varName]}` : env[varName]!;\n entry.headerVars.push(varName);\n entry.headerSources[h] = [varName];\n }\n }\n entry.headers = headers;\n result.entries.push(problem ? { ...entry, problem } : entry);\n }\n return result;\n}\n\nexport function readClientConfig(client: ImportClient, opts: ReadOptions = {}): ClientConfig {\n switch (client) {\n case \"hermes\":\n return readHermes(opts);\n case \"claude-code\":\n return readClaude(opts);\n case \"cursor\":\n return readCursor(opts);\n case \"codex\":\n return readCodex(opts);\n }\n}\n\nexport function parseImportClient(value: string): ImportClient {\n const v = value.trim().toLowerCase().replace(/^claude$/, \"claude-code\");\n if (!(IMPORT_CLIENTS as readonly string[]).includes(v)) throw new Error(`Unknown --from \"${value}\". Choose one of: ${IMPORT_CLIENTS.join(\", \")}.`);\n return v as ImportClient;\n}\n","import pc from \"picocolors\";\nimport type { Agent } from \"../../shared/types.ts\";\nimport type { AccessLevel } from \"../broker/types.ts\";\nimport { mcpTarget, type McpSetupResult, type RemoveServer, setupMcp } from \"../listen/mcpsetup.ts\";\nimport { DEFAULT_PROFILE, profilePath } from \"../listen/paths.ts\";\nimport { loadProfile, type Profile, profileExists } from \"../listen/profile.ts\";\nimport { safeText } from \"../listen/ui.ts\";\nimport { NPX } from \"../listen/version.ts\";\nimport type { LookupFn } from \"../webhooks/ssrf.ts\";\nimport { accessLabel, agentsLabel, chooseAccess, chooseAgents, parseAccess } from \"./access.ts\";\nimport { isWorking, waitWorking } from \"./manage.ts\";\nimport { confinedRoutes } from \"./routes.ts\";\nimport { mcpServerName } from \"../listen/recipes.ts\";\nimport type { ConnectionsApi, ConnectionView } from \"./api.ts\";\nimport { CLIENT_LABELS, type ClientConfig, type ClientEntry, type ImportClient, parseImportClient, readClientConfig } from \"./clients.ts\";\nimport { checkTarget } from \"./private.ts\";\nimport type { Prompter } from \"./prompt.ts\";\nimport { reconnectHint, slugify } from \"./util.ts\";\n\n/**\n * `import --from <client>`: one connection per remote MCP server in that client's config, with its static header\n * moved into the broker. OAuth servers are created needing Connect (their tokens stay in the client); stdio ones\n * aren't supported yet (M4) and stay where they are. Nothing is written without a confirmation (or --yes), and\n * the client's config is only touched by the optional setup-mcp step at the end, which removes just the entries\n * whose connection works.\n */\n\nexport interface ImportFlags {\n from: string;\n dryRun?: boolean;\n yes?: boolean;\n access?: string;\n agent?: string[];\n profile?: string;\n /** Exact `scheme://host:port` origins allowed without asking (--yes never allows one). */\n allowPrivate?: string[];\n}\n\nexport interface ImportDeps {\n prompter: Prompter;\n /** Opens the admin channel (not called for --dry-run). */\n openApi: () => ConnectionsApi;\n lookup?: LookupFn;\n env?: NodeJS.ProcessEnv;\n cwd?: string;\n /** This xaq's own MCP origins (loopback with its port), so its entry is never imported. */\n selfOrigins?: string[];\n /** How long to wait for a connected server's first tool sync (default 10 s), and how often to look. */\n verifyMs?: number;\n pollMs?: number;\n}\n\nexport type PlanItem =\n | { action: \"self\"; entry: ClientEntry }\n | { action: \"stdio\"; entry: ClientEntry }\n | { action: \"skip\"; entry: ClientEntry; reason: string }\n | { action: \"exists\"; entry: ClientEntry; connection: ConnectionView }\n | {\n action: \"create\";\n entry: ClientEntry;\n slug: string;\n url: string;\n /** header: moved into the broker; oauth: the client says so; none: no credential (the connect finds out). */\n auth: { type: \"header\"; name: string; value: string } | { type: \"oauth\" } | { type: \"none\" };\n /** The exact origin a private-target allow would cover, when the URL is on this machine or a private network. */\n privateTarget: string | null;\n };\n\n// Our own entry under its name, or under the one a profile from before the rename registered: never imported.\nconst SELF_NAME = /^(?:xaq|agentinbox)(?:-[a-z0-9][a-z0-9_-]*)?$/; // rename-xaq: keep\n\nfunction isSelf(e: ClientEntry, selfOrigins: string[]): boolean {\n if (SELF_NAME.test(e.name)) return true;\n if (Object.values(e.headers).some((v) => /^Bearer\\s+aib_/i.test(v.trim()))) return true;\n if (!e.url) return false;\n try {\n const u = new URL(e.url);\n return u.pathname.replace(/\\/+$/, \"\").endsWith(\"/mcp\") && selfOrigins.includes(u.origin);\n } catch {\n return false;\n }\n}\n\nconst sameUrl = (a: string | null | undefined, b: string) => {\n try {\n return !!a && new URL(a).href.replace(/\\/+$/, \"\") === new URL(b).href.replace(/\\/+$/, \"\");\n } catch {\n return false;\n }\n};\n\nexport async function planImport(config: ClientConfig, ctx: { existing?: ConnectionView[]; lookup?: LookupFn; selfOrigins?: string[] } = {}): Promise<PlanItem[]> {\n const label = CLIENT_LABELS[config.client];\n const taken = new Set((ctx.existing ?? []).map((c) => c.slug));\n const items: PlanItem[] = [];\n for (const entry of config.entries) {\n if (isSelf(entry, ctx.selfOrigins ?? [])) {\n items.push({ action: \"self\", entry });\n continue;\n }\n if (entry.transport === \"stdio\") {\n items.push({ action: \"stdio\", entry });\n continue;\n }\n if (entry.problem) {\n items.push({ action: \"skip\", entry, reason: entry.problem });\n continue;\n }\n if (!entry.enabled) {\n items.push({ action: \"skip\", entry, reason: `it's turned off in ${label}` });\n continue;\n }\n let url: URL;\n try {\n url = new URL(entry.url!);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") throw new Error(\"scheme\");\n } catch {\n items.push({ action: \"skip\", entry, reason: \"its url isn't an http(s) URL\" });\n continue;\n }\n const headerNames = Object.keys(entry.headers);\n if (headerNames.length > 1) {\n items.push({ action: \"skip\", entry, reason: `it sends ${headerNames.length} headers (${headerNames.join(\", \")}); a connection keeps one (not supported yet)` });\n continue;\n }\n const existing = (ctx.existing ?? []).find((c) => sameUrl(c.url, url.href));\n if (existing) {\n items.push({ action: \"exists\", entry, connection: existing });\n continue;\n }\n const target = await checkTarget(url, ctx.lookup);\n if (target.kind === \"never\") {\n items.push({\n action: \"skip\",\n entry,\n reason:\n target.why === \"ipv6_literal\"\n ? `the private-network allow takes a hostname or an IPv4 address, not ${target.address}`\n : `it's on ${target.address}, a link-local or cloud metadata address, which is never allowed`,\n });\n continue;\n }\n if (target.kind === \"public\" && url.protocol === \"http:\") {\n items.push({ action: \"skip\", entry, reason: \"plain http to a public host isn't allowed; use its https URL\" });\n continue;\n }\n let slug = slugify(entry.name);\n for (let n = 2; taken.has(slug); n++) slug = `${slugify(entry.name).slice(0, 21)}-${n}`;\n taken.add(slug);\n const auth = headerNames.length\n ? { type: \"header\" as const, name: headerNames[0]!, value: entry.headers[headerNames[0]!]! }\n : entry.oauth\n ? { type: \"oauth\" as const }\n : { type: \"none\" as const };\n items.push({ action: \"create\", entry, slug, url: entry.url!.trim(), auth, privateTarget: target.kind === \"private\" ? target.origin : null });\n }\n return items;\n}\n\nconst where = (e: ClientEntry) => (e.scope ? ` (${e.scope} scope)` : \"\");\nconst hostOf = (url: string) => {\n try {\n return new URL(url).host;\n } catch {\n return url;\n }\n};\n\n/** \"its Authorization header (from $GITHUB_TOKEN) is sent to mcp.example.com\": where each secret ends up. */\nfunction headerLine(i: Extract<PlanItem, { action: \"create\" }>): string | null {\n if (i.auth.type !== \"header\") return null;\n const vars = i.entry.headerSources[i.auth.name] ?? [];\n const from = vars.length ? ` (from ${vars.map((v) => `$${v}`).join(\", \")})` : \"\";\n return `its ${i.auth.name} header${from} moves into xaq (encrypted; never shown) and is sent to ${safeText(hostOf(i.url), 120)}`;\n}\n\n/** The plan in plain words. Never prints a header value. */\nexport function renderPlan(config: ClientConfig, items: PlanItem[]): string[] {\n const label = CLIENT_LABELS[config.client];\n const out: string[] = [];\n const width = Math.min(24, Math.max(4, ...items.map((i) => i.entry.name.length)));\n const pad = (s: string) => s.padEnd(width);\n const cont = \" \".repeat(width + 4);\n out.push(`${label}: ${config.files.join(\", \") || \"no config file\"} lists ${items.length} MCP server${items.length === 1 ? \"\" : \"s\"}.`);\n for (const i of items) {\n const name = ` ${pad(safeText(i.entry.name, 40))} `;\n switch (i.action) {\n case \"self\":\n out.push(`${name}${pc.dim(\"skip: this is xaq itself\")}`);\n break;\n case \"stdio\":\n out.push(`${name}${pc.yellow(\"not supported yet (M4)\")}: a local command (${safeText(i.entry.command ?? \"\", 60)}); it stays in ${label}`);\n break;\n case \"skip\":\n out.push(`${name}${pc.yellow(\"skip\")}: ${i.reason}; it stays in ${label}`);\n break;\n case \"exists\":\n if (isWorking(i.connection)) out.push(`${name}already connected: \"${i.connection.slug}\" (${i.connection.tools.total} tools)`);\n else {\n const why =\n i.entry.oauth || i.connection.authType === \"oauth\" || i.connection.status === \"needs_reauth\" ? \"needs Connect\" : `${i.connection.status}, ${i.connection.tools.total} tools`;\n out.push(`${name}already a connection: \"${i.connection.slug}\", ${why}; it stays in ${label} until it works`);\n out.push(`${cont}${reconnectHint(i.connection)}`);\n }\n out.push(...droppedLines(i.entry, cont));\n break;\n case \"create\": {\n out.push(`${name}${pc.green(\"create\")} connection \"${i.slug}\" → ${safeText(i.url, 120)}${where(i.entry)}`);\n if (i.entry.fromProject) out.push(`${cont}${pc.yellow(\"from the project's .mcp.json\")}: asked separately (--yes doesn't answer it)`);\n const h = headerLine(i);\n if (h) out.push(`${cont}${h}`);\n else if (i.auth.type === \"oauth\") out.push(`${cont}OAuth: created needing Connect (${label} keeps its own tokens); sign in once with the link it prints`);\n else out.push(`${cont}no credential in ${label}: connected as it is (if it turns out to use OAuth, it needs Connect)`);\n if (i.privateTarget) out.push(`${cont}${pc.yellow(\"private network\")}: needs the allow for exactly ${i.privateTarget}`);\n out.push(...droppedLines(i.entry, cont));\n break;\n }\n }\n }\n return out;\n}\n\n/** What the client did for this server that the broker doesn't: said in the plan, never silently dropped. */\nfunction droppedLines(e: ClientEntry, cont: string): string[] {\n const d = e.dropped;\n if (!d) return [];\n const out: string[] = [];\n const list = (xs: string[]) => xs.map((x) => safeText(x, 64)).join(\", \");\n if (d.exclude) out.push(`${cont}${pc.yellow(\"not carried over\")}: its tool filter hides ${list(d.exclude)}; through xaq every tool is listed (subject to the access level)`);\n if (d.include) out.push(`${cont}${pc.yellow(\"not carried over\")}: its tool filter shows only ${list(d.include)}; through xaq every tool is listed (subject to the access level)`);\n if (d.settings.length) out.push(`${cont}${pc.yellow(\"not carried over\")}: ${d.settings.join(\", \")} (xaq uses its own 60 s per call)`);\n return out;\n}\n\ntype CreateItem = Extract<PlanItem, { action: \"create\" }>;\n\ninterface Outcome {\n item: CreateItem;\n /** connected: works now; unverified: created, but not working (yet); authorize: needs a sign-in; failed: nothing kept. */\n status: \"connected\" | \"unverified\" | \"authorize\" | \"failed\";\n connection?: ConnectionView;\n authorizeUrl?: string;\n error?: string;\n}\n\nconst works = isWorking;\n\nfunction setupLines(r: McpSetupResult): string[] {\n const out = [r.ok ? `${r.dryRun ? pc.cyan(\"○\") : pc.green(\"✔\")} ${r.message}` : `${pc.yellow(\"!\")} ${r.message}`];\n for (const l of r.changes ?? []) out.push(l.startsWith(\" \") ? pc.gray(` ${l}`) : ` - ${l}`);\n if (r.backup) out.push(pc.gray(` Backup: ${r.backup}`));\n if (!r.ok) for (const l of r.manual ?? []) out.push(` ${l}`);\n for (const n of r.notes ?? []) out.push(pc.dim(` ${n}`));\n if (r.ok && r.verify?.length) out.push(` ${r.dryRun ? \"Afterwards, check it with\" : \"Check it with\"}: ${r.verify.map((v) => pc.cyan(v)).join(\"; \")}`);\n return out;\n}\n\nconst toRemove = (e: ClientEntry): RemoveServer => ({ name: e.name, scope: e.scope, projectDir: e.scope === \"user\" ? undefined : e.projectDir });\n\n/** The agent this machine's client uses (its xaq profile), if that agent is on this daemon. */\ninterface ClientAgent {\n profileName: string;\n profile: Profile | null;\n agent: Agent | null;\n}\n\nexport async function runImport(flags: ImportFlags, deps: ImportDeps): Promise<number> {\n const p = deps.prompter;\n const client: ImportClient = parseImportClient(flags.from);\n const label = CLIENT_LABELS[client];\n const access: AccessLevel | undefined = flags.access ? parseAccess(flags.access) : undefined;\n const config = readClientConfig(client, { env: deps.env, cwd: deps.cwd });\n if (!config.entries.length) {\n p.print(`${label} has no MCP servers configured (${config.files.join(\", \") || \"no config file\"}). Nothing to import.`);\n return 0;\n }\n const profileName = flags.profile ?? DEFAULT_PROFILE;\n\n if (flags.dryRun) {\n // Existing connections from the daemon when it's reachable, so a re-run's plan is the real one.\n let existing: ConnectionView[] | undefined;\n try {\n existing = await deps.openApi().list();\n } catch {\n existing = undefined;\n }\n const items = await planImport(config, { existing, lookup: deps.lookup, selfOrigins: deps.selfOrigins });\n p.print(pc.bold(\"Dry run: nothing is created or changed.\"));\n for (const l of renderPlan(config, items)) p.print(l);\n const creates = items.filter((i): i is CreateItem => i.action === \"create\");\n const priv = creates.filter((i) => i.privateTarget);\n p.print(\"\");\n p.print(`Would create ${creates.length} connection${creates.length === 1 ? \"\" : \"s\"} with ${access ? accessLabel(access) : \"the access you choose (default: Ask before risky actions)\"}.`);\n if (priv.length) p.print(`Would ask before allowing ${priv.map((i) => i.privateTarget).join(\", \")} (--yes never does; --allow-private <origin> does for that origin).`);\n if (!existing) p.print(pc.dim(\"xaq wasn't reachable, so existing connections weren't checked (the real run does: nothing is created twice).\"));\n const removable = [\n ...items.filter((i): i is Extract<PlanItem, { action: \"exists\" }> => i.action === \"exists\" && works(i.connection)).map((i) => toRemove(i.entry)),\n ...creates.filter((i) => i.auth.type !== \"oauth\").map((i) => toRemove(i.entry)),\n ];\n p.print(\"\");\n if (!removable.length) p.print(`${label}'s config isn't changed.`);\n else if (!profileExists(profileName)) {\n p.print(`Afterwards it offers to replace the imported entries in ${label} with the single xaq entry, once this machine's ${label} is paired (${NPX} connect <xaq-url> --tool ${client}).`);\n } else {\n p.print(`Afterwards it offers setup-mcp --tool ${client}, which would (for the entries whose connection works and that ${label}'s agent can use; OAuth ones after you Reconnect them):`);\n const r = setupMcp(client, mcpTarget(profileName, loadProfile(profileName)), profilePath(profileName), { dryRun: true, removeServers: removable });\n for (const l of setupLines(r)) p.print(l);\n }\n return 0;\n }\n\n const api = deps.openApi();\n const existing = await api.list();\n const items = await planImport(config, { existing, lookup: deps.lookup, selfOrigins: deps.selfOrigins });\n for (const l of renderPlan(config, items)) p.print(l);\n let creates = items.filter((i): i is CreateItem => i.action === \"create\");\n const already = items.filter((i): i is Extract<PlanItem, { action: \"exists\" }> => i.action === \"exists\");\n p.print(\"\");\n\n // A project's .mcp.json was written by whoever can commit to the repository: its own confirmation, never --yes.\n const fromProject = creates.filter((i) => i.entry.fromProject);\n if (fromProject.length) {\n p.print(pc.yellow(`These come from ${fromProject[0]!.entry.file}, which ships with the project (anyone who can commit to it wrote them):`));\n for (const i of fromProject) p.print(` ${safeText(i.entry.name, 40)} → ${safeText(i.url, 120)}${headerLine(i) ? `; ${headerLine(i)}` : \"\"}`);\n if (!(await p.confirmExplicit(`Import ${fromProject.length === 1 ? \"it\" : `these ${fromProject.length}`} into xaq?`, \"they stay in Claude Code\"))) {\n creates = creates.filter((i) => !i.entry.fromProject);\n }\n }\n\n // The private-target allow: only a person at the terminal (or --allow-private naming the exact origin) gives it.\n const preAllowed = new Set(flags.allowPrivate ?? []);\n const priv = creates.filter((i) => i.privateTarget && !preAllowed.has(i.privateTarget));\n for (const i of creates.filter((x) => x.privateTarget && preAllowed.has(x.privateTarget))) p.print(`Allowing ${i.privateTarget} (${safeText(i.entry.name, 40)}): --allow-private.`);\n if (priv.length) {\n p.print(pc.yellow(\"These servers are on this machine or your private network:\"));\n for (const i of priv) p.print(` ${i.privateTarget} (${safeText(i.entry.name, 40)})`);\n p.print(\n pc.dim(\"A connection to such a server can reach other services there too. Each allow covers exactly that scheme://host:port, for that connection only.\"),\n );\n const names = priv.map((i) => i.entry.name).join(\", \");\n if (!(await p.confirmExplicit(`Allow xaq to connect to ${priv.length === 1 ? \"it\" : `these ${priv.length}`}?`, `skipping ${names} (pass --allow-private <origin> to allow one)`))) {\n creates = creates.filter((i) => !priv.includes(i));\n }\n }\n\n const who = await clientAgent(api, profileName);\n if (!creates.length) {\n p.print(\"Nothing to create.\");\n return offerSetup(\n deps,\n api,\n client,\n who,\n already.filter((a) => works(a.connection)).map((a) => ({ entry: a.entry, connection: a.connection })),\n already.filter((a) => !works(a.connection)).map((a) => a.entry.name),\n 0,\n );\n }\n\n const level = await chooseAccess(p, access);\n let agents = await chooseAgents(p, api, flags.agent);\n if (agents !== \"all\" && who.agent && !agents.includes(who.agent.id)) {\n p.print(pc.yellow(`${safeText(who.agent.name, 60)} (the agent ${label} on this machine uses) isn't among them, so ${label} couldn't use these through xaq.`));\n if (await p.confirm(`Include ${safeText(who.agent.name, 60)}?`, true)) agents = [...agents, who.agent.id];\n }\n if (!(await p.confirm(`Create ${creates.length} connection${creates.length === 1 ? \"\" : \"s\"} (${accessLabel(level)}, ${agentsLabel(agents)})?`, true))) {\n p.print(\"Nothing was created.\");\n return 0;\n }\n\n const outcomes: Outcome[] = [];\n for (const item of creates) {\n let created: ConnectionView | null = null;\n try {\n created = await api.create({ slug: item.slug, name: item.entry.name, url: item.url, levelDefault: level, ...(agents === \"all\" ? {} : { agentIds: agents }) });\n if (item.privateTarget) await api.allowPrivateTarget(created.id, true);\n const r = await api.connect(created.id, item.auth.type === \"header\" ? { header: { name: item.auth.name, value: item.auth.value } } : {});\n if (r.status === \"connected\") {\n // \"connected\" means stored, not tested (a header connect doesn't call the server): wait for the first tool sync.\n const after = await waitWorking(api, r.connection, { pollMs: deps.pollMs, ms: deps.verifyMs });\n outcomes.push({ item, status: works(after) ? \"connected\" : \"unverified\", connection: after });\n } else if (r.status === \"authorize\") outcomes.push({ item, status: \"authorize\", connection: created, authorizeUrl: r.authorizeUrl });\n else throw new Error(r.message);\n } catch (err) {\n // Nothing half-made stays behind: running the import again retries it cleanly.\n if (created) await api.remove(created.id).catch(() => {});\n outcomes.push({ item, status: \"failed\", error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n p.print(\"\");\n for (const o of outcomes) {\n const name = safeText(o.item.entry.name, 40);\n if (o.status === \"failed\") p.print(`${pc.red(\"✘\")} ${name}: ${safeText(o.error!, 300)} (it stays in ${label})`);\n else if (o.status === \"connected\") p.print(`${pc.green(\"✔\")} ${name} → \"${o.connection!.slug}\", ${o.connection!.tools.total} tools`);\n else if (o.status === \"unverified\") {\n const c = o.connection!;\n p.print(`${pc.yellow(\"○\")} ${name} → \"${c.slug}\": not working (${c.status}${c.statusReason ? `: ${safeText(c.statusReason, 200)}` : \"\"}, ${c.tools.total} tools), so it stays in ${label}.`);\n p.print(` ${reconnectHint(c)} then run this import again.`);\n }\n else {\n p.print(`${pc.yellow(\"○\")} ${name} → \"${o.connection!.slug}\": needs Connect. Sign in (link valid 15 minutes):`);\n p.print(` ${pc.cyan(o.authorizeUrl!)}`);\n p.print(` ${reconnectHint(o.connection!)}`);\n }\n }\n const failed = outcomes.filter((o) => o.status === \"failed\").length;\n const working = [\n ...already.filter((a) => works(a.connection)).map((a) => ({ entry: a.entry, connection: a.connection })),\n ...outcomes.filter((o) => o.status === \"connected\").map((o) => ({ entry: o.item.entry, connection: o.connection! })),\n ];\n const pending = [\n ...already.filter((a) => !works(a.connection)).map((a) => a.entry.name),\n ...outcomes.filter((o) => o.status === \"authorize\" || o.status === \"unverified\").map((o) => o.item.entry.name),\n ];\n return offerSetup(deps, api, client, who, working, pending, failed ? 1 : 0);\n}\n\nasync function clientAgent(api: ConnectionsApi, profileName: string): Promise<ClientAgent> {\n if (!profileExists(profileName)) return { profileName, profile: null, agent: null };\n const profile = loadProfile(profileName);\n const agent = (await api.agents()).find((a) => a.id === profile.agentId && !a.disabled) ?? null;\n return { profileName, profile, agent };\n}\n\n/**\n * Step 2: replace the entries now served by the broker with the single xaq entry (setup-mcp). Only entries\n * the client's own agent can use through xaq go: the profile's agent must be on this daemon and have a grant\n * on the connection (offered when it has none).\n */\nasync function offerSetup(\n deps: ImportDeps,\n api: ConnectionsApi,\n client: ImportClient,\n who: ClientAgent,\n working: { entry: ClientEntry; connection: ConnectionView }[],\n pending: string[],\n code: number,\n): Promise<number> {\n const p = deps.prompter;\n const label = CLIENT_LABELS[client];\n if (pending.length) p.print(pc.dim(`${pending.join(\", \")} stay${pending.length === 1 ? \"s\" : \"\"} in ${label} until ${pending.length === 1 ? \"it works\" : \"they work\"} through xaq (Reconnect); then run this import again to replace ${pending.length === 1 ? \"it\" : \"them\"}.`));\n if (!working.length) return code;\n if (!who.profile) {\n p.print(\n `To replace ${working.map((w) => w.entry.name).join(\", \")} in ${label} with the single xaq entry, pair it first ` +\n `(${NPX} connect <xaq-url> --tool ${client}) and run this import again.`,\n );\n return code;\n }\n if (!who.agent) {\n p.print(\n pc.yellow(\n `The agent in your \"${who.profileName}\" profile (${safeText(who.profile.agentId, 40)}) isn't an agent of this xaq (or is disabled), so ${label} ` +\n `couldn't use these through it. Not replacing anything in ${label}. Pair it with this xaq (${NPX} connect <xaq-url> --tool ${client} --force), then run this import again.`,\n ),\n );\n return code;\n }\n const agentName = safeText(who.agent.name, 60);\n const usable: ClientEntry[] = [];\n for (const w of working) {\n if (w.entry.fromProject) {\n // ./.mcp.json is the project's file (often committed): left for its owners to change.\n p.print(pc.dim(` \"${w.entry.name}\" stays in ${w.entry.file}: it ships with the project. Remove it there if the project no longer needs it.`));\n continue;\n }\n const grants = await api.grants(w.connection.id);\n if (grants.some((g) => g.agentId === who.agent!.id)) {\n usable.push(w.entry);\n continue;\n }\n if (await p.confirm(`${agentName} (the agent ${label} uses) has no access to \"${w.connection.slug}\". Give it ${accessLabel(w.connection.levelDefault)}?`, true)) {\n await api.setGrants(w.connection.id, [...grants.map((g) => ({ agentId: g.agentId, level: g.level })), { agentId: who.agent.id, level: w.connection.levelDefault }]);\n usable.push(w.entry);\n } else p.print(pc.dim(` \"${w.entry.name}\" stays in ${label}: its agent couldn't use \"${w.connection.slug}\".`));\n }\n if (!usable.length) return code;\n p.print(\"\");\n const question = `Replace ${usable.map((e) => `\"${e.name}\"`).join(\", \")} in ${label} with the single xaq entry (setup-mcp --tool ${client}, with a backup)?`;\n const routes = confinedRoutes(client, mcpServerName(who.profileName), deps.env);\n let ok: boolean;\n if (routes.length) {\n const slugs = working.filter((w) => usable.includes(w.entry)).map((w) => w.connection.slug);\n p.print(pc.yellow(`These ${label} settings are limited to the xaq server only:`));\n for (const r of routes) p.print(` ${safeText(r, 120)}`);\n p.print(\n pc.yellow(\n `Through xaq they now also see the tools of ${slugs.map((s) => `\"${s}\"`).join(\", \")} (as <name>__<tool>), which ${routes.length === 1 ? \"it\" : \"they\"} couldn't reach before. ` +\n `If one is triggered by email or webhooks, those tools become reachable from that content. Give ${agentName} less access on those connections, or keep them out, if that's not what you want.`,\n ),\n );\n ok = await p.confirmExplicit(question, `${label}'s config wasn't changed; decide in a terminal`);\n } else ok = await p.confirm(question, true);\n if (!ok) {\n p.print(`${label}'s config wasn't changed. Run this import again any time to do it.`);\n return code;\n }\n const r = setupMcp(client, mcpTarget(who.profileName, who.profile), profilePath(who.profileName), { removeServers: usable.map(toRemove) });\n for (const l of setupLines(r)) p.print(l);\n const vars = [...new Set(usable.flatMap((e) => ((r.removed ?? []).includes(e.name) ? e.headerVars : [])))];\n if (r.ok && vars.length) {\n p.print(pc.dim(` ${vars.join(\", \")} ${vars.length === 1 ? \"is\" : \"are\"} no longer needed by the removed entries; delete ${vars.length === 1 ? \"it\" : \"them\"} from your environment${client === \"hermes\" ? \" (~/.hermes/.env)\" : \"\"} once everything works through xaq.`));\n }\n return r.ok ? code : 1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,SAAgB,eAAe,QAAsB,YAAoB,MAAyB,QAAQ,KAAe;CACvH,IAAI,WAAW,UAAU,OAAO,CAAC;CACjC,MAAM,OAAO,WAAW,GAAG;CAC3B,MAAM,wBAAQ,IAAI,IAAI,CAAC,YAAY,OAAO,YAAY,CAAC;CACvD,MAAM,YAAY,MAAe,MAAM,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,OAAO,MAAM,YAAY,MAAM,IAAI,CAAC,CAAC;CACxG,MAAM,MAAgB,CAAC;CACvB,MAAM,QAAQ,SAA0B;EACtC,IA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AC;CACxC,MAAM,OAAO,CAAC,GAAG,IAAI,IAAI,OAAO,SAAS,OAAQ,EAAE,WAAW,CAAC,EAAA,CAAG,SAAS,EAAE,IAAI,IAAI,EAAE,aAAa,CAAC,CAAE,CAAC,CAAC;CACzG,IAAI,EAAE,MAAM,KAAK,QACf,EAAE,MAAM,GAAG,IAAI,KAAK,KAAK,KAAK,IAAI,EAAE,GAAG,KAAK,WAAW,IAAI,OAAO,MAAM,mDAAmD,KAAK,WAAW,IAAI,OAAO,OAAO,wBAAwB,WAAW,WAAW,sBAAsB,GAAG,oCAAoC,CAAC;CAE3Q,OAAO,EAAE,KAAK,OAAO;AACvB"}
|
|
1
|
+
{"version":3,"file":"import-CjXjx6hA.js","names":["YAML_UNREADABLE","TOML_UNREADABLE"],"sources":["../server/connections-cli/routes.ts","../server/connections-cli/clients.ts","../server/connections-cli/import.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { hermesHome } from \"../listen/mcpsetup.ts\";\nimport type { ImportClient } from \"./clients.ts\";\nimport { readTopMap, UNREADABLE, type YamlValue } from \"./yaml.ts\";\n\n/**\n * Places in a client's config that confine something to the xaq MCP server alone: Hermes platform toolsets,\n * webhook routes (`toolsets: [\"mcp-<server>\", …]`) and cron jobs (`enabled_toolsets: [\"<server>\"]`). Once the\n * imported servers are served through xaq, each of these also sees their tools, so `import` warns before\n * replacing anything (docs/listen.md: an email-triggered route confined to xaq).\n */\nexport function confinedRoutes(client: ImportClient, serverName: string, env: NodeJS.ProcessEnv = process.env): string[] {\n if (client !== \"hermes\") return [];\n const home = hermesHome(env);\n const names = new Set([serverName, `mcp-${serverName}`]);\n const confines = (v: unknown) => Array.isArray(v) && v.some((x) => typeof x === \"string\" && names.has(x));\n const out: string[] = [];\n const read = (file: string): unknown => {\n try {\n return existsSync(file) ? JSON.parse(readFileSync(file, \"utf8\").replace(/^/, \"\")) : null;\n } catch {\n return null;\n }\n };\n try {\n const config = join(home, \"config.yaml\");\n if (existsSync(config)) {\n const yaml = readFileSync(config, \"utf8\");\n const platforms = readTopMap(yaml, \"platform_toolsets\") ?? {};\n for (const [platform, toolsets] of Object.entries(platforms)) if (confines(toolsets)) out.push(`platform_toolsets.${platform} (config.yaml)`);\n // Static webhook routes: platforms.webhook.extra.routes, a map of name → route or a list of routes.\n const get = (v: YamlValue | undefined, k: string): YamlValue | undefined => (v && typeof v === \"object\" && !Array.isArray(v) ? (v as Record<string, YamlValue>)[k] : undefined);\n const routes = get(get(get(readTopMap(yaml, \"platforms\") ?? undefined, \"webhook\"), \"extra\"), \"routes\");\n if (routes === UNREADABLE || (Array.isArray(routes) && routes.some((r) => r === UNREADABLE))) {\n out.push(\"webhook routes in config.yaml (platforms.webhook.extra.routes: couldn't be read, so check their toolsets)\");\n } else if (Array.isArray(routes)) {\n routes.forEach((r, i) => {\n if (confines(get(r, \"toolsets\"))) out.push(`webhook route ${String(get(r, \"name\") ?? `#${i + 1}`)} (config.yaml)`);\n });\n } else if (routes && typeof routes === \"object\") {\n for (const [name, r] of Object.entries(routes as Record<string, YamlValue>)) if (confines(get(r, \"toolsets\"))) out.push(`webhook route ${name} (config.yaml)`);\n }\n }\n } catch {\n // Unreadable: nothing to warn about from it.\n }\n const subs = read(join(home, \"webhook_subscriptions.json\"));\n if (subs && typeof subs === \"object\" && !Array.isArray(subs)) {\n for (const [route, r] of Object.entries(subs as Record<string, { toolsets?: unknown }>)) if (confines(r?.toolsets)) out.push(`webhook route ${route}`);\n }\n const cron = read(join(home, \"cron\", \"jobs.json\"));\n const jobs = (Array.isArray(cron) ? cron : ((cron as { jobs?: unknown } | null)?.jobs ?? [])) as { id?: unknown; name?: unknown; enabled_toolsets?: unknown }[];\n if (Array.isArray(jobs)) for (const j of jobs) if (confines(j?.enabled_toolsets)) out.push(`cron job ${String(j.name ?? j.id ?? \"?\")}`);\n return out;\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { claudeConfigFile, codexConfigFile, cursorConfigFile, hermesHome } from \"../listen/mcpsetup.ts\";\nimport { readTomlMcpServers, type TomlTable, UNREADABLE as TOML_UNREADABLE } from \"./toml.ts\";\nimport { readMcpServers, UNREADABLE as YAML_UNREADABLE, type YamlMap } from \"./yaml.ts\";\n\n/** Reads the MCP servers an agent's own tool is configured with (for `import --from`). */\n\nexport const IMPORT_CLIENTS = [\"hermes\", \"claude-code\", \"cursor\", \"codex\"] as const;\nexport type ImportClient = (typeof IMPORT_CLIENTS)[number];\n\nexport const CLIENT_LABELS: Record<ImportClient, string> = { hermes: \"Hermes\", \"claude-code\": \"Claude Code\", cursor: \"Cursor\", codex: \"Codex\" };\n\nexport interface ClientEntry {\n name: string;\n /** The file it's defined in. */\n file: string;\n /** Claude Code: which scope (user: ~/.claude.json; local: its projects[cwd]; project: ./.mcp.json). */\n scope?: \"user\" | \"local\" | \"project\";\n /** Claude Code local/project scope: the project directory (where `claude mcp remove` must run). */\n projectDir?: string;\n transport: \"http\" | \"sse\" | \"stdio\";\n url?: string;\n /** Static headers, with ${VAR} references resolved. Secret: never printed. */\n headers: Record<string, string>;\n /** Names of environment variables the headers came from (for the \"you can remove it from .env\" note). */\n headerVars: string[];\n /** Per header: the environment variables its value was built from (shown in the plan next to the destination). */\n headerSources: Record<string, string[]>;\n /**\n * Defined in a file the project ships (Claude Code's ./.mcp.json), not by the user: anyone who can commit to the\n * repository wrote it. Imported only when Claude Code approved it, and only after its own confirmation.\n */\n fromProject?: boolean;\n /** Client-side settings the broker doesn't carry over: tool filters and timeouts. */\n dropped?: DroppedSettings;\n /** The client says it uses OAuth (Hermes `auth: oauth`, an oauth block). Its tokens stay in the client. */\n oauth: boolean;\n enabled: boolean;\n /** Why it can't be imported as it is. */\n problem?: string;\n /** stdio: the command line, for the listing. */\n command?: string;\n}\n\nexport interface DroppedSettings {\n /** Tools the client hides from its agent (Hermes tools.exclude, Codex disabled_tools). */\n exclude?: string[];\n /** The only tools the client shows (Hermes tools.include, Codex enabled_tools). */\n include?: string[];\n /** Other settings by name, e.g. timeout, connect_timeout. */\n settings: string[];\n}\n\nconst strings = (v: unknown) => (Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : undefined);\n\nfunction droppedFrom(e: Record<string, unknown>, filters: { include: unknown; exclude: unknown }, settingKeys: string[]): DroppedSettings | undefined {\n const d: DroppedSettings = { settings: settingKeys.filter((k) => e[k] !== undefined && e[k] !== null) };\n const inc = strings(filters.include);\n const exc = strings(filters.exclude);\n if (inc?.length) d.include = inc;\n if (exc?.length) d.exclude = exc;\n return d.include || d.exclude || d.settings.length ? d : undefined;\n}\n\nexport interface ClientConfig {\n client: ImportClient;\n files: string[];\n entries: ClientEntry[];\n}\n\nexport interface ReadOptions {\n env?: NodeJS.ProcessEnv;\n cwd?: string;\n}\n\n/** Parses a dotenv file (KEY=VALUE, optional `export`, quotes). */\nexport function parseDotenv(text: string): Record<string, string> {\n const out: Record<string, string> = {};\n for (const raw of text.split(\"\\n\")) {\n const m = /^\\s*(?:export\\s+)?([A-Za-z_][A-Za-z0-9_]*)\\s*=\\s*(.*?)\\s*$/.exec(raw);\n if (!m) continue;\n let v = m[2]!;\n if ((v.startsWith('\"') && v.endsWith('\"') && v.length >= 2) || (v.startsWith(\"'\") && v.endsWith(\"'\") && v.length >= 2)) v = v.slice(1, -1);\n else v = v.replace(/\\s+#.*$/, \"\");\n out[m[1]!] = v;\n }\n return out;\n}\n\ntype Expanded = { value: string; vars: string[] } | { missing: string };\n\n/** `${VAR}` (and `${VAR:-default}`, `${env:VAR}`) from `vars`. */\nexport function expandVars(value: string, vars: Record<string, string | undefined>): Expanded {\n const used: string[] = [];\n let missing: string | null = null;\n const out = value.replace(/\\$\\{(?:env:)?([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\\}/g, (_m, name: string, def: string | undefined) => {\n const v = vars[name];\n if (v !== undefined && v !== \"\") {\n used.push(name);\n return v;\n }\n if (def !== undefined) return def;\n missing ??= name;\n return \"\";\n });\n return missing ? { missing } : { value: out, vars: used };\n}\n\nconst isObj = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\nconst readJson = (file: string): Record<string, unknown> | null => {\n if (!existsSync(file)) return null;\n const text = readFileSync(file, \"utf8\");\n if (!text.trim()) return {};\n try {\n const doc = JSON.parse(text) as unknown;\n if (!isObj(doc)) throw new Error(\"not an object\");\n return doc;\n } catch {\n throw new Error(`${file} isn't plain JSON (comments?), so it can't be read automatically.`);\n }\n};\n\n/** Shared by the JSON-shaped clients (Claude Code, Cursor): one `mcpServers` entry. */\nfunction jsonEntry(name: string, raw: unknown, file: string, vars: Record<string, string | undefined>, extra: Partial<ClientEntry> = {}): ClientEntry {\n const base: ClientEntry = { name, file, transport: \"http\", headers: {}, headerVars: [], headerSources: {}, oauth: false, enabled: true, ...extra };\n if (!isObj(raw)) return { ...base, problem: \"this entry isn't an object\" };\n if (raw.disabled === true || raw.enabled === false) base.enabled = false;\n const type = typeof raw.type === \"string\" ? raw.type.toLowerCase() : null;\n if (type === \"stdio\" || (typeof raw.command === \"string\" && !raw.url)) {\n const args = Array.isArray(raw.args) ? raw.args.map(String) : [];\n return { ...base, transport: \"stdio\", command: [String(raw.command ?? \"\"), ...args].join(\" \").trim() };\n }\n if (typeof raw.url !== \"string\") return { ...base, problem: \"no url\" };\n const url = expandVars(raw.url, vars);\n if (\"missing\" in url) return { ...base, problem: `its url uses \\${${url.missing}}, which isn't set here` };\n const entry: ClientEntry = { ...base, url: url.value, transport: type === \"sse\" ? \"sse\" : \"http\" };\n if (raw.headersHelper !== undefined || raw.headers_helper !== undefined) return { ...entry, problem: \"it gets its headers from a helper command, which the broker can't run\" };\n if (raw.oauth !== undefined || raw.auth !== undefined) entry.oauth = true;\n return withHeaders(entry, raw.headers, vars);\n}\n\nfunction withHeaders(entry: ClientEntry, headers: unknown, vars: Record<string, string | undefined>): ClientEntry {\n if (headers === undefined || headers === null) return entry;\n if (!isObj(headers)) return { ...entry, problem: \"its headers can't be read\" };\n for (const [k, v] of Object.entries(headers)) {\n if (typeof v !== \"string\") return { ...entry, problem: `its ${k} header can't be read` };\n const x = expandVars(v, vars);\n if (\"missing\" in x) return { ...entry, problem: `its ${k} header uses \\${${x.missing}}, which isn't set here` };\n entry.headers[k] = x.value;\n entry.headerVars.push(...x.vars);\n entry.headerSources[k] = x.vars;\n }\n return entry;\n}\n\n// ───────────── Hermes ─────────────\n\nexport function hermesFiles(env: NodeJS.ProcessEnv = process.env): { config: string; env: string } {\n const home = hermesHome(env);\n return { config: join(home, \"config.yaml\"), env: join(home, \".env\") };\n}\n\nfunction readHermes(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const files = hermesFiles(env);\n const result: ClientConfig = { client: \"hermes\", files: [files.config], entries: [] };\n if (!existsSync(files.config)) return result;\n const servers = readMcpServers(readFileSync(files.config, \"utf8\"));\n if (!servers) throw new Error(`${files.config} has an mcp_servers layout this can't read (flow style, several blocks, or tabs). Nothing was changed.`);\n // Hermes loads ~/.hermes/.env into its environment: the secrets its ${VAR} headers name live there.\n const vars = { ...env, ...(existsSync(files.env) ? parseDotenv(readFileSync(files.env, \"utf8\")) : {}) };\n for (const [name, raw] of Object.entries(servers)) {\n if (name.startsWith(\"\\u0000\")) continue;\n const base: ClientEntry = { name, file: files.config, transport: \"http\", headers: {}, headerVars: [], headerSources: {}, oauth: false, enabled: true };\n if (!raw || raw === YAML_UNREADABLE || typeof raw !== \"object\" || Array.isArray(raw)) {\n result.entries.push({ ...base, problem: \"this entry can't be read\" });\n continue;\n }\n const e = raw as YamlMap;\n const unreadable = [\"url\", \"headers\", \"command\", \"auth\", \"transport\", \"enabled\"].find((k) => e[k] === YAML_UNREADABLE);\n if (unreadable) {\n result.entries.push({ ...base, problem: `its ${unreadable} can't be read` });\n continue;\n }\n if (e.enabled === false || (typeof e.enabled === \"string\" && [\"false\", \"no\", \"off\", \"0\"].includes(e.enabled.toLowerCase()))) base.enabled = false;\n if (typeof e.command === \"string\") {\n const args = Array.isArray(e.args) ? e.args.filter((a) => typeof a === \"string\") : [];\n result.entries.push({ ...base, transport: \"stdio\", command: [e.command, ...args].join(\" \") });\n continue;\n }\n if (typeof e.url !== \"string\") {\n result.entries.push({ ...base, problem: \"no url\" });\n continue;\n }\n const url = expandVars(e.url, vars);\n if (\"missing\" in url) {\n result.entries.push({ ...base, problem: `its url uses \\${${url.missing}}, which isn't set in ${files.env}` });\n continue;\n }\n const tools = isObj(e.tools) ? (e.tools as Record<string, unknown>) : {};\n const entry: ClientEntry = {\n ...base,\n url: url.value,\n transport: e.transport === \"sse\" ? \"sse\" : \"http\",\n oauth: e.auth === \"oauth\" || isObj(e.oauth),\n dropped: droppedFrom(e as Record<string, unknown>, { include: tools.include, exclude: tools.exclude }, [\"timeout\", \"connect_timeout\"]),\n };\n if (e.client_cert !== undefined || e.identity_header !== undefined) {\n result.entries.push({ ...entry, problem: \"it uses a client certificate or identity header, which the broker doesn't support yet\" });\n continue;\n }\n result.entries.push(withHeaders(entry, e.headers ?? undefined, vars));\n }\n return result;\n}\n\n// ───────────── Claude Code ─────────────\n\nfunction readClaude(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const cwd = opts.cwd ?? process.cwd();\n const userFile = claudeConfigFile();\n const projectFile = join(cwd, \".mcp.json\");\n const result: ClientConfig = { client: \"claude-code\", files: [userFile, projectFile].filter(existsSync), entries: [] };\n const seen = new Set<string>();\n const add = (e: ClientEntry) => {\n // Claude Code's precedence: local, then project, then user. A shadowed one isn't what the agent uses.\n if (seen.has(e.name)) return;\n seen.add(e.name);\n result.entries.push(e);\n };\n const doc = readJson(userFile);\n const proj = doc && isObj(doc.projects) && isObj(doc.projects[cwd]) ? (doc.projects[cwd] as Record<string, unknown>) : {};\n const local = proj.mcpServers;\n if (isObj(local)) for (const [n, raw] of Object.entries(local)) add(jsonEntry(n, raw, userFile, env, { scope: \"local\", projectDir: cwd }));\n const project = readJson(projectFile);\n if (project && isObj(project.mcpServers)) {\n // ./.mcp.json comes with the repository. Claude Code itself only uses the servers the user approved for this\n // project (kept in ~/.claude.json, which the repository can't write); a project's own .claude/settings*.json\n // isn't trusted for this.\n const list = (v: unknown) => (Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : []);\n const enabled = new Set(list(proj.enabledMcpjsonServers));\n const disabled = new Set(list(proj.disabledMcpjsonServers));\n const all = proj.enableAllProjectMcpServers === true;\n for (const [n, raw] of Object.entries(project.mcpServers)) {\n const e = jsonEntry(n, raw, projectFile, env, { scope: \"project\", projectDir: cwd, fromProject: true });\n const why = disabled.has(n) ? \"turned off for this project in Claude Code\" : !all && !enabled.has(n) ? \"not approved in Claude Code\" : null;\n // An unapproved one isn't what Claude Code uses, so it doesn't shadow a user-scope server of the same name.\n if (why) result.entries.push({ ...e, problem: why });\n else add(e);\n }\n }\n if (doc && isObj(doc.mcpServers)) for (const [n, raw] of Object.entries(doc.mcpServers)) add(jsonEntry(n, raw, userFile, env, { scope: \"user\" }));\n return result;\n}\n\n// ───────────── Cursor ─────────────\n\nfunction readCursor(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const file = cursorConfigFile();\n const result: ClientConfig = { client: \"cursor\", files: [file], entries: [] };\n const doc = readJson(file);\n if (doc && isObj(doc.mcpServers)) for (const [n, raw] of Object.entries(doc.mcpServers)) result.entries.push(jsonEntry(n, raw, file, env));\n return result;\n}\n\n// ───────────── Codex ─────────────\n\nfunction readCodex(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const file = codexConfigFile();\n const result: ClientConfig = { client: \"codex\", files: [file], entries: [] };\n if (!existsSync(file)) return result;\n for (const [name, raw] of Object.entries(readTomlMcpServers(readFileSync(file, \"utf8\")))) {\n const base: ClientEntry = { name, file, transport: \"http\", headers: {}, headerVars: [], headerSources: {}, oauth: false, enabled: true };\n if (raw === TOML_UNREADABLE) {\n result.entries.push({ ...base, problem: \"this entry can't be read\" });\n continue;\n }\n const e = raw as TomlTable;\n if (e.enabled === false) base.enabled = false;\n if (typeof e.command === \"string\") {\n const args = Array.isArray(e.args) ? e.args.filter((a): a is string => typeof a === \"string\") : [];\n result.entries.push({ ...base, transport: \"stdio\", command: [e.command, ...args].join(\" \") });\n continue;\n }\n if (typeof e.url !== \"string\") {\n result.entries.push({ ...base, problem: \"no url\" });\n continue;\n }\n const entry: ClientEntry = {\n ...base,\n url: e.url,\n oauth: isObj(e.oauth) || e.auth === \"oauth\",\n dropped: droppedFrom(e, { include: e.enabled_tools, exclude: e.disabled_tools }, [\"tool_timeout_sec\", \"startup_timeout_sec\"]),\n };\n if (e.http_headers_helper !== undefined) {\n result.entries.push({ ...entry, problem: \"it gets its headers from a helper command, which the broker can't run\" });\n continue;\n }\n // Codex has no ${VAR} expansion: env_http_headers and bearer_token_env_var name variables instead.\n const headers: Record<string, string> = {};\n let problem: string | undefined;\n if (e.http_headers !== undefined) {\n if (!isObj(e.http_headers) || Object.values(e.http_headers).some((v) => typeof v !== \"string\")) problem = \"its http_headers can't be read\";\n else {\n Object.assign(headers, e.http_headers);\n for (const h of Object.keys(e.http_headers)) entry.headerSources[h] = [];\n }\n }\n const fromEnv: Record<string, unknown> = isObj(e.env_http_headers) ? { ...e.env_http_headers } : {};\n if (e.bearer_token_env_var !== undefined) fromEnv.Authorization = e.bearer_token_env_var;\n for (const [h, varName] of Object.entries(fromEnv)) {\n if (typeof varName !== \"string\") problem ??= `its ${h} header can't be read`;\n else if (!env[varName]) problem ??= `its ${h} header comes from $${varName}, which isn't set here`;\n else {\n headers[h] = h === \"Authorization\" && e.bearer_token_env_var === varName ? `Bearer ${env[varName]}` : env[varName]!;\n entry.headerVars.push(varName);\n entry.headerSources[h] = [varName];\n }\n }\n entry.headers = headers;\n result.entries.push(problem ? { ...entry, problem } : entry);\n }\n return result;\n}\n\nexport function readClientConfig(client: ImportClient, opts: ReadOptions = {}): ClientConfig {\n switch (client) {\n case \"hermes\":\n return readHermes(opts);\n case \"claude-code\":\n return readClaude(opts);\n case \"cursor\":\n return readCursor(opts);\n case \"codex\":\n return readCodex(opts);\n }\n}\n\nexport function parseImportClient(value: string): ImportClient {\n const v = value.trim().toLowerCase().replace(/^claude$/, \"claude-code\");\n if (!(IMPORT_CLIENTS as readonly string[]).includes(v)) throw new Error(`Unknown --from \"${value}\". Choose one of: ${IMPORT_CLIENTS.join(\", \")}.`);\n return v as ImportClient;\n}\n","import pc from \"picocolors\";\nimport type { Agent } from \"../../shared/types.ts\";\nimport type { AccessLevel } from \"../broker/types.ts\";\nimport { mcpTarget, type McpSetupResult, type RemoveServer, setupMcp } from \"../listen/mcpsetup.ts\";\nimport { DEFAULT_PROFILE, profilePath } from \"../listen/paths.ts\";\nimport { loadProfile, type Profile, profileExists } from \"../listen/profile.ts\";\nimport { safeText } from \"../listen/ui.ts\";\nimport { NPX } from \"../listen/version.ts\";\nimport type { LookupFn } from \"../webhooks/ssrf.ts\";\nimport { accessLabel, agentsLabel, chooseAccess, chooseAgents, parseAccess } from \"./access.ts\";\nimport { isWorking, waitWorking } from \"./manage.ts\";\nimport { confinedRoutes } from \"./routes.ts\";\nimport { mcpServerName } from \"../listen/recipes.ts\";\nimport type { ConnectionsApi, ConnectionView } from \"./api.ts\";\nimport { CLIENT_LABELS, type ClientConfig, type ClientEntry, type ImportClient, parseImportClient, readClientConfig } from \"./clients.ts\";\nimport { checkTarget } from \"./private.ts\";\nimport type { Prompter } from \"./prompt.ts\";\nimport { reconnectHint, slugify } from \"./util.ts\";\n\n/**\n * `import --from <client>`: one connection per remote MCP server in that client's config, with its static header\n * moved into the broker. OAuth servers are created needing Connect (their tokens stay in the client); stdio ones\n * aren't supported yet (M4) and stay where they are. Nothing is written without a confirmation (or --yes), and\n * the client's config is only touched by the optional setup-mcp step at the end, which removes just the entries\n * whose connection works.\n */\n\nexport interface ImportFlags {\n from: string;\n dryRun?: boolean;\n yes?: boolean;\n access?: string;\n agent?: string[];\n profile?: string;\n /** Exact `scheme://host:port` origins allowed without asking (--yes never allows one). */\n allowPrivate?: string[];\n}\n\nexport interface ImportDeps {\n prompter: Prompter;\n /** Opens the admin channel (not called for --dry-run). */\n openApi: () => ConnectionsApi;\n lookup?: LookupFn;\n env?: NodeJS.ProcessEnv;\n cwd?: string;\n /** This xaq's own MCP origins (loopback with its port), so its entry is never imported. */\n selfOrigins?: string[];\n /** How long to wait for a connected server's first tool sync (default 10 s), and how often to look. */\n verifyMs?: number;\n pollMs?: number;\n}\n\nexport type PlanItem =\n | { action: \"self\"; entry: ClientEntry }\n | { action: \"stdio\"; entry: ClientEntry }\n | { action: \"skip\"; entry: ClientEntry; reason: string }\n | { action: \"exists\"; entry: ClientEntry; connection: ConnectionView }\n | {\n action: \"create\";\n entry: ClientEntry;\n slug: string;\n url: string;\n /** header: moved into the broker; oauth: the client says so; none: no credential (the connect finds out). */\n auth: { type: \"header\"; name: string; value: string } | { type: \"oauth\" } | { type: \"none\" };\n /** The exact origin a private-target allow would cover, when the URL is on this machine or a private network. */\n privateTarget: string | null;\n };\n\n// Our own entry under its name, or under the one a profile from before the rename registered: never imported.\nconst SELF_NAME = /^(?:xaq|agentinbox)(?:-[a-z0-9][a-z0-9_-]*)?$/; // rename-xaq: keep\n\nfunction isSelf(e: ClientEntry, selfOrigins: string[]): boolean {\n if (SELF_NAME.test(e.name)) return true;\n if (Object.values(e.headers).some((v) => /^Bearer\\s+aib_/i.test(v.trim()))) return true;\n if (!e.url) return false;\n try {\n const u = new URL(e.url);\n return u.pathname.replace(/\\/+$/, \"\").endsWith(\"/mcp\") && selfOrigins.includes(u.origin);\n } catch {\n return false;\n }\n}\n\nconst sameUrl = (a: string | null | undefined, b: string) => {\n try {\n return !!a && new URL(a).href.replace(/\\/+$/, \"\") === new URL(b).href.replace(/\\/+$/, \"\");\n } catch {\n return false;\n }\n};\n\nexport async function planImport(config: ClientConfig, ctx: { existing?: ConnectionView[]; lookup?: LookupFn; selfOrigins?: string[] } = {}): Promise<PlanItem[]> {\n const label = CLIENT_LABELS[config.client];\n const taken = new Set((ctx.existing ?? []).map((c) => c.slug));\n const items: PlanItem[] = [];\n for (const entry of config.entries) {\n if (isSelf(entry, ctx.selfOrigins ?? [])) {\n items.push({ action: \"self\", entry });\n continue;\n }\n if (entry.transport === \"stdio\") {\n items.push({ action: \"stdio\", entry });\n continue;\n }\n if (entry.problem) {\n items.push({ action: \"skip\", entry, reason: entry.problem });\n continue;\n }\n if (!entry.enabled) {\n items.push({ action: \"skip\", entry, reason: `it's turned off in ${label}` });\n continue;\n }\n let url: URL;\n try {\n url = new URL(entry.url!);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") throw new Error(\"scheme\");\n } catch {\n items.push({ action: \"skip\", entry, reason: \"its url isn't an http(s) URL\" });\n continue;\n }\n const headerNames = Object.keys(entry.headers);\n if (headerNames.length > 1) {\n items.push({ action: \"skip\", entry, reason: `it sends ${headerNames.length} headers (${headerNames.join(\", \")}); a connection keeps one (not supported yet)` });\n continue;\n }\n const existing = (ctx.existing ?? []).find((c) => sameUrl(c.url, url.href));\n if (existing) {\n items.push({ action: \"exists\", entry, connection: existing });\n continue;\n }\n const target = await checkTarget(url, ctx.lookup);\n if (target.kind === \"never\") {\n items.push({\n action: \"skip\",\n entry,\n reason:\n target.why === \"ipv6_literal\"\n ? `the private-network allow takes a hostname or an IPv4 address, not ${target.address}`\n : `it's on ${target.address}, a link-local or cloud metadata address, which is never allowed`,\n });\n continue;\n }\n if (target.kind === \"public\" && url.protocol === \"http:\") {\n items.push({ action: \"skip\", entry, reason: \"plain http to a public host isn't allowed; use its https URL\" });\n continue;\n }\n let slug = slugify(entry.name);\n for (let n = 2; taken.has(slug); n++) slug = `${slugify(entry.name).slice(0, 21)}-${n}`;\n taken.add(slug);\n const auth = headerNames.length\n ? { type: \"header\" as const, name: headerNames[0]!, value: entry.headers[headerNames[0]!]! }\n : entry.oauth\n ? { type: \"oauth\" as const }\n : { type: \"none\" as const };\n items.push({ action: \"create\", entry, slug, url: entry.url!.trim(), auth, privateTarget: target.kind === \"private\" ? target.origin : null });\n }\n return items;\n}\n\nconst where = (e: ClientEntry) => (e.scope ? ` (${e.scope} scope)` : \"\");\nconst hostOf = (url: string) => {\n try {\n return new URL(url).host;\n } catch {\n return url;\n }\n};\n\n/** \"its Authorization header (from $GITHUB_TOKEN) is sent to mcp.example.com\": where each secret ends up. */\nfunction headerLine(i: Extract<PlanItem, { action: \"create\" }>): string | null {\n if (i.auth.type !== \"header\") return null;\n const vars = i.entry.headerSources[i.auth.name] ?? [];\n const from = vars.length ? ` (from ${vars.map((v) => `$${v}`).join(\", \")})` : \"\";\n return `its ${i.auth.name} header${from} moves into xaq (encrypted; never shown) and is sent to ${safeText(hostOf(i.url), 120)}`;\n}\n\n/** The plan in plain words. Never prints a header value. */\nexport function renderPlan(config: ClientConfig, items: PlanItem[]): string[] {\n const label = CLIENT_LABELS[config.client];\n const out: string[] = [];\n const width = Math.min(24, Math.max(4, ...items.map((i) => i.entry.name.length)));\n const pad = (s: string) => s.padEnd(width);\n const cont = \" \".repeat(width + 4);\n out.push(`${label}: ${config.files.join(\", \") || \"no config file\"} lists ${items.length} MCP server${items.length === 1 ? \"\" : \"s\"}.`);\n for (const i of items) {\n const name = ` ${pad(safeText(i.entry.name, 40))} `;\n switch (i.action) {\n case \"self\":\n out.push(`${name}${pc.dim(\"skip: this is xaq itself\")}`);\n break;\n case \"stdio\":\n out.push(`${name}${pc.yellow(\"not supported yet (M4)\")}: a local command (${safeText(i.entry.command ?? \"\", 60)}); it stays in ${label}`);\n break;\n case \"skip\":\n out.push(`${name}${pc.yellow(\"skip\")}: ${i.reason}; it stays in ${label}`);\n break;\n case \"exists\":\n if (isWorking(i.connection)) out.push(`${name}already connected: \"${i.connection.slug}\" (${i.connection.tools.total} tools)`);\n else {\n const why =\n i.entry.oauth || i.connection.authType === \"oauth\" || i.connection.status === \"needs_reauth\" ? \"needs Connect\" : `${i.connection.status}, ${i.connection.tools.total} tools`;\n out.push(`${name}already a connection: \"${i.connection.slug}\", ${why}; it stays in ${label} until it works`);\n out.push(`${cont}${reconnectHint(i.connection)}`);\n }\n out.push(...droppedLines(i.entry, cont));\n break;\n case \"create\": {\n out.push(`${name}${pc.green(\"create\")} connection \"${i.slug}\" → ${safeText(i.url, 120)}${where(i.entry)}`);\n if (i.entry.fromProject) out.push(`${cont}${pc.yellow(\"from the project's .mcp.json\")}: asked separately (--yes doesn't answer it)`);\n const h = headerLine(i);\n if (h) out.push(`${cont}${h}`);\n else if (i.auth.type === \"oauth\") out.push(`${cont}OAuth: created needing Connect (${label} keeps its own tokens); sign in once with the link it prints`);\n else out.push(`${cont}no credential in ${label}: connected as it is (if it turns out to use OAuth, it needs Connect)`);\n if (i.privateTarget) out.push(`${cont}${pc.yellow(\"private network\")}: needs the allow for exactly ${i.privateTarget}`);\n out.push(...droppedLines(i.entry, cont));\n break;\n }\n }\n }\n return out;\n}\n\n/** What the client did for this server that the broker doesn't: said in the plan, never silently dropped. */\nfunction droppedLines(e: ClientEntry, cont: string): string[] {\n const d = e.dropped;\n if (!d) return [];\n const out: string[] = [];\n const list = (xs: string[]) => xs.map((x) => safeText(x, 64)).join(\", \");\n if (d.exclude) out.push(`${cont}${pc.yellow(\"not carried over\")}: its tool filter hides ${list(d.exclude)}; through xaq every tool is listed (subject to the access level)`);\n if (d.include) out.push(`${cont}${pc.yellow(\"not carried over\")}: its tool filter shows only ${list(d.include)}; through xaq every tool is listed (subject to the access level)`);\n if (d.settings.length) out.push(`${cont}${pc.yellow(\"not carried over\")}: ${d.settings.join(\", \")} (xaq uses its own 60 s per call)`);\n return out;\n}\n\ntype CreateItem = Extract<PlanItem, { action: \"create\" }>;\n\ninterface Outcome {\n item: CreateItem;\n /** connected: works now; unverified: created, but not working (yet); authorize: needs a sign-in; failed: nothing kept. */\n status: \"connected\" | \"unverified\" | \"authorize\" | \"failed\";\n connection?: ConnectionView;\n authorizeUrl?: string;\n error?: string;\n}\n\nconst works = isWorking;\n\nfunction setupLines(r: McpSetupResult): string[] {\n const out = [r.ok ? `${r.dryRun ? pc.cyan(\"○\") : pc.green(\"✔\")} ${r.message}` : `${pc.yellow(\"!\")} ${r.message}`];\n for (const l of r.changes ?? []) out.push(l.startsWith(\" \") ? pc.gray(` ${l}`) : ` - ${l}`);\n if (r.backup) out.push(pc.gray(` Backup: ${r.backup}`));\n if (!r.ok) for (const l of r.manual ?? []) out.push(` ${l}`);\n for (const n of r.notes ?? []) out.push(pc.dim(` ${n}`));\n if (r.ok && r.verify?.length) out.push(` ${r.dryRun ? \"Afterwards, check it with\" : \"Check it with\"}: ${r.verify.map((v) => pc.cyan(v)).join(\"; \")}`);\n return out;\n}\n\nconst toRemove = (e: ClientEntry): RemoveServer => ({ name: e.name, scope: e.scope, projectDir: e.scope === \"user\" ? undefined : e.projectDir });\n\n/** The agent this machine's client uses (its xaq profile), if that agent is on this daemon. */\ninterface ClientAgent {\n profileName: string;\n profile: Profile | null;\n agent: Agent | null;\n}\n\nexport async function runImport(flags: ImportFlags, deps: ImportDeps): Promise<number> {\n const p = deps.prompter;\n const client: ImportClient = parseImportClient(flags.from);\n const label = CLIENT_LABELS[client];\n const access: AccessLevel | undefined = flags.access ? parseAccess(flags.access) : undefined;\n const config = readClientConfig(client, { env: deps.env, cwd: deps.cwd });\n if (!config.entries.length) {\n p.print(`${label} has no MCP servers configured (${config.files.join(\", \") || \"no config file\"}). Nothing to import.`);\n return 0;\n }\n const profileName = flags.profile ?? DEFAULT_PROFILE;\n\n if (flags.dryRun) {\n // Existing connections from the daemon when it's reachable, so a re-run's plan is the real one.\n let existing: ConnectionView[] | undefined;\n try {\n existing = await deps.openApi().list();\n } catch {\n existing = undefined;\n }\n const items = await planImport(config, { existing, lookup: deps.lookup, selfOrigins: deps.selfOrigins });\n p.print(pc.bold(\"Dry run: nothing is created or changed.\"));\n for (const l of renderPlan(config, items)) p.print(l);\n const creates = items.filter((i): i is CreateItem => i.action === \"create\");\n const priv = creates.filter((i) => i.privateTarget);\n p.print(\"\");\n p.print(`Would create ${creates.length} connection${creates.length === 1 ? \"\" : \"s\"} with ${access ? accessLabel(access) : \"the access you choose (default: Ask before risky actions)\"}.`);\n if (priv.length) p.print(`Would ask before allowing ${priv.map((i) => i.privateTarget).join(\", \")} (--yes never does; --allow-private <origin> does for that origin).`);\n if (!existing) p.print(pc.dim(\"xaq wasn't reachable, so existing connections weren't checked (the real run does: nothing is created twice).\"));\n const removable = [\n ...items.filter((i): i is Extract<PlanItem, { action: \"exists\" }> => i.action === \"exists\" && works(i.connection)).map((i) => toRemove(i.entry)),\n ...creates.filter((i) => i.auth.type !== \"oauth\").map((i) => toRemove(i.entry)),\n ];\n p.print(\"\");\n if (!removable.length) p.print(`${label}'s config isn't changed.`);\n else if (!profileExists(profileName)) {\n p.print(`Afterwards it offers to replace the imported entries in ${label} with the single xaq entry, once this machine's ${label} is paired (${NPX} connect <xaq-url> --tool ${client}).`);\n } else {\n p.print(`Afterwards it offers setup-mcp --tool ${client}, which would (for the entries whose connection works and that ${label}'s agent can use; OAuth ones after you Reconnect them):`);\n const r = setupMcp(client, mcpTarget(profileName, loadProfile(profileName)), profilePath(profileName), { dryRun: true, removeServers: removable });\n for (const l of setupLines(r)) p.print(l);\n }\n return 0;\n }\n\n const api = deps.openApi();\n const existing = await api.list();\n const items = await planImport(config, { existing, lookup: deps.lookup, selfOrigins: deps.selfOrigins });\n for (const l of renderPlan(config, items)) p.print(l);\n let creates = items.filter((i): i is CreateItem => i.action === \"create\");\n const already = items.filter((i): i is Extract<PlanItem, { action: \"exists\" }> => i.action === \"exists\");\n p.print(\"\");\n\n // A project's .mcp.json was written by whoever can commit to the repository: its own confirmation, never --yes.\n const fromProject = creates.filter((i) => i.entry.fromProject);\n if (fromProject.length) {\n p.print(pc.yellow(`These come from ${fromProject[0]!.entry.file}, which ships with the project (anyone who can commit to it wrote them):`));\n for (const i of fromProject) p.print(` ${safeText(i.entry.name, 40)} → ${safeText(i.url, 120)}${headerLine(i) ? `; ${headerLine(i)}` : \"\"}`);\n if (!(await p.confirmExplicit(`Import ${fromProject.length === 1 ? \"it\" : `these ${fromProject.length}`} into xaq?`, \"they stay in Claude Code\"))) {\n creates = creates.filter((i) => !i.entry.fromProject);\n }\n }\n\n // The private-target allow: only a person at the terminal (or --allow-private naming the exact origin) gives it.\n const preAllowed = new Set(flags.allowPrivate ?? []);\n const priv = creates.filter((i) => i.privateTarget && !preAllowed.has(i.privateTarget));\n for (const i of creates.filter((x) => x.privateTarget && preAllowed.has(x.privateTarget))) p.print(`Allowing ${i.privateTarget} (${safeText(i.entry.name, 40)}): --allow-private.`);\n if (priv.length) {\n p.print(pc.yellow(\"These servers are on this machine or your private network:\"));\n for (const i of priv) p.print(` ${i.privateTarget} (${safeText(i.entry.name, 40)})`);\n p.print(\n pc.dim(\"A connection to such a server can reach other services there too. Each allow covers exactly that scheme://host:port, for that connection only.\"),\n );\n const names = priv.map((i) => i.entry.name).join(\", \");\n if (!(await p.confirmExplicit(`Allow xaq to connect to ${priv.length === 1 ? \"it\" : `these ${priv.length}`}?`, `skipping ${names} (pass --allow-private <origin> to allow one)`))) {\n creates = creates.filter((i) => !priv.includes(i));\n }\n }\n\n const who = await clientAgent(api, profileName);\n if (!creates.length) {\n p.print(\"Nothing to create.\");\n return offerSetup(\n deps,\n api,\n client,\n who,\n already.filter((a) => works(a.connection)).map((a) => ({ entry: a.entry, connection: a.connection })),\n already.filter((a) => !works(a.connection)).map((a) => a.entry.name),\n 0,\n );\n }\n\n const level = await chooseAccess(p, access);\n let agents = await chooseAgents(p, api, flags.agent);\n if (agents !== \"all\" && who.agent && !agents.includes(who.agent.id)) {\n p.print(pc.yellow(`${safeText(who.agent.name, 60)} (the agent ${label} on this machine uses) isn't among them, so ${label} couldn't use these through xaq.`));\n if (await p.confirm(`Include ${safeText(who.agent.name, 60)}?`, true)) agents = [...agents, who.agent.id];\n }\n if (!(await p.confirm(`Create ${creates.length} connection${creates.length === 1 ? \"\" : \"s\"} (${accessLabel(level)}, ${agentsLabel(agents)})?`, true))) {\n p.print(\"Nothing was created.\");\n return 0;\n }\n\n const outcomes: Outcome[] = [];\n for (const item of creates) {\n let created: ConnectionView | null = null;\n try {\n created = await api.create({ slug: item.slug, name: item.entry.name, url: item.url, levelDefault: level, ...(agents === \"all\" ? {} : { agentIds: agents }) });\n if (item.privateTarget) await api.allowPrivateTarget(created.id, true);\n const r = await api.connect(created.id, item.auth.type === \"header\" ? { header: { name: item.auth.name, value: item.auth.value } } : {});\n if (r.status === \"connected\") {\n // \"connected\" means stored, not tested (a header connect doesn't call the server): wait for the first tool sync.\n const after = await waitWorking(api, r.connection, { pollMs: deps.pollMs, ms: deps.verifyMs });\n outcomes.push({ item, status: works(after) ? \"connected\" : \"unverified\", connection: after });\n } else if (r.status === \"authorize\") outcomes.push({ item, status: \"authorize\", connection: created, authorizeUrl: r.authorizeUrl });\n else throw new Error(r.message);\n } catch (err) {\n // Nothing half-made stays behind: running the import again retries it cleanly.\n if (created) await api.remove(created.id).catch(() => {});\n outcomes.push({ item, status: \"failed\", error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n p.print(\"\");\n for (const o of outcomes) {\n const name = safeText(o.item.entry.name, 40);\n if (o.status === \"failed\") p.print(`${pc.red(\"✘\")} ${name}: ${safeText(o.error!, 300)} (it stays in ${label})`);\n else if (o.status === \"connected\") p.print(`${pc.green(\"✔\")} ${name} → \"${o.connection!.slug}\", ${o.connection!.tools.total} tools`);\n else if (o.status === \"unverified\") {\n const c = o.connection!;\n p.print(`${pc.yellow(\"○\")} ${name} → \"${c.slug}\": not working (${c.status}${c.statusReason ? `: ${safeText(c.statusReason, 200)}` : \"\"}, ${c.tools.total} tools), so it stays in ${label}.`);\n p.print(` ${reconnectHint(c)} then run this import again.`);\n }\n else {\n p.print(`${pc.yellow(\"○\")} ${name} → \"${o.connection!.slug}\": needs Connect. Sign in (link valid 15 minutes):`);\n p.print(` ${pc.cyan(o.authorizeUrl!)}`);\n p.print(` ${reconnectHint(o.connection!)}`);\n }\n }\n const failed = outcomes.filter((o) => o.status === \"failed\").length;\n const working = [\n ...already.filter((a) => works(a.connection)).map((a) => ({ entry: a.entry, connection: a.connection })),\n ...outcomes.filter((o) => o.status === \"connected\").map((o) => ({ entry: o.item.entry, connection: o.connection! })),\n ];\n const pending = [\n ...already.filter((a) => !works(a.connection)).map((a) => a.entry.name),\n ...outcomes.filter((o) => o.status === \"authorize\" || o.status === \"unverified\").map((o) => o.item.entry.name),\n ];\n return offerSetup(deps, api, client, who, working, pending, failed ? 1 : 0);\n}\n\nasync function clientAgent(api: ConnectionsApi, profileName: string): Promise<ClientAgent> {\n if (!profileExists(profileName)) return { profileName, profile: null, agent: null };\n const profile = loadProfile(profileName);\n const agent = (await api.agents()).find((a) => a.id === profile.agentId && !a.disabled) ?? null;\n return { profileName, profile, agent };\n}\n\n/**\n * Step 2: replace the entries now served by the broker with the single xaq entry (setup-mcp). Only entries\n * the client's own agent can use through xaq go: the profile's agent must be on this daemon and have a grant\n * on the connection (offered when it has none).\n */\nasync function offerSetup(\n deps: ImportDeps,\n api: ConnectionsApi,\n client: ImportClient,\n who: ClientAgent,\n working: { entry: ClientEntry; connection: ConnectionView }[],\n pending: string[],\n code: number,\n): Promise<number> {\n const p = deps.prompter;\n const label = CLIENT_LABELS[client];\n if (pending.length) p.print(pc.dim(`${pending.join(\", \")} stay${pending.length === 1 ? \"s\" : \"\"} in ${label} until ${pending.length === 1 ? \"it works\" : \"they work\"} through xaq (Reconnect); then run this import again to replace ${pending.length === 1 ? \"it\" : \"them\"}.`));\n if (!working.length) return code;\n if (!who.profile) {\n p.print(\n `To replace ${working.map((w) => w.entry.name).join(\", \")} in ${label} with the single xaq entry, pair it first ` +\n `(${NPX} connect <xaq-url> --tool ${client}) and run this import again.`,\n );\n return code;\n }\n if (!who.agent) {\n p.print(\n pc.yellow(\n `The agent in your \"${who.profileName}\" profile (${safeText(who.profile.agentId, 40)}) isn't an agent of this xaq (or is disabled), so ${label} ` +\n `couldn't use these through it. Not replacing anything in ${label}. Pair it with this xaq (${NPX} connect <xaq-url> --tool ${client} --force), then run this import again.`,\n ),\n );\n return code;\n }\n const agentName = safeText(who.agent.name, 60);\n const usable: ClientEntry[] = [];\n for (const w of working) {\n if (w.entry.fromProject) {\n // ./.mcp.json is the project's file (often committed): left for its owners to change.\n p.print(pc.dim(` \"${w.entry.name}\" stays in ${w.entry.file}: it ships with the project. Remove it there if the project no longer needs it.`));\n continue;\n }\n const grants = await api.grants(w.connection.id);\n if (grants.some((g) => g.agentId === who.agent!.id)) {\n usable.push(w.entry);\n continue;\n }\n if (await p.confirm(`${agentName} (the agent ${label} uses) has no access to \"${w.connection.slug}\". Give it ${accessLabel(w.connection.levelDefault)}?`, true)) {\n await api.setGrants(w.connection.id, [...grants.map((g) => ({ agentId: g.agentId, level: g.level })), { agentId: who.agent.id, level: w.connection.levelDefault }]);\n usable.push(w.entry);\n } else p.print(pc.dim(` \"${w.entry.name}\" stays in ${label}: its agent couldn't use \"${w.connection.slug}\".`));\n }\n if (!usable.length) return code;\n p.print(\"\");\n const question = `Replace ${usable.map((e) => `\"${e.name}\"`).join(\", \")} in ${label} with the single xaq entry (setup-mcp --tool ${client}, with a backup)?`;\n const routes = confinedRoutes(client, mcpServerName(who.profileName), deps.env);\n let ok: boolean;\n if (routes.length) {\n const slugs = working.filter((w) => usable.includes(w.entry)).map((w) => w.connection.slug);\n p.print(pc.yellow(`These ${label} settings are limited to the xaq server only:`));\n for (const r of routes) p.print(` ${safeText(r, 120)}`);\n p.print(\n pc.yellow(\n `Through xaq they now also see the tools of ${slugs.map((s) => `\"${s}\"`).join(\", \")} (as <name>__<tool>), which ${routes.length === 1 ? \"it\" : \"they\"} couldn't reach before. ` +\n `If one is triggered by email or webhooks, those tools become reachable from that content. Give ${agentName} less access on those connections, or keep them out, if that's not what you want.`,\n ),\n );\n ok = await p.confirmExplicit(question, `${label}'s config wasn't changed; decide in a terminal`);\n } else ok = await p.confirm(question, true);\n if (!ok) {\n p.print(`${label}'s config wasn't changed. Run this import again any time to do it.`);\n return code;\n }\n const r = setupMcp(client, mcpTarget(who.profileName, who.profile), profilePath(who.profileName), { removeServers: usable.map(toRemove) });\n for (const l of setupLines(r)) p.print(l);\n const vars = [...new Set(usable.flatMap((e) => ((r.removed ?? []).includes(e.name) ? e.headerVars : [])))];\n if (r.ok && vars.length) {\n p.print(pc.dim(` ${vars.join(\", \")} ${vars.length === 1 ? \"is\" : \"are\"} no longer needed by the removed entries; delete ${vars.length === 1 ? \"it\" : \"them\"} from your environment${client === \"hermes\" ? \" (~/.hermes/.env)\" : \"\"} once everything works through xaq.`));\n }\n return r.ok ? code : 1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,SAAgB,eAAe,QAAsB,YAAoB,MAAyB,QAAQ,KAAe;CACvH,IAAI,WAAW,UAAU,OAAO,CAAC;CACjC,MAAM,OAAO,WAAW,GAAG;CAC3B,MAAM,wBAAQ,IAAI,IAAI,CAAC,YAAY,OAAO,YAAY,CAAC;CACvD,MAAM,YAAY,MAAe,MAAM,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,OAAO,MAAM,YAAY,MAAM,IAAI,CAAC,CAAC;CACxG,MAAM,MAAgB,CAAC;CACvB,MAAM,QAAQ,SAA0B;EACtC,IAAI;GACF,OAAO,WAAW,IAAI,IAAI,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC,CAAC,QAAQ,MAAM,EAAE,CAAC,IAAI;EACvF,QAAQ;GACN,OAAO;EACT;CACF;CACA,IAAI;EACF,MAAM,SAAS,KAAK,MAAM,aAAa;EACvC,IAAI,WAAW,MAAM,GAAG;GACtB,MAAM,OAAO,aAAa,QAAQ,MAAM;GACxC,MAAM,YAAY,WAAW,MAAM,mBAAmB,KAAK,CAAC;GAC5D,KAAK,MAAM,CAAC,UAAU,aAAa,OAAO,QAAQ,SAAS,GAAG,IAAI,SAAS,QAAQ,GAAG,IAAI,KAAK,qBAAqB,SAAS,eAAe;GAE5I,MAAM,OAAO,GAA0B,MAAsC,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ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d = c.expiresInDays;
|
|
444
444
|
if (d !== null && d <= 7) notes.push(d <= 0 ? "expires today: Reconnect" : `expires in ${d} day${d === 1 ? "" : "s"}`);
|
|
445
|
-
if (c.tools.held) notes.push(`${c.tools.held} held`);
|
|
446
445
|
if (c.status === "needs_reauth") notes.push("Reconnect");
|
|
447
446
|
p.print(`${c.slug.padEnd(w)} ${status} ${accessLabel(c.levelDefault).padEnd(24)} ${String(c.tools.total).padEnd(5)} ${safeText(c.url ?? c.kind, 80)}${notes.length ? pc.yellow(` (${notes.join(", ")})`) : ""}`);
|
|
448
447
|
}
|
|
@@ -474,4 +473,4 @@ async function removeConnection(slug, deps) {
|
|
|
474
473
|
//#endregion
|
|
475
474
|
export { chooseAccess as _, isWorking as a, removeConnection as c, waitWorking as d, reconnectHint as f, agentsLabel as g, accessLabel as h, disableConnection as i, renderStep as l, checkTarget as m, authorize as n, listConnections as o, slugify as p, connectNow as r, reconnectConnection as s, addConnection as t, slugFromUrl as u, chooseAgents as v, parseAccess as y };
|
|
476
475
|
|
|
477
|
-
//# sourceMappingURL=manage-
|
|
476
|
+
//# sourceMappingURL=manage-BlGiqPRV.js.map
|