deepline 0.3.460 → 0.3.462
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/client-core.ts +7593 -0
- package/dist/bundling-sources/sdk/src/client.ts +8 -7366
- package/dist/bundling-sources/sdk/src/http-core.ts +1239 -0
- package/dist/bundling-sources/sdk/src/http.ts +6 -1231
- package/dist/bundling-sources/sdk/src/index.ts +4 -1
- package/dist/bundling-sources/sdk/src/play.ts +5 -5
- package/dist/bundling-sources/sdk/src/plays/client-core.ts +437 -0
- package/dist/bundling-sources/sdk/src/plays/client.ts +4 -421
- package/dist/bundling-sources/sdk/src/plays/input-example.ts +3 -4
- package/dist/bundling-sources/sdk/src/plays/play-description.ts +1 -1
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -1
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/server.ts +43 -0
- package/dist/bundling-sources/sdk/src/types.ts +15 -5
- package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +15 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +28 -0
- package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +0 -307
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +3 -0
- package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +3 -2
- package/dist/bundling-sources/shared_libs/monitors/package.json +2 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +34 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +59 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +94 -1
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +35 -1
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-failure-codes.ts +24 -0
- package/dist/bundling-sources/shared_libs/observability/dlq.ts +32 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +57 -3
- package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +66 -1
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +36 -7
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +250 -11
- package/dist/bundling-sources/shared_libs/play-runtime/array-input-store.ts +319 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +991 -359
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +110 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +155 -6
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +110 -6
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +127 -13
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +14 -1
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +57 -1
- package/dist/bundling-sources/shared_libs/play-runtime/free-company-lookup-batching.ts +218 -0
- package/dist/bundling-sources/shared_libs/play-runtime/gateway-postgres-admission.ts +42 -5
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-budget-state-backend.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +92 -31
- package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +69 -14
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +93 -23
- package/dist/bundling-sources/shared_libs/play-runtime/governor/in-memory-rate-state-backend.ts +15 -4
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +22 -18
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +190 -14
- package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +131 -0
- package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +77 -2
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +271 -2
- package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +51 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +27 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-text-for-log.ts +63 -0
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts +112 -16
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +104 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +265 -151
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-gateway-transport.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +35 -14
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-labels.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +136 -70
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +237 -36
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +148 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +285 -32
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +251 -56
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +29 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/sandbox-create-outcome.ts +27 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +22 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +1397 -382
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-array-input-receipts.ts +920 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +38 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-flow.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +26 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +30 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +14 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +31 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +20 -7
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +1496 -320
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +31 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1389 -129
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +162 -23
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +499 -115
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +377 -9
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +117 -8
- package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +25 -0
- package/dist/bundling-sources/shared_libs/play-runtime/terminal-runtime-performance.ts +391 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +40 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/mapped-calls.ts +171 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/receipt-cohort.ts +16 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +26 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +16 -2
- package/dist/bundling-sources/shared_libs/play-runtime/transport-error-diagnostics.ts +28 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +55 -5
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +41 -1
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +4 -0
- package/dist/bundling-sources/shared_libs/plays/dataset.ts +9 -3
- package/dist/bundling-sources/shared_libs/plays/deploy/manifest-contract.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +3 -2
- package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +2 -2
- package/dist/bundling-sources/shared_libs/plays/run-output-summary.ts +66 -0
- package/dist/bundling-sources/shared_libs/plays/script-entry.ts +1 -1
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +43 -1
- package/dist/bundling-sources/shared_libs/product-notifications/content.ts +9 -0
- package/dist/bundling-sources/shared_libs/product-notifications/email.ts +91 -13
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +3 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +41 -24
- package/dist/bundling-sources/shared_libs/security/attested-client-ip.ts +91 -0
- package/dist/bundling-sources/shared_libs/security/internal-actor.ts +0 -11
- package/dist/cli/{auth-HKA6ZVHQ.mjs → auth-JDLEY7VU.mjs} +5 -4
- package/dist/cli/auth-UXKY6TCC.js +41 -0
- package/dist/cli/{billing-MTO2ZZ3G.js → billing-HXAXB3XZ.js} +152 -78
- package/dist/cli/{billing-26G44S5N.mjs → billing-SDHLBLMV.mjs} +84 -10
- package/dist/cli/{chunk-BHGII2D6.js → chunk-3ACMRZRV.js} +8 -6
- package/dist/cli/{chunk-S4Q2XCGM.mjs → chunk-3KZCFOZ6.mjs} +1 -1
- package/dist/cli/chunk-4KQ6SIBC.mjs +1038 -0
- package/dist/cli/{chunk-Z2GUFYT6.js → chunk-5LEAXRHV.js} +11 -11
- package/dist/cli/{chunk-XAYO3Q2X.mjs → chunk-6NNVJDVR.mjs} +7 -5
- package/dist/cli/{chunk-NMJ4D2WO.js → chunk-6PMCRYDA.js} +216 -91
- package/dist/cli/{chunk-OMM54B3X.mjs → chunk-6RNQGWFD.mjs} +16 -806
- package/dist/cli/{chunk-EBU7LQ64.js → chunk-6V7KVRR5.js} +3 -3
- package/dist/cli/{chunk-RDPTDDKX.js → chunk-7LFIMWMW.js} +2 -2
- package/dist/cli/chunk-7MJ6VI2T.mjs +19 -0
- package/dist/cli/chunk-7SWNPNML.js +1039 -0
- package/dist/cli/{chunk-CTRPCARW.mjs → chunk-7U3XNPOA.mjs} +267 -38
- package/dist/cli/{chunk-RBTTUYZZ.js → chunk-7VZHXVOQ.js} +1 -1
- package/dist/cli/{chunk-YVBWO647.mjs → chunk-AT636LLU.mjs} +2 -2
- package/dist/cli/{chunk-VTODQWQA.js → chunk-BGTPIMSM.js} +392 -261
- package/dist/cli/{chunk-KADIT5NV.mjs → chunk-CKSOY47X.mjs} +2 -2
- package/dist/cli/{chunk-7DH2FD7Y.mjs → chunk-D464JW3N.mjs} +5 -85
- package/dist/cli/chunk-D6DXOUTO.mjs +827 -0
- package/dist/cli/{describe-QW54QQNB.js → chunk-EM4TXCCI.js} +27 -44
- package/dist/cli/chunk-F6QV42MC.mjs +91 -0
- package/dist/cli/chunk-FKVYR3QA.mjs +1039 -0
- package/dist/cli/{chunk-LMAULZLF.js → chunk-GEGW5HPZ.js} +29 -27
- package/dist/cli/{chunk-M52JQSLK.js → chunk-HUB3CCM2.js} +13 -4
- package/dist/cli/{chunk-YHTQM5XI.js → chunk-I6VHOU5O.js} +27 -27
- package/dist/cli/{chunk-Z2XUZC34.js → chunk-IAYSWZDJ.js} +188 -76
- package/dist/cli/chunk-JF3TLIMQ.js +19 -0
- package/dist/cli/{chunk-HDFRJ4IT.mjs → chunk-JVHOS3K3.mjs} +177 -65
- package/dist/cli/{chunk-LAWEURCT.mjs → chunk-LFXLQEZN.mjs} +1 -1
- package/dist/cli/{chunk-2PBN4SZE.js → chunk-LROWFPGN.js} +16 -16
- package/dist/cli/{chunk-SLEUWLJE.mjs → chunk-MSY22NQW.mjs} +5 -5
- package/dist/cli/{chunk-LVJOFUU7.mjs → chunk-MUUQZIOF.mjs} +23 -49
- package/dist/cli/{chunk-2XHWOQF4.js → chunk-NBLSCHKK.js} +52 -50
- package/dist/cli/{chunk-526R2HON.mjs → chunk-NHRWZPWZ.mjs} +4 -2
- package/dist/cli/{chunk-KXMNM4AQ.js → chunk-NMU3VR5U.js} +4 -5
- package/dist/cli/{chunk-W3BE3CHK.mjs → chunk-O2RX5A66.mjs} +14 -12
- package/dist/cli/{chunk-UKFZT7RF.js → chunk-OMQ23IXL.js} +2 -2
- package/dist/cli/{chunk-LJTFZOHU.js → chunk-OPJAJBD4.js} +28 -54
- package/dist/cli/{chunk-MLFR6DVF.mjs → chunk-PHSEINNH.mjs} +5 -5
- package/dist/cli/{chunk-3DNKFH2G.mjs → chunk-PKHVSIJG.mjs} +19 -1
- package/dist/cli/{chunk-WIYWSYDS.mjs → chunk-Q2EIZKVX.mjs} +3 -3
- package/dist/cli/{chunk-VJAEA4CS.js → chunk-QJZ6WNWD.js} +8 -8
- package/dist/cli/{chunk-EIMG75BT.mjs → chunk-S3A4IXBQ.mjs} +4 -5
- package/dist/cli/{chunk-RZSTT45F.mjs → chunk-S42YIQNE.mjs} +13 -8
- package/dist/cli/{chunk-YULBYKAK.mjs → chunk-S6UAJR6V.mjs} +3 -3
- package/dist/cli/{chunk-G7L27KZB.mjs → chunk-TKAQR3IB.mjs} +31 -21
- package/dist/cli/{chunk-QWRHGGUH.js → chunk-UAJFWWZE.js} +20 -2
- package/dist/cli/{chunk-ZR2RLI4O.mjs → chunk-UDRPEZ5F.mjs} +223 -92
- package/dist/cli/{chunk-QGAWTBIR.js → chunk-ULK7JGGI.js} +511 -282
- package/dist/cli/chunk-V335HGX5.js +1038 -0
- package/dist/cli/{chunk-NH6JSJW6.mjs → chunk-V3MEA7NB.mjs} +7 -5
- package/dist/cli/{chunk-NRGGFVVB.js → chunk-VFGVXXZP.js} +37 -35
- package/dist/cli/chunk-VLEVVDWG.js +91 -0
- package/dist/cli/{chunk-R2GLGLDR.mjs → chunk-VPHN2HAL.mjs} +216 -91
- package/dist/cli/{chunk-CFUTOWE4.js → chunk-WG3KGAII.js} +8 -88
- package/dist/cli/{describe-TOMIAT37.mjs → chunk-WIY6U6GD.mjs} +19 -36
- package/dist/cli/{chunk-YS2YBSJB.js → chunk-XANRM3QA.js} +6 -6
- package/dist/cli/{chunk-KGQNIA37.js → chunk-XQCTG5OO.js} +44 -34
- package/dist/cli/{chunk-EJGBLXDZ.mjs → chunk-XZAFIOUQ.mjs} +1 -1
- package/dist/cli/chunk-Y4DPU4OM.js +827 -0
- package/dist/cli/chunk-YT5EODJO.js +920 -0
- package/dist/cli/{chunk-2WRO2UJ5.js → chunk-ZGQSFYD2.js} +56 -51
- package/dist/cli/{chunk-OJ6RUKVT.mjs → chunk-ZUK6LIJB.mjs} +10 -1
- package/dist/cli/command-docs.d.mts +5 -0
- package/dist/cli/command-docs.d.ts +5 -0
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-6FNFYJUC.js → csv-C56GSCEU.js} +13 -12
- package/dist/cli/{csv-MDHT4BKK.mjs → csv-L54JS7TF.mjs} +4 -3
- package/dist/cli/{db-D6AMVOEW.js → db-MOGRMZTA.js} +30 -27
- package/dist/cli/{db-74O3RFWY.mjs → db-YVBUW2DX.mjs} +10 -7
- package/dist/cli/describe-KYEULWPG.js +48 -0
- package/dist/cli/describe-NLZKKT7C.mjs +48 -0
- package/dist/cli/describe-core.d.mts +153 -5
- package/dist/cli/describe-core.d.ts +153 -5
- package/dist/cli/describe-core.js +9 -5
- package/dist/cli/describe-core.mjs +10 -6
- package/dist/cli/{executions-N4FMGVSC.js → executions-A7L4ULPP.js} +9 -7
- package/dist/cli/{executions-PVSF4HUF.mjs → executions-ZBGSTT37.mjs} +7 -5
- package/dist/cli/{feedback-OB7NANZW.mjs → feedback-G6GU37FD.mjs} +6 -5
- package/dist/cli/{feedback-WFSPCAI2.js → feedback-OHLY7RYD.js} +10 -9
- package/dist/cli/getting-started.d.mts +6 -6
- package/dist/cli/getting-started.d.ts +6 -6
- package/dist/cli/getting-started.js +2 -2
- package/dist/cli/getting-started.mjs +1 -1
- package/dist/cli/git-P76N4NDQ.js +25 -0
- package/dist/cli/{git-FHUSPAEU.mjs → git-PKZW3QD5.mjs} +5 -4
- package/dist/cli/index.js +152 -142
- package/dist/cli/index.mjs +56 -46
- package/dist/cli/{legacy-noops-ECHNA5HN.js → legacy-noops-5LM3D724.js} +8 -7
- package/dist/cli/{legacy-noops-HMK4BSCI.mjs → legacy-noops-LJJYG6YA.mjs} +5 -4
- package/dist/cli/{monitors-U7VQ3EZM.mjs → monitors-72QV4ALO.mjs} +19 -6
- package/dist/cli/{monitors-XLLFNENH.js → monitors-UX3H5DC2.js} +103 -90
- package/dist/cli/{org-6H3USO5M.mjs → org-6RRRKOCP.mjs} +9 -6
- package/dist/cli/{org-QX6ER2HN.js → org-IF7ISUVB.js} +70 -67
- package/dist/cli/pages-3SU3HKL7.js +252 -0
- package/dist/cli/pages-DXDYYKEK.mjs +252 -0
- package/dist/cli/{play-MOB2WYOR.mjs → play-AHASKRLA.mjs} +512 -1508
- package/dist/cli/{play-WNB7HBZK.js → play-EUIUVLUH.js} +1090 -2086
- package/dist/cli/{providers-CXEZ23E2.mjs → providers-GWGE3WY3.mjs} +7 -5
- package/dist/cli/{providers-7M3DISKX.js → providers-V5WU4VXJ.js} +10 -8
- package/dist/cli/{quickstart-ZFCHKHF6.mjs → quickstart-OXKQ5ZST.mjs} +5 -4
- package/dist/cli/{quickstart-CLJT4AZL.js → quickstart-QP65I5PF.js} +13 -12
- package/dist/cli/run-6MM72IGL.mjs +443 -0
- package/dist/cli/run-F3FTYS56.js +443 -0
- package/dist/cli/search-OYKOOI7A.js +32 -0
- package/dist/cli/{search-FVYWYIC3.mjs → search-ZMEBVJZB.mjs} +8 -6
- package/dist/cli/{secrets-YRLKZQS5.js → secrets-ACND5N6A.js} +16 -14
- package/dist/cli/{secrets-WAMPTQFC.mjs → secrets-XRCJFF3L.mjs} +7 -5
- package/dist/cli/{sessions-IQ332BJH.mjs → sessions-RTK3CEW6.mjs} +5 -4
- package/dist/cli/{sessions-44J6WIVU.js → sessions-ZGRJPCFF.js} +6 -5
- package/dist/cli/{settings-4IJR2I2T.js → settings-PD5KWQQZ.js} +80 -77
- package/dist/cli/{settings-22S6NIFQ.mjs → settings-XDRBPRDE.mjs} +14 -11
- package/dist/cli/{setup-OZUPKKPW.mjs → setup-3HPYAOCC.mjs} +12 -10
- package/dist/cli/{setup-3FWSRNOX.js → setup-E2Q6PXHC.js} +53 -51
- package/dist/cli/{skills-5CW3NFP3.mjs → skills-OOQFMPOV.mjs} +7 -6
- package/dist/cli/skills-XYWV52KB.js +31 -0
- package/dist/cli/tools-ASCDZJCK.js +55 -0
- package/dist/cli/tools-C5ZT3UIC.mjs +55 -0
- package/dist/cli/update-5RQSEIFM.js +33 -0
- package/dist/cli/{update-IBULOV7P.mjs → update-ZWJTADIW.mjs} +9 -8
- package/dist/cli/{workflow-MVZT7MWT.mjs → workflow-23NMPAJ7.mjs} +10 -8
- package/dist/cli/{workflow-Z7FW6GT2.js → workflow-TCXU5YJV.js} +20 -18
- package/dist/client-DS2IWYZF.d.ts +10 -0
- package/dist/client-DTwnz_AW.d.mts +10 -0
- package/dist/{client-CYqG23K1.d.ts → client-core-B_6HAIBy.d.ts} +385 -12
- package/dist/{client-BbU5_j7n.d.mts → client-core-DzBSlY1U.d.mts} +385 -12
- package/dist/{compiler-manifest-CWz_sNOQ.d.mts → compiler-manifest-Dcyd3-Zd.d.mts} +43 -1
- package/dist/{compiler-manifest-CWz_sNOQ.d.ts → compiler-manifest-Dcyd3-Zd.d.ts} +43 -1
- package/dist/errors-d-sTrZhe.d.mts +142 -0
- package/dist/errors-yQwfgrcX.d.ts +142 -0
- package/dist/{index-BF2JB_Ug.d.mts → index-C6oXchjN.d.mts} +1 -1
- package/dist/{index-4NPXDzlD.d.ts → index-P56zy_z5.d.ts} +1 -1
- package/dist/index.d.mts +11 -147
- package/dist/index.d.ts +11 -147
- package/dist/index.js +15 -11
- package/dist/index.mjs +14 -10
- package/dist/install-integrity.json +141 -104
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +2 -1
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/play-description.js +2 -2
- package/dist/plays/play-description.mjs +1 -1
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +17 -0
- package/dist/server.d.ts +17 -0
- package/dist/server.js +76 -0
- package/dist/server.mjs +76 -0
- package/package.json +6 -1
- package/dist/cli/auth-VDOCNR7H.js +0 -40
- package/dist/cli/chunk-PQUUWFXY.js +0 -95
- package/dist/cli/chunk-QJLKYYPX.js +0 -1710
- package/dist/cli/chunk-YBWAG72P.mjs +0 -95
- package/dist/cli/git-4PMBJSH5.js +0 -24
- package/dist/cli/search-4CCQCTVD.js +0 -30
- package/dist/cli/skills-LMNM6B5F.js +0 -30
- package/dist/cli/tools-AGBBDJ7P.js +0 -45
- package/dist/cli/tools-NOPBDRGW.mjs +0 -45
- package/dist/cli/update-U3W6USVD.js +0 -32
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AuthError,
|
|
3
|
-
ConfigError,
|
|
4
3
|
RateLimitError,
|
|
5
4
|
ToolRateLimitError
|
|
6
5
|
} from "./chunk-4QF2K7TM.mjs";
|
|
@@ -17,636 +16,7 @@ import {
|
|
|
17
16
|
} from "./chunk-HBL4PM5Q.mjs";
|
|
18
17
|
import {
|
|
19
18
|
SDK_RELEASE
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
|
|
22
|
-
// src/config.ts
|
|
23
|
-
import {
|
|
24
|
-
existsSync,
|
|
25
|
-
mkdirSync,
|
|
26
|
-
readdirSync,
|
|
27
|
-
realpathSync,
|
|
28
|
-
readFileSync,
|
|
29
|
-
statSync,
|
|
30
|
-
writeFileSync
|
|
31
|
-
} from "fs";
|
|
32
|
-
import { homedir } from "os";
|
|
33
|
-
import { dirname, isAbsolute, join, resolve } from "path";
|
|
34
|
-
var HOST_URL_ENV = "DEEPLINE_HOST_URL";
|
|
35
|
-
var API_KEY_ENV = "DEEPLINE_API_KEY";
|
|
36
|
-
var ACTIVE_ORG_ID_ENV = "DEEPLINE_ACTIVE_ORG_ID";
|
|
37
|
-
var ACTIVE_ORG_NAME_ENV = "DEEPLINE_ACTIVE_ORG_NAME";
|
|
38
|
-
var FEATURES_ENV = "DEEPLINE_FEATURES";
|
|
39
|
-
var PROD_URL = "https://code.deepline.com";
|
|
40
|
-
var DEFAULT_TIMEOUT = 6e4;
|
|
41
|
-
var DEFAULT_MAX_RETRIES = 3;
|
|
42
|
-
var PROJECT_DEEPLINE_ENV_FILE = ".env.deepline";
|
|
43
|
-
var COWORK_IGNORED_WORKSPACE_DIRS = /* @__PURE__ */ new Set([
|
|
44
|
-
".auto-memory",
|
|
45
|
-
".claude",
|
|
46
|
-
".remote-plugins",
|
|
47
|
-
"outputs",
|
|
48
|
-
"plugins",
|
|
49
|
-
"uploads"
|
|
50
|
-
]);
|
|
51
|
-
var COWORK_PROJECT_MARKERS = [
|
|
52
|
-
".deepline",
|
|
53
|
-
".env.deepline",
|
|
54
|
-
".git",
|
|
55
|
-
"AGENTS.md",
|
|
56
|
-
"package.json",
|
|
57
|
-
"pyproject.toml"
|
|
58
|
-
];
|
|
59
|
-
var CLI_ENV_ALLOWED_KEYS = /* @__PURE__ */ new Set([
|
|
60
|
-
HOST_URL_ENV,
|
|
61
|
-
API_KEY_ENV,
|
|
62
|
-
ACTIVE_ORG_ID_ENV,
|
|
63
|
-
ACTIVE_ORG_NAME_ENV,
|
|
64
|
-
FEATURES_ENV
|
|
65
|
-
]);
|
|
66
|
-
function featureEnvValues(data) {
|
|
67
|
-
if (!Array.isArray(data.features)) return {};
|
|
68
|
-
return {
|
|
69
|
-
[FEATURES_ENV]: data.features.filter(
|
|
70
|
-
(key) => typeof key === "string" && key.trim() !== ""
|
|
71
|
-
).map((key) => key.trim()).join(",")
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function storedHostApiKey(baseUrl) {
|
|
75
|
-
return loadCliEnv(normalizeBaseUrl(baseUrl) || baseUrl)[API_KEY_ENV] ?? "";
|
|
76
|
-
}
|
|
77
|
-
function storedHostFeatures(baseUrl) {
|
|
78
|
-
return loadCliEnv(normalizeBaseUrl(baseUrl) || baseUrl)[FEATURES_ENV];
|
|
79
|
-
}
|
|
80
|
-
function baseUrlSlug(baseUrl) {
|
|
81
|
-
let url;
|
|
82
|
-
try {
|
|
83
|
-
url = new URL(baseUrl);
|
|
84
|
-
} catch {
|
|
85
|
-
return "unknown";
|
|
86
|
-
}
|
|
87
|
-
const host = url.hostname || "unknown";
|
|
88
|
-
const port = url.port ? Number.parseInt(url.port, 10) : null;
|
|
89
|
-
let slug = host.replace(/[^a-zA-Z0-9]/g, "-");
|
|
90
|
-
if (port && port !== 80 && port !== 443) {
|
|
91
|
-
slug = `${slug}-${port}`;
|
|
92
|
-
}
|
|
93
|
-
return slug.toLowerCase().replace(/^-+|-+$/g, "");
|
|
94
|
-
}
|
|
95
|
-
function parseEnvFile(filePath) {
|
|
96
|
-
if (!existsSync(filePath)) return {};
|
|
97
|
-
const env = {};
|
|
98
|
-
const content = readFileSync(filePath, "utf-8");
|
|
99
|
-
for (const line of content.split(/\r?\n/)) {
|
|
100
|
-
const trimmed = line.trim();
|
|
101
|
-
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
102
|
-
const eqIndex = trimmed.indexOf("=");
|
|
103
|
-
if (eqIndex < 0) continue;
|
|
104
|
-
const key = trimmed.slice(0, eqIndex).trim();
|
|
105
|
-
let value = trimmed.slice(eqIndex + 1).trim();
|
|
106
|
-
if (value.length >= 2 && value.startsWith('"') && value.endsWith('"')) {
|
|
107
|
-
try {
|
|
108
|
-
value = JSON.parse(value);
|
|
109
|
-
} catch {
|
|
110
|
-
value = value.slice(1, -1);
|
|
111
|
-
}
|
|
112
|
-
} else if (value.length >= 2 && value.startsWith("'") && value.endsWith("'")) {
|
|
113
|
-
value = value.slice(1, -1);
|
|
114
|
-
}
|
|
115
|
-
if (key && value) {
|
|
116
|
-
env[key] = value;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return env;
|
|
120
|
-
}
|
|
121
|
-
function findNearestEnvFile(name, startDir = process.cwd()) {
|
|
122
|
-
let current = resolve(startDir);
|
|
123
|
-
while (true) {
|
|
124
|
-
const filePath = join(current, name);
|
|
125
|
-
if (existsSync(filePath)) return filePath;
|
|
126
|
-
const parent = dirname(current);
|
|
127
|
-
if (parent === current) return null;
|
|
128
|
-
current = parent;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function isDirectory(path) {
|
|
132
|
-
try {
|
|
133
|
-
return statSync(path).isDirectory();
|
|
134
|
-
} catch {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
function canonicalPath(path) {
|
|
139
|
-
try {
|
|
140
|
-
return realpathSync(path);
|
|
141
|
-
} catch {
|
|
142
|
-
return resolve(path);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function isTruthy(value) {
|
|
146
|
-
return /^(1|true|yes|on)$/i.test(value?.trim() ?? "");
|
|
147
|
-
}
|
|
148
|
-
function sessionRootFromPath(path) {
|
|
149
|
-
const trimmed = path?.trim();
|
|
150
|
-
if (!trimmed) return null;
|
|
151
|
-
const match = /^\/sessions\/[^/]+(?=\/|$)/.exec(trimmed);
|
|
152
|
-
return match?.[0] ?? null;
|
|
153
|
-
}
|
|
154
|
-
function coworkSessionRoot() {
|
|
155
|
-
const home = process.env.HOME?.trim();
|
|
156
|
-
const homeSessionRoot = sessionRootFromPath(home);
|
|
157
|
-
if (homeSessionRoot && isDirectory(join(homeSessionRoot, "mnt"))) {
|
|
158
|
-
return homeSessionRoot;
|
|
159
|
-
}
|
|
160
|
-
const cwdSessionRoot = sessionRootFromPath(process.cwd());
|
|
161
|
-
if (cwdSessionRoot && isDirectory(join(cwdSessionRoot, "mnt"))) {
|
|
162
|
-
return cwdSessionRoot;
|
|
163
|
-
}
|
|
164
|
-
if (isTruthy(process.env.CLAUDE_CODE_REMOTE) && home) {
|
|
165
|
-
const mountedRoot = join(home, "mnt");
|
|
166
|
-
if (isDirectory(mountedRoot)) return resolve(home);
|
|
167
|
-
}
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
function isCoworkLikeSandbox() {
|
|
171
|
-
const home = process.env.HOME?.trim();
|
|
172
|
-
return isTruthy(process.env.CLAUDE_CODE_REMOTE) || sessionRootFromPath(home) !== null || sessionRootFromPath(process.cwd()) !== null;
|
|
173
|
-
}
|
|
174
|
-
function coworkProjectScore(path) {
|
|
175
|
-
let score = 0;
|
|
176
|
-
for (const marker of COWORK_PROJECT_MARKERS) {
|
|
177
|
-
if (existsSync(join(path, marker))) score += 1;
|
|
178
|
-
}
|
|
179
|
-
return score;
|
|
180
|
-
}
|
|
181
|
-
function listCoworkWorkspaceDirCandidates() {
|
|
182
|
-
if (!isCoworkLikeSandbox()) {
|
|
183
|
-
return [];
|
|
184
|
-
}
|
|
185
|
-
const explicitProjectDir = process.env.CLAUDE_PROJECT_DIR?.trim();
|
|
186
|
-
if (explicitProjectDir && isDirectory(explicitProjectDir)) {
|
|
187
|
-
return [resolve(explicitProjectDir)];
|
|
188
|
-
}
|
|
189
|
-
const sessionRoot = coworkSessionRoot();
|
|
190
|
-
if (!sessionRoot) return [];
|
|
191
|
-
const mountedRoot = join(sessionRoot, "mnt");
|
|
192
|
-
if (!isDirectory(mountedRoot)) return [];
|
|
193
|
-
let names;
|
|
194
|
-
try {
|
|
195
|
-
names = readdirSync(mountedRoot).sort();
|
|
196
|
-
} catch {
|
|
197
|
-
return [];
|
|
198
|
-
}
|
|
199
|
-
const candidates = [];
|
|
200
|
-
for (const name of names) {
|
|
201
|
-
if (name.startsWith(".") || COWORK_IGNORED_WORKSPACE_DIRS.has(name)) {
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
const candidate = join(mountedRoot, name);
|
|
205
|
-
if (isDirectory(candidate)) candidates.push(candidate);
|
|
206
|
-
}
|
|
207
|
-
if (candidates.length <= 1) return candidates;
|
|
208
|
-
const projectLike = candidates.filter(
|
|
209
|
-
(candidate) => coworkProjectScore(candidate) > 0
|
|
210
|
-
);
|
|
211
|
-
return projectLike.length > 0 ? projectLike : candidates;
|
|
212
|
-
}
|
|
213
|
-
function isInIgnoredCoworkMount(path) {
|
|
214
|
-
const sessionRoot = coworkSessionRoot();
|
|
215
|
-
if (!sessionRoot) return false;
|
|
216
|
-
const mountedRoot = canonicalPath(join(sessionRoot, "mnt"));
|
|
217
|
-
const resolvedPath = canonicalPath(path);
|
|
218
|
-
const prefix = `${mountedRoot}/`;
|
|
219
|
-
if (!resolvedPath.startsWith(prefix)) return false;
|
|
220
|
-
const relativePath = resolvedPath.slice(prefix.length);
|
|
221
|
-
const mountName = relativePath.split("/")[0];
|
|
222
|
-
return mountName.startsWith(".") || COWORK_IGNORED_WORKSPACE_DIRS.has(mountName);
|
|
223
|
-
}
|
|
224
|
-
function detectCoworkWorkspaceDir() {
|
|
225
|
-
const candidates = listCoworkWorkspaceDirCandidates();
|
|
226
|
-
return candidates.length === 1 ? candidates[0] : null;
|
|
227
|
-
}
|
|
228
|
-
function loadProjectEnvCandidates(startDir = process.cwd()) {
|
|
229
|
-
const filePaths = [];
|
|
230
|
-
const sources = /* @__PURE__ */ new Map();
|
|
231
|
-
const nearestFile = findNearestEnvFile(PROJECT_DEEPLINE_ENV_FILE, startDir);
|
|
232
|
-
if (nearestFile && !isInIgnoredCoworkMount(nearestFile)) {
|
|
233
|
-
filePaths.push(nearestFile);
|
|
234
|
-
sources.set(resolve(nearestFile), "nearest");
|
|
235
|
-
}
|
|
236
|
-
const coworkWorkspaceDir = detectCoworkWorkspaceDir();
|
|
237
|
-
if (coworkWorkspaceDir) {
|
|
238
|
-
const coworkFile = join(coworkWorkspaceDir, PROJECT_DEEPLINE_ENV_FILE);
|
|
239
|
-
if (existsSync(coworkFile) && !filePaths.some((filePath) => resolve(filePath) === resolve(coworkFile))) {
|
|
240
|
-
filePaths.push(coworkFile);
|
|
241
|
-
sources.set(resolve(coworkFile), "cowork");
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return filePaths.map((filePath) => ({
|
|
245
|
-
filePath,
|
|
246
|
-
env: parseEnvFile(filePath),
|
|
247
|
-
source: sources.get(resolve(filePath)) ?? "nearest"
|
|
248
|
-
}));
|
|
249
|
-
}
|
|
250
|
-
function normalizeBaseUrl(baseUrl) {
|
|
251
|
-
const trimmed = baseUrl?.trim().replace(/\/+$/, "") ?? "";
|
|
252
|
-
if (!trimmed) return "";
|
|
253
|
-
try {
|
|
254
|
-
const parsed = new URL(trimmed);
|
|
255
|
-
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
256
|
-
return "";
|
|
257
|
-
}
|
|
258
|
-
return parsed.toString().replace(/\/+$/, "");
|
|
259
|
-
} catch {
|
|
260
|
-
return "";
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
function firstNonEmpty(...values) {
|
|
264
|
-
for (const value of values) {
|
|
265
|
-
const trimmed = value?.trim();
|
|
266
|
-
if (trimmed) return trimmed;
|
|
267
|
-
}
|
|
268
|
-
return "";
|
|
269
|
-
}
|
|
270
|
-
function formatEnvFileValue(value) {
|
|
271
|
-
return /^[a-zA-Z0-9_./:@%+=,-]+$/.test(value) ? value : JSON.stringify(value);
|
|
272
|
-
}
|
|
273
|
-
function mergePersistedEnvValues(existing, values) {
|
|
274
|
-
const merged = { ...existing, ...values };
|
|
275
|
-
const nextApiKey = values[API_KEY_ENV];
|
|
276
|
-
if (nextApiKey !== void 0 && nextApiKey !== existing[API_KEY_ENV] && values[ACTIVE_ORG_ID_ENV] === void 0) {
|
|
277
|
-
delete merged[ACTIVE_ORG_ID_ENV];
|
|
278
|
-
delete merged[ACTIVE_ORG_NAME_ENV];
|
|
279
|
-
delete merged[FEATURES_ENV];
|
|
280
|
-
}
|
|
281
|
-
if (values[FEATURES_ENV] === "") {
|
|
282
|
-
delete merged[FEATURES_ENV];
|
|
283
|
-
}
|
|
284
|
-
return merged;
|
|
285
|
-
}
|
|
286
|
-
function persistedEnvLines(values) {
|
|
287
|
-
return Object.entries(values).filter(
|
|
288
|
-
([key, value]) => CLI_ENV_ALLOWED_KEYS.has(key) && value.trim() !== ""
|
|
289
|
-
).map(([key, value]) => `${key}=${formatEnvFileValue(value)}`);
|
|
290
|
-
}
|
|
291
|
-
function sdkCliConfigDir(baseUrl) {
|
|
292
|
-
const home = process.env.HOME?.trim() || homedir();
|
|
293
|
-
return join(home, ".local", "deepline", baseUrlSlug(baseUrl || PROD_URL));
|
|
294
|
-
}
|
|
295
|
-
function sdkCliStateDirPath(baseUrl, homeDir = process.env.HOME?.trim() || homedir()) {
|
|
296
|
-
return join(
|
|
297
|
-
homeDir,
|
|
298
|
-
".local",
|
|
299
|
-
"deepline",
|
|
300
|
-
baseUrlSlug(baseUrl || PROD_URL),
|
|
301
|
-
"sdk-cli"
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
function sdkCliEnvFilePath(baseUrl) {
|
|
305
|
-
return join(sdkCliConfigDir(baseUrl), ".env");
|
|
306
|
-
}
|
|
307
|
-
function loadCliEnv(baseUrl = PROD_URL) {
|
|
308
|
-
return parseEnvFile(sdkCliEnvFilePath(baseUrl));
|
|
309
|
-
}
|
|
310
|
-
function hostConfigDirPath(baseUrl) {
|
|
311
|
-
return sdkCliConfigDir(baseUrl);
|
|
312
|
-
}
|
|
313
|
-
function hostEnvFilePath(baseUrl) {
|
|
314
|
-
return sdkCliEnvFilePath(baseUrl);
|
|
315
|
-
}
|
|
316
|
-
function saveHostEnvValues(baseUrl, values) {
|
|
317
|
-
const filePath = sdkCliEnvFilePath(baseUrl);
|
|
318
|
-
const dir = dirname(filePath);
|
|
319
|
-
if (!existsSync(dir)) {
|
|
320
|
-
mkdirSync(dir, { recursive: true });
|
|
321
|
-
}
|
|
322
|
-
const existing = parseEnvFile(filePath);
|
|
323
|
-
const merged = mergePersistedEnvValues(existing, values);
|
|
324
|
-
const lines = persistedEnvLines(merged);
|
|
325
|
-
writeFileSync(filePath, `${lines.join("\n")}
|
|
326
|
-
`, "utf-8");
|
|
327
|
-
}
|
|
328
|
-
function loadGlobalCliEnv() {
|
|
329
|
-
return loadCliEnv(PROD_URL);
|
|
330
|
-
}
|
|
331
|
-
function autoDetectBaseUrl() {
|
|
332
|
-
const projectEnvs = loadProjectEnvCandidates();
|
|
333
|
-
const globalEnv = loadGlobalCliEnv();
|
|
334
|
-
return normalizeBaseUrl(process.env[HOST_URL_ENV] ?? "") || firstNonEmpty(
|
|
335
|
-
...projectEnvs.map(({ env }) => normalizeBaseUrl(env[HOST_URL_ENV]))
|
|
336
|
-
) || normalizeBaseUrl(globalEnv[HOST_URL_ENV] ?? "") || PROD_URL;
|
|
337
|
-
}
|
|
338
|
-
function resolveApiKeyForBaseUrl(baseUrl, explicitApiKey) {
|
|
339
|
-
const normalizedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
340
|
-
const projectEnvs = loadProjectEnvCandidates();
|
|
341
|
-
const cliEnv = loadCliEnv(normalizedBaseUrl || baseUrl);
|
|
342
|
-
return firstNonEmpty(
|
|
343
|
-
explicitApiKey,
|
|
344
|
-
process.env[API_KEY_ENV],
|
|
345
|
-
...projectEnvs.map(({ env }) => {
|
|
346
|
-
const projectBaseUrl = normalizeBaseUrl(env[HOST_URL_ENV] ?? "");
|
|
347
|
-
return projectBaseUrl === normalizedBaseUrl ? env[API_KEY_ENV] : "";
|
|
348
|
-
}),
|
|
349
|
-
cliEnv[API_KEY_ENV]
|
|
350
|
-
);
|
|
351
|
-
}
|
|
352
|
-
function resolveProjectApiKeyForBaseUrl(baseUrl, startDir = process.cwd()) {
|
|
353
|
-
const normalizedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
354
|
-
return firstNonEmpty(
|
|
355
|
-
...loadProjectEnvCandidates(startDir).map(({ env }) => {
|
|
356
|
-
const projectBaseUrl = normalizeBaseUrl(env[HOST_URL_ENV] ?? "");
|
|
357
|
-
return projectBaseUrl === normalizedBaseUrl ? env[API_KEY_ENV] : "";
|
|
358
|
-
})
|
|
359
|
-
);
|
|
360
|
-
}
|
|
361
|
-
function resolveGlobalApiKeyForBaseUrl(baseUrl) {
|
|
362
|
-
return firstNonEmpty(
|
|
363
|
-
process.env[API_KEY_ENV],
|
|
364
|
-
loadCliEnv(normalizeBaseUrl(baseUrl) || baseUrl)[API_KEY_ENV]
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
function getResolvedProjectAuthSource(baseUrl, apiKey, startDir = process.cwd()) {
|
|
368
|
-
const normalizedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
369
|
-
const normalizedApiKey = apiKey.trim();
|
|
370
|
-
if (!normalizedBaseUrl || !normalizedApiKey) return null;
|
|
371
|
-
return loadProjectEnvCandidates(startDir).find(({ env }) => {
|
|
372
|
-
const projectBaseUrl = normalizeBaseUrl(env[HOST_URL_ENV] ?? "");
|
|
373
|
-
return projectBaseUrl === normalizedBaseUrl && (env[API_KEY_ENV] ?? "").trim() === normalizedApiKey;
|
|
374
|
-
}) ?? null;
|
|
375
|
-
}
|
|
376
|
-
function resolveBaseUrlOnly(options) {
|
|
377
|
-
const baseUrl = normalizeBaseUrl(
|
|
378
|
-
options?.baseUrl?.trim() || autoDetectBaseUrl()
|
|
379
|
-
);
|
|
380
|
-
if (!baseUrl) {
|
|
381
|
-
throw new ConfigError(
|
|
382
|
-
`Invalid ${HOST_URL_ENV}. Expected an http(s) URL such as https://code.deepline.com.`
|
|
383
|
-
);
|
|
384
|
-
}
|
|
385
|
-
return baseUrl;
|
|
386
|
-
}
|
|
387
|
-
function resolveConfig(options) {
|
|
388
|
-
const baseUrl = normalizeBaseUrl(
|
|
389
|
-
options?.baseUrl?.trim() || autoDetectBaseUrl()
|
|
390
|
-
);
|
|
391
|
-
if (!baseUrl) {
|
|
392
|
-
throw new ConfigError(
|
|
393
|
-
`Invalid ${HOST_URL_ENV}. Expected an http(s) URL such as https://code.deepline.com.`
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
const apiKey = resolveApiKeyForBaseUrl(baseUrl, options?.apiKey);
|
|
397
|
-
if (!apiKey) {
|
|
398
|
-
throw new ConfigError(
|
|
399
|
-
`No API key found. Set ${API_KEY_ENV}, add it to .env.deepline, or run: deepline auth register`
|
|
400
|
-
);
|
|
401
|
-
}
|
|
402
|
-
return {
|
|
403
|
-
apiKey,
|
|
404
|
-
baseUrl,
|
|
405
|
-
timeout: options?.timeout ?? DEFAULT_TIMEOUT,
|
|
406
|
-
maxRetries: options?.maxRetries ?? DEFAULT_MAX_RETRIES,
|
|
407
|
-
// Pass through untouched: the transport owns case-insensitive merging so
|
|
408
|
-
// there is exactly one place that decides which header wins.
|
|
409
|
-
...options?.headers ? { headers: { ...options.headers } } : {},
|
|
410
|
-
...options?.environment ? { environment: options.environment } : {}
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
function mergeProjectEnvFile(filePath, values) {
|
|
414
|
-
const existing = parseEnvFile(filePath);
|
|
415
|
-
const merged = mergePersistedEnvValues(existing, values);
|
|
416
|
-
const dir = dirname(filePath);
|
|
417
|
-
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
418
|
-
ensureProjectEnvIsIgnored(dir);
|
|
419
|
-
const lines = persistedEnvLines(merged);
|
|
420
|
-
writeFileSync(filePath, `${lines.join("\n")}
|
|
421
|
-
`, "utf-8");
|
|
422
|
-
}
|
|
423
|
-
function ensureProjectEnvIsIgnored(dir) {
|
|
424
|
-
ensureProjectPrivatePathsIgnored(dir, [
|
|
425
|
-
PROJECT_DEEPLINE_ENV_FILE,
|
|
426
|
-
".deepline/"
|
|
427
|
-
]);
|
|
428
|
-
}
|
|
429
|
-
function ensureProjectPrivatePathsIgnored(dir, entries) {
|
|
430
|
-
const gitDir = findNearestGitCommonDir(dir);
|
|
431
|
-
if (gitDir) {
|
|
432
|
-
const excludePath = join(gitDir, "info", "exclude");
|
|
433
|
-
const existing2 = existsSync(excludePath) ? readFileSync(excludePath, "utf-8") : "";
|
|
434
|
-
const existingEntries2 = new Set(
|
|
435
|
-
existing2.split(/\r?\n/).map((line) => line.trim()).filter(Boolean)
|
|
436
|
-
);
|
|
437
|
-
const missing2 = entries.filter(
|
|
438
|
-
(entry) => !existingEntries2.has(entry) && !existingEntries2.has(`/${entry}`)
|
|
439
|
-
);
|
|
440
|
-
if (missing2.length === 0) return;
|
|
441
|
-
mkdirSync(dirname(excludePath), { recursive: true });
|
|
442
|
-
const prefix2 = existing2 && !existing2.endsWith("\n") ? "\n" : "";
|
|
443
|
-
writeFileSync(
|
|
444
|
-
excludePath,
|
|
445
|
-
`${existing2}${prefix2}${missing2.join("\n")}
|
|
446
|
-
`,
|
|
447
|
-
"utf-8"
|
|
448
|
-
);
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
const gitignorePath = join(dir, ".gitignore");
|
|
452
|
-
const existing = existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf-8") : "";
|
|
453
|
-
const existingEntries = new Set(
|
|
454
|
-
existing.split(/\r?\n/).map((line) => line.trim()).filter(Boolean)
|
|
455
|
-
);
|
|
456
|
-
const missing = entries.filter(
|
|
457
|
-
(entry) => !existingEntries.has(entry) && !existingEntries.has(`/${entry}`)
|
|
458
|
-
);
|
|
459
|
-
if (missing.length === 0) return;
|
|
460
|
-
const prefix = existing && !existing.endsWith("\n") ? "\n" : "";
|
|
461
|
-
writeFileSync(
|
|
462
|
-
gitignorePath,
|
|
463
|
-
`${existing}${prefix}${missing.join("\n")}
|
|
464
|
-
`,
|
|
465
|
-
"utf-8"
|
|
466
|
-
);
|
|
467
|
-
}
|
|
468
|
-
function findNearestGitCommonDir(startDir) {
|
|
469
|
-
let current = resolve(startDir);
|
|
470
|
-
while (true) {
|
|
471
|
-
const candidate = join(current, ".git");
|
|
472
|
-
if (existsSync(candidate)) {
|
|
473
|
-
try {
|
|
474
|
-
const stat = statSync(candidate);
|
|
475
|
-
if (stat.isDirectory()) return candidate;
|
|
476
|
-
if (stat.isFile()) {
|
|
477
|
-
const match = readFileSync(candidate, "utf8").match(
|
|
478
|
-
/^gitdir:\s*(.+)$/m
|
|
479
|
-
);
|
|
480
|
-
const rawGitDir = match?.[1]?.trim();
|
|
481
|
-
if (rawGitDir) {
|
|
482
|
-
const gitDir = isAbsolute(rawGitDir) ? rawGitDir : resolve(dirname(candidate), rawGitDir);
|
|
483
|
-
const commonDirPath = join(gitDir, "commondir");
|
|
484
|
-
if (!existsSync(commonDirPath)) return gitDir;
|
|
485
|
-
const rawCommonDir = readFileSync(commonDirPath, "utf8").trim();
|
|
486
|
-
return rawCommonDir ? isAbsolute(rawCommonDir) ? rawCommonDir : resolve(gitDir, rawCommonDir) : gitDir;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
} catch {
|
|
490
|
-
return null;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
const parent = dirname(current);
|
|
494
|
-
if (parent === current) return null;
|
|
495
|
-
current = parent;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
function saveProjectDeeplineEnvValues(values, startDir = process.cwd()) {
|
|
499
|
-
const target = resolveProjectPinTarget(startDir);
|
|
500
|
-
if (!target.ok) {
|
|
501
|
-
throw new ConfigError(
|
|
502
|
-
`Cowork project folder is ambiguous. Candidate folders: ${target.candidates.join(
|
|
503
|
-
", "
|
|
504
|
-
)}. Set CLAUDE_PROJECT_DIR or cd into the intended project folder before running this command.`
|
|
505
|
-
);
|
|
506
|
-
}
|
|
507
|
-
const filePath = join(target.dir, PROJECT_DEEPLINE_ENV_FILE);
|
|
508
|
-
mergeProjectEnvFile(filePath, values);
|
|
509
|
-
return [filePath];
|
|
510
|
-
}
|
|
511
|
-
function resolveProjectPinTarget(startDir = process.cwd()) {
|
|
512
|
-
const nearestFile = findNearestEnvFile(PROJECT_DEEPLINE_ENV_FILE, startDir);
|
|
513
|
-
if (nearestFile && !isInIgnoredCoworkMount(nearestFile)) {
|
|
514
|
-
return { ok: true, dir: dirname(nearestFile), source: "nearest" };
|
|
515
|
-
}
|
|
516
|
-
const coworkCandidates = listCoworkWorkspaceDirCandidates();
|
|
517
|
-
if (coworkCandidates.length === 1) {
|
|
518
|
-
return { ok: true, dir: coworkCandidates[0], source: "cowork" };
|
|
519
|
-
}
|
|
520
|
-
if (coworkCandidates.length > 1) {
|
|
521
|
-
const resolvedStartDir = canonicalPath(startDir);
|
|
522
|
-
const cwdCandidate = coworkCandidates.find((candidate) => {
|
|
523
|
-
const resolvedCandidate = canonicalPath(candidate);
|
|
524
|
-
return resolvedStartDir === resolvedCandidate || resolvedStartDir.startsWith(`${resolvedCandidate}/`);
|
|
525
|
-
});
|
|
526
|
-
if (cwdCandidate) {
|
|
527
|
-
return { ok: true, dir: cwdCandidate, source: "cowork" };
|
|
528
|
-
}
|
|
529
|
-
return {
|
|
530
|
-
ok: false,
|
|
531
|
-
reason: "ambiguous_cowork_project",
|
|
532
|
-
candidates: coworkCandidates
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
return { ok: true, dir: resolve(startDir), source: "cwd" };
|
|
536
|
-
}
|
|
537
|
-
function getActiveProjectAuthSource(startDir = process.cwd()) {
|
|
538
|
-
return loadProjectEnvCandidates(startDir)[0] ?? null;
|
|
539
|
-
}
|
|
540
|
-
function findNearestProjectMarkerDir(startDir) {
|
|
541
|
-
let current = resolve(startDir);
|
|
542
|
-
while (true) {
|
|
543
|
-
if (COWORK_PROJECT_MARKERS.some((marker) => existsSync(join(current, marker)))) {
|
|
544
|
-
return current;
|
|
545
|
-
}
|
|
546
|
-
const parent = dirname(current);
|
|
547
|
-
if (parent === current) return null;
|
|
548
|
-
current = parent;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
function resolveCliAuthProvenance(config, startDir = process.cwd()) {
|
|
552
|
-
const envApiKey = process.env[API_KEY_ENV]?.trim();
|
|
553
|
-
const folderAuth = getResolvedProjectAuthSource(
|
|
554
|
-
config.baseUrl,
|
|
555
|
-
config.apiKey,
|
|
556
|
-
startDir
|
|
557
|
-
);
|
|
558
|
-
const pinTarget = resolveProjectPinTarget(startDir);
|
|
559
|
-
const markerDir = findNearestProjectMarkerDir(startDir);
|
|
560
|
-
const project = !pinTarget.ok ? {
|
|
561
|
-
state: "ambiguous_cowork_project",
|
|
562
|
-
candidates: pinTarget.candidates
|
|
563
|
-
} : folderAuth ? {
|
|
564
|
-
state: "project",
|
|
565
|
-
dir: dirname(folderAuth.filePath),
|
|
566
|
-
pinPath: folderAuth.filePath,
|
|
567
|
-
source: "folder"
|
|
568
|
-
} : pinTarget.source === "cowork" ? {
|
|
569
|
-
state: "project",
|
|
570
|
-
dir: pinTarget.dir,
|
|
571
|
-
pinPath: join(pinTarget.dir, PROJECT_DEEPLINE_ENV_FILE),
|
|
572
|
-
source: "cowork"
|
|
573
|
-
} : markerDir ? {
|
|
574
|
-
state: "project",
|
|
575
|
-
dir: markerDir,
|
|
576
|
-
pinPath: join(markerDir, PROJECT_DEEPLINE_ENV_FILE),
|
|
577
|
-
source: "marker"
|
|
578
|
-
} : { state: "not_project" };
|
|
579
|
-
return {
|
|
580
|
-
scope: envApiKey ? "env" : folderAuth ? "folder" : "global",
|
|
581
|
-
project,
|
|
582
|
-
folderAuthPath: folderAuth?.filePath ?? null
|
|
583
|
-
};
|
|
584
|
-
}
|
|
585
|
-
function activeOrganizationFromEnv(env) {
|
|
586
|
-
const orgId = env[ACTIVE_ORG_ID_ENV]?.trim();
|
|
587
|
-
if (!orgId) return null;
|
|
588
|
-
const orgName = env[ACTIVE_ORG_NAME_ENV]?.trim() || null;
|
|
589
|
-
return { org_id: orgId, org_name: orgName };
|
|
590
|
-
}
|
|
591
|
-
function resolveCliCommandContext(inputConfig, requestedScope) {
|
|
592
|
-
let config = inputConfig;
|
|
593
|
-
if (!config) {
|
|
594
|
-
try {
|
|
595
|
-
config = resolveConfig();
|
|
596
|
-
} catch {
|
|
597
|
-
return {
|
|
598
|
-
active_organization: null,
|
|
599
|
-
auth_scope: null,
|
|
600
|
-
metadata_source: null
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
const contextForScope = (scope) => {
|
|
605
|
-
if (scope === "env") {
|
|
606
|
-
const processApiKey = process.env[API_KEY_ENV]?.trim();
|
|
607
|
-
return processApiKey && processApiKey === config.apiKey ? {
|
|
608
|
-
active_organization: activeOrganizationFromEnv(process.env),
|
|
609
|
-
auth_scope: "env",
|
|
610
|
-
metadata_source: "process_env"
|
|
611
|
-
} : null;
|
|
612
|
-
}
|
|
613
|
-
if (scope === "folder") {
|
|
614
|
-
const projectAuth = getResolvedProjectAuthSource(
|
|
615
|
-
config.baseUrl,
|
|
616
|
-
config.apiKey
|
|
617
|
-
);
|
|
618
|
-
return projectAuth ? {
|
|
619
|
-
active_organization: activeOrganizationFromEnv(projectAuth.env),
|
|
620
|
-
auth_scope: "folder",
|
|
621
|
-
metadata_source: "folder_env"
|
|
622
|
-
} : null;
|
|
623
|
-
}
|
|
624
|
-
const hostEnv = loadCliEnv(config.baseUrl);
|
|
625
|
-
return (hostEnv[API_KEY_ENV] ?? "").trim() === config.apiKey ? {
|
|
626
|
-
active_organization: activeOrganizationFromEnv(hostEnv),
|
|
627
|
-
auth_scope: "global",
|
|
628
|
-
metadata_source: "host_env"
|
|
629
|
-
} : null;
|
|
630
|
-
};
|
|
631
|
-
const processContext = contextForScope("env");
|
|
632
|
-
if (processContext) return processContext;
|
|
633
|
-
if (requestedScope) {
|
|
634
|
-
return contextForScope(requestedScope) ?? {
|
|
635
|
-
active_organization: null,
|
|
636
|
-
auth_scope: requestedScope,
|
|
637
|
-
metadata_source: null
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
for (const scope of ["folder", "global"]) {
|
|
641
|
-
const context = contextForScope(scope);
|
|
642
|
-
if (context) return context;
|
|
643
|
-
}
|
|
644
|
-
return {
|
|
645
|
-
active_organization: null,
|
|
646
|
-
auth_scope: null,
|
|
647
|
-
metadata_source: null
|
|
648
|
-
};
|
|
649
|
-
}
|
|
19
|
+
} from "./chunk-XZAFIOUQ.mjs";
|
|
650
20
|
|
|
651
21
|
// src/version.ts
|
|
652
22
|
var SDK_VERSION = SDK_RELEASE.version;
|
|
@@ -654,7 +24,7 @@ var SDK_API_MAJOR = SDK_RELEASE.contracts.api.currentMajor;
|
|
|
654
24
|
var SDK_API_CONTRACT = SDK_RELEASE.contracts.api.legacyWireIds[0] ?? `api-v${SDK_API_MAJOR}`;
|
|
655
25
|
|
|
656
26
|
// src/agent-runtime.ts
|
|
657
|
-
import { homedir
|
|
27
|
+
import { homedir } from "os";
|
|
658
28
|
var EXPLICIT_AGENT_RUNTIMES = /* @__PURE__ */ new Set([
|
|
659
29
|
"claude_code",
|
|
660
30
|
"claude_cowork",
|
|
@@ -694,12 +64,12 @@ function agentSessionIdFromEnvironment(env = process.env, agentRuntime) {
|
|
|
694
64
|
}
|
|
695
65
|
return null;
|
|
696
66
|
}
|
|
697
|
-
function
|
|
67
|
+
function isCoworkLikeSandbox() {
|
|
698
68
|
const pluginMode = truthyEnv("DEEPLINE_PLUGIN_MODE");
|
|
699
69
|
const claudeRemote = truthyEnv("CLAUDE_CODE_REMOTE");
|
|
700
70
|
const projectDir = Boolean(process.env.CLAUDE_PROJECT_DIR?.trim());
|
|
701
71
|
const pluginRoot = Boolean(process.env.DEEPLINE_PLUGIN_ROOT?.trim());
|
|
702
|
-
const home = process.env.HOME?.trim() ||
|
|
72
|
+
const home = process.env.HOME?.trim() || homedir();
|
|
703
73
|
const sessionHome = home === "/sessions" || home.startsWith("/sessions/");
|
|
704
74
|
return claudeRemote || sessionHome || (pluginMode || pluginRoot) && projectDir;
|
|
705
75
|
}
|
|
@@ -708,7 +78,7 @@ function detectAgentRuntime(options = {}) {
|
|
|
708
78
|
const explicit = normalizeAgentRuntime(env.DEEPLINE_AGENT_RUNTIME);
|
|
709
79
|
if (explicit) return explicit;
|
|
710
80
|
if (env.CODEX_THREAD_ID?.trim()) return "codex";
|
|
711
|
-
if (options.detectCowork !== false &&
|
|
81
|
+
if (options.detectCowork !== false && isCoworkLikeSandbox()) {
|
|
712
82
|
return "claude_cowork";
|
|
713
83
|
}
|
|
714
84
|
if (env.CLAUDECODE?.trim() === "1") return "claude_code";
|
|
@@ -728,134 +98,6 @@ function detectAgentRuntime(options = {}) {
|
|
|
728
98
|
return options.defaultRuntime ?? "unknown";
|
|
729
99
|
}
|
|
730
100
|
|
|
731
|
-
// src/skills-version.ts
|
|
732
|
-
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
733
|
-
import { dirname as dirname2, join as join2 } from "path";
|
|
734
|
-
function activePluginSkillsDir() {
|
|
735
|
-
const pluginMode = process.env.DEEPLINE_PLUGIN_MODE?.trim().toLowerCase();
|
|
736
|
-
if (pluginMode !== "true" && pluginMode !== "1" && pluginMode !== "yes" && pluginMode !== "on") {
|
|
737
|
-
return "";
|
|
738
|
-
}
|
|
739
|
-
const dir = process.env.DEEPLINE_PLUGIN_SKILLS_DIR?.trim() ?? "";
|
|
740
|
-
return dir && existsSync2(dir) ? dir : "";
|
|
741
|
-
}
|
|
742
|
-
function hasActivePluginSkills() {
|
|
743
|
-
return Boolean(activePluginSkillsDir());
|
|
744
|
-
}
|
|
745
|
-
function readPluginSkillsVersion() {
|
|
746
|
-
const dir = activePluginSkillsDir();
|
|
747
|
-
if (!dir) return "";
|
|
748
|
-
try {
|
|
749
|
-
return readFileSync2(join2(dir, ".version"), "utf-8").trim();
|
|
750
|
-
} catch {
|
|
751
|
-
return "";
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
var KNOWN_SKILL_AGENTS = [
|
|
755
|
-
"antigravity",
|
|
756
|
-
"claude-code",
|
|
757
|
-
"cline",
|
|
758
|
-
"codex",
|
|
759
|
-
"cursor",
|
|
760
|
-
"gemini-cli",
|
|
761
|
-
"windsurf"
|
|
762
|
-
];
|
|
763
|
-
var DEFAULT_SKILL_AGENTS = [
|
|
764
|
-
"codex",
|
|
765
|
-
"claude-code",
|
|
766
|
-
"cursor",
|
|
767
|
-
"gemini-cli",
|
|
768
|
-
"antigravity"
|
|
769
|
-
];
|
|
770
|
-
function skillsAgentPathSegment(agent) {
|
|
771
|
-
if (agent === "*") return "all";
|
|
772
|
-
const slug = agent.replace(/[^a-z0-9]+/gi, "-").replace(/^-+|-+$/g, "");
|
|
773
|
-
return slug || "agent";
|
|
774
|
-
}
|
|
775
|
-
function sdkSkillsVersionPath(baseUrl, agents = []) {
|
|
776
|
-
const suffix = agents.length > 0 ? `-${agents.map(skillsAgentPathSegment).join("-")}` : "";
|
|
777
|
-
return join2(sdkCliStateDirPath(baseUrl), `skills${suffix}-version`);
|
|
778
|
-
}
|
|
779
|
-
function legacySdkSkillsVersionPath(baseUrl) {
|
|
780
|
-
return join2(dirname2(sdkCliStateDirPath(baseUrl)), "sdk-skills", ".version");
|
|
781
|
-
}
|
|
782
|
-
function readSkillsVersionFile(path) {
|
|
783
|
-
try {
|
|
784
|
-
return readFileSync2(path, "utf-8").trim();
|
|
785
|
-
} catch {
|
|
786
|
-
return "";
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
function resolveAutoSyncSkillAgents() {
|
|
790
|
-
switch (detectAgentRuntime()) {
|
|
791
|
-
case "codex":
|
|
792
|
-
return ["codex"];
|
|
793
|
-
case "claude_code":
|
|
794
|
-
return ["claude-code"];
|
|
795
|
-
case "cursor":
|
|
796
|
-
return ["cursor"];
|
|
797
|
-
case "gemini":
|
|
798
|
-
return ["gemini-cli"];
|
|
799
|
-
case "antigravity":
|
|
800
|
-
return ["antigravity"];
|
|
801
|
-
case "unknown":
|
|
802
|
-
return [...DEFAULT_SKILL_AGENTS];
|
|
803
|
-
default:
|
|
804
|
-
return [];
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
function readSdkSkillsLocalVersion(baseUrl) {
|
|
808
|
-
const pluginVersion = readPluginSkillsVersion();
|
|
809
|
-
if (pluginVersion) return pluginVersion;
|
|
810
|
-
const agents = resolveAutoSyncSkillAgents();
|
|
811
|
-
if (agents.length > 1) {
|
|
812
|
-
const versions = agents.map(
|
|
813
|
-
(agent) => readSkillsVersionFile(sdkSkillsVersionPath(baseUrl, [agent]))
|
|
814
|
-
);
|
|
815
|
-
const first = versions[0];
|
|
816
|
-
return first && versions.every((version) => version === first) ? first : "";
|
|
817
|
-
}
|
|
818
|
-
const scopedPath = sdkSkillsVersionPath(baseUrl, agents);
|
|
819
|
-
if (agents.length > 0 && existsSync2(scopedPath)) {
|
|
820
|
-
try {
|
|
821
|
-
return readFileSync2(scopedPath, "utf-8").trim();
|
|
822
|
-
} catch {
|
|
823
|
-
return "";
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
if (agents.length > 0) {
|
|
827
|
-
const legacyPath = legacySdkSkillsVersionPath(baseUrl);
|
|
828
|
-
if (!existsSync2(legacyPath)) return "";
|
|
829
|
-
try {
|
|
830
|
-
return readFileSync2(legacyPath, "utf-8").trim();
|
|
831
|
-
} catch {
|
|
832
|
-
return "";
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
const path = existsSync2(sdkSkillsVersionPath(baseUrl)) ? sdkSkillsVersionPath(baseUrl) : legacySdkSkillsVersionPath(baseUrl);
|
|
836
|
-
if (!existsSync2(path)) return "";
|
|
837
|
-
try {
|
|
838
|
-
return readFileSync2(path, "utf-8").trim();
|
|
839
|
-
} catch {
|
|
840
|
-
return "";
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
function writeSdkSkillsLocalVersion(baseUrl, version, agents) {
|
|
844
|
-
const targets = agents.length > 1 ? agents.map((agent) => [agent]) : [agents];
|
|
845
|
-
let complete = true;
|
|
846
|
-
for (const target of targets) {
|
|
847
|
-
const path = sdkSkillsVersionPath(baseUrl, target);
|
|
848
|
-
try {
|
|
849
|
-
mkdirSync2(dirname2(path), { recursive: true });
|
|
850
|
-
writeFileSync2(path, `${version}
|
|
851
|
-
`, "utf-8");
|
|
852
|
-
} catch {
|
|
853
|
-
complete = false;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
return complete;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
101
|
// src/deployment-protection.ts
|
|
860
102
|
function deploymentProtectionHeaders(env = typeof process !== "undefined" ? process.env : {}) {
|
|
861
103
|
const token = env.VERCEL_PROTECTION_BYPASS_TOKEN;
|
|
@@ -886,6 +128,7 @@ var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
|
|
|
886
128
|
// ../play-runtime/test-runtime-seams.ts
|
|
887
129
|
var PLAY_RUNTIME_TEST_FAULT_HEADER = "x-deepline-test-fault";
|
|
888
130
|
var MAX_RUNTIME_TEST_POLICY_MS = 10 * 6e4;
|
|
131
|
+
var MAX_RUNNER_HEARTBEAT_SILENCE_MS = 10 * 6e4;
|
|
889
132
|
|
|
890
133
|
// ../integration-contracts/execute-retry-contract.ts
|
|
891
134
|
var EXECUTE_RETRY_POLICY_HEADER = "x-deepline-execute-retry-policy";
|
|
@@ -901,7 +144,7 @@ function parseExecuteRetryPolicy(value) {
|
|
|
901
144
|
}
|
|
902
145
|
var ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER = "x-deepline-atomic-tool-supported";
|
|
903
146
|
|
|
904
|
-
// src/http.ts
|
|
147
|
+
// src/http-core.ts
|
|
905
148
|
var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
|
|
906
149
|
var COWORK_NETWORK_HINT = "Claude Cowork appears to be running Deepline in a network-restricted sandbox. In Claude Desktop, open Settings > Capabilities, turn on Allow network egress, and set Domain allowlist to All domains for the Cowork session.";
|
|
907
150
|
var REQUEST_TIMEOUT_MARKER = Symbol("deeplineRequestTimeout");
|
|
@@ -997,8 +240,9 @@ function isRecord(value) {
|
|
|
997
240
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
998
241
|
}
|
|
999
242
|
var HttpClient = class {
|
|
1000
|
-
constructor(config) {
|
|
243
|
+
constructor(config, readLocalSkillsVersion) {
|
|
1001
244
|
this.config = config;
|
|
245
|
+
this.readLocalSkillsVersion = readLocalSkillsVersion;
|
|
1002
246
|
}
|
|
1003
247
|
cleanDiagnosticHeader(value) {
|
|
1004
248
|
const normalized = String(value ?? "").replace(/[\u0000-\u001f\u007f]/g, " ").trim().slice(0, MAX_DIAGNOSTIC_HEADER_LENGTH);
|
|
@@ -1014,7 +258,7 @@ var HttpClient = class {
|
|
|
1014
258
|
if (explicit) return explicit;
|
|
1015
259
|
try {
|
|
1016
260
|
return this.cleanDiagnosticHeader(
|
|
1017
|
-
|
|
261
|
+
this.readLocalSkillsVersion?.(this.config.baseUrl)
|
|
1018
262
|
);
|
|
1019
263
|
} catch {
|
|
1020
264
|
return null;
|
|
@@ -1635,14 +879,14 @@ function decodeSseFrame(frame) {
|
|
|
1635
879
|
return parsed;
|
|
1636
880
|
}
|
|
1637
881
|
function sleep(ms, signal) {
|
|
1638
|
-
return new Promise((
|
|
882
|
+
return new Promise((resolve, reject) => {
|
|
1639
883
|
if (signal?.aborted) {
|
|
1640
884
|
reject(requestCancelledError(signal));
|
|
1641
885
|
return;
|
|
1642
886
|
}
|
|
1643
887
|
const timeoutId = setTimeout(() => {
|
|
1644
888
|
signal?.removeEventListener("abort", abort);
|
|
1645
|
-
|
|
889
|
+
resolve();
|
|
1646
890
|
}, ms);
|
|
1647
891
|
const abort = () => {
|
|
1648
892
|
clearTimeout(timeoutId);
|
|
@@ -1653,7 +897,7 @@ function sleep(ms, signal) {
|
|
|
1653
897
|
});
|
|
1654
898
|
}
|
|
1655
899
|
function withCoworkNetworkHint(message) {
|
|
1656
|
-
if (!
|
|
900
|
+
if (!isCoworkLikeSandbox() || message.includes(COWORK_NETWORK_HINT)) {
|
|
1657
901
|
return message;
|
|
1658
902
|
}
|
|
1659
903
|
return `${message}
|
|
@@ -1661,50 +905,16 @@ ${COWORK_NETWORK_HINT}`;
|
|
|
1661
905
|
}
|
|
1662
906
|
|
|
1663
907
|
export {
|
|
1664
|
-
HOST_URL_ENV,
|
|
1665
|
-
API_KEY_ENV,
|
|
1666
|
-
ACTIVE_ORG_ID_ENV,
|
|
1667
|
-
ACTIVE_ORG_NAME_ENV,
|
|
1668
|
-
FEATURES_ENV,
|
|
1669
|
-
PROD_URL,
|
|
1670
|
-
featureEnvValues,
|
|
1671
|
-
storedHostApiKey,
|
|
1672
|
-
storedHostFeatures,
|
|
1673
|
-
baseUrlSlug,
|
|
1674
|
-
sdkCliStateDirPath,
|
|
1675
|
-
hostConfigDirPath,
|
|
1676
|
-
hostEnvFilePath,
|
|
1677
|
-
saveHostEnvValues,
|
|
1678
|
-
autoDetectBaseUrl,
|
|
1679
|
-
resolveApiKeyForBaseUrl,
|
|
1680
|
-
resolveProjectApiKeyForBaseUrl,
|
|
1681
|
-
resolveGlobalApiKeyForBaseUrl,
|
|
1682
|
-
getResolvedProjectAuthSource,
|
|
1683
|
-
resolveBaseUrlOnly,
|
|
1684
|
-
resolveConfig,
|
|
1685
|
-
ensureProjectPrivatePathsIgnored,
|
|
1686
|
-
saveProjectDeeplineEnvValues,
|
|
1687
|
-
resolveProjectPinTarget,
|
|
1688
|
-
getActiveProjectAuthSource,
|
|
1689
|
-
resolveCliAuthProvenance,
|
|
1690
|
-
resolveCliCommandContext,
|
|
1691
908
|
ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER,
|
|
1692
909
|
SDK_VERSION,
|
|
1693
910
|
SDK_API_MAJOR,
|
|
1694
911
|
SDK_API_CONTRACT,
|
|
912
|
+
COORDINATOR_INTERNAL_TOKEN_HEADER,
|
|
913
|
+
RUNTIME_ENVIRONMENT_TOKEN_HEADER,
|
|
914
|
+
RETAINED_PIPELINE_RECEIVERS_HEADER,
|
|
1695
915
|
agentSessionIdFromEnvironment,
|
|
1696
916
|
detectAgentRuntime,
|
|
1697
|
-
hasActivePluginSkills,
|
|
1698
|
-
KNOWN_SKILL_AGENTS,
|
|
1699
|
-
DEFAULT_SKILL_AGENTS,
|
|
1700
|
-
skillsAgentPathSegment,
|
|
1701
|
-
resolveAutoSyncSkillAgents,
|
|
1702
|
-
readSdkSkillsLocalVersion,
|
|
1703
|
-
writeSdkSkillsLocalVersion,
|
|
1704
917
|
deploymentProtectionHeaders,
|
|
1705
918
|
fetchWithDeploymentProtection,
|
|
1706
|
-
COORDINATOR_INTERNAL_TOKEN_HEADER,
|
|
1707
|
-
RUNTIME_ENVIRONMENT_TOKEN_HEADER,
|
|
1708
|
-
RETAINED_PIPELINE_RECEIVERS_HEADER,
|
|
1709
919
|
HttpClient
|
|
1710
920
|
};
|