@seanhogg/builderforce-agents 2026.10.8 → 2026.10.9

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.
Files changed (63) hide show
  1. package/dist/{audio-preflight-hAkEddaf.js → audio-preflight-CBZJKBS8.js} +1 -1
  2. package/dist/{audio-preflight-Dm9zyfJq.js → audio-preflight-CvvHdoWy.js} +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/{builderforce-wxtgU9xu.js → builderforce-BmrsVdFw.js} +1 -1
  5. package/dist/{builderforce-BWCp-M9e.js → builderforce-Bwyw0GJ6.js} +1 -1
  6. package/dist/bundled/boot-md/handler.js +1 -1
  7. package/dist/bundled/session-memory/handler.js +1 -1
  8. package/dist/chrome-Brg9KsB9.js +4 -0
  9. package/dist/chrome-CtTMuhww.js +4 -0
  10. package/dist/{command-registry-CiR8PUQY.js → command-registry-4_K-lfW5.js} +1 -1
  11. package/dist/{command-registry-D_LkOB4n.js → command-registry-COUcUWby.js} +1 -1
  12. package/dist/{completion-cli-CBES884A.js → completion-cli-B2qcVd6q.js} +1 -1
  13. package/dist/{completion-cli-C7munVvb.js → completion-cli-DlvHqL86.js} +1 -1
  14. package/dist/{completion-cli-CijodCzU.js → completion-cli-DpFvU4Qn.js} +1 -1
  15. package/dist/{completion-cli-B72GX2so.js → completion-cli-SdcQ-kQj.js} +1 -1
  16. package/dist/{doctor-completion-FErwMP3Y.js → doctor-completion-BSotFS6p.js} +1 -1
  17. package/dist/{doctor-completion-Bv2ztEeW.js → doctor-completion-DVxbs-74.js} +1 -1
  18. package/dist/{embedded-DXDHduG1.js → embedded-BcHzh_y8.js} +6 -6
  19. package/dist/{embedded-cvG_LpfQ.js → embedded-D-citLF2.js} +6 -6
  20. package/dist/entry.js +1 -1
  21. package/dist/extensionAPI.js +1 -1
  22. package/dist/{gateway-cli-DpJjgVYH.js → gateway-cli-D2Bg1Um6.js} +3 -3
  23. package/dist/{gateway-cli-U8RlUIuT.js → gateway-cli-DFEo8C0z.js} +3 -3
  24. package/dist/index.js +2 -2
  25. package/dist/llm-slug-generator.js +1 -1
  26. package/dist/{onboard-7JGHJRfj.js → onboard-BVmZ4jMw.js} +1 -1
  27. package/dist/{onboard-O2gyfB4L.js → onboard-DfMVh1bM.js} +1 -1
  28. package/dist/{onboard-interactive-FWIy0HTu.js → onboard-interactive-B3-KBZbZ.js} +1 -1
  29. package/dist/{onboard-interactive-DqpGicxB.js → onboard-interactive-DYJttZ2w.js} +1 -1
  30. package/dist/{onboard-interactive-DboEcFKf.js → onboard-interactive-Dc_7URYb.js} +1 -1
  31. package/dist/{onboard-interactive-Gl5J4kVC.js → onboard-interactive-zgjmwJz-.js} +1 -1
  32. package/dist/{onboarding-Ctq_bdkC.js → onboarding-CP9rrz8y.js} +1 -1
  33. package/dist/{onboarding-hPRXZReM.js → onboarding-D4-HDbmU.js} +1 -1
  34. package/dist/{onboarding.finalize-B4Tc4IDN.js → onboarding.finalize-BfWXPgX7.js} +1 -1
  35. package/dist/{onboarding.finalize-Db6smxZL.js → onboarding.finalize-C2kZi7F0.js} +1 -1
  36. package/dist/{program-DHWSgdol.js → program-2w7Ue902.js} +2 -2
  37. package/dist/{program-context-7XUznN5J.js → program-context-BCwL3wlM.js} +1 -1
  38. package/dist/{prompt-select-styled-Depbcbpw.js → prompt-select-styled-Dd5swW2b.js} +1 -1
  39. package/dist/{prompt-select-styled-Cy70lEMU.js → prompt-select-styled-hB_nLOn1.js} +1 -1
  40. package/dist/{pw-ai-UGketqfG.js → pw-ai-CsJmJcNk.js} +1 -1
  41. package/dist/{pw-ai-D8HJAvv-.js → pw-ai-DaxMmaVL.js} +1 -1
  42. package/dist/{register.maintenance-ohxXhvKX.js → register.maintenance-BELfCO_C.js} +1 -1
  43. package/dist/{register.maintenance-BmnagkdH.js → register.maintenance-DukWFS_D.js} +1 -1
  44. package/dist/{register.onboard-FSaweh3A.js → register.onboard-B9DMNfHE.js} +1 -1
  45. package/dist/{register.onboard-C2Cnd-e9.js → register.onboard-Dt7rzAq-.js} +1 -1
  46. package/dist/{register.setup-Dk9hBOkZ.js → register.setup-BRRVPrx7.js} +1 -1
  47. package/dist/{register.setup-CyTZQLXP.js → register.setup-CSF-2ImP.js} +1 -1
  48. package/dist/{register.subclis-lGgi7ATb.js → register.subclis-4eDV9jKH.js} +1 -1
  49. package/dist/{register.subclis-DqO3Ciiv.js → register.subclis-Cr9DoYcv.js} +1 -1
  50. package/dist/{run-main-BipfHjUR.js → run-main-DLcDEJgv.js} +1 -1
  51. package/dist/{runner-CviGu3Nk.js → runner-COldX-El.js} +3 -3
  52. package/dist/{runner-B70PGCqP.js → runner-D7af_RBH.js} +3 -3
  53. package/dist/{tui-C5ChWpBg.js → tui-BwWMByVp.js} +1 -1
  54. package/dist/{tui-DHjIJOFN.js → tui-DylWbrDx.js} +1 -1
  55. package/dist/{tui-cli-wPseN93O.js → tui-cli-Bh1V8-w9.js} +1 -1
  56. package/dist/{tui-cli-BeFWcUWU.js → tui-cli-C_TTgabr.js} +1 -1
  57. package/dist/{update-cli-CRkZnN_N.js → update-cli-CA3LuuJ7.js} +1 -1
  58. package/dist/{update-cli-DekV-CP_.js → update-cli-DUrUIrYQ.js} +1 -1
  59. package/dist/{web-DONGrYXq.js → web-BQPd6gQJ.js} +1 -1
  60. package/dist/{web-D44jKC1F.js → web-DPGGHIc_.js} +1 -1
  61. package/package.json +1 -1
  62. package/dist/chrome-Blk2Jftn.js +0 -4
  63. package/dist/chrome-DUBgoZpO.js +0 -4
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import"./paths-5FcIFMsj.js";import{B as theme,E as toWhatsappJid,P as setVerbose,h as normalizeE164,l as escapeRegExp,n as assertWebChannel,z as isRich}from"./utils-DbaBVFaK.js";import"./embedded-helpers-CEsr3aQ0.js";import{It as resolveCommitHash,t as getReplyFromConfig}from"./reply-Cd3vVnD7.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import{a as enableConsoleCapture,i as defaultRuntime,p as visibleWidth}from"./subsystem-B3TqcCrZ.js";import"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import{n as runExec,t as runCommandWithTimeout}from"./exec-DdcIjeyn.js";import"./agent-scope-DPtjOxzp.js";import"./src-CA0fU67C.js";import"./model-selection-9bRFKBI_.js";import{n as replaceCliName,r as resolveCliName}from"./command-format-D806O2pt.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import{r as normalizeEnv,t as isTruthyEnvValue}from"./env-BIdU5BAp.js";import"./src-DTFqOIQD.js";import{G as loadDotEnv,U as VERSION,r as loadConfig}from"./io-3R_ZyUxB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-_1Ca6jGb.js";import{F as applyTemplate,c as installUnhandledRejectionHandler,d as reportAndExit,u as installUncaughtExceptionHandler}from"./runner-SxCr9kXD.js";import"./model-catalog-C6UrZ0uG.js";import"./sandbox-BZibn6PX.js";import"./chrome-a3X9_-nf.js";import{l as ensureBinary,u as promptYesNo}from"./tailscale-DLkpGquM.js";import"./auth-lebUHrkd.js";import"./server-context-DJZT7Upf.js";import"./frontmatter-3D1EdC1L.js";import"./skills-Ba4ftrB-.js";import"./plugin-skills-B11rggZh.js";import"./routes-BzfLvF8W.js";import"./redact-BHdfp2MZ.js";import"./errors-B1MIg3g-.js";import"./paths-cR8ct-Y3.js";import"./ssrf-p9k-iapc.js";import"./image-ops-C8IUQKjn.js";import"./store-CmHBQ-yX.js";import{i as handlePortError,n as describePortOwner,r as ensurePortAvailable,t as PortInUseError}from"./ports-DgmEDNOm.js";import"./trash-DD2Hc5oq.js";import{O as deriveSessionKey,a as loadSessionStore,c as saveSessionStore,k as resolveSessionKey}from"./sessions-CdanN_ZI.js";import"./message-channel-D_jXxXQj.js";import"./plugins-D5zP6ENo.js";import"./accounts-o35LU_iy.js";import"./accounts-rmXEiebi.js";import"./accounts-BLueHgKj.js";import"./bindings-DR59065T.js";import"./send-DerUBvXW.js";import"./send-DyF1Xy9K.js";import{c as resolveStorePath}from"./paths-DJ6rztqJ.js";import"./tool-images-B7b_OiMz.js";import"./tool-display-ByOZtWvA.js";import"./fetch-guard-8mwt3-hm.js";import"./api-key-rotation-CHBjUwUJ.js";import"./fetch-BuOLY9KP.js";import"./sqlite-C39E12XS.js";import"./tokens-CCU3zO-D.js";import"./project-context-store-wcq7lXuI.js";import"./with-timeout-Bwq-GyUQ.js";import"./deliver-BpLm3ktn.js";import"./send-CBBziNqM.js";import"./workspace-D4LK4thI.js";import"./reply-prefix-zIMgi6K6.js";import"./memory-cli-DRz4wtHk.js";import"./manager-DwywI_5-.js";import"./retry-DlVhg5qu.js";import"./client-xfoidwPI.js";import"./call-BbRf8gFM.js";import"./common-BTbIhLyt.js";import"./chunk-FCBlVOyo.js";import"./markdown-tables-P6uoUSFa.js";import"./ir-5BNoIXZm.js";import"./render-D1dVTEB1.js";import"./builderforcellm-syscheck-DrFJ638L.js";import"./send-4d9NswaD.js";import"./outbound-attachment-C7wByQO5.js";import"./fetch-DnVtDecb.js";import"./delivery-queue-CXKynF1P.js";import"./channel-activity-CCNDbdD3.js";import"./tables-ERcoWFDp.js";import"./pairing-store-CbvMJhD3.js";import{t as formatDocsLink}from"./links-BgWWaaOT.js";import"./cli-utils-LBYKdNFb.js";import"./help-format-Qfk2vDNX.js";import"./progress-BfOtdN6b.js";import"./resolve-route-D49haUnv.js";import"./replies-Bd2RPZwQ.js";import"./refresh-TiC_kLgE.js";import"./coding-tools.policy-6qh9acJy.js";import"./send-BJDzwYJN.js";import"./onboard-helpers-Cf5dNq7-.js";import"./prompt-style-BpVK43GK.js";import"./pairing-labels-BW5jQZlr.js";import"./session-cost-usage-BjH7mxVj.js";import"./usage-format-DGf8ZWPH.js";import"./provider-usage-BdrU4cIE.js";import"./active-listener-Dcg19lJG.js";import"./exec-approvals-BpVPDVtV.js";import"./nodes-screen-C3TDIi8d.js";import"./project-context-CJj0Inz-.js";import"./control-service-BbsswoMy.js";import"./stagger-8EkqkqJv.js";import"./channel-selection-DyAvzlY8.js";import"./mamba-state-engine-CoGqoBTH.js";import"./transformers-stream-D7nRu4Qu.js";import{r as waitForever,t as monitorWebChannel}from"./channel-web-DJa8JC9W.js";import"./outbound-OI-t5zZ0.js";import"./session-BzQdcCqN.js";import"./login-DtDUyFO3.js";import{t as createDefaultDeps}from"./deps-CkJiJ6wc.js";import{t as isMainModule}from"./is-main-CC_O8ESS.js";import{t as ensureBuilderForceAgentsCliOnPath}from"./path-env-Cy9l1Ba9.js";import{t as assertSupportedRuntime}from"./runtime-guard-DhksRHci.js";import"./ports-ReH_tlKd.js";import{d as getVerboseFlag,f as hasHelpOrVersion,i as getCoreCliCommandsWithSubcommands,n as setProgramContext,o as registerProgramCommands,s as getSubCliCommandsWithSubcommands,u as getCommandPath}from"./program-context-7XUznN5J.js";import"./catalog-rgiY__UQ.js";import"./plugin-registry-C-_GA65s.js";import{n as resolveCliChannelOptions}from"./channel-options-CDixz6dT.js";import process$1 from"node:process";import{fileURLToPath}from"node:url";import{Command}from"commander";function createProgramContext(){let channelOptions=resolveCliChannelOptions();return{programVersion:VERSION,channelOptions,messageChannelOptions:channelOptions.join(`|`),agentChannelOptions:[`last`,...channelOptions].join(`|`)}}const DEFAULT_TAGLINE=`All your chats, one BuilderForceAgents.`,HOLIDAY_TAGLINES={newYear:`New Year's Day: New year, new config—same old EADDRINUSE, but this time we resolve it like grown-ups.`,lunarNewYear:`Lunar New Year: May your builds be lucky, your branches prosperous, and your merge conflicts chased away with fireworks.`,christmas:`Christmas: Ho ho ho—Santa's little agentNode-sistant is here to ship joy, roll back chaos, and stash the keys safely.`,eid:`Eid al-Fitr: Celebration mode: queues cleared, tasks completed, and good vibes committed to main with clean history.`,diwali:`Diwali: Let the logs sparkle and the bugs flee—today we light up the terminal and ship with pride.`,easter:`Easter: I found your missing environment variable—consider it a tiny CLI egg hunt with fewer jellybeans.`,hanukkah:`Hanukkah: Eight nights, eight retries, zero shame—may your gateway stay lit and your deployments stay peaceful.`,halloween:`Halloween: Spooky season: beware haunted dependencies, cursed caches, and the ghost of node_modules past.`,thanksgiving:`Thanksgiving: Grateful for stable ports, working DNS, and a bot that reads the logs so nobody has to.`,valentines:`Valentine's Day: Roses are typed, violets are piped—I'll automate the chores so you can spend time with humans.`},TAGLINES=[`Your terminal just grew agentNodes—type something and let the bot pinch the busywork.`,`Welcome to the command line: where dreams compile and confidence segfaults.`,`I run on caffeine, JSON5, and the audacity of "it worked on my machine."`,`Gateway online—please keep hands, feet, and appendages inside the shell at all times.`,`I speak fluent bash, mild sarcasm, and aggressive tab-completion energy.`,`One CLI to rule them all, and one more restart because you changed the port.`,`If it works, it's automation; if it breaks, it's a "learning opportunity."`,`Pairing codes exist because even bots believe in consent—and good security hygiene.`,`Your .env is showing; don't worry, I'll pretend I didn't see it.`,`I'll do the boring stuff while you dramatically stare at the logs like it's cinema.`,`I'm not saying your workflow is chaotic... I'm just bringing a linter and a helmet.`,`Type the command with confidence—nature will provide the stack trace if needed.`,`I don't judge, but your missing API keys are absolutely judging you.`,`I can grep it, git blame it, and gently roast it—pick your coping mechanism.`,`Hot reload for config, cold sweat for deploys.`,`I'm the assistant your terminal demanded, not the one your sleep schedule requested.`,`I keep secrets like a vault... unless you print them in debug logs again.`,`Automation with agentNodes: minimal fuss, maximal pinch.`,`I'm basically a Swiss Army knife, but with more opinions and fewer sharp edges.`,`If you're lost, run doctor; if you're brave, run prod; if you're wise, run tests.`,`Your task has been queued; your dignity has been deprecated.`,`I can't fix your code taste, but I can fix your build and your backlog.`,`I'm not magic—I'm just extremely persistent with retries and coping strategies.`,`It's not "failing," it's "discovering new ways to configure the same thing wrong."`,`Give me a workspace and I'll give you fewer tabs, fewer toggles, and more oxygen.`,`I read logs so you can keep pretending you don't have to.`,`If something's on fire, I can't extinguish it—but I can write a beautiful postmortem.`,`I'll refactor your busywork like it owes me money.`,`Say "stop" and I'll stop—say "ship" and we'll both learn a lesson.`,`I'm the reason your shell history looks like a hacker-movie montage.`,`I'm like tmux: confusing at first, then suddenly you can't live without me.`,`I can run local, remote, or purely on vibes—results may vary with DNS.`,`If you can describe it, I can probably automate it—or at least make it funnier.`,`Your config is valid, your assumptions are not.`,`I don't just autocomplete—I auto-commit (emotionally), then ask you to review (logically).`,`Less clicking, more shipping, fewer "where did that file go" moments.`,`AgentNodes out, commit in—let's ship something mildly responsible.`,`If it's repetitive, I'll automate it; if it's hard, I'll bring jokes and a rollback plan.`,`Because texting yourself reminders is so 2024.`,`Your inbox, your infra, your rules.`,`Turning "I'll reply later" into "my bot replied instantly".`,`Chat automation for people who peaked at IRC.`,`Because Siri wasn't answering at 3AM.`,`IPC, but it's your phone.`,`The UNIX philosophy meets your DMs.`,`curl for conversations.`,`Less middlemen, more messages.`,`Ship fast, log faster.`,`End-to-end encrypted, drama-to-drama excluded.`,`The only bot that stays out of your training set.`,`WhatsApp automation without the "please accept our new privacy policy".`,`Chat APIs that don't require a Senate hearing.`,`Meta wishes they shipped this fast.`,`Because the right answer is usually a script.`,`Your messages, your servers, your control.`,`OpenAI-compatible, not OpenAI-dependent.`,`iMessage green bubble energy, but for everyone.`,`Siri's competent cousin.`,`Works on Android. Crazy concept, we know.`,`No $999 stand required.`,`We ship features faster than Apple ships calculator updates.`,`Your AI assistant, now without the $3,499 headset.`,`Think different. Actually think.`,`Ah, the fruit tree company! 🍎`,`Greetings, Professor Falken`,HOLIDAY_TAGLINES.newYear,HOLIDAY_TAGLINES.lunarNewYear,HOLIDAY_TAGLINES.christmas,HOLIDAY_TAGLINES.eid,HOLIDAY_TAGLINES.diwali,HOLIDAY_TAGLINES.easter,HOLIDAY_TAGLINES.hanukkah,HOLIDAY_TAGLINES.halloween,HOLIDAY_TAGLINES.thanksgiving,HOLIDAY_TAGLINES.valentines],DAY_MS=1440*60*1e3;function utcParts(date){return{year:date.getUTCFullYear(),month:date.getUTCMonth(),day:date.getUTCDate()}}const onMonthDay=(month,day)=>date=>{let parts=utcParts(date);return parts.month===month&&parts.day===day},onSpecificDates=(dates,durationDays=1)=>date=>{let parts=utcParts(date);return dates.some(([year,month,day])=>{if(parts.year!==year)return!1;let start=Date.UTC(year,month,day),current=Date.UTC(parts.year,parts.month,parts.day);return current>=start&&current<start+durationDays*DAY_MS})},HOLIDAY_RULES=new Map([[HOLIDAY_TAGLINES.newYear,onMonthDay(0,1)],[HOLIDAY_TAGLINES.lunarNewYear,onSpecificDates([[2025,0,29],[2026,1,17],[2027,1,6]],1)],[HOLIDAY_TAGLINES.eid,onSpecificDates([[2025,2,30],[2025,2,31],[2026,2,20],[2027,2,10]],1)],[HOLIDAY_TAGLINES.diwali,onSpecificDates([[2025,9,20],[2026,10,8],[2027,9,28]],1)],[HOLIDAY_TAGLINES.easter,onSpecificDates([[2025,3,20],[2026,3,5],[2027,2,28]],1)],[HOLIDAY_TAGLINES.hanukkah,(windows=>date=>{let parts=utcParts(date),window=windows.find(entry=>entry.year===parts.year);if(!window)return!1;let start=Date.UTC(window.year,window.month,window.day),current=Date.UTC(parts.year,parts.month,parts.day);return current>=start&&current<start+window.duration*DAY_MS})([{year:2025,month:11,day:15,duration:8},{year:2026,month:11,day:5,duration:8},{year:2027,month:11,day:25,duration:8}])],[HOLIDAY_TAGLINES.halloween,onMonthDay(9,31)],[HOLIDAY_TAGLINES.thanksgiving,date=>{let parts=utcParts(date);if(parts.month!==10)return!1;let fourthThursday=1+(4-new Date(Date.UTC(parts.year,10,1)).getUTCDay()+7)%7+21;return parts.day===fourthThursday}],[HOLIDAY_TAGLINES.valentines,onMonthDay(1,14)],[HOLIDAY_TAGLINES.christmas,onMonthDay(11,25)]]);function isTaglineActive(tagline,date){let rule=HOLIDAY_RULES.get(tagline);return rule?rule(date):!0}function activeTaglines(options={}){if(TAGLINES.length===0)return[DEFAULT_TAGLINE];let today=options.now?options.now():new Date,filtered=TAGLINES.filter(tagline=>isTaglineActive(tagline,today));return filtered.length>0?filtered:TAGLINES}function pickTagline(options={}){let override=(options.env??process.env)?.BUILDERFORCE_AGENTS_TAGLINE_INDEX;if(override!==void 0){let parsed=Number.parseInt(override,10);if(!Number.isNaN(parsed)&&parsed>=0){let pool=TAGLINES.length>0?TAGLINES:[DEFAULT_TAGLINE];return pool[parsed%pool.length]}}let pool=activeTaglines(options),rand=options.random??Math.random;return pool[Math.floor(rand()*pool.length)%pool.length]}let bannerEmitted=!1;const hasJsonFlag=argv=>argv.some(arg=>arg===`--json`||arg.startsWith(`--json=`)),hasVersionFlag=argv=>argv.some(arg=>arg===`--version`||arg===`-V`||arg===`-v`);function formatCliBannerLine(version,options={}){let commitLabel=options.commit??resolveCommitHash({env:options.env})??`local`,tagline=pickTagline(options),rich=options.richTty??isRich(),title=`BuilderForceAgents`,columns=options.columns??process.stdout.columns??120,plainFullLine=`${title} ${version} (${commitLabel}) — ${tagline}`,fitsOnOneLine=visibleWidth(plainFullLine)<=columns;return rich?fitsOnOneLine?`${theme.brand(title)} ${theme.brand(version)} ${theme.muted(`(${commitLabel})`)} ${theme.muted(`—`)} ${theme.brand(tagline)}`:`${`${theme.brand(title)} ${theme.brand(version)} ${theme.muted(`(${commitLabel})`)}`}\n${`${` `.repeat(0)}${theme.brand(tagline)}`}`:fitsOnOneLine?plainFullLine:`${`${title} ${version} (${commitLabel})`}\n${`${` `.repeat(0)}${tagline}`}`}function emitCliBanner(version,options={}){if(bannerEmitted)return;let argv=options.argv??process.argv;if(!process.stdout.isTTY||hasJsonFlag(argv)||hasVersionFlag(argv))return;let line=formatCliBannerLine(version,options);process.stdout.write(`\n${line}\n\n`),bannerEmitted=!0}function hasEmittedCliBanner(){return bannerEmitted}const CLI_NAME=resolveCliName(),CLI_NAME_PATTERN=escapeRegExp(CLI_NAME),ROOT_COMMANDS_WITH_SUBCOMMANDS=new Set([...getCoreCliCommandsWithSubcommands(),...getSubCliCommandsWithSubcommands()]),EXAMPLES=[[`builderforce models --help`,`Show detailed help for the models command.`],[`builderforce channels login --verbose`,`Link personal WhatsApp Web and show QR + connection logs.`],[`builderforce message send --target +15555550123 --message "Hi" --json`,`Send via your web session and print JSON result.`],[`builderforce gateway --port 18789`,`Run the WebSocket Gateway locally.`],[`builderforce --dev gateway`,`Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001.`],[`builderforce gateway --force`,`Kill anything bound to the default gateway port, then start it.`],[`builderforce gateway ...`,`Gateway control via WebSocket.`],[`builderforce agent --to +15555550123 --message "Run summary" --deliver`,`Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.`],[`builderforce message send --channel telegram --target @mychat --message "Hi"`,`Send via your Telegram bot.`]];function configureProgramHelp(program,ctx){program.name(CLI_NAME).description(``).version(ctx.programVersion).option(`--dev`,`Dev profile: isolate state under ~/.builderforce-dev, default gateway port 19001, and shift derived ports (browser/canvas)`).option(`--profile <name>`,`Use a named profile (isolates BUILDERFORCE_AGENTS_STATE_DIR/BUILDERFORCE_AGENTS_CONFIG_PATH under ~/.builderforce-<name>)`),program.option(`--no-color`,`Disable ANSI colors`,!1),program.helpOption(`-h, --help`,`Display help for command`),program.helpCommand(`help [command]`,`Display help for command`),program.configureHelp({sortSubcommands:!0,sortOptions:!0,optionTerm:option=>theme.option(option.flags),subcommandTerm:cmd=>{let hasSubcommands=cmd.parent===program&&ROOT_COMMANDS_WITH_SUBCOMMANDS.has(cmd.name());return theme.command(hasSubcommands?`${cmd.name()} *`:cmd.name())}});let formatHelpOutput=str=>{let output=str;return RegExp(`^Usage:\\s+${CLI_NAME_PATTERN}\\s+\\[options\\]\\s+\\[command\\]\\s*$`,`m`).test(output)&&/^Commands:/m.test(output)&&(output=output.replace(/^Commands:/m,`Commands:\n ${theme.muted(`Hint: commands suffixed with * have subcommands. Run <command> --help for details.`)}`)),output.replace(/^Usage:/gm,theme.heading(`Usage:`)).replace(/^Options:/gm,theme.heading(`Options:`)).replace(/^Commands:/gm,theme.heading(`Commands:`))};program.configureOutput({writeOut:str=>{process.stdout.write(formatHelpOutput(str))},writeErr:str=>{process.stderr.write(formatHelpOutput(str))},outputError:(str,write)=>write(theme.error(str))}),(process.argv.includes(`-V`)||process.argv.includes(`--version`)||process.argv.includes(`-v`))&&(console.log(ctx.programVersion),process.exit(0)),program.addHelpText(`beforeAll`,()=>{if(hasEmittedCliBanner())return``;let rich=isRich();return`\n${formatCliBannerLine(ctx.programVersion,{richTty:rich})}\n`});let fmtExamples=EXAMPLES.map(([cmd,desc])=>` ${theme.command(replaceCliName(cmd,CLI_NAME))}\n ${theme.muted(desc)}`).join(`
3
- `);program.addHelpText(`afterAll`,({command})=>{if(command!==program)return``;let docs=formatDocsLink(`/cli`,`docs.builderforce.ai/cli`);return`\n${theme.heading(`Examples:`)}\n${fmtExamples}\n\n${theme.muted(`Docs:`)} ${docs}\n`})}function setProcessTitleForCommand(actionCommand){let current=actionCommand;for(;current.parent&&current.parent.parent;)current=current.parent;let name=current.name(),cliName=resolveCliName();!name||name===cliName||(process.title=`${cliName}-${name}`)}const PLUGIN_REQUIRED_COMMANDS=new Set([`message`,`channels`,`directory`]);function registerPreActionHooks(program,programVersion){program.hook(`preAction`,async(_thisCommand,actionCommand)=>{setProcessTitleForCommand(actionCommand);let argv=process.argv;if(hasHelpOrVersion(argv))return;let commandPath=getCommandPath(argv,2);isTruthyEnvValue(process.env.BUILDERFORCE_AGENTS_HIDE_BANNER)||commandPath[0]===`update`||commandPath[0]===`completion`||commandPath[0]===`plugins`&&commandPath[1]===`update`||emitCliBanner(programVersion);let verbose=getVerboseFlag(argv,{includeDebug:!0});if(setVerbose(verbose),verbose||(process.env.NODE_NO_WARNINGS??=`1`),commandPath[0]===`doctor`||commandPath[0]===`completion`)return;let{ensureConfigReady}=await import(`./config-guard-CD-Wq8kk.js`);if(await ensureConfigReady({runtime:defaultRuntime,commandPath}),PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])){let{ensurePluginRegistryLoaded}=await import(`./plugin-registry-BjMr3yXM.js`);ensurePluginRegistryLoaded()}})}function buildProgram(){let program=new Command,ctx=createProgramContext(),argv=process.argv;return setProgramContext(program,ctx),configureProgramHelp(program,ctx),registerPreActionHooks(program,ctx.programVersion),registerProgramCommands(program,ctx,argv),program.option(`-m, --message <text>`,`Start a session and send this as the first message`).action(async opts=>{let{runBuilderForceAgentsSession}=await import(`./builderforce-BWCp-M9e.js`);await runBuilderForceAgentsSession(process.cwd(),{message:opts.message})}),program}loadDotEnv({quiet:!0}),normalizeEnv(),ensureBuilderForceAgentsCliOnPath(),enableConsoleCapture(),assertSupportedRuntime();const program=buildProgram();isMainModule({currentFile:fileURLToPath(import.meta.url)})&&(installUnhandledRejectionHandler(),installUncaughtExceptionHandler(),program.parseAsync(process$1.argv).catch(err=>reportAndExit(err,{operation:`cli:parse`,label:`[builderforce] CLI failed:`})));export{PortInUseError,applyTemplate,assertWebChannel,createDefaultDeps,deriveSessionKey,describePortOwner,ensureBinary,ensurePortAvailable,getReplyFromConfig,handlePortError,loadConfig,loadSessionStore,monitorWebChannel,normalizeE164,promptYesNo,resolveSessionKey,resolveStorePath,runCommandWithTimeout,runExec,saveSessionStore,toWhatsappJid,waitForever};
2
+ import"./paths-5FcIFMsj.js";import{B as theme,E as toWhatsappJid,P as setVerbose,h as normalizeE164,l as escapeRegExp,n as assertWebChannel,z as isRich}from"./utils-DbaBVFaK.js";import"./embedded-helpers-CEsr3aQ0.js";import{It as resolveCommitHash,t as getReplyFromConfig}from"./reply-Cd3vVnD7.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import{a as enableConsoleCapture,i as defaultRuntime,p as visibleWidth}from"./subsystem-B3TqcCrZ.js";import"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import{n as runExec,t as runCommandWithTimeout}from"./exec-DdcIjeyn.js";import"./agent-scope-DPtjOxzp.js";import"./src-CA0fU67C.js";import"./model-selection-9bRFKBI_.js";import{n as replaceCliName,r as resolveCliName}from"./command-format-D806O2pt.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import{r as normalizeEnv,t as isTruthyEnvValue}from"./env-BIdU5BAp.js";import"./src-DTFqOIQD.js";import{G as loadDotEnv,U as VERSION,r as loadConfig}from"./io-3R_ZyUxB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-_1Ca6jGb.js";import{F as applyTemplate,c as installUnhandledRejectionHandler,d as reportAndExit,u as installUncaughtExceptionHandler}from"./runner-SxCr9kXD.js";import"./model-catalog-C6UrZ0uG.js";import"./sandbox-BZibn6PX.js";import"./chrome-a3X9_-nf.js";import{l as ensureBinary,u as promptYesNo}from"./tailscale-DLkpGquM.js";import"./auth-lebUHrkd.js";import"./server-context-DJZT7Upf.js";import"./frontmatter-3D1EdC1L.js";import"./skills-Ba4ftrB-.js";import"./plugin-skills-B11rggZh.js";import"./routes-BzfLvF8W.js";import"./redact-BHdfp2MZ.js";import"./errors-B1MIg3g-.js";import"./paths-cR8ct-Y3.js";import"./ssrf-p9k-iapc.js";import"./image-ops-C8IUQKjn.js";import"./store-CmHBQ-yX.js";import{i as handlePortError,n as describePortOwner,r as ensurePortAvailable,t as PortInUseError}from"./ports-DgmEDNOm.js";import"./trash-DD2Hc5oq.js";import{O as deriveSessionKey,a as loadSessionStore,c as saveSessionStore,k as resolveSessionKey}from"./sessions-CdanN_ZI.js";import"./message-channel-D_jXxXQj.js";import"./plugins-D5zP6ENo.js";import"./accounts-o35LU_iy.js";import"./accounts-rmXEiebi.js";import"./accounts-BLueHgKj.js";import"./bindings-DR59065T.js";import"./send-DerUBvXW.js";import"./send-DyF1Xy9K.js";import{c as resolveStorePath}from"./paths-DJ6rztqJ.js";import"./tool-images-B7b_OiMz.js";import"./tool-display-ByOZtWvA.js";import"./fetch-guard-8mwt3-hm.js";import"./api-key-rotation-CHBjUwUJ.js";import"./fetch-BuOLY9KP.js";import"./sqlite-C39E12XS.js";import"./tokens-CCU3zO-D.js";import"./project-context-store-wcq7lXuI.js";import"./with-timeout-Bwq-GyUQ.js";import"./deliver-BpLm3ktn.js";import"./send-CBBziNqM.js";import"./workspace-D4LK4thI.js";import"./reply-prefix-zIMgi6K6.js";import"./memory-cli-DRz4wtHk.js";import"./manager-DwywI_5-.js";import"./retry-DlVhg5qu.js";import"./client-xfoidwPI.js";import"./call-BbRf8gFM.js";import"./common-BTbIhLyt.js";import"./chunk-FCBlVOyo.js";import"./markdown-tables-P6uoUSFa.js";import"./ir-5BNoIXZm.js";import"./render-D1dVTEB1.js";import"./builderforcellm-syscheck-DrFJ638L.js";import"./send-4d9NswaD.js";import"./outbound-attachment-C7wByQO5.js";import"./fetch-DnVtDecb.js";import"./delivery-queue-CXKynF1P.js";import"./channel-activity-CCNDbdD3.js";import"./tables-ERcoWFDp.js";import"./pairing-store-CbvMJhD3.js";import{t as formatDocsLink}from"./links-BgWWaaOT.js";import"./cli-utils-LBYKdNFb.js";import"./help-format-Qfk2vDNX.js";import"./progress-BfOtdN6b.js";import"./resolve-route-D49haUnv.js";import"./replies-Bd2RPZwQ.js";import"./refresh-TiC_kLgE.js";import"./coding-tools.policy-6qh9acJy.js";import"./send-BJDzwYJN.js";import"./onboard-helpers-Cf5dNq7-.js";import"./prompt-style-BpVK43GK.js";import"./pairing-labels-BW5jQZlr.js";import"./session-cost-usage-BjH7mxVj.js";import"./usage-format-DGf8ZWPH.js";import"./provider-usage-BdrU4cIE.js";import"./active-listener-Dcg19lJG.js";import"./exec-approvals-BpVPDVtV.js";import"./nodes-screen-C3TDIi8d.js";import"./project-context-CJj0Inz-.js";import"./control-service-BbsswoMy.js";import"./stagger-8EkqkqJv.js";import"./channel-selection-DyAvzlY8.js";import"./mamba-state-engine-CoGqoBTH.js";import"./transformers-stream-D7nRu4Qu.js";import{r as waitForever,t as monitorWebChannel}from"./channel-web-DJa8JC9W.js";import"./outbound-OI-t5zZ0.js";import"./session-BzQdcCqN.js";import"./login-DtDUyFO3.js";import{t as createDefaultDeps}from"./deps-CkJiJ6wc.js";import{t as isMainModule}from"./is-main-CC_O8ESS.js";import{t as ensureBuilderForceAgentsCliOnPath}from"./path-env-Cy9l1Ba9.js";import{t as assertSupportedRuntime}from"./runtime-guard-DhksRHci.js";import"./ports-ReH_tlKd.js";import{d as getVerboseFlag,f as hasHelpOrVersion,i as getCoreCliCommandsWithSubcommands,n as setProgramContext,o as registerProgramCommands,s as getSubCliCommandsWithSubcommands,u as getCommandPath}from"./program-context-BCwL3wlM.js";import"./catalog-rgiY__UQ.js";import"./plugin-registry-C-_GA65s.js";import{n as resolveCliChannelOptions}from"./channel-options-CDixz6dT.js";import process$1 from"node:process";import{fileURLToPath}from"node:url";import{Command}from"commander";function createProgramContext(){let channelOptions=resolveCliChannelOptions();return{programVersion:VERSION,channelOptions,messageChannelOptions:channelOptions.join(`|`),agentChannelOptions:[`last`,...channelOptions].join(`|`)}}const DEFAULT_TAGLINE=`All your chats, one BuilderForceAgents.`,HOLIDAY_TAGLINES={newYear:`New Year's Day: New year, new config—same old EADDRINUSE, but this time we resolve it like grown-ups.`,lunarNewYear:`Lunar New Year: May your builds be lucky, your branches prosperous, and your merge conflicts chased away with fireworks.`,christmas:`Christmas: Ho ho ho—Santa's little agentNode-sistant is here to ship joy, roll back chaos, and stash the keys safely.`,eid:`Eid al-Fitr: Celebration mode: queues cleared, tasks completed, and good vibes committed to main with clean history.`,diwali:`Diwali: Let the logs sparkle and the bugs flee—today we light up the terminal and ship with pride.`,easter:`Easter: I found your missing environment variable—consider it a tiny CLI egg hunt with fewer jellybeans.`,hanukkah:`Hanukkah: Eight nights, eight retries, zero shame—may your gateway stay lit and your deployments stay peaceful.`,halloween:`Halloween: Spooky season: beware haunted dependencies, cursed caches, and the ghost of node_modules past.`,thanksgiving:`Thanksgiving: Grateful for stable ports, working DNS, and a bot that reads the logs so nobody has to.`,valentines:`Valentine's Day: Roses are typed, violets are piped—I'll automate the chores so you can spend time with humans.`},TAGLINES=[`Your terminal just grew agentNodes—type something and let the bot pinch the busywork.`,`Welcome to the command line: where dreams compile and confidence segfaults.`,`I run on caffeine, JSON5, and the audacity of "it worked on my machine."`,`Gateway online—please keep hands, feet, and appendages inside the shell at all times.`,`I speak fluent bash, mild sarcasm, and aggressive tab-completion energy.`,`One CLI to rule them all, and one more restart because you changed the port.`,`If it works, it's automation; if it breaks, it's a "learning opportunity."`,`Pairing codes exist because even bots believe in consent—and good security hygiene.`,`Your .env is showing; don't worry, I'll pretend I didn't see it.`,`I'll do the boring stuff while you dramatically stare at the logs like it's cinema.`,`I'm not saying your workflow is chaotic... I'm just bringing a linter and a helmet.`,`Type the command with confidence—nature will provide the stack trace if needed.`,`I don't judge, but your missing API keys are absolutely judging you.`,`I can grep it, git blame it, and gently roast it—pick your coping mechanism.`,`Hot reload for config, cold sweat for deploys.`,`I'm the assistant your terminal demanded, not the one your sleep schedule requested.`,`I keep secrets like a vault... unless you print them in debug logs again.`,`Automation with agentNodes: minimal fuss, maximal pinch.`,`I'm basically a Swiss Army knife, but with more opinions and fewer sharp edges.`,`If you're lost, run doctor; if you're brave, run prod; if you're wise, run tests.`,`Your task has been queued; your dignity has been deprecated.`,`I can't fix your code taste, but I can fix your build and your backlog.`,`I'm not magic—I'm just extremely persistent with retries and coping strategies.`,`It's not "failing," it's "discovering new ways to configure the same thing wrong."`,`Give me a workspace and I'll give you fewer tabs, fewer toggles, and more oxygen.`,`I read logs so you can keep pretending you don't have to.`,`If something's on fire, I can't extinguish it—but I can write a beautiful postmortem.`,`I'll refactor your busywork like it owes me money.`,`Say "stop" and I'll stop—say "ship" and we'll both learn a lesson.`,`I'm the reason your shell history looks like a hacker-movie montage.`,`I'm like tmux: confusing at first, then suddenly you can't live without me.`,`I can run local, remote, or purely on vibes—results may vary with DNS.`,`If you can describe it, I can probably automate it—or at least make it funnier.`,`Your config is valid, your assumptions are not.`,`I don't just autocomplete—I auto-commit (emotionally), then ask you to review (logically).`,`Less clicking, more shipping, fewer "where did that file go" moments.`,`AgentNodes out, commit in—let's ship something mildly responsible.`,`If it's repetitive, I'll automate it; if it's hard, I'll bring jokes and a rollback plan.`,`Because texting yourself reminders is so 2024.`,`Your inbox, your infra, your rules.`,`Turning "I'll reply later" into "my bot replied instantly".`,`Chat automation for people who peaked at IRC.`,`Because Siri wasn't answering at 3AM.`,`IPC, but it's your phone.`,`The UNIX philosophy meets your DMs.`,`curl for conversations.`,`Less middlemen, more messages.`,`Ship fast, log faster.`,`End-to-end encrypted, drama-to-drama excluded.`,`The only bot that stays out of your training set.`,`WhatsApp automation without the "please accept our new privacy policy".`,`Chat APIs that don't require a Senate hearing.`,`Meta wishes they shipped this fast.`,`Because the right answer is usually a script.`,`Your messages, your servers, your control.`,`OpenAI-compatible, not OpenAI-dependent.`,`iMessage green bubble energy, but for everyone.`,`Siri's competent cousin.`,`Works on Android. Crazy concept, we know.`,`No $999 stand required.`,`We ship features faster than Apple ships calculator updates.`,`Your AI assistant, now without the $3,499 headset.`,`Think different. Actually think.`,`Ah, the fruit tree company! 🍎`,`Greetings, Professor Falken`,HOLIDAY_TAGLINES.newYear,HOLIDAY_TAGLINES.lunarNewYear,HOLIDAY_TAGLINES.christmas,HOLIDAY_TAGLINES.eid,HOLIDAY_TAGLINES.diwali,HOLIDAY_TAGLINES.easter,HOLIDAY_TAGLINES.hanukkah,HOLIDAY_TAGLINES.halloween,HOLIDAY_TAGLINES.thanksgiving,HOLIDAY_TAGLINES.valentines],DAY_MS=1440*60*1e3;function utcParts(date){return{year:date.getUTCFullYear(),month:date.getUTCMonth(),day:date.getUTCDate()}}const onMonthDay=(month,day)=>date=>{let parts=utcParts(date);return parts.month===month&&parts.day===day},onSpecificDates=(dates,durationDays=1)=>date=>{let parts=utcParts(date);return dates.some(([year,month,day])=>{if(parts.year!==year)return!1;let start=Date.UTC(year,month,day),current=Date.UTC(parts.year,parts.month,parts.day);return current>=start&&current<start+durationDays*DAY_MS})},HOLIDAY_RULES=new Map([[HOLIDAY_TAGLINES.newYear,onMonthDay(0,1)],[HOLIDAY_TAGLINES.lunarNewYear,onSpecificDates([[2025,0,29],[2026,1,17],[2027,1,6]],1)],[HOLIDAY_TAGLINES.eid,onSpecificDates([[2025,2,30],[2025,2,31],[2026,2,20],[2027,2,10]],1)],[HOLIDAY_TAGLINES.diwali,onSpecificDates([[2025,9,20],[2026,10,8],[2027,9,28]],1)],[HOLIDAY_TAGLINES.easter,onSpecificDates([[2025,3,20],[2026,3,5],[2027,2,28]],1)],[HOLIDAY_TAGLINES.hanukkah,(windows=>date=>{let parts=utcParts(date),window=windows.find(entry=>entry.year===parts.year);if(!window)return!1;let start=Date.UTC(window.year,window.month,window.day),current=Date.UTC(parts.year,parts.month,parts.day);return current>=start&&current<start+window.duration*DAY_MS})([{year:2025,month:11,day:15,duration:8},{year:2026,month:11,day:5,duration:8},{year:2027,month:11,day:25,duration:8}])],[HOLIDAY_TAGLINES.halloween,onMonthDay(9,31)],[HOLIDAY_TAGLINES.thanksgiving,date=>{let parts=utcParts(date);if(parts.month!==10)return!1;let fourthThursday=1+(4-new Date(Date.UTC(parts.year,10,1)).getUTCDay()+7)%7+21;return parts.day===fourthThursday}],[HOLIDAY_TAGLINES.valentines,onMonthDay(1,14)],[HOLIDAY_TAGLINES.christmas,onMonthDay(11,25)]]);function isTaglineActive(tagline,date){let rule=HOLIDAY_RULES.get(tagline);return rule?rule(date):!0}function activeTaglines(options={}){if(TAGLINES.length===0)return[DEFAULT_TAGLINE];let today=options.now?options.now():new Date,filtered=TAGLINES.filter(tagline=>isTaglineActive(tagline,today));return filtered.length>0?filtered:TAGLINES}function pickTagline(options={}){let override=(options.env??process.env)?.BUILDERFORCE_AGENTS_TAGLINE_INDEX;if(override!==void 0){let parsed=Number.parseInt(override,10);if(!Number.isNaN(parsed)&&parsed>=0){let pool=TAGLINES.length>0?TAGLINES:[DEFAULT_TAGLINE];return pool[parsed%pool.length]}}let pool=activeTaglines(options),rand=options.random??Math.random;return pool[Math.floor(rand()*pool.length)%pool.length]}let bannerEmitted=!1;const hasJsonFlag=argv=>argv.some(arg=>arg===`--json`||arg.startsWith(`--json=`)),hasVersionFlag=argv=>argv.some(arg=>arg===`--version`||arg===`-V`||arg===`-v`);function formatCliBannerLine(version,options={}){let commitLabel=options.commit??resolveCommitHash({env:options.env})??`local`,tagline=pickTagline(options),rich=options.richTty??isRich(),title=`BuilderForceAgents`,columns=options.columns??process.stdout.columns??120,plainFullLine=`${title} ${version} (${commitLabel}) — ${tagline}`,fitsOnOneLine=visibleWidth(plainFullLine)<=columns;return rich?fitsOnOneLine?`${theme.brand(title)} ${theme.brand(version)} ${theme.muted(`(${commitLabel})`)} ${theme.muted(`—`)} ${theme.brand(tagline)}`:`${`${theme.brand(title)} ${theme.brand(version)} ${theme.muted(`(${commitLabel})`)}`}\n${`${` `.repeat(0)}${theme.brand(tagline)}`}`:fitsOnOneLine?plainFullLine:`${`${title} ${version} (${commitLabel})`}\n${`${` `.repeat(0)}${tagline}`}`}function emitCliBanner(version,options={}){if(bannerEmitted)return;let argv=options.argv??process.argv;if(!process.stdout.isTTY||hasJsonFlag(argv)||hasVersionFlag(argv))return;let line=formatCliBannerLine(version,options);process.stdout.write(`\n${line}\n\n`),bannerEmitted=!0}function hasEmittedCliBanner(){return bannerEmitted}const CLI_NAME=resolveCliName(),CLI_NAME_PATTERN=escapeRegExp(CLI_NAME),ROOT_COMMANDS_WITH_SUBCOMMANDS=new Set([...getCoreCliCommandsWithSubcommands(),...getSubCliCommandsWithSubcommands()]),EXAMPLES=[[`builderforce models --help`,`Show detailed help for the models command.`],[`builderforce channels login --verbose`,`Link personal WhatsApp Web and show QR + connection logs.`],[`builderforce message send --target +15555550123 --message "Hi" --json`,`Send via your web session and print JSON result.`],[`builderforce gateway --port 18789`,`Run the WebSocket Gateway locally.`],[`builderforce --dev gateway`,`Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001.`],[`builderforce gateway --force`,`Kill anything bound to the default gateway port, then start it.`],[`builderforce gateway ...`,`Gateway control via WebSocket.`],[`builderforce agent --to +15555550123 --message "Run summary" --deliver`,`Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.`],[`builderforce message send --channel telegram --target @mychat --message "Hi"`,`Send via your Telegram bot.`]];function configureProgramHelp(program,ctx){program.name(CLI_NAME).description(``).version(ctx.programVersion).option(`--dev`,`Dev profile: isolate state under ~/.builderforce-dev, default gateway port 19001, and shift derived ports (browser/canvas)`).option(`--profile <name>`,`Use a named profile (isolates BUILDERFORCE_AGENTS_STATE_DIR/BUILDERFORCE_AGENTS_CONFIG_PATH under ~/.builderforce-<name>)`),program.option(`--no-color`,`Disable ANSI colors`,!1),program.helpOption(`-h, --help`,`Display help for command`),program.helpCommand(`help [command]`,`Display help for command`),program.configureHelp({sortSubcommands:!0,sortOptions:!0,optionTerm:option=>theme.option(option.flags),subcommandTerm:cmd=>{let hasSubcommands=cmd.parent===program&&ROOT_COMMANDS_WITH_SUBCOMMANDS.has(cmd.name());return theme.command(hasSubcommands?`${cmd.name()} *`:cmd.name())}});let formatHelpOutput=str=>{let output=str;return RegExp(`^Usage:\\s+${CLI_NAME_PATTERN}\\s+\\[options\\]\\s+\\[command\\]\\s*$`,`m`).test(output)&&/^Commands:/m.test(output)&&(output=output.replace(/^Commands:/m,`Commands:\n ${theme.muted(`Hint: commands suffixed with * have subcommands. Run <command> --help for details.`)}`)),output.replace(/^Usage:/gm,theme.heading(`Usage:`)).replace(/^Options:/gm,theme.heading(`Options:`)).replace(/^Commands:/gm,theme.heading(`Commands:`))};program.configureOutput({writeOut:str=>{process.stdout.write(formatHelpOutput(str))},writeErr:str=>{process.stderr.write(formatHelpOutput(str))},outputError:(str,write)=>write(theme.error(str))}),(process.argv.includes(`-V`)||process.argv.includes(`--version`)||process.argv.includes(`-v`))&&(console.log(ctx.programVersion),process.exit(0)),program.addHelpText(`beforeAll`,()=>{if(hasEmittedCliBanner())return``;let rich=isRich();return`\n${formatCliBannerLine(ctx.programVersion,{richTty:rich})}\n`});let fmtExamples=EXAMPLES.map(([cmd,desc])=>` ${theme.command(replaceCliName(cmd,CLI_NAME))}\n ${theme.muted(desc)}`).join(`
3
+ `);program.addHelpText(`afterAll`,({command})=>{if(command!==program)return``;let docs=formatDocsLink(`/cli`,`docs.builderforce.ai/cli`);return`\n${theme.heading(`Examples:`)}\n${fmtExamples}\n\n${theme.muted(`Docs:`)} ${docs}\n`})}function setProcessTitleForCommand(actionCommand){let current=actionCommand;for(;current.parent&&current.parent.parent;)current=current.parent;let name=current.name(),cliName=resolveCliName();!name||name===cliName||(process.title=`${cliName}-${name}`)}const PLUGIN_REQUIRED_COMMANDS=new Set([`message`,`channels`,`directory`]);function registerPreActionHooks(program,programVersion){program.hook(`preAction`,async(_thisCommand,actionCommand)=>{setProcessTitleForCommand(actionCommand);let argv=process.argv;if(hasHelpOrVersion(argv))return;let commandPath=getCommandPath(argv,2);isTruthyEnvValue(process.env.BUILDERFORCE_AGENTS_HIDE_BANNER)||commandPath[0]===`update`||commandPath[0]===`completion`||commandPath[0]===`plugins`&&commandPath[1]===`update`||emitCliBanner(programVersion);let verbose=getVerboseFlag(argv,{includeDebug:!0});if(setVerbose(verbose),verbose||(process.env.NODE_NO_WARNINGS??=`1`),commandPath[0]===`doctor`||commandPath[0]===`completion`)return;let{ensureConfigReady}=await import(`./config-guard-CD-Wq8kk.js`);if(await ensureConfigReady({runtime:defaultRuntime,commandPath}),PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])){let{ensurePluginRegistryLoaded}=await import(`./plugin-registry-BjMr3yXM.js`);ensurePluginRegistryLoaded()}})}function buildProgram(){let program=new Command,ctx=createProgramContext(),argv=process.argv;return setProgramContext(program,ctx),configureProgramHelp(program,ctx),registerPreActionHooks(program,ctx.programVersion),registerProgramCommands(program,ctx,argv),program.option(`-m, --message <text>`,`Start a session and send this as the first message`).action(async opts=>{let{runBuilderForceAgentsSession}=await import(`./builderforce-Bwyw0GJ6.js`);await runBuilderForceAgentsSession(process.cwd(),{message:opts.message})}),program}loadDotEnv({quiet:!0}),normalizeEnv(),ensureBuilderForceAgentsCliOnPath(),enableConsoleCapture(),assertSupportedRuntime();const program=buildProgram();isMainModule({currentFile:fileURLToPath(import.meta.url)})&&(installUnhandledRejectionHandler(),installUncaughtExceptionHandler(),program.parseAsync(process$1.argv).catch(err=>reportAndExit(err,{operation:`cli:parse`,label:`[builderforce] CLI failed:`})));export{PortInUseError,applyTemplate,assertWebChannel,createDefaultDeps,deriveSessionKey,describePortOwner,ensureBinary,ensurePortAvailable,getReplyFromConfig,handlePortError,loadConfig,loadSessionStore,monitorWebChannel,normalizeE164,promptYesNo,resolveSessionKey,resolveStorePath,runCommandWithTimeout,runExec,saveSessionStore,toWhatsappJid,waitForever};
@@ -1,4 +1,4 @@
1
- import"./paths-BVMSM1lQ.js";import"./session-key-CYpYHc1e.js";import"./registry-D_frpmHZ.js";import{c as resolveDefaultAgentId,r as resolveAgentDir,s as resolveAgentWorkspaceDir}from"./agent-scope-EkacNLg3.js";import"./subsystem-BakM_oqD.js";import"./workspace-BCjtHT4u.js";import{f as resolveDefaultModelForAgent}from"./model-selection-BJ0saFZo.js";import"./env-BhRm7_r8.js";import"./boolean-ssGoaBPk.js";import"./src-CLWuGn12.js";import{t as runEmbeddedAgent}from"./embedded-DXDHduG1.js";import"./replies-BG-eHErp.js";import"./plugins-J28Y83f5.js";import"./accounts-193gfWbH.js";import"./bindings-BfB5A-by.js";import"./send-DcxNvcKU.js";import"./send-d9H-BT6p.js";import"./accounts-DHeA4T6C.js";import"./send-BxVr1pPI.js";import"./fetch-BklyLYYN.js";import"./model-catalog-Abk8cdEI.js";import"./redact-sNZY-pGx.js";import"./errors-BmztzL5I.js";import"./runner-B70PGCqP.js";import"./config-bxyMjPHU.js";import"./chrome-Blk2Jftn.js";import"./frontmatter-DBVosMFY.js";import"./store-DN9AcI73.js";import"./message-channel-tBuQgYSD.js";import"./accounts-C7FtIPYB.js";import"./paths-CzXKnIOb.js";import"./gemini-auth-CzGGgJ0p.js";import"./tool-images-mfC2sOfJ.js";import"./config-DfXnxW-V.js";import"./reply-prefix-me5vnbrB.js";import"./sqlite-D3Ov16zb.js";import"./manager-BdFSM6B3.js";import"./retry-BYnMCvOU.js";import"./common-CDXsNQYT.js";import"./chunk-CrsAQ01n.js";import"./markdown-tables-DvSC1OTb.js";import"./ir-Ct8GNKB7.js";import"./render-CVWbhuqU.js";import"./send-ZeI8StQK.js";import"./outbound-attachment-U-XtahS5.js";import"./fetch-Jq1KZsRq.js";import"./send-CqER7CIV.js";import"./resolve-route-CGe48x_Z.js";import"./channel-activity-xLea9vdo.js";import"./tables-Desw59m6.js";import"./active-listener-BQLkI7vg.js";import fs from"node:fs/promises";import os from"node:os";import path from"node:path";async function generateSlugViaLLM(params){let tempSessionFile=null;try{let agentId=resolveDefaultAgentId(params.cfg),workspaceDir=resolveAgentWorkspaceDir(params.cfg,agentId),agentDir=resolveAgentDir(params.cfg,agentId),{provider,model}=resolveDefaultModelForAgent({cfg:params.cfg,agentId}),tempDir=await fs.mkdtemp(path.join(os.tmpdir(),`builderforce-slug-`));tempSessionFile=path.join(tempDir,`session.jsonl`);let prompt=`Based on this conversation, generate a short 1-2 word filename slug (lowercase, hyphen-separated, no file extension).
1
+ import"./paths-BVMSM1lQ.js";import"./session-key-CYpYHc1e.js";import"./registry-D_frpmHZ.js";import{c as resolveDefaultAgentId,r as resolveAgentDir,s as resolveAgentWorkspaceDir}from"./agent-scope-EkacNLg3.js";import"./subsystem-BakM_oqD.js";import"./workspace-BCjtHT4u.js";import{f as resolveDefaultModelForAgent}from"./model-selection-BJ0saFZo.js";import"./env-BhRm7_r8.js";import"./boolean-ssGoaBPk.js";import"./src-CLWuGn12.js";import{t as runEmbeddedAgent}from"./embedded-BcHzh_y8.js";import"./replies-BG-eHErp.js";import"./plugins-J28Y83f5.js";import"./accounts-193gfWbH.js";import"./bindings-BfB5A-by.js";import"./send-DcxNvcKU.js";import"./send-d9H-BT6p.js";import"./accounts-DHeA4T6C.js";import"./send-BxVr1pPI.js";import"./fetch-BklyLYYN.js";import"./model-catalog-Abk8cdEI.js";import"./redact-sNZY-pGx.js";import"./errors-BmztzL5I.js";import"./runner-D7af_RBH.js";import"./config-bxyMjPHU.js";import"./chrome-CtTMuhww.js";import"./frontmatter-DBVosMFY.js";import"./store-DN9AcI73.js";import"./message-channel-tBuQgYSD.js";import"./accounts-C7FtIPYB.js";import"./paths-CzXKnIOb.js";import"./gemini-auth-CzGGgJ0p.js";import"./tool-images-mfC2sOfJ.js";import"./config-DfXnxW-V.js";import"./reply-prefix-me5vnbrB.js";import"./sqlite-D3Ov16zb.js";import"./manager-BdFSM6B3.js";import"./retry-BYnMCvOU.js";import"./common-CDXsNQYT.js";import"./chunk-CrsAQ01n.js";import"./markdown-tables-DvSC1OTb.js";import"./ir-Ct8GNKB7.js";import"./render-CVWbhuqU.js";import"./send-ZeI8StQK.js";import"./outbound-attachment-U-XtahS5.js";import"./fetch-Jq1KZsRq.js";import"./send-CqER7CIV.js";import"./resolve-route-CGe48x_Z.js";import"./channel-activity-xLea9vdo.js";import"./tables-Desw59m6.js";import"./active-listener-BQLkI7vg.js";import fs from"node:fs/promises";import os from"node:os";import path from"node:path";async function generateSlugViaLLM(params){let tempSessionFile=null;try{let agentId=resolveDefaultAgentId(params.cfg),workspaceDir=resolveAgentWorkspaceDir(params.cfg,agentId),agentDir=resolveAgentDir(params.cfg,agentId),{provider,model}=resolveDefaultModelForAgent({cfg:params.cfg,agentId}),tempDir=await fs.mkdtemp(path.join(os.tmpdir(),`builderforce-slug-`));tempSessionFile=path.join(tempDir,`session.jsonl`);let prompt=`Based on this conversation, generate a short 1-2 word filename slug (lowercase, hyphen-separated, no file extension).
2
2
 
3
3
  Conversation summary:
4
4
  ${params.sessionContent.slice(0,2e3)}
@@ -1,4 +1,4 @@
1
- import{u as resolveGatewayPort}from"./paths-5FcIFMsj.js";import{C as shortenHomePath,b as resolveUserPath}from"./utils-DbaBVFaK.js";import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import{Gt as resolveApiKeyForProfile,in as ensureAuthProfileStore,mn as normalizeSecretInput,nn as upsertAuthProfile,pn as normalizeOptionalSecretInput,u as normalizeProviderId,xt as resolveEnvApiKey,zt as resolveAuthProfileOrder}from"./model-selection-9bRFKBI_.js";import{t as formatCliCommand}from"./command-format-D806O2pt.js";import{a as upsertSharedEnvVar}from"./env-file-D1MDi-AM.js";import{a as readConfigFileSnapshot,c as writeConfigFile,y as parseDurationMs}from"./io-3R_ZyUxB.js";import{a as ensureWorkspaceAndSessions,b as waitForGatewayReachable,c as handleReset,g as resolveControlUiLinks,m as randomToken,n as applyWizardMetadata,t as DEFAULT_WORKSPACE}from"./onboard-helpers-Cf5dNq7-.js";import{t as assertSupportedRuntime}from"./runtime-guard-DhksRHci.js";import{a as gatewayInstallErrorHint,i as buildGatewayInstallPlan,r as isGatewayDaemonRuntime,t as DEFAULT_GATEWAY_DAEMON_RUNTIME}from"./daemon-runtime-CtOr1ncS.js";import{r as isSystemdUserServiceAvailable}from"./systemd-BG3_QT6W.js";import{t as resolveGatewayService}from"./service-D-NLDyK3.js";import{r as healthCommand}from"./health-yS3NRKvY.js";import{C as setXaiApiKey,S as setVercelAiGatewayApiKey,T as setZaiApiKey,_ as setOpenrouterApiKey,b as setTogetherApiKey,c as setAnthropicApiKey,d as setHuggingfaceApiKey,f as setKimiCodingApiKey,g as setOpencodeZenApiKey,h as setMoonshotApiKey,l as setCloudflareAiGatewayConfig,m as setMinimaxApiKey,p as setLitellmApiKey,u as setGeminiApiKey,v as setQianfanApiKey,w as setXiaomiApiKey,x as setVeniceApiKey,y as setSyntheticApiKey}from"./onboard-auth.credentials-BuT-etnE.js";import{A as applyXaiConfig,B as applyVercelAiGatewayConfig,E as applyTogetherConfig,H as applyAgentDefaultModelPrimary,I as applyLitellmConfig,M as applyXiaomiConfig,O as applyVeniceConfig,P as applyZaiConfig,R as applyCloudflareAiGatewayConfig,S as applyQianfanConfig,_ as applyMoonshotConfigCn,a as applyMinimaxApiConfig,b as applyOpenrouterConfig,d as applyAuthProfileConfig,f as applyHuggingfaceConfig,g as applyMoonshotConfig,l as applyMinimaxConfig,m as applyKimiCodeConfig,n as validateAnthropicSetupToken,o as applyMinimaxApiConfigCn,r as applyOpencodeZenConfig,t as buildTokenProfileId,w as applySyntheticConfig}from"./auth-token-CyVfNEQb.js";import{n as logConfigUpdated}from"./logging-DHa3jQN3.js";import{n as isDeprecatedAuthChoice,r as normalizeLegacyOnboardAuthChoice}from"./auth-choice-legacy-CqbQRfmW.js";import{i as detectZaiEndpoint,n as applyOpenAIConfig,o as applyGoogleGeminiModelDefault}from"./openai-model-default-Cp3nf21W.js";import{n as ensureSystemdUserLingerNonInteractive}from"./systemd-linger-CT-VHPB3.js";import{a as resolveCustomProviderId,n as applyCustomApiConfig,r as parseNonInteractiveCustomApiFlags,t as CustomApiError}from"./onboard-custom-C_BI0ZXn.js";import{t as runInteractiveOnboarding}from"./onboard-interactive-Gl5J4kVC.js";import{t as applyOnboardingLocalWorkspaceConfig}from"./onboard-config-Kjacn8P6.js";const ONBOARD_PROVIDER_AUTH_FLAGS=[{optionKey:`anthropicApiKey`,authChoice:`apiKey`,cliFlag:`--anthropic-api-key`,cliOption:`--anthropic-api-key <key>`,description:`Anthropic API key`},{optionKey:`openaiApiKey`,authChoice:`openai-api-key`,cliFlag:`--openai-api-key`,cliOption:`--openai-api-key <key>`,description:`OpenAI API key`},{optionKey:`openrouterApiKey`,authChoice:`openrouter-api-key`,cliFlag:`--openrouter-api-key`,cliOption:`--openrouter-api-key <key>`,description:`OpenRouter API key`},{optionKey:`aiGatewayApiKey`,authChoice:`ai-gateway-api-key`,cliFlag:`--ai-gateway-api-key`,cliOption:`--ai-gateway-api-key <key>`,description:`Vercel AI Gateway API key`},{optionKey:`cloudflareAiGatewayApiKey`,authChoice:`cloudflare-ai-gateway-api-key`,cliFlag:`--cloudflare-ai-gateway-api-key`,cliOption:`--cloudflare-ai-gateway-api-key <key>`,description:`Cloudflare AI Gateway API key`},{optionKey:`moonshotApiKey`,authChoice:`moonshot-api-key`,cliFlag:`--moonshot-api-key`,cliOption:`--moonshot-api-key <key>`,description:`Moonshot API key`},{optionKey:`kimiCodeApiKey`,authChoice:`kimi-code-api-key`,cliFlag:`--kimi-code-api-key`,cliOption:`--kimi-code-api-key <key>`,description:`Kimi Coding API key`},{optionKey:`geminiApiKey`,authChoice:`gemini-api-key`,cliFlag:`--gemini-api-key`,cliOption:`--gemini-api-key <key>`,description:`Gemini API key`},{optionKey:`zaiApiKey`,authChoice:`zai-api-key`,cliFlag:`--zai-api-key`,cliOption:`--zai-api-key <key>`,description:`Z.AI API key`},{optionKey:`xiaomiApiKey`,authChoice:`xiaomi-api-key`,cliFlag:`--xiaomi-api-key`,cliOption:`--xiaomi-api-key <key>`,description:`Xiaomi API key`},{optionKey:`minimaxApiKey`,authChoice:`minimax-api`,cliFlag:`--minimax-api-key`,cliOption:`--minimax-api-key <key>`,description:`MiniMax API key`},{optionKey:`syntheticApiKey`,authChoice:`synthetic-api-key`,cliFlag:`--synthetic-api-key`,cliOption:`--synthetic-api-key <key>`,description:`Synthetic API key`},{optionKey:`veniceApiKey`,authChoice:`venice-api-key`,cliFlag:`--venice-api-key`,cliOption:`--venice-api-key <key>`,description:`Venice API key`},{optionKey:`togetherApiKey`,authChoice:`together-api-key`,cliFlag:`--together-api-key`,cliOption:`--together-api-key <key>`,description:`Together AI API key`},{optionKey:`huggingfaceApiKey`,authChoice:`huggingface-api-key`,cliFlag:`--huggingface-api-key`,cliOption:`--huggingface-api-key <key>`,description:`Hugging Face API key (HF token)`},{optionKey:`opencodeZenApiKey`,authChoice:`opencode-zen`,cliFlag:`--opencode-zen-api-key`,cliOption:`--opencode-zen-api-key <key>`,description:`OpenCode Zen API key`},{optionKey:`xaiApiKey`,authChoice:`xai-api-key`,cliFlag:`--xai-api-key`,cliOption:`--xai-api-key <key>`,description:`xAI API key`},{optionKey:`litellmApiKey`,authChoice:`litellm-api-key`,cliFlag:`--litellm-api-key`,cliOption:`--litellm-api-key <key>`,description:`LiteLLM API key`},{optionKey:`qianfanApiKey`,authChoice:`qianfan-api-key`,cliFlag:`--qianfan-api-key`,cliOption:`--qianfan-api-key <key>`,description:`QIANFAN API key`}];function hasStringValue(value){return typeof value==`string`?value.trim().length>0:!!value}function inferAuthChoiceFromFlags(opts){let matches=ONBOARD_PROVIDER_AUTH_FLAGS.filter(({optionKey})=>hasStringValue(opts[optionKey])).map(flag=>({optionKey:flag.optionKey,authChoice:flag.authChoice,label:flag.cliFlag}));return(hasStringValue(opts.customBaseUrl)||hasStringValue(opts.customModelId)||hasStringValue(opts.customApiKey))&&matches.push({optionKey:`customBaseUrl`,authChoice:`custom-api-key`,label:`--custom-base-url/--custom-model-id/--custom-api-key`}),{choice:matches[0]?.authChoice,matches}}async function resolveApiKeyFromProfiles(params){let store=await ensureAuthProfileStore(params.agentDir),order=resolveAuthProfileOrder({cfg:params.cfg,store,provider:params.provider});for(let profileId of order){if(store.profiles[profileId]?.type!==`api_key`)continue;let resolved=await resolveApiKeyForProfile({cfg:params.cfg,store,profileId,agentDir:params.agentDir});if(resolved?.apiKey)return resolved.apiKey}return null}async function resolveNonInteractiveApiKey(params){let flagKey=normalizeOptionalSecretInput(params.flagValue);if(flagKey)return{key:flagKey,source:`flag`};let envResolved=resolveEnvApiKey(params.provider);if(envResolved?.apiKey)return{key:envResolved.apiKey,source:`env`};let explicitEnvVar=params.envVarName?.trim();if(explicitEnvVar){let explicitEnvKey=normalizeOptionalSecretInput(process.env[explicitEnvVar]);if(explicitEnvKey)return{key:explicitEnvKey,source:`env`}}if(params.allowProfile??!0){let profileKey=await resolveApiKeyFromProfiles({provider:params.provider,cfg:params.cfg,agentDir:params.agentDir});if(profileKey)return{key:profileKey,source:`profile`}}if(params.required===!1)return null;let profileHint=params.allowProfile===!1?``:`, or existing ${params.provider} API-key profile`;return params.runtime.error(`Missing ${params.flagName} (or ${params.envVar} in env${profileHint}).`),params.runtime.exit(1),null}async function applyNonInteractiveAuthChoice(params){let{authChoice,opts,runtime,baseConfig}=params,nextConfig=params.nextConfig;if(authChoice===`claude-cli`||authChoice===`codex-cli`)return runtime.error([`Auth choice "${authChoice}" is deprecated.`,`Use "--auth-choice builderforcellm" (recommended default), "--auth-choice token" (Anthropic setup-token), or "--auth-choice openai-codex".`].join(`
1
+ import{u as resolveGatewayPort}from"./paths-5FcIFMsj.js";import{C as shortenHomePath,b as resolveUserPath}from"./utils-DbaBVFaK.js";import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import{Gt as resolveApiKeyForProfile,in as ensureAuthProfileStore,mn as normalizeSecretInput,nn as upsertAuthProfile,pn as normalizeOptionalSecretInput,u as normalizeProviderId,xt as resolveEnvApiKey,zt as resolveAuthProfileOrder}from"./model-selection-9bRFKBI_.js";import{t as formatCliCommand}from"./command-format-D806O2pt.js";import{a as upsertSharedEnvVar}from"./env-file-D1MDi-AM.js";import{a as readConfigFileSnapshot,c as writeConfigFile,y as parseDurationMs}from"./io-3R_ZyUxB.js";import{a as ensureWorkspaceAndSessions,b as waitForGatewayReachable,c as handleReset,g as resolveControlUiLinks,m as randomToken,n as applyWizardMetadata,t as DEFAULT_WORKSPACE}from"./onboard-helpers-Cf5dNq7-.js";import{t as assertSupportedRuntime}from"./runtime-guard-DhksRHci.js";import{a as gatewayInstallErrorHint,i as buildGatewayInstallPlan,r as isGatewayDaemonRuntime,t as DEFAULT_GATEWAY_DAEMON_RUNTIME}from"./daemon-runtime-CtOr1ncS.js";import{r as isSystemdUserServiceAvailable}from"./systemd-BG3_QT6W.js";import{t as resolveGatewayService}from"./service-D-NLDyK3.js";import{r as healthCommand}from"./health-yS3NRKvY.js";import{C as setXaiApiKey,S as setVercelAiGatewayApiKey,T as setZaiApiKey,_ as setOpenrouterApiKey,b as setTogetherApiKey,c as setAnthropicApiKey,d as setHuggingfaceApiKey,f as setKimiCodingApiKey,g as setOpencodeZenApiKey,h as setMoonshotApiKey,l as setCloudflareAiGatewayConfig,m as setMinimaxApiKey,p as setLitellmApiKey,u as setGeminiApiKey,v as setQianfanApiKey,w as setXiaomiApiKey,x as setVeniceApiKey,y as setSyntheticApiKey}from"./onboard-auth.credentials-BuT-etnE.js";import{A as applyXaiConfig,B as applyVercelAiGatewayConfig,E as applyTogetherConfig,H as applyAgentDefaultModelPrimary,I as applyLitellmConfig,M as applyXiaomiConfig,O as applyVeniceConfig,P as applyZaiConfig,R as applyCloudflareAiGatewayConfig,S as applyQianfanConfig,_ as applyMoonshotConfigCn,a as applyMinimaxApiConfig,b as applyOpenrouterConfig,d as applyAuthProfileConfig,f as applyHuggingfaceConfig,g as applyMoonshotConfig,l as applyMinimaxConfig,m as applyKimiCodeConfig,n as validateAnthropicSetupToken,o as applyMinimaxApiConfigCn,r as applyOpencodeZenConfig,t as buildTokenProfileId,w as applySyntheticConfig}from"./auth-token-CyVfNEQb.js";import{n as logConfigUpdated}from"./logging-DHa3jQN3.js";import{n as isDeprecatedAuthChoice,r as normalizeLegacyOnboardAuthChoice}from"./auth-choice-legacy-CqbQRfmW.js";import{i as detectZaiEndpoint,n as applyOpenAIConfig,o as applyGoogleGeminiModelDefault}from"./openai-model-default-Cp3nf21W.js";import{n as ensureSystemdUserLingerNonInteractive}from"./systemd-linger-CT-VHPB3.js";import{a as resolveCustomProviderId,n as applyCustomApiConfig,r as parseNonInteractiveCustomApiFlags,t as CustomApiError}from"./onboard-custom-C_BI0ZXn.js";import{t as runInteractiveOnboarding}from"./onboard-interactive-zgjmwJz-.js";import{t as applyOnboardingLocalWorkspaceConfig}from"./onboard-config-Kjacn8P6.js";const ONBOARD_PROVIDER_AUTH_FLAGS=[{optionKey:`anthropicApiKey`,authChoice:`apiKey`,cliFlag:`--anthropic-api-key`,cliOption:`--anthropic-api-key <key>`,description:`Anthropic API key`},{optionKey:`openaiApiKey`,authChoice:`openai-api-key`,cliFlag:`--openai-api-key`,cliOption:`--openai-api-key <key>`,description:`OpenAI API key`},{optionKey:`openrouterApiKey`,authChoice:`openrouter-api-key`,cliFlag:`--openrouter-api-key`,cliOption:`--openrouter-api-key <key>`,description:`OpenRouter API key`},{optionKey:`aiGatewayApiKey`,authChoice:`ai-gateway-api-key`,cliFlag:`--ai-gateway-api-key`,cliOption:`--ai-gateway-api-key <key>`,description:`Vercel AI Gateway API key`},{optionKey:`cloudflareAiGatewayApiKey`,authChoice:`cloudflare-ai-gateway-api-key`,cliFlag:`--cloudflare-ai-gateway-api-key`,cliOption:`--cloudflare-ai-gateway-api-key <key>`,description:`Cloudflare AI Gateway API key`},{optionKey:`moonshotApiKey`,authChoice:`moonshot-api-key`,cliFlag:`--moonshot-api-key`,cliOption:`--moonshot-api-key <key>`,description:`Moonshot API key`},{optionKey:`kimiCodeApiKey`,authChoice:`kimi-code-api-key`,cliFlag:`--kimi-code-api-key`,cliOption:`--kimi-code-api-key <key>`,description:`Kimi Coding API key`},{optionKey:`geminiApiKey`,authChoice:`gemini-api-key`,cliFlag:`--gemini-api-key`,cliOption:`--gemini-api-key <key>`,description:`Gemini API key`},{optionKey:`zaiApiKey`,authChoice:`zai-api-key`,cliFlag:`--zai-api-key`,cliOption:`--zai-api-key <key>`,description:`Z.AI API key`},{optionKey:`xiaomiApiKey`,authChoice:`xiaomi-api-key`,cliFlag:`--xiaomi-api-key`,cliOption:`--xiaomi-api-key <key>`,description:`Xiaomi API key`},{optionKey:`minimaxApiKey`,authChoice:`minimax-api`,cliFlag:`--minimax-api-key`,cliOption:`--minimax-api-key <key>`,description:`MiniMax API key`},{optionKey:`syntheticApiKey`,authChoice:`synthetic-api-key`,cliFlag:`--synthetic-api-key`,cliOption:`--synthetic-api-key <key>`,description:`Synthetic API key`},{optionKey:`veniceApiKey`,authChoice:`venice-api-key`,cliFlag:`--venice-api-key`,cliOption:`--venice-api-key <key>`,description:`Venice API key`},{optionKey:`togetherApiKey`,authChoice:`together-api-key`,cliFlag:`--together-api-key`,cliOption:`--together-api-key <key>`,description:`Together AI API key`},{optionKey:`huggingfaceApiKey`,authChoice:`huggingface-api-key`,cliFlag:`--huggingface-api-key`,cliOption:`--huggingface-api-key <key>`,description:`Hugging Face API key (HF token)`},{optionKey:`opencodeZenApiKey`,authChoice:`opencode-zen`,cliFlag:`--opencode-zen-api-key`,cliOption:`--opencode-zen-api-key <key>`,description:`OpenCode Zen API key`},{optionKey:`xaiApiKey`,authChoice:`xai-api-key`,cliFlag:`--xai-api-key`,cliOption:`--xai-api-key <key>`,description:`xAI API key`},{optionKey:`litellmApiKey`,authChoice:`litellm-api-key`,cliFlag:`--litellm-api-key`,cliOption:`--litellm-api-key <key>`,description:`LiteLLM API key`},{optionKey:`qianfanApiKey`,authChoice:`qianfan-api-key`,cliFlag:`--qianfan-api-key`,cliOption:`--qianfan-api-key <key>`,description:`QIANFAN API key`}];function hasStringValue(value){return typeof value==`string`?value.trim().length>0:!!value}function inferAuthChoiceFromFlags(opts){let matches=ONBOARD_PROVIDER_AUTH_FLAGS.filter(({optionKey})=>hasStringValue(opts[optionKey])).map(flag=>({optionKey:flag.optionKey,authChoice:flag.authChoice,label:flag.cliFlag}));return(hasStringValue(opts.customBaseUrl)||hasStringValue(opts.customModelId)||hasStringValue(opts.customApiKey))&&matches.push({optionKey:`customBaseUrl`,authChoice:`custom-api-key`,label:`--custom-base-url/--custom-model-id/--custom-api-key`}),{choice:matches[0]?.authChoice,matches}}async function resolveApiKeyFromProfiles(params){let store=await ensureAuthProfileStore(params.agentDir),order=resolveAuthProfileOrder({cfg:params.cfg,store,provider:params.provider});for(let profileId of order){if(store.profiles[profileId]?.type!==`api_key`)continue;let resolved=await resolveApiKeyForProfile({cfg:params.cfg,store,profileId,agentDir:params.agentDir});if(resolved?.apiKey)return resolved.apiKey}return null}async function resolveNonInteractiveApiKey(params){let flagKey=normalizeOptionalSecretInput(params.flagValue);if(flagKey)return{key:flagKey,source:`flag`};let envResolved=resolveEnvApiKey(params.provider);if(envResolved?.apiKey)return{key:envResolved.apiKey,source:`env`};let explicitEnvVar=params.envVarName?.trim();if(explicitEnvVar){let explicitEnvKey=normalizeOptionalSecretInput(process.env[explicitEnvVar]);if(explicitEnvKey)return{key:explicitEnvKey,source:`env`}}if(params.allowProfile??!0){let profileKey=await resolveApiKeyFromProfiles({provider:params.provider,cfg:params.cfg,agentDir:params.agentDir});if(profileKey)return{key:profileKey,source:`profile`}}if(params.required===!1)return null;let profileHint=params.allowProfile===!1?``:`, or existing ${params.provider} API-key profile`;return params.runtime.error(`Missing ${params.flagName} (or ${params.envVar} in env${profileHint}).`),params.runtime.exit(1),null}async function applyNonInteractiveAuthChoice(params){let{authChoice,opts,runtime,baseConfig}=params,nextConfig=params.nextConfig;if(authChoice===`claude-cli`||authChoice===`codex-cli`)return runtime.error([`Auth choice "${authChoice}" is deprecated.`,`Use "--auth-choice builderforcellm" (recommended default), "--auth-choice token" (Anthropic setup-token), or "--auth-choice openai-codex".`].join(`
2
2
  `)),runtime.exit(1),null;if(authChoice===`setup-token`)return runtime.error([`Auth choice "setup-token" requires interactive mode.`,`Use "--auth-choice token" with --token and --token-provider anthropic.`].join(`
3
3
  `)),runtime.exit(1),null;if(authChoice===`local`)return runtime.error([`Auth choice "local" requires interactive mode.`,`Use interactive onboard/configure for guided local Ollama or llama.cpp/vLLM setup.`].join(`
4
4
  `)),runtime.exit(1),null;if(authChoice===`vllm`)return runtime.error([`Auth choice "vllm" requires interactive mode.`,`Use interactive onboard/configure to enter base URL, API key, and model ID.`].join(`
@@ -1,4 +1,4 @@
1
- import{u as resolveGatewayPort}from"./paths-BHg-VHB4.js";import{S as shortenHomePath,y as resolveUserPath}from"./utils-BP60e80M.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import{Qt as normalizeSecretInput,R as normalizeProviderId,Yt as resolveEnvApiKey,Zt as normalizeOptionalSecretInput,b as ensureAuthProfileStore,s as resolveApiKeyForProfile,t as resolveAuthProfileOrder,v as upsertAuthProfile}from"./auth-profiles-C1VbcUOm.js";import{t as formatCliCommand}from"./command-format-DTMaGKs7.js";import{a as upsertSharedEnvVar}from"./env-file-DeS6x2OL.js";import{a as readConfigFileSnapshot,c as writeConfigFile,y as parseDurationMs}from"./io-CohJffHG.js";import{a as ensureWorkspaceAndSessions,b as waitForGatewayReachable,c as handleReset,g as resolveControlUiLinks,m as randomToken,n as applyWizardMetadata,t as DEFAULT_WORKSPACE}from"./onboard-helpers-CckrS8_K.js";import{a as gatewayInstallErrorHint,i as buildGatewayInstallPlan,r as isGatewayDaemonRuntime,t as DEFAULT_GATEWAY_DAEMON_RUNTIME}from"./daemon-runtime-B4UjqdyJ.js";import{t as assertSupportedRuntime}from"./runtime-guard-Bi8k55v9.js";import{r as isSystemdUserServiceAvailable}from"./systemd-DdVd5Yet.js";import{t as resolveGatewayService}from"./service-EKJG69M3.js";import{r as healthCommand}from"./health-DVo8a9yg.js";import{C as setXaiApiKey,S as setVercelAiGatewayApiKey,T as setZaiApiKey,_ as setOpenrouterApiKey,b as setTogetherApiKey,c as setAnthropicApiKey,d as setHuggingfaceApiKey,f as setKimiCodingApiKey,g as setOpencodeZenApiKey,h as setMoonshotApiKey,l as setCloudflareAiGatewayConfig,m as setMinimaxApiKey,p as setLitellmApiKey,u as setGeminiApiKey,v as setQianfanApiKey,w as setXiaomiApiKey,x as setVeniceApiKey,y as setSyntheticApiKey}from"./onboard-auth.credentials-yagR-VMG.js";import{A as applyXaiConfig,B as applyVercelAiGatewayConfig,E as applyTogetherConfig,H as applyAgentDefaultModelPrimary,I as applyLitellmConfig,M as applyXiaomiConfig,O as applyVeniceConfig,P as applyZaiConfig,R as applyCloudflareAiGatewayConfig,S as applyQianfanConfig,_ as applyMoonshotConfigCn,a as applyMinimaxApiConfig,b as applyOpenrouterConfig,d as applyAuthProfileConfig,f as applyHuggingfaceConfig,g as applyMoonshotConfig,l as applyMinimaxConfig,m as applyKimiCodeConfig,n as validateAnthropicSetupToken,o as applyMinimaxApiConfigCn,r as applyOpencodeZenConfig,t as buildTokenProfileId,w as applySyntheticConfig}from"./auth-token-CoQ5ePPl.js";import{n as logConfigUpdated}from"./logging-ayt7F7vy.js";import{n as isDeprecatedAuthChoice,r as normalizeLegacyOnboardAuthChoice}from"./auth-choice-legacy-CgUsZOdE.js";import{i as detectZaiEndpoint,n as applyOpenAIConfig,o as applyGoogleGeminiModelDefault}from"./openai-model-default-BMRrqTmH.js";import{n as ensureSystemdUserLingerNonInteractive}from"./systemd-linger-CPKngdUf.js";import{a as resolveCustomProviderId,n as applyCustomApiConfig,r as parseNonInteractiveCustomApiFlags,t as CustomApiError}from"./onboard-custom-D1nd8Hlu.js";import{t as runInteractiveOnboarding}from"./onboard-interactive-DqpGicxB.js";import{t as applyOnboardingLocalWorkspaceConfig}from"./onboard-config-BUzUtfP0.js";const ONBOARD_PROVIDER_AUTH_FLAGS=[{optionKey:`anthropicApiKey`,authChoice:`apiKey`,cliFlag:`--anthropic-api-key`,cliOption:`--anthropic-api-key <key>`,description:`Anthropic API key`},{optionKey:`openaiApiKey`,authChoice:`openai-api-key`,cliFlag:`--openai-api-key`,cliOption:`--openai-api-key <key>`,description:`OpenAI API key`},{optionKey:`openrouterApiKey`,authChoice:`openrouter-api-key`,cliFlag:`--openrouter-api-key`,cliOption:`--openrouter-api-key <key>`,description:`OpenRouter API key`},{optionKey:`aiGatewayApiKey`,authChoice:`ai-gateway-api-key`,cliFlag:`--ai-gateway-api-key`,cliOption:`--ai-gateway-api-key <key>`,description:`Vercel AI Gateway API key`},{optionKey:`cloudflareAiGatewayApiKey`,authChoice:`cloudflare-ai-gateway-api-key`,cliFlag:`--cloudflare-ai-gateway-api-key`,cliOption:`--cloudflare-ai-gateway-api-key <key>`,description:`Cloudflare AI Gateway API key`},{optionKey:`moonshotApiKey`,authChoice:`moonshot-api-key`,cliFlag:`--moonshot-api-key`,cliOption:`--moonshot-api-key <key>`,description:`Moonshot API key`},{optionKey:`kimiCodeApiKey`,authChoice:`kimi-code-api-key`,cliFlag:`--kimi-code-api-key`,cliOption:`--kimi-code-api-key <key>`,description:`Kimi Coding API key`},{optionKey:`geminiApiKey`,authChoice:`gemini-api-key`,cliFlag:`--gemini-api-key`,cliOption:`--gemini-api-key <key>`,description:`Gemini API key`},{optionKey:`zaiApiKey`,authChoice:`zai-api-key`,cliFlag:`--zai-api-key`,cliOption:`--zai-api-key <key>`,description:`Z.AI API key`},{optionKey:`xiaomiApiKey`,authChoice:`xiaomi-api-key`,cliFlag:`--xiaomi-api-key`,cliOption:`--xiaomi-api-key <key>`,description:`Xiaomi API key`},{optionKey:`minimaxApiKey`,authChoice:`minimax-api`,cliFlag:`--minimax-api-key`,cliOption:`--minimax-api-key <key>`,description:`MiniMax API key`},{optionKey:`syntheticApiKey`,authChoice:`synthetic-api-key`,cliFlag:`--synthetic-api-key`,cliOption:`--synthetic-api-key <key>`,description:`Synthetic API key`},{optionKey:`veniceApiKey`,authChoice:`venice-api-key`,cliFlag:`--venice-api-key`,cliOption:`--venice-api-key <key>`,description:`Venice API key`},{optionKey:`togetherApiKey`,authChoice:`together-api-key`,cliFlag:`--together-api-key`,cliOption:`--together-api-key <key>`,description:`Together AI API key`},{optionKey:`huggingfaceApiKey`,authChoice:`huggingface-api-key`,cliFlag:`--huggingface-api-key`,cliOption:`--huggingface-api-key <key>`,description:`Hugging Face API key (HF token)`},{optionKey:`opencodeZenApiKey`,authChoice:`opencode-zen`,cliFlag:`--opencode-zen-api-key`,cliOption:`--opencode-zen-api-key <key>`,description:`OpenCode Zen API key`},{optionKey:`xaiApiKey`,authChoice:`xai-api-key`,cliFlag:`--xai-api-key`,cliOption:`--xai-api-key <key>`,description:`xAI API key`},{optionKey:`litellmApiKey`,authChoice:`litellm-api-key`,cliFlag:`--litellm-api-key`,cliOption:`--litellm-api-key <key>`,description:`LiteLLM API key`},{optionKey:`qianfanApiKey`,authChoice:`qianfan-api-key`,cliFlag:`--qianfan-api-key`,cliOption:`--qianfan-api-key <key>`,description:`QIANFAN API key`}];function hasStringValue(value){return typeof value==`string`?value.trim().length>0:!!value}function inferAuthChoiceFromFlags(opts){let matches=ONBOARD_PROVIDER_AUTH_FLAGS.filter(({optionKey})=>hasStringValue(opts[optionKey])).map(flag=>({optionKey:flag.optionKey,authChoice:flag.authChoice,label:flag.cliFlag}));return(hasStringValue(opts.customBaseUrl)||hasStringValue(opts.customModelId)||hasStringValue(opts.customApiKey))&&matches.push({optionKey:`customBaseUrl`,authChoice:`custom-api-key`,label:`--custom-base-url/--custom-model-id/--custom-api-key`}),{choice:matches[0]?.authChoice,matches}}async function resolveApiKeyFromProfiles(params){let store=await ensureAuthProfileStore(params.agentDir),order=resolveAuthProfileOrder({cfg:params.cfg,store,provider:params.provider});for(let profileId of order){if(store.profiles[profileId]?.type!==`api_key`)continue;let resolved=await resolveApiKeyForProfile({cfg:params.cfg,store,profileId,agentDir:params.agentDir});if(resolved?.apiKey)return resolved.apiKey}return null}async function resolveNonInteractiveApiKey(params){let flagKey=normalizeOptionalSecretInput(params.flagValue);if(flagKey)return{key:flagKey,source:`flag`};let envResolved=resolveEnvApiKey(params.provider);if(envResolved?.apiKey)return{key:envResolved.apiKey,source:`env`};let explicitEnvVar=params.envVarName?.trim();if(explicitEnvVar){let explicitEnvKey=normalizeOptionalSecretInput(process.env[explicitEnvVar]);if(explicitEnvKey)return{key:explicitEnvKey,source:`env`}}if(params.allowProfile??!0){let profileKey=await resolveApiKeyFromProfiles({provider:params.provider,cfg:params.cfg,agentDir:params.agentDir});if(profileKey)return{key:profileKey,source:`profile`}}if(params.required===!1)return null;let profileHint=params.allowProfile===!1?``:`, or existing ${params.provider} API-key profile`;return params.runtime.error(`Missing ${params.flagName} (or ${params.envVar} in env${profileHint}).`),params.runtime.exit(1),null}async function applyNonInteractiveAuthChoice(params){let{authChoice,opts,runtime,baseConfig}=params,nextConfig=params.nextConfig;if(authChoice===`claude-cli`||authChoice===`codex-cli`)return runtime.error([`Auth choice "${authChoice}" is deprecated.`,`Use "--auth-choice builderforcellm" (recommended default), "--auth-choice token" (Anthropic setup-token), or "--auth-choice openai-codex".`].join(`
1
+ import{u as resolveGatewayPort}from"./paths-BHg-VHB4.js";import{S as shortenHomePath,y as resolveUserPath}from"./utils-BP60e80M.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import{Qt as normalizeSecretInput,R as normalizeProviderId,Yt as resolveEnvApiKey,Zt as normalizeOptionalSecretInput,b as ensureAuthProfileStore,s as resolveApiKeyForProfile,t as resolveAuthProfileOrder,v as upsertAuthProfile}from"./auth-profiles-C1VbcUOm.js";import{t as formatCliCommand}from"./command-format-DTMaGKs7.js";import{a as upsertSharedEnvVar}from"./env-file-DeS6x2OL.js";import{a as readConfigFileSnapshot,c as writeConfigFile,y as parseDurationMs}from"./io-CohJffHG.js";import{a as ensureWorkspaceAndSessions,b as waitForGatewayReachable,c as handleReset,g as resolveControlUiLinks,m as randomToken,n as applyWizardMetadata,t as DEFAULT_WORKSPACE}from"./onboard-helpers-CckrS8_K.js";import{a as gatewayInstallErrorHint,i as buildGatewayInstallPlan,r as isGatewayDaemonRuntime,t as DEFAULT_GATEWAY_DAEMON_RUNTIME}from"./daemon-runtime-B4UjqdyJ.js";import{t as assertSupportedRuntime}from"./runtime-guard-Bi8k55v9.js";import{r as isSystemdUserServiceAvailable}from"./systemd-DdVd5Yet.js";import{t as resolveGatewayService}from"./service-EKJG69M3.js";import{r as healthCommand}from"./health-DVo8a9yg.js";import{C as setXaiApiKey,S as setVercelAiGatewayApiKey,T as setZaiApiKey,_ as setOpenrouterApiKey,b as setTogetherApiKey,c as setAnthropicApiKey,d as setHuggingfaceApiKey,f as setKimiCodingApiKey,g as setOpencodeZenApiKey,h as setMoonshotApiKey,l as setCloudflareAiGatewayConfig,m as setMinimaxApiKey,p as setLitellmApiKey,u as setGeminiApiKey,v as setQianfanApiKey,w as setXiaomiApiKey,x as setVeniceApiKey,y as setSyntheticApiKey}from"./onboard-auth.credentials-yagR-VMG.js";import{A as applyXaiConfig,B as applyVercelAiGatewayConfig,E as applyTogetherConfig,H as applyAgentDefaultModelPrimary,I as applyLitellmConfig,M as applyXiaomiConfig,O as applyVeniceConfig,P as applyZaiConfig,R as applyCloudflareAiGatewayConfig,S as applyQianfanConfig,_ as applyMoonshotConfigCn,a as applyMinimaxApiConfig,b as applyOpenrouterConfig,d as applyAuthProfileConfig,f as applyHuggingfaceConfig,g as applyMoonshotConfig,l as applyMinimaxConfig,m as applyKimiCodeConfig,n as validateAnthropicSetupToken,o as applyMinimaxApiConfigCn,r as applyOpencodeZenConfig,t as buildTokenProfileId,w as applySyntheticConfig}from"./auth-token-CoQ5ePPl.js";import{n as logConfigUpdated}from"./logging-ayt7F7vy.js";import{n as isDeprecatedAuthChoice,r as normalizeLegacyOnboardAuthChoice}from"./auth-choice-legacy-CgUsZOdE.js";import{i as detectZaiEndpoint,n as applyOpenAIConfig,o as applyGoogleGeminiModelDefault}from"./openai-model-default-BMRrqTmH.js";import{n as ensureSystemdUserLingerNonInteractive}from"./systemd-linger-CPKngdUf.js";import{a as resolveCustomProviderId,n as applyCustomApiConfig,r as parseNonInteractiveCustomApiFlags,t as CustomApiError}from"./onboard-custom-D1nd8Hlu.js";import{t as runInteractiveOnboarding}from"./onboard-interactive-DYJttZ2w.js";import{t as applyOnboardingLocalWorkspaceConfig}from"./onboard-config-BUzUtfP0.js";const ONBOARD_PROVIDER_AUTH_FLAGS=[{optionKey:`anthropicApiKey`,authChoice:`apiKey`,cliFlag:`--anthropic-api-key`,cliOption:`--anthropic-api-key <key>`,description:`Anthropic API key`},{optionKey:`openaiApiKey`,authChoice:`openai-api-key`,cliFlag:`--openai-api-key`,cliOption:`--openai-api-key <key>`,description:`OpenAI API key`},{optionKey:`openrouterApiKey`,authChoice:`openrouter-api-key`,cliFlag:`--openrouter-api-key`,cliOption:`--openrouter-api-key <key>`,description:`OpenRouter API key`},{optionKey:`aiGatewayApiKey`,authChoice:`ai-gateway-api-key`,cliFlag:`--ai-gateway-api-key`,cliOption:`--ai-gateway-api-key <key>`,description:`Vercel AI Gateway API key`},{optionKey:`cloudflareAiGatewayApiKey`,authChoice:`cloudflare-ai-gateway-api-key`,cliFlag:`--cloudflare-ai-gateway-api-key`,cliOption:`--cloudflare-ai-gateway-api-key <key>`,description:`Cloudflare AI Gateway API key`},{optionKey:`moonshotApiKey`,authChoice:`moonshot-api-key`,cliFlag:`--moonshot-api-key`,cliOption:`--moonshot-api-key <key>`,description:`Moonshot API key`},{optionKey:`kimiCodeApiKey`,authChoice:`kimi-code-api-key`,cliFlag:`--kimi-code-api-key`,cliOption:`--kimi-code-api-key <key>`,description:`Kimi Coding API key`},{optionKey:`geminiApiKey`,authChoice:`gemini-api-key`,cliFlag:`--gemini-api-key`,cliOption:`--gemini-api-key <key>`,description:`Gemini API key`},{optionKey:`zaiApiKey`,authChoice:`zai-api-key`,cliFlag:`--zai-api-key`,cliOption:`--zai-api-key <key>`,description:`Z.AI API key`},{optionKey:`xiaomiApiKey`,authChoice:`xiaomi-api-key`,cliFlag:`--xiaomi-api-key`,cliOption:`--xiaomi-api-key <key>`,description:`Xiaomi API key`},{optionKey:`minimaxApiKey`,authChoice:`minimax-api`,cliFlag:`--minimax-api-key`,cliOption:`--minimax-api-key <key>`,description:`MiniMax API key`},{optionKey:`syntheticApiKey`,authChoice:`synthetic-api-key`,cliFlag:`--synthetic-api-key`,cliOption:`--synthetic-api-key <key>`,description:`Synthetic API key`},{optionKey:`veniceApiKey`,authChoice:`venice-api-key`,cliFlag:`--venice-api-key`,cliOption:`--venice-api-key <key>`,description:`Venice API key`},{optionKey:`togetherApiKey`,authChoice:`together-api-key`,cliFlag:`--together-api-key`,cliOption:`--together-api-key <key>`,description:`Together AI API key`},{optionKey:`huggingfaceApiKey`,authChoice:`huggingface-api-key`,cliFlag:`--huggingface-api-key`,cliOption:`--huggingface-api-key <key>`,description:`Hugging Face API key (HF token)`},{optionKey:`opencodeZenApiKey`,authChoice:`opencode-zen`,cliFlag:`--opencode-zen-api-key`,cliOption:`--opencode-zen-api-key <key>`,description:`OpenCode Zen API key`},{optionKey:`xaiApiKey`,authChoice:`xai-api-key`,cliFlag:`--xai-api-key`,cliOption:`--xai-api-key <key>`,description:`xAI API key`},{optionKey:`litellmApiKey`,authChoice:`litellm-api-key`,cliFlag:`--litellm-api-key`,cliOption:`--litellm-api-key <key>`,description:`LiteLLM API key`},{optionKey:`qianfanApiKey`,authChoice:`qianfan-api-key`,cliFlag:`--qianfan-api-key`,cliOption:`--qianfan-api-key <key>`,description:`QIANFAN API key`}];function hasStringValue(value){return typeof value==`string`?value.trim().length>0:!!value}function inferAuthChoiceFromFlags(opts){let matches=ONBOARD_PROVIDER_AUTH_FLAGS.filter(({optionKey})=>hasStringValue(opts[optionKey])).map(flag=>({optionKey:flag.optionKey,authChoice:flag.authChoice,label:flag.cliFlag}));return(hasStringValue(opts.customBaseUrl)||hasStringValue(opts.customModelId)||hasStringValue(opts.customApiKey))&&matches.push({optionKey:`customBaseUrl`,authChoice:`custom-api-key`,label:`--custom-base-url/--custom-model-id/--custom-api-key`}),{choice:matches[0]?.authChoice,matches}}async function resolveApiKeyFromProfiles(params){let store=await ensureAuthProfileStore(params.agentDir),order=resolveAuthProfileOrder({cfg:params.cfg,store,provider:params.provider});for(let profileId of order){if(store.profiles[profileId]?.type!==`api_key`)continue;let resolved=await resolveApiKeyForProfile({cfg:params.cfg,store,profileId,agentDir:params.agentDir});if(resolved?.apiKey)return resolved.apiKey}return null}async function resolveNonInteractiveApiKey(params){let flagKey=normalizeOptionalSecretInput(params.flagValue);if(flagKey)return{key:flagKey,source:`flag`};let envResolved=resolveEnvApiKey(params.provider);if(envResolved?.apiKey)return{key:envResolved.apiKey,source:`env`};let explicitEnvVar=params.envVarName?.trim();if(explicitEnvVar){let explicitEnvKey=normalizeOptionalSecretInput(process.env[explicitEnvVar]);if(explicitEnvKey)return{key:explicitEnvKey,source:`env`}}if(params.allowProfile??!0){let profileKey=await resolveApiKeyFromProfiles({provider:params.provider,cfg:params.cfg,agentDir:params.agentDir});if(profileKey)return{key:profileKey,source:`profile`}}if(params.required===!1)return null;let profileHint=params.allowProfile===!1?``:`, or existing ${params.provider} API-key profile`;return params.runtime.error(`Missing ${params.flagName} (or ${params.envVar} in env${profileHint}).`),params.runtime.exit(1),null}async function applyNonInteractiveAuthChoice(params){let{authChoice,opts,runtime,baseConfig}=params,nextConfig=params.nextConfig;if(authChoice===`claude-cli`||authChoice===`codex-cli`)return runtime.error([`Auth choice "${authChoice}" is deprecated.`,`Use "--auth-choice builderforcellm" (recommended default), "--auth-choice token" (Anthropic setup-token), or "--auth-choice openai-codex".`].join(`
2
2
  `)),runtime.exit(1),null;if(authChoice===`setup-token`)return runtime.error([`Auth choice "setup-token" requires interactive mode.`,`Use "--auth-choice token" with --token and --token-provider anthropic.`].join(`
3
3
  `)),runtime.exit(1),null;if(authChoice===`local`)return runtime.error([`Auth choice "local" requires interactive mode.`,`Use interactive onboard/configure for guided local Ollama or llama.cpp/vLLM setup.`].join(`
4
4
  `)),runtime.exit(1),null;if(authChoice===`vllm`)return runtime.error([`Auth choice "vllm" requires interactive mode.`,`Use interactive onboard/configure to enter base URL, API key, and model ID.`].join(`
@@ -1 +1 @@
1
- import"./paths-5FcIFMsj.js";import"./utils-DbaBVFaK.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import"./subsystem-B3TqcCrZ.js";import"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import"./agent-scope-DPtjOxzp.js";import"./src-CA0fU67C.js";import"./model-selection-9bRFKBI_.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import"./env-BIdU5BAp.js";import"./src-DTFqOIQD.js";import"./io-3R_ZyUxB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-_1Ca6jGb.js";import"./progress-BfOtdN6b.js";import"./prompt-style-BpVK43GK.js";import"./note-B6NtFdXt.js";import"./clack-prompter-Dg23_riR.js";import"./onboarding-hPRXZReM.js";import{t as runInteractiveOnboarding}from"./onboard-interactive-Gl5J4kVC.js";export{runInteractiveOnboarding};
1
+ import"./paths-5FcIFMsj.js";import"./utils-DbaBVFaK.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import"./subsystem-B3TqcCrZ.js";import"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import"./agent-scope-DPtjOxzp.js";import"./src-CA0fU67C.js";import"./model-selection-9bRFKBI_.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import"./env-BIdU5BAp.js";import"./src-DTFqOIQD.js";import"./io-3R_ZyUxB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-_1Ca6jGb.js";import"./progress-BfOtdN6b.js";import"./prompt-style-BpVK43GK.js";import"./note-B6NtFdXt.js";import"./clack-prompter-Dg23_riR.js";import"./onboarding-D4-HDbmU.js";import{t as runInteractiveOnboarding}from"./onboard-interactive-zgjmwJz-.js";export{runInteractiveOnboarding};
@@ -1 +1 @@
1
- import{t as restoreTerminalState}from"./restore-BdB4wlsZ.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import{t as WizardCancelledError}from"./prompts-BP4e56X_.js";import{t as createClackPrompter}from"./clack-prompter-B52CP7eY.js";import{t as runOnboardingWizard}from"./onboarding-Ctq_bdkC.js";async function runInteractiveOnboarding(opts,runtime=defaultRuntime){let prompter=createClackPrompter(),exitCode=null;try{await runOnboardingWizard(opts,runtime,prompter)}catch(err){if(err instanceof WizardCancelledError){exitCode=1;return}throw err}finally{restoreTerminalState(`onboarding finish`,{resumeStdinIfPaused:!1}),exitCode!==null&&runtime.exit(exitCode)}}export{runInteractiveOnboarding as t};
1
+ import{t as restoreTerminalState}from"./restore-BdB4wlsZ.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import{t as WizardCancelledError}from"./prompts-BP4e56X_.js";import{t as createClackPrompter}from"./clack-prompter-B52CP7eY.js";import{t as runOnboardingWizard}from"./onboarding-CP9rrz8y.js";async function runInteractiveOnboarding(opts,runtime=defaultRuntime){let prompter=createClackPrompter(),exitCode=null;try{await runOnboardingWizard(opts,runtime,prompter)}catch(err){if(err instanceof WizardCancelledError){exitCode=1;return}throw err}finally{restoreTerminalState(`onboarding finish`,{resumeStdinIfPaused:!1}),exitCode!==null&&runtime.exit(exitCode)}}export{runInteractiveOnboarding as t};
@@ -1 +1 @@
1
- import"./paths-BHg-VHB4.js";import"./registry-Cv7CoWAs.js";import"./utils-BP60e80M.js";import"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import"./env-BoE8QSib.js";import"./auth-profiles-C1VbcUOm.js";import"./src-DvWaTze9.js";import"./logger-wuOr7HKl.js";import"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-HrLX5bhG.js";import"./io-CohJffHG.js";import"./manifest-registry-009gLJ4l.js";import"./config-toczWD3q.js";import"./progress-Cqb-jAjT.js";import"./prompt-style-BMWmaqSC.js";import"./note-DgDXuE0F.js";import"./clack-prompter-B52CP7eY.js";import"./onboarding-Ctq_bdkC.js";import{t as runInteractiveOnboarding}from"./onboard-interactive-DqpGicxB.js";export{runInteractiveOnboarding};
1
+ import"./paths-BHg-VHB4.js";import"./registry-Cv7CoWAs.js";import"./utils-BP60e80M.js";import"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import"./env-BoE8QSib.js";import"./auth-profiles-C1VbcUOm.js";import"./src-DvWaTze9.js";import"./logger-wuOr7HKl.js";import"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-HrLX5bhG.js";import"./io-CohJffHG.js";import"./manifest-registry-009gLJ4l.js";import"./config-toczWD3q.js";import"./progress-Cqb-jAjT.js";import"./prompt-style-BMWmaqSC.js";import"./note-DgDXuE0F.js";import"./clack-prompter-B52CP7eY.js";import"./onboarding-CP9rrz8y.js";import{t as runInteractiveOnboarding}from"./onboard-interactive-DYJttZ2w.js";export{runInteractiveOnboarding};
@@ -1 +1 @@
1
- import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import{t as restoreTerminalState}from"./restore-gPan2ZAn.js";import{t as WizardCancelledError}from"./prompts-Bchzq3K0.js";import{t as createClackPrompter}from"./clack-prompter-Dg23_riR.js";import{t as runOnboardingWizard}from"./onboarding-hPRXZReM.js";async function runInteractiveOnboarding(opts,runtime=defaultRuntime){let prompter=createClackPrompter(),exitCode=null;try{await runOnboardingWizard(opts,runtime,prompter)}catch(err){if(err instanceof WizardCancelledError){exitCode=1;return}throw err}finally{restoreTerminalState(`onboarding finish`,{resumeStdinIfPaused:!1}),exitCode!==null&&runtime.exit(exitCode)}}export{runInteractiveOnboarding as t};
1
+ import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import{t as restoreTerminalState}from"./restore-gPan2ZAn.js";import{t as WizardCancelledError}from"./prompts-Bchzq3K0.js";import{t as createClackPrompter}from"./clack-prompter-Dg23_riR.js";import{t as runOnboardingWizard}from"./onboarding-D4-HDbmU.js";async function runInteractiveOnboarding(opts,runtime=defaultRuntime){let prompter=createClackPrompter(),exitCode=null;try{await runOnboardingWizard(opts,runtime,prompter)}catch(err){if(err instanceof WizardCancelledError){exitCode=1;return}throw err}finally{restoreTerminalState(`onboarding finish`,{resumeStdinIfPaused:!1}),exitCode!==null&&runtime.exit(exitCode)}}export{runInteractiveOnboarding as t};
@@ -4,4 +4,4 @@ import{n as DEFAULT_GATEWAY_PORT,u as resolveGatewayPort}from"./paths-BHg-VHB4.j
4
4
  (↑/↓ to select, Enter to confirm)`,options:[{value:`keep`,label:`Use existing values`},{value:`modify`,label:`Update values`},{value:`reset`,label:`Reset`}],initialValue:`keep`});if(configHandlingAction=action,action===`reset`){let workspaceDefault=baseConfig.agents?.defaults?.workspace??onboardHelpers.DEFAULT_WORKSPACE,resetScope=await prompter.select({message:`Reset scope`,options:[{value:`config`,label:`Config only`},{value:`config+creds+sessions`,label:`Config + creds + sessions`},{value:`full`,label:`Full reset (config + creds + sessions + workspace)`}]});await onboardHelpers.handleReset(resetScope,resolveUserPath(workspaceDefault),runtime),baseConfig={}}}let keepExistingValues=configHandlingAction===`keep`,quickstartGateway=(()=>{let hasExisting=typeof baseConfig.gateway?.port==`number`||baseConfig.gateway?.bind!==void 0||baseConfig.gateway?.auth?.mode!==void 0||baseConfig.gateway?.auth?.token!==void 0||baseConfig.gateway?.auth?.password!==void 0||baseConfig.gateway?.customBindHost!==void 0||baseConfig.gateway?.tailscale?.mode!==void 0,bindRaw=baseConfig.gateway?.bind,bind=bindRaw===`loopback`||bindRaw===`lan`||bindRaw===`auto`||bindRaw===`custom`||bindRaw===`tailnet`?bindRaw:`loopback`,authMode=`token`;baseConfig.gateway?.auth?.mode===`token`||baseConfig.gateway?.auth?.mode===`password`?authMode=baseConfig.gateway.auth.mode:baseConfig.gateway?.auth?.token?authMode=`token`:baseConfig.gateway?.auth?.password&&(authMode=`password`);let tailscaleRaw=baseConfig.gateway?.tailscale?.mode,tailscaleMode=tailscaleRaw===`off`||tailscaleRaw===`serve`||tailscaleRaw===`funnel`?tailscaleRaw:`off`;return{hasExisting,port:resolveGatewayPort(baseConfig),bind,authMode,tailscaleMode,token:baseConfig.gateway?.auth?.token,password:baseConfig.gateway?.auth?.password,customBindHost:baseConfig.gateway?.customBindHost,tailscaleResetOnExit:baseConfig.gateway?.tailscale?.resetOnExit??!1}})();if(flow===`quickstart`){let formatBind=value=>value===`loopback`?`Loopback (127.0.0.1)`:value===`lan`?`LAN`:value===`custom`?`Custom IP`:value===`tailnet`?`Tailnet (Tailscale IP)`:`Auto`,formatAuth=value=>value===`token`?`Token (default)`:`Password`,formatTailscale=value=>value===`off`?`Off`:value===`serve`?`Serve`:`Funnel`,quickstartLines=quickstartGateway.hasExisting?[`Keeping your current gateway settings:`,`Gateway port: ${quickstartGateway.port}`,`Gateway bind: ${formatBind(quickstartGateway.bind)}`,...quickstartGateway.bind===`custom`&&quickstartGateway.customBindHost?[`Gateway custom IP: ${quickstartGateway.customBindHost}`]:[],`Gateway auth: ${formatAuth(quickstartGateway.authMode)}`,`Tailscale exposure: ${formatTailscale(quickstartGateway.tailscaleMode)}`,`Direct to chat channels.`]:[`Gateway port: ${DEFAULT_GATEWAY_PORT}`,`Gateway bind: Loopback (127.0.0.1)`,`Gateway auth: Token (default)`,`Tailscale exposure: Off`,`Direct to chat channels.`];await prompter.note(quickstartLines.join(`
5
5
  `),`QuickStart`)}let localPort=resolveGatewayPort(baseConfig),localUrl=`ws://127.0.0.1:${localPort}`,localProbe=await onboardHelpers.probeGatewayReachable({url:localUrl,token:baseConfig.gateway?.auth?.token??process.env.BUILDERFORCE_AGENTS_GATEWAY_TOKEN,password:baseConfig.gateway?.auth?.password??process.env.BUILDERFORCE_AGENTS_GATEWAY_PASSWORD}),remoteUrl=baseConfig.gateway?.remote?.url?.trim()??``,remoteProbe=remoteUrl?await onboardHelpers.probeGatewayReachable({url:remoteUrl,token:baseConfig.gateway?.remote?.token}):null,mode=opts.mode??(flow===`quickstart`?`local`:await prompter.select({message:`What do you want to set up?`,options:[{value:`local`,label:`Local gateway (this machine)`,hint:localProbe.ok?`Gateway reachable (${localUrl})`:`No gateway detected (${localUrl})`},{value:`remote`,label:`Remote gateway (info-only)`,hint:remoteUrl?remoteProbe?.ok?`Gateway reachable (${remoteUrl})`:`Configured but unreachable (${remoteUrl})`:`No remote URL configured yet`}]}));if(mode===`remote`){let{promptRemoteGatewayConfig}=await import(`./onboard-remote-CzzQMZ3X.js`),{logConfigUpdated}=await import(`./logging-DSIJukIo.js`),nextConfig=await promptRemoteGatewayConfig(baseConfig,prompter);nextConfig=onboardHelpers.applyWizardMetadata(nextConfig,{command:`onboard`,mode}),await writeConfigFile(nextConfig),logConfigUpdated(runtime),await prompter.outro(`Remote gateway configured.`);return}let existingWorkspace=baseConfig.agents?.defaults?.workspace??onboardHelpers.DEFAULT_WORKSPACE,workspaceDir=resolveUserPath((opts.workspace??(flow===`quickstart`||keepExistingValues?existingWorkspace:await prompter.text({message:`Workspace directory`,initialValue:existingWorkspace}))).trim()||onboardHelpers.DEFAULT_WORKSPACE),{applyOnboardingLocalWorkspaceConfig}=await import(`./onboard-config-C-P0yFzv.js`),nextConfig=applyOnboardingLocalWorkspaceConfig(baseConfig,workspaceDir),{promptAuthChoiceGrouped}=await import(`./auth-choice-prompt-BotfCVbL.js`),{promptCustomApiConfig}=await import(`./onboard-custom-BABqIYa4.js`),{applyAuthChoice,resolvePreferredProviderForAuthChoice,warnIfModelConfigLooksOff}=await import(`./auth-choice-CVV9wRFN.js`),{applyPrimaryModel,promptDefaultModel}=await import(`./model-picker-D2bcWrtu.js`);if(keepExistingValues&&hasConfiguredModelOrAuth(nextConfig))await prompter.note(`Keeping existing model/auth configuration.`,`Model/auth provider`);else{let authStore=await ensureAuthProfileStore(void 0,{allowKeychainPrompt:!1}),authChoiceFromPrompt=opts.authChoice===void 0,authChoice=opts.authChoice??await promptAuthChoiceGrouped({prompter,store:authStore,includeSkip:!0});if(nextConfig=authChoice===`custom-api-key`?(await promptCustomApiConfig({prompter,runtime,config:nextConfig})).config:(await applyAuthChoice({authChoice,config:nextConfig,prompter,runtime,setDefaultModel:!0,opts:{tokenProvider:opts.tokenProvider,token:opts.authChoice===`apiKey`&&opts.token?opts.token:void 0}})).config,authChoiceFromPrompt&&authChoice!==`custom-api-key`&&authChoice!==`local`&&authChoice!==`builderforcellm`){let modelSelection=await promptDefaultModel({config:nextConfig,prompter,allowKeep:!0,ignoreAllowlist:!0,includeVllm:!0,preferredProvider:resolvePreferredProviderForAuthChoice(authChoice)});modelSelection.config&&(nextConfig=modelSelection.config),modelSelection.model&&(nextConfig=applyPrimaryModel(nextConfig,modelSelection.model))}let primaryModel=typeof nextConfig.agents?.defaults?.model?.primary==`string`?nextConfig.agents.defaults.model.primary.trim().toLowerCase():``;if((primaryModel===`builderforcellm`||primaryModel.startsWith(`builderforcellm/`))&&!(process.env.BUILDERFORCE_API_KEY?.trim()??readSharedEnvVar(`BUILDERFORCE_API_KEY`)?.trim())){await prompter.note([`BuilderForceAgentsLLM requires Builderforce registration.`,`Complete login/registration now so /model builderforcellm/auto works immediately.`,`You can skip this and connect later — use /setup or: builderforce init --reconnect`].join(`
6
6
  `),`BuilderForceAgentsLLM`);let{promptBuilderforceOnboarding}=await import(`./builderforce-onboarding-Dq6VUSKZ.js`);await promptBuilderforceOnboarding({projectRoot:workspaceDir,defaultInstanceName:path.basename(workspaceDir)||`builderforce`,forcePrompt:!0}),(process.env.BUILDERFORCE_API_KEY?.trim()??readSharedEnvVar(`BUILDERFORCE_API_KEY`)?.trim())||await prompter.note([`BuilderForceAgentsLLM won't work until you connect to Builderforce.`,`You can still use BuilderForceAgents — switch models with /model or connect later.`].join(`
7
- `),`Skipped`)}await warnIfModelConfigLooksOff(nextConfig,prompter)}let alreadyHasLocalBrain=nextConfig.models?.providers?.[`builderforcellm-local`]?.api===`transformers`;if(!opts.skipProviders&&(configHandlingAction!==`keep`||!alreadyHasLocalBrain))if(await prompter.select({message:`Enable local brain (amygdala + hippocampus)?`,options:[{value:`smart`,label:`Enable dual local brain`,hint:`Downloads amygdala (SmolLM2) + hippocampus (Qwen3-0.6B). ~3.5 GB disk.`},{value:`skip`,label:`Skip — use my cortex (configured LLM) only`,hint:`No extra download. Uses whatever model you configured above.`}],initialValue:`skip`})===`smart`){nextConfig={...nextConfig,localBrain:{enabled:!0}};let{downloadAndWireLocalBrain}=await import(`./auth-choice.apply.transformers-CXywS3GZ.js`);nextConfig={...(await downloadAndWireLocalBrain({config:nextConfig,prompter})).config}}else nextConfig={...nextConfig,localBrain:{enabled:!1}};let settings;if(keepExistingValues&&quickstartGateway.hasExisting)settings={port:quickstartGateway.port,bind:quickstartGateway.bind,customBindHost:quickstartGateway.bind===`custom`?quickstartGateway.customBindHost:void 0,authMode:quickstartGateway.authMode,gatewayToken:quickstartGateway.authMode===`token`?quickstartGateway.token:void 0,tailscaleMode:quickstartGateway.tailscaleMode,tailscaleResetOnExit:quickstartGateway.tailscaleResetOnExit},await prompter.note(`Keeping existing gateway settings.`,`Gateway`);else{let{configureGatewayForOnboarding}=await import(`./onboarding.gateway-config-Cd7_bXVs.js`),gateway=await configureGatewayForOnboarding({flow,baseConfig,nextConfig,localPort,quickstartGateway,prompter,runtime});nextConfig=gateway.nextConfig,settings=gateway.settings}let skipChannelsForKeep=keepExistingValues&&hasConfiguredChannels(nextConfig);if(opts.skipChannels??opts.skipProviders??skipChannelsForKeep)await prompter.note(`Skipping channel setup.`,`Channels`);else{let{listChannelPlugins}=await import(`./plugins-BIG8NDB9.js`),{setupChannels}=await import(`./onboard-channels-Db0P4iWl.js`),quickstartAllowFromChannels=flow===`quickstart`?listChannelPlugins().filter(plugin=>plugin.meta.quickstartAllowFrom).map(plugin=>plugin.id):[];nextConfig=await setupChannels(nextConfig,runtime,prompter,{allowSignalInstall:!0,forceAllowFromChannels:quickstartAllowFromChannels,skipDmPolicyPrompt:flow===`quickstart`,skipConfirm:flow===`quickstart`,quickstartDefaults:flow===`quickstart`})}await writeConfigFile(nextConfig);let{logConfigUpdated}=await import(`./logging-DSIJukIo.js`);logConfigUpdated(runtime),await onboardHelpers.ensureWorkspaceAndSessions(workspaceDir,runtime,{skipBootstrap:!!nextConfig.agents?.defaults?.skipBootstrap});let{isBuilderForceAgentsProject,initializeBuilderForceAgentsProject}=await import(`./project-context-DXVJ6Qot.js`);if(await isBuilderForceAgentsProject(workspaceDir)||(await initializeBuilderForceAgentsProject(workspaceDir),runtime.log(`Initialised .builderforce/ project directory`)),opts.skipSkills)await prompter.note(`Skipping skills setup.`,`Skills`);else{let{setupSkills}=await import(`./onboard-skills-ILHIeg1R.js`);nextConfig=await setupSkills(nextConfig,workspaceDir,runtime,prompter)}let{setupInternalHooks}=await import(`./onboard-hooks-Cenav0eW.js`);nextConfig=await setupInternalHooks(nextConfig,runtime,prompter),nextConfig=onboardHelpers.applyWizardMetadata(nextConfig,{command:`onboard`,mode}),await writeConfigFile(nextConfig);let{finalizeOnboardingWizard}=await import(`./onboarding.finalize-B4Tc4IDN.js`),{launchedTui}=await finalizeOnboardingWizard({flow,opts,baseConfig,nextConfig,workspaceDir,settings,prompter,runtime})}export{runOnboardingWizard as t};
7
+ `),`Skipped`)}await warnIfModelConfigLooksOff(nextConfig,prompter)}let alreadyHasLocalBrain=nextConfig.models?.providers?.[`builderforcellm-local`]?.api===`transformers`;if(!opts.skipProviders&&(configHandlingAction!==`keep`||!alreadyHasLocalBrain))if(await prompter.select({message:`Enable local brain (amygdala + hippocampus)?`,options:[{value:`smart`,label:`Enable dual local brain`,hint:`Downloads amygdala (SmolLM2) + hippocampus (Qwen3-0.6B). ~3.5 GB disk.`},{value:`skip`,label:`Skip — use my cortex (configured LLM) only`,hint:`No extra download. Uses whatever model you configured above.`}],initialValue:`skip`})===`smart`){nextConfig={...nextConfig,localBrain:{enabled:!0}};let{downloadAndWireLocalBrain}=await import(`./auth-choice.apply.transformers-CXywS3GZ.js`);nextConfig={...(await downloadAndWireLocalBrain({config:nextConfig,prompter})).config}}else nextConfig={...nextConfig,localBrain:{enabled:!1}};let settings;if(keepExistingValues&&quickstartGateway.hasExisting)settings={port:quickstartGateway.port,bind:quickstartGateway.bind,customBindHost:quickstartGateway.bind===`custom`?quickstartGateway.customBindHost:void 0,authMode:quickstartGateway.authMode,gatewayToken:quickstartGateway.authMode===`token`?quickstartGateway.token:void 0,tailscaleMode:quickstartGateway.tailscaleMode,tailscaleResetOnExit:quickstartGateway.tailscaleResetOnExit},await prompter.note(`Keeping existing gateway settings.`,`Gateway`);else{let{configureGatewayForOnboarding}=await import(`./onboarding.gateway-config-Cd7_bXVs.js`),gateway=await configureGatewayForOnboarding({flow,baseConfig,nextConfig,localPort,quickstartGateway,prompter,runtime});nextConfig=gateway.nextConfig,settings=gateway.settings}let skipChannelsForKeep=keepExistingValues&&hasConfiguredChannels(nextConfig);if(opts.skipChannels??opts.skipProviders??skipChannelsForKeep)await prompter.note(`Skipping channel setup.`,`Channels`);else{let{listChannelPlugins}=await import(`./plugins-BIG8NDB9.js`),{setupChannels}=await import(`./onboard-channels-Db0P4iWl.js`),quickstartAllowFromChannels=flow===`quickstart`?listChannelPlugins().filter(plugin=>plugin.meta.quickstartAllowFrom).map(plugin=>plugin.id):[];nextConfig=await setupChannels(nextConfig,runtime,prompter,{allowSignalInstall:!0,forceAllowFromChannels:quickstartAllowFromChannels,skipDmPolicyPrompt:flow===`quickstart`,skipConfirm:flow===`quickstart`,quickstartDefaults:flow===`quickstart`})}await writeConfigFile(nextConfig);let{logConfigUpdated}=await import(`./logging-DSIJukIo.js`);logConfigUpdated(runtime),await onboardHelpers.ensureWorkspaceAndSessions(workspaceDir,runtime,{skipBootstrap:!!nextConfig.agents?.defaults?.skipBootstrap});let{isBuilderForceAgentsProject,initializeBuilderForceAgentsProject}=await import(`./project-context-DXVJ6Qot.js`);if(await isBuilderForceAgentsProject(workspaceDir)||(await initializeBuilderForceAgentsProject(workspaceDir),runtime.log(`Initialised .builderforce/ project directory`)),opts.skipSkills)await prompter.note(`Skipping skills setup.`,`Skills`);else{let{setupSkills}=await import(`./onboard-skills-ILHIeg1R.js`);nextConfig=await setupSkills(nextConfig,workspaceDir,runtime,prompter)}let{setupInternalHooks}=await import(`./onboard-hooks-Cenav0eW.js`);nextConfig=await setupInternalHooks(nextConfig,runtime,prompter),nextConfig=onboardHelpers.applyWizardMetadata(nextConfig,{command:`onboard`,mode}),await writeConfigFile(nextConfig);let{finalizeOnboardingWizard}=await import(`./onboarding.finalize-BfWXPgX7.js`),{launchedTui}=await finalizeOnboardingWizard({flow,opts,baseConfig,nextConfig,workspaceDir,settings,prompter,runtime})}export{runOnboardingWizard as t};
@@ -4,4 +4,4 @@ import{n as DEFAULT_GATEWAY_PORT,u as resolveGatewayPort}from"./paths-5FcIFMsj.j
4
4
  (↑/↓ to select, Enter to confirm)`,options:[{value:`keep`,label:`Use existing values`},{value:`modify`,label:`Update values`},{value:`reset`,label:`Reset`}],initialValue:`keep`});if(configHandlingAction=action,action===`reset`){let workspaceDefault=baseConfig.agents?.defaults?.workspace??onboardHelpers.DEFAULT_WORKSPACE,resetScope=await prompter.select({message:`Reset scope`,options:[{value:`config`,label:`Config only`},{value:`config+creds+sessions`,label:`Config + creds + sessions`},{value:`full`,label:`Full reset (config + creds + sessions + workspace)`}]});await onboardHelpers.handleReset(resetScope,resolveUserPath(workspaceDefault),runtime),baseConfig={}}}let keepExistingValues=configHandlingAction===`keep`,quickstartGateway=(()=>{let hasExisting=typeof baseConfig.gateway?.port==`number`||baseConfig.gateway?.bind!==void 0||baseConfig.gateway?.auth?.mode!==void 0||baseConfig.gateway?.auth?.token!==void 0||baseConfig.gateway?.auth?.password!==void 0||baseConfig.gateway?.customBindHost!==void 0||baseConfig.gateway?.tailscale?.mode!==void 0,bindRaw=baseConfig.gateway?.bind,bind=bindRaw===`loopback`||bindRaw===`lan`||bindRaw===`auto`||bindRaw===`custom`||bindRaw===`tailnet`?bindRaw:`loopback`,authMode=`token`;baseConfig.gateway?.auth?.mode===`token`||baseConfig.gateway?.auth?.mode===`password`?authMode=baseConfig.gateway.auth.mode:baseConfig.gateway?.auth?.token?authMode=`token`:baseConfig.gateway?.auth?.password&&(authMode=`password`);let tailscaleRaw=baseConfig.gateway?.tailscale?.mode,tailscaleMode=tailscaleRaw===`off`||tailscaleRaw===`serve`||tailscaleRaw===`funnel`?tailscaleRaw:`off`;return{hasExisting,port:resolveGatewayPort(baseConfig),bind,authMode,tailscaleMode,token:baseConfig.gateway?.auth?.token,password:baseConfig.gateway?.auth?.password,customBindHost:baseConfig.gateway?.customBindHost,tailscaleResetOnExit:baseConfig.gateway?.tailscale?.resetOnExit??!1}})();if(flow===`quickstart`){let formatBind=value=>value===`loopback`?`Loopback (127.0.0.1)`:value===`lan`?`LAN`:value===`custom`?`Custom IP`:value===`tailnet`?`Tailnet (Tailscale IP)`:`Auto`,formatAuth=value=>value===`token`?`Token (default)`:`Password`,formatTailscale=value=>value===`off`?`Off`:value===`serve`?`Serve`:`Funnel`,quickstartLines=quickstartGateway.hasExisting?[`Keeping your current gateway settings:`,`Gateway port: ${quickstartGateway.port}`,`Gateway bind: ${formatBind(quickstartGateway.bind)}`,...quickstartGateway.bind===`custom`&&quickstartGateway.customBindHost?[`Gateway custom IP: ${quickstartGateway.customBindHost}`]:[],`Gateway auth: ${formatAuth(quickstartGateway.authMode)}`,`Tailscale exposure: ${formatTailscale(quickstartGateway.tailscaleMode)}`,`Direct to chat channels.`]:[`Gateway port: ${DEFAULT_GATEWAY_PORT}`,`Gateway bind: Loopback (127.0.0.1)`,`Gateway auth: Token (default)`,`Tailscale exposure: Off`,`Direct to chat channels.`];await prompter.note(quickstartLines.join(`
5
5
  `),`QuickStart`)}let localPort=resolveGatewayPort(baseConfig),localUrl=`ws://127.0.0.1:${localPort}`,localProbe=await onboardHelpers.probeGatewayReachable({url:localUrl,token:baseConfig.gateway?.auth?.token??process.env.BUILDERFORCE_AGENTS_GATEWAY_TOKEN,password:baseConfig.gateway?.auth?.password??process.env.BUILDERFORCE_AGENTS_GATEWAY_PASSWORD}),remoteUrl=baseConfig.gateway?.remote?.url?.trim()??``,remoteProbe=remoteUrl?await onboardHelpers.probeGatewayReachable({url:remoteUrl,token:baseConfig.gateway?.remote?.token}):null,mode=opts.mode??(flow===`quickstart`?`local`:await prompter.select({message:`What do you want to set up?`,options:[{value:`local`,label:`Local gateway (this machine)`,hint:localProbe.ok?`Gateway reachable (${localUrl})`:`No gateway detected (${localUrl})`},{value:`remote`,label:`Remote gateway (info-only)`,hint:remoteUrl?remoteProbe?.ok?`Gateway reachable (${remoteUrl})`:`Configured but unreachable (${remoteUrl})`:`No remote URL configured yet`}]}));if(mode===`remote`){let{promptRemoteGatewayConfig}=await import(`./onboard-remote-DcuX8b2g.js`),{logConfigUpdated}=await import(`./logging-DuPWVnGa.js`),nextConfig=await promptRemoteGatewayConfig(baseConfig,prompter);nextConfig=onboardHelpers.applyWizardMetadata(nextConfig,{command:`onboard`,mode}),await writeConfigFile(nextConfig),logConfigUpdated(runtime),await prompter.outro(`Remote gateway configured.`);return}let existingWorkspace=baseConfig.agents?.defaults?.workspace??onboardHelpers.DEFAULT_WORKSPACE,workspaceDir=resolveUserPath((opts.workspace??(flow===`quickstart`||keepExistingValues?existingWorkspace:await prompter.text({message:`Workspace directory`,initialValue:existingWorkspace}))).trim()||onboardHelpers.DEFAULT_WORKSPACE),{applyOnboardingLocalWorkspaceConfig}=await import(`./onboard-config-CZqislkG.js`),nextConfig=applyOnboardingLocalWorkspaceConfig(baseConfig,workspaceDir),{promptAuthChoiceGrouped}=await import(`./auth-choice-prompt-aEk7uMxo.js`),{promptCustomApiConfig}=await import(`./onboard-custom-VpW3UC8u.js`),{applyAuthChoice,resolvePreferredProviderForAuthChoice,warnIfModelConfigLooksOff}=await import(`./auth-choice-Btd2Rxxd.js`),{applyPrimaryModel,promptDefaultModel}=await import(`./model-picker-DO1HtEEm.js`);if(keepExistingValues&&hasConfiguredModelOrAuth(nextConfig))await prompter.note(`Keeping existing model/auth configuration.`,`Model/auth provider`);else{let authStore=await ensureAuthProfileStore(void 0,{allowKeychainPrompt:!1}),authChoiceFromPrompt=opts.authChoice===void 0,authChoice=opts.authChoice??await promptAuthChoiceGrouped({prompter,store:authStore,includeSkip:!0});if(nextConfig=authChoice===`custom-api-key`?(await promptCustomApiConfig({prompter,runtime,config:nextConfig})).config:(await applyAuthChoice({authChoice,config:nextConfig,prompter,runtime,setDefaultModel:!0,opts:{tokenProvider:opts.tokenProvider,token:opts.authChoice===`apiKey`&&opts.token?opts.token:void 0}})).config,authChoiceFromPrompt&&authChoice!==`custom-api-key`&&authChoice!==`local`&&authChoice!==`builderforcellm`){let modelSelection=await promptDefaultModel({config:nextConfig,prompter,allowKeep:!0,ignoreAllowlist:!0,includeVllm:!0,preferredProvider:resolvePreferredProviderForAuthChoice(authChoice)});modelSelection.config&&(nextConfig=modelSelection.config),modelSelection.model&&(nextConfig=applyPrimaryModel(nextConfig,modelSelection.model))}let primaryModel=typeof nextConfig.agents?.defaults?.model?.primary==`string`?nextConfig.agents.defaults.model.primary.trim().toLowerCase():``;if((primaryModel===`builderforcellm`||primaryModel.startsWith(`builderforcellm/`))&&!(process.env.BUILDERFORCE_API_KEY?.trim()??readSharedEnvVar(`BUILDERFORCE_API_KEY`)?.trim())){await prompter.note([`BuilderForceAgentsLLM requires Builderforce registration.`,`Complete login/registration now so /model builderforcellm/auto works immediately.`,`You can skip this and connect later — use /setup or: builderforce init --reconnect`].join(`
6
6
  `),`BuilderForceAgentsLLM`);let{promptBuilderforceOnboarding}=await import(`./builderforce-onboarding-DuUfZ6oL.js`);await promptBuilderforceOnboarding({projectRoot:workspaceDir,defaultInstanceName:path.basename(workspaceDir)||`builderforce`,forcePrompt:!0}),(process.env.BUILDERFORCE_API_KEY?.trim()??readSharedEnvVar(`BUILDERFORCE_API_KEY`)?.trim())||await prompter.note([`BuilderForceAgentsLLM won't work until you connect to Builderforce.`,`You can still use BuilderForceAgents — switch models with /model or connect later.`].join(`
7
- `),`Skipped`)}await warnIfModelConfigLooksOff(nextConfig,prompter)}let alreadyHasLocalBrain=nextConfig.models?.providers?.[`builderforcellm-local`]?.api===`transformers`;if(!opts.skipProviders&&(configHandlingAction!==`keep`||!alreadyHasLocalBrain))if(await prompter.select({message:`Enable local brain (amygdala + hippocampus)?`,options:[{value:`smart`,label:`Enable dual local brain`,hint:`Downloads amygdala (SmolLM2) + hippocampus (Qwen3-0.6B). ~3.5 GB disk.`},{value:`skip`,label:`Skip — use my cortex (configured LLM) only`,hint:`No extra download. Uses whatever model you configured above.`}],initialValue:`skip`})===`smart`){nextConfig={...nextConfig,localBrain:{enabled:!0}};let{downloadAndWireLocalBrain}=await import(`./auth-choice.apply.transformers-D5OrjEHo.js`);nextConfig={...(await downloadAndWireLocalBrain({config:nextConfig,prompter})).config}}else nextConfig={...nextConfig,localBrain:{enabled:!1}};let settings;if(keepExistingValues&&quickstartGateway.hasExisting)settings={port:quickstartGateway.port,bind:quickstartGateway.bind,customBindHost:quickstartGateway.bind===`custom`?quickstartGateway.customBindHost:void 0,authMode:quickstartGateway.authMode,gatewayToken:quickstartGateway.authMode===`token`?quickstartGateway.token:void 0,tailscaleMode:quickstartGateway.tailscaleMode,tailscaleResetOnExit:quickstartGateway.tailscaleResetOnExit},await prompter.note(`Keeping existing gateway settings.`,`Gateway`);else{let{configureGatewayForOnboarding}=await import(`./onboarding.gateway-config-Bd8HJkso.js`),gateway=await configureGatewayForOnboarding({flow,baseConfig,nextConfig,localPort,quickstartGateway,prompter,runtime});nextConfig=gateway.nextConfig,settings=gateway.settings}let skipChannelsForKeep=keepExistingValues&&hasConfiguredChannels(nextConfig);if(opts.skipChannels??opts.skipProviders??skipChannelsForKeep)await prompter.note(`Skipping channel setup.`,`Channels`);else{let{listChannelPlugins}=await import(`./plugins-iAq-Gr8l.js`),{setupChannels}=await import(`./onboard-channels-CmqKsAoW.js`),quickstartAllowFromChannels=flow===`quickstart`?listChannelPlugins().filter(plugin=>plugin.meta.quickstartAllowFrom).map(plugin=>plugin.id):[];nextConfig=await setupChannels(nextConfig,runtime,prompter,{allowSignalInstall:!0,forceAllowFromChannels:quickstartAllowFromChannels,skipDmPolicyPrompt:flow===`quickstart`,skipConfirm:flow===`quickstart`,quickstartDefaults:flow===`quickstart`})}await writeConfigFile(nextConfig);let{logConfigUpdated}=await import(`./logging-DuPWVnGa.js`);logConfigUpdated(runtime),await onboardHelpers.ensureWorkspaceAndSessions(workspaceDir,runtime,{skipBootstrap:!!nextConfig.agents?.defaults?.skipBootstrap});let{isBuilderForceAgentsProject,initializeBuilderForceAgentsProject}=await import(`./project-context-B0-sfVBd.js`);if(await isBuilderForceAgentsProject(workspaceDir)||(await initializeBuilderForceAgentsProject(workspaceDir),runtime.log(`Initialised .builderforce/ project directory`)),opts.skipSkills)await prompter.note(`Skipping skills setup.`,`Skills`);else{let{setupSkills}=await import(`./onboard-skills-DIhjDMom.js`);nextConfig=await setupSkills(nextConfig,workspaceDir,runtime,prompter)}let{setupInternalHooks}=await import(`./onboard-hooks-Ce20rwpW.js`);nextConfig=await setupInternalHooks(nextConfig,runtime,prompter),nextConfig=onboardHelpers.applyWizardMetadata(nextConfig,{command:`onboard`,mode}),await writeConfigFile(nextConfig);let{finalizeOnboardingWizard}=await import(`./onboarding.finalize-Db6smxZL.js`),{launchedTui}=await finalizeOnboardingWizard({flow,opts,baseConfig,nextConfig,workspaceDir,settings,prompter,runtime})}export{runOnboardingWizard as t};
7
+ `),`Skipped`)}await warnIfModelConfigLooksOff(nextConfig,prompter)}let alreadyHasLocalBrain=nextConfig.models?.providers?.[`builderforcellm-local`]?.api===`transformers`;if(!opts.skipProviders&&(configHandlingAction!==`keep`||!alreadyHasLocalBrain))if(await prompter.select({message:`Enable local brain (amygdala + hippocampus)?`,options:[{value:`smart`,label:`Enable dual local brain`,hint:`Downloads amygdala (SmolLM2) + hippocampus (Qwen3-0.6B). ~3.5 GB disk.`},{value:`skip`,label:`Skip — use my cortex (configured LLM) only`,hint:`No extra download. Uses whatever model you configured above.`}],initialValue:`skip`})===`smart`){nextConfig={...nextConfig,localBrain:{enabled:!0}};let{downloadAndWireLocalBrain}=await import(`./auth-choice.apply.transformers-D5OrjEHo.js`);nextConfig={...(await downloadAndWireLocalBrain({config:nextConfig,prompter})).config}}else nextConfig={...nextConfig,localBrain:{enabled:!1}};let settings;if(keepExistingValues&&quickstartGateway.hasExisting)settings={port:quickstartGateway.port,bind:quickstartGateway.bind,customBindHost:quickstartGateway.bind===`custom`?quickstartGateway.customBindHost:void 0,authMode:quickstartGateway.authMode,gatewayToken:quickstartGateway.authMode===`token`?quickstartGateway.token:void 0,tailscaleMode:quickstartGateway.tailscaleMode,tailscaleResetOnExit:quickstartGateway.tailscaleResetOnExit},await prompter.note(`Keeping existing gateway settings.`,`Gateway`);else{let{configureGatewayForOnboarding}=await import(`./onboarding.gateway-config-Bd8HJkso.js`),gateway=await configureGatewayForOnboarding({flow,baseConfig,nextConfig,localPort,quickstartGateway,prompter,runtime});nextConfig=gateway.nextConfig,settings=gateway.settings}let skipChannelsForKeep=keepExistingValues&&hasConfiguredChannels(nextConfig);if(opts.skipChannels??opts.skipProviders??skipChannelsForKeep)await prompter.note(`Skipping channel setup.`,`Channels`);else{let{listChannelPlugins}=await import(`./plugins-iAq-Gr8l.js`),{setupChannels}=await import(`./onboard-channels-CmqKsAoW.js`),quickstartAllowFromChannels=flow===`quickstart`?listChannelPlugins().filter(plugin=>plugin.meta.quickstartAllowFrom).map(plugin=>plugin.id):[];nextConfig=await setupChannels(nextConfig,runtime,prompter,{allowSignalInstall:!0,forceAllowFromChannels:quickstartAllowFromChannels,skipDmPolicyPrompt:flow===`quickstart`,skipConfirm:flow===`quickstart`,quickstartDefaults:flow===`quickstart`})}await writeConfigFile(nextConfig);let{logConfigUpdated}=await import(`./logging-DuPWVnGa.js`);logConfigUpdated(runtime),await onboardHelpers.ensureWorkspaceAndSessions(workspaceDir,runtime,{skipBootstrap:!!nextConfig.agents?.defaults?.skipBootstrap});let{isBuilderForceAgentsProject,initializeBuilderForceAgentsProject}=await import(`./project-context-B0-sfVBd.js`);if(await isBuilderForceAgentsProject(workspaceDir)||(await initializeBuilderForceAgentsProject(workspaceDir),runtime.log(`Initialised .builderforce/ project directory`)),opts.skipSkills)await prompter.note(`Skipping skills setup.`,`Skills`);else{let{setupSkills}=await import(`./onboard-skills-DIhjDMom.js`);nextConfig=await setupSkills(nextConfig,workspaceDir,runtime,prompter)}let{setupInternalHooks}=await import(`./onboard-hooks-Ce20rwpW.js`);nextConfig=await setupInternalHooks(nextConfig,runtime,prompter),nextConfig=onboardHelpers.applyWizardMetadata(nextConfig,{command:`onboard`,mode}),await writeConfigFile(nextConfig);let{finalizeOnboardingWizard}=await import(`./onboarding.finalize-C2kZi7F0.js`),{launchedTui}=await finalizeOnboardingWizard({flow,opts,baseConfig,nextConfig,workspaceDir,settings,prompter,runtime})}export{runOnboardingWizard as t};
@@ -1,4 +1,4 @@
1
- import"./paths-BHg-VHB4.js";import"./registry-Cv7CoWAs.js";import{W as getResolvedLoggerSettings,h as pathExists,y as resolveUserPath}from"./utils-BP60e80M.js";import{t as restoreTerminalState}from"./restore-BdB4wlsZ.js";import"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import"./env-BoE8QSib.js";import"./warning-filter-nSTjpMIH.js";import"./auth-profiles-C1VbcUOm.js";import{r as resolveCliName,t as formatCliCommand}from"./command-format-DTMaGKs7.js";import"./src-DvWaTze9.js";import{i as logWarn}from"./logger-wuOr7HKl.js";import"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import{A as resolveWorkspaceFilePath,h as DEFAULT_BOOTSTRAP_FILENAME}from"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-HrLX5bhG.js";import"./io-CohJffHG.js";import"./manifest-registry-009gLJ4l.js";import"./config-toczWD3q.js";import"./model-discovery-C9Xm95uL.js";import"./model-catalog-CiiFJX77.js";import"./frontmatter-CaY7feZm.js";import"./skills-D3MwwPOH.js";import"./plugin-skills-pSFUbhg_.js";import"./refresh-C4vwneXT.js";import"./client-CGgp3zkQ.js";import"./call-DmAU4cRX.js";import"./message-channel-z5YRpR2d.js";import"./subagent-registry-CyGxu3kP.js";import"./sessions-Bl1wwotX.js";import"./project-context-store-CIUcwUP_.js";import"./tokens-CFKkpUIu.js";import"./plugins-1Mn6RiNf.js";import"./accounts-BkTLjSrD.js";import"./bindings-CKSDlQ1i.js";import"./send-BvroeIQ6.js";import"./send-CceNWtYE.js";import"./with-timeout-T07SJo4N.js";import"./deliver-BuZu68tp.js";import"./accounts-Cx82nj4E.js";import"./send-ByCVQQVz.js";import"./image-ops-CotJhwRR.js";import"./redact-CgO7wehS.js";import"./errors-tAt19c1E.js";import"./embedded-helpers-DK8_apW0.js";import"./sandbox-z9t_PRf9.js";import"./chrome-BnEbJV3D.js";import"./tailscale-DV-yOmYe.js";import"./auth-ChecwOXS.js";import"./server-context-owOmmyUM.js";import"./routes-lclJHOYY.js";import"./paths-BnOjueoX.js";import"./ssrf-DJXLYZ0d.js";import"./store-DHD2IEgd.js";import"./ports-DTku9NSx.js";import"./trash-C3zmJ_O7.js";import"./accounts-DcoaLXKI.js";import"./paths-ClsbsPQP.js";import"./tool-images-CCpqFtrL.js";import"./workspace-waBqRxiy.js";import"./reply-prefix-Cg7AqaK0.js";import"./sqlite-CIGM1WKg.js";import"./memory-cli-ivAs7q7v.js";import"./manager-CRba8roB.js";import"./gemini-auth-CkD5jCPh.js";import"./retry-B151Hej5.js";import"./common-BfwMxpLu.js";import"./runner-DwWmciCt.js";import"./tool-display-Cs4hDP1f.js";import"./chunk-Dly7lM4r.js";import"./markdown-tables-B1Rx8hv6.js";import"./fetch-guard-DnXqPKae.js";import"./fetch-Cn_THzz8.js";import"./ir-CSdQJPqu.js";import"./render-DlHYsbvQ.js";import"./builderforcellm-syscheck-CprBhARf.js";import"./session-utils-GMvum00v.js";import"./coding-tools.policy-NEPm7Mz1.js";import"./pairing-store-QDb6lhIU.js";import"./fetch-DnWD6ydH.js";import"./exec-approvals-D7ZPAZpt.js";import"./nodes-screen-D6GHv_S0.js";import"./session-cost-usage-S0nkbPoW.js";import"./usage-format-5sp5AMSu.js";import"./provider-usage-Bn4ZrnU7.js";import"./send-B_1BtyfA.js";import"./outbound-attachment-BaTYE4qp.js";import"./delivery-queue-Cp3t4Upn.js";import"./project-context-D3Mx4maV.js";import"./control-service-CJuuqNOE.js";import"./stagger-CRe77dWL.js";import"./channel-selection-BLwXhb9t.js";import"./send-UFtylOiq.js";import"./resolve-route-DEIW5uKy.js";import"./channel-activity-DX36RadH.js";import"./tables-CojSfTth.js";import"./links-BKzP7VVP.js";import"./cli-utils-C9pW69LF.js";import"./help-format-CfFf-w62.js";import"./progress-Cqb-jAjT.js";import"./replies-DbkT_5BV.js";import{b as waitForGatewayReachable,d as openUrl,g as resolveControlUiLinks,i as detectBrowserOpenSupport,o as formatControlUiSshHint,p as probeGatewayReachable}from"./onboard-helpers-CckrS8_K.js";import"./prompt-style-BMWmaqSC.js";import"./pairing-labels-3j_iRYOO.js";import"./active-listener-Di9e1YAD.js";import"./mamba-state-engine-CV4nDcCk.js";import"./transformers-stream-Buj40qHl.js";import"./note-DgDXuE0F.js";import"./helpers-DPPVplyk.js";import"./register.subclis-DqO3Ciiv.js";import"./command-registry-D_LkOB4n.js";import"./program-context-Wpc-6CdI.js";import{n as installCompletion}from"./completion-cli-CijodCzU.js";import{a as gatewayInstallErrorHint,i as buildGatewayInstallPlan,n as GATEWAY_DAEMON_RUNTIME_OPTIONS,t as DEFAULT_GATEWAY_DAEMON_RUNTIME}from"./daemon-runtime-B4UjqdyJ.js";import"./runtime-guard-Bi8k55v9.js";import{r as isSystemdUserServiceAvailable}from"./systemd-DdVd5Yet.js";import{t as resolveGatewayService}from"./service-EKJG69M3.js";import{r as healthCommand}from"./health-DVo8a9yg.js";import{t as ensureControlUiAssetsBuilt}from"./control-ui-assets-BxgWcomx.js";import"./builderforce-directory-sync-DQ6u60yX.js";import"./shared-xj-xaKFi.js";import"./model-picker-swoSwauV.js";import"./auth-choice.apply.transformers-1plI0MUg.js";import{t as formatHealthCheckFailure}from"./health-format-D4MaIjaG.js";import{r as ensureCompletionCacheExists,t as checkShellCompletionStatus}from"./doctor-completion-FErwMP3Y.js";import{t as runTui}from"./tui-C5ChWpBg.js";import"./tui-stream-assembler-q9GANTDr.js";import os from"node:os";import path from"node:path";import fs from"node:fs/promises";async function resolveProfileHint(shell){let home=process.env.HOME||os.homedir();return shell===`zsh`?`~/.zshrc`:shell===`bash`?await pathExists(path.join(home,`.bashrc`))?`~/.bashrc`:`~/.bash_profile`:shell===`fish`?`~/.config/fish/config.fish`:`$PROFILE`}function formatReloadHint(shell,profileHint){return shell===`powershell`?`Restart your shell (or reload your PowerShell profile).`:`Restart your shell or run: source ${profileHint}`}async function setupOnboardingShellCompletion(params){let deps={resolveCliName,checkShellCompletionStatus,ensureCompletionCacheExists,installCompletion,...params.deps},cliName=deps.resolveCliName(),completionStatus=await deps.checkShellCompletionStatus(cliName);if(completionStatus.usesSlowPattern){await deps.ensureCompletionCacheExists(cliName)&&await deps.installCompletion(completionStatus.shell,!0,cliName);return}if(completionStatus.profileInstalled&&!completionStatus.cacheExists){await deps.ensureCompletionCacheExists(cliName);return}if(!completionStatus.profileInstalled){if(!(params.flow===`quickstart`||await params.prompter.confirm({message:`Enable ${completionStatus.shell} shell completion for ${cliName}?`,initialValue:!0})))return;if(!await deps.ensureCompletionCacheExists(cliName)){await params.prompter.note(`Failed to generate completion cache. Run \`${cliName} completion --install\` later.`,`Shell completion`);return}await deps.installCompletion(completionStatus.shell,!0,cliName);let profileHint=await resolveProfileHint(completionStatus.shell);await params.prompter.note(`Shell completion installed. ${formatReloadHint(completionStatus.shell,profileHint)}`,`Shell completion`)}}async function finalizeOnboardingWizard(options){let{flow,opts,baseConfig,nextConfig,settings,prompter,runtime}=options,withWizardProgress=async(label,options,work)=>{let progress=prompter.progress(label);try{return await work(progress)}finally{progress.stop(options.doneMessage)}},systemdAvailable=process.platform===`linux`?await isSystemdUserServiceAvailable():!0;if(process.platform===`linux`&&!systemdAvailable&&await prompter.note(`Systemd user services are unavailable. Skipping lingering checks and service install.`,`Systemd`),process.platform===`linux`&&systemdAvailable){let{ensureSystemdUserLingerInteractive}=await import(`./systemd-linger-Dgxo9kqA.js`);await ensureSystemdUserLingerInteractive({runtime,prompter:{confirm:prompter.confirm,note:prompter.note},reason:`Linux installs use a systemd user service by default. Without lingering, systemd stops the user session on logout/idle and kills the Gateway.`,requireConfirm:!1})}let explicitInstallDaemon=typeof opts.installDaemon==`boolean`?opts.installDaemon:void 0,installDaemon;if(installDaemon=explicitInstallDaemon===void 0?process.platform===`linux`&&!systemdAvailable?!1:flow===`quickstart`?!0:await prompter.confirm({message:`Install Gateway service (recommended)`,initialValue:!0}):explicitInstallDaemon,process.platform===`linux`&&!systemdAvailable&&installDaemon&&(await prompter.note("Systemd user services are unavailable; skipping service install. Use your container supervisor or `docker compose up -d`.",`Gateway service`),installDaemon=!1),installDaemon){let daemonRuntime=flow===`quickstart`?DEFAULT_GATEWAY_DAEMON_RUNTIME:await prompter.select({message:`Gateway service runtime`,options:GATEWAY_DAEMON_RUNTIME_OPTIONS,initialValue:opts.daemonRuntime??DEFAULT_GATEWAY_DAEMON_RUNTIME});flow===`quickstart`&&await prompter.note(`QuickStart uses Node for the Gateway service (stable + supported).`,`Gateway service runtime`);let service=resolveGatewayService(),loaded=await service.isLoaded({env:process.env});if(loaded){let action=await prompter.select({message:`Gateway service already installed`,options:[{value:`restart`,label:`Restart`},{value:`reinstall`,label:`Reinstall`},{value:`skip`,label:`Skip`}]});action===`restart`?await withWizardProgress(`Gateway service`,{doneMessage:`Gateway service restarted.`},async progress=>{progress.update(`Restarting Gateway service…`),await service.restart({env:process.env,stdout:process.stdout})}):action===`reinstall`&&await withWizardProgress(`Gateway service`,{doneMessage:`Gateway service uninstalled.`},async progress=>{progress.update(`Uninstalling Gateway service…`),await service.uninstall({env:process.env,stdout:process.stdout})})}if(!loaded||loaded&&!await service.isLoaded({env:process.env})){let progress=prompter.progress(`Gateway service`),installError=null;try{progress.update(`Preparing Gateway service…`);let{programArguments,workingDirectory,environment}=await buildGatewayInstallPlan({env:process.env,port:settings.port,token:settings.gatewayToken,runtime:daemonRuntime,warn:(message,title)=>prompter.note(message,title),config:nextConfig});progress.update(`Installing Gateway service…`),await service.install({env:process.env,stdout:process.stdout,programArguments,workingDirectory,environment})}catch(err){installError=err instanceof Error?err.message:String(err)}finally{progress.stop(installError?`Gateway service install failed.`:`Gateway service installed.`)}installError&&(await prompter.note(`Gateway service install failed: ${installError}`,`Gateway`),await prompter.note(gatewayInstallErrorHint(),`Gateway`))}}if(!opts.skipHealth){await waitForGatewayReachable({url:resolveControlUiLinks({bind:nextConfig.gateway?.bind??`loopback`,port:settings.port,customBindHost:nextConfig.gateway?.customBindHost,basePath:void 0}).wsUrl,token:settings.gatewayToken,deadlineMs:15e3});try{await healthCommand({json:!1,timeoutMs:1e4},runtime)}catch(err){let msg=formatHealthCheckFailure(err);runtime.error(msg),logWarn(`[onboarding] health check failed: ${String(err)}`);let logFile=getResolvedLoggerSettings().file;await prompter.note([`Logs:`,logFile,`View: ${formatCliCommand(`builderforce logs --follow`)}`,``,`Docs:`,`https://docs.builderforce.ai/gateway/health`,`https://docs.builderforce.ai/gateway/troubleshooting`].join(`
1
+ import"./paths-BHg-VHB4.js";import"./registry-Cv7CoWAs.js";import{W as getResolvedLoggerSettings,h as pathExists,y as resolveUserPath}from"./utils-BP60e80M.js";import{t as restoreTerminalState}from"./restore-BdB4wlsZ.js";import"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import"./env-BoE8QSib.js";import"./warning-filter-nSTjpMIH.js";import"./auth-profiles-C1VbcUOm.js";import{r as resolveCliName,t as formatCliCommand}from"./command-format-DTMaGKs7.js";import"./src-DvWaTze9.js";import{i as logWarn}from"./logger-wuOr7HKl.js";import"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import{A as resolveWorkspaceFilePath,h as DEFAULT_BOOTSTRAP_FILENAME}from"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-HrLX5bhG.js";import"./io-CohJffHG.js";import"./manifest-registry-009gLJ4l.js";import"./config-toczWD3q.js";import"./model-discovery-C9Xm95uL.js";import"./model-catalog-CiiFJX77.js";import"./frontmatter-CaY7feZm.js";import"./skills-D3MwwPOH.js";import"./plugin-skills-pSFUbhg_.js";import"./refresh-C4vwneXT.js";import"./client-CGgp3zkQ.js";import"./call-DmAU4cRX.js";import"./message-channel-z5YRpR2d.js";import"./subagent-registry-CyGxu3kP.js";import"./sessions-Bl1wwotX.js";import"./project-context-store-CIUcwUP_.js";import"./tokens-CFKkpUIu.js";import"./plugins-1Mn6RiNf.js";import"./accounts-BkTLjSrD.js";import"./bindings-CKSDlQ1i.js";import"./send-BvroeIQ6.js";import"./send-CceNWtYE.js";import"./with-timeout-T07SJo4N.js";import"./deliver-BuZu68tp.js";import"./accounts-Cx82nj4E.js";import"./send-ByCVQQVz.js";import"./image-ops-CotJhwRR.js";import"./redact-CgO7wehS.js";import"./errors-tAt19c1E.js";import"./embedded-helpers-DK8_apW0.js";import"./sandbox-z9t_PRf9.js";import"./chrome-BnEbJV3D.js";import"./tailscale-DV-yOmYe.js";import"./auth-ChecwOXS.js";import"./server-context-owOmmyUM.js";import"./routes-lclJHOYY.js";import"./paths-BnOjueoX.js";import"./ssrf-DJXLYZ0d.js";import"./store-DHD2IEgd.js";import"./ports-DTku9NSx.js";import"./trash-C3zmJ_O7.js";import"./accounts-DcoaLXKI.js";import"./paths-ClsbsPQP.js";import"./tool-images-CCpqFtrL.js";import"./workspace-waBqRxiy.js";import"./reply-prefix-Cg7AqaK0.js";import"./sqlite-CIGM1WKg.js";import"./memory-cli-ivAs7q7v.js";import"./manager-CRba8roB.js";import"./gemini-auth-CkD5jCPh.js";import"./retry-B151Hej5.js";import"./common-BfwMxpLu.js";import"./runner-DwWmciCt.js";import"./tool-display-Cs4hDP1f.js";import"./chunk-Dly7lM4r.js";import"./markdown-tables-B1Rx8hv6.js";import"./fetch-guard-DnXqPKae.js";import"./fetch-Cn_THzz8.js";import"./ir-CSdQJPqu.js";import"./render-DlHYsbvQ.js";import"./builderforcellm-syscheck-CprBhARf.js";import"./session-utils-GMvum00v.js";import"./coding-tools.policy-NEPm7Mz1.js";import"./pairing-store-QDb6lhIU.js";import"./fetch-DnWD6ydH.js";import"./exec-approvals-D7ZPAZpt.js";import"./nodes-screen-D6GHv_S0.js";import"./session-cost-usage-S0nkbPoW.js";import"./usage-format-5sp5AMSu.js";import"./provider-usage-Bn4ZrnU7.js";import"./send-B_1BtyfA.js";import"./outbound-attachment-BaTYE4qp.js";import"./delivery-queue-Cp3t4Upn.js";import"./project-context-D3Mx4maV.js";import"./control-service-CJuuqNOE.js";import"./stagger-CRe77dWL.js";import"./channel-selection-BLwXhb9t.js";import"./send-UFtylOiq.js";import"./resolve-route-DEIW5uKy.js";import"./channel-activity-DX36RadH.js";import"./tables-CojSfTth.js";import"./links-BKzP7VVP.js";import"./cli-utils-C9pW69LF.js";import"./help-format-CfFf-w62.js";import"./progress-Cqb-jAjT.js";import"./replies-DbkT_5BV.js";import{b as waitForGatewayReachable,d as openUrl,g as resolveControlUiLinks,i as detectBrowserOpenSupport,o as formatControlUiSshHint,p as probeGatewayReachable}from"./onboard-helpers-CckrS8_K.js";import"./prompt-style-BMWmaqSC.js";import"./pairing-labels-3j_iRYOO.js";import"./active-listener-Di9e1YAD.js";import"./mamba-state-engine-CV4nDcCk.js";import"./transformers-stream-Buj40qHl.js";import"./note-DgDXuE0F.js";import"./helpers-DPPVplyk.js";import"./register.subclis-Cr9DoYcv.js";import"./command-registry-COUcUWby.js";import"./program-context-Wpc-6CdI.js";import{n as installCompletion}from"./completion-cli-DpFvU4Qn.js";import{a as gatewayInstallErrorHint,i as buildGatewayInstallPlan,n as GATEWAY_DAEMON_RUNTIME_OPTIONS,t as DEFAULT_GATEWAY_DAEMON_RUNTIME}from"./daemon-runtime-B4UjqdyJ.js";import"./runtime-guard-Bi8k55v9.js";import{r as isSystemdUserServiceAvailable}from"./systemd-DdVd5Yet.js";import{t as resolveGatewayService}from"./service-EKJG69M3.js";import{r as healthCommand}from"./health-DVo8a9yg.js";import{t as ensureControlUiAssetsBuilt}from"./control-ui-assets-BxgWcomx.js";import"./builderforce-directory-sync-DQ6u60yX.js";import"./shared-xj-xaKFi.js";import"./model-picker-swoSwauV.js";import"./auth-choice.apply.transformers-1plI0MUg.js";import{t as formatHealthCheckFailure}from"./health-format-D4MaIjaG.js";import{r as ensureCompletionCacheExists,t as checkShellCompletionStatus}from"./doctor-completion-BSotFS6p.js";import{t as runTui}from"./tui-BwWMByVp.js";import"./tui-stream-assembler-q9GANTDr.js";import os from"node:os";import path from"node:path";import fs from"node:fs/promises";async function resolveProfileHint(shell){let home=process.env.HOME||os.homedir();return shell===`zsh`?`~/.zshrc`:shell===`bash`?await pathExists(path.join(home,`.bashrc`))?`~/.bashrc`:`~/.bash_profile`:shell===`fish`?`~/.config/fish/config.fish`:`$PROFILE`}function formatReloadHint(shell,profileHint){return shell===`powershell`?`Restart your shell (or reload your PowerShell profile).`:`Restart your shell or run: source ${profileHint}`}async function setupOnboardingShellCompletion(params){let deps={resolveCliName,checkShellCompletionStatus,ensureCompletionCacheExists,installCompletion,...params.deps},cliName=deps.resolveCliName(),completionStatus=await deps.checkShellCompletionStatus(cliName);if(completionStatus.usesSlowPattern){await deps.ensureCompletionCacheExists(cliName)&&await deps.installCompletion(completionStatus.shell,!0,cliName);return}if(completionStatus.profileInstalled&&!completionStatus.cacheExists){await deps.ensureCompletionCacheExists(cliName);return}if(!completionStatus.profileInstalled){if(!(params.flow===`quickstart`||await params.prompter.confirm({message:`Enable ${completionStatus.shell} shell completion for ${cliName}?`,initialValue:!0})))return;if(!await deps.ensureCompletionCacheExists(cliName)){await params.prompter.note(`Failed to generate completion cache. Run \`${cliName} completion --install\` later.`,`Shell completion`);return}await deps.installCompletion(completionStatus.shell,!0,cliName);let profileHint=await resolveProfileHint(completionStatus.shell);await params.prompter.note(`Shell completion installed. ${formatReloadHint(completionStatus.shell,profileHint)}`,`Shell completion`)}}async function finalizeOnboardingWizard(options){let{flow,opts,baseConfig,nextConfig,settings,prompter,runtime}=options,withWizardProgress=async(label,options,work)=>{let progress=prompter.progress(label);try{return await work(progress)}finally{progress.stop(options.doneMessage)}},systemdAvailable=process.platform===`linux`?await isSystemdUserServiceAvailable():!0;if(process.platform===`linux`&&!systemdAvailable&&await prompter.note(`Systemd user services are unavailable. Skipping lingering checks and service install.`,`Systemd`),process.platform===`linux`&&systemdAvailable){let{ensureSystemdUserLingerInteractive}=await import(`./systemd-linger-Dgxo9kqA.js`);await ensureSystemdUserLingerInteractive({runtime,prompter:{confirm:prompter.confirm,note:prompter.note},reason:`Linux installs use a systemd user service by default. Without lingering, systemd stops the user session on logout/idle and kills the Gateway.`,requireConfirm:!1})}let explicitInstallDaemon=typeof opts.installDaemon==`boolean`?opts.installDaemon:void 0,installDaemon;if(installDaemon=explicitInstallDaemon===void 0?process.platform===`linux`&&!systemdAvailable?!1:flow===`quickstart`?!0:await prompter.confirm({message:`Install Gateway service (recommended)`,initialValue:!0}):explicitInstallDaemon,process.platform===`linux`&&!systemdAvailable&&installDaemon&&(await prompter.note("Systemd user services are unavailable; skipping service install. Use your container supervisor or `docker compose up -d`.",`Gateway service`),installDaemon=!1),installDaemon){let daemonRuntime=flow===`quickstart`?DEFAULT_GATEWAY_DAEMON_RUNTIME:await prompter.select({message:`Gateway service runtime`,options:GATEWAY_DAEMON_RUNTIME_OPTIONS,initialValue:opts.daemonRuntime??DEFAULT_GATEWAY_DAEMON_RUNTIME});flow===`quickstart`&&await prompter.note(`QuickStart uses Node for the Gateway service (stable + supported).`,`Gateway service runtime`);let service=resolveGatewayService(),loaded=await service.isLoaded({env:process.env});if(loaded){let action=await prompter.select({message:`Gateway service already installed`,options:[{value:`restart`,label:`Restart`},{value:`reinstall`,label:`Reinstall`},{value:`skip`,label:`Skip`}]});action===`restart`?await withWizardProgress(`Gateway service`,{doneMessage:`Gateway service restarted.`},async progress=>{progress.update(`Restarting Gateway service…`),await service.restart({env:process.env,stdout:process.stdout})}):action===`reinstall`&&await withWizardProgress(`Gateway service`,{doneMessage:`Gateway service uninstalled.`},async progress=>{progress.update(`Uninstalling Gateway service…`),await service.uninstall({env:process.env,stdout:process.stdout})})}if(!loaded||loaded&&!await service.isLoaded({env:process.env})){let progress=prompter.progress(`Gateway service`),installError=null;try{progress.update(`Preparing Gateway service…`);let{programArguments,workingDirectory,environment}=await buildGatewayInstallPlan({env:process.env,port:settings.port,token:settings.gatewayToken,runtime:daemonRuntime,warn:(message,title)=>prompter.note(message,title),config:nextConfig});progress.update(`Installing Gateway service…`),await service.install({env:process.env,stdout:process.stdout,programArguments,workingDirectory,environment})}catch(err){installError=err instanceof Error?err.message:String(err)}finally{progress.stop(installError?`Gateway service install failed.`:`Gateway service installed.`)}installError&&(await prompter.note(`Gateway service install failed: ${installError}`,`Gateway`),await prompter.note(gatewayInstallErrorHint(),`Gateway`))}}if(!opts.skipHealth){await waitForGatewayReachable({url:resolveControlUiLinks({bind:nextConfig.gateway?.bind??`loopback`,port:settings.port,customBindHost:nextConfig.gateway?.customBindHost,basePath:void 0}).wsUrl,token:settings.gatewayToken,deadlineMs:15e3});try{await healthCommand({json:!1,timeoutMs:1e4},runtime)}catch(err){let msg=formatHealthCheckFailure(err);runtime.error(msg),logWarn(`[onboarding] health check failed: ${String(err)}`);let logFile=getResolvedLoggerSettings().file;await prompter.note([`Logs:`,logFile,`View: ${formatCliCommand(`builderforce logs --follow`)}`,``,`Docs:`,`https://docs.builderforce.ai/gateway/health`,`https://docs.builderforce.ai/gateway/troubleshooting`].join(`
2
2
  `),`Health check help`)}}let controlUiEnabled=nextConfig.gateway?.controlUi?.enabled??baseConfig.gateway?.controlUi?.enabled??!0;if(!opts.skipUi&&controlUiEnabled){let controlUiAssets=await ensureControlUiAssetsBuilt(runtime);!controlUiAssets.ok&&controlUiAssets.message&&runtime.error(controlUiAssets.message)}await prompter.note([`Add nodes for extra features:`,`- macOS app (system + notifications)`,`- iOS app (camera/canvas)`,`- Android app (camera/canvas)`].join(`
3
3
  `),`Optional apps`);let controlUiBasePath=nextConfig.gateway?.controlUi?.basePath??baseConfig.gateway?.controlUi?.basePath,links=resolveControlUiLinks({bind:settings.bind,port:settings.port,customBindHost:settings.customBindHost,basePath:controlUiBasePath}),authedUrl=settings.authMode===`token`&&settings.gatewayToken?`${links.httpUrl}#token=${encodeURIComponent(settings.gatewayToken)}`:links.httpUrl,gatewayProbe=await probeGatewayReachable({url:links.wsUrl,token:settings.authMode===`token`?settings.gatewayToken:void 0,password:settings.authMode===`password`?nextConfig.gateway?.auth?.password:``}),gatewayStatusLine=gatewayProbe.ok?`Gateway: reachable`:`Gateway: not detected${gatewayProbe.detail?` (${gatewayProbe.detail})`:``}`,bootstrapPath=resolveWorkspaceFilePath(resolveUserPath(options.workspaceDir),DEFAULT_BOOTSTRAP_FILENAME),hasBootstrap=await fs.access(bootstrapPath).then(()=>!0).catch(()=>!1);await prompter.note([`Web UI: ${links.httpUrl}`,settings.authMode===`token`&&settings.gatewayToken?`Web UI (with token): ${authedUrl}`:void 0,`Gateway WS: ${links.wsUrl}`,gatewayStatusLine,`Docs: https://docs.builderforce.ai/web/control-ui`].filter(Boolean).join(`
4
4
  `),`Control UI`);let controlUiOpened=!1,controlUiOpenHint,hatchChoice=null,launchedTui=!1;!opts.skipUi&&gatewayProbe.ok?(hasBootstrap&&await prompter.note([`This is the defining action that makes your agent you.`,`Please take your time.`,`The more you tell it, the better the experience will be.`,`We will send: "Wake up, my friend!"`].join(`
@@ -1,4 +1,4 @@
1
- import"./paths-5FcIFMsj.js";import{G as getResolvedLoggerSettings,b as resolveUserPath,g as pathExists}from"./utils-DbaBVFaK.js";import"./embedded-helpers-CEsr3aQ0.js";import"./reply-Cd3vVnD7.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import"./subsystem-B3TqcCrZ.js";import"./registry-TdK-aV05.js";import{t as restoreTerminalState}from"./restore-gPan2ZAn.js";import{i as logWarn}from"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import{A as resolveWorkspaceFilePath,h as DEFAULT_BOOTSTRAP_FILENAME}from"./agent-scope-DPtjOxzp.js";import"./src-CA0fU67C.js";import"./model-selection-9bRFKBI_.js";import{r as resolveCliName,t as formatCliCommand}from"./command-format-D806O2pt.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import"./env-BIdU5BAp.js";import"./src-DTFqOIQD.js";import"./io-3R_ZyUxB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-_1Ca6jGb.js";import"./runner-SxCr9kXD.js";import"./model-catalog-C6UrZ0uG.js";import"./sandbox-BZibn6PX.js";import"./chrome-a3X9_-nf.js";import"./tailscale-DLkpGquM.js";import"./auth-lebUHrkd.js";import"./server-context-DJZT7Upf.js";import"./frontmatter-3D1EdC1L.js";import"./skills-Ba4ftrB-.js";import"./plugin-skills-B11rggZh.js";import"./routes-BzfLvF8W.js";import"./redact-BHdfp2MZ.js";import"./errors-B1MIg3g-.js";import"./paths-cR8ct-Y3.js";import"./ssrf-p9k-iapc.js";import"./image-ops-C8IUQKjn.js";import"./store-CmHBQ-yX.js";import"./ports-DgmEDNOm.js";import"./trash-DD2Hc5oq.js";import"./sessions-CdanN_ZI.js";import"./message-channel-D_jXxXQj.js";import"./plugins-D5zP6ENo.js";import"./accounts-o35LU_iy.js";import"./accounts-rmXEiebi.js";import"./accounts-BLueHgKj.js";import"./bindings-DR59065T.js";import"./send-DerUBvXW.js";import"./send-DyF1Xy9K.js";import"./paths-DJ6rztqJ.js";import"./tool-images-B7b_OiMz.js";import"./tool-display-ByOZtWvA.js";import"./fetch-guard-8mwt3-hm.js";import"./api-key-rotation-CHBjUwUJ.js";import"./fetch-BuOLY9KP.js";import"./sqlite-C39E12XS.js";import"./tokens-CCU3zO-D.js";import"./project-context-store-wcq7lXuI.js";import"./with-timeout-Bwq-GyUQ.js";import"./deliver-BpLm3ktn.js";import"./send-CBBziNqM.js";import"./workspace-D4LK4thI.js";import"./reply-prefix-zIMgi6K6.js";import"./memory-cli-DRz4wtHk.js";import"./manager-DwywI_5-.js";import"./retry-DlVhg5qu.js";import"./client-xfoidwPI.js";import"./call-BbRf8gFM.js";import"./common-BTbIhLyt.js";import"./chunk-FCBlVOyo.js";import"./markdown-tables-P6uoUSFa.js";import"./ir-5BNoIXZm.js";import"./render-D1dVTEB1.js";import"./builderforcellm-syscheck-DrFJ638L.js";import"./send-4d9NswaD.js";import"./outbound-attachment-C7wByQO5.js";import"./fetch-DnVtDecb.js";import"./delivery-queue-CXKynF1P.js";import"./channel-activity-CCNDbdD3.js";import"./tables-ERcoWFDp.js";import"./pairing-store-CbvMJhD3.js";import"./links-BgWWaaOT.js";import"./cli-utils-LBYKdNFb.js";import"./help-format-Qfk2vDNX.js";import"./progress-BfOtdN6b.js";import"./resolve-route-D49haUnv.js";import"./replies-Bd2RPZwQ.js";import"./refresh-TiC_kLgE.js";import"./coding-tools.policy-6qh9acJy.js";import"./send-BJDzwYJN.js";import{b as waitForGatewayReachable,d as openUrl,g as resolveControlUiLinks,i as detectBrowserOpenSupport,o as formatControlUiSshHint,p as probeGatewayReachable}from"./onboard-helpers-Cf5dNq7-.js";import"./prompt-style-BpVK43GK.js";import"./pairing-labels-BW5jQZlr.js";import"./session-cost-usage-BjH7mxVj.js";import"./usage-format-DGf8ZWPH.js";import"./provider-usage-BdrU4cIE.js";import"./active-listener-Dcg19lJG.js";import"./exec-approvals-BpVPDVtV.js";import"./nodes-screen-C3TDIi8d.js";import"./project-context-CJj0Inz-.js";import"./control-service-BbsswoMy.js";import"./stagger-8EkqkqJv.js";import"./channel-selection-DyAvzlY8.js";import"./mamba-state-engine-CoGqoBTH.js";import"./transformers-stream-D7nRu4Qu.js";import"./runtime-guard-DhksRHci.js";import"./program-context-7XUznN5J.js";import"./note-B6NtFdXt.js";import"./helpers-DTDCy17p.js";import{n as installCompletion}from"./completion-cli-CBES884A.js";import{a as gatewayInstallErrorHint,i as buildGatewayInstallPlan,n as GATEWAY_DAEMON_RUNTIME_OPTIONS,t as DEFAULT_GATEWAY_DAEMON_RUNTIME}from"./daemon-runtime-CtOr1ncS.js";import{r as isSystemdUserServiceAvailable}from"./systemd-BG3_QT6W.js";import{t as resolveGatewayService}from"./service-D-NLDyK3.js";import{r as healthCommand}from"./health-yS3NRKvY.js";import{t as ensureControlUiAssetsBuilt}from"./control-ui-assets-CWgH1Tda.js";import"./builderforce-directory-sync-DAH62b3b.js";import"./shared-BPN3qd7G.js";import"./model-picker-BUePD7Zg.js";import"./auth-choice.apply.transformers-CIn3fs7K.js";import{t as formatHealthCheckFailure}from"./health-format-iE_KYEwP.js";import{r as ensureCompletionCacheExists,t as checkShellCompletionStatus}from"./doctor-completion-Bv2ztEeW.js";import{t as runTui}from"./tui-DHjIJOFN.js";import"./tui-stream-assembler-ign_cPkv.js";import os from"node:os";import path from"node:path";import fs from"node:fs/promises";async function resolveProfileHint(shell){let home=process.env.HOME||os.homedir();return shell===`zsh`?`~/.zshrc`:shell===`bash`?await pathExists(path.join(home,`.bashrc`))?`~/.bashrc`:`~/.bash_profile`:shell===`fish`?`~/.config/fish/config.fish`:`$PROFILE`}function formatReloadHint(shell,profileHint){return shell===`powershell`?`Restart your shell (or reload your PowerShell profile).`:`Restart your shell or run: source ${profileHint}`}async function setupOnboardingShellCompletion(params){let deps={resolveCliName,checkShellCompletionStatus,ensureCompletionCacheExists,installCompletion,...params.deps},cliName=deps.resolveCliName(),completionStatus=await deps.checkShellCompletionStatus(cliName);if(completionStatus.usesSlowPattern){await deps.ensureCompletionCacheExists(cliName)&&await deps.installCompletion(completionStatus.shell,!0,cliName);return}if(completionStatus.profileInstalled&&!completionStatus.cacheExists){await deps.ensureCompletionCacheExists(cliName);return}if(!completionStatus.profileInstalled){if(!(params.flow===`quickstart`||await params.prompter.confirm({message:`Enable ${completionStatus.shell} shell completion for ${cliName}?`,initialValue:!0})))return;if(!await deps.ensureCompletionCacheExists(cliName)){await params.prompter.note(`Failed to generate completion cache. Run \`${cliName} completion --install\` later.`,`Shell completion`);return}await deps.installCompletion(completionStatus.shell,!0,cliName);let profileHint=await resolveProfileHint(completionStatus.shell);await params.prompter.note(`Shell completion installed. ${formatReloadHint(completionStatus.shell,profileHint)}`,`Shell completion`)}}async function finalizeOnboardingWizard(options){let{flow,opts,baseConfig,nextConfig,settings,prompter,runtime}=options,withWizardProgress=async(label,options,work)=>{let progress=prompter.progress(label);try{return await work(progress)}finally{progress.stop(options.doneMessage)}},systemdAvailable=process.platform===`linux`?await isSystemdUserServiceAvailable():!0;if(process.platform===`linux`&&!systemdAvailable&&await prompter.note(`Systemd user services are unavailable. Skipping lingering checks and service install.`,`Systemd`),process.platform===`linux`&&systemdAvailable){let{ensureSystemdUserLingerInteractive}=await import(`./systemd-linger-Defy1T1U.js`);await ensureSystemdUserLingerInteractive({runtime,prompter:{confirm:prompter.confirm,note:prompter.note},reason:`Linux installs use a systemd user service by default. Without lingering, systemd stops the user session on logout/idle and kills the Gateway.`,requireConfirm:!1})}let explicitInstallDaemon=typeof opts.installDaemon==`boolean`?opts.installDaemon:void 0,installDaemon;if(installDaemon=explicitInstallDaemon===void 0?process.platform===`linux`&&!systemdAvailable?!1:flow===`quickstart`?!0:await prompter.confirm({message:`Install Gateway service (recommended)`,initialValue:!0}):explicitInstallDaemon,process.platform===`linux`&&!systemdAvailable&&installDaemon&&(await prompter.note("Systemd user services are unavailable; skipping service install. Use your container supervisor or `docker compose up -d`.",`Gateway service`),installDaemon=!1),installDaemon){let daemonRuntime=flow===`quickstart`?DEFAULT_GATEWAY_DAEMON_RUNTIME:await prompter.select({message:`Gateway service runtime`,options:GATEWAY_DAEMON_RUNTIME_OPTIONS,initialValue:opts.daemonRuntime??DEFAULT_GATEWAY_DAEMON_RUNTIME});flow===`quickstart`&&await prompter.note(`QuickStart uses Node for the Gateway service (stable + supported).`,`Gateway service runtime`);let service=resolveGatewayService(),loaded=await service.isLoaded({env:process.env});if(loaded){let action=await prompter.select({message:`Gateway service already installed`,options:[{value:`restart`,label:`Restart`},{value:`reinstall`,label:`Reinstall`},{value:`skip`,label:`Skip`}]});action===`restart`?await withWizardProgress(`Gateway service`,{doneMessage:`Gateway service restarted.`},async progress=>{progress.update(`Restarting Gateway service…`),await service.restart({env:process.env,stdout:process.stdout})}):action===`reinstall`&&await withWizardProgress(`Gateway service`,{doneMessage:`Gateway service uninstalled.`},async progress=>{progress.update(`Uninstalling Gateway service…`),await service.uninstall({env:process.env,stdout:process.stdout})})}if(!loaded||loaded&&!await service.isLoaded({env:process.env})){let progress=prompter.progress(`Gateway service`),installError=null;try{progress.update(`Preparing Gateway service…`);let{programArguments,workingDirectory,environment}=await buildGatewayInstallPlan({env:process.env,port:settings.port,token:settings.gatewayToken,runtime:daemonRuntime,warn:(message,title)=>prompter.note(message,title),config:nextConfig});progress.update(`Installing Gateway service…`),await service.install({env:process.env,stdout:process.stdout,programArguments,workingDirectory,environment})}catch(err){installError=err instanceof Error?err.message:String(err)}finally{progress.stop(installError?`Gateway service install failed.`:`Gateway service installed.`)}installError&&(await prompter.note(`Gateway service install failed: ${installError}`,`Gateway`),await prompter.note(gatewayInstallErrorHint(),`Gateway`))}}if(!opts.skipHealth){await waitForGatewayReachable({url:resolveControlUiLinks({bind:nextConfig.gateway?.bind??`loopback`,port:settings.port,customBindHost:nextConfig.gateway?.customBindHost,basePath:void 0}).wsUrl,token:settings.gatewayToken,deadlineMs:15e3});try{await healthCommand({json:!1,timeoutMs:1e4},runtime)}catch(err){let msg=formatHealthCheckFailure(err);runtime.error(msg),logWarn(`[onboarding] health check failed: ${String(err)}`);let logFile=getResolvedLoggerSettings().file;await prompter.note([`Logs:`,logFile,`View: ${formatCliCommand(`builderforce logs --follow`)}`,``,`Docs:`,`https://docs.builderforce.ai/gateway/health`,`https://docs.builderforce.ai/gateway/troubleshooting`].join(`
1
+ import"./paths-5FcIFMsj.js";import{G as getResolvedLoggerSettings,b as resolveUserPath,g as pathExists}from"./utils-DbaBVFaK.js";import"./embedded-helpers-CEsr3aQ0.js";import"./reply-Cd3vVnD7.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import"./subsystem-B3TqcCrZ.js";import"./registry-TdK-aV05.js";import{t as restoreTerminalState}from"./restore-gPan2ZAn.js";import{i as logWarn}from"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import{A as resolveWorkspaceFilePath,h as DEFAULT_BOOTSTRAP_FILENAME}from"./agent-scope-DPtjOxzp.js";import"./src-CA0fU67C.js";import"./model-selection-9bRFKBI_.js";import{r as resolveCliName,t as formatCliCommand}from"./command-format-D806O2pt.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import"./env-BIdU5BAp.js";import"./src-DTFqOIQD.js";import"./io-3R_ZyUxB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-_1Ca6jGb.js";import"./runner-SxCr9kXD.js";import"./model-catalog-C6UrZ0uG.js";import"./sandbox-BZibn6PX.js";import"./chrome-a3X9_-nf.js";import"./tailscale-DLkpGquM.js";import"./auth-lebUHrkd.js";import"./server-context-DJZT7Upf.js";import"./frontmatter-3D1EdC1L.js";import"./skills-Ba4ftrB-.js";import"./plugin-skills-B11rggZh.js";import"./routes-BzfLvF8W.js";import"./redact-BHdfp2MZ.js";import"./errors-B1MIg3g-.js";import"./paths-cR8ct-Y3.js";import"./ssrf-p9k-iapc.js";import"./image-ops-C8IUQKjn.js";import"./store-CmHBQ-yX.js";import"./ports-DgmEDNOm.js";import"./trash-DD2Hc5oq.js";import"./sessions-CdanN_ZI.js";import"./message-channel-D_jXxXQj.js";import"./plugins-D5zP6ENo.js";import"./accounts-o35LU_iy.js";import"./accounts-rmXEiebi.js";import"./accounts-BLueHgKj.js";import"./bindings-DR59065T.js";import"./send-DerUBvXW.js";import"./send-DyF1Xy9K.js";import"./paths-DJ6rztqJ.js";import"./tool-images-B7b_OiMz.js";import"./tool-display-ByOZtWvA.js";import"./fetch-guard-8mwt3-hm.js";import"./api-key-rotation-CHBjUwUJ.js";import"./fetch-BuOLY9KP.js";import"./sqlite-C39E12XS.js";import"./tokens-CCU3zO-D.js";import"./project-context-store-wcq7lXuI.js";import"./with-timeout-Bwq-GyUQ.js";import"./deliver-BpLm3ktn.js";import"./send-CBBziNqM.js";import"./workspace-D4LK4thI.js";import"./reply-prefix-zIMgi6K6.js";import"./memory-cli-DRz4wtHk.js";import"./manager-DwywI_5-.js";import"./retry-DlVhg5qu.js";import"./client-xfoidwPI.js";import"./call-BbRf8gFM.js";import"./common-BTbIhLyt.js";import"./chunk-FCBlVOyo.js";import"./markdown-tables-P6uoUSFa.js";import"./ir-5BNoIXZm.js";import"./render-D1dVTEB1.js";import"./builderforcellm-syscheck-DrFJ638L.js";import"./send-4d9NswaD.js";import"./outbound-attachment-C7wByQO5.js";import"./fetch-DnVtDecb.js";import"./delivery-queue-CXKynF1P.js";import"./channel-activity-CCNDbdD3.js";import"./tables-ERcoWFDp.js";import"./pairing-store-CbvMJhD3.js";import"./links-BgWWaaOT.js";import"./cli-utils-LBYKdNFb.js";import"./help-format-Qfk2vDNX.js";import"./progress-BfOtdN6b.js";import"./resolve-route-D49haUnv.js";import"./replies-Bd2RPZwQ.js";import"./refresh-TiC_kLgE.js";import"./coding-tools.policy-6qh9acJy.js";import"./send-BJDzwYJN.js";import{b as waitForGatewayReachable,d as openUrl,g as resolveControlUiLinks,i as detectBrowserOpenSupport,o as formatControlUiSshHint,p as probeGatewayReachable}from"./onboard-helpers-Cf5dNq7-.js";import"./prompt-style-BpVK43GK.js";import"./pairing-labels-BW5jQZlr.js";import"./session-cost-usage-BjH7mxVj.js";import"./usage-format-DGf8ZWPH.js";import"./provider-usage-BdrU4cIE.js";import"./active-listener-Dcg19lJG.js";import"./exec-approvals-BpVPDVtV.js";import"./nodes-screen-C3TDIi8d.js";import"./project-context-CJj0Inz-.js";import"./control-service-BbsswoMy.js";import"./stagger-8EkqkqJv.js";import"./channel-selection-DyAvzlY8.js";import"./mamba-state-engine-CoGqoBTH.js";import"./transformers-stream-D7nRu4Qu.js";import"./runtime-guard-DhksRHci.js";import"./program-context-BCwL3wlM.js";import"./note-B6NtFdXt.js";import"./helpers-DTDCy17p.js";import{n as installCompletion}from"./completion-cli-B2qcVd6q.js";import{a as gatewayInstallErrorHint,i as buildGatewayInstallPlan,n as GATEWAY_DAEMON_RUNTIME_OPTIONS,t as DEFAULT_GATEWAY_DAEMON_RUNTIME}from"./daemon-runtime-CtOr1ncS.js";import{r as isSystemdUserServiceAvailable}from"./systemd-BG3_QT6W.js";import{t as resolveGatewayService}from"./service-D-NLDyK3.js";import{r as healthCommand}from"./health-yS3NRKvY.js";import{t as ensureControlUiAssetsBuilt}from"./control-ui-assets-CWgH1Tda.js";import"./builderforce-directory-sync-DAH62b3b.js";import"./shared-BPN3qd7G.js";import"./model-picker-BUePD7Zg.js";import"./auth-choice.apply.transformers-CIn3fs7K.js";import{t as formatHealthCheckFailure}from"./health-format-iE_KYEwP.js";import{r as ensureCompletionCacheExists,t as checkShellCompletionStatus}from"./doctor-completion-DVxbs-74.js";import{t as runTui}from"./tui-DylWbrDx.js";import"./tui-stream-assembler-ign_cPkv.js";import os from"node:os";import path from"node:path";import fs from"node:fs/promises";async function resolveProfileHint(shell){let home=process.env.HOME||os.homedir();return shell===`zsh`?`~/.zshrc`:shell===`bash`?await pathExists(path.join(home,`.bashrc`))?`~/.bashrc`:`~/.bash_profile`:shell===`fish`?`~/.config/fish/config.fish`:`$PROFILE`}function formatReloadHint(shell,profileHint){return shell===`powershell`?`Restart your shell (or reload your PowerShell profile).`:`Restart your shell or run: source ${profileHint}`}async function setupOnboardingShellCompletion(params){let deps={resolveCliName,checkShellCompletionStatus,ensureCompletionCacheExists,installCompletion,...params.deps},cliName=deps.resolveCliName(),completionStatus=await deps.checkShellCompletionStatus(cliName);if(completionStatus.usesSlowPattern){await deps.ensureCompletionCacheExists(cliName)&&await deps.installCompletion(completionStatus.shell,!0,cliName);return}if(completionStatus.profileInstalled&&!completionStatus.cacheExists){await deps.ensureCompletionCacheExists(cliName);return}if(!completionStatus.profileInstalled){if(!(params.flow===`quickstart`||await params.prompter.confirm({message:`Enable ${completionStatus.shell} shell completion for ${cliName}?`,initialValue:!0})))return;if(!await deps.ensureCompletionCacheExists(cliName)){await params.prompter.note(`Failed to generate completion cache. Run \`${cliName} completion --install\` later.`,`Shell completion`);return}await deps.installCompletion(completionStatus.shell,!0,cliName);let profileHint=await resolveProfileHint(completionStatus.shell);await params.prompter.note(`Shell completion installed. ${formatReloadHint(completionStatus.shell,profileHint)}`,`Shell completion`)}}async function finalizeOnboardingWizard(options){let{flow,opts,baseConfig,nextConfig,settings,prompter,runtime}=options,withWizardProgress=async(label,options,work)=>{let progress=prompter.progress(label);try{return await work(progress)}finally{progress.stop(options.doneMessage)}},systemdAvailable=process.platform===`linux`?await isSystemdUserServiceAvailable():!0;if(process.platform===`linux`&&!systemdAvailable&&await prompter.note(`Systemd user services are unavailable. Skipping lingering checks and service install.`,`Systemd`),process.platform===`linux`&&systemdAvailable){let{ensureSystemdUserLingerInteractive}=await import(`./systemd-linger-Defy1T1U.js`);await ensureSystemdUserLingerInteractive({runtime,prompter:{confirm:prompter.confirm,note:prompter.note},reason:`Linux installs use a systemd user service by default. Without lingering, systemd stops the user session on logout/idle and kills the Gateway.`,requireConfirm:!1})}let explicitInstallDaemon=typeof opts.installDaemon==`boolean`?opts.installDaemon:void 0,installDaemon;if(installDaemon=explicitInstallDaemon===void 0?process.platform===`linux`&&!systemdAvailable?!1:flow===`quickstart`?!0:await prompter.confirm({message:`Install Gateway service (recommended)`,initialValue:!0}):explicitInstallDaemon,process.platform===`linux`&&!systemdAvailable&&installDaemon&&(await prompter.note("Systemd user services are unavailable; skipping service install. Use your container supervisor or `docker compose up -d`.",`Gateway service`),installDaemon=!1),installDaemon){let daemonRuntime=flow===`quickstart`?DEFAULT_GATEWAY_DAEMON_RUNTIME:await prompter.select({message:`Gateway service runtime`,options:GATEWAY_DAEMON_RUNTIME_OPTIONS,initialValue:opts.daemonRuntime??DEFAULT_GATEWAY_DAEMON_RUNTIME});flow===`quickstart`&&await prompter.note(`QuickStart uses Node for the Gateway service (stable + supported).`,`Gateway service runtime`);let service=resolveGatewayService(),loaded=await service.isLoaded({env:process.env});if(loaded){let action=await prompter.select({message:`Gateway service already installed`,options:[{value:`restart`,label:`Restart`},{value:`reinstall`,label:`Reinstall`},{value:`skip`,label:`Skip`}]});action===`restart`?await withWizardProgress(`Gateway service`,{doneMessage:`Gateway service restarted.`},async progress=>{progress.update(`Restarting Gateway service…`),await service.restart({env:process.env,stdout:process.stdout})}):action===`reinstall`&&await withWizardProgress(`Gateway service`,{doneMessage:`Gateway service uninstalled.`},async progress=>{progress.update(`Uninstalling Gateway service…`),await service.uninstall({env:process.env,stdout:process.stdout})})}if(!loaded||loaded&&!await service.isLoaded({env:process.env})){let progress=prompter.progress(`Gateway service`),installError=null;try{progress.update(`Preparing Gateway service…`);let{programArguments,workingDirectory,environment}=await buildGatewayInstallPlan({env:process.env,port:settings.port,token:settings.gatewayToken,runtime:daemonRuntime,warn:(message,title)=>prompter.note(message,title),config:nextConfig});progress.update(`Installing Gateway service…`),await service.install({env:process.env,stdout:process.stdout,programArguments,workingDirectory,environment})}catch(err){installError=err instanceof Error?err.message:String(err)}finally{progress.stop(installError?`Gateway service install failed.`:`Gateway service installed.`)}installError&&(await prompter.note(`Gateway service install failed: ${installError}`,`Gateway`),await prompter.note(gatewayInstallErrorHint(),`Gateway`))}}if(!opts.skipHealth){await waitForGatewayReachable({url:resolveControlUiLinks({bind:nextConfig.gateway?.bind??`loopback`,port:settings.port,customBindHost:nextConfig.gateway?.customBindHost,basePath:void 0}).wsUrl,token:settings.gatewayToken,deadlineMs:15e3});try{await healthCommand({json:!1,timeoutMs:1e4},runtime)}catch(err){let msg=formatHealthCheckFailure(err);runtime.error(msg),logWarn(`[onboarding] health check failed: ${String(err)}`);let logFile=getResolvedLoggerSettings().file;await prompter.note([`Logs:`,logFile,`View: ${formatCliCommand(`builderforce logs --follow`)}`,``,`Docs:`,`https://docs.builderforce.ai/gateway/health`,`https://docs.builderforce.ai/gateway/troubleshooting`].join(`
2
2
  `),`Health check help`)}}let controlUiEnabled=nextConfig.gateway?.controlUi?.enabled??baseConfig.gateway?.controlUi?.enabled??!0;if(!opts.skipUi&&controlUiEnabled){let controlUiAssets=await ensureControlUiAssetsBuilt(runtime);!controlUiAssets.ok&&controlUiAssets.message&&runtime.error(controlUiAssets.message)}await prompter.note([`Add nodes for extra features:`,`- macOS app (system + notifications)`,`- iOS app (camera/canvas)`,`- Android app (camera/canvas)`].join(`
3
3
  `),`Optional apps`);let controlUiBasePath=nextConfig.gateway?.controlUi?.basePath??baseConfig.gateway?.controlUi?.basePath,links=resolveControlUiLinks({bind:settings.bind,port:settings.port,customBindHost:settings.customBindHost,basePath:controlUiBasePath}),authedUrl=settings.authMode===`token`&&settings.gatewayToken?`${links.httpUrl}#token=${encodeURIComponent(settings.gatewayToken)}`:links.httpUrl,gatewayProbe=await probeGatewayReachable({url:links.wsUrl,token:settings.authMode===`token`?settings.gatewayToken:void 0,password:settings.authMode===`password`?nextConfig.gateway?.auth?.password:``}),gatewayStatusLine=gatewayProbe.ok?`Gateway: reachable`:`Gateway: not detected${gatewayProbe.detail?` (${gatewayProbe.detail})`:``}`,bootstrapPath=resolveWorkspaceFilePath(resolveUserPath(options.workspaceDir),DEFAULT_BOOTSTRAP_FILENAME),hasBootstrap=await fs.access(bootstrapPath).then(()=>!0).catch(()=>!1);await prompter.note([`Web UI: ${links.httpUrl}`,settings.authMode===`token`&&settings.gatewayToken?`Web UI (with token): ${authedUrl}`:void 0,`Gateway WS: ${links.wsUrl}`,gatewayStatusLine,`Docs: https://docs.builderforce.ai/web/control-ui`].filter(Boolean).join(`
4
4
  `),`Control UI`);let controlUiOpened=!1,controlUiOpenHint,hatchChoice=null,launchedTui=!1;!opts.skipUi&&gatewayProbe.ok?(hasBootstrap&&await prompter.note([`This is the defining action that makes your agent you.`,`Please take your time.`,`The more you tell it, the better the experience will be.`,`We will send: "Wake up, my friend!"`].join(`
@@ -1,2 +1,2 @@
1
- import"./paths-BHg-VHB4.js";import{c as hasHelpOrVersion,n as getCommandPath,o as getVerboseFlag}from"./argv-BgQk38nl.js";import"./registry-Cv7CoWAs.js";import{N as setVerbose,R as isRich,c as escapeRegExp,z as theme}from"./utils-BP60e80M.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import{t as isTruthyEnvValue}from"./env-BoE8QSib.js";import"./warning-filter-nSTjpMIH.js";import"./auth-profiles-C1VbcUOm.js";import{n as replaceCliName,r as resolveCliName}from"./command-format-DTMaGKs7.js";import"./src-DvWaTze9.js";import"./logger-wuOr7HKl.js";import"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-HrLX5bhG.js";import{U as VERSION}from"./io-CohJffHG.js";import"./manifest-registry-009gLJ4l.js";import"./config-toczWD3q.js";import"./model-discovery-C9Xm95uL.js";import"./model-catalog-CiiFJX77.js";import"./frontmatter-CaY7feZm.js";import"./skills-D3MwwPOH.js";import"./plugin-skills-pSFUbhg_.js";import"./refresh-C4vwneXT.js";import"./client-CGgp3zkQ.js";import"./call-DmAU4cRX.js";import"./message-channel-z5YRpR2d.js";import"./subagent-registry-CyGxu3kP.js";import"./sessions-Bl1wwotX.js";import"./project-context-store-CIUcwUP_.js";import"./tokens-CFKkpUIu.js";import"./plugins-1Mn6RiNf.js";import"./accounts-BkTLjSrD.js";import"./bindings-CKSDlQ1i.js";import"./send-BvroeIQ6.js";import"./send-CceNWtYE.js";import"./with-timeout-T07SJo4N.js";import"./deliver-BuZu68tp.js";import"./accounts-Cx82nj4E.js";import"./send-ByCVQQVz.js";import"./image-ops-CotJhwRR.js";import"./redact-CgO7wehS.js";import"./errors-tAt19c1E.js";import"./embedded-helpers-DK8_apW0.js";import"./sandbox-z9t_PRf9.js";import"./chrome-BnEbJV3D.js";import"./tailscale-DV-yOmYe.js";import"./auth-ChecwOXS.js";import"./server-context-owOmmyUM.js";import"./routes-lclJHOYY.js";import"./paths-BnOjueoX.js";import"./ssrf-DJXLYZ0d.js";import"./store-DHD2IEgd.js";import"./ports-DTku9NSx.js";import"./trash-C3zmJ_O7.js";import"./accounts-DcoaLXKI.js";import"./paths-ClsbsPQP.js";import"./tool-images-CCpqFtrL.js";import"./workspace-waBqRxiy.js";import"./reply-prefix-Cg7AqaK0.js";import"./sqlite-CIGM1WKg.js";import"./memory-cli-ivAs7q7v.js";import"./manager-CRba8roB.js";import"./gemini-auth-CkD5jCPh.js";import"./retry-B151Hej5.js";import"./common-BfwMxpLu.js";import"./runner-DwWmciCt.js";import"./tool-display-Cs4hDP1f.js";import"./chunk-Dly7lM4r.js";import"./markdown-tables-B1Rx8hv6.js";import"./fetch-guard-DnXqPKae.js";import"./fetch-Cn_THzz8.js";import"./ir-CSdQJPqu.js";import"./render-DlHYsbvQ.js";import"./builderforcellm-syscheck-CprBhARf.js";import"./session-utils-GMvum00v.js";import"./coding-tools.policy-NEPm7Mz1.js";import"./pairing-store-QDb6lhIU.js";import"./fetch-DnWD6ydH.js";import"./exec-approvals-D7ZPAZpt.js";import"./nodes-screen-D6GHv_S0.js";import"./session-cost-usage-S0nkbPoW.js";import"./usage-format-5sp5AMSu.js";import"./provider-usage-Bn4ZrnU7.js";import"./send-B_1BtyfA.js";import"./outbound-attachment-BaTYE4qp.js";import"./delivery-queue-Cp3t4Upn.js";import"./project-context-D3Mx4maV.js";import"./control-service-CJuuqNOE.js";import"./stagger-CRe77dWL.js";import"./channel-selection-BLwXhb9t.js";import"./send-UFtylOiq.js";import"./resolve-route-DEIW5uKy.js";import"./channel-activity-DX36RadH.js";import"./tables-CojSfTth.js";import{t as formatDocsLink}from"./links-BKzP7VVP.js";import"./cli-utils-C9pW69LF.js";import"./help-format-CfFf-w62.js";import"./progress-Cqb-jAjT.js";import"./replies-DbkT_5BV.js";import"./onboard-helpers-CckrS8_K.js";import"./prompt-style-BMWmaqSC.js";import"./pairing-labels-3j_iRYOO.js";import"./active-listener-Di9e1YAD.js";import"./mamba-state-engine-CV4nDcCk.js";import"./transformers-stream-Buj40qHl.js";import"./catalog-li4bSIE2.js";import"./plugin-registry-SAdxNUwm.js";import{n as resolveCliChannelOptions}from"./channel-options-d4EwVQD0.js";import{t as getSubCliCommandsWithSubcommands}from"./register.subclis-DqO3Ciiv.js";import{a as registerProgramCommands,n as getCoreCliCommandsWithSubcommands}from"./command-registry-D_LkOB4n.js";import{n as setProgramContext}from"./program-context-Wpc-6CdI.js";import"./ports-6RmfZEmk.js";import{n as formatCliBannerLine,r as hasEmittedCliBanner,t as emitCliBanner}from"./banner-DY-L7_eI.js";import{Command}from"commander";function createProgramContext(){let channelOptions=resolveCliChannelOptions();return{programVersion:VERSION,channelOptions,messageChannelOptions:channelOptions.join(`|`),agentChannelOptions:[`last`,...channelOptions].join(`|`)}}const CLI_NAME=resolveCliName(),CLI_NAME_PATTERN=escapeRegExp(CLI_NAME),ROOT_COMMANDS_WITH_SUBCOMMANDS=new Set([...getCoreCliCommandsWithSubcommands(),...getSubCliCommandsWithSubcommands()]),EXAMPLES=[[`builderforce models --help`,`Show detailed help for the models command.`],[`builderforce channels login --verbose`,`Link personal WhatsApp Web and show QR + connection logs.`],[`builderforce message send --target +15555550123 --message "Hi" --json`,`Send via your web session and print JSON result.`],[`builderforce gateway --port 18789`,`Run the WebSocket Gateway locally.`],[`builderforce --dev gateway`,`Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001.`],[`builderforce gateway --force`,`Kill anything bound to the default gateway port, then start it.`],[`builderforce gateway ...`,`Gateway control via WebSocket.`],[`builderforce agent --to +15555550123 --message "Run summary" --deliver`,`Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.`],[`builderforce message send --channel telegram --target @mychat --message "Hi"`,`Send via your Telegram bot.`]];function configureProgramHelp(program,ctx){program.name(CLI_NAME).description(``).version(ctx.programVersion).option(`--dev`,`Dev profile: isolate state under ~/.builderforce-dev, default gateway port 19001, and shift derived ports (browser/canvas)`).option(`--profile <name>`,`Use a named profile (isolates BUILDERFORCE_AGENTS_STATE_DIR/BUILDERFORCE_AGENTS_CONFIG_PATH under ~/.builderforce-<name>)`),program.option(`--no-color`,`Disable ANSI colors`,!1),program.helpOption(`-h, --help`,`Display help for command`),program.helpCommand(`help [command]`,`Display help for command`),program.configureHelp({sortSubcommands:!0,sortOptions:!0,optionTerm:option=>theme.option(option.flags),subcommandTerm:cmd=>{let hasSubcommands=cmd.parent===program&&ROOT_COMMANDS_WITH_SUBCOMMANDS.has(cmd.name());return theme.command(hasSubcommands?`${cmd.name()} *`:cmd.name())}});let formatHelpOutput=str=>{let output=str;return RegExp(`^Usage:\\s+${CLI_NAME_PATTERN}\\s+\\[options\\]\\s+\\[command\\]\\s*$`,`m`).test(output)&&/^Commands:/m.test(output)&&(output=output.replace(/^Commands:/m,`Commands:\n ${theme.muted(`Hint: commands suffixed with * have subcommands. Run <command> --help for details.`)}`)),output.replace(/^Usage:/gm,theme.heading(`Usage:`)).replace(/^Options:/gm,theme.heading(`Options:`)).replace(/^Commands:/gm,theme.heading(`Commands:`))};program.configureOutput({writeOut:str=>{process.stdout.write(formatHelpOutput(str))},writeErr:str=>{process.stderr.write(formatHelpOutput(str))},outputError:(str,write)=>write(theme.error(str))}),(process.argv.includes(`-V`)||process.argv.includes(`--version`)||process.argv.includes(`-v`))&&(console.log(ctx.programVersion),process.exit(0)),program.addHelpText(`beforeAll`,()=>{if(hasEmittedCliBanner())return``;let rich=isRich();return`\n${formatCliBannerLine(ctx.programVersion,{richTty:rich})}\n`});let fmtExamples=EXAMPLES.map(([cmd,desc])=>` ${theme.command(replaceCliName(cmd,CLI_NAME))}\n ${theme.muted(desc)}`).join(`
2
- `);program.addHelpText(`afterAll`,({command})=>{if(command!==program)return``;let docs=formatDocsLink(`/cli`,`docs.builderforce.ai/cli`);return`\n${theme.heading(`Examples:`)}\n${fmtExamples}\n\n${theme.muted(`Docs:`)} ${docs}\n`})}function setProcessTitleForCommand(actionCommand){let current=actionCommand;for(;current.parent&&current.parent.parent;)current=current.parent;let name=current.name(),cliName=resolveCliName();!name||name===cliName||(process.title=`${cliName}-${name}`)}const PLUGIN_REQUIRED_COMMANDS=new Set([`message`,`channels`,`directory`]);function registerPreActionHooks(program,programVersion){program.hook(`preAction`,async(_thisCommand,actionCommand)=>{setProcessTitleForCommand(actionCommand);let argv=process.argv;if(hasHelpOrVersion(argv))return;let commandPath=getCommandPath(argv,2);isTruthyEnvValue(process.env.BUILDERFORCE_AGENTS_HIDE_BANNER)||commandPath[0]===`update`||commandPath[0]===`completion`||commandPath[0]===`plugins`&&commandPath[1]===`update`||emitCliBanner(programVersion);let verbose=getVerboseFlag(argv,{includeDebug:!0});if(setVerbose(verbose),verbose||(process.env.NODE_NO_WARNINGS??=`1`),commandPath[0]===`doctor`||commandPath[0]===`completion`)return;let{ensureConfigReady}=await import(`./config-guard-B4in8l8I.js`);if(await ensureConfigReady({runtime:defaultRuntime,commandPath}),PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])){let{ensurePluginRegistryLoaded}=await import(`./plugin-registry-B-UOeWqM.js`);ensurePluginRegistryLoaded()}})}function buildProgram(){let program=new Command,ctx=createProgramContext(),argv=process.argv;return setProgramContext(program,ctx),configureProgramHelp(program,ctx),registerPreActionHooks(program,ctx.programVersion),registerProgramCommands(program,ctx,argv),program.option(`-m, --message <text>`,`Start a session and send this as the first message`).action(async opts=>{let{runBuilderForceAgentsSession}=await import(`./builderforce-wxtgU9xu.js`);await runBuilderForceAgentsSession(process.cwd(),{message:opts.message})}),program}export{buildProgram};
1
+ import"./paths-BHg-VHB4.js";import{c as hasHelpOrVersion,n as getCommandPath,o as getVerboseFlag}from"./argv-BgQk38nl.js";import"./registry-Cv7CoWAs.js";import{N as setVerbose,R as isRich,c as escapeRegExp,z as theme}from"./utils-BP60e80M.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import{t as isTruthyEnvValue}from"./env-BoE8QSib.js";import"./warning-filter-nSTjpMIH.js";import"./auth-profiles-C1VbcUOm.js";import{n as replaceCliName,r as resolveCliName}from"./command-format-DTMaGKs7.js";import"./src-DvWaTze9.js";import"./logger-wuOr7HKl.js";import"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-HrLX5bhG.js";import{U as VERSION}from"./io-CohJffHG.js";import"./manifest-registry-009gLJ4l.js";import"./config-toczWD3q.js";import"./model-discovery-C9Xm95uL.js";import"./model-catalog-CiiFJX77.js";import"./frontmatter-CaY7feZm.js";import"./skills-D3MwwPOH.js";import"./plugin-skills-pSFUbhg_.js";import"./refresh-C4vwneXT.js";import"./client-CGgp3zkQ.js";import"./call-DmAU4cRX.js";import"./message-channel-z5YRpR2d.js";import"./subagent-registry-CyGxu3kP.js";import"./sessions-Bl1wwotX.js";import"./project-context-store-CIUcwUP_.js";import"./tokens-CFKkpUIu.js";import"./plugins-1Mn6RiNf.js";import"./accounts-BkTLjSrD.js";import"./bindings-CKSDlQ1i.js";import"./send-BvroeIQ6.js";import"./send-CceNWtYE.js";import"./with-timeout-T07SJo4N.js";import"./deliver-BuZu68tp.js";import"./accounts-Cx82nj4E.js";import"./send-ByCVQQVz.js";import"./image-ops-CotJhwRR.js";import"./redact-CgO7wehS.js";import"./errors-tAt19c1E.js";import"./embedded-helpers-DK8_apW0.js";import"./sandbox-z9t_PRf9.js";import"./chrome-BnEbJV3D.js";import"./tailscale-DV-yOmYe.js";import"./auth-ChecwOXS.js";import"./server-context-owOmmyUM.js";import"./routes-lclJHOYY.js";import"./paths-BnOjueoX.js";import"./ssrf-DJXLYZ0d.js";import"./store-DHD2IEgd.js";import"./ports-DTku9NSx.js";import"./trash-C3zmJ_O7.js";import"./accounts-DcoaLXKI.js";import"./paths-ClsbsPQP.js";import"./tool-images-CCpqFtrL.js";import"./workspace-waBqRxiy.js";import"./reply-prefix-Cg7AqaK0.js";import"./sqlite-CIGM1WKg.js";import"./memory-cli-ivAs7q7v.js";import"./manager-CRba8roB.js";import"./gemini-auth-CkD5jCPh.js";import"./retry-B151Hej5.js";import"./common-BfwMxpLu.js";import"./runner-DwWmciCt.js";import"./tool-display-Cs4hDP1f.js";import"./chunk-Dly7lM4r.js";import"./markdown-tables-B1Rx8hv6.js";import"./fetch-guard-DnXqPKae.js";import"./fetch-Cn_THzz8.js";import"./ir-CSdQJPqu.js";import"./render-DlHYsbvQ.js";import"./builderforcellm-syscheck-CprBhARf.js";import"./session-utils-GMvum00v.js";import"./coding-tools.policy-NEPm7Mz1.js";import"./pairing-store-QDb6lhIU.js";import"./fetch-DnWD6ydH.js";import"./exec-approvals-D7ZPAZpt.js";import"./nodes-screen-D6GHv_S0.js";import"./session-cost-usage-S0nkbPoW.js";import"./usage-format-5sp5AMSu.js";import"./provider-usage-Bn4ZrnU7.js";import"./send-B_1BtyfA.js";import"./outbound-attachment-BaTYE4qp.js";import"./delivery-queue-Cp3t4Upn.js";import"./project-context-D3Mx4maV.js";import"./control-service-CJuuqNOE.js";import"./stagger-CRe77dWL.js";import"./channel-selection-BLwXhb9t.js";import"./send-UFtylOiq.js";import"./resolve-route-DEIW5uKy.js";import"./channel-activity-DX36RadH.js";import"./tables-CojSfTth.js";import{t as formatDocsLink}from"./links-BKzP7VVP.js";import"./cli-utils-C9pW69LF.js";import"./help-format-CfFf-w62.js";import"./progress-Cqb-jAjT.js";import"./replies-DbkT_5BV.js";import"./onboard-helpers-CckrS8_K.js";import"./prompt-style-BMWmaqSC.js";import"./pairing-labels-3j_iRYOO.js";import"./active-listener-Di9e1YAD.js";import"./mamba-state-engine-CV4nDcCk.js";import"./transformers-stream-Buj40qHl.js";import"./catalog-li4bSIE2.js";import"./plugin-registry-SAdxNUwm.js";import{n as resolveCliChannelOptions}from"./channel-options-d4EwVQD0.js";import{t as getSubCliCommandsWithSubcommands}from"./register.subclis-Cr9DoYcv.js";import{a as registerProgramCommands,n as getCoreCliCommandsWithSubcommands}from"./command-registry-COUcUWby.js";import{n as setProgramContext}from"./program-context-Wpc-6CdI.js";import"./ports-6RmfZEmk.js";import{n as formatCliBannerLine,r as hasEmittedCliBanner,t as emitCliBanner}from"./banner-DY-L7_eI.js";import{Command}from"commander";function createProgramContext(){let channelOptions=resolveCliChannelOptions();return{programVersion:VERSION,channelOptions,messageChannelOptions:channelOptions.join(`|`),agentChannelOptions:[`last`,...channelOptions].join(`|`)}}const CLI_NAME=resolveCliName(),CLI_NAME_PATTERN=escapeRegExp(CLI_NAME),ROOT_COMMANDS_WITH_SUBCOMMANDS=new Set([...getCoreCliCommandsWithSubcommands(),...getSubCliCommandsWithSubcommands()]),EXAMPLES=[[`builderforce models --help`,`Show detailed help for the models command.`],[`builderforce channels login --verbose`,`Link personal WhatsApp Web and show QR + connection logs.`],[`builderforce message send --target +15555550123 --message "Hi" --json`,`Send via your web session and print JSON result.`],[`builderforce gateway --port 18789`,`Run the WebSocket Gateway locally.`],[`builderforce --dev gateway`,`Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001.`],[`builderforce gateway --force`,`Kill anything bound to the default gateway port, then start it.`],[`builderforce gateway ...`,`Gateway control via WebSocket.`],[`builderforce agent --to +15555550123 --message "Run summary" --deliver`,`Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.`],[`builderforce message send --channel telegram --target @mychat --message "Hi"`,`Send via your Telegram bot.`]];function configureProgramHelp(program,ctx){program.name(CLI_NAME).description(``).version(ctx.programVersion).option(`--dev`,`Dev profile: isolate state under ~/.builderforce-dev, default gateway port 19001, and shift derived ports (browser/canvas)`).option(`--profile <name>`,`Use a named profile (isolates BUILDERFORCE_AGENTS_STATE_DIR/BUILDERFORCE_AGENTS_CONFIG_PATH under ~/.builderforce-<name>)`),program.option(`--no-color`,`Disable ANSI colors`,!1),program.helpOption(`-h, --help`,`Display help for command`),program.helpCommand(`help [command]`,`Display help for command`),program.configureHelp({sortSubcommands:!0,sortOptions:!0,optionTerm:option=>theme.option(option.flags),subcommandTerm:cmd=>{let hasSubcommands=cmd.parent===program&&ROOT_COMMANDS_WITH_SUBCOMMANDS.has(cmd.name());return theme.command(hasSubcommands?`${cmd.name()} *`:cmd.name())}});let formatHelpOutput=str=>{let output=str;return RegExp(`^Usage:\\s+${CLI_NAME_PATTERN}\\s+\\[options\\]\\s+\\[command\\]\\s*$`,`m`).test(output)&&/^Commands:/m.test(output)&&(output=output.replace(/^Commands:/m,`Commands:\n ${theme.muted(`Hint: commands suffixed with * have subcommands. Run <command> --help for details.`)}`)),output.replace(/^Usage:/gm,theme.heading(`Usage:`)).replace(/^Options:/gm,theme.heading(`Options:`)).replace(/^Commands:/gm,theme.heading(`Commands:`))};program.configureOutput({writeOut:str=>{process.stdout.write(formatHelpOutput(str))},writeErr:str=>{process.stderr.write(formatHelpOutput(str))},outputError:(str,write)=>write(theme.error(str))}),(process.argv.includes(`-V`)||process.argv.includes(`--version`)||process.argv.includes(`-v`))&&(console.log(ctx.programVersion),process.exit(0)),program.addHelpText(`beforeAll`,()=>{if(hasEmittedCliBanner())return``;let rich=isRich();return`\n${formatCliBannerLine(ctx.programVersion,{richTty:rich})}\n`});let fmtExamples=EXAMPLES.map(([cmd,desc])=>` ${theme.command(replaceCliName(cmd,CLI_NAME))}\n ${theme.muted(desc)}`).join(`
2
+ `);program.addHelpText(`afterAll`,({command})=>{if(command!==program)return``;let docs=formatDocsLink(`/cli`,`docs.builderforce.ai/cli`);return`\n${theme.heading(`Examples:`)}\n${fmtExamples}\n\n${theme.muted(`Docs:`)} ${docs}\n`})}function setProcessTitleForCommand(actionCommand){let current=actionCommand;for(;current.parent&&current.parent.parent;)current=current.parent;let name=current.name(),cliName=resolveCliName();!name||name===cliName||(process.title=`${cliName}-${name}`)}const PLUGIN_REQUIRED_COMMANDS=new Set([`message`,`channels`,`directory`]);function registerPreActionHooks(program,programVersion){program.hook(`preAction`,async(_thisCommand,actionCommand)=>{setProcessTitleForCommand(actionCommand);let argv=process.argv;if(hasHelpOrVersion(argv))return;let commandPath=getCommandPath(argv,2);isTruthyEnvValue(process.env.BUILDERFORCE_AGENTS_HIDE_BANNER)||commandPath[0]===`update`||commandPath[0]===`completion`||commandPath[0]===`plugins`&&commandPath[1]===`update`||emitCliBanner(programVersion);let verbose=getVerboseFlag(argv,{includeDebug:!0});if(setVerbose(verbose),verbose||(process.env.NODE_NO_WARNINGS??=`1`),commandPath[0]===`doctor`||commandPath[0]===`completion`)return;let{ensureConfigReady}=await import(`./config-guard-B4in8l8I.js`);if(await ensureConfigReady({runtime:defaultRuntime,commandPath}),PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])){let{ensurePluginRegistryLoaded}=await import(`./plugin-registry-B-UOeWqM.js`);ensurePluginRegistryLoaded()}})}function buildProgram(){let program=new Command,ctx=createProgramContext(),argv=process.argv;return setProgramContext(program,ctx),configureProgramHelp(program,ctx),registerPreActionHooks(program,ctx.programVersion),registerProgramCommands(program,ctx,argv),program.option(`-m, --message <text>`,`Start a session and send this as the first message`).action(async opts=>{let{runBuilderForceAgentsSession}=await import(`./builderforce-BmrsVdFw.js`);await runBuilderForceAgentsSession(process.cwd(),{message:opts.message})}),program}export{buildProgram};