@chibitek/chibi 0.1.209 → 0.1.210

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 (142) hide show
  1. package/dist/assets/{TerminalPanel-CHGq3udb.js → TerminalPanel-DxQoOfkY.js} +1 -1
  2. package/dist/assets/{abnfDiagram-O67JEVCF-BMaKhJ-b.js → abnfDiagram-O67JEVCF-Ds2qYdjS.js} +1 -1
  3. package/dist/assets/{arc-CYAiNWN8.js → arc-1O9tchZk.js} +1 -1
  4. package/dist/assets/{architectureDiagram-NJMV4G6O-CxJFFlbO.js → architectureDiagram-NJMV4G6O-CWuQ1x2F.js} +1 -1
  5. package/dist/assets/{blockDiagram-BEXU5L5S-C7AbPjRB.js → blockDiagram-BEXU5L5S-CNcEkXEx.js} +1 -1
  6. package/dist/assets/{c4Diagram-YGBWAQC7-DfVnCJmT.js → c4Diagram-YGBWAQC7-BKI_wi9I.js} +1 -1
  7. package/dist/assets/channel-CT5xRPK0.js +1 -0
  8. package/dist/assets/{chunk-2Q5K7J3B-CzAUFkgv.js → chunk-2Q5K7J3B-gO88emfN.js} +1 -1
  9. package/dist/assets/{chunk-3FUC2YCW-BgeBXphm.js → chunk-3FUC2YCW-DbKNT_-r.js} +2 -2
  10. package/dist/assets/{chunk-5VM5RSS4-DPRdTAXc.js → chunk-5VM5RSS4-BbJCoZVg.js} +1 -1
  11. package/dist/assets/{chunk-GTNCS2PH-BS-_dIVl.js → chunk-GTNCS2PH-DXurSCcp.js} +1 -1
  12. package/dist/assets/{chunk-GWA4HPMP-D6I7xMmd.js → chunk-GWA4HPMP-BWyt0I_m.js} +1 -1
  13. package/dist/assets/{chunk-JWPE2WC7-BKSKe7C9.js → chunk-JWPE2WC7-6iWSsogl.js} +1 -1
  14. package/dist/assets/{chunk-NETBCI7D-R48UYTRN.js → chunk-NETBCI7D-CFoqO9Hw.js} +1 -1
  15. package/dist/assets/{chunk-WEXAMYUT-C8z4mL-2.js → chunk-WEXAMYUT-BZEzAlNi.js} +1 -1
  16. package/dist/assets/{chunk-XXDRQBXY-Bml3ZRJ5.js → chunk-XXDRQBXY-W4hfC50f.js} +1 -1
  17. package/dist/assets/{classDiagram-v2-NBCMYWYE-w5wo22FO.js → classDiagram-v2-NBCMYWYE-BsGmL9e7.js} +1 -1
  18. package/dist/assets/{cose-bilkent-JH36ORCC-Cum9v--4.js → cose-bilkent-JH36ORCC-CYtTgIzk.js} +1 -1
  19. package/dist/assets/{cynefin-OW5HDTMX-BzN0-KsP.js → cynefin-OW5HDTMX-DLOi2Q2V.js} +1 -1
  20. package/dist/assets/{cynefinDiagram-VND7K2PF-CkOpm32D.js → cynefinDiagram-VND7K2PF-BXcXJ3hv.js} +1 -1
  21. package/dist/assets/{dagre-6A5THRUB-BItQkKZD.js → dagre-6A5THRUB-BdBOiuzt.js} +1 -1
  22. package/dist/assets/{diagram-22UHCM2B-BI0zDn7c.js → diagram-22UHCM2B-DCf3M4WE.js} +1 -1
  23. package/dist/assets/{diagram-3UASUU5V-jwcDxsu6.js → diagram-3UASUU5V-CzdF-UXi.js} +1 -1
  24. package/dist/assets/{diagram-ATOU4E4O-2RnY9egJ.js → diagram-ATOU4E4O-_UmmlMOD.js} +1 -1
  25. package/dist/assets/{diagram-CDSNMT55-eVdEZmEF.js → diagram-CDSNMT55-DrQODVuX.js} +1 -1
  26. package/dist/assets/{diagram-MLGK6HIB-BCDGCJJ0.js → diagram-MLGK6HIB-CE16iJlJ.js} +1 -1
  27. package/dist/assets/{diagram-MPIPVDR6-DtN5uO5w.js → diagram-MPIPVDR6-DJuTbhbP.js} +1 -1
  28. package/dist/assets/{ebnfDiagram-ZINNZB2B-B9GpXSEs.js → ebnfDiagram-ZINNZB2B-f1VEI2Po.js} +1 -1
  29. package/dist/assets/{elk-276RUBZZ-Bk_eaK4T.js → elk-276RUBZZ-BRbs9WzY.js} +1 -1
  30. package/dist/assets/{erDiagram-OPXOYQCR-BiGoW6C6.js → erDiagram-OPXOYQCR-DvMp_cQr.js} +1 -1
  31. package/dist/assets/{flowDiagram-KWPJA3E3-ZW5w0BaJ.js → flowDiagram-KWPJA3E3-CYS1A0fu.js} +1 -1
  32. package/dist/assets/{ganttDiagram-FUAMR5RP-yyrKgsx1.js → ganttDiagram-FUAMR5RP-qya_JE9x.js} +1 -1
  33. package/dist/assets/{gitGraphDiagram-X574FWY7-CeiDikzD.js → gitGraphDiagram-X574FWY7-ChMUJ3hH.js} +1 -1
  34. package/dist/assets/{index-CZGnshrJ.js → index-COH7BlyH.js} +196 -196
  35. package/dist/assets/index-H8vkXbLq.css +1 -0
  36. package/dist/assets/{index-DUFlRZuA.js → index-xE4Li_H2.js} +1 -1
  37. package/dist/assets/{infoDiagram-VRGFBTTK-q2B-KJFm.js → infoDiagram-VRGFBTTK-B2VudqsE.js} +1 -1
  38. package/dist/assets/{ishikawaDiagram-OU5B5YK6-D8gXFuc0.js → ishikawaDiagram-OU5B5YK6-Bdk47y0t.js} +1 -1
  39. package/dist/assets/{journeyDiagram-ZHPQQLJL-BmHL2mbq.js → journeyDiagram-ZHPQQLJL-A4StgNQ9.js} +1 -1
  40. package/dist/assets/{kanban-definition-PNTS6WVX-B9Ll2WkA.js → kanban-definition-PNTS6WVX-DZo45dQw.js} +1 -1
  41. package/dist/assets/{linear-CMVGYrKx.js → linear-D_rK-Ord.js} +1 -1
  42. package/dist/assets/{mermaid.core-qO11n1kV.js → mermaid.core-C7CvDDvz.js} +5 -5
  43. package/dist/assets/{mindmap-definition-NLK3R4M7-CxLGFX45.js → mindmap-definition-NLK3R4M7-6fmVPMyc.js} +1 -1
  44. package/dist/assets/{pegDiagram-GJSIUBJH-CxK1MJG4.js → pegDiagram-GJSIUBJH-CD4Qg24h.js} +1 -1
  45. package/dist/assets/{pieDiagram-5QR66LMP-H5jiF5Eu.js → pieDiagram-5QR66LMP-DmzQ883B.js} +1 -1
  46. package/dist/assets/{quadrantDiagram-O4NWA36T-CKaqCruv.js → quadrantDiagram-O4NWA36T-BW37utPZ.js} +1 -1
  47. package/dist/assets/{railroadDiagram-XR7U4H2S-BCzKiQOd.js → railroadDiagram-XR7U4H2S-CWXiMlAb.js} +1 -1
  48. package/dist/assets/{requirementDiagram-PLB6GJNP-Cqtr43DT.js → requirementDiagram-PLB6GJNP-DHSfr9U3.js} +1 -1
  49. package/dist/assets/{sankeyDiagram-IPEJSGJF-B2tQewX8.js → sankeyDiagram-IPEJSGJF-PebTt4eq.js} +1 -1
  50. package/dist/assets/{sequenceDiagram-PO4LG4MO-nggwQyrw.js → sequenceDiagram-PO4LG4MO-DPwp8fia.js} +1 -1
  51. package/dist/assets/{sizeCapture-INFHLROL-qSPXJBv2.js → sizeCapture-INFHLROL-BX_46o3S.js} +1 -1
  52. package/dist/assets/{stateDiagram-v2-GCMORJYK-DraPbL2T.js → stateDiagram-v2-GCMORJYK-W2e0RRrZ.js} +1 -1
  53. package/dist/assets/{swimlanes-2SLR337P-C6HVkIDA.js → swimlanes-2SLR337P-CkyXpQX9.js} +1 -1
  54. package/dist/assets/swimlanesDiagram-TC7HE7FX-BH9Yry0J.js +8 -0
  55. package/dist/assets/{timeline-definition-EJHVYXUP-DZmPRTsx.js → timeline-definition-EJHVYXUP-BS-sCjlN.js} +1 -1
  56. package/dist/assets/{usecaseDiagram-POWQR4AR-CsVuROW_.js → usecaseDiagram-POWQR4AR-BQre-k6x.js} +1 -1
  57. package/dist/assets/{vennDiagram-UO4OBE2U-B9IRbuhp.js → vennDiagram-UO4OBE2U-CEWCsi_s.js} +1 -1
  58. package/dist/assets/{wardleyDiagram-VNRHLVJA-CGmVK53n.js → wardleyDiagram-VNRHLVJA-CXUxqghG.js} +1 -1
  59. package/dist/assets/{xychartDiagram-PMCCYNJV-BAw-x9Y1.js → xychartDiagram-PMCCYNJV-DBgVMpwp.js} +1 -1
  60. package/dist/index.html +4 -2
  61. package/dist-server/accounts-proxy.js +19 -12
  62. package/dist-server/browser-proxy.js +19 -14
  63. package/dist-server/container-mcp.js +84 -12
  64. package/dist-server/drivers/agents-proxy.js +28 -13
  65. package/dist-server/drivers/phone-proxy.js +21 -13
  66. package/dist-server/index.js +3990 -2815
  67. package/dist-server/local-computer-proxy.js +77 -11
  68. package/dist-server/local-computer.js +2 -1
  69. package/dist-server/mcp-gate.js +53 -4
  70. package/dist-server/mcp-server.js +1 -1
  71. package/dist-server/openmausbot.js +443 -74
  72. package/dist-server/pair-cli.js +443 -74
  73. package/dist-server/server/accounts-proxy.js +3 -17
  74. package/dist-server/server/atomic-engine-release.js +7 -0
  75. package/dist-server/server/browser-proxy.js +3 -17
  76. package/dist-server/server/child-env.js +79 -0
  77. package/dist-server/server/config.js +11 -5
  78. package/dist-server/server/container-computer.js +1 -1
  79. package/dist-server/server/container-mcp.js +3 -2
  80. package/dist-server/server/control-client.js +7 -6
  81. package/dist-server/server/delegated-full-access.js +98 -0
  82. package/dist-server/server/desktop-loopback-gate.js +57 -0
  83. package/dist-server/server/drivers/acp/core.js +4 -4
  84. package/dist-server/server/drivers/acp/session-key.js +8 -0
  85. package/dist-server/server/drivers/agents-client.js +2 -14
  86. package/dist-server/server/drivers/gcloud-token.js +28 -0
  87. package/dist-server/server/drivers/github-copilot.js +152 -0
  88. package/dist-server/server/drivers/openai-chat-protocol.js +8 -0
  89. package/dist-server/server/drivers/openai-chat.js +10 -8
  90. package/dist-server/server/drivers/openai-compat.js +44 -9
  91. package/dist-server/server/drivers/phone-proxy.js +5 -18
  92. package/dist-server/server/engine-tiers.js +9 -9
  93. package/dist-server/server/harness/http.js +47 -1
  94. package/dist-server/server/index.js +54 -54
  95. package/dist-server/server/ladder-pick.js +18 -0
  96. package/dist-server/server/local-computer-proxy.js +3 -2
  97. package/dist-server/server/local-computer.js +1 -0
  98. package/dist-server/server/mcp-bridge.js +3 -2
  99. package/dist-server/server/mcp-gate.js +2 -1
  100. package/dist-server/server/mcp-registry.js +5 -1
  101. package/dist-server/server/model-gateway/failover.js +4 -1
  102. package/dist-server/server/model-gateway/route.js +64 -14
  103. package/dist-server/server/model-gateway/usage.js +66 -0
  104. package/dist-server/server/model-levels/aa-scale.js +42 -0
  105. package/dist-server/server/model-levels/aliases.js +16 -3
  106. package/dist-server/server/model-levels/index.js +8 -3
  107. package/dist-server/server/model-levels/rankings-build.js +76 -0
  108. package/dist-server/server/model-prices.js +6 -0
  109. package/dist-server/server/nexus-memory/index.js +5 -13
  110. package/dist-server/server/nexus-memory/policy.js +5 -17
  111. package/dist-server/server/oauth-account-vault.js +7 -2
  112. package/dist-server/server/provider-accounts.js +20 -1
  113. package/dist-server/server/provider-key-check.js +31 -1
  114. package/dist-server/server/registry-load.js +88 -0
  115. package/dist-server/server/request-auth.js +6 -28
  116. package/dist-server/server/routes/provider-accounts.js +124 -6
  117. package/dist-server/server/routine-daily-schedule.js +20 -0
  118. package/dist-server/server/routine-prompt-escape.js +18 -0
  119. package/dist-server/server/routine-tick-guard.js +16 -0
  120. package/dist-server/server/routine-tool-problems.js +36 -0
  121. package/dist-server/server/routines.js +36 -38
  122. package/dist-server/server/shutdown-triggers.js +18 -0
  123. package/dist-server/server/spend.js +23 -13
  124. package/dist-server/server/store.js +4 -13
  125. package/dist-server/server/terminal.js +2 -1
  126. package/dist-server/server/turn-token-file.js +79 -0
  127. package/dist-server/server/turn-token.js +23 -0
  128. package/dist-server/server/vps-container-mcp.js +3 -2
  129. package/dist-server/server/webhook-ingress.js +11 -1
  130. package/dist-server/server/webhook-prompt.js +82 -0
  131. package/dist-server/server/webhooks.js +8 -65
  132. package/dist-server/server/workspace-backup-policy.js +3 -3
  133. package/dist-server/server/workspace-backup.js +1 -1
  134. package/dist-server/server/workspace-time-zone.js +47 -0
  135. package/dist-server/shared/engine-choices.js +12 -1
  136. package/dist-server/shared/provider-accounts.js +114 -2
  137. package/dist-server/shared/zoned-time.js +55 -0
  138. package/dist-server/vps-container-mcp.js +84 -12
  139. package/package.json +1 -1
  140. package/dist/assets/channel-DxL_mLhm.js +0 -1
  141. package/dist/assets/index-Bi3hprmz.css +0 -1
  142. package/dist/assets/swimlanesDiagram-TC7HE7FX-gQUGsELo.js +0 -8
@@ -17180,6 +17180,23 @@ var init_provider_accounts = __esm({
17180
17180
  keyUrl: "https://z.ai/manage-apikey/apikey-list",
17181
17181
  signupUrl: "https://z.ai/subscribe"
17182
17182
  },
17183
+ {
17184
+ // GitHub Copilot (Pro, Pro+, Business, Enterprise): a subscription used
17185
+ // through a GitHub device-code sign-in. The GitHub token is kept like a
17186
+ // key; each request trades it for a short-lived Copilot token
17187
+ // (server/drivers/github-copilot.ts). Its models come from several
17188
+ // companies, so it walks with the subscriptions but gets no bot of its own.
17189
+ id: "githubCopilot",
17190
+ kind: "apiKey",
17191
+ label: "GitHub Copilot",
17192
+ billing: "subscription",
17193
+ driver: "openai-compat",
17194
+ envVar: "GITHUB_COPILOT_TOKEN",
17195
+ config: { url: "https://api.githubcopilot.com", apiKeyEnv: "GITHUB_COPILOT_TOKEN", model: "", provider: "", auth: "githubCopilot" },
17196
+ deviceSignIn: "githubCopilot",
17197
+ keyUrl: "https://github.com/settings/copilot",
17198
+ signupUrl: "https://github.com/features/copilot/plans"
17199
+ },
17183
17200
  {
17184
17201
  id: "xai",
17185
17202
  kind: "apiKey",
@@ -17204,6 +17221,155 @@ var init_provider_accounts = __esm({
17204
17221
  keyTest: { provider: "mistral" },
17205
17222
  keyUrl: "https://console.mistral.ai/api-keys"
17206
17223
  },
17224
+ {
17225
+ // OpenRouter with credit: one key for hundreds of models from every
17226
+ // company, billed per token. OpenRouter reports each request's cost, so
17227
+ // the ledger and the monthly spend limit count it exactly. `openrouter/auto`
17228
+ // lets OpenRouter pick until a model is chosen. A key with no credit can
17229
+ // still use the free models: add it as "OpenRouter (free models)".
17230
+ id: "openrouter",
17231
+ kind: "apiKey",
17232
+ label: "OpenRouter",
17233
+ billing: "payPerUse",
17234
+ driver: "openai-compat",
17235
+ envVar: "OPENROUTER_API_KEY",
17236
+ icon: "openrouter",
17237
+ config: { url: "https://openrouter.ai/api/v1", apiKeyEnv: "OPENROUTER_API_KEY", model: "openrouter/auto", provider: "" },
17238
+ keyTest: { provider: "openaiCompat", url: "https://openrouter.ai/api/v1" },
17239
+ keyUrl: "https://openrouter.ai/settings/keys",
17240
+ signupUrl: "https://openrouter.ai/"
17241
+ },
17242
+ {
17243
+ // Hugging Face Inference Providers: one Hugging Face token, an
17244
+ // OpenAI-compatible router in front of many inference companies, billed
17245
+ // per use to the Hugging Face account (a PRO account includes a small
17246
+ // monthly credit). The router's model list is public, so the key test
17247
+ // asks Hugging Face who the token belongs to instead.
17248
+ id: "huggingface",
17249
+ kind: "apiKey",
17250
+ label: "Hugging Face",
17251
+ billing: "payPerUse",
17252
+ driver: "openai-compat",
17253
+ envVar: "HF_TOKEN",
17254
+ config: { url: "https://router.huggingface.co/v1", apiKeyEnv: "HF_TOKEN", model: "openai/gpt-oss-120b", provider: "" },
17255
+ keyTest: { provider: "huggingface" },
17256
+ keyUrl: "https://huggingface.co/settings/tokens/new?tokenType=fineGrained",
17257
+ signupUrl: "https://huggingface.co/docs/inference-providers"
17258
+ },
17259
+ // Pay-per-use API keys, read 2026-11-22 from each vendor's own docs.
17260
+ {
17261
+ // DeepSeek's own API (api-docs.deepseek.com): OpenAI format at
17262
+ // api.deepseek.com, models deepseek-flash and deepseek-v4-pro.
17263
+ id: "deepseek",
17264
+ kind: "apiKey",
17265
+ label: "DeepSeek",
17266
+ billing: "payPerUse",
17267
+ driver: "openai-compat",
17268
+ envVar: "DEEPSEEK_API_KEY",
17269
+ config: { url: "https://api.deepseek.com", apiKeyEnv: "DEEPSEEK_API_KEY", model: "deepseek-flash", provider: "" },
17270
+ keyTest: { provider: "openaiCompat", url: "https://api.deepseek.com" },
17271
+ keyUrl: "https://platform.deepseek.com/api_keys"
17272
+ },
17273
+ {
17274
+ id: "together",
17275
+ kind: "apiKey",
17276
+ label: "Together AI",
17277
+ billing: "payPerUse",
17278
+ driver: "openai-compat",
17279
+ envVar: "TOGETHER_API_KEY",
17280
+ config: { url: "https://api.together.xyz/v1", apiKeyEnv: "TOGETHER_API_KEY", model: "openai/gpt-oss-120b", provider: "" },
17281
+ keyTest: { provider: "openaiCompat", url: "https://api.together.xyz/v1" },
17282
+ keyUrl: "https://api.together.ai/settings/api-keys"
17283
+ },
17284
+ {
17285
+ id: "fireworks",
17286
+ kind: "apiKey",
17287
+ label: "Fireworks AI",
17288
+ billing: "payPerUse",
17289
+ driver: "openai-compat",
17290
+ envVar: "FIREWORKS_API_KEY",
17291
+ config: { url: "https://api.fireworks.ai/inference/v1", apiKeyEnv: "FIREWORKS_API_KEY", model: "accounts/fireworks/models/gpt-oss-120b", provider: "" },
17292
+ keyTest: { provider: "openaiCompat", url: "https://api.fireworks.ai/inference/v1" },
17293
+ keyUrl: "https://app.fireworks.ai/settings/users/api-keys"
17294
+ },
17295
+ {
17296
+ // The paid tiers use the same endpoints as the free-tier accounts below;
17297
+ // only the account's billing differs, so they stay separate accounts.
17298
+ id: "groq",
17299
+ kind: "apiKey",
17300
+ label: "Groq",
17301
+ billing: "payPerUse",
17302
+ driver: "openai-compat",
17303
+ envVar: "GROQ_API_KEY",
17304
+ config: { url: "https://api.groq.com/openai/v1", apiKeyEnv: "GROQ_API_KEY", model: "openai/gpt-oss-120b", provider: "" },
17305
+ keyTest: { provider: "openaiCompat", url: "https://api.groq.com/openai/v1" },
17306
+ keyUrl: "https://console.groq.com/keys",
17307
+ signupUrl: "https://console.groq.com/settings/billing"
17308
+ },
17309
+ {
17310
+ id: "cerebras",
17311
+ kind: "apiKey",
17312
+ label: "Cerebras",
17313
+ billing: "payPerUse",
17314
+ driver: "openai-compat",
17315
+ envVar: "CEREBRAS_API_KEY",
17316
+ config: { url: "https://api.cerebras.ai/v1", apiKeyEnv: "CEREBRAS_API_KEY", model: "gpt-oss-120b", provider: "" },
17317
+ keyTest: { provider: "openaiCompat", url: "https://api.cerebras.ai/v1" },
17318
+ keyUrl: "https://cloud.cerebras.ai/platform/apikeys",
17319
+ signupUrl: "https://cloud.cerebras.ai/"
17320
+ },
17321
+ {
17322
+ // Amazon Bedrock's OpenAI-compatible Chat Completions on bedrock-runtime
17323
+ // with a Bedrock API key as the bearer token. Keys are per Region, and
17324
+ // short-term ones last at most 12 hours. bedrock-runtime has no model
17325
+ // list, so the model id is asked for (default: gpt-oss-120b).
17326
+ id: "bedrock",
17327
+ kind: "apiKey",
17328
+ label: "Amazon Bedrock",
17329
+ billing: "payPerUse",
17330
+ driver: "openai-compat",
17331
+ envVar: "AWS_BEARER_TOKEN_BEDROCK",
17332
+ config: { url: "https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1", apiKeyEnv: "AWS_BEARER_TOKEN_BEDROCK", model: "openai.gpt-oss-120b-1:0", provider: "" },
17333
+ setup: {
17334
+ url: { example: "https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1", pattern: "^https://bedrock-runtime\\.[a-z0-9-]+\\.amazonaws\\.com/openai/v1$" },
17335
+ model: { example: "openai.gpt-oss-120b-1:0" }
17336
+ },
17337
+ keyUrl: "https://console.aws.amazon.com/bedrock/home#/api-keys"
17338
+ },
17339
+ {
17340
+ // Azure OpenAI v1 API: the resource's own endpoint plus /openai/v1, the
17341
+ // resource key as the bearer token, and the deployment name as the model.
17342
+ id: "azureOpenai",
17343
+ kind: "apiKey",
17344
+ label: "Azure OpenAI",
17345
+ billing: "payPerUse",
17346
+ driver: "openai-compat",
17347
+ envVar: "AZURE_OPENAI_API_KEY",
17348
+ config: { url: "", apiKeyEnv: "AZURE_OPENAI_API_KEY", model: "", provider: "" },
17349
+ setup: {
17350
+ url: { example: "https://your-resource.openai.azure.com/openai/v1", pattern: "^https://[a-z0-9-]+\\.(openai\\.azure\\.com|services\\.ai\\.azure\\.com|cognitiveservices\\.azure\\.com)/openai/v1$" },
17351
+ model: { example: "gpt-5.4-mini", required: true }
17352
+ },
17353
+ keyUrl: "https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/OpenAI"
17354
+ },
17355
+ {
17356
+ // Google Vertex AI's OpenAI-compatible endpoint accepts only a Google
17357
+ // Cloud access token, so the account borrows this computer's gcloud
17358
+ // sign-in (server/drivers/gcloud-token.ts) and stores no key.
17359
+ id: "vertexAi",
17360
+ kind: "apiKey",
17361
+ label: "Google Vertex AI",
17362
+ billing: "payPerUse",
17363
+ driver: "openai-compat",
17364
+ envVar: "VERTEX_AI_ACCESS_TOKEN",
17365
+ keyless: true,
17366
+ config: { url: "", apiKeyEnv: "VERTEX_AI_ACCESS_TOKEN", key: "gcloud", auth: "gcloud", model: "google/gemini-3.8-flash", provider: "" },
17367
+ setup: {
17368
+ url: { example: "https://aiplatform.googleapis.com/v1/projects/your-project/locations/global/endpoints/openapi", pattern: "^https://([a-z0-9-]+-)?aiplatform\\.googleapis\\.com/v1(beta1)?/projects/[a-z0-9-]+/locations/[a-z0-9-]+/endpoints/openapi$" },
17369
+ model: { example: "google/gemini-3.8-flash" }
17370
+ },
17371
+ keyUrl: "https://console.cloud.google.com/vertex-ai"
17372
+ },
17207
17373
  {
17208
17374
  // Ollama's Free, Pro, Max and Team plans each include a monthly credit.
17209
17375
  // Unused credit does not carry over (use it or lose it); use past it is
@@ -17262,7 +17428,9 @@ var init_provider_accounts = __esm({
17262
17428
  driver: "openai-compat",
17263
17429
  envVar: "OPENROUTER_FREE_API_KEY",
17264
17430
  icon: "openrouter",
17265
- config: { url: "https://openrouter.ai/api/v1", apiKeyEnv: "OPENROUTER_FREE_API_KEY", model: "", provider: "" },
17431
+ // Only free models are listed (`:free` ids and OpenRouter's own free
17432
+ // router, the default), so this account can never spend credit.
17433
+ config: { url: "https://openrouter.ai/api/v1", apiKeyEnv: "OPENROUTER_FREE_API_KEY", model: "openrouter/free", provider: "", modelFilter: "free" },
17266
17434
  keyTest: { provider: "openaiCompat", url: "https://openrouter.ai/api/v1" },
17267
17435
  keyUrl: "https://openrouter.ai/keys",
17268
17436
  signupUrl: "https://openrouter.ai/models?max_price=0"
@@ -17315,6 +17483,21 @@ var init_provider_accounts = __esm({
17315
17483
  keyTest: { provider: "openaiCompat", url: "https://integrate.api.nvidia.com/v1" },
17316
17484
  keyUrl: "https://build.nvidia.com/settings/api-keys",
17317
17485
  signupUrl: "https://build.nvidia.com/"
17486
+ },
17487
+ // No key, no sign-up: Pollinations' anonymous tier serves one small model
17488
+ // (openai-fast, gpt-oss-20b, Añejo). It answered an identical prompt with
17489
+ // an identical cached reply when checked (2026-11-22), so prompts may be
17490
+ // stored: opt-in only, never for client data (the free band skips it).
17491
+ {
17492
+ id: "pollinationsFree",
17493
+ kind: "apiKey",
17494
+ label: "Pollinations (no sign-up)",
17495
+ billing: "free",
17496
+ driver: "openai-compat",
17497
+ envVar: "POLLINATIONS_FREE_API_KEY",
17498
+ keyless: true,
17499
+ config: { url: "https://text.pollinations.ai/openai", apiKeyEnv: "POLLINATIONS_FREE_API_KEY", key: "anonymous", model: "openai-fast", provider: "" },
17500
+ keyUrl: "https://pollinations.ai/"
17318
17501
  }
17319
17502
  ];
17320
17503
  }
@@ -17955,7 +18138,7 @@ function saveConfig(patch, options = {}) {
17955
18138
  }
17956
18139
  if (checkedPatch.vps !== void 0) disk.vps = normalizeVpsConfig(checkedPatch.vps);
17957
18140
  if (checkedPatch.workspaceName !== void 0) disk.workspaceName = checkedPatch.workspaceName;
17958
- if (checkedPatch.language !== void 0) disk.language = checkedPatch.language;
18141
+ for (const key of ["language", "timeZone"]) if (checkedPatch[key] !== void 0) disk[key] = checkedPatch[key];
17959
18142
  if (checkedPatch.customDomain !== void 0) disk.customDomain = checkedPatch.customDomain;
17960
18143
  if (checkedPatch.godMode !== void 0) disk.godMode = checkedPatch.godMode;
17961
18144
  if (checkedPatch.signIn !== void 0) disk.signIn = checkedPatch.signIn;
@@ -18499,8 +18682,9 @@ var init_config = __esm({
18499
18682
  ).optional()
18500
18683
  }).strict().optional(),
18501
18684
  /** UI language override (BCP-47, lowercase). Empty/absent = follow the
18502
- * system language. Unknown tags degrade to English in the renderer. */
18685
+ * system language. Unknown tags degrade to English in the renderer. timeZone: see server/workspace-time-zone.ts. */
18503
18686
  language: optionalText,
18687
+ timeZone: external_exports.string().max(64).optional(),
18504
18688
  rooms: roomConfigSchema.optional(),
18505
18689
  context: external_exports.object({
18506
18690
  rebuildBytes: external_exports.number().int().min(1024).max(1e6).optional(),
@@ -18562,7 +18746,13 @@ var init_config = __esm({
18562
18746
  storedAppConfigSchema = appConfigSchema.extend({
18563
18747
  browserProfiles: storedBrowserProfilesSchema.optional()
18564
18748
  });
18565
- appConfigPatchSchema = appConfigSchema.omit({ instances: true, mcpServers: true, cliStartup: true, customDomain: true, godMode: true, engineTiers: true, jevAnswerChecks: true, hipaa: true, personal: true, subscriptionBots: true, nexusMemory: true }).extend({ threads: threadsPatchSchema.optional(), newBots: newBotsPatchSchema.optional() });
18749
+ appConfigPatchSchema = appConfigSchema.omit({ instances: true, mcpServers: true, cliStartup: true, customDomain: true, godMode: true, engineTiers: true, jevAnswerChecks: true, hipaa: true, personal: true, subscriptionBots: true, nexusMemory: true }).extend({ threads: threadsPatchSchema.optional(), newBots: newBotsPatchSchema.optional(), timeZone: external_exports.string().max(64).refine((value) => {
18750
+ try {
18751
+ return value === "" || Boolean(new Intl.DateTimeFormat("en-US", { timeZone: value }));
18752
+ } catch {
18753
+ return false;
18754
+ }
18755
+ }, "Choose a time zone from the list.").optional() });
18566
18756
  jsonObjectSchema = external_exports.record(external_exports.string(), external_exports.json());
18567
18757
  DATA_DIR = process.env.OMB_DATA_DIR ?? join4(homedir2(), ".atomic-app");
18568
18758
  LEGACY_DATA_DIR = join4(homedir2(), ".opengrokbot");
@@ -22316,8 +22506,46 @@ var init_cli_prompts = __esm({
22316
22506
  }
22317
22507
  });
22318
22508
 
22509
+ // electron/windows-process-time.mjs
22510
+ import { execFileSync as execFileSync3 } from "node:child_process";
22511
+ function windowsCreationTimeArgs(pid) {
22512
+ if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0 || pid > MAX_PID) return null;
22513
+ return [
22514
+ "-NoProfile",
22515
+ "-NonInteractive",
22516
+ "-Command",
22517
+ // ToFileTimeUtc is an integer, so the answer does not depend on the
22518
+ // machine's language, date format or time zone.
22519
+ `$p = Get-CimInstance Win32_Process -Filter 'ProcessId=${pid}'; if ($p) { $p.CreationDate.ToFileTimeUtc() }`
22520
+ ];
22521
+ }
22522
+ function parseFileTimeUtcMs(text7) {
22523
+ const raw = String(text7 ?? "").trim();
22524
+ if (!/^\d{15,19}$/u.test(raw)) return null;
22525
+ const ms2 = BigInt(raw) / FILETIME_TICKS_PER_MS - FILETIME_UNIX_EPOCH_MS;
22526
+ return ms2 > 0n && ms2 <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(ms2) : null;
22527
+ }
22528
+ function windowsProcessCreationTimeMs(pid, { platform = process.platform, exec: exec2 = execFileSync3 } = {}) {
22529
+ if (platform !== "win32") return null;
22530
+ const args = windowsCreationTimeArgs(pid);
22531
+ if (!args) return null;
22532
+ try {
22533
+ return parseFileTimeUtcMs(exec2("powershell.exe", args, { encoding: "utf8", timeout: 1e4, stdio: ["ignore", "pipe", "ignore"], windowsHide: true }));
22534
+ } catch {
22535
+ return null;
22536
+ }
22537
+ }
22538
+ var MAX_PID, FILETIME_TICKS_PER_MS, FILETIME_UNIX_EPOCH_MS;
22539
+ var init_windows_process_time = __esm({
22540
+ "electron/windows-process-time.mjs"() {
22541
+ "use strict";
22542
+ MAX_PID = 2147483647;
22543
+ FILETIME_TICKS_PER_MS = 10000n;
22544
+ FILETIME_UNIX_EPOCH_MS = 11644473600000n;
22545
+ }
22546
+ });
22547
+
22319
22548
  // electron/data-dir-lease.mjs
22320
- import { execFileSync as execFileSync2 } from "node:child_process";
22321
22549
  import { createHash as createHash3, randomUUID as randomUUID6 } from "node:crypto";
22322
22550
  import { existsSync as existsSync10, linkSync, mkdirSync as mkdirSync8, readFileSync as readFileSync6, renameSync as renameSync5, unlinkSync as unlinkSync3, writeFileSync as writeFileSync5 } from "node:fs";
22323
22551
  import { hostname as hostname4, uptime } from "node:os";
@@ -22326,7 +22554,7 @@ function leaseError(message3, cause) {
22326
22554
  return Object.assign(new DataDirLeaseError(message3), { cause });
22327
22555
  }
22328
22556
  function isPid(value) {
22329
- return Number.isInteger(value) && value > 0 && value <= MAX_PID;
22557
+ return Number.isInteger(value) && value > 0 && value <= MAX_PID2;
22330
22558
  }
22331
22559
  function readBootSession() {
22332
22560
  try {
@@ -22334,7 +22562,7 @@ function readBootSession() {
22334
22562
  return normalizeBootId(readFileSync6("/proc/sys/kernel/random/boot_id", "utf8"));
22335
22563
  }
22336
22564
  if (process.platform === "darwin") {
22337
- return normalizeBootId(execFileSync2("/usr/sbin/sysctl", ["-n", "kern.bootsessionuuid"], {
22565
+ return normalizeBootId(execFileSync("/usr/sbin/sysctl", ["-n", "kern.bootsessionuuid"], {
22338
22566
  encoding: "utf8",
22339
22567
  timeout: 5e3,
22340
22568
  stdio: ["ignore", "pipe", "ignore"]
@@ -22416,50 +22644,9 @@ function processIsAlive2(pid) {
22416
22644
  throw leaseError("Atomic could not verify the data-directory lease owner; refusing to start.", error51);
22417
22645
  }
22418
22646
  }
22419
- function parseWmiDateTime(value) {
22420
- const raw = String(value).trim();
22421
- const match = /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\.(\d{6})([+-]\d{3})$/.exec(raw);
22422
- if (!match) return null;
22423
- const [_3, year, month, day, hour, minute, second, micro, offset] = match;
22424
- const ms2 = Date.UTC(
22425
- Number(year),
22426
- Number(month) - 1,
22427
- Number(day),
22428
- Number(hour),
22429
- Number(minute),
22430
- Number(second),
22431
- Math.floor(Number(micro) / 1e3)
22432
- );
22433
- const offsetMinutes = Number(offset);
22434
- return ms2 - offsetMinutes * 60 * 1e3;
22435
- }
22436
- function processCreationTimeMs(pid) {
22437
- if (process.platform !== "win32") return null;
22438
- try {
22439
- const output = execFileSync2(
22440
- "wmic",
22441
- ["process", "where", `ProcessId=${pid}`, "get", "CreationDate", "/format:csv"],
22442
- // windowsHide: wmic is a console program and this is the windowed main
22443
- // process, so without it every launch flashed a console window.
22444
- { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "ignore"], windowsHide: true }
22445
- );
22446
- for (const line of output.split(/\r?\n/)) {
22447
- const trimmed = line.trim();
22448
- if (!trimmed) continue;
22449
- const lower = trimmed.toLowerCase();
22450
- if (lower === "node,creationdate" || lower.startsWith("node,")) continue;
22451
- const parts = trimmed.split(",");
22452
- const raw = parts[parts.length - 1].trim();
22453
- const parsed = parseWmiDateTime(raw);
22454
- if (parsed !== null) return parsed;
22455
- }
22456
- } catch {
22457
- }
22458
- return null;
22459
- }
22460
22647
  function ownerIdentityMatches(owner) {
22461
22648
  if (process.platform !== "win32") return true;
22462
- const created = processCreationTimeMs(owner.pid);
22649
+ const created = windowsProcessCreationTimeMs(owner.pid);
22463
22650
  if (created === null) return true;
22464
22651
  return created < owner.createdAt;
22465
22652
  }
@@ -22659,15 +22846,16 @@ function acquireDataDirLeaseInternal(dataDir, options = {}) {
22659
22846
  function acquireDataDirLease(dataDir, options = {}) {
22660
22847
  return acquireDataDirLeaseInternal(dataDir, options);
22661
22848
  }
22662
- var LEASE_NAME, DELEGATED_CHILD_DIR, CHILD_LEASE_ENV, UUID2, MAX_PID, MAX_BOOT_ID, MAX_REAPER_GENERATIONS, DataDirLeaseError, cachedBootSession;
22849
+ var LEASE_NAME, DELEGATED_CHILD_DIR, CHILD_LEASE_ENV, UUID2, MAX_PID2, MAX_BOOT_ID, MAX_REAPER_GENERATIONS, DataDirLeaseError, cachedBootSession;
22663
22850
  var init_data_dir_lease = __esm({
22664
22851
  "electron/data-dir-lease.mjs"() {
22665
22852
  "use strict";
22853
+ init_windows_process_time();
22666
22854
  LEASE_NAME = "openmausbot-server.lease";
22667
22855
  DELEGATED_CHILD_DIR = ".openmausbot-server-child";
22668
22856
  CHILD_LEASE_ENV = "OPENMAUSBOT_INTERNAL_DATA_DIR_LEASE";
22669
22857
  UUID2 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
22670
- MAX_PID = 2147483647;
22858
+ MAX_PID2 = 2147483647;
22671
22859
  MAX_BOOT_ID = 128;
22672
22860
  MAX_REAPER_GENERATIONS = 128;
22673
22861
  DataDirLeaseError = class extends Error {
@@ -26538,6 +26726,20 @@ var init_local_inject = __esm({
26538
26726
  }
26539
26727
  });
26540
26728
 
26729
+ // server/drivers/acp/session-key.ts
26730
+ function mcpSessionKey(servers) {
26731
+ return JSON.stringify(servers.map((server) => {
26732
+ if (!server.env) return server;
26733
+ const names = new Set(server.env.map((entry) => entry.name));
26734
+ return { ...server, env: server.env.filter((entry) => !names.has(`${entry.name}_FILE`)) };
26735
+ }));
26736
+ }
26737
+ var init_session_key = __esm({
26738
+ "server/drivers/acp/session-key.ts"() {
26739
+ "use strict";
26740
+ }
26741
+ });
26742
+
26541
26743
  // server/drivers/prompt-shape.ts
26542
26744
  function permissionKindOfLabel(label) {
26543
26745
  const text7 = label.trim();
@@ -28489,7 +28691,7 @@ function createAcpDriver(support12) {
28489
28691
  const spawnEnv = launch.env ?? env;
28490
28692
  const envFingerprint = createHash5("sha256").update(JSON.stringify(spawnEnv)).digest("hex").slice(0, 16);
28491
28693
  const contractKey = JSON.stringify([launch.command, launch.args ?? [], spawnArgs, cwd, turnConfig.fullAuto === true, envFingerprint]);
28492
- const sessionKey = JSON.stringify(mcpServers);
28694
+ const sessionKey = mcpSessionKey(mcpServers);
28493
28695
  if (turn.sessionReset) {
28494
28696
  closeSession(threadId, "reset");
28495
28697
  sessionAllows.delete(threadId);
@@ -28930,6 +29132,7 @@ var init_core3 = __esm({
28930
29132
  "use strict";
28931
29133
  init_config();
28932
29134
  init_local_inject();
29135
+ init_session_key();
28933
29136
  init_prompt_shape();
28934
29137
  init_procs();
28935
29138
  init_contracts();
@@ -44527,16 +44730,17 @@ var init_box = __esm({
44527
44730
  // server/control-client.ts
44528
44731
  function createControlClient(options) {
44529
44732
  const url2 = options?.url ?? process.env.OMB_CONTROL_URL ?? "";
44530
- const token = options?.token ?? process.env.OMB_CONTROL_TOKEN ?? "";
44733
+ const given = options?.token ?? process.env.OMB_CONTROL_TOKEN ?? "";
44734
+ const token = typeof given === "function" ? given : () => given;
44531
44735
  const cacheMs = options?.cacheMs ?? 750;
44532
44736
  const fetchImpl = options?.fetchImpl ?? fetch;
44533
- const configured = Boolean(url2 && token);
44534
- const headers = { authorization: `Bearer ${token}`, "content-type": "application/json" };
44737
+ const configured = Boolean(url2 && token());
44738
+ const headers = () => ({ authorization: `Bearer ${token()}`, "content-type": "application/json" });
44535
44739
  let cachedAt = 0;
44536
44740
  let cached3 = DISENGAGED;
44537
44741
  async function read() {
44538
44742
  try {
44539
- const res = await fetchImpl(url2, { headers, signal: AbortSignal.timeout(2e3) });
44743
+ const res = await fetchImpl(url2, { headers: headers(), signal: AbortSignal.timeout(2e3) });
44540
44744
  if (!res.ok) return UNAVAILABLE;
44541
44745
  const body = await res.json().catch(() => null);
44542
44746
  if (typeof body?.held !== "boolean" || typeof body?.helpOpen !== "boolean") return UNAVAILABLE;
@@ -44565,7 +44769,7 @@ function createControlClient(options) {
44565
44769
  try {
44566
44770
  const res = await fetchImpl(url2, {
44567
44771
  method: "POST",
44568
- headers,
44772
+ headers: headers(),
44569
44773
  body: JSON.stringify({ reason }),
44570
44774
  signal: AbortSignal.timeout(2e3)
44571
44775
  });
@@ -44581,7 +44785,7 @@ function createControlClient(options) {
44581
44785
  try {
44582
44786
  await fetchImpl(url2, {
44583
44787
  method: "DELETE",
44584
- headers,
44788
+ headers: headers(),
44585
44789
  body: JSON.stringify({ requestId }),
44586
44790
  signal: AbortSignal.timeout(2e3)
44587
44791
  });
@@ -45176,6 +45380,11 @@ function providerError(json2) {
45176
45380
  }
45177
45381
  return null;
45178
45382
  }
45383
+ function chatUsage(usage) {
45384
+ if (!usage) return null;
45385
+ const cost = typeof usage.cost === "number" && Number.isFinite(usage.cost) && usage.cost >= 0 ? usage.cost : void 0;
45386
+ return { input: usage.prompt_tokens ?? 0, output: usage.completion_tokens ?? 0, ...cost !== void 0 ? { cost } : {} };
45387
+ }
45179
45388
  var MAX_CHAT_TOOL_CALLS, MAX_ARGUMENT_CHARS, ChatProtocolError, ChatReasoningDetails, ChatToolCalls;
45180
45389
  var init_openai_chat_protocol = __esm({
45181
45390
  "server/drivers/openai-chat-protocol.ts"() {
@@ -45324,11 +45533,12 @@ function createOpenAIChatRuntime(options) {
45324
45533
  resetIdleTimer();
45325
45534
  try {
45326
45535
  const activeSignal = signal ? AbortSignal.any([signal, timeoutController.signal]) : timeoutController.signal;
45327
- const sendable = sendableMessages(options.apiUrl, model, messages);
45328
- const response = await fetch(`${options.apiUrl}/chat/completions`, {
45536
+ const auth = await options.authorize?.();
45537
+ const sendable = sendableMessages(auth?.apiUrl ?? options.apiUrl, model, messages);
45538
+ const response = await fetch(`${auth?.apiUrl ?? options.apiUrl}/chat/completions`, {
45329
45539
  method: "POST",
45330
45540
  ...hasImageParts(sendable) ? { redirect: "error" } : {},
45331
- headers: { ...options.extraHeaders, authorization: `Bearer ${options.apiKey}`, "content-type": "application/json" },
45541
+ headers: { ...options.extraHeaders, ...auth?.headers, authorization: `Bearer ${auth?.apiKey ?? options.apiKey}`, "content-type": "application/json" },
45332
45542
  body: JSON.stringify({
45333
45543
  ...options.requestBody(model, sendable, stream),
45334
45544
  ...tools.length ? { tools } : {}
@@ -45529,6 +45739,7 @@ function createOpenAIChatRuntime(options) {
45529
45739
  let tools;
45530
45740
  const usage = { input: 0, output: 0 };
45531
45741
  let hasUsage = false;
45742
+ let cost = null;
45532
45743
  let ok = false;
45533
45744
  let stopReason = null;
45534
45745
  let failure;
@@ -45589,6 +45800,7 @@ function createOpenAIChatRuntime(options) {
45589
45800
  }
45590
45801
  native("in", options.nativeLog.incoming(completion));
45591
45802
  if (completion.usage) {
45803
+ if (completion.usage.cost !== void 0) cost = (cost ?? 0) + completion.usage.cost;
45592
45804
  usage.input += completion.usage.input;
45593
45805
  usage.output += completion.usage.output;
45594
45806
  hasUsage = true;
@@ -45707,7 +45919,7 @@ function createOpenAIChatRuntime(options) {
45707
45919
  type: "turn.completed",
45708
45920
  ok,
45709
45921
  stopReason,
45710
- cost: null,
45922
+ cost,
45711
45923
  ...hasUsage && (options.includeUsageInCompleted || seenCalls.size) ? { usage } : {},
45712
45924
  ...denials.length ? { denials } : {}
45713
45925
  });
@@ -45791,7 +46003,7 @@ var init_openai_chat = __esm({
45791
46003
  init_chat_text_only();
45792
46004
  init_native();
45793
46005
  init_retry();
45794
- usageFrom = (usage) => usage ? { input: usage.prompt_tokens ?? 0, output: usage.completion_tokens ?? 0 } : null;
46006
+ usageFrom = (usage) => chatUsage(usage);
45795
46007
  asError = (value) => value instanceof Error ? value : new Error(String(value));
45796
46008
  }
45797
46009
  });
@@ -50769,6 +50981,13 @@ var init_atomic_engine_release = __esm({
50769
50981
  url: "https://ugmbfkqvogfuvufzjxtb.supabase.co/storage/v1/object/public/atomic-updates/atomic/K_5FMcrZFZ5AE2K-Lydn-Tis/atomic-engine-0.21.4-68432dd-win32-x64.tar.gz",
50770
50982
  bytes: 103356325,
50771
50983
  sha512: "a2bb1c23194ca63168a855daee719a851d5213c79b6db083ca676b0aaff26ac55f0e2086e36395f86a677379e8cc0cf53113122b6695b841e12e3619857fc08c"
50984
+ },
50985
+ {
50986
+ version: "0.21.4-68432dd",
50987
+ platform: "darwin-x64",
50988
+ url: "https://ugmbfkqvogfuvufzjxtb.supabase.co/storage/v1/object/public/atomic-updates/atomic/K_5FMcrZFZ5AE2K-Lydn-Tis/atomic-engine-0.21.4-68432dd-darwin-x64.tar.gz",
50989
+ bytes: 107288371,
50990
+ sha512: "8f42c9411363df6969aeea1768f85e2699b3f074d336d8040b8ff4fc3bce798b2727c8071e9a079a00318e60ceab21ef0b752af5e32a073a6d43c8a4d98481fb"
50772
50991
  }
50773
50992
  ];
50774
50993
  }
@@ -58605,7 +58824,128 @@ var init_provider_key_check = __esm({
58605
58824
  }
58606
58825
  });
58607
58826
 
58827
+ // server/drivers/github-copilot.ts
58828
+ async function exchangeCopilotToken(githubToken, fetchImpl = fetch, now = Date.now()) {
58829
+ let response;
58830
+ try {
58831
+ response = await fetchImpl(`${GITHUB_API}/copilot_internal/v2/token`, {
58832
+ headers: { ...COPILOT_HEADERS, accept: "application/json", authorization: `token ${githubToken}` },
58833
+ redirect: "error",
58834
+ signal: AbortSignal.timeout(1e4)
58835
+ });
58836
+ } catch {
58837
+ throw new CopilotAuthError("Could not reach GitHub to renew the Copilot sign-in.");
58838
+ }
58839
+ if (response.status === 401) throw new CopilotAuthError(COPILOT_SIGNED_OUT, 401);
58840
+ if (response.status === 403 || response.status === 404) throw new CopilotAuthError(COPILOT_NO_PLAN, response.status);
58841
+ if (!response.ok) throw new CopilotAuthError(`GitHub could not renew the Copilot sign-in (HTTP ${response.status}).`, response.status);
58842
+ const body = await response.json().catch(() => null);
58843
+ const token = typeof body?.token === "string" ? body.token : "";
58844
+ if (!token) throw new CopilotAuthError("GitHub gave an unexpected answer when renewing the Copilot sign-in.");
58845
+ const endpoints = body?.endpoints && typeof body.endpoints === "object" ? body.endpoints : {};
58846
+ const api2 = typeof endpoints.api === "string" && /^https:\/\/[a-z0-9.-]+\.githubcopilot\.com\/?$/i.test(endpoints.api) ? endpoints.api.replace(/\/+$/, "") : COPILOT_DEFAULT_API;
58847
+ const expiresAt = typeof body?.expires_at === "number" ? body.expires_at * 1e3 : now + 25 * 6e4;
58848
+ return { token, apiUrl: api2, expiresAt };
58849
+ }
58850
+ function copilotSessionCache(githubToken, fetchImpl = fetch, clock3 = Date.now) {
58851
+ let current;
58852
+ let pending;
58853
+ return async () => {
58854
+ if (current && current.expiresAt - RENEW_EARLY_MS > clock3()) return current;
58855
+ pending ??= exchangeCopilotToken(githubToken, fetchImpl, clock3()).then((session) => {
58856
+ current = session;
58857
+ return session;
58858
+ }).finally(() => {
58859
+ pending = void 0;
58860
+ });
58861
+ return pending;
58862
+ };
58863
+ }
58864
+ async function fetchCopilotModels(session, fetchImpl = fetch) {
58865
+ const response = await fetchImpl(`${session.apiUrl}/models`, {
58866
+ headers: { ...COPILOT_HEADERS, authorization: `Bearer ${session.token}` },
58867
+ redirect: "error",
58868
+ signal: AbortSignal.timeout(8e3)
58869
+ });
58870
+ if (!response.ok) return [];
58871
+ const json2 = await response.json().catch(() => null);
58872
+ const rows = Array.isArray(json2?.data) ? json2.data : [];
58873
+ const seen = /* @__PURE__ */ new Set();
58874
+ const options = [];
58875
+ for (const row of rows) {
58876
+ const id = typeof row.id === "string" ? row.id : "";
58877
+ const capabilities = row.capabilities && typeof row.capabilities === "object" ? row.capabilities : {};
58878
+ const policy = row.policy && typeof row.policy === "object" ? row.policy : {};
58879
+ if (!id || seen.has(id)) continue;
58880
+ if (capabilities.type !== void 0 && capabilities.type !== "chat") continue;
58881
+ if (row.model_picker_enabled === false || policy.state === "disabled") continue;
58882
+ seen.add(id);
58883
+ options.push({ id, label: typeof row.name === "string" && row.name.trim() ? row.name : id, custom: true });
58884
+ }
58885
+ return options;
58886
+ }
58887
+ var COPILOT_DEFAULT_API, GITHUB_API, RENEW_EARLY_MS, COPILOT_HEADERS, CopilotAuthError, COPILOT_NO_PLAN, COPILOT_SIGNED_OUT;
58888
+ var init_github_copilot = __esm({
58889
+ "server/drivers/github-copilot.ts"() {
58890
+ "use strict";
58891
+ COPILOT_DEFAULT_API = "https://api.githubcopilot.com";
58892
+ GITHUB_API = "https://api.github.com";
58893
+ RENEW_EARLY_MS = 5 * 6e4;
58894
+ COPILOT_HEADERS = Object.freeze({
58895
+ "editor-version": "vscode/1.99.0",
58896
+ "editor-plugin-version": "copilot-chat/0.26.0",
58897
+ "copilot-integration-id": "vscode-chat",
58898
+ "user-agent": "GitHubCopilotChat/0.26.0",
58899
+ "openai-intent": "conversation-panel"
58900
+ });
58901
+ CopilotAuthError = class extends Error {
58902
+ status;
58903
+ constructor(message3, status) {
58904
+ super(message3);
58905
+ this.status = status;
58906
+ }
58907
+ };
58908
+ COPILOT_NO_PLAN = "This GitHub account has no active Copilot plan. Check github.com/settings/copilot, then sign in again.";
58909
+ COPILOT_SIGNED_OUT = "GitHub Copilot is signed out. Sign in again in Settings > AI & accounts > Subscriptions.";
58910
+ }
58911
+ });
58912
+
58913
+ // server/drivers/gcloud-token.ts
58914
+ import { execFile as execFile3 } from "node:child_process";
58915
+ function gcloudTokenCache(run2 = runGcloud, now = Date.now) {
58916
+ let held = null;
58917
+ let renewing = null;
58918
+ return async () => {
58919
+ if (held && held.until > now()) return held.token;
58920
+ renewing ??= run2().then((token) => {
58921
+ held = { token, until: now() + KEEP_MS };
58922
+ return token;
58923
+ }).finally(() => {
58924
+ renewing = null;
58925
+ });
58926
+ return renewing;
58927
+ };
58928
+ }
58929
+ var GCLOUD_SIGNED_OUT, KEEP_MS, runGcloud;
58930
+ var init_gcloud_token = __esm({
58931
+ "server/drivers/gcloud-token.ts"() {
58932
+ "use strict";
58933
+ GCLOUD_SIGNED_OUT = 'Vertex AI needs the Google Cloud CLI signed in on this computer. Run "gcloud auth login", then try again.';
58934
+ KEEP_MS = 45 * 6e4;
58935
+ runGcloud = () => new Promise((resolve14, reject) => {
58936
+ execFile3("gcloud", ["auth", "print-access-token"], { timeout: 2e4, windowsHide: true }, (error51, stdout2) => {
58937
+ const token = String(stdout2 ?? "").trim();
58938
+ if (error51 || !token) return reject(new Error(GCLOUD_SIGNED_OUT));
58939
+ resolve14(token);
58940
+ });
58941
+ });
58942
+ }
58943
+ });
58944
+
58608
58945
  // server/drivers/openai-compat.ts
58946
+ function isFreeOpenRouterModel(id) {
58947
+ return id.endsWith(":free") || id === "openrouter/free";
58948
+ }
58609
58949
  function isOpenRouterUrl(url2) {
58610
58950
  try {
58611
58951
  const host = new URL(url2).hostname.toLowerCase();
@@ -58630,6 +58970,10 @@ function decodeConfig6(raw) {
58630
58970
  // connection (CLI setup uses this). Absent still inherits the global pin.
58631
58971
  provider: typeof config2.provider === "string" ? config2.provider || void 0 : process.env.OPENAI_COMPAT_PROVIDER || void 0,
58632
58972
  ...typeof config2.organization === "string" && config2.organization ? { organization: config2.organization } : {},
58973
+ // Accounts added as "OpenRouter (free models)" before the filter existed
58974
+ // are known by their key's variable.
58975
+ ...config2.modelFilter === "free" || config2.apiKeyEnv === "OPENROUTER_FREE_API_KEY" ? { modelFilter: "free" } : {},
58976
+ ...config2.auth === "githubCopilot" || config2.auth === "gcloud" ? { auth: config2.auth } : {},
58633
58977
  ...typeof config2.project === "string" && config2.project ? { project: config2.project } : {}
58634
58978
  };
58635
58979
  }
@@ -58640,6 +58984,8 @@ var init_openai_compat = __esm({
58640
58984
  init_ollama_cloud();
58641
58985
  init_openai_chat();
58642
58986
  init_provider_key_check();
58987
+ init_github_copilot();
58988
+ init_gcloud_token();
58643
58989
  DRIVER_KIND5 = "openai-compat";
58644
58990
  DEFAULT_IDLE_TIMEOUT_MS = 18e4;
58645
58991
  idleTimeoutMs = () => {
@@ -58681,9 +59027,25 @@ var init_openai_compat = __esm({
58681
59027
  default: config2.model,
58682
59028
  options: DEFAULT_MODELS2.options.some((model) => model.id === config2.model) ? DEFAULT_MODELS2.options : [{ id: config2.model, label: config2.model, custom: true }, ...DEFAULT_MODELS2.options]
58683
59029
  } : DEFAULT_MODELS2;
59030
+ const copilot = config2.auth === "githubCopilot" && apiKey ? copilotSessionCache(apiKey) : void 0;
59031
+ const gcloud = config2.auth === "gcloud" ? gcloudTokenCache() : void 0;
59032
+ const useOptions = (options) => {
59033
+ if (!options.length) return;
59034
+ if (config2.model && !options.some((model) => model.id === config2.model)) {
59035
+ options.unshift({ id: config2.model, label: config2.model, custom: true });
59036
+ }
59037
+ catalog2 = { default: config2.model || options[0].id, options };
59038
+ };
58684
59039
  const fetchModels = async () => {
58685
- if (config2.managedModels) return;
59040
+ if (config2.managedModels || gcloud) return;
58686
59041
  if (!apiKey) return;
59042
+ if (copilot) {
59043
+ try {
59044
+ useOptions(await fetchCopilotModels(await copilot()));
59045
+ } catch {
59046
+ }
59047
+ return;
59048
+ }
58687
59049
  try {
58688
59050
  const response = await fetch(`${config2.url}/models`, {
58689
59051
  headers: { ...teamHeaders, authorization: `Bearer ${apiKey}` },
@@ -58697,6 +59059,7 @@ var init_openai_compat = __esm({
58697
59059
  for (const row of rows) {
58698
59060
  const id = typeof row.id === "string" ? row.id : "";
58699
59061
  if (!id || seen.has(id)) continue;
59062
+ if (config2.modelFilter === "free" && !isFreeOpenRouterModel(id)) continue;
58700
59063
  seen.add(id);
58701
59064
  options.push({
58702
59065
  id,
@@ -58704,11 +59067,7 @@ var init_openai_compat = __esm({
58704
59067
  custom: true
58705
59068
  });
58706
59069
  }
58707
- if (!options.length) return;
58708
- if (config2.model && !options.some((model) => model.id === config2.model)) {
58709
- options.unshift({ id: config2.model, label: config2.model, custom: true });
58710
- }
58711
- catalog2 = { default: config2.model ?? options[0].id, options };
59070
+ useOptions(options);
58712
59071
  } catch {
58713
59072
  }
58714
59073
  };
@@ -58719,6 +59078,12 @@ var init_openai_compat = __esm({
58719
59078
  apiKey,
58720
59079
  apiUrl: config2.url,
58721
59080
  extraHeaders: teamHeaders,
59081
+ ...copilot ? {
59082
+ authorize: async () => {
59083
+ const session = await copilot();
59084
+ return { apiKey: session.token, apiUrl: session.apiUrl, headers: { ...COPILOT_HEADERS } };
59085
+ }
59086
+ } : gcloud ? { authorize: async () => ({ apiKey: await gcloud() }) } : {},
58722
59087
  tools: config2.tools,
58723
59088
  computerUse: true,
58724
59089
  models: () => catalog2,
@@ -58728,14 +59093,18 @@ var init_openai_compat = __esm({
58728
59093
  messages,
58729
59094
  stream,
58730
59095
  stream_options: stream ? { include_usage: true } : void 0,
58731
- ...config2.provider && isOpenRouterUrl(config2.url) ? { provider: { order: [config2.provider], allow_fallbacks: false } } : {}
59096
+ ...config2.provider && isOpenRouterUrl(config2.url) ? { provider: { order: [config2.provider], allow_fallbacks: false } } : {},
59097
+ // OpenRouter then reports each request's price, which the ledger and
59098
+ // the monthly spend limit use instead of an estimate.
59099
+ ...isOpenRouterUrl(config2.url) ? { usage: { include: true } } : {}
58732
59100
  }),
58733
59101
  httpErrorLabel: "upstream",
58734
59102
  missingKeyError: OPENAI_COMPAT_NO_KEY,
58735
59103
  unavailableReason: OPENAI_COMPAT_NO_KEY,
58736
59104
  timeoutMs: idleTimeoutMs(),
58737
59105
  reasoning: true,
58738
- billing: "metered",
59106
+ // A Copilot plan is a subscription, not metered by the token.
59107
+ ...copilot ? {} : { billing: "metered" },
58739
59108
  includeUsageInCompleted: true,
58740
59109
  nativeLog: {
58741
59110
  source: "openai-compat.chat.completions",
@@ -63140,7 +63509,7 @@ function shouldShowBanner(options, stdout2 = process.stdout) {
63140
63509
 
63141
63510
  // server/fleet-cli.ts
63142
63511
  init_atomic();
63143
- import { execFileSync, spawn as spawn4 } from "node:child_process";
63512
+ import { execFileSync as execFileSync2, spawn as spawn4 } from "node:child_process";
63144
63513
  import { appendFileSync, closeSync as closeSync3, existsSync as existsSync7, fsyncSync as fsyncSync2, lstatSync, mkdirSync as mkdirSync5, openSync as openSync3, readFileSync as readFileSync4, rmSync as rmSync3 } from "node:fs";
63145
63514
  import { posix as posix4 } from "node:path";
63146
63515
 
@@ -63683,7 +64052,7 @@ process.stdout.write(JSON.stringify(result));
63683
64052
  function tenantIo(owner, file2, action, content, mode) {
63684
64053
  assertUnixUser(owner);
63685
64054
  const options = { encoding: "utf8", timeout: 5e3, killSignal: "SIGKILL", cwd: "/", env: { PATH: "/usr/bin:/bin" }, stdio: ["pipe", "pipe", "pipe"] };
63686
- const account = execFileSync("/usr/bin/getent", ["passwd", owner], { ...options, maxBuffer: 8192 }).trim().split(":");
64055
+ const account = execFileSync2("/usr/bin/getent", ["passwd", owner], { ...options, maxBuffer: 8192 }).trim().split(":");
63687
64056
  const uid = Number(account[2]);
63688
64057
  const gid = Number(account[3]);
63689
64058
  const home = account[5];
@@ -63691,7 +64060,7 @@ function tenantIo(owner, file2, action, content, mode) {
63691
64060
  throw new Error(`unsafe filesystem identity or path for ${owner}`);
63692
64061
  }
63693
64062
  try {
63694
- return JSON.parse(execFileSync(process.execPath, ["--eval", TENANT_IO], { ...options, maxBuffer: action === "usage" ? 8192 : 32 * 1024 * 1024, input: JSON.stringify({ uid, gid, home, file: file2, action, content, mode }) }));
64063
+ return JSON.parse(execFileSync2(process.execPath, ["--eval", TENANT_IO], { ...options, maxBuffer: action === "usage" ? 8192 : 32 * 1024 * 1024, input: JSON.stringify({ uid, gid, home, file: file2, action, content, mode }) }));
63695
64064
  } catch {
63696
64065
  throw new Error(`could not ${action} workspace file as ${owner}: check ownership, links, file size and permissions`);
63697
64066
  }