@madarco/agentbox 0.22.1 → 0.22.2

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 (122) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/{_cloud-attach-YH2SU75S.js → _cloud-attach-Y5WZ7F53.js} +5 -5
  3. package/dist/{chunk-KBVD2UUQ.js → chunk-3KAWXDQ4.js} +3 -3
  4. package/dist/{chunk-YZXXBHWG.js → chunk-5DZTXHLQ.js} +3 -3
  5. package/dist/{chunk-O2NDZQHN.js → chunk-7HAGPF4X.js} +2 -2
  6. package/dist/{chunk-O67ZESNL.js → chunk-AYNGC4Z5.js} +4 -4
  7. package/dist/{chunk-GGWVTWJM.js → chunk-BMCT3LBE.js} +16 -13
  8. package/dist/chunk-BMCT3LBE.js.map +1 -0
  9. package/dist/{chunk-ALEYDWAO.js → chunk-ES2DDCAC.js} +303 -87
  10. package/dist/chunk-ES2DDCAC.js.map +1 -0
  11. package/dist/{chunk-VBSRJG53.js → chunk-QT3SHMLY.js} +9 -1
  12. package/dist/chunk-QT3SHMLY.js.map +1 -0
  13. package/dist/{chunk-CDEJ2GQK.js → chunk-S4OWE3UD.js} +4 -4
  14. package/dist/{chunk-W2FLHB54.js → chunk-V2NCCC2B.js} +2 -2
  15. package/dist/{dist-QBXEP4VY.js → dist-2BTJQUJS.js} +2 -2
  16. package/dist/{dist-LJHS4PTC.js → dist-AN5NUXA5.js} +6 -6
  17. package/dist/{dist-EJXUKIR7.js → dist-FNAGMTUI.js} +4 -4
  18. package/dist/{dist-YECTRVGD.js → dist-K5GASNBV.js} +6 -6
  19. package/dist/{dist-UR2DB2HT.js → dist-SJRMFVRV.js} +6 -6
  20. package/dist/{dist-QNV4H6NN.js → dist-VOVN64Y2.js} +6 -6
  21. package/dist/index.js +1108 -727
  22. package/dist/index.js.map +1 -1
  23. package/dist/{prepared-state-5FIGV4BE-BMUK63FD.js → prepared-state-5FIGV4BE-WPHOEDA6.js} +2 -2
  24. package/package.json +5 -5
  25. package/runtime/_shared/ctl.cjs +10 -0
  26. package/runtime/docker/packages/ctl/dist/bin.cjs +10 -0
  27. package/runtime/e2b/ctl.cjs +10 -0
  28. package/runtime/hetzner/ctl.cjs +10 -0
  29. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  30. package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +1 -0
  31. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  32. package/runtime/hub/apps/hub/.next/routes-manifest.json +8 -0
  33. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route/app-paths-manifest.json +3 -0
  34. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route/build-manifest.json +9 -0
  35. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route/server-reference-manifest.json +4 -0
  36. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js +9 -0
  37. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js.map +5 -0
  38. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js.nft.json +1 -0
  39. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route_client-reference-manifest.js +3 -0
  40. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
  41. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/server-reference-manifest.json +12 -0
  42. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
  43. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/server-reference-manifest.json +12 -0
  44. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  45. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/server-reference-manifest.json +12 -0
  46. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
  47. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  48. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  49. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  50. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  51. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  52. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  53. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  54. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  55. package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +1 -0
  56. package/runtime/hub/apps/hub/.next/server/chunks/0m4a_kysely_dist_095p8vu._.js +1 -1
  57. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_rename_route_actions_0mf3a9p.js +3 -0
  58. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +1 -1
  59. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
  60. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0szd4sh._.js +3 -0
  61. package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +14 -14
  62. package/runtime/hub/apps/hub/.next/server/chunks/_0lgs9kd._.js +3 -0
  63. package/runtime/hub/apps/hub/.next/server/chunks/ssr/044u_hub__next-internal_server_app_(dashboard)_projects_[id]_page_actions_15f56np.js +1 -1
  64. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_09gdzmo._.js +1 -1
  65. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ozyjt1._.js +1 -1
  66. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +1 -1
  67. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0tgpglr._.js +1 -1
  68. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_1laion6._.js +1 -1
  69. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_boxes_[id]_page_actions_0k7kgn2.js +1 -1
  70. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_page_actions_1t3u0xy.js +1 -1
  71. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_components_1z1p98f._.js +1 -1
  72. package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +1 -0
  73. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  74. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  75. package/runtime/hub/apps/hub/.next/server/server-reference-manifest.js +1 -1
  76. package/runtime/hub/apps/hub/.next/server/server-reference-manifest.json +24 -0
  77. package/runtime/hub/apps/hub/.next/static/chunks/2xc1sm79a6tsb.js +1 -0
  78. package/runtime/hub/apps/hub/.next/static/chunks/332lo0ac7l2wv.js +1 -0
  79. package/runtime/hub/apps/hub/.next/static/chunks/3gdqmzzl34ilu.js +1 -0
  80. package/runtime/hub/apps/hub/.next/static/chunks/44exu5uemf-ev.js +1 -0
  81. package/runtime/hub/apps/hub/{auth-YBXDRLHG.js → auth-675P3LQS.js} +2 -2
  82. package/runtime/hub/apps/hub/{auth-config-LJGI76HI.js → auth-config-AOBEKRZQ.js} +2 -2
  83. package/runtime/hub/apps/hub/{chunk-OBKLTPIR.js → chunk-56YQBVN2.js} +1 -1
  84. package/runtime/hub/apps/hub/{chunk-LJG4CEGS.js → chunk-5XQ3T3W2.js} +274 -84
  85. package/runtime/hub/apps/hub/{chunk-JDA7BPPN.js → chunk-673QOHSR.js} +3 -3
  86. package/runtime/hub/apps/hub/{chunk-V5KGFHCF.js → chunk-7J6ZFTT4.js} +2 -2
  87. package/runtime/hub/apps/hub/{chunk-AKLBSCSZ.js → chunk-EXQCBM5Q.js} +8 -0
  88. package/runtime/hub/apps/hub/{dist-GGM4BUKM.js → dist-EI54M5DP.js} +4 -4
  89. package/runtime/hub/apps/hub/{dist-ELOY2IUE.js → dist-GCALYJN7.js} +3 -3
  90. package/runtime/hub/apps/hub/{dist-FDBOJ74K.js → dist-K7WHNDZB.js} +4 -4
  91. package/runtime/hub/apps/hub/{dist-CM4YAQLI.js → dist-LYTWBTUL.js} +4 -4
  92. package/runtime/hub/apps/hub/{dist-BF54UNHK.js → dist-MOCUH2OC.js} +4 -4
  93. package/runtime/hub/apps/hub/{dist-IENF7YOD.js → dist-STQK5XM6.js} +1 -1
  94. package/runtime/hub/apps/hub/{hub-token-EW32VDIU.js → hub-token-2BZFBBW3.js} +2 -2
  95. package/runtime/hub/apps/hub/{prepared-state-5FIGV4BE-FIXKBF5A.js → prepared-state-5FIGV4BE-D2HJEY2L.js} +1 -1
  96. package/runtime/hub/apps/hub/server.js +57 -16
  97. package/runtime/relay/bin.cjs +10 -0
  98. package/runtime/vercel/ctl.cjs +10 -0
  99. package/dist/chunk-ALEYDWAO.js.map +0 -1
  100. package/dist/chunk-GGWVTWJM.js.map +0 -1
  101. package/dist/chunk-VBSRJG53.js.map +0 -1
  102. package/runtime/hub/apps/hub/.next/static/chunks/0lq354ziiwxxl.js +0 -1
  103. package/runtime/hub/apps/hub/.next/static/chunks/11vmjdy3390ik.js +0 -1
  104. package/runtime/hub/apps/hub/.next/static/chunks/1svigjdfotduh.js +0 -1
  105. package/runtime/hub/apps/hub/.next/static/chunks/2d5e6t-5j4etp.js +0 -1
  106. /package/dist/{_cloud-attach-YH2SU75S.js.map → _cloud-attach-Y5WZ7F53.js.map} +0 -0
  107. /package/dist/{chunk-KBVD2UUQ.js.map → chunk-3KAWXDQ4.js.map} +0 -0
  108. /package/dist/{chunk-YZXXBHWG.js.map → chunk-5DZTXHLQ.js.map} +0 -0
  109. /package/dist/{chunk-O2NDZQHN.js.map → chunk-7HAGPF4X.js.map} +0 -0
  110. /package/dist/{chunk-O67ZESNL.js.map → chunk-AYNGC4Z5.js.map} +0 -0
  111. /package/dist/{chunk-CDEJ2GQK.js.map → chunk-S4OWE3UD.js.map} +0 -0
  112. /package/dist/{chunk-W2FLHB54.js.map → chunk-V2NCCC2B.js.map} +0 -0
  113. /package/dist/{dist-EJXUKIR7.js.map → dist-2BTJQUJS.js.map} +0 -0
  114. /package/dist/{dist-LJHS4PTC.js.map → dist-AN5NUXA5.js.map} +0 -0
  115. /package/dist/{dist-QBXEP4VY.js.map → dist-FNAGMTUI.js.map} +0 -0
  116. /package/dist/{dist-QNV4H6NN.js.map → dist-K5GASNBV.js.map} +0 -0
  117. /package/dist/{dist-UR2DB2HT.js.map → dist-SJRMFVRV.js.map} +0 -0
  118. /package/dist/{dist-YECTRVGD.js.map → dist-VOVN64Y2.js.map} +0 -0
  119. /package/dist/{prepared-state-5FIGV4BE-BMUK63FD.js.map → prepared-state-5FIGV4BE-WPHOEDA6.js.map} +0 -0
  120. /package/runtime/hub/apps/hub/.next/static/{TpPTWVdZDxqrPlONtJcR5 → zT1paOSXMJpAPsZ1dFK2V}/_buildManifest.js +0 -0
  121. /package/runtime/hub/apps/hub/.next/static/{TpPTWVdZDxqrPlONtJcR5 → zT1paOSXMJpAPsZ1dFK2V}/_clientMiddlewareManifest.js +0 -0
  122. /package/runtime/hub/apps/hub/.next/static/{TpPTWVdZDxqrPlONtJcR5 → zT1paOSXMJpAPsZ1dFK2V}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/config/src/providers.ts","../../../packages/config/src/types.ts","../../../packages/config/src/parse.ts","../../../packages/config/src/paths.ts","../../../packages/config/src/load.ts","../../../packages/config/src/image.ts","../../../packages/config/src/checkpoint.ts","../../../packages/config/src/size.ts","../../../packages/config/src/write.ts"],"sourcesContent":["/**\n * Single source of truth for the set of sandbox providers.\n *\n * Adding one row to `PROVIDERS` is the *only* place a new provider's identity\n * has to be registered. This table drives, by derivation:\n * - the `ProviderKind` union (below),\n * - the `box.provider` enum + its description (see `types.ts`),\n * - the per-provider `box.image<P>` / `box.size<P>` / `box.defaultCheckpoint<P>`\n * entries in `KEY_REGISTRY` (generated in `types.ts`),\n * - the CLI's known/cloud provider lists, the install-wizard picker\n * labels/hints, the wizard's rebuild-time estimate, and the doctor groups.\n *\n * The interface fields on `UserConfig`/`EffectiveConfig` and the JSON schema\n * still list the per-provider keys explicitly (static types can't be generated\n * from a runtime array); a test (`test/providers.test.ts`) fails if either\n * drifts from this table.\n */\n\nexport interface ProviderMeta {\n /** Canonical name — MUST equal the `@agentbox/sandbox-<name>` package suffix. */\n readonly name: string;\n /** 'local' = docker; 'cloud' = has a CloudBackend + a prepared base snapshot. */\n readonly kind: 'local' | 'cloud';\n /** Human label for the install-wizard picker. */\n readonly label: string;\n /** One-line hint for the install-wizard picker. */\n readonly loginHint: string;\n /** Rough base-image/snapshot bake time (minutes) shown by the install wizard. */\n readonly rebuildMinutes: string;\n /** Fragment describing this backend, joined into the `box.provider` enum description. */\n readonly blurb: string;\n /** Description of the per-provider `box.size<P>` KEY_REGISTRY entry. */\n readonly sizeDesc: string;\n /** Description of the per-provider `box.image<P>` KEY_REGISTRY entry. */\n readonly imageDesc: string;\n}\n\nexport const PROVIDERS = [\n {\n name: 'docker',\n kind: 'local',\n label: 'Docker (local)',\n loginHint: 'builds a ~1GB local image; no login needed',\n rebuildMinutes: '1',\n blurb: 'local Docker containers',\n sizeDesc:\n 'Per-provider override of `box.size` for docker. Reserved — docker sizing is controlled via `box.memory` / `box.cpus` / `box.disk`.',\n imageDesc:\n 'Per-provider override of `box.image` for docker (local docker image ref, e.g. `agentbox/box:dev`). Wins over the generic when set.',\n },\n {\n name: 'daytona',\n kind: 'cloud',\n label: 'Daytona (cloud sandbox)',\n loginHint: 'approve a browser sign-in link',\n rebuildMinutes: '7',\n blurb: 'Daytona Cloud sandboxes',\n sizeDesc:\n 'Per-provider override of `box.size` for daytona. `cpu-memory-disk` GB spec (e.g. `4-8-20`). Only honored on the image/Dockerfile create path; Daytona rejects custom resources on snapshot-resume.',\n imageDesc:\n 'Per-provider override of `box.image` for daytona (named snapshot, e.g. `agentbox-base-<fingerprint>`). Written by `agentbox prepare --provider daytona`.',\n },\n {\n name: 'hetzner',\n kind: 'cloud',\n label: 'Hetzner (cloud VPS)',\n loginHint: 'paste an API token from the Hetzner Console',\n rebuildMinutes: '7-10',\n blurb: 'Hetzner Cloud VPSes',\n sizeDesc:\n 'Per-provider override of `box.size` for hetzner. Server type string (e.g. `cx23`, `cx33`, `cx43`).',\n imageDesc:\n 'Per-provider override of `box.image` for hetzner (image description, e.g. `agentbox-base-<fingerprint>`). Written by `agentbox prepare --provider hetzner`.',\n },\n {\n name: 'vercel',\n kind: 'cloud',\n label: 'Vercel (cloud microVM)',\n loginHint: 'installs the Vercel sandbox CLI, then a browser sign-in',\n rebuildMinutes: '5-10',\n blurb: 'Vercel Sandboxes',\n sizeDesc:\n 'Per-provider override of `box.size` for vercel. Reserved — vercel sizing is controlled via `box.vercelVcpus`.',\n imageDesc:\n 'Per-provider override of `box.image` for vercel (snapshot id, e.g. `snap_…`). Written by `agentbox prepare --provider vercel`.',\n },\n {\n name: 'e2b',\n kind: 'cloud',\n label: 'E2B (cloud microVM)',\n loginHint: 'paste an API key from the E2B dashboard',\n rebuildMinutes: '2',\n blurb: 'E2B microVMs',\n sizeDesc:\n 'Per-provider override of `box.size` for e2b. Reserved — e2b sizing is template-level (set at `agentbox prepare --provider e2b` time via --vcpus / --memory).',\n imageDesc:\n 'Per-provider override of `box.image` for e2b (template id or `name:tag`, e.g. `agentbox-base:latest`). Written by `agentbox prepare --provider e2b`.',\n },\n] as const satisfies readonly ProviderMeta[];\n\n/** Sandbox backend new boxes are created on. Derived from the `PROVIDERS` table. */\nexport type ProviderKind = (typeof PROVIDERS)[number]['name'];\n\n/** All provider names, in canonical order. */\nexport const PROVIDER_NAMES: readonly ProviderKind[] = PROVIDERS.map((p) => p.name);\n\n/** Cloud provider names only (everything except docker). */\nexport const CLOUD_PROVIDER_NAMES: readonly ProviderKind[] = PROVIDERS.filter(\n (p) => p.kind === 'cloud',\n).map((p) => p.name);\n\nexport function isProviderKind(name: string): name is ProviderKind {\n return (PROVIDER_NAMES as readonly string[]).includes(name);\n}\n\nexport function providerMeta(name: ProviderKind): ProviderMeta {\n const m = PROVIDERS.find((p) => p.name === name);\n if (!m) throw new Error(`unknown provider: ${String(name)}`);\n return m;\n}\n\n/**\n * Capitalize a provider name for its config-key suffix: `e2b` -> `E2b`,\n * `docker` -> `Docker`, `digitalocean` -> `Digitalocean`. First char upper,\n * the rest verbatim — matches the hand-written keys this table replaced.\n */\nexport function providerKeyCap(name: string): string {\n return name.charAt(0).toUpperCase() + name.slice(1);\n}\n\n/** Per-provider config key, e.g. `('image','hetzner')` -> `'box.imageHetzner'`. */\nexport function perProviderConfigKey(\n base: 'image' | 'size' | 'defaultCheckpoint',\n provider: string,\n): string {\n return `box.${base}${providerKeyCap(provider)}`;\n}\n","/**\n * Layered user config. The same shape is accepted at three layers:\n * - global ~/.agentbox/config.yaml\n * - project ~/.agentbox/projects/<hash>/config.yaml\n * - workspace defaults: block in ./agentbox.yaml\n *\n * Plus a CLI-flag layer at runtime. Precedence (highest wins):\n * cli > workspace > project > global > built-in defaults.\n */\n\nimport {\n PROVIDERS,\n PROVIDER_NAMES,\n perProviderConfigKey,\n type ProviderKind,\n} from './providers.js';\n\nexport type IdeFlavor = 'vscode' | 'cursor' | 'auto';\nexport type EngineKind = 'orbstack' | 'docker-desktop' | 'other' | 'auto';\nexport type BrowserKind = 'agent-browser' | 'playwright' | 'both';\n/** Sandbox backend new boxes are created on. Defined in `providers.ts` (the single source of truth) and re-exported here for back-compat. */\nexport type { ProviderKind };\n/**\n * How the base image/snapshot installs Claude Code at bake time. `native`\n * (Anthropic's installer, the default) or `npm` (`@anthropic-ai/claude-code`) —\n * an opt-in fallback for cloud egress IPs whose CDN the native installer 403s.\n */\nexport type ClaudeInstallMethod = 'native' | 'npm';\n/**\n * How a box's `git push` reaches GitHub:\n * - `relay` — the box asks the host relay to push with the HOST's credentials\n * (they never enter the box). Docker boxes always use this; for a cloud box it\n * runs through the host relay's cloud poller (git-bundle pull-back).\n * - `lease` — the relay/plane leases a short-lived GitHub-App token and the box\n * pushes directly with it (keeps working with the laptop off). Needs a\n * reachable relay/plane with a GitHub App configured.\n * - `auto` (default) — lease when a control plane is configured for the box\n * (`relay.controlPlaneUrl`), else relay. Today's behavior.\n * Docker boxes ignore this (always `relay` — they bind-mount the host `.git`).\n */\nexport type GitPushMode = 'auto' | 'relay' | 'lease';\n/** Where `agentbox claude|codex|opencode` opens the attached session when the host\n * shell is running inside tmux, cmux, Herdr, or iTerm2. `same` keeps today's inline behavior. */\nexport type AttachOpenIn = 'split' | 'window' | 'tab' | 'same';\n/** Where a background `-i` (queued) run opens the box once the worker has created\n * it. `none` (default) opens nothing — the historical behavior. The open is\n * driven by the host relay's queue worker when the box becomes ready, not at\n * submit time, so there is no `same` (inline) mode here. */\nexport type QueueOpenIn = 'none' | 'split' | 'window' | 'tab';\n\nexport interface UserConfig {\n /**\n * Config-file shape version. Stamped to `1` on first write so future\n * migrations (e.g. a renamed key, a leaf-shape change) have a stable\n * read-time discriminator. No behavioural effect yet — placeholder for\n * later. Loader strips it before merge so it never leaks into\n * `EffectiveConfig`.\n */\n schema?: number;\n box?: {\n provider?: ProviderKind;\n hostSnapshot?: boolean;\n defaultCheckpoint?: string;\n /** Per-provider override of `defaultCheckpoint`. Resolved before falling back to the global. */\n defaultCheckpointDocker?: string;\n defaultCheckpointDaytona?: string;\n defaultCheckpointHetzner?: string;\n defaultCheckpointVercel?: string;\n defaultCheckpointE2b?: string;\n /**\n * Generic VM-size fallback for cloud providers. Provider-interpreted:\n * Hetzner = server type string (e.g. `cx33`); Daytona = `cpu-memory-disk`\n * GB spec (e.g. `4-8-20`). Per-provider `size{Provider}` wins over this.\n * Docker/Vercel ignore it (Docker uses `memory`/`cpus`/`disk`; Vercel uses\n * `vercelVcpus`).\n */\n size?: string;\n sizeDocker?: string;\n sizeDaytona?: string;\n sizeHetzner?: string;\n sizeVercel?: string;\n sizeE2b?: string;\n withPlaywright?: boolean;\n /**\n * How the base image/snapshot installs Claude Code at bake time. Bake-time\n * only (read by `agentbox prepare`, not `create`); `npm` is a fallback for\n * cloud egress IPs the native installer's CDN 403s.\n */\n claudeInstall?: ClaudeInstallMethod;\n withEnv?: boolean;\n resyncOnStart?: boolean;\n vnc?: boolean;\n autoApproveHostActions?: boolean;\n autoApproveSafeHostActions?: boolean;\n isolateClaudeConfig?: boolean;\n isolateCodexConfig?: boolean;\n isolateOpencodeConfig?: boolean;\n image?: string;\n /**\n * Per-provider override of `image`. Written by `agentbox prepare\n * --provider <name>` so a daytona prepare can't poison a hetzner create.\n * Resolved before falling back to the generic.\n */\n imageDocker?: string;\n imageDaytona?: string;\n imageHetzner?: string;\n imageVercel?: string;\n imageE2b?: string;\n imageRegistry?: string;\n dockerCacheShared?: boolean;\n memory?: number;\n cpus?: number;\n pidsLimit?: number;\n disk?: string;\n bundleDepth?: number;\n vercelVcpus?: number;\n vercelTimeoutMs?: number;\n vercelNetworkPolicy?: string;\n e2bTimeoutMs?: number;\n cpMaxBytes?: number;\n };\n checkpoint?: {\n maxLayers?: number;\n };\n claude?: {\n sessionName?: string;\n dangerouslySkipPermissions?: boolean;\n };\n codex?: {\n sessionName?: string;\n dangerouslySkipPermissions?: boolean;\n };\n opencode?: {\n sessionName?: string;\n };\n attach?: {\n openIn?: AttachOpenIn;\n cmuxStatus?: boolean;\n herdrStatus?: boolean;\n };\n code?: {\n ide?: IdeFlavor;\n wait?: boolean;\n timeoutMs?: number;\n autoTerminals?: boolean;\n };\n shell?: {\n user?: string;\n login?: boolean;\n tmux?: boolean;\n };\n ssh?: {\n autoConfig?: boolean;\n };\n engine?: {\n kind?: EngineKind;\n };\n browser?: {\n default?: BrowserKind;\n };\n relay?: {\n port?: number;\n /**\n * Public HTTPS URL of a deployed control plane (the hosted Next.js +\n * Postgres app). When set, newly created cloud boxes point at it for their\n * centralized concerns — git-token leasing, permission state, the box\n * registry/events — and push to GitHub directly with a leased token, so\n * they keep working with the laptop off. Empty/unset = laptop-local relay\n * (the default). Set via `agentbox control-plane set-url`.\n */\n controlPlaneUrl?: string;\n };\n git?: {\n pushMode?: GitPushMode;\n };\n vnc?: {\n containerPort?: number;\n };\n portless?: {\n enabled?: boolean;\n stateDir?: string;\n };\n autopause?: {\n enabled?: boolean;\n maxRunningBoxes?: number;\n idleMinutes?: number;\n };\n queue?: {\n enabled?: boolean;\n maxConcurrent?: number;\n maxWorking?: number;\n idleGraceSeconds?: number;\n openIn?: QueueOpenIn;\n };\n cloud?: {\n useCurrentBranch?: boolean;\n };\n maintenance?: {\n pruneProjectConfigs?: boolean;\n pruneProjectConfigsEvery?: number;\n };\n integrations?: {\n notion?: {\n enabled?: boolean;\n };\n linear?: {\n enabled?: boolean;\n };\n };\n}\n\n/**\n * Required-everywhere variant returned as the merged effective config. Each\n * leaf is filled from BUILT_IN_DEFAULTS when no layer set it.\n *\n * `box.hostSnapshot` and `portless.enabled` are intentionally\n * `boolean | undefined` (unprompted): the default is \"ask the user\", expressed\n * as undefined.\n */\nexport interface EffectiveConfig {\n box: {\n provider: ProviderKind;\n hostSnapshot: boolean | undefined;\n defaultCheckpoint: string;\n defaultCheckpointDocker: string;\n defaultCheckpointDaytona: string;\n defaultCheckpointHetzner: string;\n defaultCheckpointVercel: string;\n defaultCheckpointE2b: string;\n size: string;\n sizeDocker: string;\n sizeDaytona: string;\n sizeHetzner: string;\n sizeVercel: string;\n sizeE2b: string;\n withPlaywright: boolean;\n claudeInstall: ClaudeInstallMethod;\n withEnv: boolean;\n resyncOnStart: boolean;\n vnc: boolean;\n autoApproveHostActions: boolean;\n autoApproveSafeHostActions: boolean;\n isolateClaudeConfig: boolean;\n isolateCodexConfig: boolean;\n isolateOpencodeConfig: boolean;\n image: string;\n imageDocker: string;\n imageDaytona: string;\n imageHetzner: string;\n imageVercel: string;\n imageE2b: string;\n imageRegistry: string;\n dockerCacheShared: boolean;\n memory: number;\n cpus: number;\n pidsLimit: number;\n disk: string;\n bundleDepth: number | undefined;\n vercelVcpus: number;\n vercelTimeoutMs: number;\n vercelNetworkPolicy: string;\n e2bTimeoutMs: number;\n cpMaxBytes: number;\n };\n checkpoint: {\n maxLayers: number;\n };\n claude: {\n sessionName: string;\n dangerouslySkipPermissions: boolean;\n };\n codex: {\n sessionName: string;\n dangerouslySkipPermissions: boolean;\n };\n opencode: {\n sessionName: string;\n };\n attach: {\n openIn: AttachOpenIn;\n cmuxStatus: boolean;\n herdrStatus: boolean;\n };\n code: {\n ide: IdeFlavor;\n wait: boolean;\n timeoutMs: number;\n autoTerminals: boolean;\n };\n shell: {\n user: string;\n login: boolean;\n tmux: boolean;\n };\n ssh: {\n autoConfig: boolean;\n };\n engine: {\n kind: EngineKind;\n };\n browser: {\n default: BrowserKind;\n };\n relay: {\n port: number;\n controlPlaneUrl: string | undefined;\n };\n git: {\n pushMode: GitPushMode;\n };\n vnc: {\n containerPort: number;\n };\n portless: {\n enabled: boolean | undefined;\n stateDir: string;\n };\n autopause: {\n enabled: boolean;\n maxRunningBoxes: number;\n idleMinutes: number;\n };\n queue: {\n enabled: boolean;\n maxConcurrent: number;\n maxWorking: number;\n idleGraceSeconds: number;\n openIn: QueueOpenIn;\n };\n cloud: {\n useCurrentBranch: boolean;\n };\n maintenance: {\n pruneProjectConfigs: boolean;\n pruneProjectConfigsEvery: number;\n };\n integrations: {\n notion: {\n enabled: boolean;\n };\n linear: {\n enabled: boolean;\n };\n };\n}\n\nexport type ConfigSource = 'cli' | 'workspace' | 'project' | 'global' | 'default';\n\nexport interface ConfigLayer {\n source: ConfigSource;\n /** File path the layer was loaded from. Absent for `cli` and `default`. */\n path?: string;\n values: Partial<UserConfig>;\n}\n\nexport interface LoadedConfig {\n effective: EffectiveConfig;\n layers: {\n cli: { values: Partial<UserConfig> };\n workspace: { path: string | null; values: Partial<UserConfig> };\n project: { path: string; values: Partial<UserConfig> };\n global: { path: string; values: Partial<UserConfig> };\n defaults: EffectiveConfig;\n };\n /** Per-leaf source map: 'box.hostSnapshot' -> 'workspace'. Powers `config get --all`. */\n sources: Record<string, ConfigSource>;\n /** Resolved project root used for the project layer (cwd if no agentbox.yaml found). */\n projectRoot: string;\n projectHash: string;\n /** True if we walked up to an agentbox.yaml; false if we fell back to cwd. */\n hasAgentboxYaml: boolean;\n}\n\nexport const BUILT_IN_DEFAULTS: EffectiveConfig = {\n box: {\n provider: 'docker',\n hostSnapshot: undefined,\n defaultCheckpoint: '',\n defaultCheckpointDocker: '',\n defaultCheckpointDaytona: '',\n defaultCheckpointHetzner: '',\n defaultCheckpointVercel: '',\n defaultCheckpointE2b: '',\n size: '',\n sizeDocker: '',\n sizeDaytona: '',\n sizeHetzner: '',\n sizeVercel: '',\n sizeE2b: '',\n withPlaywright: false,\n claudeInstall: 'native',\n withEnv: false,\n resyncOnStart: true,\n vnc: true,\n autoApproveHostActions: false,\n autoApproveSafeHostActions: true,\n isolateClaudeConfig: false,\n isolateCodexConfig: false,\n isolateOpencodeConfig: false,\n image: 'agentbox/box:dev',\n imageDocker: '',\n imageDaytona: '',\n imageHetzner: '',\n imageVercel: '',\n imageE2b: '',\n // Mirrors BOX_IMAGE_REGISTRY in @agentbox/sandbox-docker. Empty disables the\n // registry pull (always build the docker base image locally).\n imageRegistry: 'ghcr.io/madarco/agentbox/box',\n dockerCacheShared: false,\n memory: 0,\n cpus: 0,\n pidsLimit: 0,\n disk: '',\n bundleDepth: undefined,\n vercelVcpus: 2,\n vercelTimeoutMs: 2_700_000,\n vercelNetworkPolicy: '',\n e2bTimeoutMs: 2_700_000,\n cpMaxBytes: 100 * 1024 * 1024,\n },\n checkpoint: {\n maxLayers: 3,\n },\n claude: {\n sessionName: 'claude',\n dangerouslySkipPermissions: true,\n },\n codex: {\n sessionName: 'codex',\n dangerouslySkipPermissions: true,\n },\n opencode: {\n sessionName: 'opencode',\n },\n attach: {\n openIn: 'split',\n cmuxStatus: true,\n herdrStatus: true,\n },\n code: {\n ide: 'auto',\n wait: true,\n timeoutMs: 120_000,\n autoTerminals: true,\n },\n shell: {\n user: 'vscode',\n login: true,\n tmux: true,\n },\n ssh: {\n autoConfig: true,\n },\n engine: {\n kind: 'auto',\n },\n browser: {\n default: 'agent-browser',\n },\n relay: {\n port: 8787,\n controlPlaneUrl: undefined,\n },\n git: {\n pushMode: 'auto',\n },\n vnc: {\n containerPort: 6080,\n },\n portless: {\n enabled: undefined,\n stateDir: '',\n },\n autopause: {\n enabled: true,\n maxRunningBoxes: 5,\n idleMinutes: 5,\n },\n queue: {\n enabled: true,\n maxConcurrent: 5,\n maxWorking: 0,\n idleGraceSeconds: 15,\n openIn: 'none',\n },\n cloud: {\n useCurrentBranch: false,\n },\n maintenance: {\n pruneProjectConfigs: true,\n pruneProjectConfigsEvery: 50,\n },\n integrations: {\n notion: { enabled: false },\n linear: { enabled: false },\n },\n};\n\nexport type KeyType = 'bool' | 'string' | 'int' | 'enum';\n\nexport interface KeyDescriptor {\n /** Dot-path, e.g. \"box.snapshot\". */\n key: string;\n type: KeyType;\n enumValues?: readonly string[];\n description: string;\n /** True for keys most users shouldn't touch (image, ports). Hidden from `list` by default. */\n advanced?: boolean;\n}\n\n/** Join blurbs into \"a, b, c, or d\" for the enum description. */\nfunction joinOr(items: readonly string[]): string {\n if (items.length <= 1) return items.join('');\n return `${items.slice(0, -1).join(', ')}, or ${items[items.length - 1]}`;\n}\n\n/**\n * Per-provider config-key descriptors generated from the `PROVIDERS` table so a\n * new provider gets its `box.defaultCheckpoint<P>` / `box.size<P>` /\n * `box.image<P>` entries automatically. The `size`/`image` descriptions come\n * from the table (they carry provider-specific detail); the checkpoint one is\n * uniform.\n */\nfunction perProviderCheckpointKeys(): KeyDescriptor[] {\n return PROVIDERS.map((p) => ({\n key: perProviderConfigKey('defaultCheckpoint', p.name),\n type: 'string',\n description: `Per-provider override of \\`box.defaultCheckpoint\\` for ${p.name}. Wins over the global when set; set via \\`agentbox checkpoint set-default --provider ${p.name}\\`.`,\n advanced: true,\n }));\n}\nfunction perProviderSizeKeys(): KeyDescriptor[] {\n return PROVIDERS.map((p) => ({\n key: perProviderConfigKey('size', p.name),\n type: 'string',\n description: p.sizeDesc,\n advanced: true,\n }));\n}\nfunction perProviderImageKeys(): KeyDescriptor[] {\n return PROVIDERS.map((p) => ({\n key: perProviderConfigKey('image', p.name),\n type: 'string',\n description: p.imageDesc,\n advanced: true,\n }));\n}\n\n/**\n * Single source of truth for which keys are addressable from the CLI. The\n * parser, `set`/`unset`, and `list` all walk this. Adding a key here is the\n * one place a new field has to be registered (plus the type interface above\n * and the JSON schema). Per-provider `box.{image,size,defaultCheckpoint}<P>`\n * keys are generated from the `PROVIDERS` table (see `providers.ts`).\n */\nexport const KEY_REGISTRY: readonly KeyDescriptor[] = [\n {\n key: 'box.provider',\n type: 'enum',\n enumValues: PROVIDER_NAMES,\n description: `Sandbox backend new boxes are created on: ${joinOr(PROVIDERS.map((p) => p.blurb))}.`,\n },\n {\n key: 'box.hostSnapshot',\n type: 'bool',\n description:\n 'Use a frozen APFS clone of the host workspace as the overlay lower (default: prompt). Was box.snapshot.',\n },\n {\n key: 'box.defaultCheckpoint',\n type: 'string',\n description:\n 'Checkpoint ref new boxes in this project start from when --snapshot is not given (set via `agentbox checkpoint set-default`). Used as fallback when no per-provider override is set.',\n },\n ...perProviderCheckpointKeys(),\n {\n key: 'box.size',\n type: 'string',\n description:\n 'Default VM size for cloud providers. Provider-interpreted: hetzner = server type (e.g. `cx33`); daytona = `cpu-memory-disk` GB (e.g. `4-8-20`). Used as fallback when no per-provider override is set. Docker/Vercel ignore it.',\n },\n ...perProviderSizeKeys(),\n {\n key: 'checkpoint.maxLayers',\n type: 'int',\n description:\n 'Max stacked checkpoint layers before a new checkpoint is materialized merged (flattened) instead of layered.',\n advanced: true,\n },\n {\n key: 'box.withPlaywright',\n type: 'bool',\n description: 'Install @playwright/cli@latest in the box at create time.',\n },\n {\n key: 'box.claudeInstall',\n type: 'enum',\n enumValues: ['native', 'npm'] as const,\n description:\n \"How `agentbox prepare` installs Claude Code into the base image/snapshot: `native` (Anthropic's installer, the default) or `npm` (@anthropic-ai/claude-code). A fallback for cloud egress IPs the native installer's CDN 403s. Bake-time only — change it, then re-run `agentbox prepare --provider <name>`.\",\n },\n {\n key: 'box.withEnv',\n type: 'bool',\n description:\n 'Copy host env/config files (.env*, secrets.toml, agentbox.yaml, ...) into /workspace at box create time (gitignore-bypassing).',\n },\n {\n key: 'box.resyncOnStart',\n type: 'bool',\n description:\n \"Merge the host's current branch into the box and overlay the host's uncommitted/untracked changes when starting an agent session (keeps the box's version on conflict and warns the agent).\",\n },\n {\n key: 'box.vnc',\n type: 'bool',\n description: 'Run the per-box Xvnc + noVNC stack.',\n },\n {\n key: 'box.autoApproveHostActions',\n type: 'bool',\n description:\n 'Auto-approve host-action confirmations (git push, cp host<->box, gh PR writes, checkpoint) for this box without an interactive prompt. Off by default; intended for unattended orchestration of trusted boxes. Each auto-approval is recorded as a relay event (visible in `agentbox agent` / the dashboard).',\n },\n {\n key: 'box.autoApproveSafeHostActions',\n type: 'bool',\n description:\n 'Auto-approve the SAFE subset of host actions without a prompt: opening a PR, PR/review comments, re-running CI, pushing to the box\\'s scratch or host-sanctioned branch, checkpoints, integration writes, and file copy/download that stays inside the box project folder (non-secret). Uncontained or secret file transfers, non-sanctioned-branch pushes, and PR merge/checkout still prompt. On by default; set false to prompt for every host action (the pre-relax behavior). Superseded by box.autoApproveHostActions, which approves everything. Each auto-approval is recorded as a relay event.',\n },\n {\n key: 'box.isolateClaudeConfig',\n type: 'bool',\n description: 'Use a per-box ~/.claude volume instead of the shared one.',\n },\n {\n key: 'box.isolateCodexConfig',\n type: 'bool',\n description: 'Use a per-box ~/.codex volume instead of the shared one.',\n },\n {\n key: 'box.isolateOpencodeConfig',\n type: 'bool',\n description: 'Use a per-box OpenCode config/data volume instead of the shared one.',\n },\n {\n key: 'box.image',\n type: 'string',\n description: 'Generic box image ref (fallback). Used as fallback when no per-provider override is set; the default `agentbox/box:dev` is treated as a sentinel by cloud backends (boot from their prepared base snapshot instead).',\n advanced: true,\n },\n ...perProviderImageKeys(),\n {\n key: 'box.imageRegistry',\n type: 'string',\n description:\n 'Registry repo to pull the prebuilt docker base image from before building locally. Empty = always build. Docker only (advanced).',\n advanced: true,\n },\n {\n key: 'box.dockerCacheShared',\n type: 'bool',\n description:\n \"Share the in-box docker image cache across boxes via the 'agentbox-docker-cache' volume (preserved on destroy/prune; only one box can run at a time when set).\",\n },\n {\n key: 'box.memory',\n type: 'int',\n description:\n 'Hard memory ceiling in MiB for new boxes (0 = unlimited). Use --memory on create/claude for byte/k/m/g strings.',\n },\n {\n key: 'box.cpus',\n type: 'int',\n description:\n 'CPU count cap for new boxes (0 = unlimited). Whole cores via config; use --cpus for fractional (e.g. 1.5).',\n },\n {\n key: 'box.pidsLimit',\n type: 'int',\n description: 'Max process count (PIDs cgroup) for new boxes (0 = unlimited).',\n },\n {\n key: 'box.disk',\n type: 'string',\n description:\n \"Best-effort writable-layer size for new boxes, e.g. '10G'. No-op on overlay2 / the macOS engines.\",\n advanced: true,\n },\n {\n key: 'box.bundleDepth',\n type: 'int',\n description:\n 'Cap git bundle history shipped to cloud sandboxes (daytona, hetzner). 0 = full history. Unset = adaptive default (last 200 commits; re-bundle at 100 if the bundle exceeds 20 MB). Ignored for docker (which bind-mounts .git/).',\n },\n {\n key: 'box.vercelVcpus',\n type: 'int',\n description:\n 'vCPUs for new --provider vercel boxes (Vercel couples RAM at 2048 MB/vCPU). Default 2. Vercel only accepts specific counts (e.g. 1, 2, 4, 8) — an unsupported value fails create with a 400. Vercel-only; ignored by other providers.',\n },\n {\n key: 'box.vercelTimeoutMs',\n type: 'int',\n description:\n 'Max session length (ms) for new --provider vercel boxes before the VM auto-snapshots; persistent mode auto-resumes on the next call. Default 2700000 (45 min, the Hobby ceiling). Vercel-only.',\n },\n {\n key: 'box.e2bTimeoutMs',\n type: 'int',\n description:\n 'Session timeout (ms) a new --provider e2b box is created with, before E2B auto-pauses it on inactivity. The host keepalive loop pushes this forward while the agent is working. Default 2700000 (45 min); the Hobby tier caps total session at ~1 h regardless. E2B-only.',\n },\n {\n key: 'box.cpMaxBytes',\n type: 'int',\n description:\n 'Max bytes a single host→box copy may transfer after excludes, shared by `agentbox cp` (blocked with a size breakdown unless --yes) and each `carry:` entry (rejected at resolve time). Default 104857600 (100 MiB).',\n advanced: true,\n },\n {\n key: 'box.vercelNetworkPolicy',\n type: 'string',\n description:\n \"Egress lock for new --provider vercel boxes: 'allow-all' (default, unset), 'deny-all', or a comma-separated domain allowlist (e.g. 'github.com,*.npmjs.org') that denies everything else. Vercel-only; ignored by other providers.\",\n },\n {\n key: 'claude.sessionName',\n type: 'string',\n description: 'tmux session name for `agentbox claude`.',\n },\n {\n key: 'claude.dangerouslySkipPermissions',\n type: 'bool',\n description:\n 'Launch claude in new boxes with --dangerously-skip-permissions (auto-accept tool use). Safe because boxes are isolated; on by default. Override per-box with --no-dangerously-skip-permissions.',\n },\n {\n key: 'codex.sessionName',\n type: 'string',\n description: 'tmux session name for `agentbox codex`.',\n },\n {\n key: 'codex.dangerouslySkipPermissions',\n type: 'bool',\n description:\n 'Launch codex in new boxes with --dangerously-bypass-approvals-and-sandbox (never prompt for approval). Safe because boxes are isolated; on by default. Override per-box with --no-dangerously-skip-permissions.',\n },\n {\n key: 'opencode.sessionName',\n type: 'string',\n description: 'tmux session name for `agentbox opencode`.',\n },\n {\n key: 'attach.openIn',\n type: 'enum',\n enumValues: ['split', 'window', 'tab', 'same'] as const,\n description:\n 'Where `agentbox claude|codex|opencode` opens the attached session when run from tmux, cmux, Herdr, or iTerm2: `split` (tmux split-window / cmux new-split / Herdr pane.split / iTerm2 vertical split, default — same workspace), `window` (tmux new-window / cmux new-workspace / Herdr workspace.create / new iTerm2 window), `tab` (tmux new-window / cmux new-surface / Herdr tab.create in the current workspace / new iTerm2 tab), or `same` (attach inline in the current terminal). Outside tmux/cmux/Herdr/iTerm2 every value behaves like `same`.',\n },\n {\n key: 'attach.cmuxStatus',\n type: 'bool',\n description:\n \"When attached inside cmux, reflect the box agent's live activity on its cmux workspace (colour + description: blue=working, amber=needs input, idle clears; restored on detach) and, when the agent needs input, flag the box's own tab via a cmux notification (tab badge + reorder + desktop notification) so it stands out among sibling tabs. cmux only; no-op in other terminals.\",\n },\n {\n key: 'attach.herdrStatus',\n type: 'bool',\n description:\n \"When attached inside Herdr, report the box agent's live activity to its Herdr pane (pane.report_agent: working / blocked / idle) so it looks like a normal agent pane and Herdr handles needs-input natively, and fire a Herdr notification for AgentBox's own host-relay approval prompts (git push / PR / checkpoint …) which Herdr can't otherwise see. Herdr only; no-op in other terminals.\",\n },\n {\n key: 'code.ide',\n type: 'enum',\n enumValues: ['vscode', 'cursor', 'auto'] as const,\n description: 'Which IDE `agentbox code` launches; \"auto\" prefers code, falls back to cursor.',\n },\n {\n key: 'code.wait',\n type: 'bool',\n description: 'Block on agentbox-ctl wait-ready before opening the IDE.',\n },\n {\n key: 'code.timeoutMs',\n type: 'int',\n description: 'wait-ready timeout in milliseconds.',\n },\n {\n key: 'code.autoTerminals',\n type: 'bool',\n description: 'Generate /workspace/.vscode/tasks.json so the IDE auto-opens log panels.',\n },\n {\n key: 'shell.user',\n type: 'string',\n description: 'Default in-container user for `agentbox shell`.',\n },\n {\n key: 'shell.login',\n type: 'bool',\n description: 'Pass `-l` to bash so the login profile loads.',\n },\n {\n key: 'shell.tmux',\n type: 'bool',\n description: 'Run `agentbox shell` inside a detachable tmux session (Ctrl+a d to detach).',\n },\n {\n key: 'ssh.autoConfig',\n type: 'bool',\n description:\n 'Automatically write a `~/.agentbox/ssh/config` entry (Include\\'d from `~/.ssh/config`) for SSH-capable cloud boxes on create and start/resume, so `ssh <box>` just works. On by default; set false if you manage `~/.ssh/config` yourself. Explicit `agentbox shell --ssh-config`/`code`/`open` still write on demand regardless.',\n },\n {\n key: 'engine.kind',\n type: 'enum',\n enumValues: ['orbstack', 'docker-desktop', 'other', 'auto'] as const,\n description: 'Override the docker-engine auto-detection (used for OrbStack-only optimisations).',\n },\n {\n key: 'browser.default',\n type: 'enum',\n enumValues: ['agent-browser', 'playwright', 'both'] as const,\n description: 'Default browser stack inside the box. \"playwright\" or \"both\" implies box.withPlaywright.',\n },\n {\n key: 'relay.port',\n type: 'int',\n description: 'Host relay TCP port (advanced).',\n advanced: true,\n },\n {\n key: 'relay.controlPlaneUrl',\n type: 'string',\n description:\n 'Public HTTPS URL of a deployed control plane (hosted Next.js + Postgres app). When set, new cloud boxes point at it for git-token leasing, permission state, and the box registry/events, and push to GitHub directly with a leased token so they keep working with the laptop off. Set via `agentbox control-plane set-url`.',\n },\n {\n key: 'git.pushMode',\n type: 'enum',\n enumValues: ['auto', 'relay', 'lease'] as const,\n description:\n \"How a box's `git push` reaches GitHub: `relay` (the host relay pushes with your host credentials — they never enter the box), `lease` (the relay/plane leases a short-lived GitHub-App token and the box pushes directly, so it works with the laptop off), or `auto` (default — lease when `relay.controlPlaneUrl` is set for the box, else relay). Only affects cloud boxes; docker boxes always use `relay`. Forcing `relay` needs a reachable host relay for the box; forcing `lease` needs a reachable relay/plane with a GitHub App.\",\n },\n {\n key: 'vnc.containerPort',\n type: 'int',\n description: 'Container-side noVNC port (advanced).',\n advanced: true,\n },\n {\n key: 'portless.enabled',\n type: 'bool',\n description:\n 'Map each box web app to a https://<box-name>.localhost URL via the Portless proxy (Docker Desktop only; OrbStack already has .orb.local). Default: prompt.',\n },\n {\n key: 'portless.stateDir',\n type: 'string',\n description:\n 'Host Portless state directory to share into boxes (advanced; default: Portless’s own location).',\n advanced: true,\n },\n {\n key: 'autopause.enabled',\n type: 'bool',\n description:\n 'Let the host relay periodically pause idle boxes when more than autopause.maxRunningBoxes are running.',\n },\n {\n key: 'autopause.maxRunningBoxes',\n type: 'int',\n description:\n 'Target maximum number of simultaneously-running boxes before idle ones get auto-paused.',\n },\n {\n key: 'autopause.idleMinutes',\n type: 'int',\n description:\n 'Minutes a box must be continuously idle (claude state) before it is eligible for auto-pause.',\n },\n {\n key: 'queue.enabled',\n type: 'bool',\n description:\n 'Run `agentbox claude|codex|opencode -i <prompt>` jobs through the host-wide background queue (FIFO, capped by queue.maxConcurrent).',\n },\n {\n key: 'queue.maxConcurrent',\n type: 'int',\n description:\n 'Max number of simultaneously-running boxes (across providers) before background `-i` jobs queue up instead of starting immediately. Per-invocation override: `--max-running <n>`.',\n },\n {\n key: 'queue.maxWorking',\n type: 'int',\n description:\n 'Max agents actively working/thinking (quota-consuming) at once before background `-i` jobs queue. 0 = disabled (use the queue.maxConcurrent running-box gate). Counts all boxes, foreground + queued. Per-invocation override: `--max-working <n>`.',\n },\n {\n key: 'queue.idleGraceSeconds',\n type: 'int',\n description:\n 'Seconds an agent must stay non-working before it frees its working slot (debounce against brief idle flaps between turns). Only used when queue.maxWorking > 0.',\n },\n {\n key: 'queue.openIn',\n type: 'enum',\n enumValues: ['none', 'split', 'window', 'tab'] as const,\n description:\n 'When a background `-i` job finishes creating its box, where the host relay opens an attached terminal onto it: `none` (default — open nothing, just queue), `split`, `window`, or `tab`. Honored only when the submitting shell runs inside tmux, cmux, Herdr, or iTerm2 (the targeting is captured at submit time). Under cmux, `split` splits the pane you submitted from (falling back to the parent workspace, then a new workspace), `tab` adds a tab in the parent workspace, and `window` opens a separate workspace; under Herdr, `split` splits the pane you submitted from, `tab` adds a tab in the parent workspace, and `window` opens a separate workspace; iTerm2 opens relative to the frontmost window. Unlike `attach.openIn` there is no `same` mode — the box is created asynchronously, so it is always a fresh terminal.',\n },\n {\n key: 'cloud.useCurrentBranch',\n type: 'bool',\n description:\n \"On cloud providers (daytona/hetzner), start new boxes on the host's current branch instead of forking a new agentbox/<box-name> branch. Overridden by an explicit --use-branch / --from-branch.\",\n },\n {\n key: 'maintenance.pruneProjectConfigs',\n type: 'bool',\n description:\n 'Periodically delete ~/.agentbox/projects/<hash>/ dirs whose source workspace folder no longer exists.',\n },\n {\n key: 'maintenance.pruneProjectConfigsEvery',\n type: 'int',\n description: 'Run the orphan project-config sweep every N successful `agentbox create`.',\n },\n {\n key: 'integrations.notion.enabled',\n type: 'bool',\n description:\n 'Enable the in-box Notion integration shim (`ntn`/`notion` commands routed via the host relay). When false (default), the relay refuses dispatch with a clear \"disabled\" error and no host process is touched.',\n },\n {\n key: 'integrations.linear.enabled',\n type: 'bool',\n description:\n 'Enable the in-box Linear integration shim (`linear` commands routed via the host relay; backed by `@schpet/linear-cli`). When false (default), the relay refuses dispatch with a clear \"disabled\" error and no host process is touched.',\n },\n];\n\nconst REGISTRY_BY_KEY = new Map<string, KeyDescriptor>(KEY_REGISTRY.map((d) => [d.key, d]));\n\nexport function lookupKey(key: string): KeyDescriptor | undefined {\n return REGISTRY_BY_KEY.get(key);\n}\n\nexport class UserConfigError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UserConfigError';\n }\n}\n\nexport type ConfigScope = 'global' | 'project';\n","import { parse as parseYaml } from 'yaml';\nimport {\n KEY_REGISTRY,\n type KeyDescriptor,\n type UserConfig,\n UserConfigError,\n} from './types.js';\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n return typeof v === 'object' && v !== null && !Array.isArray(v);\n}\n\n/** Keys removed in a rename. Surfaced with a migration hint instead of a bare \"unknown key\". */\nconst RENAMED_KEYS: ReadonlyMap<string, string> = new Map([['box.snapshot', 'box.hostSnapshot']]);\n\ninterface BranchSpec {\n name: string;\n /** Map of leaf-key (dot-suffix) → descriptor whose `key` starts with this branch. */\n leaves: Map<string, KeyDescriptor>;\n}\n\nconst BRANCHES: Map<string, BranchSpec> = (() => {\n const out = new Map<string, BranchSpec>();\n for (const desc of KEY_REGISTRY) {\n const idx = desc.key.indexOf('.');\n if (idx < 0) {\n throw new Error(`KEY_REGISTRY entry ${desc.key} must use dot-path form (branch.leaf)`);\n }\n const branch = desc.key.slice(0, idx);\n const leaf = desc.key.slice(idx + 1);\n let entry = out.get(branch);\n if (!entry) {\n entry = { name: branch, leaves: new Map() };\n out.set(branch, entry);\n }\n entry.leaves.set(leaf, desc);\n }\n return out;\n})();\n\n/**\n * Coerce a typed YAML scalar (already typed by the YAML parser) into the\n * descriptor's expected type. Strings from the CLI go through `coerceFromString`\n * instead — that path accepts e.g. \"true\" or \"120000\".\n */\nfunction coerceTypedValue(raw: unknown, desc: KeyDescriptor, where: string): unknown {\n if (raw === null) {\n throw new UserConfigError(`${where} must not be null (use \\`agentbox config unset\\` to clear)`);\n }\n switch (desc.type) {\n case 'bool':\n if (typeof raw !== 'boolean') {\n throw new UserConfigError(`${where} must be a boolean (got ${typeof raw})`);\n }\n return raw;\n case 'string':\n if (typeof raw !== 'string') {\n throw new UserConfigError(`${where} must be a string (got ${typeof raw})`);\n }\n if (raw.length === 0) {\n throw new UserConfigError(`${where} must not be empty`);\n }\n return raw;\n case 'int':\n if (typeof raw !== 'number' || !Number.isInteger(raw)) {\n throw new UserConfigError(`${where} must be an integer (got ${String(raw)})`);\n }\n return raw;\n case 'enum':\n if (typeof raw !== 'string' || !desc.enumValues!.includes(raw)) {\n throw new UserConfigError(\n `${where} must be one of: ${desc.enumValues!.join(', ')} (got ${String(raw)})`,\n );\n }\n return raw;\n }\n}\n\n/**\n * Parse a UserConfig document text (YAML). Strict: unknown branches and\n * unknown leaves throw UserConfigError so typos surface early.\n *\n * `where` is the human-readable origin for error messages, e.g. the file path.\n * Empty / whitespace-only input parses to `{}`.\n */\nexport function parseUserConfig(text: string, where: string): Partial<UserConfig> {\n let doc: unknown;\n try {\n doc = parseYaml(text);\n } catch (err) {\n throw new UserConfigError(\n `${where}: yaml parse error: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n if (doc === null || doc === undefined) return {};\n if (!isPlainObject(doc)) {\n throw new UserConfigError(`${where}: top-level must be a mapping`);\n }\n return parseUserConfigObject(doc, where);\n}\n\n/**\n * Same validation as `parseUserConfig` but starting from an already-decoded\n * object. Used when the caller has the YAML parsed (e.g. agentbox.yaml's\n * `defaults:` block).\n */\nexport function parseUserConfigObject(doc: unknown, where: string): Partial<UserConfig> {\n if (doc === null || doc === undefined) return {};\n if (!isPlainObject(doc)) {\n throw new UserConfigError(`${where}: must be a mapping`);\n }\n\n const out: Partial<UserConfig> = {};\n for (const [branchName, branchRaw] of Object.entries(doc)) {\n // Top-level `schema` is a metadata stamp written by the loader on first\n // save (future-proofs migrations). It's not a config section and never\n // appears in `EffectiveConfig`; carry it through so writers preserve it\n // round-trip, but skip the \"must be a mapping\" / leaf checks below.\n if (branchName === 'schema') {\n if (branchRaw !== undefined && branchRaw !== null) {\n if (typeof branchRaw !== 'number' || !Number.isInteger(branchRaw)) {\n throw new UserConfigError(`${where}.schema: must be an integer (got ${String(branchRaw)})`);\n }\n out.schema = branchRaw;\n }\n continue;\n }\n const branchSpec = BRANCHES.get(branchName);\n if (!branchSpec) {\n throw new UserConfigError(\n `${where}: unknown config section \"${branchName}\" (known: ${[...BRANCHES.keys()].join(', ')})`,\n );\n }\n if (branchRaw === null || branchRaw === undefined) continue;\n if (!isPlainObject(branchRaw)) {\n throw new UserConfigError(`${where}.${branchName}: must be a mapping`);\n }\n const branchOut = parseBranchObject(branchSpec, branchName, branchRaw, '', where);\n if (Object.keys(branchOut).length > 0) {\n // We've validated that each branch matches one of UserConfig's known\n // sub-objects; the indexed write keeps the union type happy.\n (out as Record<string, unknown>)[branchName] = branchOut;\n }\n }\n return out;\n}\n\n/**\n * Validate a YAML branch sub-tree against `branchSpec`'s registered leaf paths.\n * Handles nested keys like `integrations.notion.enabled` — the branch is\n * `integrations`, the leaf path is `notion.enabled`, so the YAML can be\n * written as a nested mapping. `qualifiedPrefix` is the dotted path walked so\n * far within the branch (empty at top level).\n */\nfunction parseBranchObject(\n branchSpec: BranchSpec,\n branchName: string,\n raw: Record<string, unknown>,\n qualifiedPrefix: string,\n where: string,\n): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(raw)) {\n if (value === undefined) continue;\n const qualified = qualifiedPrefix ? `${qualifiedPrefix}.${name}` : name;\n const desc = branchSpec.leaves.get(qualified);\n if (desc) {\n out[name] = coerceTypedValue(value, desc, `${where}.${desc.key}`);\n continue;\n }\n // Not a leaf — descend if it's a mapping AND a deeper leaf is registered\n // beneath this path. Otherwise the key is unknown / not in the registry.\n if (isPlainObject(value) && branchHasLeafBelow(branchSpec, qualified)) {\n const sub = parseBranchObject(branchSpec, branchName, value, qualified, where);\n if (Object.keys(sub).length > 0) out[name] = sub;\n continue;\n }\n const renamedTo = RENAMED_KEYS.get(`${branchName}.${qualified}`);\n if (renamedTo) {\n throw new UserConfigError(\n `${where}.${branchName}.${qualified} was renamed to ${renamedTo} — update your config`,\n );\n }\n throw new UserConfigError(\n `${where}.${branchName}: unknown key \"${qualified}\" (known: ${[...branchSpec.leaves.keys()].join(', ')})`,\n );\n }\n return out;\n}\n\nfunction branchHasLeafBelow(branchSpec: BranchSpec, prefix: string): boolean {\n const needle = `${prefix}.`;\n for (const leaf of branchSpec.leaves.keys()) {\n if (leaf.startsWith(needle)) return true;\n }\n return false;\n}\n\n/**\n * Coerce a string (e.g. typed at the CLI by `agentbox config set`) into the\n * declared type for `key`. Booleans accept true/false/yes/no/1/0 (case\n * insensitive). Returns the typed value or throws UserConfigError.\n */\nexport function coerceFromString(key: string, raw: string): unknown {\n const desc = lookupKeyOrThrow(key);\n switch (desc.type) {\n case 'bool': {\n const v = raw.trim().toLowerCase();\n if (v === 'true' || v === 'yes' || v === '1' || v === 'on') return true;\n if (v === 'false' || v === 'no' || v === '0' || v === 'off') return false;\n throw new UserConfigError(`${key}: expected a boolean (true/false), got \"${raw}\"`);\n }\n case 'string':\n if (raw.length === 0) throw new UserConfigError(`${key}: must not be empty`);\n return raw;\n case 'int': {\n const n = Number(raw);\n if (!Number.isFinite(n) || !Number.isInteger(n)) {\n throw new UserConfigError(`${key}: expected an integer, got \"${raw}\"`);\n }\n return n;\n }\n case 'enum':\n if (!desc.enumValues!.includes(raw)) {\n throw new UserConfigError(\n `${key}: expected one of ${desc.enumValues!.join(', ')}, got \"${raw}\"`,\n );\n }\n return raw;\n }\n}\n\nfunction lookupKeyOrThrow(key: string): KeyDescriptor {\n const renamedTo = RENAMED_KEYS.get(key);\n if (renamedTo) {\n throw new UserConfigError(`${key} was renamed to ${renamedTo} — use ${renamedTo} instead`);\n }\n const idx = key.indexOf('.');\n if (idx < 0) {\n throw new UserConfigError(`unknown key \"${key}\" (must be in branch.leaf form)`);\n }\n const branch = BRANCHES.get(key.slice(0, idx));\n if (!branch) {\n throw new UserConfigError(\n `unknown config section \"${key.slice(0, idx)}\" (known: ${[...BRANCHES.keys()].join(', ')})`,\n );\n }\n const desc = branch.leaves.get(key.slice(idx + 1));\n if (!desc) {\n throw new UserConfigError(\n `unknown key \"${key}\" (known in ${branch.name}: ${[...branch.leaves.keys()].join(', ')})`,\n );\n }\n return desc;\n}\n","import { createHash } from 'node:crypto';\nimport { realpath, stat } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { basename, dirname, join, resolve } from 'node:path';\nimport type { ConfigScope } from './types.js';\n\nexport const STATE_DIR = join(homedir(), '.agentbox');\nexport const GLOBAL_CONFIG_FILE = join(STATE_DIR, 'config.yaml');\nexport const PROJECTS_DIR = join(STATE_DIR, 'projects');\nexport const WORKSPACE_CONFIG_BASENAME = 'agentbox.yaml';\n\nexport interface ProjectRoot {\n /** Absolute path to the resolved project root (host filesystem). */\n root: string;\n hasAgentboxYaml: boolean;\n}\n\n/**\n * Walk up from `cwd` until we find an `agentbox.yaml`. That dir is the\n * \"project\". If no ancestor has one, we fall back to `cwd` (per spec) so\n * `agentbox config` still does something sane in dirs without a workspace\n * file. The returned path is always absolute and **symlink-canonicalised**\n * via `realpath` — without this, macOS's `/tmp` symlink to `/private/tmp`\n * makes `findProjectRoot('/tmp/x')` (at create time, --workspace) and\n * `findProjectRoot(process.cwd())` (at resolve time, the same dir) return\n * different roots, breaking the per-project box index match.\n */\nexport async function findProjectRoot(cwd: string): Promise<ProjectRoot> {\n const start = await canonicalize(cwd);\n let dir = start;\n // Defensive cap on iterations: filesystem roots end with `dirname(x) === x`.\n for (let i = 0; i < 64; i++) {\n if (await fileExists(join(dir, WORKSPACE_CONFIG_BASENAME))) {\n return { root: dir, hasAgentboxYaml: true };\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return { root: start, hasAgentboxYaml: false };\n}\n\nasync function canonicalize(p: string): Promise<string> {\n const abs = resolve(p);\n // realpath only works for paths that exist. cwd and create-time\n // workspaces always do; fall back to the resolved (non-canonicalised)\n // path for anything else (e.g. config get from a deleted dir).\n try {\n return await realpath(abs);\n } catch {\n return abs;\n }\n}\n\nasync function fileExists(p: string): Promise<boolean> {\n try {\n const st = await stat(p);\n return st.isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * SHA-1 (first 16 hex chars) of the *normalised* absolute path. We strip a\n * single trailing slash so `/foo/` and `/foo` hash identically. Case is\n * preserved — macOS APFS is case-preserving and so is the user's intent.\n */\nexport function hashProjectPath(absPath: string): string {\n const normalised = absPath.length > 1 && absPath.endsWith('/')\n ? absPath.slice(0, -1)\n : absPath;\n return createHash('sha1').update(normalised).digest('hex').slice(0, 16);\n}\n\n/**\n * Make `raw` safe to embed as the mnemonic half of an on-disk dir segment or a\n * Docker tag repo. Lowercased so docker tag repos stay valid; `-` collapses to\n * `_` so the single `-` between hash and mnemonic remains the only one (which\n * is what `listProjectsConfigured` parses on). Bounded length, never empty.\n */\nexport function sanitizeMnemonic(raw: string): string {\n return (\n raw\n .toLowerCase()\n .replace(/-/g, '_')\n .replace(/[^a-z0-9_]+/g, '_')\n .replace(/_+/g, '_')\n .replace(/^_+|_+$/g, '')\n .slice(0, 32) || 'unnamed'\n );\n}\n\n/**\n * On-disk dir segment for a project under `~/.agentbox/projects/` and\n * `~/.agentbox/checkpoints/`: `<hash>-<mnemonic>`. The hash stays the\n * canonical key; the trailing mnemonic is decorative — readers parse the hash\n * as the leading 16 hex chars and ignore the suffix.\n */\nexport function projectDirSegment(absPath: string): string {\n return `${hashProjectPath(absPath)}-${sanitizeMnemonic(basename(absPath))}`;\n}\n\nexport function projectConfigDir(absPath: string): string {\n return join(PROJECTS_DIR, projectDirSegment(absPath));\n}\n\nexport function projectConfigFile(absPath: string): string {\n return join(projectConfigDir(absPath), 'config.yaml');\n}\n\nexport function projectMetaFile(absPath: string): string {\n return join(projectConfigDir(absPath), 'meta.json');\n}\n\nexport function workspaceConfigFile(workspacePath: string): string {\n return join(workspacePath, WORKSPACE_CONFIG_BASENAME);\n}\n\n/**\n * Resolve a file path for a given scope. For `global`, no cwd is needed;\n * for `project`, `cwd` selects which project hash. Workspace path uses the\n * resolved project root (the dir holding `agentbox.yaml`, or cwd as fallback).\n */\nexport async function configPathFor(\n scope: ConfigScope | 'workspace',\n cwd: string,\n): Promise<string> {\n if (scope === 'global') return GLOBAL_CONFIG_FILE;\n const root = await findProjectRoot(cwd);\n if (scope === 'project') return projectConfigFile(root.root);\n return workspaceConfigFile(root.root);\n}\n","import { readFile } from 'node:fs/promises';\nimport { parse as parseYaml } from 'yaml';\nimport {\n findProjectRoot,\n GLOBAL_CONFIG_FILE,\n hashProjectPath,\n projectConfigFile,\n workspaceConfigFile,\n} from './paths.js';\nimport { parseUserConfig, parseUserConfigObject } from './parse.js';\nimport {\n BUILT_IN_DEFAULTS,\n type ConfigSource,\n type EffectiveConfig,\n KEY_REGISTRY,\n type LoadedConfig,\n type UserConfig,\n} from './types.js';\n\n/**\n * ENOENT-tolerant read of a UserConfig file. Anything else propagates.\n */\nasync function loadOptionalUserConfig(path: string): Promise<Partial<UserConfig>> {\n let text: string;\n try {\n text = await readFile(path, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return {};\n throw err;\n }\n return parseUserConfig(text, path);\n}\n\n/**\n * Read the `defaults:` block from `<workspacePath>/agentbox.yaml`. Returns\n * `{}` if the file is missing or has no `defaults:` key. Throws on YAML\n * parse errors or invalid `defaults:` content (so typos surface as soon as\n * the user runs anything in the workspace).\n *\n * The rest of `agentbox.yaml` is owned by `@agentbox/ctl` — we don't validate\n * it here and we don't depend on that package.\n */\nexport async function loadProjectAgentboxDefaults(\n workspacePath: string,\n): Promise<Partial<UserConfig>> {\n const path = workspaceConfigFile(workspacePath);\n let text: string;\n try {\n text = await readFile(path, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return {};\n throw err;\n }\n let doc: unknown;\n try {\n doc = parseYaml(text);\n } catch {\n // The ctl parser will surface its own error on the next box action; we\n // only throw if defaults: is present and broken (validated below).\n return {};\n }\n if (doc === null || doc === undefined || typeof doc !== 'object' || Array.isArray(doc)) {\n return {};\n }\n const defaults = (doc as Record<string, unknown>)['defaults'];\n if (defaults === undefined || defaults === null) return {};\n return parseUserConfigObject(defaults, `${path} defaults`);\n}\n\nexport interface LoadEffectiveConfigOptions {\n /** Highest-precedence layer; values supplied by command-line flags. */\n cliOverrides?: Partial<UserConfig>;\n}\n\n/**\n * Load and merge all four config sources for the cwd. Per-leaf precedence\n * (highest wins): cli > workspace > project > global > built-in defaults.\n *\n * The returned `sources` map has one entry per leaf in the registry — useful\n * for `agentbox config get --all` to show provenance.\n */\nexport async function loadEffectiveConfig(\n cwd: string,\n opts: LoadEffectiveConfigOptions = {},\n): Promise<LoadedConfig> {\n const projectRoot = await findProjectRoot(cwd);\n const projectPath = projectConfigFile(projectRoot.root);\n const workspacePath = projectRoot.hasAgentboxYaml ? workspaceConfigFile(projectRoot.root) : null;\n\n const [globalValues, projectValues, workspaceValues] = await Promise.all([\n loadOptionalUserConfig(GLOBAL_CONFIG_FILE),\n loadOptionalUserConfig(projectPath),\n workspacePath ? loadProjectAgentboxDefaults(projectRoot.root) : Promise.resolve({}),\n ]);\n\n const cliValues = opts.cliOverrides ?? {};\n\n const { effective, sources } = mergeLayers({\n cli: cliValues,\n workspace: workspaceValues,\n project: projectValues,\n global: globalValues,\n });\n\n return {\n effective,\n layers: {\n cli: { values: cliValues },\n workspace: { path: workspacePath, values: workspaceValues },\n project: { path: projectPath, values: projectValues },\n global: { path: GLOBAL_CONFIG_FILE, values: globalValues },\n defaults: BUILT_IN_DEFAULTS,\n },\n sources,\n projectRoot: projectRoot.root,\n projectHash: hashProjectPath(projectRoot.root),\n hasAgentboxYaml: projectRoot.hasAgentboxYaml,\n };\n}\n\ninterface MergeInput {\n cli: Partial<UserConfig>;\n workspace: Partial<UserConfig>;\n project: Partial<UserConfig>;\n global: Partial<UserConfig>;\n}\n\n/**\n * Walk every key in KEY_REGISTRY, pick the highest-precedence layer that has\n * a leaf value, and record the source. Lower-precedence layers never\n * overwrite a higher-precedence definition; absent leaves don't shadow.\n */\nfunction mergeLayers(input: MergeInput): {\n effective: EffectiveConfig;\n sources: Record<string, ConfigSource>;\n} {\n // Deep-clone the defaults; we'll overwrite leaves in place.\n const effective: EffectiveConfig = JSON.parse(JSON.stringify(BUILT_IN_DEFAULTS)) as EffectiveConfig;\n const sources: Record<string, ConfigSource> = {};\n\n const layerOrder: Array<{ source: ConfigSource; values: Partial<UserConfig> }> = [\n { source: 'cli', values: input.cli },\n { source: 'workspace', values: input.workspace },\n { source: 'project', values: input.project },\n { source: 'global', values: input.global },\n ];\n\n for (const desc of KEY_REGISTRY) {\n const idx = desc.key.indexOf('.');\n const branch = desc.key.slice(0, idx);\n const leaf = desc.key.slice(idx + 1);\n\n let chosen: { source: ConfigSource; value: unknown } | null = null;\n for (const layer of layerOrder) {\n const v = readLeaf(layer.values, branch, leaf);\n if (v !== undefined) {\n chosen = { source: layer.source, value: v };\n break;\n }\n }\n\n if (chosen) {\n writeLeaf(effective, branch, leaf, chosen.value);\n sources[desc.key] = chosen.source;\n } else {\n sources[desc.key] = 'default';\n }\n }\n\n return { effective, sources };\n}\n\nfunction readLeaf(\n obj: Partial<UserConfig>,\n branch: string,\n leaf: string,\n): unknown {\n let cur: unknown = (obj as Record<string, unknown>)[branch];\n for (const seg of leaf.split('.')) {\n if (cur === undefined || cur === null || typeof cur !== 'object') return undefined;\n cur = (cur as Record<string, unknown>)[seg];\n }\n return cur;\n}\n\nfunction writeLeaf(\n obj: EffectiveConfig,\n branch: string,\n leaf: string,\n value: unknown,\n): void {\n let cur: Record<string, unknown> | undefined =\n (obj as unknown as Record<string, Record<string, unknown>>)[branch];\n if (!cur) return; // BUILT_IN_DEFAULTS guarantees the branch exists\n const segs = leaf.split('.');\n for (let i = 0; i < segs.length - 1; i++) {\n const seg = segs[i]!;\n const next = cur[seg];\n if (next === undefined || next === null || typeof next !== 'object') {\n // BUILT_IN_DEFAULTS guarantees nested sub-objects exist for every\n // registered key path, so this is unreachable in practice; defaulting\n // to a fresh sub-object keeps the function total.\n cur[seg] = {};\n }\n cur = cur[seg] as Record<string, unknown>;\n }\n cur[segs[segs.length - 1]!] = value;\n}\n","/**\n * Resolve the effective box image ref for a given provider.\n *\n * Precedence (highest wins):\n * 1. `box.image<Provider>` — per-provider override\n * (`imageDocker` / `imageDaytona` / `imageHetzner` / `imageVercel`).\n * 2. `box.image` — generic fallback (defaults to `agentbox/box:dev`,\n * which cloud backends recognize as a sentinel meaning \"boot from\n * the provider's prepared base snapshot\").\n *\n * Each `agentbox prepare --provider X` writes its result into its own\n * per-provider key, so cross-provider prepares can no longer poison\n * creates on other providers.\n */\nimport type { EffectiveConfig, ProviderKind } from './types.js';\nimport { isProviderKind, perProviderConfigKey } from './providers.js';\n\n/**\n * Read a per-provider `box.<base><P>` string field off the effective config.\n * Only BUILT-IN providers have such a key; any other name — a stray value, or\n * an external plugin provider — returns '' so the caller falls through to the\n * generic `box.<base>`. For a plugin that generic is the image sentinel\n * (`agentbox/box:dev`), which the plugin's own backend maps to its prepared\n * snapshot — so a plugin never accidentally reads docker's per-provider value.\n */\nfunction perProviderValue(\n cfg: EffectiveConfig,\n base: 'image' | 'size' | 'defaultCheckpoint',\n provider: ProviderKind | string,\n): string {\n if (!isProviderKind(provider)) return '';\n const field = perProviderConfigKey(base, provider).slice('box.'.length);\n const val = (cfg.box as Record<string, unknown>)[field];\n return typeof val === 'string' ? val : '';\n}\n\nexport function resolveBoxImage(cfg: EffectiveConfig, provider: ProviderKind | string): string {\n // Unknown provider names fall back to the generic `box.image` — a stray\n // value in argv or config shouldn't crash before the validation layer.\n const perProvider = perProviderValue(cfg, 'image', provider);\n if (perProvider.length > 0) return perProvider;\n return cfg.box.image;\n}\n\nexport { perProviderValue };\n\n/**\n * Flat KEY_REGISTRY key for `agentbox prepare --provider X` to pin the\n * resulting image into the right per-provider slot; mirrors\n * `defaultCheckpointConfigKey`. Unknown provider → generic `box.image`\n * (legacy callers).\n */\nexport function boxImageConfigKey(provider: ProviderKind | string | undefined): string {\n if (provider && isProviderKind(provider)) return perProviderConfigKey('image', provider);\n return 'box.image';\n}\n","/**\n * Resolve the effective default checkpoint ref for a given provider.\n *\n * Precedence (highest wins):\n * 1. `box.defaultCheckpoint<Provider>` — per-provider override\n * (`defaultCheckpointDocker` / `defaultCheckpointDaytona` /\n * `defaultCheckpointHetzner`).\n * 2. `box.defaultCheckpoint` — global fallback (back-compat shape: every\n * pre-cloud config has this; no flag was needed).\n * 3. '' — no default.\n *\n * Returning the empty string (instead of undefined) matches the\n * `EffectiveConfig.box.defaultCheckpoint` shape so call sites that already\n * test `.length > 0` keep working unchanged.\n */\nimport type { EffectiveConfig, ProviderKind } from './types.js';\nimport { isProviderKind, perProviderConfigKey } from './providers.js';\nimport { perProviderValue } from './image.js';\n\nexport function resolveDefaultCheckpoint(\n cfg: EffectiveConfig,\n provider: ProviderKind | string,\n): string {\n // Unknown provider names fall back to the global default — a stray value in\n // config or argv shouldn't crash before the validation layer.\n const perProvider = perProviderValue(cfg, 'defaultCheckpoint', provider);\n if (perProvider.length > 0) return perProvider;\n return cfg.box.defaultCheckpoint;\n}\n\n/**\n * Config key (one of the flat KEY_REGISTRY entries) used by `agentbox\n * checkpoint set-default [--provider X]` to write the right field. Passing\n * an unknown provider falls back to the global key (legacy callers).\n */\nexport function defaultCheckpointConfigKey(provider: ProviderKind | string | undefined): string {\n if (provider && isProviderKind(provider)) {\n return perProviderConfigKey('defaultCheckpoint', provider);\n }\n return 'box.defaultCheckpoint';\n}\n","/**\n * Resolve the effective default VM size for a given cloud provider.\n *\n * Precedence (highest wins):\n * 1. `box.size<Provider>` — per-provider override\n * (`sizeDocker` / `sizeDaytona` / `sizeHetzner` / `sizeVercel`).\n * 2. `box.size` — generic fallback.\n * 3. '' — no preference; backend uses its built-in default.\n *\n * Interpretation is provider-specific:\n * - hetzner: server type string (e.g. `cx33`).\n * - daytona: `cpu-memory-disk` GB spec (e.g. `4-8-20`).\n * - docker / vercel: reserved (docker uses memory/cpus/disk; vercel uses\n * vercelVcpus). The keys exist for surface uniformity.\n *\n * Returning '' (rather than undefined) mirrors how `resolveDefaultCheckpoint`\n * shapes its result, so call sites can `.length > 0` test uniformly.\n */\nimport type { EffectiveConfig, ProviderKind } from './types.js';\nimport { perProviderValue } from './image.js';\n\nexport function resolveBoxSize(cfg: EffectiveConfig, provider: ProviderKind | string): string {\n // Unknown provider names fall back to the generic `box.size` — a stray value\n // in argv or config shouldn't crash before the validation layer.\n const perProvider = perProviderValue(cfg, 'size', provider);\n if (perProvider.length > 0) return perProvider;\n return cfg.box.size;\n}\n","import { mkdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport { stringify as stringifyYaml } from 'yaml';\nimport {\n configPathFor,\n findProjectRoot,\n hashProjectPath,\n PROJECTS_DIR,\n projectConfigFile,\n projectMetaFile,\n} from './paths.js';\nimport { coerceFromString, parseUserConfig } from './parse.js';\nimport { type ConfigScope, lookupKey, type UserConfig, UserConfigError } from './types.js';\nimport { readdir } from 'node:fs/promises';\n\ninterface WriteResult {\n path: string;\n /** The value we coerced and stored, after string→typed conversion. */\n coerced: unknown;\n}\n\ninterface SetOptions {\n /**\n * When true (the CLI `set` path), accept a string and coerce. When false\n * (programmatic), accept any typed value and write it through after a\n * round-trip parse for validation.\n */\n raw?: boolean;\n}\n\n/**\n * Write a single key into the chosen scope's config file. Creates parent\n * dirs and (for project scope) the meta.json sidecar. Atomic via tmp-rename.\n */\nexport async function setConfigValue(\n scope: ConfigScope,\n key: string,\n value: unknown,\n cwd: string,\n opts: SetOptions = {},\n): Promise<WriteResult> {\n if (!lookupKey(key)) {\n throw new UserConfigError(`unknown key \"${key}\"`);\n }\n\n const coerced = opts.raw && typeof value === 'string'\n ? coerceFromString(key, value)\n : value;\n\n const path = await configPathFor(scope, cwd);\n const current = await readExistingDoc(path);\n setLeaf(current, key, coerced);\n stampSchema(current);\n // Re-parse to validate the merged document; any change that produces an\n // invalid file (shouldn't be possible here, but defence-in-depth) throws.\n parseUserConfig(stringifyYaml(current), path);\n await atomicWriteYaml(path, current);\n\n if (scope === 'project') {\n const root = (await findProjectRoot(cwd)).root;\n await touchProjectMeta(root);\n }\n\n return { path, coerced };\n}\n\n/**\n * Remove a key from the chosen scope's config file. Empty parent objects are\n * pruned so the file stays tidy. ENOENT is treated as success.\n */\nexport async function unsetConfigValue(\n scope: ConfigScope,\n key: string,\n cwd: string,\n): Promise<{ path: string; existed: boolean }> {\n if (!lookupKey(key)) {\n throw new UserConfigError(`unknown key \"${key}\"`);\n }\n const path = await configPathFor(scope, cwd);\n const current = await readExistingDoc(path);\n const existed = unsetLeaf(current, key);\n if (!existed) return { path, existed: false };\n stampSchema(current);\n await atomicWriteYaml(path, current);\n if (scope === 'project') {\n const root = (await findProjectRoot(cwd)).root;\n await touchProjectMeta(root);\n }\n return { path, existed: true };\n}\n\nexport interface ProjectEntry {\n /** SHA-1 (first 16 hex chars) of `originalPath` — the canonical key. */\n hash: string;\n /**\n * On-disk dir name under `PROJECTS_DIR`. Equal to the hash for legacy\n * pre-rename dirs; `<hash>-<mnemonic>` for new dirs. Used directly when we\n * need to `rm` the dir so the call works regardless of which shape happens\n * to be on disk.\n */\n dirName: string;\n originalPath: string;\n createdAt: string | null;\n lastSeenAt: string | null;\n configPath: string;\n hasConfigFile: boolean;\n}\n\n/**\n * Enumerate per-project config dirs. The meta.json's recorded\n * `originalPath` is what we report — the hash on disk is opaque.\n */\nexport async function listProjectsConfigured(): Promise<ProjectEntry[]> {\n let entries: string[];\n try {\n entries = await readdir(PROJECTS_DIR);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return [];\n throw err;\n }\n const out: ProjectEntry[] = [];\n for (const dirName of entries) {\n // Dir shape is `<sha1-16>` (legacy) or `<sha1-16>-<mnemonic>` (current);\n // either way the leading 16 hex chars are the canonical key.\n const m = /^([0-9a-f]{16})(?:-.+)?$/.exec(dirName);\n if (!m) continue;\n const hash = m[1]!;\n const meta = await readMeta(dirName);\n if (!meta) continue;\n const cfgPath = projectConfigFile(meta.originalPath);\n const hasConfig = await fileExists(cfgPath);\n out.push({\n hash,\n dirName,\n originalPath: meta.originalPath,\n createdAt: meta.createdAt,\n lastSeenAt: meta.lastSeenAt,\n configPath: cfgPath,\n hasConfigFile: hasConfig,\n });\n }\n out.sort((a, b) => a.originalPath.localeCompare(b.originalPath));\n return out;\n}\n\nexport interface PruneOrphanProjectConfigsOptions {\n dryRun?: boolean;\n /** Absolute project roots of live boxes — kept even if the folder is gone. */\n protectedPaths?: string[];\n}\n\nexport interface PruneOrphanProjectConfigsResult {\n removed: { hash: string; originalPath: string }[];\n dryRun: boolean;\n}\n\n/**\n * Delete `~/.agentbox/projects/<hash>/` dirs whose recorded `originalPath`\n * workspace folder no longer exists on disk. Conservative by construction:\n * only an ENOENT on `originalPath` counts as orphaned (a transient/permission\n * error is never treated as \"deleted\"), and any path in `protectedPaths` (the\n * project roots of still-live boxes) is left alone. Best-effort and\n * idempotent — a failed `rm` is swallowed.\n */\nexport async function pruneOrphanProjectConfigs(\n opts: PruneOrphanProjectConfigsOptions = {},\n): Promise<PruneOrphanProjectConfigsResult> {\n const dryRun = opts.dryRun ?? false;\n const keep = new Set(opts.protectedPaths ?? []);\n const removed: { hash: string; originalPath: string }[] = [];\n for (const entry of await listProjectsConfigured()) {\n if (!isAbsolute(entry.originalPath) || keep.has(entry.originalPath)) continue;\n let missing = false;\n try {\n await stat(entry.originalPath);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') missing = true;\n }\n if (!missing) continue;\n removed.push({ hash: entry.hash, originalPath: entry.originalPath });\n if (!dryRun) {\n try {\n // Remove by the on-disk dir name (originalPath is gone, so recomputing\n // the segment from it would be pointless; entry.dirName preserves\n // whichever shape — legacy `<hash>` or new `<hash>-<mnemonic>` —\n // happens to be on disk).\n await rm(join(PROJECTS_DIR, entry.dirName), { recursive: true, force: true });\n } catch {\n /* best-effort */\n }\n }\n }\n return { removed, dryRun };\n}\n\n/**\n * Sidecar counter for the periodic create-time sweep. Lives inside\n * `PROJECTS_DIR` but `listProjectsConfigured` only reads 16-hex-named dirs, so\n * a dotfile here is invisible to it.\n */\nconst PROJECT_GC_COUNTER_FILE = join(PROJECTS_DIR, '.gc.json');\n\n/** Read `{creates}` (0 if missing/corrupt), increment, atomic-write, return new value. */\nexport async function bumpProjectGcCounter(): Promise<number> {\n let prior = 0;\n try {\n const parsed = JSON.parse(await readFile(PROJECT_GC_COUNTER_FILE, 'utf8')) as {\n creates?: unknown;\n };\n if (typeof parsed.creates === 'number' && Number.isFinite(parsed.creates)) {\n prior = parsed.creates;\n }\n } catch {\n /* missing or corrupt -> start from 0 */\n }\n const next = prior + 1;\n await mkdir(PROJECTS_DIR, { recursive: true });\n const tmp = `${PROJECT_GC_COUNTER_FILE}.tmp-${process.pid.toString()}-${Date.now().toString(36)}`;\n await writeFile(tmp, JSON.stringify({ creates: next }) + '\\n', { encoding: 'utf8', mode: 0o644 });\n await rename(tmp, PROJECT_GC_COUNTER_FILE);\n return next;\n}\n\nasync function readMeta(\n dirName: string,\n): Promise<{ originalPath: string; createdAt: string | null; lastSeenAt: string | null } | null> {\n const metaPath = `${PROJECTS_DIR}/${dirName}/meta.json`;\n try {\n const text = await readFile(metaPath, 'utf8');\n const parsed = JSON.parse(text) as Record<string, unknown>;\n if (typeof parsed['originalPath'] !== 'string') return null;\n return {\n originalPath: parsed['originalPath'],\n createdAt: typeof parsed['createdAt'] === 'string' ? parsed['createdAt'] : null,\n lastSeenAt: typeof parsed['lastSeenAt'] === 'string' ? parsed['lastSeenAt'] : null,\n };\n } catch {\n return null;\n }\n}\n\nasync function fileExists(p: string): Promise<boolean> {\n try {\n const st = await stat(p);\n return st.isFile();\n } catch {\n return false;\n }\n}\n\nasync function readExistingDoc(path: string): Promise<Partial<UserConfig>> {\n let text: string;\n try {\n text = await readFile(path, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return {};\n throw err;\n }\n return parseUserConfig(text, path);\n}\n\n/**\n * Stamp `schema: 1` on a doc that hasn't been stamped yet. Idempotent — a\n * doc already carrying any `schema` value is left alone. Future schema\n * bumps live here.\n */\nconst CURRENT_CONFIG_SCHEMA = 1;\nfunction stampSchema(doc: Partial<UserConfig>): void {\n if (typeof doc.schema !== 'number') {\n doc.schema = CURRENT_CONFIG_SCHEMA;\n }\n}\n\nfunction setLeaf(doc: Partial<UserConfig>, key: string, value: unknown): void {\n const segs = key.split('.');\n let cur = doc as unknown as Record<string, unknown>;\n for (let i = 0; i < segs.length - 1; i++) {\n const seg = segs[i]!;\n const next = cur[seg];\n if (!next || typeof next !== 'object') {\n cur[seg] = {};\n }\n cur = cur[seg] as Record<string, unknown>;\n }\n cur[segs[segs.length - 1]!] = value;\n}\n\nfunction unsetLeaf(doc: Partial<UserConfig>, key: string): boolean {\n const segs = key.split('.');\n const path: Record<string, unknown>[] = [doc as unknown as Record<string, unknown>];\n for (let i = 0; i < segs.length - 1; i++) {\n const seg = segs[i]!;\n const next = path[path.length - 1]![seg];\n if (!next || typeof next !== 'object') return false;\n path.push(next as Record<string, unknown>);\n }\n const leafSeg = segs[segs.length - 1]!;\n const leafContainer = path[path.length - 1]!;\n if (!(leafSeg in leafContainer)) return false;\n delete leafContainer[leafSeg];\n // Prune empty parent objects from leaf-most up so the YAML stays tidy.\n for (let i = path.length - 1; i > 0; i--) {\n if (Object.keys(path[i]!).length > 0) break;\n delete path[i - 1]![segs[i - 1]!];\n }\n return true;\n}\n\nasync function atomicWriteYaml(path: string, doc: Partial<UserConfig>): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n // YAML serialises empty objects as `{}` which is correct but ugly; if the\n // doc is empty we still want a usable placeholder file.\n const text = Object.keys(doc).length === 0\n ? '# managed by agentbox config — empty\\n'\n : stringifyYaml(doc);\n const tmp = `${path}.tmp-${process.pid.toString()}-${Date.now().toString(36)}`;\n await writeFile(tmp, text, { encoding: 'utf8', mode: 0o644 });\n await rename(tmp, path);\n}\n\n/**\n * Register a project (a folder on the PC) in the on-disk registry so it is\n * enumerable via {@link listProjectsConfigured} even before it has any config\n * value or any box. Idempotent: creates `~/.agentbox/projects/<hash>/meta.json`\n * on first call and refreshes `lastSeenAt` (preserving `createdAt`) after.\n *\n * `absPath` should be a canonical project root (e.g. `findProjectRoot(cwd).root`).\n * Callers that start from an arbitrary user path should canonicalize first.\n */\nexport async function registerProject(absPath: string): Promise<void> {\n await touchProjectMeta(absPath);\n}\n\n/**\n * Remove a project from the on-disk registry by its {@link hashProjectPath}\n * hash — deletes `~/.agentbox/projects/<hash>-<mnemonic>/`, i.e. its `meta.json`\n * and any project-scoped `config.yaml` the user set for that folder. Does NOT\n * touch the workspace folder/files, its git repo, or checkpoints (a separate\n * `~/.agentbox/checkpoints/` tree). Idempotent: returns `false` when the hash\n * isn't registered (nothing to remove). Mirrors the delete\n * {@link pruneOrphanProjectConfigs} does (rm by the on-disk `dirName`).\n */\nexport async function unregisterProject(hash: string): Promise<boolean> {\n const entry = (await listProjectsConfigured()).find((e) => e.hash === hash);\n if (!entry) return false;\n await rm(join(PROJECTS_DIR, entry.dirName), { recursive: true, force: true });\n return true;\n}\n\nasync function touchProjectMeta(absPath: string): Promise<void> {\n const dir = dirname(projectMetaFile(absPath));\n await mkdir(dir, { recursive: true });\n const metaPath = projectMetaFile(absPath);\n let prior: { originalPath?: string; createdAt?: string } = {};\n try {\n prior = JSON.parse(await readFile(metaPath, 'utf8')) as typeof prior;\n } catch {\n /* fresh file */\n }\n const now = new Date().toISOString();\n const next = {\n originalPath: absPath,\n hash: hashProjectPath(absPath),\n createdAt: prior.createdAt ?? now,\n lastSeenAt: now,\n };\n const tmp = `${metaPath}.tmp-${process.pid.toString()}-${Date.now().toString(36)}`;\n await writeFile(tmp, JSON.stringify(next, null, 2) + '\\n', { encoding: 'utf8', mode: 0o644 });\n await rename(tmp, metaPath);\n}\n\n// Re-export for ergonomics; same path resolution as the loader uses.\nexport { configPathFor };\n"],"mappings":";;;AEAA,SAAS,SAAS,iBAAiB;ACAnC,SAAS,kBAAkB;AAC3B,SAAS,UAAU,YAAY;AAC/B,SAAS,eAAe;AACxB,SAAS,UAAU,SAAS,MAAM,eAAe;ACHjD,SAAS,gBAAgB;AACzB,SAAS,SAASA,kBAAiB;AIDnC,SAAS,OAAO,YAAAC,WAAU,QAAQ,IAAI,QAAAC,OAAM,iBAAiB;AAC7D,SAAS,WAAAC,UAAS,YAAY,QAAAC,aAAY;AAC1C,SAAS,aAAa,qBAAqB;AAW3C,SAAS,eAAe;ARwBjB,IAAM,YAAY;EACvB;IACE,MAAM;IACN,MAAM;IACN,OAAO;IACP,WAAW;IACX,gBAAgB;IAChB,OAAO;IACP,UACE;IACF,WACE;EACJ;EACA;IACE,MAAM;IACN,MAAM;IACN,OAAO;IACP,WAAW;IACX,gBAAgB;IAChB,OAAO;IACP,UACE;IACF,WACE;EACJ;EACA;IACE,MAAM;IACN,MAAM;IACN,OAAO;IACP,WAAW;IACX,gBAAgB;IAChB,OAAO;IACP,UACE;IACF,WACE;EACJ;EACA;IACE,MAAM;IACN,MAAM;IACN,OAAO;IACP,WAA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xB;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,SAAS,UAAU,OAAO,MAAM;IAC7C,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,UAAU,UAAU,MAAM;IACvC,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,YAAY,kBAAkB,SAAS,MAAM;IAC1D,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,iBAAiB,cAAc,MAAM;IAClD,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;IACb,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,QAAQ,SAAS,OAAO;IACrC,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;IACb,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,QAAQ,SAAS,UAAU,KAAK;IAC7C,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;AACF;AAEA,IAAM,kBAAkB,IAAI,IAA2B,aAAa,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CA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IACX,cAAc;IACd,MAAM,gBAAgB,OAAO;IAC7B,WAAW,MAAM,aAAa;IAC9B,YAAY;EACd;AACA,QAAM,MAAM,GAAG,QAAQ,QAAQ,QAAQ,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE,CAAC;AAChF,QAAM,UAAU,KAAK,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI,MAAM,EAAE,UAAU,QAAQ,MAAM,IAAM,CAAC;AAC5F,QAAM,OAAO,KAAK,QAAQ;AAC5B;","names":["parseYaml","readFile","stat","dirname","join","fileExists"]}
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,86892,30544,e=>{"use strict";var t=e.i(1262),r=e.i(64595);let n={running:{label:"running",badgeClass:"badge-run"},paused:{label:"paused",badgeClass:"badge-pause"},stopped:{label:"stopped",badgeClass:"badge-stop"},creating:{label:"creating",badgeClass:"badge-create"},error:{label:"error",badgeClass:"badge-err"}};e.s(["StatusBadge",0,function({status:e}){let a=n[e]??n.stopped;return(0,t.jsxs)(r.Badge,{className:a.badgeClass,children:[(0,t.jsx)("span",{className:"badge-dot"}),a.label]})}],86892);var a=e.i(45971),s=e.i(54129),o=e.i(65232),l=e.i(69377),i=e.i(44344),c=e.i(9383);let d=(0,c.createServerReference)("40f10bede8a5e7505d5875574f7e6fc4a06e8e2cb7",c.callServer,void 0,c.findSourceMapURL,"destroyBoxAction"),u=(0,c.createServerReference)("40ea16199b5abb2d3c1d4cecdd25aac1e3c41f074c",c.callServer,void 0,c.findSourceMapURL,"pauseBoxAction"),x=(0,c.createServerReference)("4071308a0e1675de302803bb969800c52d79f11e13",c.callServer,void 0,c.findSourceMapURL,"resumeBoxAction"),m=(0,c.createServerReference)("40e545c7dd69b4a1d410deb9c94101099961d3af7a",c.callServer,void 0,c.findSourceMapURL,"stopBoxAction");e.s(["BoxActions",0,function({box:e,size:r}){let n=(0,a.useRouter)(),[c,p]=(0,s.useTransition)(),h="running"===e.status,b="paused"===e.status,f="stopped"===e.status,g="lg"===r,j=g?"sm":"icon-sm",v=(t,r,a)=>{t.stopPropagation(),(!a||window.confirm(a))&&p(async()=>{let t=await r(e.id);t.ok||window.alert(`Action failed: ${t.error}`),n.refresh()})};return(0,t.jsxs)("div",{className:(0,o.cn)("flex gap-1.5",g?"":"justify-end"),children:[b?(0,t.jsxs)(l.Button,{variant:g?"default":"outline",size:j,title:"Resume",disabled:c,className:g?"":"hover:border-[var(--green)] hover:bg-accent hover:text-[var(--green-ink)]",onClick:e=>v(e,x),children:[(0,t.jsx)(i.Icons.play,{}),g?"Resume":null]}):(0,t.jsxs)(l.Button,{variant:"outline",size:j,disabled:c||!h,title:"Pause",className:g?"":"hover:border-[var(--amber)] hover:bg-[var(--amber-soft)] hover:text-[var(--amber)]",onClick:e=>v(e,u),children:[(0,t.jsx)(i.Icons.pause,{}),g?"Pause":null]}),(0,t.jsxs)(l.Button,{variant:"outline",size:j,disabled:c||f,title:"Stop",onClick:e=>v(e,m),children:[(0,t.jsx)(i.Icons.stop,{}),g?"Stop":null]}),(0,t.jsxs)(l.Button,{variant:"destructive",size:j,title:"Destroy",disabled:c,onClick:t=>v(t,d,`Destroy box ${e.id}? Its workspace volume is discarded. This cannot be undone.`),children:[(0,t.jsx)(i.Icons.trash,{}),g?"Destroy":null]})]})}],30544)},95141,e=>{"use strict";var t=e.i(1262),r=e.i(54129),n=e.i(65232),a=e.i(44344);e.s(["Dialog",0,function({onClose:e,className:s,children:o}){return(0,r.useEffect)(()=>{let t=t=>{"Escape"===t.key&&e()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),(0,t.jsx)("div",{className:"anim-fade fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-[rgba(20,24,30,.42)] p-6 backdrop-blur-[2px]",onClick:e,children:(0,t.jsxs)("div",{role:"dialog","aria-modal":"true",className:(0,n.cn)("anim-pop relative m-auto w-full max-w-[500px] rounded-2xl border border-border bg-card shadow-[0_40px_80px_-30px_rgba(20,24,30,.5)]",s),onClick:e=>e.stopPropagation(),children:[o,(0,t.jsx)("button",{className:"absolute right-4 top-4 grid h-7 w-7 cursor-pointer place-items-center rounded-md border-0 bg-transparent text-[#a4a9b0] transition-colors hover:bg-secondary hover:text-foreground",onClick:e,"aria-label":"Close",children:(0,t.jsx)(a.Icons.x,{style:{width:15,height:15}})})]})})},"DialogBody",0,function({className:e,...r}){return(0,t.jsx)("div",{className:(0,n.cn)("px-5 py-4",e),...r})},"DialogDescription",0,function({className:e,...r}){return(0,t.jsx)("div",{className:(0,n.cn)("mt-1 font-mono text-xs text-muted-foreground",e),...r})},"DialogFooter",0,function({className:e,...r}){return(0,t.jsx)("div",{className:(0,n.cn)("flex justify-end gap-2.5 rounded-b-2xl border-t border-border/70 bg-background px-5 py-3.5",e),...r})},"DialogHeader",0,function({className:e,...r}){return(0,t.jsx)("div",{className:(0,n.cn)("flex items-start gap-3 border-b border-border/70 px-5 pb-4 pt-5",e),...r})},"DialogIcon",0,function({children:e}){return(0,t.jsx)("span",{className:"grid h-9 w-9 flex-none place-items-center rounded-lg border border-[var(--green-line)] bg-accent text-primary [&_svg]:size-[17px]",children:e})},"DialogTitle",0,function({className:e,...r}){return(0,t.jsx)("div",{className:(0,n.cn)("text-base font-semibold leading-tight tracking-tight",e),...r})}])},49604,e=>{"use strict";var t=e.i(1262),r=e.i(65232);e.s(["Select",0,function({wrapperClassName:e,className:n,children:a,...s}){return(0,t.jsxs)("span",{className:(0,r.cn)("relative inline-flex",e),children:[(0,t.jsx)("select",{className:(0,r.cn)("h-9 w-full cursor-pointer appearance-none rounded-lg border border-input bg-card py-1 pl-3 pr-9 text-[13px] shadow-sm focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15",n),...s,children:a}),(0,t.jsx)("svg",{className:"pointer-events-none absolute right-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:(0,t.jsx)("path",{d:"m6 9 6 6 6-6"})})]})}])},80922,35594,e=>{"use strict";var t=e.i(1262),r=e.i(51096),n=e.i(44344);e.s(["BackLink",0,function({to:e,children:a}){return(0,t.jsxs)(r.default,{className:"mb-3.5 inline-flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 font-mono text-xs text-muted-foreground hover:text-primary",href:e,children:[(0,t.jsx)(n.Icons.arrowL,{className:"size-[13px]"}),a]})}],80922);var a=e.i(65232),s=e.i(8536);e.s(["Stat",0,function({k:e,v:r,mono:n,icon:s}){return(0,t.jsxs)("div",{className:"px-4.5 p-4",children:[(0,t.jsx)("div",{className:"mb-1.5 font-mono text-[10.5px] uppercase tracking-[.06em] text-[#a4a9b0]",children:e}),(0,t.jsxs)("div",{className:(0,a.cn)("flex items-center gap-2 font-semibold tracking-[-0.01em]",n?"font-mono text-sm font-medium":"text-base"),children:[s?(0,t.jsx)(s,{className:"size-[15px] text-muted-foreground"}):null,r]})]})},"StatGrid",0,function({children:e}){return(0,t.jsx)(s.Card,{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] divide-x divide-border/60 overflow-hidden",children:e})}],35594)},8536,e=>{"use strict";var t=e.i(1262),r=e.i(65232);e.s(["Card",0,function({className:e,...n}){return(0,t.jsx)("div",{className:(0,r.cn)("rounded-xl border border-border bg-card text-card-foreground",e),...n})},"CardContent",0,function({className:e,...n}){return(0,t.jsx)("div",{className:(0,r.cn)("p-5 pt-0",e),...n})},"CardDescription",0,function({className:e,...n}){return(0,t.jsx)("div",{className:(0,r.cn)("text-[12.5px] text-muted-foreground",e),...n})},"CardHeader",0,function({className:e,...n}){return(0,t.jsx)("div",{className:(0,r.cn)("flex flex-col space-y-1 p-5",e),...n})},"CardTitle",0,function({className:e,...n}){return(0,t.jsx)("div",{className:(0,r.cn)("text-[15px] font-semibold leading-none tracking-tight",e),...n})}])},3060,e=>{"use strict";var t=e.i(1262),r=e.i(65232);e.s(["Input",0,function({className:e,...n}){return(0,t.jsx)("input",{className:(0,r.cn)("flex h-10 w-full rounded-lg border border-input bg-card px-3 py-1 text-sm shadow-sm transition-[border-color,box-shadow] placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15",e),...n})}])},86184,e=>{"use strict";var t=e.i(1262),r=e.i(54129),n=e.i(69377),a=e.i(3060);function s({jobId:e,login:o}){let[l,i]=(0,r.useState)(""),[c,d]=(0,r.useState)(!1),[u,x]=(0,r.useState)(null),m="exchanging"===o.phase,p=async()=>{let t=l.trim();if(t&&!c){d(!0),x(null);try{let r=await fetch(`/api/v1/jobs/${encodeURIComponent(e)}/login-code`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:t})});if(!r.ok){let e=await r.json().catch(()=>null);x(e?.error?.message??`request failed (${r.status})`);return}i("")}catch(e){x(e instanceof Error?e.message:String(e))}finally{d(!1)}}};return(0,t.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 p-3",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-amber-200",children:"Claude login required"}),(0,t.jsx)("p",{className:"text-xs text-amber-100/80",children:"Your saved Claude login is expired. Open the sign-in page, approve access, then paste the code Claude shows you."}),o.url?(0,t.jsx)("a",{href:o.url,target:"_blank",rel:"noreferrer",className:"w-fit rounded-md bg-amber-500/20 px-2.5 py-1 text-xs font-medium text-amber-100 underline decoration-amber-400/50 underline-offset-2 hover:bg-amber-500/30",children:"Open Claude sign-in ↗"}):(0,t.jsx)("span",{className:"text-xs text-amber-100/60",children:"waiting for the sign-in link…"}),(0,t.jsxs)("div",{className:"mt-1 flex gap-2",children:[(0,t.jsx)(a.Input,{value:l,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"===e.key&&p()},placeholder:"Paste approval code",disabled:m,className:"flex-1 font-mono text-xs"}),(0,t.jsx)(n.Button,{type:"button",onClick:()=>void p(),disabled:!l.trim()||c||m,children:m?"Verifying…":c?"Submitting…":"Submit"})]}),o.lastError?(0,t.jsx)("p",{className:"text-xs text-amber-300",children:o.lastError}):null,"error"===o.phase&&o.error?(0,t.jsx)("p",{className:"text-xs text-red-400",children:o.error}):null,u?(0,t.jsx)("p",{className:"text-xs text-red-400",children:u}):null]})}e.s(["JobLogStream",0,function({jobId:e,endpoint:n,onDone:a,onStatus:o,onLogin:l}){let[i,c]=(0,r.useState)([]),[d,u]=(0,r.useState)(null),x=(0,r.useRef)(null),m=(0,r.useRef)(a);m.current=a;let p=(0,r.useRef)(o);p.current=o;let h=(0,r.useRef)(l);return h.current=l,(0,r.useEffect)(()=>{p.current?.("streaming");let t=new EventSource(n??`/api/jobs/${encodeURIComponent(e)}/logs`);return t.addEventListener("log",e=>{let t=JSON.parse(e.data);c(e=>[...e,t])}),t.addEventListener("login",e=>{let t=JSON.parse(e.data);u(t),h.current?.(t)}),t.addEventListener("end",e=>{let r=JSON.parse(e.data);p.current?.(r.status),m.current?.(r.status),t.close()}),()=>t.close()},[e,n]),(0,r.useEffect)(()=>{let e=x.current;e&&(e.scrollTop=e.scrollHeight)},[i]),(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[d&&"done"!==d.phase?(0,t.jsx)(s,{jobId:e,login:d}):null,(0,t.jsx)("pre",{ref:x,className:"max-h-[440px] min-h-[220px] overflow-auto whitespace-pre rounded-lg bg-[#16181c] p-3 font-mono text-[11.5px] leading-relaxed text-[#d6d9de]",children:0===i.length?"starting…":i.join("\n")})]})}])},33789,1485,e=>{"use strict";var t=e.i(1262),r=e.i(54129);e.s(["Ago",0,function({ms:e}){let[n,a]=(0,r.useState)(!1);return(0,r.useEffect)(()=>a(!0),[]),(0,t.jsx)("span",{suppressHydrationWarning:!0,children:n?function(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return t+"s ago";let r=Math.floor(t/60);if(r<60)return r+"m ago";let n=Math.floor(r/60);return n<24?n+"h ago":Math.floor(n/24)+"d ago"}(e):new Date(e).toLocaleDateString()})}],33789),e.s(["SectionLabel",0,function({children:e,right:r}){return(0,t.jsxs)("div",{className:"mb-3 mt-8 flex items-center gap-2.5 font-mono text-[11px] uppercase tracking-[.1em] text-[#a4a9b0]",children:[e,(0,t.jsx)("span",{className:"h-px flex-1 bg-border"}),r??null]})}],1485)},9383,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={callServer:function(){return s.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let s=e.r(57855),o=e.r(61414),l=e.r(97615)},31758,e=>{"use strict";var t=e.i(1262),r=e.i(44344);e.s(["EmptyBox",0,function({children:e}){return(0,t.jsxs)("div",{className:"rounded-xl border border-dashed border-border bg-card px-5 py-9 text-center text-[13.5px] text-muted-foreground",children:[(0,t.jsx)("div",{className:"mx-auto mb-3 grid h-10 w-10 place-items-center rounded-lg border border-border text-[#a4a9b0]",children:(0,t.jsx)(r.Icons.box,{className:"size-5"})}),e]})}])},23878,e=>{"use strict";var t=e.i(1262),r=e.i(65232);e.s(["Table",0,function({className:e,...n}){return(0,t.jsx)("table",{className:(0,r.cn)("w-full caption-bottom text-sm",e),...n})},"TableBody",0,function({className:e,...n}){return(0,t.jsx)("tbody",{className:(0,r.cn)("[&_tr:last-child]:border-0",e),...n})},"TableCell",0,function({className:e,...n}){return(0,t.jsx)("td",{className:(0,r.cn)("px-4 py-3 align-middle",e),...n})},"TableHead",0,function({className:e,...n}){return(0,t.jsx)("th",{className:(0,r.cn)("h-9 px-4 text-left align-middle font-mono text-[10.5px] font-normal uppercase tracking-[.08em] text-muted-foreground/90",e),...n})},"TableHeader",0,function({className:e,...n}){return(0,t.jsx)("thead",{className:(0,r.cn)("bg-background [&_tr]:border-b [&_tr]:border-border",e),...n})},"TableRow",0,function({className:e,...n}){return(0,t.jsx)("tr",{className:(0,r.cn)("border-b border-border/60 transition-colors hover:bg-[#fcfcfb] data-[state=selected]:bg-accent",e),...n})}])},22983,93268,66818,e=>{"use strict";var t=e.i(1262),r=e.i(45971),n=e.i(33789),a=e.i(44344),s=e.i(86892),o=e.i(8536),l=e.i(23878),i=e.i(30544);e.s(["BoxTable",0,function({boxes:e}){let c=(0,r.useRouter)();return(0,t.jsx)(o.Card,{className:"overflow-hidden",children:(0,t.jsxs)(l.Table,{children:[(0,t.jsx)(l.TableHeader,{children:(0,t.jsxs)(l.TableRow,{className:"hover:bg-transparent",children:[(0,t.jsx)(l.TableHead,{className:"w-[38%]",children:"Task"}),(0,t.jsx)(l.TableHead,{className:"w-[27%] max-md:hidden",children:"Branch"}),(0,t.jsx)(l.TableHead,{className:"max-md:hidden",children:"Status"}),(0,t.jsx)(l.TableHead,{className:"text-right",children:"Actions"})]})}),(0,t.jsx)(l.TableBody,{children:e.map(e=>(0,t.jsxs)(l.TableRow,{className:"cursor-pointer",onClick:()=>c.push("/boxes/"+e.id),children:[(0,t.jsxs)(l.TableCell,{children:[(0,t.jsx)("div",{className:"truncate text-[13.5px] font-medium",children:e.task}),(0,t.jsxs)("div",{className:"mt-0.5 font-mono text-[11px] text-[#a4a9b0]",children:[e.id," · ",e.host]})]}),(0,t.jsxs)(l.TableCell,{className:"max-md:hidden",children:[(0,t.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1.5 font-mono text-xs text-secondary-foreground",children:[(0,t.jsx)(a.Icons.branch,{className:"size-3 flex-none text-muted-foreground"}),(0,t.jsx)("span",{className:"truncate",children:e.branch})]}),(0,t.jsxs)("div",{className:"mt-0.5 font-mono text-[11px] text-[#a4a9b0]",children:[e.agent," · ",(0,t.jsx)(n.Ago,{ms:e.lastActivity})]})]}),(0,t.jsx)(l.TableCell,{className:"max-md:hidden",children:(0,t.jsx)(s.StatusBadge,{status:e.status})}),(0,t.jsx)(l.TableCell,{className:"text-right",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(i.BoxActions,{box:e})})]},e.id))})]})})}],22983);var c=e.i(54129),d=e.i(64595),u=e.i(69377),x=e.i(95141),m=e.i(3060),p=e.i(49604),h=e.i(65232);function b({className:e,...r}){return(0,t.jsx)("textarea",{className:(0,h.cn)("flex min-h-[76px] w-full resize-y rounded-lg border border-input bg-card px-3 py-2 text-sm leading-normal shadow-sm transition-[border-color,box-shadow] placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15",e),...r})}var f=e.i(9383);let g=(0,f.createServerReference)("4070192706087364b8c7d220576a6f3e4d3e5c532b",f.callServer,void 0,f.findSourceMapURL,"createBoxAction"),j=(0,f.createServerReference)("40386bdce4d894a318a969412fa1299d2704ccdfb3",f.callServer,void 0,f.findSourceMapURL,"listBranchesAction");var v=e.i(96621),N=e.i(86184);let S=[{id:"docker",label:"Docker (local)",configured:!0}];function y({project:e,projects:n,onClose:s}){let o=(0,r.useRouter)(),{state:l}=(0,v.useStore)(),i=l.providers.length?l.providers:S,[d,f]=(0,c.useTransition)(),[k,B]=(0,c.useState)(e?.id??n[0]?.id??""),[T,R]=(0,c.useState)("claude"),[D,L]=(0,c.useState)("docker"),[I,A]=(0,c.useState)(""),[P,E]=(0,c.useState)(""),[z,H]=(0,c.useState)(""),[M,O]=(0,c.useState)(null),[U,_]=(0,c.useState)(!1),[F,$]=(0,c.useState)(!1),[J,W]=(0,c.useState)(null),[q,K]=(0,c.useState)(null),[G,V]=(0,c.useState)("streaming"),[Y,Q]=(0,c.useState)(null),X=n.find(e=>e.id===k)??e;return(0,c.useEffect)(()=>{if(!k||q)return;_(X?.needsSetup??!1),L("docker");let e=!1;return O(null),H(X?.currentBranch??""),j(k).then(t=>{if(e||!t.ok){e||t.ok||O([]);return}O(t.branches),t.current&&t.branches.includes(t.current)&&H(t.current)}),()=>{e=!0}},[k,q]),(0,t.jsxs)(x.Dialog,{onClose:s,className:q?"max-w-[900px]":"max-w-[560px]",children:[(0,t.jsxs)(x.DialogHeader,{children:[(0,t.jsx)(x.DialogIcon,{children:(0,t.jsx)(a.Icons.box,{})}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.DialogTitle,{children:"Create box"}),(0,t.jsx)(x.DialogDescription,{children:X?X.name:"Start a box in a project"})]}),q?(0,t.jsx)("div",{className:"ml-auto mr-8 flex-none pt-0.5",children:(0,t.jsx)(w,{status:G,loginPhase:Y})}):null]}),(0,t.jsx)(x.DialogBody,{className:"flex flex-col gap-4",children:q?(0,t.jsx)(N.JobLogStream,{jobId:q,onStatus:V,onDone:()=>o.refresh(),onLogin:e=>Q(e?.phase??null)}):(0,t.jsxs)(t.Fragment,{children:[e?null:(0,t.jsx)(C,{label:"Project",children:(0,t.jsxs)(p.Select,{value:k,onChange:e=>B(e.target.value),children:[0===n.length?(0,t.jsx)("option",{value:"",children:"No projects — add one first"}):null,n.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,t.jsx)(C,{label:"Provider",children:(0,t.jsx)(p.Select,{value:D,onChange:e=>L(e.target.value),children:i.map(e=>(0,t.jsxs)("option",{value:e.id,disabled:!e.configured,title:e.reason,children:[e.label,e.configured?"":" — not configured"]},e.id))})}),(0,t.jsx)(C,{label:"Agent",children:(0,t.jsxs)(p.Select,{value:T,onChange:e=>R(e.target.value),children:[(0,t.jsx)("option",{value:"claude",children:"Claude"}),(0,t.jsx)("option",{value:"codex",children:"Codex"}),(0,t.jsx)("option",{value:"opencode",children:"OpenCode"}),(0,t.jsx)("option",{value:"none",children:"Empty — just create the box"})]})}),(0,t.jsx)(C,{label:"Name (optional)",children:(0,t.jsx)(m.Input,{value:I,onChange:e=>A(e.target.value),placeholder:"auto"})}),X?.needsSetup&&"none"!==T?(0,t.jsxs)("label",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("input",{type:"checkbox",checked:U,onChange:e=>_(e.target.checked),className:"mt-0.5 h-4 w-4 flex-none accent-primary"}),(0,t.jsxs)("span",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-secondary-foreground",children:"Run setup wizard"}),(0,t.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:"This project has no agentbox.yaml — the agent explores the repo and proposes one on its first turn."})]})]}):null,"none"===T?(0,t.jsxs)("p",{className:"font-mono text-xs text-muted-foreground",children:["The box is created and left running with no agent — attach later from a terminal or SSH (",(0,t.jsx)("span",{className:"text-secondary-foreground",children:"agentbox shell"}),")."]}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>$(e=>!e),className:"flex cursor-pointer items-center gap-1.5 self-start text-xs font-medium text-secondary-foreground transition-colors hover:text-foreground",children:[(0,t.jsx)(a.Icons.chevR,{className:(0,h.cn)("size-3.5 transition-transform",F&&"rotate-90")}),"Advanced"]}),F?(0,t.jsxs)(t.Fragment,{children:[null===M?(0,t.jsx)(C,{label:"Base branch",children:(0,t.jsx)(p.Select,{value:"",disabled:!0,children:(0,t.jsx)("option",{value:"",children:"Loading branches…"})})}):M.length>0?(0,t.jsx)(C,{label:"Base branch",children:(0,t.jsxs)(p.Select,{value:z,onChange:e=>H(e.target.value),children:[X?.currentBranch&&!M.includes(X.currentBranch)?(0,t.jsxs)("option",{value:"",children:[X.currentBranch," (current)"]}):null,M.map(e=>(0,t.jsxs)("option",{value:e,children:[e,e===X?.currentBranch?" (current)":""]},e))]})}):null,"none"!==T?(0,t.jsx)(C,{label:"Initial prompt (optional)",children:(0,t.jsx)(b,{value:P,onChange:e=>E(e.target.value),rows:3,placeholder:"Leave empty to just start the agent — attach later from a terminal or SSH."})}):null]}):null]}),J?(0,t.jsx)("div",{className:"font-mono text-xs text-destructive",children:J}):null]})}),(0,t.jsx)(x.DialogFooter,{children:q?(0,t.jsxs)(t.Fragment,{children:["streaming"===G?(0,t.jsx)("span",{className:"mr-auto self-center font-mono text-xs text-muted-foreground",children:"The box + agent start in the background — you can close this."}):null,(0,t.jsx)(u.Button,{onClick:s,children:"Close"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Button,{variant:"outline",onClick:s,disabled:d,children:"Cancel"}),(0,t.jsx)(u.Button,{onClick:()=>{(W(null),k)?f(async()=>{let e=await g({projectId:k,agent:T,provider:D,name:I.trim()||void 0,prompt:"none"===T?void 0:P.trim()||void 0,fromBranch:z.trim()&&z.trim()!==X?.currentBranch?z.trim():void 0,setupWizard:"none"!==T&&U});e.ok?(K(e.jobId),o.refresh()):W(e.error)}):W("pick a project")},disabled:d||!k,children:d?"Starting…":"Create box"})]})})]})}function w({status:e,loginPhase:r}){return"done"===e?(0,t.jsxs)(d.Badge,{className:"badge-run",children:[(0,t.jsx)("span",{className:"badge-dot"}),"Done"]}):"failed"===e||"error"===e||"cancelled"===e?(0,t.jsxs)(d.Badge,{className:"badge-err",children:[(0,t.jsx)("span",{className:"badge-dot"}),"Failed"]}):"error"===r?(0,t.jsxs)(d.Badge,{className:"badge-err",children:[(0,t.jsx)("span",{className:"badge-dot"}),"Login failed"]}):"awaiting-code"===r||"starting"===r||"exchanging"===r?(0,t.jsxs)(d.Badge,{className:"badge-create",children:[(0,t.jsx)("span",{className:"badge-dot"}),"Login required"]}):(0,t.jsxs)(d.Badge,{className:"badge-create",children:[(0,t.jsx)("span",{className:"badge-dot"}),"Working…"]})}function C({label:e,children:r}){return(0,t.jsxs)("label",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-secondary-foreground",children:e}),r]})}e.s(["CreateBoxButton",0,function({project:e,projects:r,variant:n,size:s,className:o}){let[l,i]=(0,c.useState)(!1);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(u.Button,{variant:n,size:s,className:o,onClick:()=>i(!0),children:[(0,t.jsx)(a.Icons.plus,{}),"Create box"]}),l?(0,t.jsx)(y,{project:e,projects:r??(e?[e]:[]),onClose:()=>i(!1)}):null]})}],93268);let k=(0,f.createServerReference)("40c7856bd78dddab224344045df78d51620e411335",f.callServer,void 0,f.findSourceMapURL,"removeProjectAction");e.s(["DeleteProjectButton",0,function({project:e,size:n,className:s,redirectHome:o}){let l=(0,r.useRouter)(),[i,d]=(0,c.useTransition)();return(0,t.jsxs)(u.Button,{variant:"destructive",size:n,className:s,title:"Delete project",disabled:i,onClick:t=>{t.stopPropagation(),t.preventDefault(),window.confirm(`Remove project "${e.name}" from the hub? Its folder and files are NOT deleted — this only unregisters it (and any hub-set project settings). This cannot be undone.`)&&d(async()=>{let t=await k(e.id);t.ok?o?l.push("/"):l.refresh():window.alert(`Delete failed: ${t.error}`)})},children:[(0,t.jsx)(a.Icons.trash,{}),"Delete"]})}],66818)},86691,e=>{"use strict";var t=e.i(1262),r=e.i(45971),n=e.i(33789),a=e.i(44344),s=e.i(96621),o=e.i(80922),l=e.i(22983),i=e.i(93268),c=e.i(66818),d=e.i(31758),u=e.i(1485),x=e.i(35594);e.s(["default",0,function(){let{id:e}=(0,r.useParams)(),{project:m,boxesFor:p}=(0,s.useStore)(),h=m(e);if(!h)return(0,t.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8",children:[(0,t.jsx)(o.BackLink,{to:"/",children:"Dashboard"}),(0,t.jsx)(d.EmptyBox,{children:"Project not found."})]});let b=p(e),f=b.filter(e=>"running"===e.status).length;return(0,t.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8 max-sm:px-4",children:[(0,t.jsx)(o.BackLink,{to:"/",children:"All projects"}),(0,t.jsxs)("div",{className:"flex items-start gap-4 max-md:flex-col",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("h1",{className:"flex items-center gap-3 text-[25px] font-semibold leading-tight tracking-[-0.025em]",children:[(0,t.jsx)("span",{className:"grid h-[26px] w-[26px] flex-none place-items-center rounded-md border border-[var(--green-line)] bg-accent text-primary",children:(0,t.jsx)(a.Icons.folder,{className:"size-[15px]"})}),h.name]}),(0,t.jsxs)("div",{className:"mt-1.5 text-sm text-muted-foreground",children:[(0,t.jsx)("span",{className:"font-mono text-secondary-foreground",children:h.repo})," · ",h.provider]})]}),(0,t.jsxs)("div",{className:"ml-auto flex flex-none gap-2 max-md:ml-0",children:[(0,t.jsx)(i.CreateBoxButton,{project:h}),0===b.length?(0,t.jsx)(c.DeleteProjectButton,{project:h,redirectHome:!0}):null]})]}),(0,t.jsx)("div",{className:"mt-5",children:(0,t.jsxs)(x.StatGrid,{children:[(0,t.jsx)(x.Stat,{k:"Boxes",v:b.length,icon:a.Icons.box}),(0,t.jsx)(x.Stat,{k:"Running",v:f,icon:a.Icons.activity}),(0,t.jsx)(x.Stat,{k:"Provider",v:h.provider,mono:!0}),(0,t.jsx)(x.Stat,{k:"Created",v:(0,t.jsx)(n.Ago,{ms:h.createdAt}),mono:!0})]})}),(0,t.jsx)(u.SectionLabel,{children:"Boxes"}),b.length?(0,t.jsx)(l.BoxTable,{boxes:b}):(0,t.jsx)(d.EmptyBox,{children:(0,t.jsx)("div",{children:"No boxes yet."})})]})}])}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,88451,e=>{"use strict";var t=e.i(1262),r=e.i(45971),n=e.i(54129),s=e.i(44344),a=e.i(69377),o=e.i(9383);let l=(0,o.createServerReference)("60ff5520393ac26282f15f58e0b073a0c45b3ba7e5",o.callServer,void 0,o.findSourceMapURL,"answerApprovalAction");e.s(["ApprovalActions",0,function({id:e}){let o=(0,r.useRouter)(),[i,c]=(0,n.useTransition)(),d=t=>{c(async()=>{let r=await l(e,t);r.ok||window.alert(`Failed: ${r.error}`),o.refresh()})};return(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,t.jsxs)(a.Button,{variant:"outline",size:"sm",disabled:i,className:"hover:border-[var(--red-line)] hover:bg-[var(--red-soft)] hover:text-[var(--red)]",onClick:()=>d("n"),children:[(0,t.jsx)(s.Icons.x,{}),"Deny"]}),(0,t.jsxs)(a.Button,{size:"sm",disabled:i,onClick:()=>d("y"),children:[(0,t.jsx)(s.Icons.check,{}),"Approve"]})]})}],88451)},95141,e=>{"use strict";var t=e.i(1262),r=e.i(54129),n=e.i(65232),s=e.i(44344);e.s(["Dialog",0,function({onClose:e,className:a,children:o}){return(0,r.useEffect)(()=>{let t=t=>{"Escape"===t.key&&e()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),(0,t.jsx)("div",{className:"anim-fade fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-[rgba(20,24,30,.42)] p-6 backdrop-blur-[2px]",onClick:e,children:(0,t.jsxs)("div",{role:"dialog","aria-modal":"true",className:(0,n.cn)("anim-pop relative m-auto w-full max-w-[500px] rounded-2xl border border-border bg-card shadow-[0_40px_80px_-30px_rgba(20,24,30,.5)]",a),onClick:e=>e.stopPropagation(),children:[o,(0,t.jsx)("button",{className:"absolute right-4 top-4 grid h-7 w-7 cursor-pointer place-items-center rounded-md border-0 bg-transparent text-[#a4a9b0] transition-colors hover:bg-secondary hover:text-foreground",onClick:e,"aria-label":"Close",children:(0,t.jsx)(s.Icons.x,{style:{width:15,height:15}})})]})})},"DialogBody",0,function({className:e,...r}){return(0,t.jsx)("div",{className:(0,n.cn)("px-5 py-4",e),...r})},"DialogDescription",0,function({className:e,...r}){return(0,t.jsx)("div",{className:(0,n.cn)("mt-1 font-mono text-xs text-muted-foreground",e),...r})},"DialogFooter",0,function({className:e,...r}){return(0,t.jsx)("div",{className:(0,n.cn)("flex justify-end gap-2.5 rounded-b-2xl border-t border-border/70 bg-background px-5 py-3.5",e),...r})},"DialogHeader",0,function({className:e,...r}){return(0,t.jsx)("div",{className:(0,n.cn)("flex items-start gap-3 border-b border-border/70 px-5 pb-4 pt-5",e),...r})},"DialogIcon",0,function({children:e}){return(0,t.jsx)("span",{className:"grid h-9 w-9 flex-none place-items-center rounded-lg border border-[var(--green-line)] bg-accent text-primary [&_svg]:size-[17px]",children:e})},"DialogTitle",0,function({className:e,...r}){return(0,t.jsx)("div",{className:(0,n.cn)("text-base font-semibold leading-tight tracking-tight",e),...r})}])},86892,30544,e=>{"use strict";var t=e.i(1262),r=e.i(64595);let n={running:{label:"running",badgeClass:"badge-run"},paused:{label:"paused",badgeClass:"badge-pause"},stopped:{label:"stopped",badgeClass:"badge-stop"},creating:{label:"creating",badgeClass:"badge-create"},error:{label:"error",badgeClass:"badge-err"}};e.s(["StatusBadge",0,function({status:e}){let s=n[e]??n.stopped;return(0,t.jsxs)(r.Badge,{className:s.badgeClass,children:[(0,t.jsx)("span",{className:"badge-dot"}),s.label]})}],86892);var s=e.i(45971),a=e.i(54129),o=e.i(65232),l=e.i(69377),i=e.i(44344),c=e.i(9383);let d=(0,c.createServerReference)("40f10bede8a5e7505d5875574f7e6fc4a06e8e2cb7",c.callServer,void 0,c.findSourceMapURL,"destroyBoxAction"),x=(0,c.createServerReference)("40ea16199b5abb2d3c1d4cecdd25aac1e3c41f074c",c.callServer,void 0,c.findSourceMapURL,"pauseBoxAction"),u=(0,c.createServerReference)("4071308a0e1675de302803bb969800c52d79f11e13",c.callServer,void 0,c.findSourceMapURL,"resumeBoxAction"),m=(0,c.createServerReference)("40e545c7dd69b4a1d410deb9c94101099961d3af7a",c.callServer,void 0,c.findSourceMapURL,"stopBoxAction");e.s(["BoxActions",0,function({box:e,size:r}){let n=(0,s.useRouter)(),[c,p]=(0,a.useTransition)(),h="running"===e.status,f="paused"===e.status,b="stopped"===e.status,g="lg"===r,j=g?"sm":"icon-sm",v=(t,r,s)=>{t.stopPropagation(),(!s||window.confirm(s))&&p(async()=>{let t=await r(e.id);t.ok||window.alert(`Action failed: ${t.error}`),n.refresh()})};return(0,t.jsxs)("div",{className:(0,o.cn)("flex gap-1.5",g?"":"justify-end"),children:[f?(0,t.jsxs)(l.Button,{variant:g?"default":"outline",size:j,title:"Resume",disabled:c,className:g?"":"hover:border-[var(--green)] hover:bg-accent hover:text-[var(--green-ink)]",onClick:e=>v(e,u),children:[(0,t.jsx)(i.Icons.play,{}),g?"Resume":null]}):(0,t.jsxs)(l.Button,{variant:"outline",size:j,disabled:c||!h,title:"Pause",className:g?"":"hover:border-[var(--amber)] hover:bg-[var(--amber-soft)] hover:text-[var(--amber)]",onClick:e=>v(e,x),children:[(0,t.jsx)(i.Icons.pause,{}),g?"Pause":null]}),(0,t.jsxs)(l.Button,{variant:"outline",size:j,disabled:c||b,title:"Stop",onClick:e=>v(e,m),children:[(0,t.jsx)(i.Icons.stop,{}),g?"Stop":null]}),(0,t.jsxs)(l.Button,{variant:"destructive",size:j,title:"Destroy",disabled:c,onClick:t=>v(t,d,`Destroy box ${e.id}? Its workspace volume is discarded. This cannot be undone.`),children:[(0,t.jsx)(i.Icons.trash,{}),g?"Destroy":null]})]})}],30544)},49604,e=>{"use strict";var t=e.i(1262),r=e.i(65232);e.s(["Select",0,function({wrapperClassName:e,className:n,children:s,...a}){return(0,t.jsxs)("span",{className:(0,r.cn)("relative inline-flex",e),children:[(0,t.jsx)("select",{className:(0,r.cn)("h-9 w-full cursor-pointer appearance-none rounded-lg border border-input bg-card py-1 pl-3 pr-9 text-[13px] shadow-sm focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15",n),...a,children:s}),(0,t.jsx)("svg",{className:"pointer-events-none absolute right-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:(0,t.jsx)("path",{d:"m6 9 6 6 6-6"})})]})}])},8536,e=>{"use strict";var t=e.i(1262),r=e.i(65232);e.s(["Card",0,function({className:e,...n}){return(0,t.jsx)("div",{className:(0,r.cn)("rounded-xl border border-border bg-card text-card-foreground",e),...n})},"CardContent",0,function({className:e,...n}){return(0,t.jsx)("div",{className:(0,r.cn)("p-5 pt-0",e),...n})},"CardDescription",0,function({className:e,...n}){return(0,t.jsx)("div",{className:(0,r.cn)("text-[12.5px] text-muted-foreground",e),...n})},"CardHeader",0,function({className:e,...n}){return(0,t.jsx)("div",{className:(0,r.cn)("flex flex-col space-y-1 p-5",e),...n})},"CardTitle",0,function({className:e,...n}){return(0,t.jsx)("div",{className:(0,r.cn)("text-[15px] font-semibold leading-none tracking-tight",e),...n})}])},3060,e=>{"use strict";var t=e.i(1262),r=e.i(65232);e.s(["Input",0,function({className:e,...n}){return(0,t.jsx)("input",{className:(0,r.cn)("flex h-10 w-full rounded-lg border border-input bg-card px-3 py-1 text-sm shadow-sm transition-[border-color,box-shadow] placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15",e),...n})}])},86184,e=>{"use strict";var t=e.i(1262),r=e.i(54129),n=e.i(69377),s=e.i(3060);function a({jobId:e,login:o}){let[l,i]=(0,r.useState)(""),[c,d]=(0,r.useState)(!1),[x,u]=(0,r.useState)(null),m="exchanging"===o.phase,p=async()=>{let t=l.trim();if(t&&!c){d(!0),u(null);try{let r=await fetch(`/api/v1/jobs/${encodeURIComponent(e)}/login-code`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:t})});if(!r.ok){let e=await r.json().catch(()=>null);u(e?.error?.message??`request failed (${r.status})`);return}i("")}catch(e){u(e instanceof Error?e.message:String(e))}finally{d(!1)}}};return(0,t.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 p-3",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-amber-200",children:"Claude login required"}),(0,t.jsx)("p",{className:"text-xs text-amber-100/80",children:"Your saved Claude login is expired. Open the sign-in page, approve access, then paste the code Claude shows you."}),o.url?(0,t.jsx)("a",{href:o.url,target:"_blank",rel:"noreferrer",className:"w-fit rounded-md bg-amber-500/20 px-2.5 py-1 text-xs font-medium text-amber-100 underline decoration-amber-400/50 underline-offset-2 hover:bg-amber-500/30",children:"Open Claude sign-in ↗"}):(0,t.jsx)("span",{className:"text-xs text-amber-100/60",children:"waiting for the sign-in link…"}),(0,t.jsxs)("div",{className:"mt-1 flex gap-2",children:[(0,t.jsx)(s.Input,{value:l,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"===e.key&&p()},placeholder:"Paste approval code",disabled:m,className:"flex-1 font-mono text-xs"}),(0,t.jsx)(n.Button,{type:"button",onClick:()=>void p(),disabled:!l.trim()||c||m,children:m?"Verifying…":c?"Submitting…":"Submit"})]}),o.lastError?(0,t.jsx)("p",{className:"text-xs text-amber-300",children:o.lastError}):null,"error"===o.phase&&o.error?(0,t.jsx)("p",{className:"text-xs text-red-400",children:o.error}):null,x?(0,t.jsx)("p",{className:"text-xs text-red-400",children:x}):null]})}e.s(["JobLogStream",0,function({jobId:e,endpoint:n,onDone:s,onStatus:o,onLogin:l}){let[i,c]=(0,r.useState)([]),[d,x]=(0,r.useState)(null),u=(0,r.useRef)(null),m=(0,r.useRef)(s);m.current=s;let p=(0,r.useRef)(o);p.current=o;let h=(0,r.useRef)(l);return h.current=l,(0,r.useEffect)(()=>{p.current?.("streaming");let t=new EventSource(n??`/api/jobs/${encodeURIComponent(e)}/logs`);return t.addEventListener("log",e=>{let t=JSON.parse(e.data);c(e=>[...e,t])}),t.addEventListener("login",e=>{let t=JSON.parse(e.data);x(t),h.current?.(t)}),t.addEventListener("end",e=>{let r=JSON.parse(e.data);p.current?.(r.status),m.current?.(r.status),t.close()}),()=>t.close()},[e,n]),(0,r.useEffect)(()=>{let e=u.current;e&&(e.scrollTop=e.scrollHeight)},[i]),(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[d&&"done"!==d.phase?(0,t.jsx)(a,{jobId:e,login:d}):null,(0,t.jsx)("pre",{ref:u,className:"max-h-[440px] min-h-[220px] overflow-auto whitespace-pre rounded-lg bg-[#16181c] p-3 font-mono text-[11.5px] leading-relaxed text-[#d6d9de]",children:0===i.length?"starting…":i.join("\n")})]})}])},33789,1485,e=>{"use strict";var t=e.i(1262),r=e.i(54129);e.s(["Ago",0,function({ms:e}){let[n,s]=(0,r.useState)(!1);return(0,r.useEffect)(()=>s(!0),[]),(0,t.jsx)("span",{suppressHydrationWarning:!0,children:n?function(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return t+"s ago";let r=Math.floor(t/60);if(r<60)return r+"m ago";let n=Math.floor(r/60);return n<24?n+"h ago":Math.floor(n/24)+"d ago"}(e):new Date(e).toLocaleDateString()})}],33789),e.s(["SectionLabel",0,function({children:e,right:r}){return(0,t.jsxs)("div",{className:"mb-3 mt-8 flex items-center gap-2.5 font-mono text-[11px] uppercase tracking-[.1em] text-[#a4a9b0]",children:[e,(0,t.jsx)("span",{className:"h-px flex-1 bg-border"}),r??null]})}],1485)},9383,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={callServer:function(){return a.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var s in n)Object.defineProperty(r,s,{enumerable:!0,get:n[s]});let a=e.r(57855),o=e.r(61414),l=e.r(97615)},31758,e=>{"use strict";var t=e.i(1262),r=e.i(44344);e.s(["EmptyBox",0,function({children:e}){return(0,t.jsxs)("div",{className:"rounded-xl border border-dashed border-border bg-card px-5 py-9 text-center text-[13.5px] text-muted-foreground",children:[(0,t.jsx)("div",{className:"mx-auto mb-3 grid h-10 w-10 place-items-center rounded-lg border border-border text-[#a4a9b0]",children:(0,t.jsx)(r.Icons.box,{className:"size-5"})}),e]})}])},23878,e=>{"use strict";var t=e.i(1262),r=e.i(65232);e.s(["Table",0,function({className:e,...n}){return(0,t.jsx)("table",{className:(0,r.cn)("w-full caption-bottom text-sm",e),...n})},"TableBody",0,function({className:e,...n}){return(0,t.jsx)("tbody",{className:(0,r.cn)("[&_tr:last-child]:border-0",e),...n})},"TableCell",0,function({className:e,...n}){return(0,t.jsx)("td",{className:(0,r.cn)("px-4 py-3 align-middle",e),...n})},"TableHead",0,function({className:e,...n}){return(0,t.jsx)("th",{className:(0,r.cn)("h-9 px-4 text-left align-middle font-mono text-[10.5px] font-normal uppercase tracking-[.08em] text-muted-foreground/90",e),...n})},"TableHeader",0,function({className:e,...n}){return(0,t.jsx)("thead",{className:(0,r.cn)("bg-background [&_tr]:border-b [&_tr]:border-border",e),...n})},"TableRow",0,function({className:e,...n}){return(0,t.jsx)("tr",{className:(0,r.cn)("border-b border-border/60 transition-colors hover:bg-[#fcfcfb] data-[state=selected]:bg-accent",e),...n})}])},22983,93268,66818,e=>{"use strict";var t=e.i(1262),r=e.i(45971),n=e.i(33789),s=e.i(44344),a=e.i(86892),o=e.i(8536),l=e.i(23878),i=e.i(30544);e.s(["BoxTable",0,function({boxes:e}){let c=(0,r.useRouter)();return(0,t.jsx)(o.Card,{className:"overflow-hidden",children:(0,t.jsxs)(l.Table,{children:[(0,t.jsx)(l.TableHeader,{children:(0,t.jsxs)(l.TableRow,{className:"hover:bg-transparent",children:[(0,t.jsx)(l.TableHead,{className:"w-[38%]",children:"Task"}),(0,t.jsx)(l.TableHead,{className:"w-[27%] max-md:hidden",children:"Branch"}),(0,t.jsx)(l.TableHead,{className:"max-md:hidden",children:"Status"}),(0,t.jsx)(l.TableHead,{className:"text-right",children:"Actions"})]})}),(0,t.jsx)(l.TableBody,{children:e.map(e=>(0,t.jsxs)(l.TableRow,{className:"cursor-pointer",onClick:()=>c.push("/boxes/"+e.id),children:[(0,t.jsxs)(l.TableCell,{children:[(0,t.jsx)("div",{className:"truncate text-[13.5px] font-medium",children:e.task}),(0,t.jsxs)("div",{className:"mt-0.5 font-mono text-[11px] text-[#a4a9b0]",children:[e.id," · ",e.host]})]}),(0,t.jsxs)(l.TableCell,{className:"max-md:hidden",children:[(0,t.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1.5 font-mono text-xs text-secondary-foreground",children:[(0,t.jsx)(s.Icons.branch,{className:"size-3 flex-none text-muted-foreground"}),(0,t.jsx)("span",{className:"truncate",children:e.branch})]}),(0,t.jsxs)("div",{className:"mt-0.5 font-mono text-[11px] text-[#a4a9b0]",children:[e.agent," · ",(0,t.jsx)(n.Ago,{ms:e.lastActivity})]})]}),(0,t.jsx)(l.TableCell,{className:"max-md:hidden",children:(0,t.jsx)(a.StatusBadge,{status:e.status})}),(0,t.jsx)(l.TableCell,{className:"text-right",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(i.BoxActions,{box:e})})]},e.id))})]})})}],22983);var c=e.i(54129),d=e.i(64595),x=e.i(69377),u=e.i(95141),m=e.i(3060),p=e.i(49604),h=e.i(65232);function f({className:e,...r}){return(0,t.jsx)("textarea",{className:(0,h.cn)("flex min-h-[76px] w-full resize-y rounded-lg border border-input bg-card px-3 py-2 text-sm leading-normal shadow-sm transition-[border-color,box-shadow] placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15",e),...r})}var b=e.i(9383);let g=(0,b.createServerReference)("4070192706087364b8c7d220576a6f3e4d3e5c532b",b.callServer,void 0,b.findSourceMapURL,"createBoxAction"),j=(0,b.createServerReference)("40386bdce4d894a318a969412fa1299d2704ccdfb3",b.callServer,void 0,b.findSourceMapURL,"listBranchesAction");var v=e.i(96621),N=e.i(86184);let S=[{id:"docker",label:"Docker (local)",configured:!0}];function y({project:e,projects:n,onClose:a}){let o=(0,r.useRouter)(),{state:l}=(0,v.useStore)(),i=l.providers.length?l.providers:S,[d,b]=(0,c.useTransition)(),[k,B]=(0,c.useState)(e?.id??n[0]?.id??""),[R,D]=(0,c.useState)("claude"),[T,I]=(0,c.useState)("docker"),[A,L]=(0,c.useState)(""),[z,P]=(0,c.useState)(""),[E,U]=(0,c.useState)(""),[M,H]=(0,c.useState)(null),[O,F]=(0,c.useState)(!1),[_,$]=(0,c.useState)(!1),[J,K]=(0,c.useState)(null),[W,q]=(0,c.useState)(null),[V,Y]=(0,c.useState)("streaming"),[G,Q]=(0,c.useState)(null),X=n.find(e=>e.id===k)??e;return(0,c.useEffect)(()=>{if(!k||W)return;F(X?.needsSetup??!1),I("docker");let e=!1;return H(null),U(X?.currentBranch??""),j(k).then(t=>{if(e||!t.ok){e||t.ok||H([]);return}H(t.branches),t.current&&t.branches.includes(t.current)&&U(t.current)}),()=>{e=!0}},[k,W]),(0,t.jsxs)(u.Dialog,{onClose:a,className:W?"max-w-[900px]":"max-w-[560px]",children:[(0,t.jsxs)(u.DialogHeader,{children:[(0,t.jsx)(u.DialogIcon,{children:(0,t.jsx)(s.Icons.box,{})}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.DialogTitle,{children:"Create box"}),(0,t.jsx)(u.DialogDescription,{children:X?X.name:"Start a box in a project"})]}),W?(0,t.jsx)("div",{className:"ml-auto mr-8 flex-none pt-0.5",children:(0,t.jsx)(w,{status:V,loginPhase:G})}):null]}),(0,t.jsx)(u.DialogBody,{className:"flex flex-col gap-4",children:W?(0,t.jsx)(N.JobLogStream,{jobId:W,onStatus:Y,onDone:()=>o.refresh(),onLogin:e=>Q(e?.phase??null)}):(0,t.jsxs)(t.Fragment,{children:[e?null:(0,t.jsx)(C,{label:"Project",children:(0,t.jsxs)(p.Select,{value:k,onChange:e=>B(e.target.value),children:[0===n.length?(0,t.jsx)("option",{value:"",children:"No projects — add one first"}):null,n.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,t.jsx)(C,{label:"Provider",children:(0,t.jsx)(p.Select,{value:T,onChange:e=>I(e.target.value),children:i.map(e=>(0,t.jsxs)("option",{value:e.id,disabled:!e.configured,title:e.reason,children:[e.label,e.configured?"":" — not configured"]},e.id))})}),(0,t.jsx)(C,{label:"Agent",children:(0,t.jsxs)(p.Select,{value:R,onChange:e=>D(e.target.value),children:[(0,t.jsx)("option",{value:"claude",children:"Claude"}),(0,t.jsx)("option",{value:"codex",children:"Codex"}),(0,t.jsx)("option",{value:"opencode",children:"OpenCode"}),(0,t.jsx)("option",{value:"none",children:"Empty — just create the box"})]})}),(0,t.jsx)(C,{label:"Name (optional)",children:(0,t.jsx)(m.Input,{value:A,onChange:e=>L(e.target.value),placeholder:"auto"})}),X?.needsSetup&&"none"!==R?(0,t.jsxs)("label",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("input",{type:"checkbox",checked:O,onChange:e=>F(e.target.checked),className:"mt-0.5 h-4 w-4 flex-none accent-primary"}),(0,t.jsxs)("span",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-secondary-foreground",children:"Run setup wizard"}),(0,t.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:"This project has no agentbox.yaml — the agent explores the repo and proposes one on its first turn."})]})]}):null,"none"===R?(0,t.jsxs)("p",{className:"font-mono text-xs text-muted-foreground",children:["The box is created and left running with no agent — attach later from a terminal or SSH (",(0,t.jsx)("span",{className:"text-secondary-foreground",children:"agentbox shell"}),")."]}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>$(e=>!e),className:"flex cursor-pointer items-center gap-1.5 self-start text-xs font-medium text-secondary-foreground transition-colors hover:text-foreground",children:[(0,t.jsx)(s.Icons.chevR,{className:(0,h.cn)("size-3.5 transition-transform",_&&"rotate-90")}),"Advanced"]}),_?(0,t.jsxs)(t.Fragment,{children:[null===M?(0,t.jsx)(C,{label:"Base branch",children:(0,t.jsx)(p.Select,{value:"",disabled:!0,children:(0,t.jsx)("option",{value:"",children:"Loading branches…"})})}):M.length>0?(0,t.jsx)(C,{label:"Base branch",children:(0,t.jsxs)(p.Select,{value:E,onChange:e=>U(e.target.value),children:[X?.currentBranch&&!M.includes(X.currentBranch)?(0,t.jsxs)("option",{value:"",children:[X.currentBranch," (current)"]}):null,M.map(e=>(0,t.jsxs)("option",{value:e,children:[e,e===X?.currentBranch?" (current)":""]},e))]})}):null,"none"!==R?(0,t.jsx)(C,{label:"Initial prompt (optional)",children:(0,t.jsx)(f,{value:z,onChange:e=>P(e.target.value),rows:3,placeholder:"Leave empty to just start the agent — attach later from a terminal or SSH."})}):null]}):null]}),J?(0,t.jsx)("div",{className:"font-mono text-xs text-destructive",children:J}):null]})}),(0,t.jsx)(u.DialogFooter,{children:W?(0,t.jsxs)(t.Fragment,{children:["streaming"===V?(0,t.jsx)("span",{className:"mr-auto self-center font-mono text-xs text-muted-foreground",children:"The box + agent start in the background — you can close this."}):null,(0,t.jsx)(x.Button,{onClick:a,children:"Close"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Button,{variant:"outline",onClick:a,disabled:d,children:"Cancel"}),(0,t.jsx)(x.Button,{onClick:()=>{(K(null),k)?b(async()=>{let e=await g({projectId:k,agent:R,provider:T,name:A.trim()||void 0,prompt:"none"===R?void 0:z.trim()||void 0,fromBranch:E.trim()&&E.trim()!==X?.currentBranch?E.trim():void 0,setupWizard:"none"!==R&&O});e.ok?(q(e.jobId),o.refresh()):K(e.error)}):K("pick a project")},disabled:d||!k,children:d?"Starting…":"Create box"})]})})]})}function w({status:e,loginPhase:r}){return"done"===e?(0,t.jsxs)(d.Badge,{className:"badge-run",children:[(0,t.jsx)("span",{className:"badge-dot"}),"Done"]}):"failed"===e||"error"===e||"cancelled"===e?(0,t.jsxs)(d.Badge,{className:"badge-err",children:[(0,t.jsx)("span",{className:"badge-dot"}),"Failed"]}):"error"===r?(0,t.jsxs)(d.Badge,{className:"badge-err",children:[(0,t.jsx)("span",{className:"badge-dot"}),"Login failed"]}):"awaiting-code"===r||"starting"===r||"exchanging"===r?(0,t.jsxs)(d.Badge,{className:"badge-create",children:[(0,t.jsx)("span",{className:"badge-dot"}),"Login required"]}):(0,t.jsxs)(d.Badge,{className:"badge-create",children:[(0,t.jsx)("span",{className:"badge-dot"}),"Working…"]})}function C({label:e,children:r}){return(0,t.jsxs)("label",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-secondary-foreground",children:e}),r]})}e.s(["CreateBoxButton",0,function({project:e,projects:r,variant:n,size:a,className:o}){let[l,i]=(0,c.useState)(!1);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(x.Button,{variant:n,size:a,className:o,onClick:()=>i(!0),children:[(0,t.jsx)(s.Icons.plus,{}),"Create box"]}),l?(0,t.jsx)(y,{project:e,projects:r??(e?[e]:[]),onClose:()=>i(!1)}):null]})}],93268);let k=(0,b.createServerReference)("40c7856bd78dddab224344045df78d51620e411335",b.callServer,void 0,b.findSourceMapURL,"removeProjectAction");e.s(["DeleteProjectButton",0,function({project:e,size:n,className:a,redirectHome:o}){let l=(0,r.useRouter)(),[i,d]=(0,c.useTransition)();return(0,t.jsxs)(x.Button,{variant:"destructive",size:n,className:a,title:"Delete project",disabled:i,onClick:t=>{t.stopPropagation(),t.preventDefault(),window.confirm(`Remove project "${e.name}" from the hub? Its folder and files are NOT deleted — this only unregisters it (and any hub-set project settings). This cannot be undone.`)&&d(async()=>{let t=await k(e.id);t.ok?o?l.push("/"):l.refresh():window.alert(`Delete failed: ${t.error}`)})},children:[(0,t.jsx)(s.Icons.trash,{}),"Delete"]})}],66818)},87340,e=>{"use strict";var t=e.i(1262),r=e.i(51096),n=e.i(44344),s=e.i(96621),a=e.i(88451);function o(){let{state:e,box:o}=(0,s.useStore)();if(0===e.approvals.length)return null;let l=[...e.approvals].sort((e,t)=>e.createdAt-t.createdAt),i=l[0],c=o(i.boxId);return(0,t.jsxs)("div",{className:"mb-6 flex items-start gap-3 rounded-xl border border-[var(--amber-line)] bg-[var(--amber-soft)] p-4",children:[(0,t.jsx)(n.Icons.shield,{className:"mt-0.5 size-4 flex-none text-[var(--amber)]"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[c?(0,t.jsx)(r.default,{className:"text-[13.5px] font-semibold hover:text-[var(--green-ink)]",href:"/boxes/"+c.id,children:c.task}):(0,t.jsx)("span",{className:"text-[13.5px] font-semibold",children:i.boxId}),(0,t.jsx)("span",{className:"truncate font-mono text-[12.5px] text-secondary-foreground",children:i.command??i.message})]}),i.detail?(0,t.jsx)("div",{className:"mt-0.5 truncate text-[11.5px] text-muted-foreground",children:i.detail}):null,i.cwd?(0,t.jsx)("div",{className:"mt-0.5 truncate font-mono text-[11px] text-[#a4a9b0]",children:i.cwd}):null]}),(0,t.jsxs)("div",{className:"flex flex-none items-center gap-3",children:[l.length>1?(0,t.jsxs)("div",{className:"hidden items-center gap-2 sm:flex",children:[(0,t.jsxs)("span",{className:"font-mono text-[11.5px] text-[var(--amber)]",children:[l.length," pending"]}),(0,t.jsx)(r.default,{className:"font-mono text-[11.5px] text-muted-foreground hover:text-[var(--green-ink)]",href:"/approvals",children:"View all"})]}):null,(0,t.jsx)(a.ApprovalActions,{id:i.id})]})]})}var l=e.i(45971),i=e.i(54129),c=e.i(69377),d=e.i(95141),x=e.i(3060),u=e.i(9383);let m=(0,u.createServerReference)("4087bb6da1f4834ca146bcc8cb7c69295dbeda0bdc",u.callServer,void 0,u.findSourceMapURL,"addProjectAction"),p=(0,u.createServerReference)("40942714d29a270a6816a39cd419b4f09f50fc19b1",u.callServer,void 0,u.findSourceMapURL,"browseDirAction");function h(){let[e,r]=(0,i.useState)(!1);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(c.Button,{onClick:()=>r(!0),children:[(0,t.jsx)(n.Icons.plus,{}),"New project"]}),e?(0,t.jsx)(f,{onClose:()=>r(!1)}):null]})}function f({onClose:e}){let r=(0,l.useRouter)(),[s,a]=(0,i.useTransition)(),[o,u]=(0,i.useState)(""),[h,b]=(0,i.useState)(null),[g,j]=(0,i.useState)([]),[v,N]=(0,i.useState)(!0),[S,y]=(0,i.useState)(null),w=(0,i.useCallback)(async e=>{N(!0),y(null);let t=await p(e);if(!t.ok){y(t.error),N(!1);return}u(t.path),b(t.parent),j(t.entries),N(!1)},[]);return(0,i.useEffect)(()=>{w()},[w]),(0,t.jsxs)(d.Dialog,{onClose:e,children:[(0,t.jsxs)(d.DialogHeader,{children:[(0,t.jsx)(d.DialogIcon,{children:(0,t.jsx)(n.Icons.folder,{})}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.DialogTitle,{children:"Add project"}),(0,t.jsx)(d.DialogDescription,{children:"Pick a folder on this machine"})]})]}),(0,t.jsxs)(d.DialogBody,{className:"flex flex-col gap-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.Button,{variant:"outline",className:"flex-none px-2.5",onClick:()=>void w(h??void 0),disabled:!h||v,title:"Up one level","aria-label":"Up one level",children:(0,t.jsx)(n.Icons.arrowUp,{})}),(0,t.jsx)(x.Input,{value:o,onChange:e=>u(e.target.value),placeholder:"/Users/you/Projects/my-app",className:"font-mono text-xs",onKeyDown:e=>{"Enter"===e.key&&w(o)}})]}),(0,t.jsx)("div",{className:"h-56 overflow-y-auto rounded-lg border border-border bg-background",children:v?(0,t.jsx)("div",{className:"px-3 py-2.5 font-mono text-xs text-muted-foreground",children:"Loading…"}):0===g.length?(0,t.jsx)("div",{className:"px-3 py-2.5 font-mono text-xs text-muted-foreground",children:"No subfolders here"}):g.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>void w(e.path),className:"flex w-full cursor-pointer items-center gap-2 border-0 border-b border-border/60 bg-transparent px-3 py-2 text-left text-[13px] transition-colors last:border-b-0 hover:bg-secondary",children:[(0,t.jsx)(n.Icons.folder,{className:"size-4 flex-none text-muted-foreground"}),(0,t.jsx)("span",{className:"truncate",children:e.name}),e.isProject?(0,t.jsx)("span",{className:"ml-auto flex-none rounded border border-[var(--green-line)] bg-accent px-1.5 py-px font-mono text-[10px] uppercase tracking-wide text-primary",children:"project"}):(0,t.jsx)(n.Icons.chevR,{className:"ml-auto size-3.5 flex-none text-[#a4a9b0]"})]},e.path))}),S?(0,t.jsx)("div",{className:"font-mono text-xs text-destructive",children:S}):null]}),(0,t.jsxs)(d.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",onClick:e,disabled:s,children:"Cancel"}),(0,t.jsx)(c.Button,{onClick:()=>{y(null);let t=o.trim();t?a(async()=>{let n=await m(t);n.ok?(r.refresh(),e()):y(n.error)}):y("choose a folder")},disabled:s||v,children:s?"Adding…":"Add this folder"})]})]})}var b=e.i(22983),g=e.i(93268),j=e.i(66818),v=e.i(31758),N=e.i(1485);e.s(["default",0,function(){let{state:e,boxesFor:a}=(0,s.useStore)(),l=e.projects.map(e=>({p:e,boxes:a(e.id)})).sort((e,t)=>(e.boxes.length>0?0:1)-(t.boxes.length>0?0:1)),i=e.boxes.filter(e=>"running"===e.status).length;return(0,t.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8 max-sm:px-4",children:[(0,t.jsx)(o,{}),(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h1",{className:"text-[25px] font-semibold leading-tight tracking-[-0.025em]",children:"Boxes"}),(0,t.jsxs)("div",{className:"mt-1.5 text-sm text-muted-foreground",children:[(0,t.jsx)("span",{className:"font-mono text-secondary-foreground",children:i})," running across"," ",(0,t.jsx)("span",{className:"font-mono text-secondary-foreground",children:e.projects.length})," ","project",1===e.projects.length?"":"s"," on this machine."]})]}),(0,t.jsx)("div",{className:"ml-auto flex flex-none gap-2",children:(0,t.jsx)(h,{})})]}),(0,t.jsx)(N.SectionLabel,{children:"Projects"}),0===l.length?(0,t.jsxs)(v.EmptyBox,{children:[(0,t.jsx)("div",{children:"No projects on this machine yet."}),(0,t.jsx)("div",{className:"mt-1.5 font-mono text-xs text-muted-foreground",children:"Add one with “New project”, or run `agentbox create` in a folder."})]}):null,l.map(({p:e,boxes:s})=>(0,t.jsxs)("div",{className:"mb-7",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 px-1 pb-3",children:[(0,t.jsxs)(r.default,{className:"flex cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-[15px] font-semibold tracking-[-0.01em] text-foreground hover:text-[var(--green-ink)]",href:"/projects/"+e.id,children:[(0,t.jsx)("span",{className:"grid h-[22px] w-[22px] flex-none place-items-center rounded-md border border-[var(--green-line)] bg-accent text-primary",children:(0,t.jsx)(n.Icons.folder,{className:"size-[13px]"})}),e.name]}),(0,t.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:e.repo}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsxs)("span",{className:"font-mono text-[11.5px] text-[#a4a9b0]",children:[s.length," box",1===s.length?"":"es"]}),(0,t.jsx)(g.CreateBoxButton,{project:e,variant:"outline",size:"sm",className:"font-mono text-xs"}),0===s.length?(0,t.jsx)(j.DeleteProjectButton,{project:e,size:"sm",className:"font-mono text-xs"}):null]}),s.length?(0,t.jsx)(b.BoxTable,{boxes:s}):(0,t.jsx)(v.EmptyBox,{children:(0,t.jsxs)("div",{children:["No boxes in ",(0,t.jsx)("b",{className:"font-semibold text-secondary-foreground",children:e.name})," yet."]})})]},e.id))]})}],87340)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33789,1485,e=>{"use strict";var r=e.i(1262),t=e.i(54129);e.s(["Ago",0,function({ms:e}){let[n,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>s(!0),[]),(0,r.jsx)("span",{suppressHydrationWarning:!0,children:n?function(e){let r=Math.floor((Date.now()-e)/1e3);if(r<60)return r+"s ago";let t=Math.floor(r/60);if(t<60)return t+"m ago";let n=Math.floor(t/60);return n<24?n+"h ago":Math.floor(n/24)+"d ago"}(e):new Date(e).toLocaleDateString()})}],33789),e.s(["SectionLabel",0,function({children:e,right:t}){return(0,r.jsxs)("div",{className:"mb-3 mt-8 flex items-center gap-2.5 font-mono text-[11px] uppercase tracking-[.1em] text-[#a4a9b0]",children:[e,(0,r.jsx)("span",{className:"h-px flex-1 bg-border"}),t??null]})}],1485)},9383,(e,r,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={callServer:function(){return a.callServer},createServerReference:function(){return o.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}};for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:n[s]});let a=e.r(57855),i=e.r(61414),o=e.r(97615)},31758,e=>{"use strict";var r=e.i(1262),t=e.i(44344);e.s(["EmptyBox",0,function({children:e}){return(0,r.jsxs)("div",{className:"rounded-xl border border-dashed border-border bg-card px-5 py-9 text-center text-[13.5px] text-muted-foreground",children:[(0,r.jsx)("div",{className:"mx-auto mb-3 grid h-10 w-10 place-items-center rounded-lg border border-border text-[#a4a9b0]",children:(0,r.jsx)(t.Icons.box,{className:"size-5"})}),e]})}])},88451,e=>{"use strict";var r=e.i(1262),t=e.i(45971),n=e.i(54129),s=e.i(44344),a=e.i(69377),i=e.i(9383);let o=(0,i.createServerReference)("60ff5520393ac26282f15f58e0b073a0c45b3ba7e5",i.callServer,void 0,i.findSourceMapURL,"answerApprovalAction");e.s(["ApprovalActions",0,function({id:e}){let i=(0,t.useRouter)(),[l,c]=(0,n.useTransition)(),d=r=>{c(async()=>{let t=await o(e,r);t.ok||window.alert(`Failed: ${t.error}`),i.refresh()})};return(0,r.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,r.jsxs)(a.Button,{variant:"outline",size:"sm",disabled:l,className:"hover:border-[var(--red-line)] hover:bg-[var(--red-soft)] hover:text-[var(--red)]",onClick:()=>d("n"),children:[(0,r.jsx)(s.Icons.x,{}),"Deny"]}),(0,r.jsxs)(a.Button,{size:"sm",disabled:l,onClick:()=>d("y"),children:[(0,r.jsx)(s.Icons.check,{}),"Approve"]})]})}],88451)},16200,e=>{"use strict";var r=e.i(1262),t=e.i(65232);e.s(["Label",0,function({className:e,...n}){return(0,r.jsx)("label",{className:(0,t.cn)("mb-2 block text-[13px] font-medium leading-none",e),...n})}])},8536,e=>{"use strict";var r=e.i(1262),t=e.i(65232);e.s(["Card",0,function({className:e,...n}){return(0,r.jsx)("div",{className:(0,t.cn)("rounded-xl border border-border bg-card text-card-foreground",e),...n})},"CardContent",0,function({className:e,...n}){return(0,r.jsx)("div",{className:(0,t.cn)("p-5 pt-0",e),...n})},"CardDescription",0,function({className:e,...n}){return(0,r.jsx)("div",{className:(0,t.cn)("text-[12.5px] text-muted-foreground",e),...n})},"CardHeader",0,function({className:e,...n}){return(0,r.jsx)("div",{className:(0,t.cn)("flex flex-col space-y-1 p-5",e),...n})},"CardTitle",0,function({className:e,...n}){return(0,r.jsx)("div",{className:(0,t.cn)("text-[15px] font-semibold leading-none tracking-tight",e),...n})}])},3060,e=>{"use strict";var r=e.i(1262),t=e.i(65232);e.s(["Input",0,function({className:e,...n}){return(0,r.jsx)("input",{className:(0,t.cn)("flex h-10 w-full rounded-lg border border-input bg-card px-3 py-1 text-sm shadow-sm transition-[border-color,box-shadow] placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15",e),...n})}])},86892,30544,e=>{"use strict";var r=e.i(1262),t=e.i(64595);let n={running:{label:"running",badgeClass:"badge-run"},paused:{label:"paused",badgeClass:"badge-pause"},stopped:{label:"stopped",badgeClass:"badge-stop"},creating:{label:"creating",badgeClass:"badge-create"},error:{label:"error",badgeClass:"badge-err"}};e.s(["StatusBadge",0,function({status:e}){let s=n[e]??n.stopped;return(0,r.jsxs)(t.Badge,{className:s.badgeClass,children:[(0,r.jsx)("span",{className:"badge-dot"}),s.label]})}],86892);var s=e.i(45971),a=e.i(54129),i=e.i(65232),o=e.i(69377),l=e.i(44344),c=e.i(9383);let d=(0,c.createServerReference)("40f10bede8a5e7505d5875574f7e6fc4a06e8e2cb7",c.callServer,void 0,c.findSourceMapURL,"destroyBoxAction"),x=(0,c.createServerReference)("40ea16199b5abb2d3c1d4cecdd25aac1e3c41f074c",c.callServer,void 0,c.findSourceMapURL,"pauseBoxAction"),u=(0,c.createServerReference)("4071308a0e1675de302803bb969800c52d79f11e13",c.callServer,void 0,c.findSourceMapURL,"resumeBoxAction"),m=(0,c.createServerReference)("40e545c7dd69b4a1d410deb9c94101099961d3af7a",c.callServer,void 0,c.findSourceMapURL,"stopBoxAction");e.s(["BoxActions",0,function({box:e,size:t}){let n=(0,s.useRouter)(),[c,p]=(0,a.useTransition)(),h="running"===e.status,f="paused"===e.status,b="stopped"===e.status,v="lg"===t,g=v?"sm":"icon-sm",j=(r,t,s)=>{r.stopPropagation(),(!s||window.confirm(s))&&p(async()=>{let r=await t(e.id);r.ok||window.alert(`Action failed: ${r.error}`),n.refresh()})};return(0,r.jsxs)("div",{className:(0,i.cn)("flex gap-1.5",v?"":"justify-end"),children:[f?(0,r.jsxs)(o.Button,{variant:v?"default":"outline",size:g,title:"Resume",disabled:c,className:v?"":"hover:border-[var(--green)] hover:bg-accent hover:text-[var(--green-ink)]",onClick:e=>j(e,u),children:[(0,r.jsx)(l.Icons.play,{}),v?"Resume":null]}):(0,r.jsxs)(o.Button,{variant:"outline",size:g,disabled:c||!h,title:"Pause",className:v?"":"hover:border-[var(--amber)] hover:bg-[var(--amber-soft)] hover:text-[var(--amber)]",onClick:e=>j(e,x),children:[(0,r.jsx)(l.Icons.pause,{}),v?"Pause":null]}),(0,r.jsxs)(o.Button,{variant:"outline",size:g,disabled:c||b,title:"Stop",onClick:e=>j(e,m),children:[(0,r.jsx)(l.Icons.stop,{}),v?"Stop":null]}),(0,r.jsxs)(o.Button,{variant:"destructive",size:g,title:"Destroy",disabled:c,onClick:r=>j(r,d,`Destroy box ${e.id}? Its workspace volume is discarded. This cannot be undone.`),children:[(0,r.jsx)(l.Icons.trash,{}),v?"Destroy":null]})]})}],30544)},95141,e=>{"use strict";var r=e.i(1262),t=e.i(54129),n=e.i(65232),s=e.i(44344);e.s(["Dialog",0,function({onClose:e,className:a,children:i}){return(0,t.useEffect)(()=>{let r=r=>{"Escape"===r.key&&e()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e]),(0,r.jsx)("div",{className:"anim-fade fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-[rgba(20,24,30,.42)] p-6 backdrop-blur-[2px]",onClick:e,children:(0,r.jsxs)("div",{role:"dialog","aria-modal":"true",className:(0,n.cn)("anim-pop relative m-auto w-full max-w-[500px] rounded-2xl border border-border bg-card shadow-[0_40px_80px_-30px_rgba(20,24,30,.5)]",a),onClick:e=>e.stopPropagation(),children:[i,(0,r.jsx)("button",{className:"absolute right-4 top-4 grid h-7 w-7 cursor-pointer place-items-center rounded-md border-0 bg-transparent text-[#a4a9b0] transition-colors hover:bg-secondary hover:text-foreground",onClick:e,"aria-label":"Close",children:(0,r.jsx)(s.Icons.x,{style:{width:15,height:15}})})]})})},"DialogBody",0,function({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("px-5 py-4",e),...t})},"DialogDescription",0,function({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("mt-1 font-mono text-xs text-muted-foreground",e),...t})},"DialogFooter",0,function({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("flex justify-end gap-2.5 rounded-b-2xl border-t border-border/70 bg-background px-5 py-3.5",e),...t})},"DialogHeader",0,function({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("flex items-start gap-3 border-b border-border/70 px-5 pb-4 pt-5",e),...t})},"DialogIcon",0,function({children:e}){return(0,r.jsx)("span",{className:"grid h-9 w-9 flex-none place-items-center rounded-lg border border-[var(--green-line)] bg-accent text-primary [&_svg]:size-[17px]",children:e})},"DialogTitle",0,function({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("text-base font-semibold leading-tight tracking-tight",e),...t})}])},49604,e=>{"use strict";var r=e.i(1262),t=e.i(65232);e.s(["Select",0,function({wrapperClassName:e,className:n,children:s,...a}){return(0,r.jsxs)("span",{className:(0,t.cn)("relative inline-flex",e),children:[(0,r.jsx)("select",{className:(0,t.cn)("h-9 w-full cursor-pointer appearance-none rounded-lg border border-input bg-card py-1 pl-3 pr-9 text-[13px] shadow-sm focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15",n),...a,children:s}),(0,r.jsx)("svg",{className:"pointer-events-none absolute right-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:(0,r.jsx)("path",{d:"m6 9 6 6 6-6"})})]})}])},80922,35594,e=>{"use strict";var r=e.i(1262),t=e.i(51096),n=e.i(44344);e.s(["BackLink",0,function({to:e,children:s}){return(0,r.jsxs)(t.default,{className:"mb-3.5 inline-flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 font-mono text-xs text-muted-foreground hover:text-primary",href:e,children:[(0,r.jsx)(n.Icons.arrowL,{className:"size-[13px]"}),s]})}],80922);var s=e.i(65232),a=e.i(8536);e.s(["Stat",0,function({k:e,v:t,mono:n,icon:a}){return(0,r.jsxs)("div",{className:"px-4.5 p-4",children:[(0,r.jsx)("div",{className:"mb-1.5 font-mono text-[10.5px] uppercase tracking-[.06em] text-[#a4a9b0]",children:e}),(0,r.jsxs)("div",{className:(0,s.cn)("flex items-center gap-2 font-semibold tracking-[-0.01em]",n?"font-mono text-sm font-medium":"text-base"),children:[a?(0,r.jsx)(a,{className:"size-[15px] text-muted-foreground"}):null,t]})]})},"StatGrid",0,function({children:e}){return(0,r.jsx)(a.Card,{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] divide-x divide-border/60 overflow-hidden",children:e})}],35594)},77084,e=>{"use strict";var r=e.i(1262),t=e.i(45971),n=e.i(33789),s=e.i(44344),a=e.i(86892),i=e.i(65232);function o({className:e,icon:t,title:n,children:s}){return(0,r.jsxs)("div",{className:(0,i.cn)("relative flex w-full items-start gap-3 rounded-xl border p-4",e),children:[t?(0,r.jsx)(t,{className:"mt-0.5 size-4 flex-none"}):null,(0,r.jsxs)("div",{className:"min-w-0",children:[n?(0,r.jsx)("div",{className:"mb-0.5 text-[13.5px] font-semibold leading-tight",children:n}):null,(0,r.jsx)("div",{className:"text-[12.5px] leading-normal",children:s})]})]})}var l=e.i(8536),c=e.i(96621),d=e.i(88451);function x({boxId:e}){let{state:t}=(0,c.useStore)(),a=t.approvals.filter(r=>r.boxId===e).sort((e,r)=>e.createdAt-r.createdAt);return 0===a.length?null:(0,r.jsxs)("div",{className:"mt-4 overflow-hidden rounded-xl border border-[var(--amber-line)] bg-[var(--amber-soft)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 border-b border-[var(--amber-line)] px-4 py-2.5",children:[(0,r.jsx)(s.Icons.shield,{className:"size-4 flex-none text-[var(--amber)]"}),(0,r.jsxs)("span",{className:"text-[13.5px] font-semibold",children:[a.length," pending approval",1===a.length?"":"s"]}),(0,r.jsx)("span",{className:"text-[12.5px] text-muted-foreground",children:"— this box is waiting on you."})]}),(0,r.jsx)("div",{className:"divide-y divide-[var(--amber-line)]",children:a.map(e=>(0,r.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"truncate font-mono text-[13px] text-secondary-foreground",children:e.command??e.message}),e.detail?(0,r.jsx)("div",{className:"mt-0.5 truncate text-[11.5px] text-muted-foreground",children:e.detail}):null,e.cwd?(0,r.jsx)("div",{className:"mt-0.5 truncate font-mono text-[11px] text-[#a4a9b0]",children:e.cwd}):null,(0,r.jsx)("div",{className:"mt-0.5 font-mono text-[11px] text-[#a4a9b0]",children:(0,r.jsx)(n.Ago,{ms:e.createdAt})})]}),(0,r.jsx)("div",{className:"flex-none pt-0.5",children:(0,r.jsx)(d.ApprovalActions,{id:e.id})})]},e.id))})]})}var u=e.i(54129),m=e.i(69377);function p({url:e}){let[t,n]=(0,u.useState)(!1),a=(0,u.useRef)(null);(0,u.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]);let i=(0,u.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),n(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>n(!1),1500)}catch{}},[e]);return(0,r.jsxs)(m.Button,{variant:"outline",size:"sm",onClick:i,children:[t?(0,r.jsx)(s.Icons.check,{}):(0,r.jsx)(s.Icons.copy,{}),t?"Copied":"Copy URL"]})}function h({webUrl:e,vncUrl:t}){return e||t?(0,r.jsx)(l.Card,{className:"divide-y divide-border/60 overflow-hidden",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,r.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,r.jsx)("div",{className:"text-[13.5px] font-medium",children:e?"Web":"VNC"}),(0,r.jsx)("div",{className:"mt-0.5 break-all font-mono text-[11.5px] text-muted-foreground",children:e??"Remote desktop"})]}),(0,r.jsxs)("div",{className:"flex flex-none flex-wrap gap-1.5",children:[e?(0,r.jsxs)(m.Button,{variant:"outline",size:"sm",href:e,target:"_blank",rel:"noreferrer",children:[(0,r.jsx)(s.Icons.ext,{}),"Open web"]}):null,e?(0,r.jsx)(p,{url:e}):null,t?(0,r.jsxs)(m.Button,{variant:"outline",size:"sm",href:t,target:"_blank",rel:"noreferrer",children:[(0,r.jsx)(s.Icons.ext,{}),"Open VNC"]}):null]})]})}):null}var f=e.i(80922),b=e.i(30544),v=e.i(51096);function g({k:e,v:t,mono:n,link:s}){return(0,r.jsxs)("div",{className:"grid grid-cols-[156px_1fr] items-baseline gap-4 px-4.5 p-3 max-sm:grid-cols-1 max-sm:gap-1",children:[(0,r.jsx)("div",{className:"font-mono text-xs text-muted-foreground",children:e}),(0,r.jsx)("div",{className:(0,i.cn)("min-w-0 text-[13.5px]",n?"font-mono text-[13px]":""),children:s?(0,r.jsx)(v.default,{className:"cursor-pointer text-primary",href:s,children:t}):t})]})}var j=e.i(31758),N=e.i(95141),w=e.i(3060),y=e.i(16200),S=e.i(49604),k=e.i(9383);let C=(0,k.createServerReference)("70fd109611adee18e2a11d04af4332c29e796848e9",k.callServer,void 0,k.findSourceMapURL,"gitBranchAction"),I=(0,k.createServerReference)("600e7ece96e4038f118842cef0ebcf51dadf743c9b",k.callServer,void 0,k.findSourceMapURL,"gitCheckoutAction"),B=(0,k.createServerReference)("605f4904ee0814a4a51c0445aa18e7dfbde590c7e5",k.callServer,void 0,k.findSourceMapURL,"gitPullAction"),R=(0,k.createServerReference)("60675b1179af1a57b7c4bb6e4d893805dd8f7b0b66",k.callServer,void 0,k.findSourceMapURL,"gitPushAction"),D=(0,k.createServerReference)("607692631dd5973ad6071d94f3fee9c7da56a766db",k.callServer,void 0,k.findSourceMapURL,"gitPushHostAction"),A=0;function L({toasts:e,dismiss:t}){return(0,r.jsx)("div",{className:"pointer-events-none fixed bottom-5 right-5 z-[60] flex w-[340px] max-w-[calc(100vw-40px)] flex-col gap-2",children:e.map(e=>(0,r.jsxs)("div",{className:"anim-pop pointer-events-auto relative flex items-start gap-3 rounded-xl border border-border bg-card p-3.5 pr-9 shadow-[0_16px_40px_-18px_rgba(20,24,30,.35)]",children:[(0,r.jsx)("span",{className:(0,i.cn)("mt-0.5 grid h-6 w-6 flex-none place-items-center rounded-md border","error"===e.variant?"border-[var(--red-line)] bg-[var(--red-soft)] text-[var(--red)]":"border-[var(--green-line)] bg-accent text-primary"),children:"error"===e.variant?(0,r.jsx)(s.Icons.warn,{className:"size-3.5"}):(0,r.jsx)(s.Icons.check,{className:"size-3.5"})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("div",{className:"text-[13px] font-semibold leading-tight",children:e.title}),e.detail?(0,r.jsx)("div",{className:"mt-0.5 break-words font-mono text-[11.5px] leading-normal text-muted-foreground",children:e.detail}):null]}),(0,r.jsx)("button",{className:"absolute right-2.5 top-2.5 grid h-5 w-5 cursor-pointer place-items-center rounded border-0 bg-transparent text-[#a4a9b0] hover:text-foreground",onClick:()=>t(e.id),"aria-label":"Dismiss",children:(0,r.jsx)(s.Icons.x,{className:"size-3"})})]},e.id))})}function z({label:e,desc:t,children:n}){return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,r.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,r.jsx)("div",{className:"text-[13.5px] font-medium",children:e}),(0,r.jsx)("div",{className:"mt-0.5 font-mono text-[11.5px] text-muted-foreground",children:t})]}),(0,r.jsx)("div",{className:"flex flex-none flex-wrap gap-1.5",children:n})]})}function U({icon:e,disabled:t,onRun:n,children:s}){let[a,i]=(0,u.useState)(!1),o=async()=>{i(!0);try{await n()}finally{i(!1)}};return(0,r.jsxs)(m.Button,{variant:"outline",size:"sm",disabled:t||a,onClick:o,children:[a?(0,r.jsx)("span",{className:"spin",style:{width:12,height:12}}):(0,r.jsx)(e,{}),s]})}function P(e,r){let t=(e??"").trim()||(r??"").trim();return t?t.split("\n")[0]:void 0}function T({box:e}){let n=(0,t.useRouter)(),{toasts:a,push:o,dismiss:c}=function(){let[e,r]=(0,u.useState)([]),t=(0,u.useCallback)(e=>r(r=>r.filter(r=>r.id!==e)),[]);return{toasts:e,push:(0,u.useCallback)(e=>{let n=++A;r(r=>[...r,{id:n,...e}]),setTimeout(()=>t(n),4200)},[t]),dismiss:t}}(),[d,x]=(0,u.useState)(null),[p,h]=(0,u.useState)(null),f="running"!==e.status,b=(0,u.useCallback)(async()=>{try{let r=await fetch(`/api/v1/boxes/${encodeURIComponent(e.id)}/git`,{credentials:"same-origin"});x(r.ok?await r.json():null)}catch{x(null)}},[e.id]);(0,u.useEffect)(()=>{b()},[b]);let v=d?.ok&&d.branch?d.branch:e.branch||"—",g=()=>{b(),n.refresh()},j=async(e,r)=>{let t=await r();t.ok?(o({title:e,detail:P(t.stdout,t.stderr)}),g()):o({variant:"error",title:`${e} failed`,detail:t.error})};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Card,{className:(0,i.cn)("divide-y divide-border/60 overflow-hidden",f?"opacity-90":""),children:[f?(0,r.jsxs)("div",{className:"flex items-center gap-2.5 bg-[var(--amber-soft)] px-4.5 p-2.5 text-[12.5px] text-[var(--amber)]",children:[(0,r.jsx)(s.Icons.warn,{className:"size-3.5 flex-none"}),"Box is ",e.status," — git operations need a running box."]}):null,(0,r.jsxs)(z,{label:"Sync",desc:`origin ↔ ${v}`,children:[(0,r.jsx)(U,{icon:s.Icons.arrowL,disabled:f,onRun:()=>j("Pulled from origin",()=>B(e.id)),children:"Pull"}),(0,r.jsx)(U,{icon:s.Icons.ext,disabled:f,onRun:()=>j("Pushed to origin",()=>R(e.id)),children:"Push"}),(0,r.jsx)(U,{icon:s.Icons.host,disabled:f,onRun:()=>j("Pushed to host",()=>D(e.id)),children:"Push to host"})]}),(0,r.jsxs)(z,{label:"Branch",desc:`currently on ${v}`,children:[(0,r.jsxs)(m.Button,{variant:"outline",size:"sm",disabled:f,onClick:()=>h("change"),children:[(0,r.jsx)(s.Icons.branch,{}),"Change branch"]}),(0,r.jsxs)(m.Button,{variant:"outline",size:"sm",disabled:f,onClick:()=>h("new"),children:[(0,r.jsx)(s.Icons.plus,{}),"New branch"]})]})]}),"change"===p?(0,r.jsx)(E,{box:e,branch:v,onClose:()=>h(null),onDone:o,onRefresh:g}):null,"new"===p?(0,r.jsx)(F,{box:e,onClose:()=>h(null),onDone:o,onRefresh:g}):null,(0,r.jsx)(L,{toasts:a,dismiss:c})]})}let M="__manual__";function _({boxId:e,value:t,onChange:n,id:s,headLabel:a,currentBranch:i}){let[o,l]=(0,u.useState)(null),[c,d]=(0,u.useState)(i??null),[x,m]=(0,u.useState)(!1);return((0,u.useEffect)(()=>{let r=!1;return(async()=>{try{let t=await fetch(`/api/v1/boxes/${encodeURIComponent(e)}/branches`,{credentials:"same-origin"}),n=t.ok?await t.json():null;if(r)return;n&&Array.isArray(n.branches)&&n.branches.length>0?(l(n.branches),i||"string"!=typeof n.current||d(n.current)):(l([]),m(!0))}catch{r||(l([]),m(!0))}})(),()=>{r=!0}},[e,i]),null===o)?(0,r.jsx)(S.Select,{id:s,value:"",disabled:!0,wrapperClassName:"w-full",children:(0,r.jsx)("option",{value:"",children:"Loading branches…"})}):x?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.Input,{id:s,className:"font-mono text-[13px]",autoFocus:!0,value:t,onChange:e=>n(e.target.value),placeholder:a?"HEAD":"feature-x"}),o.length>0?(0,r.jsx)("button",{type:"button",onClick:()=>{m(!1),n("")},className:"mt-1.5 cursor-pointer text-xs text-secondary-foreground underline-offset-2 hover:underline",children:"← Back to branch list"}):null]}):(0,r.jsxs)(S.Select,{id:s,value:t,wrapperClassName:"w-full",onChange:e=>{if(e.target.value===M){m(!0),n("");return}n(e.target.value)},children:[a?(0,r.jsx)("option",{value:"",children:a}):(0,r.jsx)("option",{value:"",disabled:!0,children:"Select a branch…"}),(0,r.jsx)("option",{value:M,children:"Other / type manually…"}),(0,r.jsx)("option",{disabled:!0,children:"────────────"}),o.map(e=>(0,r.jsxs)("option",{value:e,children:[e,e===c?" (current)":""]},e))]})}function E({box:e,branch:t,onClose:n,onDone:a,onRefresh:i}){let[o,l]=(0,u.useState)(""),[c,d]=(0,u.useState)(!1),[x,p]=(0,u.useState)(null),h=o.trim().length>0;return(0,r.jsxs)(N.Dialog,{onClose:n,className:"max-w-[440px]",children:[(0,r.jsxs)(N.DialogHeader,{children:[(0,r.jsx)(N.DialogIcon,{children:(0,r.jsx)(s.Icons.branch,{})}),(0,r.jsxs)("div",{children:[(0,r.jsx)(N.DialogTitle,{children:"Change branch"}),(0,r.jsxs)(N.DialogDescription,{children:[e.id," · currently on ",t]})]})]}),(0,r.jsxs)(N.DialogBody,{children:[(0,r.jsx)(y.Label,{htmlFor:"gb-branch",children:"Branch"}),(0,r.jsx)(_,{boxId:e.id,id:"gb-branch",value:o,onChange:l,currentBranch:t}),(0,r.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"The branch must exist and not be checked out in another worktree."}),x?(0,r.jsx)("p",{className:"mt-2 break-words font-mono text-xs text-destructive",children:x}):null]}),(0,r.jsxs)(N.DialogFooter,{children:[(0,r.jsx)(m.Button,{variant:"outline",onClick:n,disabled:c,children:"Cancel"}),(0,r.jsxs)(m.Button,{onClick:()=>{h&&!c&&(d(!0),p(null),(async()=>{let r=await I(e.id,o.trim());r.ok?(a({title:"Branch changed",detail:P(r.stdout,r.stderr)}),n(),i()):(p(r.error),d(!1))})())},disabled:!h||c,children:[c?(0,r.jsx)("span",{className:"spin"}):(0,r.jsx)(s.Icons.check,{}),c?"Checking out…":"Change branch"]})]})]})}function F({box:e,onClose:t,onDone:n,onRefresh:a}){let[i,o]=(0,u.useState)(""),[l,c]=(0,u.useState)(""),[d,x]=(0,u.useState)(!1),[p,h]=(0,u.useState)(null),f=i.trim().length>0,b=()=>{f&&!d&&(x(!0),h(null),(async()=>{let r=await C(e.id,i.trim(),l.trim()||void 0);r.ok?(n({title:"Branch created",detail:P(r.stdout,r.stderr)}),t(),a()):(h(r.error),x(!1))})())};return(0,r.jsxs)(N.Dialog,{onClose:t,className:"max-w-[440px]",children:[(0,r.jsxs)(N.DialogHeader,{children:[(0,r.jsx)(N.DialogIcon,{children:(0,r.jsx)(s.Icons.branch,{})}),(0,r.jsxs)("div",{children:[(0,r.jsx)(N.DialogTitle,{children:"New branch"}),(0,r.jsxs)(N.DialogDescription,{children:[e.id," · branching in the box workspace"]})]})]}),(0,r.jsxs)(N.DialogBody,{children:[(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)(y.Label,{htmlFor:"nb-name",children:"Name"}),(0,r.jsx)(w.Input,{id:"nb-name",className:"font-mono text-[13px]",autoFocus:!0,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&b()},placeholder:"my-branch"}),(0,r.jsxs)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:["An ",(0,r.jsx)("span",{className:"font-mono",children:"agentbox/"})," prefix is added when missing."]})]}),(0,r.jsxs)(y.Label,{htmlFor:"nb-from",children:["Base ref ",(0,r.jsx)("span",{className:"font-normal text-[#a4a9b0]",children:"(optional)"})]}),(0,r.jsx)(_,{boxId:e.id,id:"nb-from",value:l,onChange:c,headLabel:"Current HEAD (default)"}),(0,r.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"Defaults to the box's current HEAD."}),p?(0,r.jsx)("p",{className:"mt-2 break-words font-mono text-xs text-destructive",children:p}):null]}),(0,r.jsxs)(N.DialogFooter,{children:[(0,r.jsx)(m.Button,{variant:"outline",onClick:t,disabled:d,children:"Cancel"}),(0,r.jsxs)(m.Button,{onClick:b,disabled:!f||d,children:[d?(0,r.jsx)("span",{className:"spin"}):(0,r.jsx)(s.Icons.plus,{}),d?"Creating…":"Create branch"]})]})]})}var $=e.i(1485);let H=(0,k.createServerReference)("6096ff4dd5616157cf1da6a977c271641a3ddce491",k.callServer,void 0,k.findSourceMapURL,"restartServiceAction"),O=new Set(["ready","running","done"]),G=new Set(["crashed","unhealthy","backoff","failed"]),K={up:"bg-[var(--green)]",bad:"bg-[var(--red)]",idle:"bg-[var(--amber)]"},W={up:"text-[var(--green-ink)]",bad:"text-[var(--red)]",idle:"text-[var(--amber)]"};function V({svc:e,disabled:t,onRestart:n}){var a;let o=(a=e.state,O.has(a)?"up":G.has(a)?"bad":"idle");return(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[(0,r.jsx)("span",{className:(0,i.cn)("badge-dot",K[o]),"aria-hidden":!0}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[13px] text-secondary-foreground",children:e.name}),(0,r.jsx)("span",{className:(0,i.cn)("font-mono text-xs",W[o]),children:e.state}),e.restarts>0?(0,r.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground",children:["↻",e.restarts]}):null,(0,r.jsx)(m.Button,{variant:"outline",size:"icon-sm",title:`Restart ${e.name}`,disabled:t,onClick:()=>n(e.name),children:(0,r.jsx)(s.Icons.refresh,{})})]})}function q({id:e,running:t}){let[n,a]=(0,u.useState)(null),[i,o]=(0,u.useState)(null),[c,d]=(0,u.useTransition)(),x=(0,u.useCallback)(async()=>{try{let r=await fetch(`/api/v1/boxes/${encodeURIComponent(e)}/services`,{credentials:"same-origin"});if(!r.ok)return void o(`status ${String(r.status)}`);a(await r.json()),o(null)}catch(e){o(e instanceof Error?e.message:String(e))}},[e]);(0,u.useEffect)(()=>{if(x(),!t)return;let e=setInterval(()=>void x(),4e3);return()=>clearInterval(e)},[x,t]);let p=r=>{d(async()=>{let t=await H(e,r);t.ok||window.alert(`Restart failed: ${t.error}`),await x()})},h=n?.services??[],f=h.length>0;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($.SectionLabel,{right:f?(0,r.jsxs)(m.Button,{variant:"outline",size:"sm",disabled:!t||c,onClick:()=>p(void 0),children:[(0,r.jsx)(s.Icons.refresh,{}),"Restart all"]}):null,children:"Services"}),(0,r.jsx)(l.Card,{className:"divide-y divide-border/60 overflow-hidden",children:n||i?i?(0,r.jsxs)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:["Could not load services (",i,")."]}):f?(0,r.jsxs)(r.Fragment,{children:[n?.source==="persisted"?(0,r.jsx)("div",{className:"bg-muted/30 px-4 py-1.5 font-mono text-[11px] text-muted-foreground",children:"persisted snapshot — box not running"}):null,h.map(e=>(0,r.jsx)(V,{svc:e,disabled:!t||c,onRestart:e=>p(e)},e.name))]}):(0,r.jsx)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:n?.source==="unavailable"?"No service status (box not running or no snapshot yet).":"No services declared in agentbox.yaml."}):(0,r.jsx)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Loading…"})})]})}var J=e.i(35594);e.s(["default",0,function(){let{id:e}=(0,t.useParams)(),{box:i,project:d}=(0,c.useStore)(),u=i(e);if(!u)return(0,r.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8",children:[(0,r.jsx)(f.BackLink,{to:"/",children:"All boxes"}),(0,r.jsx)(j.EmptyBox,{children:"This box no longer exists — it may have been destroyed."})]});let m=d(u.projectId);return(0,r.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8 max-sm:px-4",children:[(0,r.jsx)(f.BackLink,{to:"/projects/"+u.projectId,children:m?m.name:"Project"}),(0,r.jsxs)("div",{className:"flex items-start gap-4 max-md:flex-col",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("h1",{className:"flex flex-wrap items-center gap-3 text-[25px] font-semibold leading-tight tracking-[-0.025em]",children:[u.task,(0,r.jsx)(a.StatusBadge,{status:u.status})]}),(0,r.jsxs)("div",{className:"mt-1.5 text-sm text-muted-foreground",children:[(0,r.jsx)("span",{className:"font-mono text-secondary-foreground",children:u.id})," ·"," ",(0,r.jsx)("span",{className:"font-mono text-secondary-foreground",children:u.repo})," · ",u.host]})]}),(0,r.jsx)("div",{className:"ml-auto flex-none max-md:ml-0",children:(0,r.jsx)(b.BoxActions,{box:u,size:"lg"})})]}),u.error?(0,r.jsx)(o,{className:"mt-4 border-[var(--red-line)] bg-[var(--red-soft)] text-[var(--red)]",icon:s.Icons.warn,title:"Box errored",children:(0,r.jsx)("span",{className:"font-mono text-secondary-foreground",children:u.error})}):null,(0,r.jsx)(x,{boxId:u.id}),(0,r.jsx)($.SectionLabel,{children:"Overview"}),(0,r.jsxs)(J.StatGrid,{children:[(0,r.jsx)(J.Stat,{k:"Status",v:(0,r.jsx)(a.StatusBadge,{status:u.status})}),(0,r.jsx)(J.Stat,{k:"Agent CLI",v:u.agent,mono:!0}),(0,r.jsx)(J.Stat,{k:"Commits",v:u.commits??"—",icon:s.Icons.commit}),(0,r.jsx)(J.Stat,{k:"Files touched",v:u.filesTouched??"—",icon:s.Icons.file}),(0,r.jsx)(J.Stat,{k:"Last activity",v:(0,r.jsx)(n.Ago,{ms:u.lastActivity}),mono:!0})]}),u.webUrl||u.vncUrl?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($.SectionLabel,{children:"Access"}),(0,r.jsx)(h,{webUrl:u.webUrl,vncUrl:u.vncUrl})]}):null,(0,r.jsx)($.SectionLabel,{children:"Git operations"}),(0,r.jsx)(T,{box:u}),(0,r.jsx)(q,{id:u.id,running:"running"===u.status}),(0,r.jsx)($.SectionLabel,{children:"Details"}),(0,r.jsxs)(l.Card,{className:"divide-y divide-border/60 overflow-hidden",children:[(0,r.jsx)(g,{k:"Box ID",v:u.id,mono:!0}),(0,r.jsx)(g,{k:"Project",v:m?m.name:"—",link:m?"/projects/"+u.projectId:null}),(0,r.jsx)(g,{k:"Repository",v:u.repo,mono:!0}),(0,r.jsx)(g,{k:"Branch",v:u.branch,mono:!0}),(0,r.jsx)(g,{k:"Host",v:u.host,mono:!0}),(0,r.jsx)(g,{k:"Created",v:new Date(u.createdAt).toLocaleString(),mono:!0})]})]})}],77084)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,44344,96621,e=>{"use strict";var t=e.i(1262);let r=(e,r)=>n=>(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:r?"currentColor":"none",stroke:r?"none":"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",...n,children:e.map((e,r)=>(0,t.jsx)("path",{d:e},r))}),n={grid:r(["M4 4h7v7H4zM13 4h7v7h-7zM13 13h7v7h-7zM4 13h7v7H4z"]),box:r(["M12 20.5 5 17V7l7-3.5L19 7v10Z","m5 7 7 3.5L19 7M12 10.5V20"]),folder:r(["M4 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"]),settings:r(["M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z","M19.4 15a1.6 1.6 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.6 1.6 0 0 0-2.7 1.1V21a2 2 0 1 1-4 0v-.1A1.6 1.6 0 0 0 7.5 19.4a1.6 1.6 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.6 1.6 0 0 0-1.1-2.7H1a2 2 0 1 1 0-4h.1A1.6 1.6 0 0 0 2.6 7.5a1.6 1.6 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.6 1.6 0 0 0 2.7-1.1V1a2 2 0 1 1 4 0v.1a1.6 1.6 0 0 0 2.7 1.1 1.6 1.6 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.6 1.6 0 0 0 1.1 2.7H21a2 2 0 1 1 0 4h-.1a1.6 1.6 0 0 0-1.5 1Z"]),book:r(["M4 19.5A2.5 2.5 0 0 1 6.5 17H20","M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2Z"]),branch:r(["M6 3v12","M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z","M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z","M18 9a9 9 0 0 1-9 9"]),plus:r(["M12 5v14M5 12h14"]),pause:r(["M9 4H6v16h3zM18 4h-3v16h3z"]),play:r(["M6 4l14 8-14 8Z"]),refresh:r(["M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8","M3 3v5h5","M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16","M21 21v-5h-5"]),stop:r(["M7 7h10v10H7z"]),trash:r(["M3 6h18","M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2","M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"]),chevR:r(["m9 6 6 6-6 6"]),arrowL:r(["M19 12H5","m12 19-7-7 7-7"]),arrowUp:r(["M12 19V5","m5 12 7-7 7 7"]),ext:r(["M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6","M15 3h6v6","M10 14 21 3"]),copy:r(["M9 9h11a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2Z","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"]),x:r(["M18 6 6 18M6 6l12 12"]),check:r(["M20 6 9 17l-5-5"]),clock:r(["M12 7v5l3 2","M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z"]),server:r(["M3 4h18v6H3zM3 14h18v6H3z","M7 7h.01M7 17h.01"]),host:r(["M5 4h14a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Z","M5 14h14a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2a2 2 0 0 1 2-2Z","M7 7h.01M7 17h.01"]),repo:r(["M4 19.5A2.5 2.5 0 0 1 6.5 17H20","M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2Z"]),search:r(["M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14Z","m20 20-3.5-3.5"]),menu:r(["M4 7h16M4 12h16M4 17h16"]),terminal:r(["m6 9 3 3-3 3","M13 15h5","M4 4h16v16H4z"]),warn:r(["M10.3 4.3 2.5 18a1.8 1.8 0 0 0 1.6 2.7h15.8A1.8 1.8 0 0 0 21.5 18L13.7 4.3a1.8 1.8 0 0 0-3.1 0Z","M12 9v4M12 17h.01"]),activity:r(["M22 12h-4l-3 9L9 3l-3 9H2"]),commit:r(["M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z","M3 12h6M15 12h6"]),file:r(["M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z","M14 2v6h6"]),shield:r(["M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z"]),claude:r(["M12 3v18M3 12h18M5.5 5.5l13 13M18.5 5.5l-13 13"]),codex:e=>(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("path",{d:"M12 2.6 3.2 7v10l8.8 4.4L20.8 17V7L12 2.6Zm0 3.1a6.3 6.3 0 1 1 0 12.6 6.3 6.3 0 0 1 0-12.6Zm0 2.4a3.9 3.9 0 1 0 0 7.8 3.9 3.9 0 0 0 0-7.8Z"})}),opencode:r(["M9 8l-4 4 4 4","M15 8l4 4-4 4","M13 6l-2 12"]),github:e=>(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("path",{d:"M12 1.5A10.5 10.5 0 0 0 8.7 22c.5.1.7-.2.7-.5v-1.8c-2.9.6-3.5-1.4-3.5-1.4-.5-1.2-1.2-1.5-1.2-1.5-.9-.6.1-.6.1-.6 1 .1 1.6 1 1.6 1 .9 1.6 2.4 1.1 3 .9.1-.7.4-1.1.6-1.4-2.3-.3-4.7-1.2-4.7-5.1 0-1.1.4-2 1-2.7-.1-.3-.5-1.4.1-2.8 0 0 .9-.3 2.8 1a9.6 9.6 0 0 1 5 0c1.9-1.3 2.8-1 2.8-1 .6 1.4.2 2.5.1 2.8.7.7 1 1.6 1 2.7 0 3.9-2.4 4.8-4.6 5 .4.3.7.9.7 1.9v2.8c0 .3.2.6.7.5A10.5 10.5 0 0 0 12 1.5Z"})})},o={TypeScript:"#3178c6",Go:"#00add8",Astro:"#ff5d01",MDX:"#f9a03c",JavaScript:"#f1e05a",Python:"#3572a5"};n.claude,n.codex,n.opencode,n.terminal,e.s(["Icons",0,n,"LangDot",0,function({lang:e}){return(0,t.jsx)("span",{className:"inline-block h-2 w-2 flex-none rounded-full",style:{background:o[e]??"#9aa0a6"}})}],44344);var a=e.i(54129);let s=(0,a.createContext)(null);e.s(["HubProvider",0,function({data:e,children:r}){let n=(0,a.useMemo)(()=>({state:e,project:t=>e.projects.find(e=>e.id===t),box:t=>e.boxes.find(e=>e.id===t),boxesFor:t=>e.boxes.filter(e=>e.projectId===t),repo:t=>e.github.repos.find(e=>e.full===t)}),[e]);return(0,t.jsx)(s.Provider,{value:n,children:r})},"useStore",0,function(){let e=(0,a.useContext)(s);if(!e)throw Error("useStore must be used within HubProvider");return e}],96621)},64595,e=>{"use strict";var t=e.i(1262),r=e.i(65232);let n={default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",outline:"text-muted-foreground border-border"};e.s(["Badge",0,function({className:e,variant:o="outline",...a}){return(0,t.jsx)("span",{className:(0,r.cn)("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-[2px] font-mono text-[11px] font-medium tracking-[.01em]",n[o],e),...a})}])},80314,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return l},formatWithValidation:function(){return c},urlObjectKeys:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(44066)._(e.r(39394)),s=/https?|ftp|gopher|file/;function l(e){let{auth:t,hostname:r}=e,n=e.protocol||"",o=e.pathname||"",l=e.hash||"",i=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:r&&(c=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(c+=":"+e.port)),i&&"object"==typeof i&&(i=String(a.urlQueryToSearchParams(i)));let u=e.search||i&&`?${i}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||s.test(n))&&!1!==c?(c="//"+(c||""),o&&"/"!==o[0]&&(o="/"+o)):c||(c=""),l&&"#"!==l[0]&&(l="#"+l),u&&"?"!==u[0]&&(u="?"+u),o=o.replace(/[?#]/g,encodeURIComponent),u=u.replace("#","%23"),`${n}${c}${o}${u}${l}`}let i=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return l(e)}},82024,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return o}});let n=e.r(54129);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=a(e,n)),t&&(o.current=a(t,n))},[e,t])}function a(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},15275,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return a}});let n=e.r(84842),o=e.r(1857);function a(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},31196,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},51096,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return v},useLinkStatus:function(){return g}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(44066),s=e.r(1262),l=a._(e.r(54129)),i=e.r(80314),c=e.r(69106),u=e.r(82024),d=e.r(84842),h=e.r(12625);e.r(14587);let p=e.r(68705),f=e.r(73316),x=e.r(15275),m=e.r(15874);function v(t){var r,n;let o,a,v,[g,j]=(0,l.useOptimistic)(f.IDLE_LINK_STATUS),M=(0,l.useRef)(null),{href:y,as:k,children:N,prefetch:P=null,passHref:_,replace:L,shallow:S,scroll:w,onClick:C,onMouseEnter:H,onTouchStart:A,legacyBehavior:I=!1,onNavigate:O,transitionTypes:T,ref:R,unstable_dynamicOnHover:Z,...z}=t;o=N,I&&("string"==typeof o||"number"==typeof o)&&(o=(0,s.jsx)("a",{children:o}));let E=l.default.useContext(c.AppRouterContext),B=!1!==P,U=!1!==P?null===(n=P)||"auto"===n?m.FetchStrategy.PPR:m.FetchStrategy.Full:m.FetchStrategy.PPR,V="string"==typeof(r=k||y)?r:(0,i.formatUrl)(r);if(I){if(o?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});a=l.default.Children.only(o)}let D=I?a&&"object"==typeof a&&a.ref:R,K=l.default.useCallback(e=>(null!==E&&(M.current=(0,f.mountLinkInstance)(e,V,E,U,B,j)),()=>{M.current&&((0,f.unmountLinkForCurrentNavigation)(M.current),M.current=null),(0,f.unmountPrefetchableInstance)(e)}),[B,V,E,U,j]),$={ref:(0,u.useMergedRef)(K,D),onClick(t){I||"function"!=typeof C||C(t),I&&a.props&&"function"==typeof a.props.onClick&&a.props.onClick(t),!E||t.defaultPrevented||function(t,r,n,o,a,s,i){if("u">typeof window){let c,{nodeName:u}=t.currentTarget;if("A"===u.toUpperCase()&&((c=t.currentTarget.getAttribute("target"))&&"_self"!==c||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,x.isLocalURL)(r)){o&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),s){let e=!1;if(s({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(8898);l.default.startTransition(()=>{d(r,o?"replace":"push",!1===a?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,n.current,i)})}}(t,V,M,L,w,O,T)},onMouseEnter(e){I||"function"!=typeof H||H(e),I&&a.props&&"function"==typeof a.props.onMouseEnter&&a.props.onMouseEnter(e),E&&B&&(0,f.onNavigationIntent)(e.currentTarget,!0===Z)},onTouchStart:function(e){I||"function"!=typeof A||A(e),I&&a.props&&"function"==typeof a.props.onTouchStart&&a.props.onTouchStart(e),E&&B&&(0,f.onNavigationIntent)(e.currentTarget,!0===Z)}};return(0,d.isAbsoluteUrl)(V)?$.href=V:I&&!_&&("a"!==a.type||"href"in a.props)||($.href=(0,h.addBasePath)(V)),v=I?l.default.cloneElement(a,$):(0,s.jsx)("a",{...z,...$,children:o}),(0,s.jsx)(b.Provider,{value:g,children:v})}e.r(31196);let b=(0,l.createContext)(f.IDLE_LINK_STATUS),g=()=>(0,l.useContext)(b);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},31876,e=>{"use strict";var t=e.i(1262),r=e.i(45971),n=e.i(54129),o=e.i(51096),a=e.i(65232),s=e.i(44344);function l({className:e,fallback:r,...n}){return(0,t.jsx)("span",{className:(0,a.cn)("grid h-7 w-7 flex-none place-items-center rounded-full bg-primary font-mono text-xs font-semibold text-primary-foreground",e),...n,children:r})}var i=e.i(64595),c=e.i(96621);function u({active:e,to:r,href:n,icon:l,label:c,count:d,ext:h}){let p=(0,a.cn)("flex w-full cursor-pointer items-center gap-2.5 rounded-lg border-0 bg-transparent px-2 py-[7px] text-left text-[13.5px] transition-colors",e?"bg-accent font-medium text-accent-foreground":"text-secondary-foreground hover:bg-secondary hover:text-foreground"),f=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l,{className:(0,a.cn)("size-4 flex-none",e?"text-primary":"text-muted-foreground")}),c,void 0!==d?(0,t.jsx)(i.Badge,{className:(0,a.cn)("ml-auto border-transparent px-2 py-0 text-[11px]",e?"bg-card text-primary":"bg-secondary text-[#a4a9b0]"),children:d}):null,h?(0,t.jsx)(s.Icons.ext,{className:"ml-auto size-[13px] text-[#a4a9b0]"}):null]});return n?(0,t.jsx)("a",{className:p,href:n,target:"_blank",rel:"noopener",children:f}):(0,t.jsx)(o.default,{className:p,href:r??"#",children:f})}function d({children:e}){return(0,t.jsx)("div",{className:"px-2 pb-1.5 pt-4 font-mono text-[10.5px] uppercase tracking-[.1em] text-[#a4a9b0]",children:e})}function h(){let{state:e,boxesFor:n}=(0,c.useStore)(),o=(0,r.usePathname)(),a="/"===o||o.startsWith("/boxes");return(0,t.jsxs)("aside",{className:"shad-side sticky top-0 z-50 flex h-screen flex-col self-start overflow-y-auto border-r border-border bg-background px-3.5 pb-4 pt-4 max-md:w-64",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5 px-2 pb-4 font-mono text-sm font-semibold",children:[(0,t.jsx)("img",{src:"/logo.svg",alt:"",width:20,height:20,className:"h-5 w-5"}),"agentbox",(0,t.jsx)("span",{className:"font-normal text-[#a4a9b0]",children:"/ hub"})]}),(0,t.jsx)(d,{children:"Workspace"}),(0,t.jsxs)("nav",{className:"flex flex-col gap-px",children:[(0,t.jsx)(u,{active:a,to:"/",icon:s.Icons.grid,label:"Dashboard",count:e.boxes.length}),(0,t.jsx)(u,{active:o.startsWith("/approvals"),to:"/approvals",icon:s.Icons.shield,label:"Approvals",count:e.approvals.length}),(0,t.jsx)(u,{active:o.startsWith("/settings"),to:"/settings",icon:s.Icons.settings,label:"Settings"}),(0,t.jsx)(u,{href:"https://agent-box.sh/docs",icon:s.Icons.book,label:"Docs",ext:!0}),(0,t.jsx)(u,{href:"/api/v1/docs",icon:s.Icons.terminal,label:"API",ext:!0})]}),(0,t.jsx)(d,{children:"Projects"}),(0,t.jsx)("nav",{className:"flex flex-col gap-px",children:e.projects.map(e=>(0,t.jsx)(u,{active:o==="/projects/"+e.id,to:"/projects/"+e.id,icon:s.Icons.folder,label:e.name,count:n(e.id).length},e.id))}),(0,t.jsx)("div",{className:"mt-auto border-t border-border pt-2.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2.5 px-1.5 pt-1.5",children:[(0,t.jsx)(l,{fallback:"M"}),(0,t.jsxs)("div",{className:"text-[12.5px] leading-tight",children:[e.user.name,(0,t.jsxs)("span",{className:"block font-mono text-[11px] text-muted-foreground",children:["@",e.user.login]})]})]})})]})}function p(){let e=(0,r.useRouter)();return(0,n.useEffect)(()=>{let t=null,r=()=>{document.hidden||t||(t=setTimeout(()=>{t=null,e.refresh()},250))},n=new EventSource("/api/events");return n.addEventListener("change",r),n.addEventListener("ping",r),()=>{t&&clearTimeout(t),n.close()}},[e]),null}var f=e.i(69377),x=e.i(68223);function m({to:e,children:r,current:n}){return n?(0,t.jsx)("b",{className:"overflow-hidden text-ellipsis whitespace-nowrap font-medium text-secondary-foreground",children:r}):(0,t.jsx)(o.default,{className:"cursor-pointer hover:text-primary",href:e??"#",children:r})}function v(){return(0,t.jsx)("span",{className:"text-border",children:"/"})}function b(){let e=(0,r.usePathname)(),{project:n,box:o}=(0,c.useStore)(),a=[(0,t.jsx)(m,{to:"/",children:"hub"},"h")],s=e.split("/").filter(Boolean);if("projects"===s[0]&&s[1]){let e=n(s[1]);a.push((0,t.jsx)(v,{},"s1"),(0,t.jsx)(m,{current:!0,children:e?e.name:"project"},"p"))}else if("boxes"===s[0]&&s[1]){let e=o(s[1]),r=e?n(e.projectId):void 0;r&&a.push((0,t.jsx)(v,{},"s1"),(0,t.jsx)(m,{to:"/projects/"+r.id,children:r.name},"p")),a.push((0,t.jsx)(v,{},"s2"),(0,t.jsx)(m,{current:!0,children:e?e.id:"box"},"b"))}else"settings"===s[0]?a.push((0,t.jsx)(v,{},"s1"),(0,t.jsx)(m,{current:!0,children:"settings"},"se")):a.push((0,t.jsx)(v,{},"s1"),(0,t.jsx)(m,{current:!0,children:"dashboard"},"d"));return(0,t.jsx)("div",{className:"flex min-w-0 items-center gap-2 font-mono text-[12.5px] text-[#a4a9b0]",children:a})}function g(){let e=(0,r.useRouter)(),{state:n}=(0,c.useStore)();return(0,t.jsxs)("div",{className:"sticky top-0 z-30 flex h-[54px] items-center gap-3 border-b border-border bg-[rgba(246,246,243,.86)] px-6 backdrop-blur-md",children:[(0,t.jsx)(f.Button,{variant:"outline",size:"icon-sm",className:"hidden max-md:inline-flex","aria-label":"Menu",onClick:()=>document.body.classList.toggle("nav-open"),children:(0,t.jsx)(s.Icons.menu,{})}),(0,t.jsx)(b,{}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsxs)(f.Button,{variant:"ghost",size:"sm",href:"https://agent-box.sh/docs",target:"_blank",rel:"noopener",children:[(0,t.jsx)(s.Icons.book,{}),"Docs"]}),(0,t.jsxs)(f.Button,{variant:"ghost",size:"sm",href:"/api/v1/docs",target:"_blank",rel:"noopener",children:[(0,t.jsx)(s.Icons.terminal,{}),"API"]}),"password"===n.authMode?(0,t.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>{(0,x.signOut)().then(()=>{e.push("/signin"),e.refresh()})},children:"Sign out"}):null]})}function j({children:e}){let o=(0,r.usePathname)();return(0,n.useEffect)(()=>{document.body.classList.remove("nav-open")},[o]),(0,t.jsxs)("div",{className:"grid min-h-screen grid-cols-[232px_minmax(0,1fr)] max-md:grid-cols-1",children:[(0,t.jsx)("div",{className:"pointer-events-none fixed inset-0 z-40 bg-[rgba(20,24,30,.4)] opacity-0 transition-opacity [body.nav-open_&]:pointer-events-auto [body.nav-open_&]:opacity-100",onClick:()=>document.body.classList.remove("nav-open")}),(0,t.jsx)(h,{}),(0,t.jsxs)("main",{className:"flex min-w-0 flex-col",children:[(0,t.jsx)(g,{}),e]})]})}e.s(["HubShell",0,function({data:e,children:r}){return(0,t.jsxs)(c.HubProvider,{data:e,children:[(0,t.jsx)(p,{}),(0,t.jsx)(j,{children:r})]})}],31876)}]);