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,1710 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkALJJRZNJjs = require('./chunk-ALJJRZNJ.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _chunkXNYIZMNQjs = require('./chunk-XNYIZMNQ.js');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _chunkDIAWYWT5js = require('./chunk-DIAWYWT5.js');
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _chunkRBTTUYZZjs = require('./chunk-RBTTUYZZ.js');
|
|
21
|
-
|
|
22
|
-
// src/config.ts
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var _fs = require('fs');
|
|
32
|
-
var _os = require('os');
|
|
33
|
-
var _path = require('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 _nullishCoalesce(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 (e) {
|
|
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 (!_fs.existsSync.call(void 0, filePath)) return {};
|
|
97
|
-
const env = {};
|
|
98
|
-
const content = _fs.readFileSync.call(void 0, 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 (e2) {
|
|
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 = _path.resolve.call(void 0, startDir);
|
|
123
|
-
while (true) {
|
|
124
|
-
const filePath = _path.join.call(void 0, current, name);
|
|
125
|
-
if (_fs.existsSync.call(void 0, filePath)) return filePath;
|
|
126
|
-
const parent = _path.dirname.call(void 0, current);
|
|
127
|
-
if (parent === current) return null;
|
|
128
|
-
current = parent;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function isDirectory(path) {
|
|
132
|
-
try {
|
|
133
|
-
return _fs.statSync.call(void 0, path).isDirectory();
|
|
134
|
-
} catch (e3) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
function canonicalPath(path) {
|
|
139
|
-
try {
|
|
140
|
-
return _fs.realpathSync.call(void 0, path);
|
|
141
|
-
} catch (e4) {
|
|
142
|
-
return _path.resolve.call(void 0, path);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function isTruthy(value) {
|
|
146
|
-
return /^(1|true|yes|on)$/i.test(_nullishCoalesce(_optionalChain([value, 'optionalAccess', _ => _.trim, 'call', _2 => _2()]), () => ( "")));
|
|
147
|
-
}
|
|
148
|
-
function sessionRootFromPath(path) {
|
|
149
|
-
const trimmed = _optionalChain([path, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()]);
|
|
150
|
-
if (!trimmed) return null;
|
|
151
|
-
const match = /^\/sessions\/[^/]+(?=\/|$)/.exec(trimmed);
|
|
152
|
-
return _nullishCoalesce(_optionalChain([match, 'optionalAccess', _5 => _5[0]]), () => ( null));
|
|
153
|
-
}
|
|
154
|
-
function coworkSessionRoot() {
|
|
155
|
-
const home = _optionalChain([process, 'access', _6 => _6.env, 'access', _7 => _7.HOME, 'optionalAccess', _8 => _8.trim, 'call', _9 => _9()]);
|
|
156
|
-
const homeSessionRoot = sessionRootFromPath(home);
|
|
157
|
-
if (homeSessionRoot && isDirectory(_path.join.call(void 0, homeSessionRoot, "mnt"))) {
|
|
158
|
-
return homeSessionRoot;
|
|
159
|
-
}
|
|
160
|
-
const cwdSessionRoot = sessionRootFromPath(process.cwd());
|
|
161
|
-
if (cwdSessionRoot && isDirectory(_path.join.call(void 0, cwdSessionRoot, "mnt"))) {
|
|
162
|
-
return cwdSessionRoot;
|
|
163
|
-
}
|
|
164
|
-
if (isTruthy(process.env.CLAUDE_CODE_REMOTE) && home) {
|
|
165
|
-
const mountedRoot = _path.join.call(void 0, home, "mnt");
|
|
166
|
-
if (isDirectory(mountedRoot)) return _path.resolve.call(void 0, home);
|
|
167
|
-
}
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
function isCoworkLikeSandbox() {
|
|
171
|
-
const home = _optionalChain([process, 'access', _10 => _10.env, 'access', _11 => _11.HOME, 'optionalAccess', _12 => _12.trim, 'call', _13 => _13()]);
|
|
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 (_fs.existsSync.call(void 0, _path.join.call(void 0, path, marker))) score += 1;
|
|
178
|
-
}
|
|
179
|
-
return score;
|
|
180
|
-
}
|
|
181
|
-
function listCoworkWorkspaceDirCandidates() {
|
|
182
|
-
if (!isCoworkLikeSandbox()) {
|
|
183
|
-
return [];
|
|
184
|
-
}
|
|
185
|
-
const explicitProjectDir = _optionalChain([process, 'access', _14 => _14.env, 'access', _15 => _15.CLAUDE_PROJECT_DIR, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()]);
|
|
186
|
-
if (explicitProjectDir && isDirectory(explicitProjectDir)) {
|
|
187
|
-
return [_path.resolve.call(void 0, explicitProjectDir)];
|
|
188
|
-
}
|
|
189
|
-
const sessionRoot = coworkSessionRoot();
|
|
190
|
-
if (!sessionRoot) return [];
|
|
191
|
-
const mountedRoot = _path.join.call(void 0, sessionRoot, "mnt");
|
|
192
|
-
if (!isDirectory(mountedRoot)) return [];
|
|
193
|
-
let names;
|
|
194
|
-
try {
|
|
195
|
-
names = _fs.readdirSync.call(void 0, mountedRoot).sort();
|
|
196
|
-
} catch (e5) {
|
|
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 = _path.join.call(void 0, 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(_path.join.call(void 0, 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(_path.resolve.call(void 0, nearestFile), "nearest");
|
|
235
|
-
}
|
|
236
|
-
const coworkWorkspaceDir = detectCoworkWorkspaceDir();
|
|
237
|
-
if (coworkWorkspaceDir) {
|
|
238
|
-
const coworkFile = _path.join.call(void 0, coworkWorkspaceDir, PROJECT_DEEPLINE_ENV_FILE);
|
|
239
|
-
if (_fs.existsSync.call(void 0, coworkFile) && !filePaths.some((filePath) => _path.resolve.call(void 0, filePath) === _path.resolve.call(void 0, coworkFile))) {
|
|
240
|
-
filePaths.push(coworkFile);
|
|
241
|
-
sources.set(_path.resolve.call(void 0, coworkFile), "cowork");
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return filePaths.map((filePath) => ({
|
|
245
|
-
filePath,
|
|
246
|
-
env: parseEnvFile(filePath),
|
|
247
|
-
source: _nullishCoalesce(sources.get(_path.resolve.call(void 0, filePath)), () => ( "nearest"))
|
|
248
|
-
}));
|
|
249
|
-
}
|
|
250
|
-
function normalizeBaseUrl(baseUrl) {
|
|
251
|
-
const trimmed = _nullishCoalesce(_optionalChain([baseUrl, 'optionalAccess', _18 => _18.trim, 'call', _19 => _19(), 'access', _20 => _20.replace, 'call', _21 => _21(/\/+$/, "")]), () => ( ""));
|
|
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 (e6) {
|
|
260
|
-
return "";
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
function firstNonEmpty(...values) {
|
|
264
|
-
for (const value of values) {
|
|
265
|
-
const trimmed = _optionalChain([value, 'optionalAccess', _22 => _22.trim, 'call', _23 => _23()]);
|
|
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 = _optionalChain([process, 'access', _24 => _24.env, 'access', _25 => _25.HOME, 'optionalAccess', _26 => _26.trim, 'call', _27 => _27()]) || _os.homedir.call(void 0, );
|
|
293
|
-
return _path.join.call(void 0, home, ".local", "deepline", baseUrlSlug(baseUrl || PROD_URL));
|
|
294
|
-
}
|
|
295
|
-
function sdkCliStateDirPath(baseUrl, homeDir = _optionalChain([process, 'access', _28 => _28.env, 'access', _29 => _29.HOME, 'optionalAccess', _30 => _30.trim, 'call', _31 => _31()]) || _os.homedir.call(void 0, )) {
|
|
296
|
-
return _path.join.call(void 0,
|
|
297
|
-
homeDir,
|
|
298
|
-
".local",
|
|
299
|
-
"deepline",
|
|
300
|
-
baseUrlSlug(baseUrl || PROD_URL),
|
|
301
|
-
"sdk-cli"
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
function sdkCliEnvFilePath(baseUrl) {
|
|
305
|
-
return _path.join.call(void 0, 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 = _path.dirname.call(void 0, filePath);
|
|
319
|
-
if (!_fs.existsSync.call(void 0, dir)) {
|
|
320
|
-
_fs.mkdirSync.call(void 0, dir, { recursive: true });
|
|
321
|
-
}
|
|
322
|
-
const existing = parseEnvFile(filePath);
|
|
323
|
-
const merged = mergePersistedEnvValues(existing, values);
|
|
324
|
-
const lines = persistedEnvLines(merged);
|
|
325
|
-
_fs.writeFileSync.call(void 0, 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(_nullishCoalesce(process.env[HOST_URL_ENV], () => ( ""))) || firstNonEmpty(
|
|
335
|
-
...projectEnvs.map(({ env }) => normalizeBaseUrl(env[HOST_URL_ENV]))
|
|
336
|
-
) || normalizeBaseUrl(_nullishCoalesce(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(_nullishCoalesce(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(_nullishCoalesce(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 _nullishCoalesce(loadProjectEnvCandidates(startDir).find(({ env }) => {
|
|
372
|
-
const projectBaseUrl = normalizeBaseUrl(_nullishCoalesce(env[HOST_URL_ENV], () => ( "")));
|
|
373
|
-
return projectBaseUrl === normalizedBaseUrl && (_nullishCoalesce(env[API_KEY_ENV], () => ( ""))).trim() === normalizedApiKey;
|
|
374
|
-
}), () => ( null));
|
|
375
|
-
}
|
|
376
|
-
function resolveBaseUrlOnly(options) {
|
|
377
|
-
const baseUrl = normalizeBaseUrl(
|
|
378
|
-
_optionalChain([options, 'optionalAccess', _32 => _32.baseUrl, 'optionalAccess', _33 => _33.trim, 'call', _34 => _34()]) || autoDetectBaseUrl()
|
|
379
|
-
);
|
|
380
|
-
if (!baseUrl) {
|
|
381
|
-
throw new (0, _chunkALJJRZNJjs.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
|
-
_optionalChain([options, 'optionalAccess', _35 => _35.baseUrl, 'optionalAccess', _36 => _36.trim, 'call', _37 => _37()]) || autoDetectBaseUrl()
|
|
390
|
-
);
|
|
391
|
-
if (!baseUrl) {
|
|
392
|
-
throw new (0, _chunkALJJRZNJjs.ConfigError)(
|
|
393
|
-
`Invalid ${HOST_URL_ENV}. Expected an http(s) URL such as https://code.deepline.com.`
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
const apiKey = resolveApiKeyForBaseUrl(baseUrl, _optionalChain([options, 'optionalAccess', _38 => _38.apiKey]));
|
|
397
|
-
if (!apiKey) {
|
|
398
|
-
throw new (0, _chunkALJJRZNJjs.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: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _39 => _39.timeout]), () => ( DEFAULT_TIMEOUT)),
|
|
406
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _40 => _40.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
|
-
..._optionalChain([options, 'optionalAccess', _41 => _41.headers]) ? { headers: { ...options.headers } } : {},
|
|
410
|
-
..._optionalChain([options, 'optionalAccess', _42 => _42.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 = _path.dirname.call(void 0, filePath);
|
|
417
|
-
if (!_fs.existsSync.call(void 0, dir)) _fs.mkdirSync.call(void 0, dir, { recursive: true });
|
|
418
|
-
ensureProjectEnvIsIgnored(dir);
|
|
419
|
-
const lines = persistedEnvLines(merged);
|
|
420
|
-
_fs.writeFileSync.call(void 0, 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 = _path.join.call(void 0, gitDir, "info", "exclude");
|
|
433
|
-
const existing2 = _fs.existsSync.call(void 0, excludePath) ? _fs.readFileSync.call(void 0, 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
|
-
_fs.mkdirSync.call(void 0, _path.dirname.call(void 0, excludePath), { recursive: true });
|
|
442
|
-
const prefix2 = existing2 && !existing2.endsWith("\n") ? "\n" : "";
|
|
443
|
-
_fs.writeFileSync.call(void 0,
|
|
444
|
-
excludePath,
|
|
445
|
-
`${existing2}${prefix2}${missing2.join("\n")}
|
|
446
|
-
`,
|
|
447
|
-
"utf-8"
|
|
448
|
-
);
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
const gitignorePath = _path.join.call(void 0, dir, ".gitignore");
|
|
452
|
-
const existing = _fs.existsSync.call(void 0, gitignorePath) ? _fs.readFileSync.call(void 0, 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
|
-
_fs.writeFileSync.call(void 0,
|
|
462
|
-
gitignorePath,
|
|
463
|
-
`${existing}${prefix}${missing.join("\n")}
|
|
464
|
-
`,
|
|
465
|
-
"utf-8"
|
|
466
|
-
);
|
|
467
|
-
}
|
|
468
|
-
function findNearestGitCommonDir(startDir) {
|
|
469
|
-
let current = _path.resolve.call(void 0, startDir);
|
|
470
|
-
while (true) {
|
|
471
|
-
const candidate = _path.join.call(void 0, current, ".git");
|
|
472
|
-
if (_fs.existsSync.call(void 0, candidate)) {
|
|
473
|
-
try {
|
|
474
|
-
const stat = _fs.statSync.call(void 0, candidate);
|
|
475
|
-
if (stat.isDirectory()) return candidate;
|
|
476
|
-
if (stat.isFile()) {
|
|
477
|
-
const match = _fs.readFileSync.call(void 0, candidate, "utf8").match(
|
|
478
|
-
/^gitdir:\s*(.+)$/m
|
|
479
|
-
);
|
|
480
|
-
const rawGitDir = _optionalChain([match, 'optionalAccess', _43 => _43[1], 'optionalAccess', _44 => _44.trim, 'call', _45 => _45()]);
|
|
481
|
-
if (rawGitDir) {
|
|
482
|
-
const gitDir = _path.isAbsolute.call(void 0, rawGitDir) ? rawGitDir : _path.resolve.call(void 0, _path.dirname.call(void 0, candidate), rawGitDir);
|
|
483
|
-
const commonDirPath = _path.join.call(void 0, gitDir, "commondir");
|
|
484
|
-
if (!_fs.existsSync.call(void 0, commonDirPath)) return gitDir;
|
|
485
|
-
const rawCommonDir = _fs.readFileSync.call(void 0, commonDirPath, "utf8").trim();
|
|
486
|
-
return rawCommonDir ? _path.isAbsolute.call(void 0, rawCommonDir) ? rawCommonDir : _path.resolve.call(void 0, gitDir, rawCommonDir) : gitDir;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
} catch (e7) {
|
|
490
|
-
return null;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
const parent = _path.dirname.call(void 0, 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 (0, _chunkALJJRZNJjs.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 = _path.join.call(void 0, 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: _path.dirname.call(void 0, 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: _path.resolve.call(void 0, startDir), source: "cwd" };
|
|
536
|
-
}
|
|
537
|
-
function getActiveProjectAuthSource(startDir = process.cwd()) {
|
|
538
|
-
return _nullishCoalesce(loadProjectEnvCandidates(startDir)[0], () => ( null));
|
|
539
|
-
}
|
|
540
|
-
function findNearestProjectMarkerDir(startDir) {
|
|
541
|
-
let current = _path.resolve.call(void 0, startDir);
|
|
542
|
-
while (true) {
|
|
543
|
-
if (COWORK_PROJECT_MARKERS.some((marker) => _fs.existsSync.call(void 0, _path.join.call(void 0, current, marker)))) {
|
|
544
|
-
return current;
|
|
545
|
-
}
|
|
546
|
-
const parent = _path.dirname.call(void 0, current);
|
|
547
|
-
if (parent === current) return null;
|
|
548
|
-
current = parent;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
function resolveCliAuthProvenance(config, startDir = process.cwd()) {
|
|
552
|
-
const envApiKey = _optionalChain([process, 'access', _46 => _46.env, 'access', _47 => _47[API_KEY_ENV], 'optionalAccess', _48 => _48.trim, 'call', _49 => _49()]);
|
|
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: _path.dirname.call(void 0, folderAuth.filePath),
|
|
566
|
-
pinPath: folderAuth.filePath,
|
|
567
|
-
source: "folder"
|
|
568
|
-
} : pinTarget.source === "cowork" ? {
|
|
569
|
-
state: "project",
|
|
570
|
-
dir: pinTarget.dir,
|
|
571
|
-
pinPath: _path.join.call(void 0, pinTarget.dir, PROJECT_DEEPLINE_ENV_FILE),
|
|
572
|
-
source: "cowork"
|
|
573
|
-
} : markerDir ? {
|
|
574
|
-
state: "project",
|
|
575
|
-
dir: markerDir,
|
|
576
|
-
pinPath: _path.join.call(void 0, 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: _nullishCoalesce(_optionalChain([folderAuth, 'optionalAccess', _50 => _50.filePath]), () => ( null))
|
|
583
|
-
};
|
|
584
|
-
}
|
|
585
|
-
function activeOrganizationFromEnv(env) {
|
|
586
|
-
const orgId = _optionalChain([env, 'access', _51 => _51[ACTIVE_ORG_ID_ENV], 'optionalAccess', _52 => _52.trim, 'call', _53 => _53()]);
|
|
587
|
-
if (!orgId) return null;
|
|
588
|
-
const orgName = _optionalChain([env, 'access', _54 => _54[ACTIVE_ORG_NAME_ENV], 'optionalAccess', _55 => _55.trim, 'call', _56 => _56()]) || 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 (e8) {
|
|
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 = _optionalChain([process, 'access', _57 => _57.env, 'access', _58 => _58[API_KEY_ENV], 'optionalAccess', _59 => _59.trim, 'call', _60 => _60()]);
|
|
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 (_nullishCoalesce(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 _nullishCoalesce(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
|
-
}
|
|
650
|
-
|
|
651
|
-
// src/version.ts
|
|
652
|
-
var SDK_VERSION = _chunkRBTTUYZZjs.SDK_RELEASE.version;
|
|
653
|
-
var SDK_API_MAJOR = _chunkRBTTUYZZjs.SDK_RELEASE.contracts.api.currentMajor;
|
|
654
|
-
var SDK_API_CONTRACT = _nullishCoalesce(_chunkRBTTUYZZjs.SDK_RELEASE.contracts.api.legacyWireIds[0], () => ( `api-v${SDK_API_MAJOR}`));
|
|
655
|
-
|
|
656
|
-
// src/agent-runtime.ts
|
|
657
|
-
|
|
658
|
-
var EXPLICIT_AGENT_RUNTIMES = /* @__PURE__ */ new Set([
|
|
659
|
-
"claude_code",
|
|
660
|
-
"claude_cowork",
|
|
661
|
-
"codex",
|
|
662
|
-
"cline",
|
|
663
|
-
"cursor",
|
|
664
|
-
"gemini",
|
|
665
|
-
"antigravity",
|
|
666
|
-
"windsurf",
|
|
667
|
-
"unknown"
|
|
668
|
-
]);
|
|
669
|
-
function truthyEnv(name) {
|
|
670
|
-
return ["1", "true", "yes", "on"].includes(
|
|
671
|
-
String(_nullishCoalesce(process.env[name], () => ( ""))).trim().toLowerCase()
|
|
672
|
-
);
|
|
673
|
-
}
|
|
674
|
-
function normalizeAgentRuntime(value) {
|
|
675
|
-
const explicit = _optionalChain([value, 'optionalAccess', _61 => _61.trim, 'call', _62 => _62(), 'access', _63 => _63.toLowerCase, 'call', _64 => _64(), 'access', _65 => _65.replace, 'call', _66 => _66(/-/g, "_")]);
|
|
676
|
-
if (!explicit) return null;
|
|
677
|
-
if (explicit === "gemini_cli") return "gemini";
|
|
678
|
-
return EXPLICIT_AGENT_RUNTIMES.has(explicit) ? explicit : null;
|
|
679
|
-
}
|
|
680
|
-
var AGENT_SESSION_ID_VARIABLES = [
|
|
681
|
-
"CLAUDE_CODE_SESSION_ID",
|
|
682
|
-
"CODEX_SESSION_ID",
|
|
683
|
-
"CODEX_THREAD_ID"
|
|
684
|
-
];
|
|
685
|
-
function agentSessionIdFromEnvironment(env = process.env, agentRuntime) {
|
|
686
|
-
const detectedRuntime = normalizeAgentRuntime(
|
|
687
|
-
_nullishCoalesce(agentRuntime, () => ( env.DEEPLINE_AGENT_RUNTIME))
|
|
688
|
-
);
|
|
689
|
-
const runtime = _nullishCoalesce((detectedRuntime === "unknown" ? null : detectedRuntime), () => ( (_optionalChain([env, 'access', _67 => _67.CODEX_SESSION_ID, 'optionalAccess', _68 => _68.trim, 'call', _69 => _69()]) || _optionalChain([env, 'access', _70 => _70.CODEX_THREAD_ID, 'optionalAccess', _71 => _71.trim, 'call', _72 => _72()]) ? "codex" : null)));
|
|
690
|
-
const variables = runtime === "codex" ? ["CODEX_SESSION_ID", "CODEX_THREAD_ID"] : runtime === "claude_code" || runtime === "claude_cowork" ? ["CLAUDE_CODE_SESSION_ID"] : runtime === null ? AGENT_SESSION_ID_VARIABLES : [];
|
|
691
|
-
for (const variable of variables) {
|
|
692
|
-
const sessionId = _optionalChain([env, 'access', _73 => _73[variable], 'optionalAccess', _74 => _74.trim, 'call', _75 => _75()]);
|
|
693
|
-
if (sessionId) return sessionId;
|
|
694
|
-
}
|
|
695
|
-
return null;
|
|
696
|
-
}
|
|
697
|
-
function isCoworkLikeSandbox2() {
|
|
698
|
-
const pluginMode = truthyEnv("DEEPLINE_PLUGIN_MODE");
|
|
699
|
-
const claudeRemote = truthyEnv("CLAUDE_CODE_REMOTE");
|
|
700
|
-
const projectDir = Boolean(_optionalChain([process, 'access', _76 => _76.env, 'access', _77 => _77.CLAUDE_PROJECT_DIR, 'optionalAccess', _78 => _78.trim, 'call', _79 => _79()]));
|
|
701
|
-
const pluginRoot = Boolean(_optionalChain([process, 'access', _80 => _80.env, 'access', _81 => _81.DEEPLINE_PLUGIN_ROOT, 'optionalAccess', _82 => _82.trim, 'call', _83 => _83()]));
|
|
702
|
-
const home = _optionalChain([process, 'access', _84 => _84.env, 'access', _85 => _85.HOME, 'optionalAccess', _86 => _86.trim, 'call', _87 => _87()]) || _os.homedir.call(void 0, );
|
|
703
|
-
const sessionHome = home === "/sessions" || home.startsWith("/sessions/");
|
|
704
|
-
return claudeRemote || sessionHome || (pluginMode || pluginRoot) && projectDir;
|
|
705
|
-
}
|
|
706
|
-
function detectAgentRuntime(options = {}) {
|
|
707
|
-
const env = _nullishCoalesce(options.env, () => ( process.env));
|
|
708
|
-
const explicit = normalizeAgentRuntime(env.DEEPLINE_AGENT_RUNTIME);
|
|
709
|
-
if (explicit) return explicit;
|
|
710
|
-
if (_optionalChain([env, 'access', _88 => _88.CODEX_THREAD_ID, 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()])) return "codex";
|
|
711
|
-
if (options.detectCowork !== false && isCoworkLikeSandbox2()) {
|
|
712
|
-
return "claude_cowork";
|
|
713
|
-
}
|
|
714
|
-
if (_optionalChain([env, 'access', _91 => _91.CLAUDECODE, 'optionalAccess', _92 => _92.trim, 'call', _93 => _93()]) === "1") return "claude_code";
|
|
715
|
-
if (_optionalChain([env, 'access', _94 => _94.CLINE_ACTIVE, 'optionalAccess', _95 => _95.trim, 'call', _96 => _96(), 'access', _97 => _97.toLowerCase, 'call', _98 => _98()]) === "true") return "cline";
|
|
716
|
-
if (_optionalChain([env, 'access', _99 => _99.CURSOR_TRACE_ID, 'optionalAccess', _100 => _100.trim, 'call', _101 => _101()]) || _optionalChain([env, 'access', _102 => _102.CURSOR_AGENT, 'optionalAccess', _103 => _103.trim, 'call', _104 => _104()])) {
|
|
717
|
-
return "cursor";
|
|
718
|
-
}
|
|
719
|
-
if (_optionalChain([env, 'access', _105 => _105.WINDSURF, 'optionalAccess', _106 => _106.trim, 'call', _107 => _107()]) || _optionalChain([env, 'access', _108 => _108.CASCADE, 'optionalAccess', _109 => _109.trim, 'call', _110 => _110()])) {
|
|
720
|
-
return "windsurf";
|
|
721
|
-
}
|
|
722
|
-
if (_optionalChain([env, 'access', _111 => _111.ANTIGRAVITY, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()]) || _optionalChain([env, 'access', _114 => _114.ANTIGRAVITY_CLI, 'optionalAccess', _115 => _115.trim, 'call', _116 => _116()]) || _optionalChain([env, 'access', _117 => _117.ANTIGRAVITY_AGENT, 'optionalAccess', _118 => _118.trim, 'call', _119 => _119()]) || _optionalChain([env, 'access', _120 => _120.ANTIGRAVITY_WORKSPACE, 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()])) {
|
|
723
|
-
return "antigravity";
|
|
724
|
-
}
|
|
725
|
-
if (_optionalChain([env, 'access', _123 => _123.GEMINI_CLI, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()]) || _optionalChain([env, 'access', _126 => _126.GEMINI_CLI_VERSION, 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()]) || _optionalChain([env, 'access', _129 => _129.GEMINI_SANDBOX, 'optionalAccess', _130 => _130.trim, 'call', _131 => _131()]) || _optionalChain([env, 'access', _132 => _132.GEMINI_CONFIG_DIR, 'optionalAccess', _133 => _133.trim, 'call', _134 => _134()])) {
|
|
726
|
-
return "gemini";
|
|
727
|
-
}
|
|
728
|
-
return _nullishCoalesce(options.defaultRuntime, () => ( "unknown"));
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
// src/skills-version.ts
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
function activePluginSkillsDir() {
|
|
735
|
-
const pluginMode = _optionalChain([process, 'access', _135 => _135.env, 'access', _136 => _136.DEEPLINE_PLUGIN_MODE, 'optionalAccess', _137 => _137.trim, 'call', _138 => _138(), 'access', _139 => _139.toLowerCase, 'call', _140 => _140()]);
|
|
736
|
-
if (pluginMode !== "true" && pluginMode !== "1" && pluginMode !== "yes" && pluginMode !== "on") {
|
|
737
|
-
return "";
|
|
738
|
-
}
|
|
739
|
-
const dir = _nullishCoalesce(_optionalChain([process, 'access', _141 => _141.env, 'access', _142 => _142.DEEPLINE_PLUGIN_SKILLS_DIR, 'optionalAccess', _143 => _143.trim, 'call', _144 => _144()]), () => ( ""));
|
|
740
|
-
return dir && _fs.existsSync.call(void 0, 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 _fs.readFileSync.call(void 0, _path.join.call(void 0, dir, ".version"), "utf-8").trim();
|
|
750
|
-
} catch (e9) {
|
|
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 _path.join.call(void 0, sdkCliStateDirPath(baseUrl), `skills${suffix}-version`);
|
|
778
|
-
}
|
|
779
|
-
function legacySdkSkillsVersionPath(baseUrl) {
|
|
780
|
-
return _path.join.call(void 0, _path.dirname.call(void 0, sdkCliStateDirPath(baseUrl)), "sdk-skills", ".version");
|
|
781
|
-
}
|
|
782
|
-
function readSkillsVersionFile(path) {
|
|
783
|
-
try {
|
|
784
|
-
return _fs.readFileSync.call(void 0, path, "utf-8").trim();
|
|
785
|
-
} catch (e10) {
|
|
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 && _fs.existsSync.call(void 0, scopedPath)) {
|
|
820
|
-
try {
|
|
821
|
-
return _fs.readFileSync.call(void 0, scopedPath, "utf-8").trim();
|
|
822
|
-
} catch (e11) {
|
|
823
|
-
return "";
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
if (agents.length > 0) {
|
|
827
|
-
const legacyPath = legacySdkSkillsVersionPath(baseUrl);
|
|
828
|
-
if (!_fs.existsSync.call(void 0, legacyPath)) return "";
|
|
829
|
-
try {
|
|
830
|
-
return _fs.readFileSync.call(void 0, legacyPath, "utf-8").trim();
|
|
831
|
-
} catch (e12) {
|
|
832
|
-
return "";
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
const path = _fs.existsSync.call(void 0, sdkSkillsVersionPath(baseUrl)) ? sdkSkillsVersionPath(baseUrl) : legacySdkSkillsVersionPath(baseUrl);
|
|
836
|
-
if (!_fs.existsSync.call(void 0, path)) return "";
|
|
837
|
-
try {
|
|
838
|
-
return _fs.readFileSync.call(void 0, path, "utf-8").trim();
|
|
839
|
-
} catch (e13) {
|
|
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
|
-
_fs.mkdirSync.call(void 0, _path.dirname.call(void 0, path), { recursive: true });
|
|
850
|
-
_fs.writeFileSync.call(void 0, path, `${version}
|
|
851
|
-
`, "utf-8");
|
|
852
|
-
} catch (e14) {
|
|
853
|
-
complete = false;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
return complete;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
// src/deployment-protection.ts
|
|
860
|
-
function deploymentProtectionHeaders(env = typeof process !== "undefined" ? process.env : {}) {
|
|
861
|
-
const token = env.VERCEL_PROTECTION_BYPASS_TOKEN;
|
|
862
|
-
return token ? { "x-vercel-protection-bypass": token } : {};
|
|
863
|
-
}
|
|
864
|
-
var fetchWithDeploymentProtection = (input, init) => {
|
|
865
|
-
const headers = new Headers(
|
|
866
|
-
input instanceof Request ? input.headers : void 0
|
|
867
|
-
);
|
|
868
|
-
new Headers(_optionalChain([init, 'optionalAccess', _145 => _145.headers])).forEach((value, name) => headers.set(name, value));
|
|
869
|
-
for (const [name, value] of Object.entries(deploymentProtectionHeaders())) {
|
|
870
|
-
headers.set(name, value);
|
|
871
|
-
}
|
|
872
|
-
return fetch(input, { ...init, headers });
|
|
873
|
-
};
|
|
874
|
-
|
|
875
|
-
// ../play-runtime/coordinator-headers.ts
|
|
876
|
-
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
877
|
-
var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
|
|
878
|
-
var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
|
|
879
|
-
var RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER = "x-deepline-runtime-scheduler-schema";
|
|
880
|
-
var RUNTIME_ENVIRONMENT_TOKEN_HEADER = "x-deepline-runtime-environment-token";
|
|
881
|
-
var RETAINED_PIPELINE_RECEIVERS_HEADER = "x-deepline-retained-pipeline-receivers";
|
|
882
|
-
var ABSURD_RELEASE_OVERRIDE_HEADER = "x-deepline-absurd-release";
|
|
883
|
-
var PREFERRED_RECEIPT_GATEWAY_MACHINE_ID_HEADER = "x-deepline-preferred-receipt-gateway-machine-id";
|
|
884
|
-
var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
|
|
885
|
-
|
|
886
|
-
// ../play-runtime/test-runtime-seams.ts
|
|
887
|
-
var PLAY_RUNTIME_TEST_FAULT_HEADER = "x-deepline-test-fault";
|
|
888
|
-
var MAX_RUNTIME_TEST_POLICY_MS = 10 * 6e4;
|
|
889
|
-
|
|
890
|
-
// ../integration-contracts/execute-retry-contract.ts
|
|
891
|
-
var EXECUTE_RETRY_POLICY_HEADER = "x-deepline-execute-retry-policy";
|
|
892
|
-
var EXECUTE_RETRY_POLICY_VERSION = 1;
|
|
893
|
-
function parseExecuteRetryPolicy(value) {
|
|
894
|
-
if (value === `v${EXECUTE_RETRY_POLICY_VERSION}:transient-http-safe`) {
|
|
895
|
-
return "transient-http-safe";
|
|
896
|
-
}
|
|
897
|
-
if (value === `v${EXECUTE_RETRY_POLICY_VERSION}:transient-http-unsafe`) {
|
|
898
|
-
return "transient-http-unsafe";
|
|
899
|
-
}
|
|
900
|
-
return null;
|
|
901
|
-
}
|
|
902
|
-
var ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER = "x-deepline-atomic-tool-supported";
|
|
903
|
-
|
|
904
|
-
// src/http.ts
|
|
905
|
-
var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
|
|
906
|
-
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
|
-
var REQUEST_TIMEOUT_MARKER = Symbol("deeplineRequestTimeout");
|
|
908
|
-
var REQUEST_ABORT_MARKER = Symbol("deeplineRequestAbort");
|
|
909
|
-
var MAX_AUTOMATIC_RETRY_WAIT_MS = 3e4;
|
|
910
|
-
function requestCancelledError(signal) {
|
|
911
|
-
const error = withErrorCause(new Error("Request aborted"), signal.reason);
|
|
912
|
-
error[REQUEST_ABORT_MARKER] = true;
|
|
913
|
-
return error;
|
|
914
|
-
}
|
|
915
|
-
function normalizeRequestAbortError(error, input) {
|
|
916
|
-
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
917
|
-
const tagged = normalized;
|
|
918
|
-
if (input.timedOut) {
|
|
919
|
-
tagged[REQUEST_TIMEOUT_MARKER] = input.timeoutMs;
|
|
920
|
-
} else if (isAbortLikeError(normalized)) {
|
|
921
|
-
tagged[REQUEST_ABORT_MARKER] = true;
|
|
922
|
-
}
|
|
923
|
-
return normalized;
|
|
924
|
-
}
|
|
925
|
-
function applyExplicitHeaders(headers, explicit) {
|
|
926
|
-
if (!explicit) return headers;
|
|
927
|
-
for (const [rawName, value] of Object.entries(explicit)) {
|
|
928
|
-
const name = rawName.trim().toLowerCase();
|
|
929
|
-
if (!name) continue;
|
|
930
|
-
for (const existing of Object.keys(headers)) {
|
|
931
|
-
if (existing.toLowerCase() === name) delete headers[existing];
|
|
932
|
-
}
|
|
933
|
-
headers[rawName.trim()] = value;
|
|
934
|
-
}
|
|
935
|
-
return headers;
|
|
936
|
-
}
|
|
937
|
-
function isAbortLikeError(error) {
|
|
938
|
-
const name = error.name.toLowerCase();
|
|
939
|
-
const message = error.message.toLowerCase();
|
|
940
|
-
return name === "aborterror" || message.includes("operation was aborted") || message === "aborted";
|
|
941
|
-
}
|
|
942
|
-
function withErrorCause(error, cause) {
|
|
943
|
-
if (cause !== null && cause !== void 0) {
|
|
944
|
-
Object.defineProperty(error, "cause", {
|
|
945
|
-
value: cause,
|
|
946
|
-
configurable: true,
|
|
947
|
-
writable: true
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
|
-
return error;
|
|
951
|
-
}
|
|
952
|
-
function mapNetworkError(baseUrl, error, targetLabel) {
|
|
953
|
-
const tagged = error;
|
|
954
|
-
const timeoutMs = _optionalChain([tagged, 'optionalAccess', _146 => _146[REQUEST_TIMEOUT_MARKER]]);
|
|
955
|
-
if (typeof timeoutMs === "number") {
|
|
956
|
-
return {
|
|
957
|
-
message: `Request to ${targetLabel} timed out after ${timeoutMs}ms while waiting for a response.`,
|
|
958
|
-
code: "NETWORK_TIMEOUT",
|
|
959
|
-
details: { timeoutMs, target: targetLabel }
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
if (_optionalChain([tagged, 'optionalAccess', _147 => _147[REQUEST_ABORT_MARKER]])) {
|
|
963
|
-
return {
|
|
964
|
-
message: `Request to ${targetLabel} was aborted before it completed.`,
|
|
965
|
-
code: "NETWORK_ABORTED"
|
|
966
|
-
};
|
|
967
|
-
}
|
|
968
|
-
return {
|
|
969
|
-
message: _optionalChain([error, 'optionalAccess', _148 => _148.message]) ? `Unable to connect to ${baseUrl}. ${error.message}` : `Unable to connect to ${baseUrl}. Is the computer able to access the url?`,
|
|
970
|
-
code: "NETWORK_ERROR"
|
|
971
|
-
};
|
|
972
|
-
}
|
|
973
|
-
function describeRequestTarget(path) {
|
|
974
|
-
const toolExecuteMatch = path.match(
|
|
975
|
-
/^\/api\/v2\/integrations\/([^/?#]+)\/execute(?:[/?#]|$)/
|
|
976
|
-
);
|
|
977
|
-
if (toolExecuteMatch) {
|
|
978
|
-
return providerLabelFromToolId(decodeURIComponent(toolExecuteMatch[1]));
|
|
979
|
-
}
|
|
980
|
-
return "Deepline";
|
|
981
|
-
}
|
|
982
|
-
function networkDiagnosticUrl(value) {
|
|
983
|
-
try {
|
|
984
|
-
const url = new URL(value);
|
|
985
|
-
if (url.protocol !== "https:" && url.protocol !== "http:") return void 0;
|
|
986
|
-
return `${url.origin}${url.pathname}`;
|
|
987
|
-
} catch (e15) {
|
|
988
|
-
return void 0;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
function providerLabelFromToolId(toolId) {
|
|
992
|
-
const normalized = toolId.trim().toLowerCase();
|
|
993
|
-
const provider = normalized.split(/[_:./-]+/)[0];
|
|
994
|
-
return provider || normalized || "provider";
|
|
995
|
-
}
|
|
996
|
-
function isRecord(value) {
|
|
997
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
998
|
-
}
|
|
999
|
-
var HttpClient = class {
|
|
1000
|
-
constructor(config) {
|
|
1001
|
-
this.config = config;
|
|
1002
|
-
}
|
|
1003
|
-
cleanDiagnosticHeader(value) {
|
|
1004
|
-
const normalized = String(_nullishCoalesce(value, () => ( ""))).replace(/[\u0000-\u001f\u007f]/g, " ").trim().slice(0, MAX_DIAGNOSTIC_HEADER_LENGTH);
|
|
1005
|
-
return normalized || null;
|
|
1006
|
-
}
|
|
1007
|
-
environment() {
|
|
1008
|
-
return _nullishCoalesce(this.config.environment, () => ( (typeof process !== "undefined" ? process.env : {})));
|
|
1009
|
-
}
|
|
1010
|
-
readSkillsVersionHeader() {
|
|
1011
|
-
const explicit = this.cleanDiagnosticHeader(
|
|
1012
|
-
this.environment().DEEPLINE_SKILLS_VERSION
|
|
1013
|
-
);
|
|
1014
|
-
if (explicit) return explicit;
|
|
1015
|
-
try {
|
|
1016
|
-
return this.cleanDiagnosticHeader(
|
|
1017
|
-
readSdkSkillsLocalVersion(this.config.baseUrl)
|
|
1018
|
-
);
|
|
1019
|
-
} catch (e16) {
|
|
1020
|
-
return null;
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
authHeaders(extra) {
|
|
1024
|
-
const env = this.environment();
|
|
1025
|
-
const transportHeaders = {
|
|
1026
|
-
Authorization: `Bearer ${this.config.apiKey}`,
|
|
1027
|
-
"User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
|
|
1028
|
-
"X-Deepline-Client-Family": "sdk",
|
|
1029
|
-
"X-Deepline-CLI-Family": "sdk",
|
|
1030
|
-
"X-Deepline-Agent-Runtime": detectAgentRuntime(
|
|
1031
|
-
this.config.environment ? { env, detectCowork: false } : {}
|
|
1032
|
-
),
|
|
1033
|
-
"X-Deepline-CLI-Version": SDK_VERSION,
|
|
1034
|
-
"X-Deepline-SDK-Version": SDK_VERSION,
|
|
1035
|
-
"X-Deepline-API-Contract": SDK_API_CONTRACT,
|
|
1036
|
-
"X-Deepline-Run-Result-Shape": "canonical"
|
|
1037
|
-
};
|
|
1038
|
-
const headers = deploymentProtectionHeaders(env);
|
|
1039
|
-
const skillsVersion = this.readSkillsVersionHeader();
|
|
1040
|
-
if (skillsVersion) {
|
|
1041
|
-
headers["X-Deepline-Skills-Version"] = skillsVersion;
|
|
1042
|
-
}
|
|
1043
|
-
const agentSessionId = agentSessionIdFromEnvironment(env);
|
|
1044
|
-
if (agentSessionId) {
|
|
1045
|
-
headers["X-Deepline-Agent-Session-Id"] = agentSessionId;
|
|
1046
|
-
}
|
|
1047
|
-
const playArtifactR2Prefix = env.DEEPLINE_PLAY_ARTIFACT_R2_PREFIX;
|
|
1048
|
-
if (playArtifactR2Prefix) {
|
|
1049
|
-
headers["x-deepline-play-artifact-r2-prefix"] = playArtifactR2Prefix;
|
|
1050
|
-
}
|
|
1051
|
-
const coordinatorUrl = env.DEEPLINE_COORDINATOR_URL;
|
|
1052
|
-
const coordinatorInternalToken = env.DEEPLINE_INTERNAL_TOKEN;
|
|
1053
|
-
const absurdReleaseOverride = env.DEEPLINE_ABSURD_RELEASE;
|
|
1054
|
-
const preferredReceiptGatewayMachineId = env.DEEPLINE_PREFERRED_RECEIPT_GATEWAY_MACHINE_ID;
|
|
1055
|
-
if (_optionalChain([coordinatorUrl, 'optionalAccess', _149 => _149.trim, 'call', _150 => _150()])) {
|
|
1056
|
-
headers[COORDINATOR_URL_OVERRIDE_HEADER] = coordinatorUrl.trim();
|
|
1057
|
-
}
|
|
1058
|
-
const workerCallbackUrl = env.DEEPLINE_WORKER_CALLBACK_URL;
|
|
1059
|
-
if (_optionalChain([workerCallbackUrl, 'optionalAccess', _151 => _151.trim, 'call', _152 => _152()])) {
|
|
1060
|
-
headers[WORKER_CALLBACK_URL_OVERRIDE_HEADER] = workerCallbackUrl.trim();
|
|
1061
|
-
}
|
|
1062
|
-
const runtimeSchedulerSchema = env.DEEPLINE_RUNTIME_SCHEDULER_SCHEMA;
|
|
1063
|
-
if (_optionalChain([runtimeSchedulerSchema, 'optionalAccess', _153 => _153.trim, 'call', _154 => _154()])) {
|
|
1064
|
-
headers[RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER] = runtimeSchedulerSchema.trim();
|
|
1065
|
-
}
|
|
1066
|
-
const syntheticRun = env.DEEPLINE_SYNTHETIC_RUN;
|
|
1067
|
-
if (syntheticRun && syntheticRun.trim() && syntheticRun.trim() !== "0") {
|
|
1068
|
-
headers[SYNTHETIC_RUN_HEADER] = "1";
|
|
1069
|
-
}
|
|
1070
|
-
const runtimeTestFault = env.DEEPLINE_TEST_RUNTIME_FAULT;
|
|
1071
|
-
if (_optionalChain([runtimeTestFault, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()])) {
|
|
1072
|
-
headers[PLAY_RUNTIME_TEST_FAULT_HEADER] = runtimeTestFault.trim();
|
|
1073
|
-
}
|
|
1074
|
-
const retainedReceivers = _optionalChain([env, 'access', _157 => _157.DEEPLINE_RUNTIME_RETAINED_PIPELINE_RECEIVERS, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()]);
|
|
1075
|
-
if (retainedReceivers && _optionalChain([coordinatorInternalToken, 'optionalAccess', _160 => _160.trim, 'call', _161 => _161()])) {
|
|
1076
|
-
headers[RETAINED_PIPELINE_RECEIVERS_HEADER] = retainedReceivers;
|
|
1077
|
-
headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
|
|
1078
|
-
}
|
|
1079
|
-
if (_optionalChain([absurdReleaseOverride, 'optionalAccess', _162 => _162.trim, 'call', _163 => _163()]) && _optionalChain([coordinatorInternalToken, 'optionalAccess', _164 => _164.trim, 'call', _165 => _165()])) {
|
|
1080
|
-
headers[ABSURD_RELEASE_OVERRIDE_HEADER] = absurdReleaseOverride.trim();
|
|
1081
|
-
}
|
|
1082
|
-
if (_optionalChain([preferredReceiptGatewayMachineId, 'optionalAccess', _166 => _166.trim, 'call', _167 => _167()]) && _optionalChain([coordinatorInternalToken, 'optionalAccess', _168 => _168.trim, 'call', _169 => _169()])) {
|
|
1083
|
-
headers[PREFERRED_RECEIPT_GATEWAY_MACHINE_ID_HEADER] = preferredReceiptGatewayMachineId.trim();
|
|
1084
|
-
}
|
|
1085
|
-
if (_optionalChain([coordinatorInternalToken, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]) && (_optionalChain([coordinatorUrl, 'optionalAccess', _172 => _172.trim, 'call', _173 => _173()]) || _optionalChain([workerCallbackUrl, 'optionalAccess', _174 => _174.trim, 'call', _175 => _175()]) || _optionalChain([runtimeTestFault, 'optionalAccess', _176 => _176.trim, 'call', _177 => _177()]) || _optionalChain([absurdReleaseOverride, 'optionalAccess', _178 => _178.trim, 'call', _179 => _179()]) || _optionalChain([preferredReceiptGatewayMachineId, 'optionalAccess', _180 => _180.trim, 'call', _181 => _181()]))) {
|
|
1086
|
-
headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
|
|
1087
|
-
}
|
|
1088
|
-
return applyExplicitHeaders(
|
|
1089
|
-
applyExplicitHeaders(
|
|
1090
|
-
applyExplicitHeaders(transportHeaders, extra),
|
|
1091
|
-
headers
|
|
1092
|
-
),
|
|
1093
|
-
this.config.headers
|
|
1094
|
-
);
|
|
1095
|
-
}
|
|
1096
|
-
/**
|
|
1097
|
-
* Send an HTTP request with automatic retries and error handling.
|
|
1098
|
-
*
|
|
1099
|
-
* @typeParam T - Expected response body type
|
|
1100
|
-
* @param path - API path (e.g. `"/api/v2/tools"`)
|
|
1101
|
-
* @param options - HTTP method, body, headers, and timeout
|
|
1102
|
-
* @returns Parsed JSON response body
|
|
1103
|
-
* @throws {@link AuthError} on Deepline-auth HTTP 401/403 (immediate, no retry)
|
|
1104
|
-
* @throws {@link RateLimitError} on HTTP 429 after all retries exhausted
|
|
1105
|
-
* @throws {@link DeeplineError} on other API errors or connection failures
|
|
1106
|
-
*/
|
|
1107
|
-
async request(path, options) {
|
|
1108
|
-
const baseUrl = this.config.baseUrl;
|
|
1109
|
-
const url = `${baseUrl}${path}`;
|
|
1110
|
-
const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.method]), () => ( "GET"));
|
|
1111
|
-
const requestStartedAt = Date.now();
|
|
1112
|
-
let fetchAttempts = 0;
|
|
1113
|
-
let lastRequestUrl = url;
|
|
1114
|
-
let networkFailedAt;
|
|
1115
|
-
let networkPhase = "before_request";
|
|
1116
|
-
const headers = this.authHeaders(_optionalChain([options, 'optionalAccess', _183 => _183.headers]));
|
|
1117
|
-
if (_optionalChain([options, 'optionalAccess', _184 => _184.body]) !== void 0) {
|
|
1118
|
-
applyExplicitHeaders(headers, { "Content-Type": "application/json" });
|
|
1119
|
-
}
|
|
1120
|
-
let lastError = null;
|
|
1121
|
-
const candidateUrls = _optionalChain([options, 'optionalAccess', _185 => _185.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
|
|
1122
|
-
let retryAfterDelayMs = null;
|
|
1123
|
-
let totalRetryWaitMs = 0;
|
|
1124
|
-
let maxRetries = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _186 => _186.maxRetries]), () => ( this.config.maxRetries));
|
|
1125
|
-
requestAttempts: for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
1126
|
-
if (_optionalChain([options, 'optionalAccess', _187 => _187.signal, 'optionalAccess', _188 => _188.aborted])) {
|
|
1127
|
-
lastError = requestCancelledError(options.signal);
|
|
1128
|
-
networkFailedAt = Date.now();
|
|
1129
|
-
break;
|
|
1130
|
-
}
|
|
1131
|
-
if (attempt > 0) {
|
|
1132
|
-
const backoffMs = Math.min(1e3 * Math.pow(2, attempt - 1), 3e4);
|
|
1133
|
-
const delayMs = retryAfterDelayMs === null ? backoffMs : Math.max(backoffMs, retryAfterDelayMs);
|
|
1134
|
-
retryAfterDelayMs = null;
|
|
1135
|
-
if (totalRetryWaitMs + delayMs > MAX_AUTOMATIC_RETRY_WAIT_MS) {
|
|
1136
|
-
break requestAttempts;
|
|
1137
|
-
}
|
|
1138
|
-
totalRetryWaitMs += delayMs;
|
|
1139
|
-
networkPhase = "retry_wait";
|
|
1140
|
-
try {
|
|
1141
|
-
await sleep(delayMs, _optionalChain([options, 'optionalAccess', _189 => _189.signal]));
|
|
1142
|
-
} catch (error) {
|
|
1143
|
-
lastError = error instanceof Error ? error : new Error(String(error));
|
|
1144
|
-
networkFailedAt = Date.now();
|
|
1145
|
-
break;
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
for (const candidateUrl of candidateUrls) {
|
|
1149
|
-
if (_optionalChain([options, 'optionalAccess', _190 => _190.signal, 'optionalAccess', _191 => _191.aborted])) {
|
|
1150
|
-
lastError = requestCancelledError(options.signal);
|
|
1151
|
-
networkFailedAt = Date.now();
|
|
1152
|
-
break requestAttempts;
|
|
1153
|
-
}
|
|
1154
|
-
const controller = new AbortController();
|
|
1155
|
-
const timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _192 => _192.timeout]), () => ( this.config.timeout));
|
|
1156
|
-
let requestTimedOut = false;
|
|
1157
|
-
const timeoutId = setTimeout(() => {
|
|
1158
|
-
requestTimedOut = true;
|
|
1159
|
-
controller.abort();
|
|
1160
|
-
}, timeoutMs);
|
|
1161
|
-
const abortRequest = () => controller.abort();
|
|
1162
|
-
_optionalChain([options, 'optionalAccess', _193 => _193.signal, 'optionalAccess', _194 => _194.addEventListener, 'call', _195 => _195("abort", abortRequest, {
|
|
1163
|
-
once: true
|
|
1164
|
-
})]);
|
|
1165
|
-
networkPhase = "before_request";
|
|
1166
|
-
try {
|
|
1167
|
-
const requestBody = _optionalChain([options, 'optionalAccess', _196 => _196.formData]) !== void 0 ? typeof options.formData === "function" ? options.formData() : options.formData : _optionalChain([options, 'optionalAccess', _197 => _197.body]) !== void 0 ? JSON.stringify(options.body) : void 0;
|
|
1168
|
-
fetchAttempts += 1;
|
|
1169
|
-
lastRequestUrl = candidateUrl;
|
|
1170
|
-
networkPhase = "awaiting_headers";
|
|
1171
|
-
const response = await fetch(candidateUrl, {
|
|
1172
|
-
method,
|
|
1173
|
-
headers,
|
|
1174
|
-
body: requestBody,
|
|
1175
|
-
signal: controller.signal
|
|
1176
|
-
});
|
|
1177
|
-
networkPhase = "reading_body";
|
|
1178
|
-
_optionalChain([options, 'optionalAccess', _198 => _198.onResponse, 'optionalCall', _199 => _199(response)]);
|
|
1179
|
-
if (response.status === 404 && _optionalChain([options, 'optionalAccess', _200 => _200.allowNotFound])) {
|
|
1180
|
-
clearTimeout(timeoutId);
|
|
1181
|
-
return null;
|
|
1182
|
-
}
|
|
1183
|
-
const body = await response.text();
|
|
1184
|
-
const receivedAtMs = Date.now();
|
|
1185
|
-
clearTimeout(timeoutId);
|
|
1186
|
-
const parsed = parseResponseBody(body);
|
|
1187
|
-
_optionalChain([options, 'optionalAccess', _201 => _201.onResponseBody, 'optionalCall', _202 => _202({
|
|
1188
|
-
receivedAtMs,
|
|
1189
|
-
httpStatus: response.status,
|
|
1190
|
-
body: parsed
|
|
1191
|
-
})]);
|
|
1192
|
-
const responseRetryAllowed = _optionalChain([options, 'optionalAccess', _203 => _203.retryFromExecutePolicy]) !== true || parseExecuteRetryPolicy(
|
|
1193
|
-
response.headers.get(EXECUTE_RETRY_POLICY_HEADER)
|
|
1194
|
-
) === "transient-http-safe";
|
|
1195
|
-
if (_optionalChain([options, 'optionalAccess', _204 => _204.retryFromExecutePolicy]) === true && responseRetryAllowed && options.executePolicyMaxRetries !== void 0) {
|
|
1196
|
-
maxRetries = options.executePolicyMaxRetries;
|
|
1197
|
-
}
|
|
1198
|
-
const structuredToolError = _optionalChain([options, 'optionalAccess', _205 => _205.toolId]) && !response.ok ? _chunkDIAWYWT5js.deserializeToolExecutionFailure.call(void 0,
|
|
1199
|
-
_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status),
|
|
1200
|
-
isRecord(parsed) ? parsed.tool_error : null,
|
|
1201
|
-
_chunkDIAWYWT5js.TOOL_EXECUTION_ERROR_SCHEMA_VERSION
|
|
1202
|
-
) : null;
|
|
1203
|
-
if (structuredToolError) {
|
|
1204
|
-
if (response.status === 429) {
|
|
1205
|
-
const retryAfter = parseRetryAfter(response);
|
|
1206
|
-
const failure = _chunkDIAWYWT5js.serializeToolExecutionFailure.call(void 0, structuredToolError);
|
|
1207
|
-
lastError = failure === null ? structuredToolError : new (0, _chunkALJJRZNJjs.ToolRateLimitError)(structuredToolError.message, {
|
|
1208
|
-
...failure,
|
|
1209
|
-
retryAfterMs: _nullishCoalesce(failure.retryAfterMs, () => ( Math.max(0, retryAfter)))
|
|
1210
|
-
});
|
|
1211
|
-
if (responseRetryAllowed && attempt < maxRetries) {
|
|
1212
|
-
retryAfterDelayMs = retryAfter;
|
|
1213
|
-
break;
|
|
1214
|
-
}
|
|
1215
|
-
throw lastError;
|
|
1216
|
-
}
|
|
1217
|
-
throw structuredToolError;
|
|
1218
|
-
}
|
|
1219
|
-
if (response.status === 429) {
|
|
1220
|
-
if (_optionalChain([options, 'optionalAccess', _206 => _206.preserveRateLimitResponse]) && isMonitorRateLimitEnvelope(parsed)) {
|
|
1221
|
-
throw new (0, _chunkDIAWYWT5js.DeeplineError)(
|
|
1222
|
-
_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status),
|
|
1223
|
-
response.status,
|
|
1224
|
-
_chunkXNYIZMNQjs.apiErrorCodeFromResponse.call(void 0, parsed),
|
|
1225
|
-
{ response: parsed }
|
|
1226
|
-
);
|
|
1227
|
-
}
|
|
1228
|
-
const retryAfter = parseRetryAfter(response);
|
|
1229
|
-
lastError = new (0, _chunkALJJRZNJjs.RateLimitError)(retryAfter);
|
|
1230
|
-
if (responseRetryAllowed && attempt < maxRetries) {
|
|
1231
|
-
retryAfterDelayMs = retryAfter;
|
|
1232
|
-
break;
|
|
1233
|
-
}
|
|
1234
|
-
throw lastError;
|
|
1235
|
-
}
|
|
1236
|
-
if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
|
|
1237
|
-
throw new (0, _chunkALJJRZNJjs.AuthError)(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
|
|
1238
|
-
}
|
|
1239
|
-
if (!response.ok) {
|
|
1240
|
-
const retryableApiError = _optionalChain([options, 'optionalAccess', _207 => _207.retryApiErrors]) === true && responseRetryAllowed && isRetryableApiErrorResponse(response.status);
|
|
1241
|
-
const htmlError = detectHtmlErrorBody(
|
|
1242
|
-
body,
|
|
1243
|
-
response.headers.get("content-type")
|
|
1244
|
-
);
|
|
1245
|
-
if (htmlError) {
|
|
1246
|
-
lastError = new (0, _chunkDIAWYWT5js.DeeplineError)(
|
|
1247
|
-
htmlError.message(response.status),
|
|
1248
|
-
response.status,
|
|
1249
|
-
"API_ERROR",
|
|
1250
|
-
{
|
|
1251
|
-
htmlErrorPage: true,
|
|
1252
|
-
...htmlError.title ? { title: htmlError.title } : {},
|
|
1253
|
-
...htmlError.workerThrewException ? { workerThrewException: true } : {}
|
|
1254
|
-
}
|
|
1255
|
-
);
|
|
1256
|
-
if (retryableApiError && attempt < maxRetries) {
|
|
1257
|
-
retryAfterDelayMs = parseOptionalRetryAfter(response);
|
|
1258
|
-
break;
|
|
1259
|
-
}
|
|
1260
|
-
throw lastError;
|
|
1261
|
-
}
|
|
1262
|
-
const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
|
|
1263
|
-
const msg = typeof errorValue === "string" ? errorValue : errorValue && typeof errorValue === "object" && "message" in errorValue && typeof errorValue.message === "string" ? errorValue.message : typeof parsed === "object" && parsed && "message" in parsed && typeof parsed.message === "string" ? parsed.message : `HTTP ${response.status}`;
|
|
1264
|
-
const apiErrorCode = _chunkXNYIZMNQjs.apiErrorCodeFromResponse.call(void 0, parsed);
|
|
1265
|
-
lastError = new (0, _chunkDIAWYWT5js.DeeplineError)(msg, response.status, apiErrorCode, {
|
|
1266
|
-
response: parsed
|
|
1267
|
-
});
|
|
1268
|
-
if (retryableApiError && attempt < maxRetries) {
|
|
1269
|
-
retryAfterDelayMs = parseOptionalRetryAfter(response);
|
|
1270
|
-
break;
|
|
1271
|
-
}
|
|
1272
|
-
throw lastError;
|
|
1273
|
-
}
|
|
1274
|
-
if (typeof parsed === "string") {
|
|
1275
|
-
const interstitial = detectHtmlErrorBody(
|
|
1276
|
-
body,
|
|
1277
|
-
response.headers.get("content-type")
|
|
1278
|
-
);
|
|
1279
|
-
if (interstitial) {
|
|
1280
|
-
throw new (0, _chunkDIAWYWT5js.DeeplineError)(
|
|
1281
|
-
`${this.config.baseUrl} returned a deployment-protection page instead of JSON. Set VERCEL_PROTECTION_BYPASS_TOKEN, or run \`vercel login\` if the CLI session expired.`,
|
|
1282
|
-
response.status,
|
|
1283
|
-
"DEPLOYMENT_PROTECTED",
|
|
1284
|
-
{ htmlErrorPage: true }
|
|
1285
|
-
);
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
return parsed;
|
|
1289
|
-
} catch (error) {
|
|
1290
|
-
clearTimeout(timeoutId);
|
|
1291
|
-
networkFailedAt = Date.now();
|
|
1292
|
-
if (_optionalChain([options, 'optionalAccess', _208 => _208.signal, 'optionalAccess', _209 => _209.aborted])) {
|
|
1293
|
-
lastError = requestCancelledError(options.signal);
|
|
1294
|
-
break requestAttempts;
|
|
1295
|
-
}
|
|
1296
|
-
if (error instanceof _chunkALJJRZNJjs.AuthError || error instanceof _chunkDIAWYWT5js.DeeplineError) {
|
|
1297
|
-
throw error;
|
|
1298
|
-
}
|
|
1299
|
-
if (error instanceof _chunkALJJRZNJjs.RateLimitError) {
|
|
1300
|
-
lastError = error;
|
|
1301
|
-
break;
|
|
1302
|
-
}
|
|
1303
|
-
lastError = normalizeRequestAbortError(error, {
|
|
1304
|
-
timeoutMs,
|
|
1305
|
-
timedOut: requestTimedOut
|
|
1306
|
-
});
|
|
1307
|
-
if (_optionalChain([options, 'optionalAccess', _210 => _210.retryFromExecutePolicy]) && options.retryAmbiguousDelivery !== true) {
|
|
1308
|
-
break requestAttempts;
|
|
1309
|
-
}
|
|
1310
|
-
} finally {
|
|
1311
|
-
clearTimeout(timeoutId);
|
|
1312
|
-
_optionalChain([options, 'optionalAccess', _211 => _211.signal, 'optionalAccess', _212 => _212.removeEventListener, 'call', _213 => _213("abort", abortRequest)]);
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
if (attempt < maxRetries) continue;
|
|
1316
|
-
}
|
|
1317
|
-
if (lastError instanceof _chunkDIAWYWT5js.DeeplineError) {
|
|
1318
|
-
throw lastError;
|
|
1319
|
-
}
|
|
1320
|
-
const mappedNetworkError = mapNetworkError(
|
|
1321
|
-
baseUrl,
|
|
1322
|
-
lastError,
|
|
1323
|
-
describeRequestTarget(path)
|
|
1324
|
-
);
|
|
1325
|
-
const failedAt = _nullishCoalesce(networkFailedAt, () => ( Date.now()));
|
|
1326
|
-
const diagnosticUrl = networkDiagnosticUrl(lastRequestUrl);
|
|
1327
|
-
const networkDetails = {
|
|
1328
|
-
...mappedNetworkError.details,
|
|
1329
|
-
request: {
|
|
1330
|
-
method,
|
|
1331
|
-
...diagnosticUrl === void 0 ? {} : { url: diagnosticUrl },
|
|
1332
|
-
failedAtUtc: new Date(failedAt).toISOString(),
|
|
1333
|
-
// Elapsed time covers the entire logical request, including retries.
|
|
1334
|
-
elapsedMs: Math.max(0, failedAt - requestStartedAt),
|
|
1335
|
-
attempts: fetchAttempts,
|
|
1336
|
-
phase: networkPhase
|
|
1337
|
-
}
|
|
1338
|
-
};
|
|
1339
|
-
if (_optionalChain([options, 'optionalAccess', _214 => _214.toolId])) {
|
|
1340
|
-
const code = mappedNetworkError.code;
|
|
1341
|
-
throw withErrorCause(
|
|
1342
|
-
new (0, _chunkDIAWYWT5js.ToolExecutionError)(
|
|
1343
|
-
withCoworkNetworkHint(mappedNetworkError.message),
|
|
1344
|
-
{
|
|
1345
|
-
toolId: options.toolId,
|
|
1346
|
-
provider: providerLabelFromToolId(options.toolId),
|
|
1347
|
-
operation: options.toolId,
|
|
1348
|
-
code,
|
|
1349
|
-
origin: "deepline",
|
|
1350
|
-
category: "network",
|
|
1351
|
-
// A direct client timeout has ambiguous delivery. Fail closed unless
|
|
1352
|
-
// the server returns the authoritative action delivery contract.
|
|
1353
|
-
retryable: options.retryAmbiguousDelivery === true,
|
|
1354
|
-
statusCode: null,
|
|
1355
|
-
requestId: null,
|
|
1356
|
-
retryAfterMs: null,
|
|
1357
|
-
networkKind: code === "NETWORK_TIMEOUT" ? "timeout" : code === "NETWORK_ABORTED" ? "unknown" : "unavailable",
|
|
1358
|
-
networkScope: "client_to_deepline",
|
|
1359
|
-
details: networkDetails,
|
|
1360
|
-
publicDetails: options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : null
|
|
1361
|
-
}
|
|
1362
|
-
),
|
|
1363
|
-
lastError
|
|
1364
|
-
);
|
|
1365
|
-
}
|
|
1366
|
-
throw withErrorCause(
|
|
1367
|
-
new (0, _chunkDIAWYWT5js.DeeplineError)(
|
|
1368
|
-
withCoworkNetworkHint(mappedNetworkError.message),
|
|
1369
|
-
void 0,
|
|
1370
|
-
mappedNetworkError.code,
|
|
1371
|
-
networkDetails
|
|
1372
|
-
),
|
|
1373
|
-
lastError
|
|
1374
|
-
);
|
|
1375
|
-
}
|
|
1376
|
-
/**
|
|
1377
|
-
* Send a GET request.
|
|
1378
|
-
*
|
|
1379
|
-
* @typeParam T - Expected response body type
|
|
1380
|
-
* @param path - API path (e.g. `"/api/v2/tools"`)
|
|
1381
|
-
*/
|
|
1382
|
-
async get(path, options) {
|
|
1383
|
-
return this.request(path, {
|
|
1384
|
-
method: "GET",
|
|
1385
|
-
retryApiErrors: true,
|
|
1386
|
-
...options
|
|
1387
|
-
});
|
|
1388
|
-
}
|
|
1389
|
-
async *streamSse(path, options) {
|
|
1390
|
-
const url = `${this.config.baseUrl}${path}`;
|
|
1391
|
-
const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _215 => _215.method]), () => ( "GET"));
|
|
1392
|
-
const headers = this.authHeaders({
|
|
1393
|
-
Accept: "text/event-stream",
|
|
1394
|
-
..._optionalChain([options, 'optionalAccess', _216 => _216.headers])
|
|
1395
|
-
});
|
|
1396
|
-
if (_optionalChain([options, 'optionalAccess', _217 => _217.body]) !== void 0) {
|
|
1397
|
-
applyExplicitHeaders(headers, { "Content-Type": "application/json" });
|
|
1398
|
-
}
|
|
1399
|
-
let lastError = null;
|
|
1400
|
-
const candidateUrls = _optionalChain([options, 'optionalAccess', _218 => _218.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
|
|
1401
|
-
for (const candidateUrl of candidateUrls) {
|
|
1402
|
-
try {
|
|
1403
|
-
const response = await fetch(candidateUrl, {
|
|
1404
|
-
method,
|
|
1405
|
-
headers,
|
|
1406
|
-
body: _optionalChain([options, 'optionalAccess', _219 => _219.body]) !== void 0 ? JSON.stringify(options.body) : void 0,
|
|
1407
|
-
signal: _optionalChain([options, 'optionalAccess', _220 => _220.signal])
|
|
1408
|
-
});
|
|
1409
|
-
if (!response.ok) {
|
|
1410
|
-
const body = await response.text();
|
|
1411
|
-
const parsed = parseResponseBody(body);
|
|
1412
|
-
if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
|
|
1413
|
-
throw new (0, _chunkALJJRZNJjs.AuthError)(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
|
|
1414
|
-
}
|
|
1415
|
-
const htmlError = detectHtmlErrorBody(
|
|
1416
|
-
body,
|
|
1417
|
-
response.headers.get("content-type")
|
|
1418
|
-
);
|
|
1419
|
-
if (htmlError) {
|
|
1420
|
-
throw new (0, _chunkDIAWYWT5js.DeeplineError)(
|
|
1421
|
-
htmlError.message(response.status),
|
|
1422
|
-
response.status,
|
|
1423
|
-
"API_ERROR",
|
|
1424
|
-
{
|
|
1425
|
-
htmlErrorPage: true,
|
|
1426
|
-
...htmlError.title ? { title: htmlError.title } : {},
|
|
1427
|
-
...htmlError.workerThrewException ? { workerThrewException: true } : {}
|
|
1428
|
-
}
|
|
1429
|
-
);
|
|
1430
|
-
}
|
|
1431
|
-
throw new (0, _chunkDIAWYWT5js.DeeplineError)(
|
|
1432
|
-
_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status),
|
|
1433
|
-
response.status,
|
|
1434
|
-
_chunkXNYIZMNQjs.apiErrorCodeFromResponse.call(void 0, parsed),
|
|
1435
|
-
{ response: parsed }
|
|
1436
|
-
);
|
|
1437
|
-
}
|
|
1438
|
-
if (!response.body) {
|
|
1439
|
-
throw new (0, _chunkDIAWYWT5js.DeeplineError)("SSE response did not include a body.");
|
|
1440
|
-
}
|
|
1441
|
-
yield* decodeSseStream(response.body);
|
|
1442
|
-
return;
|
|
1443
|
-
} catch (error) {
|
|
1444
|
-
if (error instanceof _chunkALJJRZNJjs.AuthError || error instanceof _chunkDIAWYWT5js.DeeplineError) {
|
|
1445
|
-
throw error;
|
|
1446
|
-
}
|
|
1447
|
-
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
1448
|
-
if (isAbortLikeError(normalized) && _optionalChain([options, 'optionalAccess', _221 => _221.signal, 'optionalAccess', _222 => _222.aborted])) {
|
|
1449
|
-
throw new (0, _chunkDIAWYWT5js.DeeplineError)(
|
|
1450
|
-
`Stream from ${this.config.baseUrl} was aborted by the caller.`,
|
|
1451
|
-
void 0,
|
|
1452
|
-
"ABORTED"
|
|
1453
|
-
);
|
|
1454
|
-
}
|
|
1455
|
-
lastError = normalized;
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
if (lastError && isAbortLikeError(lastError)) {
|
|
1459
|
-
throw new (0, _chunkDIAWYWT5js.DeeplineError)(
|
|
1460
|
-
withCoworkNetworkHint(
|
|
1461
|
-
`Unable to stream from ${this.config.baseUrl}. The remote stream was interrupted.`
|
|
1462
|
-
),
|
|
1463
|
-
void 0,
|
|
1464
|
-
"PLAY_STREAM_NETWORK_ABORTED"
|
|
1465
|
-
);
|
|
1466
|
-
}
|
|
1467
|
-
throw new (0, _chunkDIAWYWT5js.DeeplineError)(
|
|
1468
|
-
withCoworkNetworkHint(
|
|
1469
|
-
_optionalChain([lastError, 'optionalAccess', _223 => _223.message]) ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
|
|
1470
|
-
)
|
|
1471
|
-
);
|
|
1472
|
-
}
|
|
1473
|
-
/**
|
|
1474
|
-
* Send a POST request with a JSON body.
|
|
1475
|
-
*
|
|
1476
|
-
* @typeParam T - Expected response body type
|
|
1477
|
-
* @param path - API path
|
|
1478
|
-
* @param body - Request body (will be JSON-serialized)
|
|
1479
|
-
*/
|
|
1480
|
-
async post(path, body, headers, options) {
|
|
1481
|
-
return this.request(path, {
|
|
1482
|
-
method: "POST",
|
|
1483
|
-
body,
|
|
1484
|
-
headers,
|
|
1485
|
-
...options
|
|
1486
|
-
});
|
|
1487
|
-
}
|
|
1488
|
-
async postFormData(path, formData, headers) {
|
|
1489
|
-
return this.request(path, {
|
|
1490
|
-
method: "POST",
|
|
1491
|
-
formData,
|
|
1492
|
-
headers
|
|
1493
|
-
});
|
|
1494
|
-
}
|
|
1495
|
-
/**
|
|
1496
|
-
* Send a PATCH request with a JSON body.
|
|
1497
|
-
*
|
|
1498
|
-
* @typeParam T - Expected response body type
|
|
1499
|
-
* @param path - API path
|
|
1500
|
-
* @param body - JSON-serializable request body
|
|
1501
|
-
*/
|
|
1502
|
-
async patch(path, body, headers) {
|
|
1503
|
-
return this.request(path, {
|
|
1504
|
-
method: "PATCH",
|
|
1505
|
-
body,
|
|
1506
|
-
headers
|
|
1507
|
-
});
|
|
1508
|
-
}
|
|
1509
|
-
async put(path, body, headers) {
|
|
1510
|
-
return this.request(path, { method: "PUT", body, headers });
|
|
1511
|
-
}
|
|
1512
|
-
/**
|
|
1513
|
-
* Send a DELETE request.
|
|
1514
|
-
*
|
|
1515
|
-
* @typeParam T - Expected response body type
|
|
1516
|
-
* @param path - API path
|
|
1517
|
-
*/
|
|
1518
|
-
async delete(path) {
|
|
1519
|
-
return this.request(path, { method: "DELETE" });
|
|
1520
|
-
}
|
|
1521
|
-
};
|
|
1522
|
-
function parseResponseBody(body) {
|
|
1523
|
-
try {
|
|
1524
|
-
return JSON.parse(body);
|
|
1525
|
-
} catch (e17) {
|
|
1526
|
-
return body;
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
function isProviderOriginatedHttpError(parsed) {
|
|
1530
|
-
const response = asRecord(parsed);
|
|
1531
|
-
const error = asRecord(_optionalChain([response, 'optionalAccess', _224 => _224.error]));
|
|
1532
|
-
const failureOrigin = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _225 => _225.failure_origin]), () => ( _optionalChain([response, 'optionalAccess', _226 => _226.failure_origin])));
|
|
1533
|
-
const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _227 => _227.code]), () => ( _optionalChain([response, 'optionalAccess', _228 => _228.code])));
|
|
1534
|
-
return failureOrigin === "provider" || code === "UPSTREAM_BLOCKED";
|
|
1535
|
-
}
|
|
1536
|
-
function isMonitorRateLimitEnvelope(parsed) {
|
|
1537
|
-
const response = asRecord(parsed);
|
|
1538
|
-
const error = asRecord(_optionalChain([response, 'optionalAccess', _229 => _229.error]));
|
|
1539
|
-
return (_optionalChain([error, 'optionalAccess', _230 => _230.code]) === "monitor_upstream_rate_limited" || _optionalChain([error, 'optionalAccess', _231 => _231.code]) === "monitor_preview_rate_limited") && typeof error.message === "string";
|
|
1540
|
-
}
|
|
1541
|
-
function asRecord(value) {
|
|
1542
|
-
return typeof value === "object" && value !== null ? value : null;
|
|
1543
|
-
}
|
|
1544
|
-
function isRetryableApiErrorResponse(status) {
|
|
1545
|
-
return status === 408 || status === 425 || status >= 500 && status < 600;
|
|
1546
|
-
}
|
|
1547
|
-
function detectHtmlErrorBody(body, contentType) {
|
|
1548
|
-
const trimmed = body.trim();
|
|
1549
|
-
const lower = trimmed.toLowerCase();
|
|
1550
|
-
const isHtml = (_nullishCoalesce(contentType, () => ( ""))).toLowerCase().includes("text/html") || lower.startsWith("<!doctype") || lower.startsWith("<html");
|
|
1551
|
-
if (!isHtml) {
|
|
1552
|
-
return null;
|
|
1553
|
-
}
|
|
1554
|
-
const titleMatch = trimmed.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
|
|
1555
|
-
const title = _optionalChain([titleMatch, 'optionalAccess', _232 => _232[1], 'optionalAccess', _233 => _233.replace, 'call', _234 => _234(/\s+/g, " "), 'access', _235 => _235.trim, 'call', _236 => _236()]) || void 0;
|
|
1556
|
-
const workerThrewException = /worker threw exception/i.test(trimmed);
|
|
1557
|
-
return {
|
|
1558
|
-
title,
|
|
1559
|
-
workerThrewException,
|
|
1560
|
-
message: (status) => {
|
|
1561
|
-
const segments = [`HTTP ${status}`];
|
|
1562
|
-
if (workerThrewException) {
|
|
1563
|
-
segments.push("Worker threw exception");
|
|
1564
|
-
}
|
|
1565
|
-
if (title) {
|
|
1566
|
-
segments.push(title);
|
|
1567
|
-
}
|
|
1568
|
-
return `${segments.join(": ")} (Cloudflare HTML error page suppressed)`;
|
|
1569
|
-
}
|
|
1570
|
-
};
|
|
1571
|
-
}
|
|
1572
|
-
function parseRetryAfter(response) {
|
|
1573
|
-
return _nullishCoalesce(parseOptionalRetryAfter(response), () => ( 5e3));
|
|
1574
|
-
}
|
|
1575
|
-
function parseOptionalRetryAfter(response) {
|
|
1576
|
-
const header = response.headers.get("retry-after");
|
|
1577
|
-
if (header) {
|
|
1578
|
-
const seconds = Number(header);
|
|
1579
|
-
if (Number.isFinite(seconds) && seconds > 0) {
|
|
1580
|
-
return seconds * 1e3;
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
return null;
|
|
1584
|
-
}
|
|
1585
|
-
function buildCandidateUrls(url) {
|
|
1586
|
-
try {
|
|
1587
|
-
const parsed = new URL(url);
|
|
1588
|
-
const candidates = [url];
|
|
1589
|
-
if (parsed.hostname === "localhost") {
|
|
1590
|
-
const loopback = new URL(url);
|
|
1591
|
-
loopback.hostname = "127.0.0.1";
|
|
1592
|
-
candidates.push(loopback.toString());
|
|
1593
|
-
}
|
|
1594
|
-
return [...new Set(candidates)];
|
|
1595
|
-
} catch (e18) {
|
|
1596
|
-
return [url];
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
async function* decodeSseStream(body) {
|
|
1600
|
-
const reader = body.getReader();
|
|
1601
|
-
const decoder = new TextDecoder();
|
|
1602
|
-
let buffered = "";
|
|
1603
|
-
try {
|
|
1604
|
-
while (true) {
|
|
1605
|
-
const { value, done } = await reader.read();
|
|
1606
|
-
if (done) break;
|
|
1607
|
-
buffered += decoder.decode(value, { stream: true });
|
|
1608
|
-
const frames = buffered.split(/\r?\n\r?\n/);
|
|
1609
|
-
buffered = _nullishCoalesce(frames.pop(), () => ( ""));
|
|
1610
|
-
for (const frame of frames) {
|
|
1611
|
-
const event2 = decodeSseFrame(frame);
|
|
1612
|
-
if (event2) {
|
|
1613
|
-
yield event2;
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
buffered += decoder.decode();
|
|
1618
|
-
const event = decodeSseFrame(buffered);
|
|
1619
|
-
if (event) {
|
|
1620
|
-
yield event;
|
|
1621
|
-
}
|
|
1622
|
-
} finally {
|
|
1623
|
-
reader.releaseLock();
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
function decodeSseFrame(frame) {
|
|
1627
|
-
const data = frame.split(/\r?\n/).filter((line) => line.startsWith("data:")).map((line) => line.slice("data:".length).trimStart()).join("\n").trim();
|
|
1628
|
-
if (!data) {
|
|
1629
|
-
return null;
|
|
1630
|
-
}
|
|
1631
|
-
const parsed = JSON.parse(data);
|
|
1632
|
-
if (!parsed || typeof parsed !== "object" || typeof parsed.cursor !== "string" || typeof parsed.streamId !== "string" || typeof parsed.scope !== "string" || typeof parsed.type !== "string" || typeof parsed.at !== "string") {
|
|
1633
|
-
return null;
|
|
1634
|
-
}
|
|
1635
|
-
return parsed;
|
|
1636
|
-
}
|
|
1637
|
-
function sleep(ms, signal) {
|
|
1638
|
-
return new Promise((resolve2, reject) => {
|
|
1639
|
-
if (_optionalChain([signal, 'optionalAccess', _237 => _237.aborted])) {
|
|
1640
|
-
reject(requestCancelledError(signal));
|
|
1641
|
-
return;
|
|
1642
|
-
}
|
|
1643
|
-
const timeoutId = setTimeout(() => {
|
|
1644
|
-
_optionalChain([signal, 'optionalAccess', _238 => _238.removeEventListener, 'call', _239 => _239("abort", abort)]);
|
|
1645
|
-
resolve2();
|
|
1646
|
-
}, ms);
|
|
1647
|
-
const abort = () => {
|
|
1648
|
-
clearTimeout(timeoutId);
|
|
1649
|
-
_optionalChain([signal, 'optionalAccess', _240 => _240.removeEventListener, 'call', _241 => _241("abort", abort)]);
|
|
1650
|
-
reject(requestCancelledError(signal));
|
|
1651
|
-
};
|
|
1652
|
-
_optionalChain([signal, 'optionalAccess', _242 => _242.addEventListener, 'call', _243 => _243("abort", abort, { once: true })]);
|
|
1653
|
-
});
|
|
1654
|
-
}
|
|
1655
|
-
function withCoworkNetworkHint(message) {
|
|
1656
|
-
if (!isCoworkLikeSandbox2() || message.includes(COWORK_NETWORK_HINT)) {
|
|
1657
|
-
return message;
|
|
1658
|
-
}
|
|
1659
|
-
return `${message}
|
|
1660
|
-
${COWORK_NETWORK_HINT}`;
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
exports.HOST_URL_ENV = HOST_URL_ENV; exports.API_KEY_ENV = API_KEY_ENV; exports.ACTIVE_ORG_ID_ENV = ACTIVE_ORG_ID_ENV; exports.ACTIVE_ORG_NAME_ENV = ACTIVE_ORG_NAME_ENV; exports.FEATURES_ENV = FEATURES_ENV; exports.PROD_URL = PROD_URL; exports.featureEnvValues = featureEnvValues; exports.storedHostApiKey = storedHostApiKey; exports.storedHostFeatures = storedHostFeatures; exports.baseUrlSlug = baseUrlSlug; exports.sdkCliStateDirPath = sdkCliStateDirPath; exports.hostConfigDirPath = hostConfigDirPath; exports.hostEnvFilePath = hostEnvFilePath; exports.saveHostEnvValues = saveHostEnvValues; exports.autoDetectBaseUrl = autoDetectBaseUrl; exports.resolveApiKeyForBaseUrl = resolveApiKeyForBaseUrl; exports.resolveProjectApiKeyForBaseUrl = resolveProjectApiKeyForBaseUrl; exports.resolveGlobalApiKeyForBaseUrl = resolveGlobalApiKeyForBaseUrl; exports.getResolvedProjectAuthSource = getResolvedProjectAuthSource; exports.resolveBaseUrlOnly = resolveBaseUrlOnly; exports.resolveConfig = resolveConfig; exports.ensureProjectPrivatePathsIgnored = ensureProjectPrivatePathsIgnored; exports.saveProjectDeeplineEnvValues = saveProjectDeeplineEnvValues; exports.resolveProjectPinTarget = resolveProjectPinTarget; exports.getActiveProjectAuthSource = getActiveProjectAuthSource; exports.resolveCliAuthProvenance = resolveCliAuthProvenance; exports.resolveCliCommandContext = resolveCliCommandContext; exports.ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER = ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER; exports.SDK_VERSION = SDK_VERSION; exports.SDK_API_MAJOR = SDK_API_MAJOR; exports.SDK_API_CONTRACT = SDK_API_CONTRACT; exports.agentSessionIdFromEnvironment = agentSessionIdFromEnvironment; exports.detectAgentRuntime = detectAgentRuntime; exports.hasActivePluginSkills = hasActivePluginSkills; exports.KNOWN_SKILL_AGENTS = KNOWN_SKILL_AGENTS; exports.DEFAULT_SKILL_AGENTS = DEFAULT_SKILL_AGENTS; exports.skillsAgentPathSegment = skillsAgentPathSegment; exports.resolveAutoSyncSkillAgents = resolveAutoSyncSkillAgents; exports.readSdkSkillsLocalVersion = readSdkSkillsLocalVersion; exports.writeSdkSkillsLocalVersion = writeSdkSkillsLocalVersion; exports.deploymentProtectionHeaders = deploymentProtectionHeaders; exports.fetchWithDeploymentProtection = fetchWithDeploymentProtection; exports.COORDINATOR_INTERNAL_TOKEN_HEADER = COORDINATOR_INTERNAL_TOKEN_HEADER; exports.RUNTIME_ENVIRONMENT_TOKEN_HEADER = RUNTIME_ENVIRONMENT_TOKEN_HEADER; exports.RETAINED_PIPELINE_RECEIVERS_HEADER = RETAINED_PIPELINE_RECEIVERS_HEADER; exports.HttpClient = HttpClient;
|