deepline 0.3.552 → 0.3.553

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 (319) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +107 -12
  2. package/dist/bundling-sources/sdk/src/compat.ts +239 -87
  3. package/dist/bundling-sources/sdk/src/config.ts +113 -2
  4. package/dist/bundling-sources/sdk/src/errors.ts +2 -0
  5. package/dist/bundling-sources/sdk/src/http-core.ts +118 -8
  6. package/dist/bundling-sources/sdk/src/index.ts +2 -0
  7. package/dist/bundling-sources/sdk/src/integrations.ts +6 -4
  8. package/dist/bundling-sources/sdk/src/play.ts +3 -0
  9. package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -1
  10. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  11. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +8 -1
  12. package/dist/bundling-sources/sdk/src/tool-calls.ts +2 -1
  13. package/dist/bundling-sources/sdk/src/tool-failure-hint.ts +104 -0
  14. package/dist/bundling-sources/sdk/src/types.ts +9 -1
  15. package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +4 -2
  16. package/dist/bundling-sources/shared_libs/integration-contracts/billing-plan-skus.ts +25 -0
  17. package/dist/bundling-sources/shared_libs/monitors/action-actor.ts +2 -0
  18. package/dist/bundling-sources/shared_libs/monitors/billing/credit-recovery.ts +58 -4
  19. package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +8 -0
  20. package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +11 -0
  21. package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +13 -0
  22. package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +103 -5
  23. package/dist/bundling-sources/shared_libs/monitors/fleets/converge-admission.ts +133 -0
  24. package/dist/bundling-sources/shared_libs/monitors/fleets/fence-attention.ts +165 -0
  25. package/dist/bundling-sources/shared_libs/monitors/fleets/fence-release.ts +726 -0
  26. package/dist/bundling-sources/shared_libs/monitors/fleets/fence-walk.ts +274 -0
  27. package/dist/bundling-sources/shared_libs/monitors/fleets/issues.ts +1 -0
  28. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +28 -0
  29. package/dist/bundling-sources/shared_libs/monitors/fleets/provider-bulk-wait.ts +126 -0
  30. package/dist/bundling-sources/shared_libs/monitors/fleets/shared-payload.ts +189 -0
  31. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +28 -0
  32. package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +4 -0
  33. package/dist/bundling-sources/shared_libs/monitors/inventory-counter-errors.ts +25 -0
  34. package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +65 -0
  35. package/dist/bundling-sources/shared_libs/monitors/package.json +9 -0
  36. package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +152 -1
  37. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +6 -0
  38. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +390 -10
  39. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +34 -0
  40. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +66 -30
  41. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +30 -0
  42. package/dist/bundling-sources/shared_libs/monitors/provider-resource-failure.ts +26 -3
  43. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +41 -13
  44. package/dist/bundling-sources/shared_libs/monitors/signal-radars/raw-receipt-causes.ts +219 -0
  45. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +21 -10
  46. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +13 -0
  47. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +6 -0
  48. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +13 -0
  49. package/dist/bundling-sources/shared_libs/observability/dlq.ts +1 -1
  50. package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +5 -3
  51. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +10 -1
  52. package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
  53. package/dist/bundling-sources/shared_libs/observability/redaction.ts +24 -1
  54. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +168 -41
  55. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +1 -2
  56. package/dist/bundling-sources/shared_libs/play-data-plane/preview-r2-oidc.ts +188 -0
  57. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +170 -16
  58. package/dist/bundling-sources/shared_libs/play-data-plane/runtime-sheet-storage-contract.ts +5 -0
  59. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +68 -2
  60. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +444 -39
  61. package/dist/bundling-sources/shared_libs/play-runtime/ctx-fetch-caller-deadline.ts +200 -0
  62. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
  63. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +21 -1
  64. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +3 -2
  65. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +70 -2
  66. package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +3 -3
  67. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +16 -0
  68. package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +72 -0
  69. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +1 -0
  70. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +7 -1
  71. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +62 -0
  72. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +74 -3
  73. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +31 -3
  74. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +6 -0
  75. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +8 -0
  76. package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +19 -0
  77. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +39 -2
  78. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +9 -1
  79. package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +33 -0
  80. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +24 -0
  81. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +254 -44
  82. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +87 -6
  83. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +241 -10
  84. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox-egress.ts +161 -14
  85. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +16 -3
  86. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-compression.ts +37 -0
  87. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +9 -0
  88. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +259 -52
  89. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +13 -0
  90. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +30 -0
  91. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +62 -1
  92. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +36 -0
  93. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +36 -0
  94. package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +206 -2
  95. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +42 -0
  96. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +185 -64
  97. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-slot-ledger.ts +157 -0
  98. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +110 -2
  99. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-listener-hint.ts +323 -0
  100. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/executor-attempt-standing.ts +72 -0
  101. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-storage.ts +23 -4
  102. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-workspace-purge.ts +199 -0
  103. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +632 -66
  104. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +517 -16
  105. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +1 -1
  106. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +9 -0
  107. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +599 -2
  108. package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +26 -1
  109. package/dist/bundling-sources/shared_libs/play-runtime/startup-read-tool-ids.ts +60 -0
  110. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +51 -0
  111. package/dist/bundling-sources/shared_libs/play-runtime/tool-call-retry-facts.ts +2 -0
  112. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +113 -3
  113. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +5 -7
  114. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +2 -0
  115. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +3 -0
  116. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +40 -5
  117. package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +3 -0
  118. package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +16 -0
  119. package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +10 -41
  120. package/dist/bundling-sources/shared_libs/plays/extension-bridge.ts +33 -0
  121. package/dist/bundling-sources/shared_libs/plays/row-identity.ts +18 -1
  122. package/dist/bundling-sources/shared_libs/plays/tool-execution-error.ts +108 -0
  123. package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +14 -0
  124. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +171 -0
  125. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +27 -1
  126. package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +9 -24
  127. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +178 -5
  128. package/dist/bundling-sources/shared_libs/security/signup-email-dns-screen.ts +148 -0
  129. package/dist/bundling-sources/shared_libs/tool-execution-error.ts +108 -0
  130. package/dist/cli/{auth-KVSBJZOX.mjs → auth-I3QAU4RV.mjs} +8 -7
  131. package/dist/cli/auth-MQCN7WGZ.js +44 -0
  132. package/dist/cli/{billing-54RHFEBI.mjs → billing-3IC54OQQ.mjs} +197 -61
  133. package/dist/cli/{billing-FQREA7UA.js → billing-YGFFVAIC.js} +297 -161
  134. package/dist/cli/{chunk-4MK42735.js → chunk-2B5B5KAW.js} +210 -128
  135. package/dist/cli/{chunk-UBKA33KY.mjs → chunk-2MGZAI54.mjs} +17 -0
  136. package/dist/cli/{chunk-4NQF6KJ3.js → chunk-3NTP2OSG.js} +13 -13
  137. package/dist/cli/{chunk-HYC4MKGK.mjs → chunk-45OAVGU6.mjs} +5 -5
  138. package/dist/cli/{chunk-WLN3SUIA.js → chunk-4747TPLV.js} +3 -3
  139. package/dist/cli/{chunk-AZQ264ID.mjs → chunk-4BFTDNHU.mjs} +1 -1
  140. package/dist/cli/{chunk-BGBJV26E.mjs → chunk-4HYNMXXF.mjs} +4 -4
  141. package/dist/cli/{chunk-DJ2JDK4O.mjs → chunk-4SMCFQ23.mjs} +1 -1
  142. package/dist/cli/{chunk-QPKH23EC.mjs → chunk-55F6HNOY.mjs} +5 -5
  143. package/dist/cli/{chunk-LX35AXTN.mjs → chunk-5TYLSS4Q.mjs} +6 -6
  144. package/dist/cli/{chunk-634ZDA3F.js → chunk-6NE3RRRY.js} +1 -1
  145. package/dist/cli/{chunk-EITMD3A5.js → chunk-6VLFQZK6.js} +8 -8
  146. package/dist/cli/{chunk-EOPEYCY7.mjs → chunk-72V4PDH5.mjs} +18 -18
  147. package/dist/cli/{chunk-IHRKLXZN.js → chunk-74RES4DS.js} +5 -5
  148. package/dist/cli/{chunk-45PVGZST.js → chunk-7GEMELKI.js} +366 -320
  149. package/dist/cli/{chunk-4UUR4TCH.js → chunk-7O6J6A7P.js} +1871 -92
  150. package/dist/cli/{chunk-XVB7V4N7.js → chunk-7SERLBNR.js} +161 -53
  151. package/dist/cli/{chunk-F2LH7TGF.js → chunk-7YRJ5UC4.js} +21 -21
  152. package/dist/cli/{chunk-YJHE3O5M.mjs → chunk-A7DLBE5K.mjs} +136 -54
  153. package/dist/cli/{chunk-6PRW5UBA.mjs → chunk-AGICYWGN.mjs} +299 -69
  154. package/dist/cli/{chunk-S5S355UY.mjs → chunk-AGIQDA2T.mjs} +12 -12
  155. package/dist/cli/{chunk-RBEUVDZF.js → chunk-AGLR6QVN.js} +249 -107
  156. package/dist/cli/{chunk-NURW5XH4.mjs → chunk-ASB47RXJ.mjs} +1 -1
  157. package/dist/cli/{chunk-RQZQVFCJ.js → chunk-BVDKFS2T.js} +2 -2
  158. package/dist/cli/{chunk-PFO3ISXA.js → chunk-CACFJODG.js} +174 -129
  159. package/dist/cli/{chunk-6RZOWL2V.mjs → chunk-CAEBJOYU.mjs} +1 -1
  160. package/dist/cli/{chunk-XDVT3GOM.js → chunk-CFJFUVX2.js} +18 -1
  161. package/dist/cli/{chunk-6YCA5NKJ.js → chunk-DP2VH7CO.js} +12 -12
  162. package/dist/cli/{chunk-AWJPDPMA.mjs → chunk-DP64MD6U.mjs} +1 -1
  163. package/dist/cli/{chunk-PTVD2GVQ.mjs → chunk-DZA7RFGL.mjs} +5 -5
  164. package/dist/cli/{chunk-V436Z54K.js → chunk-E2G2DNAB.js} +3 -1
  165. package/dist/cli/{chunk-GGGAEVCX.mjs → chunk-E7WZOX2A.mjs} +22 -18
  166. package/dist/cli/{chunk-IDVVIXPJ.js → chunk-FM7LPUPA.js} +41 -41
  167. package/dist/cli/{chunk-AQWQ2BFX.mjs → chunk-GAVZ4EOD.mjs} +1 -1
  168. package/dist/cli/{chunk-GKYAYLRI.js → chunk-HEBO3XNZ.js} +27 -31
  169. package/dist/cli/{chunk-IYSTRCLX.mjs → chunk-HSJ6X2AQ.mjs} +4 -4
  170. package/dist/cli/{chunk-UPMRIVZB.js → chunk-HVI55MTK.js} +61 -10
  171. package/dist/cli/{chunk-KWSH5T7K.js → chunk-IH6GDNKW.js} +21 -21
  172. package/dist/cli/{chunk-HO3XK3R7.js → chunk-IMX7J4DU.js} +8 -8
  173. package/dist/cli/{chunk-EUPVF4SU.mjs → chunk-INEMTYMT.mjs} +8 -8
  174. package/dist/cli/{chunk-3FD5EQ62.js → chunk-IUOGII7D.js} +6 -7
  175. package/dist/cli/{chunk-U7QRMBIY.mjs → chunk-JJGWHITQ.mjs} +5 -5
  176. package/dist/cli/{chunk-SHLFOPD6.js → chunk-JLGP5XAJ.js} +5 -5
  177. package/dist/cli/{chunk-4TALT2M3.mjs → chunk-LFOERUQY.mjs} +69 -3
  178. package/dist/cli/{chunk-BBTKAASQ.js → chunk-LFQJW4S2.js} +42 -1
  179. package/dist/cli/{chunk-Z5TSLLOW.mjs → chunk-LH5PZKER.mjs} +63 -18
  180. package/dist/cli/{chunk-S46HWQKO.js → chunk-LRDHPOZW.js} +69 -69
  181. package/dist/cli/{chunk-6ZORHRKB.mjs → chunk-LRZGS6RZ.mjs} +2 -0
  182. package/dist/cli/{chunk-SL6MYJYM.js → chunk-MJTVX4QK.js} +35 -35
  183. package/dist/cli/{chunk-7IKQKKNX.js → chunk-MLABYI4M.js} +90 -24
  184. package/dist/cli/{chunk-ZIAXDBXX.mjs → chunk-NDNHYONK.mjs} +17 -21
  185. package/dist/cli/{chunk-YLTMXJFC.mjs → chunk-OTV2UUKW.mjs} +158 -16
  186. package/dist/cli/{chunk-G4O75EXF.js → chunk-Q6Z6N3A7.js} +18 -18
  187. package/dist/cli/{chunk-WE5HES3H.mjs → chunk-QG6JIWUL.mjs} +151 -43
  188. package/dist/cli/{chunk-QY3ZNU6Z.mjs → chunk-QI5S5HWB.mjs} +2 -2
  189. package/dist/cli/{chunk-CBV7AKWM.js → chunk-R6DZ6NQ2.js} +5 -5
  190. package/dist/cli/{chunk-57VZVF5D.mjs → chunk-RMNOZKRI.mjs} +3 -3
  191. package/dist/cli/{chunk-BAIST2BR.js → chunk-RTV4RF7N.js} +36 -36
  192. package/dist/cli/{chunk-JWUAX6OP.js → chunk-SBH4CKPN.js} +11 -11
  193. package/dist/cli/{chunk-FTJLJCE5.mjs → chunk-SG3LUONJ.mjs} +3 -3
  194. package/dist/cli/{chunk-2WFPHBR4.js → chunk-TFEXSHPM.js} +22 -18
  195. package/dist/cli/{chunk-QAORXEY3.mjs → chunk-TN4TY6TT.mjs} +6 -7
  196. package/dist/cli/{chunk-WEHCBH5R.mjs → chunk-UEVKMZLR.mjs} +54 -3
  197. package/dist/cli/{chunk-QILKGXYF.mjs → chunk-UVQJYV76.mjs} +2 -2
  198. package/dist/cli/{chunk-FSIVF2SI.mjs → chunk-VZGLIK5U.mjs} +1 -1
  199. package/dist/cli/{chunk-MF2GHZDO.js → chunk-WOCHZCUJ.js} +2 -2
  200. package/dist/cli/{chunk-VQALXEXO.js → chunk-XLIHTJVM.js} +348 -118
  201. package/dist/cli/{chunk-ADRC5I3R.js → chunk-Y6SP3JMI.js} +22 -22
  202. package/dist/cli/{chunk-77AAAGVB.js → chunk-YUA6HA6D.js} +2 -2
  203. package/dist/cli/{chunk-JL2OTMSG.mjs → chunk-Z3A2S3QM.mjs} +41 -0
  204. package/dist/cli/{chunk-6O5HOODW.mjs → chunk-Z6XPSHKM.mjs} +87 -41
  205. package/dist/cli/{chunk-QX7LFGJR.mjs → chunk-Z7AOIHFE.mjs} +1870 -91
  206. package/dist/cli/command-docs.js +3 -3
  207. package/dist/cli/command-docs.mjs +2 -2
  208. package/dist/cli/concurrent-runs-help-CFJH4KXV.js +22 -0
  209. package/dist/cli/{concurrent-runs-help-Q4KPAUJX.mjs → concurrent-runs-help-DNV2X5AZ.mjs} +9 -8
  210. package/dist/cli/{csv-F5VAGX4K.js → csv-SA6ELJY6.js} +16 -15
  211. package/dist/cli/{csv-2PTVDNO6.mjs → csv-ZXZGHWOM.mjs} +7 -6
  212. package/dist/cli/{db-IEDXAUF7.mjs → db-A54SP6AD.mjs} +16 -16
  213. package/dist/cli/{db-Z3OIUFMM.js → db-JHFEIQBU.js} +43 -43
  214. package/dist/cli/describe-PHQ33AGS.mjs +50 -0
  215. package/dist/cli/describe-RHJ4XRFI.js +50 -0
  216. package/dist/cli/describe-core.d.mts +3 -3
  217. package/dist/cli/describe-core.d.ts +3 -3
  218. package/dist/cli/describe-core.js +6 -6
  219. package/dist/cli/describe-core.mjs +5 -5
  220. package/dist/cli/{executions-R3LP74QN.mjs → executions-HL2M2DFU.mjs} +10 -10
  221. package/dist/cli/{executions-H6H5655J.js → executions-TLFZRHBJ.js} +12 -12
  222. package/dist/cli/{feedback-VFOUR66B.js → feedback-5UEX5UZK.js} +17 -16
  223. package/dist/cli/{feedback-WL3MRVT5.mjs → feedback-QMBTNXVG.mjs} +9 -8
  224. package/dist/cli/git-4JWOOHBG.js +26 -0
  225. package/dist/cli/{git-YX2J4GCI.mjs → git-LKGXVIVC.mjs} +8 -7
  226. package/dist/cli/index.js +170 -158
  227. package/dist/cli/index.mjs +60 -48
  228. package/dist/cli/{integrations-E2JZYKHS.js → integrations-6RUTLMN7.js} +23 -27
  229. package/dist/cli/{integrations-5ZK5KLVP.mjs → integrations-FGGRVUJ7.mjs} +15 -19
  230. package/dist/cli/{legacy-noops-3VW4IJTH.js → legacy-noops-J3Z7QRWZ.js} +12 -11
  231. package/dist/cli/{legacy-noops-SMN3GSXY.mjs → legacy-noops-YIPRMVXZ.mjs} +9 -8
  232. package/dist/cli/{mcp-UQV2K4EW.js → mcp-6LWFP7RW.js} +121 -48
  233. package/dist/cli/{mcp-V6MGCYAG.mjs → mcp-CHDYFO7F.mjs} +100 -27
  234. package/dist/cli/{monitors-R3BBDCRC.js → monitors-STM6A7OU.js} +221 -186
  235. package/dist/cli/{monitors-GGKS5W6M.mjs → monitors-UGRY2BXI.mjs} +58 -23
  236. package/dist/cli/org-3SYOUQCX.mjs +2289 -0
  237. package/dist/cli/org-ZOBSNSIB.js +2289 -0
  238. package/dist/cli/outcomes-H4YYAT5X.js +2865 -0
  239. package/dist/cli/outcomes-Z3P2JE67.mjs +2865 -0
  240. package/dist/cli/{play-2MVO27VO.js → play-SM4CW2GS.js} +1116 -846
  241. package/dist/cli/{play-MDWPR4XG.mjs → play-SN5YWLS7.mjs} +375 -105
  242. package/dist/cli/{providers-AKDYFZJZ.mjs → providers-WZ4YBR5Y.mjs} +10 -10
  243. package/dist/cli/{providers-2AACRUZH.js → providers-WZARYMCF.js} +13 -13
  244. package/dist/cli/{quickstart-QDGRJFZY.mjs → quickstart-2575BNKA.mjs} +7 -6
  245. package/dist/cli/{quickstart-H6IV3PV3.js → quickstart-PS4YHQJ6.js} +9 -8
  246. package/dist/cli/{run-2634REDK.js → run-FLZ6OTM7.js} +51 -51
  247. package/dist/cli/{run-RTSQNGRD.mjs → run-ZUHCZOJS.mjs} +31 -31
  248. package/dist/cli/run-identity-LMLFMACS.js +31 -0
  249. package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MAZ7ANH5.mjs} +9 -3
  250. package/dist/cli/{search-6AOJ4XPP.mjs → search-HLPPKQEO.mjs} +11 -11
  251. package/dist/cli/search-JJWVHR3N.js +32 -0
  252. package/dist/cli/{search-output-6ADMTOU5.mjs → search-output-PDAXNOGP.mjs} +9 -8
  253. package/dist/cli/{search-output-S5ODBL5E.js → search-output-RXJLU36B.js} +12 -11
  254. package/dist/cli/{secrets-TFIFBFB3.mjs → secrets-CGELYQ3H.mjs} +11 -11
  255. package/dist/cli/{secrets-LHCIIHMT.js → secrets-QJNG7G2Y.js} +20 -20
  256. package/dist/cli/sessions-DHTBT2GN.js +23 -0
  257. package/dist/cli/{sessions-WHBVUHVW.mjs → sessions-ELMWVR4M.mjs} +9 -8
  258. package/dist/cli/{settings-CP4FVK2W.js → settings-44I44P5F.js} +89 -89
  259. package/dist/cli/{settings-EBONWL5C.mjs → settings-RR3LZXL7.mjs} +16 -16
  260. package/dist/cli/{setup-I5AZE3IU.mjs → setup-KGWRWH4B.mjs} +20 -19
  261. package/dist/cli/{setup-LFGHTNLQ.js → setup-KTEYOCJO.js} +60 -59
  262. package/dist/cli/skills-EPZPEXI2.js +37 -0
  263. package/dist/cli/{skills-W76AO5XE.mjs → skills-FPRID2I5.mjs} +10 -9
  264. package/dist/cli/tools-IGQQ5TML.js +57 -0
  265. package/dist/cli/{tools-7IJHGF6W.mjs → tools-PI4WMDLY.mjs} +23 -23
  266. package/dist/cli/update-4RNCVYGE.js +37 -0
  267. package/dist/cli/{update-GFOPZTHY.mjs → update-VJOJAZ7B.mjs} +14 -11
  268. package/dist/cli/{views-BPL2TQJ4.js → views-NTUOLNQU.js} +62 -64
  269. package/dist/cli/{views-D4NX4SBG.mjs → views-OVPSINZO.mjs} +47 -49
  270. package/dist/cli/{workflow-ZYNAUCKC.js → workflow-2UDYDM6F.js} +23 -23
  271. package/dist/cli/{workflow-YXP42FUI.mjs → workflow-7OEFNXZC.mjs} +13 -13
  272. package/dist/{client-CyXGrO4D.d.mts → client-B8f7RNF8.d.mts} +1 -1
  273. package/dist/{client-Bf3IpUKN.d.ts → client-C5TgXmJQ.d.ts} +1 -1
  274. package/dist/{client-core-BxsLnXlm.d.mts → client-core-SLLGBTht.d.mts} +268 -23
  275. package/dist/{client-core-BWd0lX0Z.d.ts → client-core-p0sOxnkl.d.ts} +268 -23
  276. package/dist/{compiler-manifest-BqwVrOri.d.ts → compiler-manifest-D_zZEh9Q.d.mts} +70 -5
  277. package/dist/{compiler-manifest-BqwVrOri.d.mts → compiler-manifest-D_zZEh9Q.d.ts} +70 -5
  278. package/dist/{errors-BU8FB99X.d.mts → errors-CZCrBFrQ.d.mts} +1 -1
  279. package/dist/{errors-DfVN_FUG.d.ts → errors-DsUkLrdZ.d.ts} +1 -1
  280. package/dist/{index-BGnvtYGc.d.ts → index-B6RTOZGC.d.ts} +1 -1
  281. package/dist/{index-DjZgwpGw.d.mts → index-DeOVrEmX.d.mts} +1 -1
  282. package/dist/index.d.mts +7 -7
  283. package/dist/index.d.ts +7 -7
  284. package/dist/index.js +66 -55
  285. package/dist/index.mjs +25 -14
  286. package/dist/install-integrity.json +161 -142
  287. package/dist/plays/bundle-play-file.d.mts +3 -3
  288. package/dist/plays/bundle-play-file.d.ts +3 -3
  289. package/dist/plays/bundle-play-file.mjs +23 -4
  290. package/dist/plays/csv-data-input.js +3 -3
  291. package/dist/plays/csv-data-input.mjs +2 -2
  292. package/dist/plays/play-description.d.mts +2 -2
  293. package/dist/plays/play-description.d.ts +2 -2
  294. package/dist/plays/run-request.d.mts +2 -2
  295. package/dist/plays/run-request.d.ts +2 -2
  296. package/dist/plays/run-request.js +4 -4
  297. package/dist/plays/run-request.mjs +3 -3
  298. package/dist/release.d.mts +1 -1
  299. package/dist/release.d.ts +1 -1
  300. package/dist/release.js +2 -2
  301. package/dist/release.mjs +1 -1
  302. package/dist/server.d.mts +4 -4
  303. package/dist/server.d.ts +4 -4
  304. package/dist/server.js +15 -13
  305. package/dist/server.mjs +9 -7
  306. package/package.json +1 -1
  307. package/dist/cli/auth-MMNVWATX.js +0 -43
  308. package/dist/cli/concurrent-runs-help-FQAIHKKC.js +0 -21
  309. package/dist/cli/describe-QDANCTS3.mjs +0 -50
  310. package/dist/cli/describe-VUTT5ZKU.js +0 -50
  311. package/dist/cli/git-ETB3GH3K.js +0 -25
  312. package/dist/cli/org-GRYVMNSW.js +0 -1282
  313. package/dist/cli/org-Z37NGJV4.mjs +0 -1282
  314. package/dist/cli/run-identity-G257GQED.js +0 -25
  315. package/dist/cli/search-VTW2YNBS.js +0 -32
  316. package/dist/cli/sessions-CJ4FJ2WB.js +0 -22
  317. package/dist/cli/skills-R7EBXREW.js +0 -36
  318. package/dist/cli/tools-V7U2BDXM.js +0 -57
  319. package/dist/cli/update-4COPZETK.js +0 -34
@@ -1,1282 +0,0 @@
1
- import {
2
- DeeplineClient
3
- } from "./chunk-QY3ZNU6Z.mjs";
4
- import "./chunk-Z5TSLLOW.mjs";
5
- import "./chunk-FZHMNK6F.mjs";
6
- import "./chunk-LX35AXTN.mjs";
7
- import "./chunk-PSX3WHIH.mjs";
8
- import "./chunk-UBKA33KY.mjs";
9
- import {
10
- printCommandEnvelope
11
- } from "./chunk-6PRW5UBA.mjs";
12
- import {
13
- ACTIVE_ORG_ID_ENV,
14
- ACTIVE_ORG_NAME_ENV,
15
- API_KEY_ENV,
16
- FEATURES_ENV,
17
- HOST_URL_ENV,
18
- HttpClient,
19
- featureEnvValues,
20
- getActiveProjectAuthSource,
21
- getResolvedProjectAuthSource,
22
- hostEnvFilePath,
23
- resolveCliAuthProvenance,
24
- resolveCliCommandContext,
25
- resolveConfig,
26
- resolveProjectPinTarget,
27
- saveHostEnvValues,
28
- saveProjectDeeplineEnvValues,
29
- sdkCliStateDirPath,
30
- storedHostFeatures
31
- } from "./chunk-4TALT2M3.mjs";
32
- import {
33
- detectAgentRuntime
34
- } from "./chunk-YLTMXJFC.mjs";
35
- import "./chunk-NURW5XH4.mjs";
36
- import "./chunk-DLIRSHV6.mjs";
37
- import "./chunk-JL2OTMSG.mjs";
38
- import "./chunk-AQWQ2BFX.mjs";
39
- import "./chunk-WZYKRD7T.mjs";
40
- import "./chunk-KRD6H754.mjs";
41
-
42
- // src/cli/commands/org.ts
43
- import { createHash, randomUUID } from "crypto";
44
- import {
45
- existsSync,
46
- mkdirSync,
47
- readFileSync,
48
- unlinkSync,
49
- writeFileSync
50
- } from "fs";
51
- import { join } from "path";
52
- function pendingOrgCreatePath(baseUrl, accountId, sourceOrgId, name) {
53
- const intent = createHash("sha256").update(accountId).update("\0").update(sourceOrgId).update("\0").update(name).digest("hex");
54
- return join(sdkCliStateDirPath(baseUrl), `pending-org-create-${intent}.json`);
55
- }
56
- function readPendingOrgCreate(path, accountId, sourceOrgId, name) {
57
- let value;
58
- try {
59
- value = JSON.parse(readFileSync(path, "utf8"));
60
- } catch (error) {
61
- throw new Error(
62
- `Cannot resume the pending workspace creation recorded at ${path}: ${error instanceof Error ? error.message : String(error)}`
63
- );
64
- }
65
- if (typeof value !== "object" || value === null || value.accountId !== accountId || value.sourceOrgId !== sourceOrgId || value.name !== name || typeof value.idempotencyKey !== "string" || !value.idempotencyKey.trim()) {
66
- throw new Error(
67
- `Cannot resume the pending workspace creation recorded at ${path}: the saved intent is invalid.`
68
- );
69
- }
70
- return value;
71
- }
72
- function loadOrCreatePendingOrgCreate(input) {
73
- const stateDir = sdkCliStateDirPath(input.baseUrl);
74
- const path = pendingOrgCreatePath(
75
- input.baseUrl,
76
- input.accountId,
77
- input.sourceOrgId,
78
- input.name
79
- );
80
- mkdirSync(stateDir, { recursive: true });
81
- if (existsSync(path)) {
82
- return {
83
- ...readPendingOrgCreate(
84
- path,
85
- input.accountId,
86
- input.sourceOrgId,
87
- input.name
88
- ),
89
- path
90
- };
91
- }
92
- const pending = {
93
- accountId: input.accountId,
94
- sourceOrgId: input.sourceOrgId,
95
- name: input.name,
96
- idempotencyKey: randomUUID()
97
- };
98
- try {
99
- writeFileSync(path, `${JSON.stringify(pending)}
100
- `, {
101
- encoding: "utf8",
102
- flag: "wx",
103
- mode: 384
104
- });
105
- return { ...pending, path };
106
- } catch (error) {
107
- if (error.code !== "EEXIST") throw error;
108
- return {
109
- ...readPendingOrgCreate(
110
- path,
111
- input.accountId,
112
- input.sourceOrgId,
113
- input.name
114
- ),
115
- path
116
- };
117
- }
118
- }
119
- async function fetchWorkspaceCreationIdentity(http, apiKey) {
120
- const status = await http.post("/api/v2/auth/cli/status", { api_key: apiKey });
121
- const accountId = status.user_id?.trim();
122
- if (!accountId) {
123
- throw new Error(
124
- "Workspace creation requires an API key linked to a user account."
125
- );
126
- }
127
- return { accountId, orgId: status.org_id?.trim() || null };
128
- }
129
- async function fetchOrganizations(http, apiKey) {
130
- return http.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
131
- }
132
- function normalizeAuthScope(value) {
133
- if (!value) return "auto";
134
- if (value === "auto" || value === "folder" || value === "global") {
135
- return value;
136
- }
137
- throw new Error(
138
- `Invalid --auth-scope "${value}". Expected one of: auto, folder, global.`
139
- );
140
- }
141
- function orgListLines(orgs) {
142
- return orgs.map((org, index) => {
143
- const current = org.is_current ? " (current)" : "";
144
- const role = org.role ? ` [${org.role}]` : "";
145
- return `${index + 1}. ${org.name}${role}${current}`;
146
- });
147
- }
148
- function redactApiKey(value) {
149
- if (!value) return null;
150
- if (value.length <= 10) return `${value.slice(0, 3)}...`;
151
- return `${value.slice(0, 8)}...${value.slice(-4)}`;
152
- }
153
- function processEnvValue(name) {
154
- return process.env[name]?.trim() ?? "";
155
- }
156
- function organizationAuthValues(input) {
157
- return {
158
- [HOST_URL_ENV]: input.baseUrl,
159
- [API_KEY_ENV]: input.apiKey,
160
- [ACTIVE_ORG_ID_ENV]: input.orgId,
161
- [ACTIVE_ORG_NAME_ENV]: input.orgName,
162
- ...featureEnvValues(input)
163
- };
164
- }
165
- function organizationCommandContext(input) {
166
- return {
167
- active_organization: {
168
- org_id: input.orgId,
169
- org_name: input.orgName
170
- },
171
- auth_scope: input.authScope,
172
- metadata_source: input.authScope === "folder" ? "folder_env" : "host_env"
173
- };
174
- }
175
- function agentCommandContext(commandContext) {
176
- return detectAgentRuntime() !== "unknown" ? { command_context: commandContext } : {};
177
- }
178
- function resolveOrgSwitchAuthTarget(scope, config) {
179
- const activeProject = getResolvedProjectAuthSource(
180
- config.baseUrl,
181
- config.apiKey
182
- );
183
- const folderTarget = resolveProjectPinTarget();
184
- const globalOverrideWarning = activeProject && scope === "global" ? [
185
- `Folder auth in ${activeProject.filePath} overrides global auth for commands run here.`
186
- ] : [];
187
- if (scope === "folder") {
188
- if (!folderTarget.ok) {
189
- throw new Error(
190
- `Cowork project folder is ambiguous. Candidate folders: ${folderTarget.candidates.join(
191
- ", "
192
- )}. Set CLAUDE_PROJECT_DIR or cd into the intended project folder before running this command.`
193
- );
194
- }
195
- return {
196
- kind: "folder",
197
- requested_scope: scope,
198
- effective_scope: "folder",
199
- reason: "explicit_folder",
200
- source: folderTarget.source,
201
- warnings: []
202
- };
203
- }
204
- if (scope === "global") {
205
- return {
206
- kind: "global",
207
- requested_scope: scope,
208
- effective_scope: "global",
209
- reason: "explicit_global",
210
- warnings: globalOverrideWarning
211
- };
212
- }
213
- if (activeProject) {
214
- return {
215
- kind: "folder",
216
- requested_scope: scope,
217
- effective_scope: "folder",
218
- reason: "existing_folder_auth",
219
- source: activeProject.source,
220
- warnings: []
221
- };
222
- }
223
- if (folderTarget.ok && folderTarget.source === "cowork") {
224
- return {
225
- kind: "folder",
226
- requested_scope: scope,
227
- effective_scope: "folder",
228
- reason: "detected_cowork_project",
229
- source: "cowork",
230
- warnings: []
231
- };
232
- }
233
- if (!folderTarget.ok) {
234
- return {
235
- kind: "global",
236
- requested_scope: scope,
237
- effective_scope: "global",
238
- reason: "ambiguous_cowork_fell_back_global",
239
- warnings: [
240
- `Cowork project folder is ambiguous, so global auth was updated. Candidate folders: ${folderTarget.candidates.join(
241
- ", "
242
- )}. Set CLAUDE_PROJECT_DIR or cd into the intended project folder to update folder auth.`
243
- ]
244
- };
245
- }
246
- return {
247
- kind: "global",
248
- requested_scope: scope,
249
- effective_scope: "global",
250
- reason: "default_global",
251
- warnings: []
252
- };
253
- }
254
- async function handleOrgList(options) {
255
- const config = resolveConfig();
256
- const http = new HttpClient(config);
257
- const payload = await fetchOrganizations(http, config.apiKey);
258
- printCommandEnvelope(
259
- {
260
- ...payload,
261
- render: {
262
- sections: [
263
- {
264
- title: "Your organizations:",
265
- lines: orgListLines(payload.organizations)
266
- }
267
- ]
268
- }
269
- },
270
- { json: options.json }
271
- );
272
- }
273
- async function handleOrgStatus(options) {
274
- const config = resolveConfig();
275
- const http = new HttpClient(config);
276
- const payload = await fetchOrganizations(http, config.apiKey);
277
- const current = payload.organizations.find((org) => org.is_current) ?? payload.organizations.find(
278
- (org) => org.org_id === payload.current_org_id
279
- ) ?? null;
280
- const projectCandidate = getActiveProjectAuthSource();
281
- const activeProject = getResolvedProjectAuthSource(
282
- config.baseUrl,
283
- config.apiKey
284
- );
285
- const folderTarget = resolveProjectPinTarget();
286
- const provenance = resolveCliAuthProvenance(config);
287
- const hostPath = hostEnvFilePath(config.baseUrl);
288
- const envApiKey = processEnvValue(API_KEY_ENV);
289
- const envHostUrl = processEnvValue(HOST_URL_ENV);
290
- const authSource = envApiKey ? {
291
- scope: "env",
292
- source: "process",
293
- path: null,
294
- api_key: redactApiKey(envApiKey),
295
- host: envHostUrl || null,
296
- overrides_global: true,
297
- overrides_folder: Boolean(projectCandidate)
298
- } : activeProject ? {
299
- scope: "folder",
300
- source: activeProject.source,
301
- path: activeProject.filePath,
302
- api_key: redactApiKey(activeProject.env.DEEPLINE_API_KEY),
303
- overrides_global: true
304
- } : {
305
- scope: "global",
306
- source: "host",
307
- path: hostPath,
308
- api_key: redactApiKey(config.apiKey),
309
- overrides_global: false
310
- };
311
- const folderTargetPayload = folderTarget.ok ? {
312
- ok: true,
313
- source: folderTarget.source,
314
- dir: folderTarget.dir,
315
- env_path: `${folderTarget.dir}/.env.deepline`
316
- } : {
317
- ok: false,
318
- reason: folderTarget.reason,
319
- candidates: folderTarget.candidates
320
- };
321
- const lines = [
322
- `Organization: ${current?.name ?? "(unknown)"}`,
323
- `Organization ID: ${payload.current_org_id ?? "(unknown)"}`,
324
- `Host: ${config.baseUrl}`,
325
- `Auth scope: ${authSource.scope}`
326
- ];
327
- if (authSource.path) {
328
- lines.push(`Auth file: ${authSource.path}`);
329
- } else {
330
- lines.push(`Auth source: ${API_KEY_ENV} process environment`);
331
- }
332
- if (envApiKey) {
333
- lines.push(`${API_KEY_ENV} overrides saved auth for this process.`);
334
- } else if (activeProject) {
335
- lines.push("Global auth is overridden in this folder.");
336
- } else if (provenance.scope === "global" && provenance.project.state === "project") {
337
- lines.push("Cloud mutations are blocked until this project is pinned.");
338
- lines.push("Pin it: deepline org set --auth-scope folder");
339
- }
340
- printCommandEnvelope(
341
- {
342
- ok: true,
343
- host: config.baseUrl,
344
- organization: current,
345
- current_org_id: payload.current_org_id,
346
- auth_source: authSource,
347
- host_env_path: hostPath,
348
- folder_target: folderTargetPayload,
349
- project_pin: provenance.scope === "global" && provenance.project.state === "project" ? {
350
- available: true,
351
- required: false,
352
- path: provenance.project.pinPath,
353
- cloud_mutations_blocked: false,
354
- command: "deepline org set --auth-scope folder"
355
- } : {
356
- available: false,
357
- required: false,
358
- cloud_mutations_blocked: false
359
- },
360
- next: {
361
- set_auto: "deepline org set <org>",
362
- set_folder: "deepline org set <org> --auth-scope folder",
363
- set_global: "deepline org set <org> --auth-scope global"
364
- },
365
- render: {
366
- sections: [{ title: "org status", lines }]
367
- }
368
- },
369
- { json: options.json }
370
- );
371
- }
372
- async function handleOrgSwitch(selection, options) {
373
- const authScope = normalizeAuthScope(options.authScope);
374
- const config = resolveConfig();
375
- const provenance = resolveCliAuthProvenance(config);
376
- if (!selection && !options.orgId && authScope === "folder" && provenance.scope === "global" && provenance.project.state === "project") {
377
- const commandContext = resolveCliCommandContext(config);
378
- const activeOrganization = commandContext.active_organization;
379
- const pinnedFeatures = storedHostFeatures(config.baseUrl);
380
- const project_env_paths2 = saveProjectDeeplineEnvValues(
381
- {
382
- [HOST_URL_ENV]: config.baseUrl,
383
- [API_KEY_ENV]: config.apiKey,
384
- ...activeOrganization ? {
385
- [ACTIVE_ORG_ID_ENV]: activeOrganization.org_id,
386
- [ACTIVE_ORG_NAME_ENV]: activeOrganization.org_name ?? ""
387
- } : {},
388
- ...pinnedFeatures !== void 0 ? { [FEATURES_ENV]: pinnedFeatures } : {}
389
- },
390
- provenance.project.dir
391
- );
392
- printCommandEnvelope(
393
- {
394
- ok: true,
395
- unchanged: true,
396
- requested_auth_scope: "folder",
397
- effective_auth_scope: "folder",
398
- auth_scope: "folder",
399
- ...agentCommandContext(
400
- activeOrganization ? organizationCommandContext({
401
- orgId: activeOrganization.org_id,
402
- orgName: activeOrganization.org_name,
403
- authScope: "folder"
404
- }) : resolveCliCommandContext(config, "folder")
405
- ),
406
- project_env_paths: project_env_paths2,
407
- next: { status: "deepline org status" },
408
- render: {
409
- sections: [
410
- {
411
- title: "org set",
412
- lines: [
413
- "\u2713 Pinned this project to the current target.",
414
- `Saved folder auth in ${project_env_paths2[0]}.`,
415
- "Global host auth was not changed."
416
- ]
417
- }
418
- ]
419
- }
420
- },
421
- { json: options.json }
422
- );
423
- return;
424
- }
425
- const http = new HttpClient(config);
426
- const payload = await fetchOrganizations(http, config.apiKey);
427
- if (!selection && !options.orgId) {
428
- printCommandEnvelope(
429
- {
430
- ...payload,
431
- next: { set: "deepline org set <number>" },
432
- deprecated_command: options.deprecatedSwitch ? "org switch" : null,
433
- replacement_command: options.deprecatedSwitch ? "deepline org set" : null,
434
- warnings: options.deprecatedSwitch ? ["org switch is deprecated; use org set."] : [],
435
- render: {
436
- sections: [
437
- {
438
- title: "Your organizations:",
439
- lines: orgListLines(payload.organizations)
440
- }
441
- ],
442
- actions: [{ label: "Run", command: "deepline org set <number>" }]
443
- }
444
- },
445
- { json: options.json }
446
- );
447
- return;
448
- }
449
- let target = payload.organizations.find(
450
- (org) => org.org_id === options.orgId
451
- );
452
- if (!target && selection) {
453
- const index = Number.parseInt(selection, 10);
454
- if (Number.isFinite(index) && index >= 1 && index <= payload.organizations.length) {
455
- target = payload.organizations[index - 1];
456
- } else {
457
- target = payload.organizations.find(
458
- (org) => org.name === selection || org.org_id === selection
459
- );
460
- }
461
- }
462
- if (!target) {
463
- throw new Error("Could not resolve the selected organization.");
464
- }
465
- const authTarget = resolveOrgSwitchAuthTarget(authScope, config);
466
- if (target.is_current) {
467
- let project_env_paths2 = [];
468
- const features = await http.post("/api/v2/auth/cli/status", {
469
- api_key: config.apiKey
470
- }).then((status) => status.features).catch(() => void 0);
471
- const authValues2 = organizationAuthValues({
472
- baseUrl: config.baseUrl,
473
- apiKey: config.apiKey,
474
- orgId: target.org_id,
475
- orgName: target.name,
476
- features
477
- });
478
- if (authTarget.kind === "folder") {
479
- project_env_paths2 = saveProjectDeeplineEnvValues(authValues2);
480
- } else {
481
- saveHostEnvValues(config.baseUrl, authValues2);
482
- }
483
- const renderLines2 = [`Already on ${target.name}.`];
484
- for (const projectPath of project_env_paths2) {
485
- renderLines2.push(`Saved folder auth in ${projectPath}`);
486
- }
487
- if (authTarget.kind === "global") {
488
- renderLines2.push(
489
- `Saved global auth in ${hostEnvFilePath(config.baseUrl)}`
490
- );
491
- }
492
- renderLines2.push(
493
- `Scope: ${authTarget.requested_scope} -> ${authTarget.effective_scope} (${authTarget.reason})`
494
- );
495
- if (options.deprecatedSwitch) {
496
- renderLines2.push("Warning: org switch is deprecated; use org set.");
497
- }
498
- for (const warning of authTarget.warnings) {
499
- renderLines2.push(`Warning: ${warning}`);
500
- }
501
- const warnings2 = [
502
- ...options.deprecatedSwitch ? ["org switch is deprecated; use org set."] : [],
503
- ...authTarget.warnings
504
- ];
505
- printCommandEnvelope(
506
- {
507
- ok: true,
508
- unchanged: true,
509
- organization: target,
510
- requested_auth_scope: authTarget.requested_scope,
511
- effective_auth_scope: authTarget.effective_scope,
512
- auth_scope_reason: authTarget.reason,
513
- auth_scope: authTarget.effective_scope,
514
- ...agentCommandContext(
515
- organizationCommandContext({
516
- orgId: target.org_id,
517
- orgName: target.name,
518
- authScope: authTarget.effective_scope
519
- })
520
- ),
521
- host_env_path: authTarget.kind === "global" ? hostEnvFilePath(config.baseUrl) : null,
522
- project_env_paths: project_env_paths2,
523
- deprecated_command: options.deprecatedSwitch ? "org switch" : null,
524
- replacement_command: options.deprecatedSwitch ? "deepline org set" : null,
525
- warnings: warnings2,
526
- render: {
527
- sections: [{ title: "org set", lines: renderLines2 }]
528
- }
529
- },
530
- { json: options.json }
531
- );
532
- return;
533
- }
534
- const switched = await http.post("/api/v2/auth/cli/switch", {
535
- api_key: config.apiKey,
536
- org_id: target.org_id
537
- });
538
- let project_env_paths = [];
539
- const authValues = organizationAuthValues({
540
- baseUrl: config.baseUrl,
541
- apiKey: switched.api_key,
542
- orgId: switched.org_id,
543
- orgName: switched.org_name,
544
- features: switched.features
545
- });
546
- if (authTarget.kind === "folder") {
547
- project_env_paths = saveProjectDeeplineEnvValues(authValues);
548
- } else {
549
- saveHostEnvValues(config.baseUrl, authValues);
550
- }
551
- const { api_key: _apiKey, ...publicSwitched } = switched;
552
- const renderLines = [`Switched to ${switched.org_name}.`];
553
- if (authTarget.kind === "folder") {
554
- for (const projectPath of project_env_paths) {
555
- renderLines.push(`Saved folder auth in ${projectPath}`);
556
- }
557
- } else {
558
- renderLines.push(`Saved global auth in ${hostEnvFilePath(config.baseUrl)}`);
559
- }
560
- renderLines.push(
561
- `Scope: ${authTarget.requested_scope} -> ${authTarget.effective_scope} (${authTarget.reason})`
562
- );
563
- if (options.deprecatedSwitch) {
564
- renderLines.push("Warning: org switch is deprecated; use org set.");
565
- }
566
- for (const warning of authTarget.warnings) {
567
- renderLines.push(`Warning: ${warning}`);
568
- }
569
- const warnings = [
570
- ...options.deprecatedSwitch ? ["org switch is deprecated; use org set."] : [],
571
- ...authTarget.warnings
572
- ];
573
- printCommandEnvelope(
574
- {
575
- ok: true,
576
- host_env_path: authTarget.kind === "global" ? hostEnvFilePath(config.baseUrl) : null,
577
- project_env_paths,
578
- ...publicSwitched,
579
- api_key_saved: true,
580
- requested_auth_scope: authTarget.requested_scope,
581
- effective_auth_scope: authTarget.effective_scope,
582
- auth_scope_reason: authTarget.reason,
583
- auth_scope: authTarget.effective_scope,
584
- ...agentCommandContext(
585
- organizationCommandContext({
586
- orgId: switched.org_id,
587
- orgName: switched.org_name,
588
- authScope: authTarget.effective_scope
589
- })
590
- ),
591
- deprecated_command: options.deprecatedSwitch ? "org switch" : null,
592
- replacement_command: options.deprecatedSwitch ? "deepline org set" : null,
593
- warnings,
594
- render: {
595
- sections: [
596
- {
597
- title: "org set",
598
- lines: renderLines
599
- }
600
- ]
601
- }
602
- },
603
- { json: options.json }
604
- );
605
- }
606
- async function handleOrgCreate(name, options) {
607
- const config = resolveConfig();
608
- const normalizedName = name.trim();
609
- if (!normalizedName) {
610
- throw new Error("Workspace name is required.");
611
- }
612
- const http = new HttpClient(config);
613
- const identity = await fetchWorkspaceCreationIdentity(http, config.apiKey);
614
- let created;
615
- let workspaceApiKey;
616
- let workspaceFeatures;
617
- let pendingIntentPath = null;
618
- if (!identity.orgId) {
619
- const firstWorkspace = await http.post("/api/v2/auth/cli/org-create", {
620
- api_key: config.apiKey,
621
- name: normalizedName
622
- });
623
- const {
624
- api_key: apiKey,
625
- features,
626
- ...publicFirstWorkspace
627
- } = firstWorkspace;
628
- workspaceApiKey = apiKey;
629
- workspaceFeatures = features;
630
- created = publicFirstWorkspace;
631
- } else {
632
- const pending = loadOrCreatePendingOrgCreate({
633
- baseUrl: config.baseUrl,
634
- accountId: identity.accountId,
635
- sourceOrgId: identity.orgId,
636
- name: normalizedName
637
- });
638
- const workspace = await new DeeplineClient({
639
- apiKey: config.apiKey,
640
- baseUrl: config.baseUrl
641
- }).workspaces.create({
642
- name: normalizedName,
643
- idempotencyKey: pending.idempotencyKey
644
- });
645
- const switched = await http.post("/api/v2/auth/cli/switch", {
646
- api_key: config.apiKey,
647
- org_id: workspace.org_id
648
- });
649
- workspaceApiKey = switched.api_key;
650
- workspaceFeatures = switched.features;
651
- created = { ...workspace };
652
- pendingIntentPath = pending.path;
653
- }
654
- const authValues = organizationAuthValues({
655
- baseUrl: config.baseUrl,
656
- apiKey: workspaceApiKey,
657
- orgId: created.org_id,
658
- orgName: created.org_name,
659
- features: workspaceFeatures
660
- });
661
- saveHostEnvValues(config.baseUrl, authValues);
662
- if (pendingIntentPath) unlinkSync(pendingIntentPath);
663
- printCommandEnvelope(
664
- {
665
- ok: true,
666
- ...created,
667
- initial_credits: typeof created.initial_credits === "number" ? created.initial_credits : 0,
668
- api_key_saved: true,
669
- switched: true,
670
- host_env_path: hostEnvFilePath(config.baseUrl),
671
- ...agentCommandContext(
672
- organizationCommandContext({
673
- orgId: created.org_id,
674
- orgName: created.org_name,
675
- authScope: "global"
676
- })
677
- ),
678
- render: {
679
- sections: [
680
- {
681
- title: "org create",
682
- lines: [
683
- `Created organization: ${created.org_name}.`,
684
- `Switched to ${created.org_name}.`,
685
- `Saved host auth in ${hostEnvFilePath(config.baseUrl)}`
686
- ]
687
- }
688
- ]
689
- }
690
- },
691
- { json: options.json }
692
- );
693
- }
694
- function registerOrgCommands(program) {
695
- const org = program.command("org").description("List, create, and set organizations.").addHelpText(
696
- "after",
697
- `
698
- Notes:
699
- Organizations are workspaces. Auth is stored as an API key scoped to one
700
- organization, so setting an org saves a key for the selected auth scope.
701
-
702
- Auth scopes:
703
- auto Update the folder pin that already controls this command; in
704
- Cowork, write the mounted project folder; otherwise update global
705
- host auth.
706
- folder Write .env.deepline in the current project/Cowork project and make
707
- sure .env.deepline is gitignored. Commands below that folder use
708
- this org; sibling folders can pin different orgs.
709
- global Write ~/.local/deepline/<host>/.env. Commands outside folder pins
710
- use this org. Existing folder pins still override global auth.
711
-
712
- Process env DEEPLINE_API_KEY overrides saved auth for that command only.
713
- For projects, agents, CI, and multiple customer workspaces, prefer folder
714
- scope or a per-command DEEPLINE_API_KEY. Global scope is machine-wide and
715
- can make an unrelated terminal target the last-selected organization.
716
-
717
- Agent loop:
718
- deepline org list
719
- deepline org set <number-or-org-id> --auth-scope folder
720
- deepline org status
721
- deepline auth status
722
-
723
- Examples:
724
- deepline org list
725
- deepline org status
726
- deepline org create Acme
727
- deepline org set 2
728
- deepline org set 2 --auth-scope folder
729
- deepline org set --org-id org_123
730
- cd path/to/project-a && deepline org set Prove --auth-scope folder
731
- cd path/to/project-b && deepline org set Mixmax --auth-scope folder
732
- cd .. && deepline org status
733
- `
734
- );
735
- const members = org.command("members").description("List workspace members and manage their grants.");
736
- members.command("list").description("List one page of memberships and effective grants.").option("--cursor <cursor>", "Continue from the previous page").option("--json", "Output JSON").action(async (options) => {
737
- const result = await new DeeplineClient().workspaces.members(options);
738
- printCommandEnvelope(
739
- {
740
- ...result,
741
- render: {
742
- sections: [
743
- {
744
- title: "Workspace members",
745
- lines: result.members.map(
746
- (member) => `${member.id} user=${member.userId} grants=${member.grants.join(",")}`
747
- )
748
- }
749
- ]
750
- }
751
- },
752
- { json: options.json }
753
- );
754
- });
755
- members.command("set-grants <member-id> <grants...>").description(
756
- "Replace a member\u2019s grants (read, run, admin). Requires admin."
757
- ).option("--json", "Output JSON").action(
758
- async (memberId, grants, options) => {
759
- const result = await new DeeplineClient().workspaces.setMemberGrants(
760
- memberId,
761
- grants
762
- );
763
- printCommandEnvelope(
764
- {
765
- ...result,
766
- render: {
767
- sections: [
768
- {
769
- title: "Workspace grants",
770
- lines: [`${result.memberId}: ${result.role}`]
771
- }
772
- ]
773
- }
774
- },
775
- { json: options.json }
776
- );
777
- }
778
- );
779
- const serviceAccounts = org.command("service-accounts").description(
780
- "Manage service accounts: members that are not people and own API keys."
781
- );
782
- const renderServiceAccount = (account) => `${account.id} ${account.name} role=${account.role ?? "none"} keys=${account.activeKeyCount}`;
783
- serviceAccounts.command("list").description("List service accounts and, for admins, their keys.").option("--json", "Output JSON").action(async (options) => {
784
- const result = await new DeeplineClient().workspaces.serviceAccounts.list();
785
- printCommandEnvelope(
786
- {
787
- ...result,
788
- render: {
789
- sections: [
790
- {
791
- title: "Service accounts",
792
- lines: result.serviceAccounts.flatMap((account) => [
793
- renderServiceAccount(account),
794
- ...(account.keys ?? []).map(
795
- (key) => ` key ${key.id} ${key.keyPrefix}\u2026${key.keyLast4}`
796
- )
797
- ])
798
- }
799
- ]
800
- }
801
- },
802
- { json: options.json }
803
- );
804
- });
805
- serviceAccounts.command("create <name>").description("Create a service account. Requires admin.").requiredOption("--role <role>", "read, run, or member").option("--json", "Output JSON").action(async (name, options) => {
806
- const result = await new DeeplineClient().workspaces.serviceAccounts.create({
807
- name,
808
- role: options.role
809
- });
810
- printCommandEnvelope(
811
- {
812
- ...result,
813
- render: {
814
- sections: [
815
- {
816
- title: "Service account created",
817
- lines: [renderServiceAccount(result.serviceAccount)]
818
- }
819
- ]
820
- },
821
- next: {
822
- createKey: `deepline org service-accounts keys create ${result.serviceAccount.id}`
823
- }
824
- },
825
- { json: options.json }
826
- );
827
- });
828
- serviceAccounts.command("set-role <service-account-id> <role>").description("Change a service account\u2019s role. Requires admin.").option("--json", "Output JSON").action(
829
- async (serviceAccountId, role, options) => {
830
- const result = await new DeeplineClient().workspaces.serviceAccounts.setRole(
831
- serviceAccountId,
832
- role
833
- );
834
- printCommandEnvelope(
835
- {
836
- ...result,
837
- render: {
838
- sections: [
839
- {
840
- title: "Service account role",
841
- lines: [renderServiceAccount(result.serviceAccount)]
842
- }
843
- ]
844
- }
845
- },
846
- { json: options.json }
847
- );
848
- }
849
- );
850
- serviceAccounts.command("delete <service-account-id>").description(
851
- "Delete a service account and revoke its keys. Requires admin."
852
- ).option("--json", "Output JSON").action(async (serviceAccountId, options) => {
853
- const result = await new DeeplineClient().workspaces.serviceAccounts.delete(
854
- serviceAccountId
855
- );
856
- printCommandEnvelope(
857
- {
858
- ...result,
859
- render: {
860
- sections: [
861
- {
862
- title: "Service account deleted",
863
- lines: [`${result.id} revoked keys=${result.revokedKeyCount}`]
864
- }
865
- ]
866
- }
867
- },
868
- { json: options.json }
869
- );
870
- });
871
- const serviceAccountKeys = serviceAccounts.command("keys").description(
872
- "Create, rotate and revoke a service account\u2019s API key. A service account holds one active key."
873
- );
874
- serviceAccountKeys.command("create <service-account-id>").description(
875
- "Create the API key for a service account that has none. Requires admin."
876
- ).option("--json", "Output JSON").action(async (serviceAccountId, options) => {
877
- const result = await new DeeplineClient().workspaces.serviceAccounts.createKey(
878
- serviceAccountId
879
- );
880
- printCommandEnvelope(
881
- {
882
- ...result,
883
- render: {
884
- sections: [
885
- {
886
- title: "Service account key (shown once)",
887
- lines: [result.apiKey, `id ${result.key.id}`]
888
- }
889
- ]
890
- }
891
- },
892
- { json: options.json }
893
- );
894
- });
895
- serviceAccountKeys.command("rotate <service-account-id>").description(
896
- "Replace a service account\u2019s API key: the old key stops working and the new one is shown once. Requires admin."
897
- ).option("--json", "Output JSON").action(async (serviceAccountId, options) => {
898
- const result = await new DeeplineClient().workspaces.serviceAccounts.rotateKey(
899
- serviceAccountId
900
- );
901
- printCommandEnvelope(
902
- {
903
- ...result,
904
- render: {
905
- sections: [
906
- {
907
- title: "Service account key rotated (shown once)",
908
- lines: [
909
- result.apiKey,
910
- `id ${result.key.id}`,
911
- `revoked ${result.revokedKeyIds.join(", ")}`
912
- ]
913
- }
914
- ]
915
- }
916
- },
917
- { json: options.json }
918
- );
919
- });
920
- serviceAccountKeys.command("revoke <service-account-id> <key-id>").description("Revoke a service account API key. Requires admin.").option("--json", "Output JSON").action(
921
- async (serviceAccountId, keyId, options) => {
922
- const result = await new DeeplineClient().workspaces.serviceAccounts.revokeKey(
923
- serviceAccountId,
924
- keyId
925
- );
926
- printCommandEnvelope(
927
- {
928
- ...result,
929
- render: {
930
- sections: [
931
- {
932
- title: "Service account key revoked",
933
- lines: [`${result.keyId} ${result.status}`]
934
- }
935
- ]
936
- }
937
- },
938
- { json: options.json }
939
- );
940
- }
941
- );
942
- const sso = org.command("sso").description("Manage Enterprise workspace SSO.");
943
- const ssoPath = "/api/v2/auth/workspace/sso";
944
- const printSso = (payload, json) => printCommandEnvelope(
945
- {
946
- ...payload,
947
- render: {
948
- sections: [
949
- {
950
- title: "Workspace SSO",
951
- lines: [
952
- `Plan eligible: ${payload.eligible ? "yes" : "no"}`,
953
- `Can manage: ${payload.canManage ? "yes" : "no"}`,
954
- payload.provider ? `${payload.provider.type.toUpperCase()} for ${payload.provider.domain} (${payload.provider.domainVerified ? "verified" : "awaiting DNS verification"})` : "No SSO connection.",
955
- ...payload.provider && !payload.provider.domainVerified ? [
956
- `DNS host: _better-auth-token-${payload.provider.providerId}.${payload.provider.domain}`,
957
- ...payload.verificationToken ? [
958
- `DNS value: _better-auth-token-${payload.provider.providerId}=${payload.verificationToken}`
959
- ] : []
960
- ] : []
961
- ]
962
- }
963
- ]
964
- }
965
- },
966
- { json }
967
- );
968
- const ssoHttp = () => new HttpClient(resolveConfig());
969
- sso.command("status").description("Show this workspace's SSO connection and plan eligibility.").option("--json", "Emit JSON output").action(async (options) => {
970
- printSso(await ssoHttp().get(ssoPath), options.json);
971
- });
972
- sso.command("configure-oidc").requiredOption("--domain <domain>", "Verified email domain").requiredOption("--issuer <url>", "OIDC issuer URL").requiredOption("--client-id <id>", "OIDC client ID").requiredOption(
973
- "--client-secret-file <path>",
974
- "File containing the client secret"
975
- ).option("--json", "Emit JSON output").action(
976
- async (options) => {
977
- const clientSecret = readFileSync(
978
- options.clientSecretFile,
979
- "utf8"
980
- ).trim();
981
- if (!clientSecret) throw new Error("Client secret file is empty.");
982
- printSso(
983
- await ssoHttp().post(ssoPath, {
984
- operation: "create_oidc",
985
- domain: options.domain,
986
- issuer: options.issuer,
987
- client_id: options.clientId,
988
- client_secret: clientSecret
989
- }),
990
- options.json
991
- );
992
- }
993
- );
994
- sso.command("configure-saml").requiredOption("--domain <domain>", "Verified email domain").requiredOption(
995
- "--idp-metadata-file <path>",
996
- "Identity provider metadata XML file"
997
- ).option("--json", "Emit JSON output").action(
998
- async (options) => {
999
- const config = resolveConfig();
1000
- const http = new HttpClient(config);
1001
- const identity = await fetchWorkspaceCreationIdentity(
1002
- http,
1003
- config.apiKey
1004
- );
1005
- if (!identity.orgId) throw new Error("No active workspace.");
1006
- const providerId = `sso-${identity.orgId}`;
1007
- const issuer = new URL(
1008
- `/api/auth/sso/saml2/sp/metadata?providerId=${encodeURIComponent(providerId)}`,
1009
- config.baseUrl
1010
- ).toString();
1011
- printSso(
1012
- await http.post(ssoPath, {
1013
- operation: "create_saml",
1014
- domain: options.domain,
1015
- issuer,
1016
- idp_metadata_xml: readFileSync(options.idpMetadataFile, "utf8")
1017
- }),
1018
- options.json
1019
- );
1020
- }
1021
- );
1022
- for (const [name, operation] of [
1023
- ["request-token", "request_token"],
1024
- ["verify", "verify"],
1025
- ["test", "test"]
1026
- ]) {
1027
- sso.command(name).description(
1028
- name === "verify" ? "Verify the SSO domain TXT record." : name === "test" ? "Validate the saved SSO connection configuration." : "Get or renew the SSO domain verification token."
1029
- ).option("--json", "Emit JSON output").action(async (options) => {
1030
- printSso(
1031
- await ssoHttp().post(ssoPath, { operation }),
1032
- options.json
1033
- );
1034
- });
1035
- }
1036
- sso.command("remove").description("Remove this workspace's SSO connection.").option("--json", "Emit JSON output").action(async (options) => {
1037
- printSso(await ssoHttp().delete(ssoPath), options.json);
1038
- });
1039
- const scim = org.command("scim").description(
1040
- "Manage SCIM user provisioning from your identity provider (Enterprise)."
1041
- ).addHelpText(
1042
- "after",
1043
- `
1044
- Notes:
1045
- SCIM needs Enterprise SSO with a verified email domain. Your identity
1046
- provider uses the base URL and token to add, update, deactivate, and remove
1047
- org members. Deactivating someone removes their org membership and revokes
1048
- their API keys in this org. Only emails on the verified domain are
1049
- provisioned.
1050
-
1051
- create-token and rotate-token print the token once; Deepline keeps only its
1052
- hash. Rotating stops the previous token immediately. Managing SCIM needs the
1053
- owner or admin role.
1054
-
1055
- Examples:
1056
- deepline org scim status
1057
- deepline org scim create-token
1058
- deepline org scim rotate-token --json
1059
- deepline org scim remove
1060
- `
1061
- );
1062
- const scimPath = "/api/v2/auth/workspace/scim";
1063
- const printScim = (payload, json) => printCommandEnvelope(
1064
- {
1065
- ...payload,
1066
- render: {
1067
- sections: [
1068
- {
1069
- title: "SCIM provisioning",
1070
- lines: [
1071
- `Plan eligible: ${payload.eligible ? "yes" : "no"}`,
1072
- `Can manage: ${payload.canManage ? "yes" : "no"}`,
1073
- `SSO domain verified: ${payload.ssoReady ? "yes" : "no"}`,
1074
- payload.connection ? `Connected since ${new Date(payload.connection.createdAt).toISOString()} (token updated ${new Date(payload.connection.updatedAt).toISOString()})` : "No SCIM connection.",
1075
- `Base URL: ${payload.base_url}`,
1076
- ...payload.token ? [
1077
- `Token (shown once): ${payload.token}`,
1078
- "Paste the base URL and token into your identity provider now."
1079
- ] : []
1080
- ]
1081
- }
1082
- ]
1083
- }
1084
- },
1085
- { json }
1086
- );
1087
- const scimHttp = () => new HttpClient(resolveConfig());
1088
- scim.command("status").description("Show this org's SCIM connection and plan eligibility.").option("--json", "Emit JSON output").action(async (options) => {
1089
- printScim(await scimHttp().get(scimPath), options.json);
1090
- });
1091
- for (const [name, operation, description] of [
1092
- [
1093
- "create-token",
1094
- "create_token",
1095
- "Create the SCIM connection and print its token once."
1096
- ],
1097
- [
1098
- "rotate-token",
1099
- "rotate_token",
1100
- "Replace the SCIM token; the previous token stops working."
1101
- ]
1102
- ]) {
1103
- scim.command(name).description(description).option("--json", "Emit JSON output").action(async (options) => {
1104
- printScim(
1105
- await scimHttp().post(scimPath, { operation }),
1106
- options.json
1107
- );
1108
- });
1109
- }
1110
- scim.command("remove").description(
1111
- "Remove this org's SCIM connection. Provisioned members stay in the org."
1112
- ).option("--json", "Emit JSON output").action(async (options) => {
1113
- printScim(await scimHttp().delete(scimPath), options.json);
1114
- });
1115
- org.command("logo [url]").description("Show, set, or remove the current organization's logo.").addHelpText(
1116
- "after",
1117
- `
1118
- Notes:
1119
- With no arguments, shows where the logo comes from. Setting or removing it
1120
- mutates workspace branding and requires the owner role in the current
1121
- organization.
1122
-
1123
- --domain looks up the company's logo from its domain when you run it; the
1124
- resolved image URL is not shown. A URL argument uses that http(s) image
1125
- as-is. --remove clears the logo. The logo appears in the dashboard workspace
1126
- switcher.
1127
-
1128
- Examples:
1129
- deepline org logo
1130
- deepline org logo --domain acme.com
1131
- deepline org logo https://example.com/logo.png
1132
- deepline org logo --remove
1133
- `
1134
- ).option("--domain <domain>", "Use the logo for this company's domain").option("--remove", "Remove the logo").option("--json", "Emit JSON output").action(
1135
- async (url, options) => {
1136
- const chosen = [url, options.domain, options.remove].filter(Boolean);
1137
- if (chosen.length > 1) {
1138
- throw new Error("Pass one of a logo URL, --domain, or --remove.");
1139
- }
1140
- const http = new HttpClient(resolveConfig());
1141
- const path = "/api/v2/auth/workspace/logo";
1142
- const payload = chosen.length === 0 ? await http.get(path) : await http.patch(
1143
- path,
1144
- options.domain ? { domain: options.domain } : { logo: url ?? null }
1145
- );
1146
- printCommandEnvelope(
1147
- {
1148
- ...payload,
1149
- render: {
1150
- sections: [
1151
- {
1152
- title: "Workspace logo",
1153
- lines: [
1154
- payload.source === "domain" ? `From domain: ${payload.domain}` : payload.source === "url" ? `From URL: ${payload.url}` : "No logo."
1155
- ]
1156
- }
1157
- ]
1158
- }
1159
- },
1160
- { json: options.json }
1161
- );
1162
- }
1163
- );
1164
- org.command("list").description("List your organizations.").addHelpText(
1165
- "after",
1166
- `
1167
- Notes:
1168
- Read-only. Marks the active organization when the server returns that metadata.
1169
-
1170
- Examples:
1171
- deepline org list
1172
- deepline org list
1173
- `
1174
- ).option("--json", "Emit JSON output").action(handleOrgList);
1175
- org.command("create <name>").description("Create a new organization and switch this CLI to it.").addHelpText(
1176
- "after",
1177
- `
1178
- Notes:
1179
- Mutates workspace and billing state. The new organization is created for the
1180
- current authenticated user and provisioned on the active PAYG offer before
1181
- this CLI switches to it. Interrupted requests resume automatically.
1182
-
1183
- Examples:
1184
- deepline org create Acme
1185
- deepline org create "Acme Sales"
1186
- `
1187
- ).option("--json", "Emit JSON output").action(handleOrgCreate);
1188
- org.command("status").description("Show the current organization and auth source.").addHelpText(
1189
- "after",
1190
- `
1191
- Notes:
1192
- Read-only. Shows the current org plus auth_source.scope, auth_source.path,
1193
- folder_target, host_env_path, and next commands.
1194
-
1195
- Scopes are env, folder, or global. env means DEEPLINE_API_KEY/
1196
- DEEPLINE_HOST_URL in process env wins. folder means nearest/Cowork
1197
- .env.deepline wins. global means host config wins.
1198
-
1199
- Run before and after org set to verify what future commands will use.
1200
-
1201
- Examples:
1202
- deepline org status
1203
- deepline org status
1204
- `
1205
- ).option("--json", "Emit JSON output").action(handleOrgStatus);
1206
- const addOrgSetOptions = (command) => command.option("--org-id <id>", "Set using an explicit organization id").option(
1207
- "--auth-scope <scope>",
1208
- "Where to save auth: auto, folder, or global",
1209
- "auto"
1210
- ).option("--json", "Emit JSON output");
1211
- addOrgSetOptions(
1212
- org.command("set [selection]").description("Set the organization for the selected auth scope.").addHelpText(
1213
- "after",
1214
- `
1215
- Notes:
1216
- Selection can be a list number, exact organization name, or organization id.
1217
- Without a selection, prints choices. With --auth-scope folder while this
1218
- project is using global host auth, it pins the current target directly
1219
- without an additional organization lookup.
1220
-
1221
- Mutates local auth state and asks Deepline for an org-scoped API key. It
1222
- writes only the selected scope:
1223
- auto Update the folder pin that already controls this command; in
1224
- Cowork, write the mounted project folder; otherwise update global
1225
- host auth.
1226
- folder Write .env.deepline in the current project/Cowork project and make
1227
- sure .env.deepline is gitignored.
1228
- global Write ~/.local/deepline/<host>/.env.
1229
-
1230
- Folder auth shadows global auth. If you set --auth-scope global from a pinned
1231
- folder, commands in that folder still use the folder pin until it is changed
1232
- or removed.
1233
-
1234
- Prefer --auth-scope folder for a repository or customer workspace. Use
1235
- --auth-scope global only for deliberate host-wide interactive defaults; it
1236
- is shared by every unpinned CLI on this machine. Global auth remains
1237
- supported in projects; use a folder pin when you want a project-specific
1238
- default. For automation, pass
1239
- DEEPLINE_API_KEY only to that invocation and confirm with org status.
1240
-
1241
- Use --json for stable fields including effective_auth_scope,
1242
- auth_scope_reason, host_env_path, project_env_paths, warnings, org_id, and
1243
- org_name.
1244
-
1245
- Examples:
1246
- deepline org set
1247
- deepline org set 2
1248
- deepline org set 2 --auth-scope folder
1249
- deepline org set 2 --auth-scope global
1250
- deepline org set --org-id org_123
1251
- deepline org status
1252
- `
1253
- )
1254
- ).action(handleOrgSwitch);
1255
- addOrgSetOptions(
1256
- org.command("switch [selection]", { hidden: true }).description(
1257
- "Deprecated alias for org set. Set the organization for the selected auth scope."
1258
- ).addHelpText(
1259
- "after",
1260
- `
1261
- Notes:
1262
- Deprecated alias. Use deepline org set instead. The command still mutates
1263
- local auth state with the same --auth-scope behavior as org set.
1264
-
1265
- Run deepline org set --help for scope definitions and the agent verification
1266
- loop.
1267
-
1268
- Examples:
1269
- deepline org switch
1270
- deepline org switch 2
1271
- deepline org switch 2 --auth-scope folder
1272
- deepline org switch 2 --auth-scope global
1273
- deepline org switch --org-id org_123
1274
- `
1275
- )
1276
- ).action(
1277
- (selection, options) => handleOrgSwitch(selection, { ...options, deprecatedSwitch: true })
1278
- );
1279
- }
1280
- export {
1281
- registerOrgCommands
1282
- };