deepline 0.3.461 → 0.3.463
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/tamradar.ts +17 -17
- 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 +61 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +122 -2
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +11 -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 +38 -12
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +33 -9
- 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-6HJXNWUG.mjs → auth-LZLBR4C3.mjs} +5 -4
- package/dist/cli/auth-XPGKBJKB.js +41 -0
- package/dist/cli/{billing-6P5HO6QG.js → billing-6TJPNJQD.js} +152 -78
- package/dist/cli/{billing-MJ42N7YF.mjs → billing-OTOP5RE4.mjs} +84 -10
- package/dist/cli/{chunk-FCAZQ7WV.js → chunk-2NISBXMN.js} +52 -50
- package/dist/cli/{chunk-PNATXKLP.js → chunk-2ZIRCBYG.js} +6 -6
- package/dist/cli/{chunk-5FDKJQZE.js → chunk-3BOIOCNX.js} +1 -1
- package/dist/cli/chunk-3BVLLJ3H.mjs +1038 -0
- package/dist/cli/{chunk-FJZILBL7.mjs → chunk-3U5EAP6E.mjs} +5 -5
- package/dist/cli/{describe-FRAVCY5F.mjs → chunk-4YZKBBLZ.mjs} +19 -36
- package/dist/cli/{chunk-QWRHGGUH.js → chunk-5DRNNC72.js} +20 -2
- package/dist/cli/{chunk-Z2GUFYT6.js → chunk-5LEAXRHV.js} +11 -11
- package/dist/cli/{chunk-5MDIZX7M.js → chunk-5LHXOIPT.js} +8 -6
- package/dist/cli/{chunk-NMJ4D2WO.js → chunk-6PMCRYDA.js} +216 -91
- package/dist/cli/{chunk-EBU7LQ64.js → chunk-6V7KVRR5.js} +3 -3
- package/dist/cli/{chunk-MGXEUZHL.mjs → chunk-7D6X7IXW.mjs} +7 -5
- package/dist/cli/{chunk-SAZFZQRI.js → chunk-7FCYPAPP.js} +2 -2
- package/dist/cli/{chunk-ACCR7POB.js → chunk-7XYDDCQ2.js} +27 -27
- package/dist/cli/{chunk-5IYOUBFZ.js → chunk-ALZBANZI.js} +28 -54
- package/dist/cli/{chunk-3DNKFH2G.mjs → chunk-BAPTQDLF.mjs} +19 -1
- package/dist/cli/chunk-BGNWI3KH.js +827 -0
- package/dist/cli/{chunk-V7REJRDZ.mjs → chunk-C25QE4CH.mjs} +1 -1
- package/dist/cli/{chunk-FGMX4HUZ.js → chunk-CBZP6J3V.js} +29 -27
- package/dist/cli/{chunk-QEYHTIV4.mjs → chunk-CTQ56DXP.mjs} +10 -1
- package/dist/cli/{chunk-IHHLTHE7.mjs → chunk-CVQ7N5CV.mjs} +267 -38
- package/dist/cli/{chunk-7DH2FD7Y.mjs → chunk-D464JW3N.mjs} +5 -85
- package/dist/cli/{chunk-MEAIOXJL.mjs → chunk-DHXCBITQ.mjs} +7 -5
- package/dist/cli/chunk-F2RHUPVH.mjs +827 -0
- package/dist/cli/chunk-F6QV42MC.mjs +91 -0
- package/dist/cli/{chunk-OZBWRICM.js → chunk-FK2HNDCN.js} +2 -2
- package/dist/cli/{chunk-BGY2PLP7.mjs → chunk-GUT7CLOL.mjs} +23 -49
- package/dist/cli/{chunk-RY4IVOU3.mjs → chunk-I624J4H5.mjs} +16 -806
- package/dist/cli/{chunk-Z2XUZC34.js → chunk-IAYSWZDJ.js} +188 -76
- package/dist/cli/{chunk-FGLKOWSC.mjs → chunk-IKWRUNAP.mjs} +1 -1
- package/dist/cli/{chunk-KCCOQ5G5.js → chunk-JVDKZJUH.js} +511 -282
- package/dist/cli/{chunk-HDFRJ4IT.mjs → chunk-JVHOS3K3.mjs} +177 -65
- package/dist/cli/chunk-LYFKBLJI.mjs +1039 -0
- package/dist/cli/{chunk-SLEUWLJE.mjs → chunk-MSY22NQW.mjs} +5 -5
- package/dist/cli/{chunk-5FY72YOV.js → chunk-NAPTMYTY.js} +8 -8
- package/dist/cli/{chunk-O6QOMHCH.js → chunk-NDHJR2WZ.js} +37 -35
- package/dist/cli/{chunk-KXMNM4AQ.js → chunk-NMU3VR5U.js} +4 -5
- package/dist/cli/chunk-NTLI6P6Y.mjs +19 -0
- package/dist/cli/{chunk-RFONC4WJ.mjs → chunk-O3BJYD6D.mjs} +3 -3
- package/dist/cli/{describe-2WQY7ZCY.js → chunk-PVY4DPPF.js} +27 -44
- package/dist/cli/{chunk-WIYWSYDS.mjs → chunk-Q2EIZKVX.mjs} +3 -3
- package/dist/cli/{chunk-VZBCEA5S.mjs → chunk-RD6IQ2JY.mjs} +223 -92
- package/dist/cli/chunk-RGOUCIIZ.js +1039 -0
- package/dist/cli/{chunk-EIMG75BT.mjs → chunk-S3A4IXBQ.mjs} +4 -5
- package/dist/cli/{chunk-QIW7TVV6.mjs → chunk-S4XQCFES.mjs} +14 -12
- package/dist/cli/chunk-SKU6ECIY.js +19 -0
- package/dist/cli/{chunk-CRYOUPEB.js → chunk-TIRBDQ3W.js} +16 -16
- package/dist/cli/{chunk-G7L27KZB.mjs → chunk-TKAQR3IB.mjs} +31 -21
- package/dist/cli/{chunk-MDJPEGVN.js → chunk-UC4SFYNU.js} +392 -261
- package/dist/cli/{chunk-3BMLICF7.mjs → chunk-UIURR26V.mjs} +13 -8
- package/dist/cli/{chunk-TNMBPMMC.js → chunk-UROQDCVW.js} +13 -4
- package/dist/cli/{chunk-R64BGGRQ.mjs → chunk-VDGTTH7K.mjs} +2 -2
- package/dist/cli/chunk-VLEVVDWG.js +91 -0
- package/dist/cli/{chunk-R2GLGLDR.mjs → chunk-VPHN2HAL.mjs} +216 -91
- package/dist/cli/chunk-VY2GBNTX.js +1038 -0
- package/dist/cli/{chunk-CFUTOWE4.js → chunk-WG3KGAII.js} +8 -88
- package/dist/cli/{chunk-QAJAJPKK.mjs → chunk-WUMIYOXQ.mjs} +4 -2
- package/dist/cli/{chunk-SCIR5JXW.js → chunk-WUZS2HK6.js} +56 -51
- package/dist/cli/{chunk-T3MVIPHG.mjs → chunk-XDWS2JJT.mjs} +1 -1
- package/dist/cli/{chunk-KGQNIA37.js → chunk-XQCTG5OO.js} +44 -34
- package/dist/cli/{chunk-KVJ5VHW5.mjs → chunk-XW2JIYG7.mjs} +2 -2
- package/dist/cli/chunk-YGGIZ3VT.js +920 -0
- 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-NX7NO3O6.js → csv-EH5QWR4O.js} +13 -12
- package/dist/cli/{csv-DQ6GW5B5.mjs → csv-OK45Z5XQ.mjs} +4 -3
- package/dist/cli/{db-R72DFMP6.js → db-3ESJKETS.js} +30 -27
- package/dist/cli/{db-2YP33M4K.mjs → db-6Z5E4HKN.mjs} +10 -7
- package/dist/cli/describe-PNDQB7YS.mjs +48 -0
- package/dist/cli/describe-QUF7VTTR.js +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-WFBU7L2Q.mjs → executions-2NTWQFEG.mjs} +7 -5
- package/dist/cli/{executions-ZLHD4QIT.js → executions-KUOBRX5V.js} +9 -7
- package/dist/cli/{feedback-CN3HJFVF.mjs → feedback-7RPRMSGY.mjs} +6 -5
- package/dist/cli/{feedback-NDV6TPHG.js → feedback-UPHAZJ4C.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-QAD6E3HW.mjs → git-SCYP6WSZ.mjs} +5 -4
- package/dist/cli/git-UH653WHV.js +25 -0
- package/dist/cli/index.js +152 -142
- package/dist/cli/index.mjs +56 -46
- package/dist/cli/{legacy-noops-KVC5QJ74.js → legacy-noops-7XMFCVRG.js} +8 -7
- package/dist/cli/{legacy-noops-TPTKNBI2.mjs → legacy-noops-A4KYAGI6.mjs} +5 -4
- package/dist/cli/{monitors-SV57JFLO.mjs → monitors-FLC5J7RI.mjs} +19 -6
- package/dist/cli/{monitors-KCROV6PJ.js → monitors-NZV6IX5H.js} +103 -90
- package/dist/cli/{org-NJYX5743.js → org-IZ7UP3XF.js} +70 -67
- package/dist/cli/{org-KX6QIR7A.mjs → org-LUETJ7Z5.mjs} +9 -6
- package/dist/cli/pages-22ML3O7O.js +252 -0
- package/dist/cli/pages-EUX5EAGF.mjs +252 -0
- package/dist/cli/{play-IQQ57L7Z.mjs → play-CDHPAKKM.mjs} +512 -1508
- package/dist/cli/{play-32L7EQN4.js → play-USJBQADG.js} +1090 -2086
- package/dist/cli/{providers-4WEC2EQN.mjs → providers-CCXZ3SQF.mjs} +7 -5
- package/dist/cli/{providers-ZQV6QLVQ.js → providers-WFEUNPGC.js} +10 -8
- package/dist/cli/{quickstart-HKUSFADF.js → quickstart-O4JSUORZ.js} +13 -12
- package/dist/cli/{quickstart-RQ76RIUE.mjs → quickstart-ZUULI635.mjs} +5 -4
- package/dist/cli/run-ISDJYJMU.js +443 -0
- package/dist/cli/run-QJ4NX5F5.mjs +443 -0
- package/dist/cli/{search-ZRAVFBZC.mjs → search-IX3XKZJ3.mjs} +8 -6
- package/dist/cli/search-TIFNLRPM.js +32 -0
- package/dist/cli/{secrets-CMJOVNVH.mjs → secrets-7VUDXTUZ.mjs} +7 -5
- package/dist/cli/{secrets-J3G5Y43U.js → secrets-ELQSNCTR.js} +16 -14
- package/dist/cli/{sessions-WY7VN4AE.js → sessions-A3FG3AZX.js} +6 -5
- package/dist/cli/{sessions-MDQYY5CB.mjs → sessions-VOIQ62GB.mjs} +5 -4
- package/dist/cli/{settings-4RWZPCT5.mjs → settings-S6N6EFBG.mjs} +14 -11
- package/dist/cli/{settings-HTNTFKCE.js → settings-ZTXQEMZI.js} +80 -77
- package/dist/cli/{setup-P3GYYZWG.mjs → setup-AYPIK4JE.mjs} +12 -10
- package/dist/cli/{setup-QGCAP62X.js → setup-Y3WOIFLS.js} +53 -51
- package/dist/cli/{skills-7NAE4ICL.mjs → skills-5SF5QWNI.mjs} +7 -6
- package/dist/cli/skills-MWFRMG3H.js +31 -0
- package/dist/cli/tools-3XNZ4J64.mjs +55 -0
- package/dist/cli/tools-XEC4OD3R.js +55 -0
- package/dist/cli/{update-GODLRKNB.mjs → update-3U4OVX5R.mjs} +9 -8
- package/dist/cli/update-DWYEYTZE.js +33 -0
- package/dist/cli/{workflow-4BXOUVEO.mjs → workflow-2M5JP7SA.mjs} +10 -8
- package/dist/cli/{workflow-AO3A6LXN.js → workflow-RM7H7555.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.ts → compiler-manifest-Dcyd3-Zd.d.mts} +43 -1
- package/dist/{compiler-manifest-CWz_sNOQ.d.mts → 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 +16 -12
- package/dist/index.mjs +15 -11
- 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-IACERYQH.js +0 -40
- package/dist/cli/chunk-PQUUWFXY.js +0 -95
- package/dist/cli/chunk-YBWAG72P.mjs +0 -95
- package/dist/cli/chunk-YQDUODZW.js +0 -1710
- package/dist/cli/git-JVI36ZFV.js +0 -24
- package/dist/cli/search-75X5LTDE.js +0 -30
- package/dist/cli/skills-BKJ53JOQ.js +0 -30
- package/dist/cli/tools-COWMIEJ6.mjs +0 -45
- package/dist/cli/tools-TASOCE7I.js +0 -45
- package/dist/cli/update-SJIKVME6.js +0 -32
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DEFAULT_MAX_CONCURRENT_EXTERNAL_CALLS,
|
|
3
|
+
MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS,
|
|
4
|
+
MAX_CONFIGURABLE_CONCURRENT_ROWS,
|
|
5
|
+
parsePlayRunHeaderFlag,
|
|
6
|
+
parsePlayRunOptions,
|
|
7
|
+
resolvePlayRunCliOptions
|
|
8
|
+
} from "./chunk-3BVLLJ3H.mjs";
|
|
9
|
+
import {
|
|
10
|
+
TABLE_EXPORT_ERROR_COLUMN,
|
|
2
11
|
addDescribeOptions,
|
|
3
|
-
|
|
4
|
-
|
|
12
|
+
orderRunExportJson,
|
|
13
|
+
outputCollections,
|
|
14
|
+
recordPlayTermination,
|
|
15
|
+
tableExportErrorCell,
|
|
16
|
+
tableExportHasFailedRows,
|
|
17
|
+
underscoreKeysLast,
|
|
18
|
+
writeExecutionOutput,
|
|
19
|
+
writeRunDatasetCsv
|
|
20
|
+
} from "./chunk-LYFKBLJI.mjs";
|
|
5
21
|
import {
|
|
6
22
|
registerDeprecatedSearchCommand
|
|
7
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-GUT7CLOL.mjs";
|
|
8
24
|
import {
|
|
9
25
|
handleDeploymentGet,
|
|
10
26
|
handleDeploymentsList
|
|
11
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-O3BJYD6D.mjs";
|
|
12
28
|
import {
|
|
13
29
|
buildPlayDashboardUrl
|
|
14
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-JVHOS3K3.mjs";
|
|
15
31
|
import {
|
|
16
32
|
shellQuote
|
|
17
33
|
} from "./chunk-OVDNJAJN.mjs";
|
|
@@ -23,9 +39,11 @@ import {
|
|
|
23
39
|
inlinePlaySource,
|
|
24
40
|
isAstNode,
|
|
25
41
|
listPlayFileExports,
|
|
26
|
-
parsePlaySourceForAnalysis
|
|
42
|
+
parsePlaySourceForAnalysis
|
|
43
|
+
} from "./chunk-D464JW3N.mjs";
|
|
44
|
+
import {
|
|
27
45
|
resolveEnabledExecutionProfile
|
|
28
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-F6QV42MC.mjs";
|
|
29
47
|
import "./chunk-H7HIDGZ7.mjs";
|
|
30
48
|
import "./chunk-FR2ILQ4G.mjs";
|
|
31
49
|
import {
|
|
@@ -34,10 +52,12 @@ import {
|
|
|
34
52
|
import {
|
|
35
53
|
pinLocalPlayImports,
|
|
36
54
|
planLocalPlayExecution
|
|
37
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-BAPTQDLF.mjs";
|
|
56
|
+
import {
|
|
57
|
+
DeeplineClient
|
|
58
|
+
} from "./chunk-NTLI6P6Y.mjs";
|
|
38
59
|
import "./chunk-ZCALLYF6.mjs";
|
|
39
60
|
import {
|
|
40
|
-
DeeplineClient,
|
|
41
61
|
RUN_EVENT_SEARCH_KIND_VALUES,
|
|
42
62
|
RunEventQueryInputError,
|
|
43
63
|
classifyLogLine,
|
|
@@ -49,7 +69,7 @@ import {
|
|
|
49
69
|
normalizePlayStatus,
|
|
50
70
|
normalizeRunEventOperationRequest,
|
|
51
71
|
parseLogLevel
|
|
52
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-RD6IQ2JY.mjs";
|
|
53
73
|
import "./chunk-L2VKAASU.mjs";
|
|
54
74
|
import {
|
|
55
75
|
CSV_DATA_INPUT_KEY,
|
|
@@ -58,33 +78,31 @@ import {
|
|
|
58
78
|
decodePlayRunPublicStatus,
|
|
59
79
|
fileInputBindingsFromPlaySchema,
|
|
60
80
|
fileInputBindingsFromStaticPipeline,
|
|
61
|
-
setDottedInputValue,
|
|
62
81
|
stageFileInputs,
|
|
63
82
|
stagedFileContentType
|
|
64
83
|
} from "./chunk-FAG4DFUC.mjs";
|
|
65
84
|
import {
|
|
66
85
|
CSV_HEADER_MATCHING_NOTE,
|
|
67
86
|
playInputExampleArgs
|
|
68
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-S3A4IXBQ.mjs";
|
|
69
88
|
import "./chunk-UBKA33KY.mjs";
|
|
70
89
|
import {
|
|
71
90
|
checkPlayRunCompatibility,
|
|
72
91
|
usesInlinePlayAdmission
|
|
73
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-XW2JIYG7.mjs";
|
|
74
93
|
import {
|
|
75
94
|
isCliTraceEnabled,
|
|
76
95
|
recordCliTrace,
|
|
77
96
|
resolveCliMaintenancePolicy,
|
|
78
97
|
traceCliSpan
|
|
79
|
-
} from "./chunk-
|
|
80
|
-
import "./chunk-
|
|
98
|
+
} from "./chunk-C25QE4CH.mjs";
|
|
99
|
+
import "./chunk-UIURR26V.mjs";
|
|
81
100
|
import {
|
|
82
101
|
createCliProgress,
|
|
83
102
|
getActiveCliProgress
|
|
84
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-CTQ56DXP.mjs";
|
|
85
104
|
import {
|
|
86
105
|
argsWantJson,
|
|
87
|
-
csvSafeJsonString,
|
|
88
106
|
describeArgs,
|
|
89
107
|
getAuthedHttpClient,
|
|
90
108
|
jsonFieldArgs,
|
|
@@ -96,16 +114,17 @@ import {
|
|
|
96
114
|
printJsonError,
|
|
97
115
|
renderCommandEnvelopeText,
|
|
98
116
|
shouldEmitJson
|
|
99
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-WUMIYOXQ.mjs";
|
|
118
|
+
import "./chunk-F2RHUPVH.mjs";
|
|
100
119
|
import {
|
|
101
120
|
fetchWithDeploymentProtection
|
|
102
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-I624J4H5.mjs";
|
|
103
122
|
import "./chunk-4QF2K7TM.mjs";
|
|
104
123
|
import "./chunk-DLIRSHV6.mjs";
|
|
105
124
|
import {
|
|
106
125
|
DeeplineError
|
|
107
126
|
} from "./chunk-HBL4PM5Q.mjs";
|
|
108
|
-
import "./chunk-
|
|
127
|
+
import "./chunk-XDWS2JJT.mjs";
|
|
109
128
|
import "./chunk-WZYKRD7T.mjs";
|
|
110
129
|
import {
|
|
111
130
|
__commonJS,
|
|
@@ -3947,7 +3966,7 @@ function checkedRunExample(plays, target) {
|
|
|
3947
3966
|
const schema = record2(play?.inputSchema);
|
|
3948
3967
|
if (!play?.valid || !schema) return void 0;
|
|
3949
3968
|
const quote = (value) => `'${value.replace(/'/g, `'\\''`)}'`;
|
|
3950
|
-
const base = `deepline
|
|
3969
|
+
const base = `deepline run ${quote(target)}`;
|
|
3951
3970
|
return {
|
|
3952
3971
|
command: `${base}${playInputExampleArgs(schema)}`,
|
|
3953
3972
|
note: "Runs the local file without publishing and may spend credits. Supply the indicated file; JSON input must match inputSchema."
|
|
@@ -3970,7 +3989,7 @@ function buildPlayCheckOutput(input) {
|
|
|
3970
3989
|
actions: {
|
|
3971
3990
|
...runExample ? { runExample } : {},
|
|
3972
3991
|
getFullCheckCmd: input.detailsCommand,
|
|
3973
|
-
getRunHelpCmd: "deepline
|
|
3992
|
+
getRunHelpCmd: "deepline run --help",
|
|
3974
3993
|
...valid && input.publishCommand ? { publishCmd: input.publishCommand } : {}
|
|
3975
3994
|
}
|
|
3976
3995
|
};
|
|
@@ -3984,14 +4003,14 @@ ${JSON.stringify(value, null, 2)}` : `${key}: ${String(value)}`
|
|
|
3984
4003
|
|
|
3985
4004
|
// src/cli/commands/play.ts
|
|
3986
4005
|
import {
|
|
3987
|
-
existsSync
|
|
4006
|
+
existsSync,
|
|
3988
4007
|
mkdirSync,
|
|
3989
|
-
readFileSync
|
|
4008
|
+
readFileSync,
|
|
3990
4009
|
readdirSync,
|
|
3991
4010
|
realpathSync,
|
|
3992
4011
|
rmSync,
|
|
3993
4012
|
statSync,
|
|
3994
|
-
writeFileSync as
|
|
4013
|
+
writeFileSync as writeFileSync2
|
|
3995
4014
|
} from "fs";
|
|
3996
4015
|
import {
|
|
3997
4016
|
lstat,
|
|
@@ -4007,7 +4026,7 @@ import {
|
|
|
4007
4026
|
isAbsolute as isAbsolute2,
|
|
4008
4027
|
join as join6,
|
|
4009
4028
|
relative as relative3,
|
|
4010
|
-
resolve as
|
|
4029
|
+
resolve as resolve3
|
|
4011
4030
|
} from "path";
|
|
4012
4031
|
import { Option as Option2 } from "commander";
|
|
4013
4032
|
|
|
@@ -4365,198 +4384,6 @@ function formatRunHitCountLines(tables) {
|
|
|
4365
4384
|
return lines;
|
|
4366
4385
|
}
|
|
4367
4386
|
|
|
4368
|
-
// src/cli/run-dataset-csv.ts
|
|
4369
|
-
import { writeFileSync } from "fs";
|
|
4370
|
-
import { resolve } from "path";
|
|
4371
|
-
|
|
4372
|
-
// ../plays/table-csv.ts
|
|
4373
|
-
var TABLE_EXPORT_ERROR_COLUMN = "_error";
|
|
4374
|
-
var UNRECORDED_FAILURE_REASON = "Row failed without a recorded reason.";
|
|
4375
|
-
function tableCellText(value) {
|
|
4376
|
-
if (value === null || value === void 0) return "";
|
|
4377
|
-
if (typeof value === "string") return value;
|
|
4378
|
-
if (typeof value === "number" || typeof value === "bigint" || typeof value === "boolean")
|
|
4379
|
-
return String(value);
|
|
4380
|
-
if (value instanceof Date) return value.toISOString();
|
|
4381
|
-
if (typeof value === "symbol" || typeof value === "function") return "";
|
|
4382
|
-
try {
|
|
4383
|
-
return JSON.stringify(
|
|
4384
|
-
value,
|
|
4385
|
-
(_key, nested) => typeof nested === "bigint" ? nested.toString() : nested
|
|
4386
|
-
) ?? "";
|
|
4387
|
-
} catch {
|
|
4388
|
-
return String(value);
|
|
4389
|
-
}
|
|
4390
|
-
}
|
|
4391
|
-
function csvField(value) {
|
|
4392
|
-
const text = tableCellText(value);
|
|
4393
|
-
return /[",\r\n]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text;
|
|
4394
|
-
}
|
|
4395
|
-
function csvRecord(values) {
|
|
4396
|
-
return `${values.map(csvField).join(",")}
|
|
4397
|
-
`;
|
|
4398
|
-
}
|
|
4399
|
-
function isFailedRow(row) {
|
|
4400
|
-
return row.status === "failed";
|
|
4401
|
-
}
|
|
4402
|
-
function tableExportHasFailedRows(rows) {
|
|
4403
|
-
for (const row of rows) if (isFailedRow(row)) return true;
|
|
4404
|
-
return false;
|
|
4405
|
-
}
|
|
4406
|
-
function tableExportErrorCell(row) {
|
|
4407
|
-
if (!isFailedRow(row)) return "";
|
|
4408
|
-
const reason = typeof row.error === "string" ? row.error.trim() : "";
|
|
4409
|
-
return reason || UNRECORDED_FAILURE_REASON;
|
|
4410
|
-
}
|
|
4411
|
-
function tableExportColumns(columns, withError) {
|
|
4412
|
-
if (!withError) return [...columns];
|
|
4413
|
-
return [
|
|
4414
|
-
...columns.filter((column) => column !== TABLE_EXPORT_ERROR_COLUMN),
|
|
4415
|
-
TABLE_EXPORT_ERROR_COLUMN
|
|
4416
|
-
];
|
|
4417
|
-
}
|
|
4418
|
-
function tableExportCells(row, columns, withError) {
|
|
4419
|
-
return tableExportColumns(columns, withError).map(
|
|
4420
|
-
(column) => column === TABLE_EXPORT_ERROR_COLUMN && withError ? tableExportErrorCell(row) : Object.hasOwn(row.data, column) ? row.data[column] : void 0
|
|
4421
|
-
);
|
|
4422
|
-
}
|
|
4423
|
-
function tableCsvText(header, records) {
|
|
4424
|
-
let text = csvRecord(header);
|
|
4425
|
-
for (const record3 of records) text += csvRecord(record3);
|
|
4426
|
-
return text;
|
|
4427
|
-
}
|
|
4428
|
-
|
|
4429
|
-
// src/cli/run-dataset-order.ts
|
|
4430
|
-
function underscoreKeysLast(keys) {
|
|
4431
|
-
return [...keys].sort(
|
|
4432
|
-
(left, right) => Number(left.startsWith("_")) - Number(right.startsWith("_"))
|
|
4433
|
-
);
|
|
4434
|
-
}
|
|
4435
|
-
function orderRunExportJson(value) {
|
|
4436
|
-
const copies = /* @__PURE__ */ new WeakMap();
|
|
4437
|
-
function visit(item) {
|
|
4438
|
-
if (item === null || typeof item !== "object") return item;
|
|
4439
|
-
if (copies.has(item)) return copies.get(item);
|
|
4440
|
-
if (Array.isArray(item)) {
|
|
4441
|
-
const copy2 = [];
|
|
4442
|
-
copies.set(item, copy2);
|
|
4443
|
-
for (const element of item) copy2.push(visit(element));
|
|
4444
|
-
return copy2;
|
|
4445
|
-
}
|
|
4446
|
-
const prototype = Object.getPrototypeOf(item);
|
|
4447
|
-
if (prototype !== Object.prototype && prototype !== null) return item;
|
|
4448
|
-
const record3 = item;
|
|
4449
|
-
const copy = /* @__PURE__ */ Object.create(null);
|
|
4450
|
-
copies.set(item, copy);
|
|
4451
|
-
for (const key of underscoreKeysLast(Object.keys(record3))) {
|
|
4452
|
-
copy[key] = visit(record3[key]);
|
|
4453
|
-
}
|
|
4454
|
-
return copy;
|
|
4455
|
-
}
|
|
4456
|
-
return visit(value);
|
|
4457
|
-
}
|
|
4458
|
-
|
|
4459
|
-
// src/cli/run-dataset-csv.ts
|
|
4460
|
-
var RunDatasetCsv = class _RunDatasetCsv {
|
|
4461
|
-
#projection;
|
|
4462
|
-
constructor(input) {
|
|
4463
|
-
const rows = input.rows.map(projectRunDatasetRow);
|
|
4464
|
-
this.#projection = {
|
|
4465
|
-
rows,
|
|
4466
|
-
columns: runDatasetCsvColumns(rows, input.columns)
|
|
4467
|
-
};
|
|
4468
|
-
}
|
|
4469
|
-
static from(input) {
|
|
4470
|
-
return new _RunDatasetCsv(input);
|
|
4471
|
-
}
|
|
4472
|
-
projection() {
|
|
4473
|
-
return this.#projection;
|
|
4474
|
-
}
|
|
4475
|
-
write(outPath) {
|
|
4476
|
-
const absolutePath = resolve(outPath);
|
|
4477
|
-
const { rows, columns } = this.#projection;
|
|
4478
|
-
writeFileSync(
|
|
4479
|
-
absolutePath,
|
|
4480
|
-
tableCsvText(
|
|
4481
|
-
columns,
|
|
4482
|
-
rows.map((data) => tableExportCells({ data }, columns, false))
|
|
4483
|
-
),
|
|
4484
|
-
"utf-8"
|
|
4485
|
-
);
|
|
4486
|
-
return absolutePath;
|
|
4487
|
-
}
|
|
4488
|
-
};
|
|
4489
|
-
function writeRunDatasetCsv(input) {
|
|
4490
|
-
return RunDatasetCsv.from(input).write(input.outPath);
|
|
4491
|
-
}
|
|
4492
|
-
function projectRunDatasetRow(row) {
|
|
4493
|
-
return Object.fromEntries(
|
|
4494
|
-
Object.entries(row).map(([column, value]) => [
|
|
4495
|
-
column,
|
|
4496
|
-
projectRunDatasetCell(value)
|
|
4497
|
-
])
|
|
4498
|
-
);
|
|
4499
|
-
}
|
|
4500
|
-
function projectRunDatasetCell(value) {
|
|
4501
|
-
const logicalValue = parseSerializedDatasetValue(value);
|
|
4502
|
-
if (logicalValue === null || logicalValue === void 0) return logicalValue;
|
|
4503
|
-
if (typeof logicalValue === "object") {
|
|
4504
|
-
return csvSafeJsonString(canonicalDatasetJson(logicalValue));
|
|
4505
|
-
}
|
|
4506
|
-
return logicalValue;
|
|
4507
|
-
}
|
|
4508
|
-
function canonicalDatasetJson(value) {
|
|
4509
|
-
return canonicalDatasetJsonValue(value, /* @__PURE__ */ new WeakSet());
|
|
4510
|
-
}
|
|
4511
|
-
function canonicalDatasetJsonValue(value, ancestors) {
|
|
4512
|
-
if (Array.isArray(value)) {
|
|
4513
|
-
if (ancestors.has(value)) return value;
|
|
4514
|
-
ancestors.add(value);
|
|
4515
|
-
const normalized2 = value.map(
|
|
4516
|
-
(item) => canonicalDatasetJsonValue(item, ancestors)
|
|
4517
|
-
);
|
|
4518
|
-
ancestors.delete(value);
|
|
4519
|
-
return normalized2;
|
|
4520
|
-
}
|
|
4521
|
-
if (!value || typeof value !== "object" || value instanceof Date) {
|
|
4522
|
-
return value;
|
|
4523
|
-
}
|
|
4524
|
-
if (ancestors.has(value)) return value;
|
|
4525
|
-
ancestors.add(value);
|
|
4526
|
-
const record3 = value;
|
|
4527
|
-
const normalized = Object.fromEntries(
|
|
4528
|
-
underscoreKeysLast(
|
|
4529
|
-
Object.keys(record3).sort((left, right) => left.localeCompare(right))
|
|
4530
|
-
).map((key) => [key, canonicalDatasetJsonValue(record3[key], ancestors)])
|
|
4531
|
-
);
|
|
4532
|
-
ancestors.delete(value);
|
|
4533
|
-
return normalized;
|
|
4534
|
-
}
|
|
4535
|
-
function parseSerializedDatasetValue(value) {
|
|
4536
|
-
if (typeof value !== "string") return value;
|
|
4537
|
-
const text = value.trim();
|
|
4538
|
-
if (!text || !["{", "["].includes(text[0] ?? "")) return value;
|
|
4539
|
-
try {
|
|
4540
|
-
return JSON.parse(text);
|
|
4541
|
-
} catch {
|
|
4542
|
-
return value;
|
|
4543
|
-
}
|
|
4544
|
-
}
|
|
4545
|
-
function runDatasetCsvColumns(rows, declaredColumns) {
|
|
4546
|
-
const columns = [];
|
|
4547
|
-
const seen = /* @__PURE__ */ new Set();
|
|
4548
|
-
const add = (column) => {
|
|
4549
|
-
if (!column || seen.has(column)) return;
|
|
4550
|
-
seen.add(column);
|
|
4551
|
-
columns.push(column);
|
|
4552
|
-
};
|
|
4553
|
-
for (const column of declaredColumns) add(column);
|
|
4554
|
-
for (const row of rows) {
|
|
4555
|
-
for (const column of Object.keys(row)) add(column);
|
|
4556
|
-
}
|
|
4557
|
-
return underscoreKeysLast(columns);
|
|
4558
|
-
}
|
|
4559
|
-
|
|
4560
4387
|
// src/cli/dataset-stats.ts
|
|
4561
4388
|
function mergeCanonicalRowsInfo(left, right) {
|
|
4562
4389
|
if (left.datasetId && right.datasetId && left.datasetId !== right.datasetId) {
|
|
@@ -5114,8 +4941,8 @@ function extractCanonicalRowsInfo(statusOrResult) {
|
|
|
5114
4941
|
}
|
|
5115
4942
|
|
|
5116
4943
|
// src/cli/run-dataset-selection.ts
|
|
5117
|
-
import { writeFileSync
|
|
5118
|
-
import { resolve
|
|
4944
|
+
import { writeFileSync } from "fs";
|
|
4945
|
+
import { resolve } from "path";
|
|
5119
4946
|
var Run = class _Run {
|
|
5120
4947
|
#datasets;
|
|
5121
4948
|
constructor(input) {
|
|
@@ -5241,8 +5068,8 @@ var RunDataset = class _RunDataset {
|
|
|
5241
5068
|
);
|
|
5242
5069
|
}
|
|
5243
5070
|
if (options.format === "json") {
|
|
5244
|
-
const absolutePath =
|
|
5245
|
-
|
|
5071
|
+
const absolutePath = resolve(outPath);
|
|
5072
|
+
writeFileSync(
|
|
5246
5073
|
absolutePath,
|
|
5247
5074
|
`${JSON.stringify(orderRunExportJson(this.rows), null, 2)}
|
|
5248
5075
|
`,
|
|
@@ -5449,31 +5276,6 @@ ${hint}`;
|
|
|
5449
5276
|
});
|
|
5450
5277
|
}
|
|
5451
5278
|
|
|
5452
|
-
// ../play-runtime/governor/policy.ts
|
|
5453
|
-
var DEFAULT_MAX_CONCURRENT_EXTERNAL_CALLS = 64;
|
|
5454
|
-
var MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS = 1e3;
|
|
5455
|
-
var MAX_CONFIGURABLE_CONCURRENT_ROWS = 1e3;
|
|
5456
|
-
function resolveMaxConcurrentExternalCalls(requested) {
|
|
5457
|
-
if (requested === void 0 || requested === null) {
|
|
5458
|
-
return DEFAULT_MAX_CONCURRENT_EXTERNAL_CALLS;
|
|
5459
|
-
}
|
|
5460
|
-
if (!Number.isSafeInteger(requested) || requested < 1 || requested > MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS) {
|
|
5461
|
-
throw new Error(
|
|
5462
|
-
`maxConcurrentExternalCalls must be a whole number from 1 through ${MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS}.`
|
|
5463
|
-
);
|
|
5464
|
-
}
|
|
5465
|
-
return requested;
|
|
5466
|
-
}
|
|
5467
|
-
function resolveMaxConcurrentRows(requested) {
|
|
5468
|
-
if (requested === void 0 || requested === null) return null;
|
|
5469
|
-
if (!Number.isSafeInteger(requested) || requested < 1 || requested > MAX_CONFIGURABLE_CONCURRENT_ROWS) {
|
|
5470
|
-
throw new Error(
|
|
5471
|
-
`maxConcurrentRows must be a whole number from 1 through ${MAX_CONFIGURABLE_CONCURRENT_ROWS}.`
|
|
5472
|
-
);
|
|
5473
|
-
}
|
|
5474
|
-
return requested;
|
|
5475
|
-
}
|
|
5476
|
-
|
|
5477
5279
|
// ../plays/sandbox-runtime-limits.ts
|
|
5478
5280
|
var PLAY_SANDBOX_SIZE_LIMITS = {
|
|
5479
5281
|
standard: {
|
|
@@ -5619,6 +5421,8 @@ function resolveModalSandboxComputeItem(input) {
|
|
|
5619
5421
|
var STANDARD_PLAY_RUNTIME_LIMIT_SECONDS = 30 * 60;
|
|
5620
5422
|
var PLAY_RUNNER_TERMINAL_GRACE_SECONDS = 90;
|
|
5621
5423
|
var PLAY_RUNNER_STARTUP_GRACE_SECONDS = 4 * 60;
|
|
5424
|
+
var SANDBOX_NETWORK_CUT_MAX_MS = 11 * 6e4;
|
|
5425
|
+
var RUNNER_GATEWAY_CONNECTION_RETRY_BUDGET_MS = SANDBOX_NETWORK_CUT_MAX_MS + 6e4;
|
|
5622
5426
|
var PLAY_RUNNER_TIMEOUT_SECONDS = 40 * 60;
|
|
5623
5427
|
var WORKFLOW_EXECUTOR_TOKEN_TTL_SECONDS = MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds + (PLAY_RUNNER_TIMEOUT_SECONDS - STANDARD_PLAY_RUNTIME_LIMIT_SECONDS);
|
|
5624
5428
|
|
|
@@ -5626,12 +5430,29 @@ var WORKFLOW_EXECUTOR_TOKEN_TTL_SECONDS = MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeou
|
|
|
5626
5430
|
var COMPUTE_BILLING_MARKUP_MULTIPLIER = 5;
|
|
5627
5431
|
var DEFAULT_USD_PER_CUSTOMER_CREDIT = 0.1;
|
|
5628
5432
|
var DEFAULT_PROVIDER_MARKUP_MULTIPLIER = 1.4;
|
|
5433
|
+
var MAX_SANDBOX_COMPUTE_BILLING_SECONDS = 60 * 60;
|
|
5434
|
+
var MAX_SANDBOX_COMPUTE_PROVIDER_COST_USD = Math.max(
|
|
5435
|
+
resolveDaytonaSandboxComputeItem({
|
|
5436
|
+
itemId: "billing-cap",
|
|
5437
|
+
wallTimeSeconds: MAX_SANDBOX_COMPUTE_BILLING_SECONDS,
|
|
5438
|
+
...STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS
|
|
5439
|
+
}).providerCostUsd,
|
|
5440
|
+
resolveModalSandboxComputeItem({
|
|
5441
|
+
itemId: "billing-cap",
|
|
5442
|
+
wallTimeSeconds: MAX_SANDBOX_COMPUTE_BILLING_SECONDS,
|
|
5443
|
+
physicalCpuCores: MODAL_SANDBOX_CPU_CORES,
|
|
5444
|
+
memoryGiB: STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.memoryGiB
|
|
5445
|
+
}).providerCostUsd
|
|
5446
|
+
);
|
|
5629
5447
|
function roundUpCredits(value) {
|
|
5630
5448
|
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
5631
5449
|
return Math.ceil(value * 100) / 100;
|
|
5632
5450
|
}
|
|
5633
5451
|
function maximumPlaySandboxBillingSeconds(limits) {
|
|
5634
|
-
return
|
|
5452
|
+
return Math.min(
|
|
5453
|
+
limits.timeoutSeconds + PLAY_RUNNER_TERMINAL_GRACE_SECONDS,
|
|
5454
|
+
MAX_SANDBOX_COMPUTE_BILLING_SECONDS
|
|
5455
|
+
);
|
|
5635
5456
|
}
|
|
5636
5457
|
function estimateDaytonaMaximumComputeCredits(limits) {
|
|
5637
5458
|
const item = resolveDaytonaSandboxComputeItem({
|
|
@@ -5680,7 +5501,7 @@ function isInternalGlueStepId(stepId) {
|
|
|
5680
5501
|
import { randomUUID } from "crypto";
|
|
5681
5502
|
import { mkdtemp as mkdtemp2, realpath, rm as rm2 } from "fs/promises";
|
|
5682
5503
|
import { tmpdir } from "os";
|
|
5683
|
-
import { join as join4, resolve as
|
|
5504
|
+
import { join as join4, resolve as resolve2 } from "path";
|
|
5684
5505
|
|
|
5685
5506
|
// ../plays/deploy/run-deployment.ts
|
|
5686
5507
|
import { join as join3 } from "path";
|
|
@@ -5858,6 +5679,11 @@ var DeployApiClient = class {
|
|
|
5858
5679
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
5859
5680
|
import { readdir, readFile as readFile2, stat } from "fs/promises";
|
|
5860
5681
|
import { join, relative } from "path";
|
|
5682
|
+
|
|
5683
|
+
// ../plays/deploy/manifest-contract.ts
|
|
5684
|
+
var DEFAULT_MANIFEST_FILE = "deepline.json";
|
|
5685
|
+
|
|
5686
|
+
// ../plays/deploy/manifest.ts
|
|
5861
5687
|
var DEFAULT_PLAY_GLOBS = ["**/*.play.ts"];
|
|
5862
5688
|
var DEFAULT_MONITOR_GLOBS = ["**/*.monitor.json"];
|
|
5863
5689
|
var MAX_DISCOVERED_FILES = 200;
|
|
@@ -5916,7 +5742,6 @@ function parseDeeplineManifest(raw) {
|
|
|
5916
5742
|
...org ? { org } : {}
|
|
5917
5743
|
};
|
|
5918
5744
|
}
|
|
5919
|
-
var DEFAULT_MANIFEST_FILE = "deepline.json";
|
|
5920
5745
|
async function readDeeplineManifest(projectRoot, manifestFile = DEFAULT_MANIFEST_FILE) {
|
|
5921
5746
|
let raw = null;
|
|
5922
5747
|
try {
|
|
@@ -6298,7 +6123,7 @@ async function runDeployment(params, hooks) {
|
|
|
6298
6123
|
throw lastError;
|
|
6299
6124
|
}
|
|
6300
6125
|
await new Promise(
|
|
6301
|
-
(
|
|
6126
|
+
(resolve4) => setTimeout(resolve4, hooks.checkRunRetryDelayMs ?? 1e3)
|
|
6302
6127
|
);
|
|
6303
6128
|
}
|
|
6304
6129
|
}
|
|
@@ -6781,7 +6606,7 @@ async function runDeployment(params, hooks) {
|
|
|
6781
6606
|
"Monitor jobs are still reconciling. Retrying this deployment will resume the same jobs."
|
|
6782
6607
|
);
|
|
6783
6608
|
}
|
|
6784
|
-
await new Promise((
|
|
6609
|
+
await new Promise((resolve4) => setTimeout(resolve4, 1e3));
|
|
6785
6610
|
for (let index = 0; index < monitorOutcomes.length; index += 1) {
|
|
6786
6611
|
const outcome = monitorOutcomes[index];
|
|
6787
6612
|
if (outcome.status !== "applying") continue;
|
|
@@ -6906,1138 +6731,162 @@ async function runDeployment(params, hooks) {
|
|
|
6906
6731
|
try {
|
|
6907
6732
|
checkRunId = await postFailureCheck?.(message.slice(0, 2e3));
|
|
6908
6733
|
} catch (checkError) {
|
|
6909
|
-
const revokedAtCheck = revokedFinalStatus(checkError);
|
|
6910
|
-
if (revokedAtCheck) {
|
|
6911
|
-
return { finalStatus: revokedAtCheck, outcomes: [] };
|
|
6912
|
-
}
|
|
6913
|
-
if (checkError instanceof RetryableDeploymentError) {
|
|
6914
|
-
console.warn(
|
|
6915
|
-
"[deploy-worker] retryable failure, leaving non-terminal",
|
|
6916
|
-
{
|
|
6917
|
-
deploymentId: params.deploymentId,
|
|
6918
|
-
error: checkError.message.slice(0, 300)
|
|
6919
|
-
}
|
|
6920
|
-
);
|
|
6921
|
-
throw checkError;
|
|
6922
|
-
}
|
|
6923
|
-
}
|
|
6924
|
-
await setStatus({
|
|
6925
|
-
status: "failed",
|
|
6926
|
-
error: message.slice(0, 2e3),
|
|
6927
|
-
...monitorOutcomes.length > 0 ? { results: monitorResults() } : {},
|
|
6928
|
-
buildSeconds: buildSeconds(),
|
|
6929
|
-
...checkRunId ? { checkRunId } : {}
|
|
6930
|
-
}).catch(() => void 0);
|
|
6931
|
-
throw error;
|
|
6932
|
-
} finally {
|
|
6933
|
-
await rm(workDir, { recursive: true, force: true }).catch(() => void 0);
|
|
6934
|
-
}
|
|
6935
|
-
}
|
|
6936
|
-
function topoSortByPlayDependencies(plays) {
|
|
6937
|
-
const byName = new Map(plays.map((play) => [play.name, play]));
|
|
6938
|
-
const visited = /* @__PURE__ */ new Set();
|
|
6939
|
-
const ordered = [];
|
|
6940
|
-
const visit = (play, stack) => {
|
|
6941
|
-
if (visited.has(play.name)) return;
|
|
6942
|
-
if (stack.has(play.name)) {
|
|
6943
|
-
return;
|
|
6944
|
-
}
|
|
6945
|
-
stack.add(play.name);
|
|
6946
|
-
const dependencyNames = /* @__PURE__ */ new Set([
|
|
6947
|
-
...(play.result.importedPlayDependencies ?? []).map(
|
|
6948
|
-
(dependency) => dependency.playName
|
|
6949
|
-
),
|
|
6950
|
-
...play.runPlayStringTargets
|
|
6951
|
-
]);
|
|
6952
|
-
for (const dependencyName of dependencyNames) {
|
|
6953
|
-
const target = byName.get(dependencyName);
|
|
6954
|
-
if (target) visit(target, stack);
|
|
6955
|
-
}
|
|
6956
|
-
stack.delete(play.name);
|
|
6957
|
-
visited.add(play.name);
|
|
6958
|
-
ordered.push(play);
|
|
6959
|
-
};
|
|
6960
|
-
for (const play of plays) visit(play, /* @__PURE__ */ new Set());
|
|
6961
|
-
return ordered;
|
|
6962
|
-
}
|
|
6963
|
-
|
|
6964
|
-
// src/cli/commands/plays-deploy.ts
|
|
6965
|
-
var MAX_DEPLOY_ATTEMPTS = 3;
|
|
6966
|
-
function renderOutcome(outcome) {
|
|
6967
|
-
const version = outcome.version === void 0 ? "" : outcome.previousVersion === void 0 ? ` v${outcome.version}` : ` v${outcome.previousVersion} -> v${outcome.version}`;
|
|
6968
|
-
const sdkUpdated = outcome.sdkUpdated ? " (SDK updated)" : "";
|
|
6969
|
-
const note = outcome.error ?? outcome.warning;
|
|
6970
|
-
return `${outcome.name} (${outcome.file}): ${outcome.status}${version}${sdkUpdated}${note ? ` - ${note}` : ""}`;
|
|
6971
|
-
}
|
|
6972
|
-
function printResult2(input) {
|
|
6973
|
-
const failed = input.status === "failed" || input.status === "cancelled";
|
|
6974
|
-
if (failed) process.exitCode = 1;
|
|
6975
|
-
printCommandEnvelope(
|
|
6976
|
-
{
|
|
6977
|
-
deployment: { ...input.deployment, status: input.status },
|
|
6978
|
-
plays: input.outcomes,
|
|
6979
|
-
render: {
|
|
6980
|
-
sections: [
|
|
6981
|
-
{
|
|
6982
|
-
title: `deployment ${input.deployment.id}`,
|
|
6983
|
-
lines: [
|
|
6984
|
-
`${input.directory}: ${input.status}`,
|
|
6985
|
-
...input.outcomes.map(renderOutcome),
|
|
6986
|
-
...failed && input.deployment.error ? [input.deployment.error] : [],
|
|
6987
|
-
`Details: deepline plays deployments ${input.deployment.id}`
|
|
6988
|
-
]
|
|
6989
|
-
}
|
|
6990
|
-
]
|
|
6991
|
-
}
|
|
6992
|
-
},
|
|
6993
|
-
{ json: input.json }
|
|
6994
|
-
);
|
|
6995
|
-
}
|
|
6996
|
-
async function handlePlaysDeploy(directory, options) {
|
|
6997
|
-
const root = await realpath(resolve3(directory ?? ".")).catch(() => {
|
|
6998
|
-
throw new Error(`No such directory: ${resolve3(directory ?? ".")}`);
|
|
6999
|
-
});
|
|
7000
|
-
const { http, config } = getAuthedHttpClient();
|
|
7001
|
-
const deliveryId = `local:${randomUUID()}`;
|
|
7002
|
-
const startDeployment = () => http.post("/api/v2/deployments", {
|
|
7003
|
-
deliveryId,
|
|
7004
|
-
...options.repo ? { repo: options.repo } : {},
|
|
7005
|
-
...options.ref ? { ref: options.ref } : {},
|
|
7006
|
-
...options.commit ? { commit: options.commit } : {}
|
|
7007
|
-
});
|
|
7008
|
-
const { bundleDeployPlayFile } = await loadPlayBundler();
|
|
7009
|
-
const workRoot = await mkdtemp2(join4(tmpdir(), "deepline-deploy-"));
|
|
7010
|
-
const consoleInfo = console.info;
|
|
7011
|
-
console.info = console.error;
|
|
7012
|
-
try {
|
|
7013
|
-
for (let attempt = 1; ; attempt += 1) {
|
|
7014
|
-
const { deployment } = await startDeployment();
|
|
7015
|
-
let result;
|
|
7016
|
-
try {
|
|
7017
|
-
result = await runDeployment(
|
|
7018
|
-
{
|
|
7019
|
-
deploymentId: deployment.id,
|
|
7020
|
-
// The workspace key drives its own deployment; there is no
|
|
7021
|
-
// separate deploy token to mint.
|
|
7022
|
-
deployToken: config.apiKey,
|
|
7023
|
-
appBaseUrl: config.baseUrl
|
|
7024
|
-
},
|
|
7025
|
-
{
|
|
7026
|
-
bundle: bundleDeployPlayFile,
|
|
7027
|
-
fetchImpl: fetchWithDeploymentProtection,
|
|
7028
|
-
// The plays are already here: "opening" the source is naming it.
|
|
7029
|
-
openSource: async () => ({
|
|
7030
|
-
open: async () => ({ repoRoot: root })
|
|
7031
|
-
}),
|
|
7032
|
-
target: {
|
|
7033
|
-
rootDirectory: "",
|
|
7034
|
-
manifestPath: options.manifest?.trim() ?? ""
|
|
7035
|
-
},
|
|
7036
|
-
workRoot
|
|
7037
|
-
}
|
|
7038
|
-
);
|
|
7039
|
-
} catch (error) {
|
|
7040
|
-
if (error instanceof RetryableDeploymentError && attempt < MAX_DEPLOY_ATTEMPTS) {
|
|
7041
|
-
process.stderr.write(
|
|
7042
|
-
`Deployment ${deployment.id} did not finish (${error.message}); retrying (${attempt + 1}/${MAX_DEPLOY_ATTEMPTS}).
|
|
7043
|
-
`
|
|
7044
|
-
);
|
|
7045
|
-
continue;
|
|
7046
|
-
}
|
|
7047
|
-
throw error;
|
|
7048
|
-
}
|
|
7049
|
-
const finished = await http.get(
|
|
7050
|
-
`/api/v2/deployments/${encodeURIComponent(deployment.id)}`
|
|
7051
|
-
).then((payload) => payload.deployment).catch(() => deployment);
|
|
7052
|
-
printResult2({
|
|
7053
|
-
directory: root,
|
|
7054
|
-
deployment: finished,
|
|
7055
|
-
status: result.finalStatus,
|
|
7056
|
-
outcomes: result.outcomes,
|
|
7057
|
-
json: options.json
|
|
7058
|
-
});
|
|
7059
|
-
return;
|
|
7060
|
-
}
|
|
7061
|
-
} finally {
|
|
7062
|
-
console.info = consoleInfo;
|
|
7063
|
-
await rm2(workRoot, { recursive: true, force: true });
|
|
7064
|
-
}
|
|
7065
|
-
}
|
|
7066
|
-
|
|
7067
|
-
// src/cli/operations/play-run-options.ts
|
|
7068
|
-
import { existsSync, readFileSync } from "fs";
|
|
7069
|
-
import { resolve as resolve4 } from "path";
|
|
7070
|
-
|
|
7071
|
-
// ../play-runtime/fixture-behavior.ts
|
|
7072
|
-
var FIXTURE_BEHAVIOR_VERSION = 1;
|
|
7073
|
-
var FIXTURE_BEHAVIOR_RESPONSE_VERSION = 2;
|
|
7074
|
-
var FIXTURE_BEHAVIOR_REPLAY_VERSION = 3;
|
|
7075
|
-
var MAX_FIXTURE_RESPONSE_DELAY_SAMPLES = 256;
|
|
7076
|
-
var MAX_FIXTURE_RESPONSE_DELAY_MS = 8 * 6e4;
|
|
7077
|
-
var MAX_FIXTURE_RESPONSE_ERROR_MESSAGE_LENGTH = 500;
|
|
7078
|
-
var MAX_FIXTURE_RETRY_AFTER_MS = 60 * 6e4;
|
|
7079
|
-
var FIXTURE_RATE_WINDOWS = [
|
|
7080
|
-
{ field: "requestsPerSecond", name: "rps", windowMs: 1e3 },
|
|
7081
|
-
{ field: "requestsPerMinute", name: "rpm", windowMs: 6e4 },
|
|
7082
|
-
{ field: "requestsPerHour", name: "rph", windowMs: 36e5 }
|
|
7083
|
-
];
|
|
7084
|
-
function validateFixtureBehavior(value) {
|
|
7085
|
-
if (value === void 0 || value === null) {
|
|
7086
|
-
return { ok: true, behavior: null };
|
|
7087
|
-
}
|
|
7088
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
7089
|
-
return { ok: false, error: "fixtureBehavior must be a JSON object." };
|
|
7090
|
-
}
|
|
7091
|
-
const record3 = value;
|
|
7092
|
-
const supportedKeys = record3.version === FIXTURE_BEHAVIOR_RESPONSE_VERSION || record3.version === FIXTURE_BEHAVIOR_REPLAY_VERSION ? /* @__PURE__ */ new Set([
|
|
7093
|
-
"version",
|
|
7094
|
-
"responseSamples",
|
|
7095
|
-
"transient429",
|
|
7096
|
-
"sharedRateLimit",
|
|
7097
|
-
...record3.version === FIXTURE_BEHAVIOR_REPLAY_VERSION ? ["replayBundle"] : []
|
|
7098
|
-
]) : /* @__PURE__ */ new Set(["version", "responseDelaySamplesMs"]);
|
|
7099
|
-
const unknownKeys = Object.keys(record3).filter(
|
|
7100
|
-
(key) => !supportedKeys.has(key)
|
|
7101
|
-
);
|
|
7102
|
-
if (unknownKeys.length > 0) {
|
|
7103
|
-
return {
|
|
7104
|
-
ok: false,
|
|
7105
|
-
error: `Unsupported fixtureBehavior field "${unknownKeys[0]}".`
|
|
7106
|
-
};
|
|
7107
|
-
}
|
|
7108
|
-
if (record3.version !== FIXTURE_BEHAVIOR_VERSION && record3.version !== FIXTURE_BEHAVIOR_RESPONSE_VERSION && record3.version !== FIXTURE_BEHAVIOR_REPLAY_VERSION) {
|
|
7109
|
-
return {
|
|
7110
|
-
ok: false,
|
|
7111
|
-
error: `fixtureBehavior.version must be ${FIXTURE_BEHAVIOR_VERSION} or ${FIXTURE_BEHAVIOR_RESPONSE_VERSION}, or ${FIXTURE_BEHAVIOR_REPLAY_VERSION}.`
|
|
7112
|
-
};
|
|
7113
|
-
}
|
|
7114
|
-
if (record3.version === FIXTURE_BEHAVIOR_RESPONSE_VERSION || record3.version === FIXTURE_BEHAVIOR_REPLAY_VERSION) {
|
|
7115
|
-
if (!Array.isArray(record3.responseSamples) || record3.responseSamples.length === 0 || record3.responseSamples.length > MAX_FIXTURE_RESPONSE_DELAY_SAMPLES) {
|
|
7116
|
-
return {
|
|
7117
|
-
ok: false,
|
|
7118
|
-
error: `fixtureBehavior.responseSamples must contain between 1 and ${MAX_FIXTURE_RESPONSE_DELAY_SAMPLES} values.`
|
|
7119
|
-
};
|
|
7120
|
-
}
|
|
7121
|
-
const samples2 = [];
|
|
7122
|
-
for (let index = 0; index < record3.responseSamples.length; index += 1) {
|
|
7123
|
-
const value2 = record3.responseSamples[index];
|
|
7124
|
-
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) {
|
|
7125
|
-
return {
|
|
7126
|
-
ok: false,
|
|
7127
|
-
error: `fixtureBehavior.responseSamples[${index}] must be an object.`
|
|
7128
|
-
};
|
|
7129
|
-
}
|
|
7130
|
-
const sample = value2;
|
|
7131
|
-
const sampleUnknownKeys = Object.keys(sample).filter(
|
|
7132
|
-
(key) => key !== "delayMs" && key !== "when" && key !== "httpError"
|
|
7133
|
-
);
|
|
7134
|
-
if (sampleUnknownKeys.length > 0) {
|
|
7135
|
-
return {
|
|
7136
|
-
ok: false,
|
|
7137
|
-
error: `Unsupported fixtureBehavior.responseSamples[${index}] field "${sampleUnknownKeys[0]}".`
|
|
7138
|
-
};
|
|
7139
|
-
}
|
|
7140
|
-
if (typeof sample.delayMs !== "number" || !Number.isSafeInteger(sample.delayMs) || sample.delayMs < 0 || sample.delayMs > MAX_FIXTURE_RESPONSE_DELAY_MS) {
|
|
7141
|
-
return {
|
|
7142
|
-
ok: false,
|
|
7143
|
-
error: `fixtureBehavior.responseSamples[${index}].delayMs must be an integer between 0 and ${MAX_FIXTURE_RESPONSE_DELAY_MS}.`
|
|
7144
|
-
};
|
|
7145
|
-
}
|
|
7146
|
-
let when;
|
|
7147
|
-
if (sample.when !== void 0) {
|
|
7148
|
-
if (!sample.when || typeof sample.when !== "object" || Array.isArray(sample.when)) {
|
|
7149
|
-
return {
|
|
7150
|
-
ok: false,
|
|
7151
|
-
error: `fixtureBehavior.responseSamples[${index}].when must be an object.`
|
|
7152
|
-
};
|
|
7153
|
-
}
|
|
7154
|
-
const condition = sample.when;
|
|
7155
|
-
const conditionUnknownKeys = Object.keys(condition).filter(
|
|
7156
|
-
(key) => key !== "provider" && key !== "operation"
|
|
7157
|
-
);
|
|
7158
|
-
if (conditionUnknownKeys.length > 0) {
|
|
7159
|
-
return {
|
|
7160
|
-
ok: false,
|
|
7161
|
-
error: `Unsupported fixtureBehavior.responseSamples[${index}].when field "${conditionUnknownKeys[0]}".`
|
|
7162
|
-
};
|
|
7163
|
-
}
|
|
7164
|
-
const provider = normalizeFixtureScopeValue(condition.provider, 100);
|
|
7165
|
-
const operation = normalizeFixtureScopeValue(condition.operation, 200);
|
|
7166
|
-
if (provider.error || operation.error) {
|
|
7167
|
-
return {
|
|
7168
|
-
ok: false,
|
|
7169
|
-
error: `fixtureBehavior.responseSamples[${index}].when ` + (provider.error ?? operation.error)
|
|
7170
|
-
};
|
|
7171
|
-
}
|
|
7172
|
-
if (!provider.value && !operation.value) {
|
|
7173
|
-
return {
|
|
7174
|
-
ok: false,
|
|
7175
|
-
error: `fixtureBehavior.responseSamples[${index}].when must select a provider or operation.`
|
|
7176
|
-
};
|
|
7177
|
-
}
|
|
7178
|
-
when = {
|
|
7179
|
-
...provider.value ? { provider: provider.value } : {},
|
|
7180
|
-
...operation.value ? { operation: operation.value } : {}
|
|
7181
|
-
};
|
|
7182
|
-
}
|
|
7183
|
-
let httpError;
|
|
7184
|
-
if (sample.httpError !== void 0) {
|
|
7185
|
-
if (!sample.httpError || typeof sample.httpError !== "object" || Array.isArray(sample.httpError)) {
|
|
7186
|
-
return {
|
|
7187
|
-
ok: false,
|
|
7188
|
-
error: `fixtureBehavior.responseSamples[${index}].httpError must be an object.`
|
|
7189
|
-
};
|
|
7190
|
-
}
|
|
7191
|
-
const error = sample.httpError;
|
|
7192
|
-
const errorUnknownKeys = Object.keys(error).filter(
|
|
7193
|
-
(key) => key !== "status" && key !== "message" && key !== "retryAfterMs" && key !== "retryAfterFormat" && key !== "failuresBeforeSuccess"
|
|
7194
|
-
);
|
|
7195
|
-
if (errorUnknownKeys.length > 0) {
|
|
7196
|
-
return {
|
|
7197
|
-
ok: false,
|
|
7198
|
-
error: `Unsupported fixtureBehavior.responseSamples[${index}].httpError field "${errorUnknownKeys[0]}".`
|
|
7199
|
-
};
|
|
7200
|
-
}
|
|
7201
|
-
if (typeof error.status !== "number" || !Number.isSafeInteger(error.status) || error.status < 400 || error.status > 599) {
|
|
7202
|
-
return {
|
|
7203
|
-
ok: false,
|
|
7204
|
-
error: `fixtureBehavior.responseSamples[${index}].httpError.status must be an integer between 400 and 599.`
|
|
7205
|
-
};
|
|
7206
|
-
}
|
|
7207
|
-
if (typeof error.message !== "string" || !error.message.trim() || error.message.length > MAX_FIXTURE_RESPONSE_ERROR_MESSAGE_LENGTH) {
|
|
7208
|
-
return {
|
|
7209
|
-
ok: false,
|
|
7210
|
-
error: `fixtureBehavior.responseSamples[${index}].httpError.message must contain 1-${MAX_FIXTURE_RESPONSE_ERROR_MESSAGE_LENGTH} characters.`
|
|
7211
|
-
};
|
|
7212
|
-
}
|
|
7213
|
-
if (error.retryAfterMs !== void 0 && (error.status !== 429 || typeof error.retryAfterMs !== "number" || !Number.isSafeInteger(error.retryAfterMs) || error.retryAfterMs < 1 || error.retryAfterMs > MAX_FIXTURE_RETRY_AFTER_MS)) {
|
|
7214
|
-
return {
|
|
7215
|
-
ok: false,
|
|
7216
|
-
error: `fixtureBehavior.responseSamples[${index}].httpError.retryAfterMs requires status 429 and an integer from 1 through ${MAX_FIXTURE_RETRY_AFTER_MS}.`
|
|
7217
|
-
};
|
|
7218
|
-
}
|
|
7219
|
-
if (error.retryAfterFormat !== void 0 && (error.status !== 429 || error.retryAfterFormat !== "delta_seconds" && error.retryAfterFormat !== "http_date")) {
|
|
7220
|
-
return {
|
|
7221
|
-
ok: false,
|
|
7222
|
-
error: `fixtureBehavior.responseSamples[${index}].httpError.retryAfterFormat requires status 429 and delta_seconds or http_date.`
|
|
7223
|
-
};
|
|
7224
|
-
}
|
|
7225
|
-
if (error.failuresBeforeSuccess !== void 0 && (![429, 500, 502, 503, 504].includes(error.status) || typeof error.failuresBeforeSuccess !== "number" || !Number.isSafeInteger(error.failuresBeforeSuccess) || error.failuresBeforeSuccess < 1 || error.failuresBeforeSuccess > 20)) {
|
|
7226
|
-
return {
|
|
7227
|
-
ok: false,
|
|
7228
|
-
error: `fixtureBehavior.responseSamples[${index}].httpError.failuresBeforeSuccess requires status 429, 500, 502, 503, or 504 and an integer from 1 through 20.`
|
|
7229
|
-
};
|
|
7230
|
-
}
|
|
7231
|
-
httpError = {
|
|
7232
|
-
status: error.status,
|
|
7233
|
-
message: error.message.trim(),
|
|
7234
|
-
...error.retryAfterMs !== void 0 ? { retryAfterMs: error.retryAfterMs } : {},
|
|
7235
|
-
...error.retryAfterFormat !== void 0 ? {
|
|
7236
|
-
retryAfterFormat: error.retryAfterFormat
|
|
7237
|
-
} : {},
|
|
7238
|
-
...error.failuresBeforeSuccess !== void 0 ? { failuresBeforeSuccess: error.failuresBeforeSuccess } : {}
|
|
7239
|
-
};
|
|
7240
|
-
}
|
|
7241
|
-
samples2.push({
|
|
7242
|
-
delayMs: sample.delayMs,
|
|
7243
|
-
...when ? { when } : {},
|
|
7244
|
-
...httpError ? { httpError } : {}
|
|
7245
|
-
});
|
|
7246
|
-
}
|
|
7247
|
-
let sharedRateLimit;
|
|
7248
|
-
if (record3.sharedRateLimit !== void 0) {
|
|
7249
|
-
const plan = record3.sharedRateLimit;
|
|
7250
|
-
if (!plan || typeof plan !== "object" || Array.isArray(plan)) {
|
|
7251
|
-
return {
|
|
7252
|
-
ok: false,
|
|
7253
|
-
error: "fixtureBehavior.sharedRateLimit must be an object."
|
|
7254
|
-
};
|
|
7255
|
-
}
|
|
7256
|
-
const planRecord = plan;
|
|
7257
|
-
const entries = Object.entries(planRecord);
|
|
7258
|
-
const boundaryAfterMs = planRecord.requestsPerHourBoundaryAfterMs;
|
|
7259
|
-
const quotaEntries = entries.filter(
|
|
7260
|
-
([name]) => name !== "requestsPerHourBoundaryAfterMs"
|
|
7261
|
-
);
|
|
7262
|
-
if (quotaEntries.length === 0 || quotaEntries.some(
|
|
7263
|
-
([name, limit]) => !FIXTURE_RATE_WINDOWS.some((window) => window.field === name) || typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 1
|
|
7264
|
-
)) {
|
|
7265
|
-
return {
|
|
7266
|
-
ok: false,
|
|
7267
|
-
error: "fixtureBehavior.sharedRateLimit requires positive integer requestsPerSecond, requestsPerMinute, or requestsPerHour quotas."
|
|
7268
|
-
};
|
|
7269
|
-
}
|
|
7270
|
-
if (boundaryAfterMs !== void 0 && (planRecord.requestsPerHour === void 0 || typeof boundaryAfterMs !== "number" || !Number.isSafeInteger(boundaryAfterMs) || boundaryAfterMs < 1e3 || boundaryAfterMs > 3e5)) {
|
|
7271
|
-
return {
|
|
7272
|
-
ok: false,
|
|
7273
|
-
error: "fixtureBehavior.sharedRateLimit.requestsPerHourBoundaryAfterMs requires requestsPerHour and an integer from 1000 through 300000."
|
|
7274
|
-
};
|
|
7275
|
-
}
|
|
7276
|
-
sharedRateLimit = Object.fromEntries(entries);
|
|
7277
|
-
}
|
|
7278
|
-
let transient429;
|
|
7279
|
-
if (record3.transient429 !== void 0) {
|
|
7280
|
-
const selected = record3.transient429;
|
|
7281
|
-
if (!selected || typeof selected !== "object" || Array.isArray(selected)) {
|
|
7282
|
-
return {
|
|
7283
|
-
ok: false,
|
|
7284
|
-
error: "fixtureBehavior.transient429 must be an object."
|
|
7285
|
-
};
|
|
7286
|
-
}
|
|
7287
|
-
const fault = selected;
|
|
7288
|
-
const unknownFaultKeys = Object.keys(fault).filter(
|
|
7289
|
-
(key) => key !== "everyNthCall" && key !== "retryAfterMs" && key !== "failuresBeforeSuccess" && key !== "when"
|
|
7290
|
-
);
|
|
7291
|
-
if (unknownFaultKeys.length > 0) {
|
|
7292
|
-
return {
|
|
7293
|
-
ok: false,
|
|
7294
|
-
error: `Unsupported fixtureBehavior.transient429 field "${unknownFaultKeys[0]}".`
|
|
7295
|
-
};
|
|
7296
|
-
}
|
|
7297
|
-
for (const [name, value2, max] of [
|
|
7298
|
-
["everyNthCall", fault.everyNthCall, 1e4],
|
|
7299
|
-
["retryAfterMs", fault.retryAfterMs, MAX_FIXTURE_RETRY_AFTER_MS],
|
|
7300
|
-
["failuresBeforeSuccess", fault.failuresBeforeSuccess, 20]
|
|
7301
|
-
]) {
|
|
7302
|
-
if (typeof value2 !== "number" || !Number.isSafeInteger(value2) || value2 < 1 || value2 > max) {
|
|
7303
|
-
return {
|
|
7304
|
-
ok: false,
|
|
7305
|
-
error: `fixtureBehavior.transient429.${name} must be an integer from 1 through ${max}.`
|
|
7306
|
-
};
|
|
7307
|
-
}
|
|
7308
|
-
}
|
|
7309
|
-
let when;
|
|
7310
|
-
if (fault.when !== void 0) {
|
|
7311
|
-
if (!fault.when || typeof fault.when !== "object" || Array.isArray(fault.when)) {
|
|
7312
|
-
return {
|
|
7313
|
-
ok: false,
|
|
7314
|
-
error: "fixtureBehavior.transient429.when must be an object."
|
|
7315
|
-
};
|
|
7316
|
-
}
|
|
7317
|
-
const condition = fault.when;
|
|
7318
|
-
const unknownConditionKeys = Object.keys(condition).filter(
|
|
7319
|
-
(key) => key !== "provider" && key !== "operation"
|
|
7320
|
-
);
|
|
7321
|
-
if (unknownConditionKeys.length > 0) {
|
|
7322
|
-
return {
|
|
7323
|
-
ok: false,
|
|
7324
|
-
error: `Unsupported fixtureBehavior.transient429.when field "${unknownConditionKeys[0]}".`
|
|
7325
|
-
};
|
|
7326
|
-
}
|
|
7327
|
-
const provider = normalizeFixtureScopeValue(condition.provider, 100);
|
|
7328
|
-
const operation = normalizeFixtureScopeValue(condition.operation, 200);
|
|
7329
|
-
if (provider.error || operation.error || !provider.value && !operation.value) {
|
|
7330
|
-
return {
|
|
7331
|
-
ok: false,
|
|
7332
|
-
error: "fixtureBehavior.transient429.when must select a valid provider or operation."
|
|
7333
|
-
};
|
|
7334
|
-
}
|
|
7335
|
-
when = {
|
|
7336
|
-
...provider.value ? { provider: provider.value } : {},
|
|
7337
|
-
...operation.value ? { operation: operation.value } : {}
|
|
7338
|
-
};
|
|
7339
|
-
}
|
|
7340
|
-
transient429 = {
|
|
7341
|
-
everyNthCall: fault.everyNthCall,
|
|
7342
|
-
retryAfterMs: fault.retryAfterMs,
|
|
7343
|
-
failuresBeforeSuccess: fault.failuresBeforeSuccess,
|
|
7344
|
-
...when ? { when } : {}
|
|
7345
|
-
};
|
|
7346
|
-
}
|
|
7347
|
-
let replayBundle;
|
|
7348
|
-
if (record3.version === FIXTURE_BEHAVIOR_REPLAY_VERSION) {
|
|
7349
|
-
if (!record3.replayBundle || typeof record3.replayBundle !== "object" || Array.isArray(record3.replayBundle)) {
|
|
7350
|
-
return {
|
|
7351
|
-
ok: false,
|
|
7352
|
-
error: "fixtureBehavior.replayBundle must be an object."
|
|
7353
|
-
};
|
|
7354
|
-
}
|
|
7355
|
-
const replay = record3.replayBundle;
|
|
7356
|
-
const replayUnknownKeys = Object.keys(replay).filter(
|
|
7357
|
-
(key) => key !== "bundleId" && key !== "manifestSha256" && key !== "syntheticFallbackToolIds"
|
|
7358
|
-
);
|
|
7359
|
-
if (replayUnknownKeys.length > 0) {
|
|
7360
|
-
return {
|
|
7361
|
-
ok: false,
|
|
7362
|
-
error: `Unsupported fixtureBehavior.replayBundle field "${replayUnknownKeys[0]}".`
|
|
7363
|
-
};
|
|
7364
|
-
}
|
|
7365
|
-
const digestPattern = /^[a-f0-9]{64}$/;
|
|
7366
|
-
if (typeof replay.bundleId !== "string" || !digestPattern.test(replay.bundleId)) {
|
|
7367
|
-
return {
|
|
7368
|
-
ok: false,
|
|
7369
|
-
error: "fixtureBehavior.replayBundle.bundleId must be a lowercase SHA-256 digest."
|
|
7370
|
-
};
|
|
7371
|
-
}
|
|
7372
|
-
if (typeof replay.manifestSha256 !== "string" || !digestPattern.test(replay.manifestSha256)) {
|
|
7373
|
-
return {
|
|
7374
|
-
ok: false,
|
|
7375
|
-
error: "fixtureBehavior.replayBundle.manifestSha256 must be a lowercase SHA-256 digest."
|
|
7376
|
-
};
|
|
7377
|
-
}
|
|
7378
|
-
let syntheticFallbackToolIds;
|
|
7379
|
-
if (replay.syntheticFallbackToolIds !== void 0) {
|
|
7380
|
-
if (!Array.isArray(replay.syntheticFallbackToolIds) || replay.syntheticFallbackToolIds.length === 0 || replay.syntheticFallbackToolIds.length > 32) {
|
|
7381
|
-
return {
|
|
7382
|
-
ok: false,
|
|
7383
|
-
error: "fixtureBehavior.replayBundle.syntheticFallbackToolIds must contain 1-32 tool ids."
|
|
7384
|
-
};
|
|
7385
|
-
}
|
|
7386
|
-
syntheticFallbackToolIds = [];
|
|
7387
|
-
for (const rawToolId of replay.syntheticFallbackToolIds) {
|
|
7388
|
-
if (typeof rawToolId !== "string" || rawToolId !== rawToolId.trim().toLowerCase() || !/^[a-z0-9][a-z0-9_.-]*$/.test(rawToolId) || rawToolId.length > 250 || syntheticFallbackToolIds.includes(rawToolId)) {
|
|
7389
|
-
return {
|
|
7390
|
-
ok: false,
|
|
7391
|
-
error: "fixtureBehavior.replayBundle.syntheticFallbackToolIds contains an invalid tool id."
|
|
7392
|
-
};
|
|
7393
|
-
}
|
|
7394
|
-
syntheticFallbackToolIds.push(rawToolId);
|
|
7395
|
-
}
|
|
7396
|
-
}
|
|
7397
|
-
replayBundle = {
|
|
7398
|
-
bundleId: replay.bundleId,
|
|
7399
|
-
manifestSha256: replay.manifestSha256,
|
|
7400
|
-
...syntheticFallbackToolIds ? { syntheticFallbackToolIds } : {}
|
|
7401
|
-
};
|
|
7402
|
-
}
|
|
7403
|
-
if (record3.version === FIXTURE_BEHAVIOR_REPLAY_VERSION) {
|
|
7404
|
-
return {
|
|
7405
|
-
ok: true,
|
|
7406
|
-
behavior: {
|
|
7407
|
-
version: FIXTURE_BEHAVIOR_REPLAY_VERSION,
|
|
7408
|
-
responseSamples: samples2,
|
|
7409
|
-
...transient429 ? { transient429 } : {},
|
|
7410
|
-
...sharedRateLimit ? { sharedRateLimit } : {},
|
|
7411
|
-
replayBundle
|
|
7412
|
-
}
|
|
7413
|
-
};
|
|
7414
|
-
}
|
|
7415
|
-
return {
|
|
7416
|
-
ok: true,
|
|
7417
|
-
behavior: {
|
|
7418
|
-
version: FIXTURE_BEHAVIOR_RESPONSE_VERSION,
|
|
7419
|
-
responseSamples: samples2,
|
|
7420
|
-
...transient429 ? { transient429 } : {},
|
|
7421
|
-
...sharedRateLimit ? { sharedRateLimit } : {}
|
|
7422
|
-
}
|
|
7423
|
-
};
|
|
7424
|
-
}
|
|
7425
|
-
if (!Array.isArray(record3.responseDelaySamplesMs) || record3.responseDelaySamplesMs.length === 0 || record3.responseDelaySamplesMs.length > MAX_FIXTURE_RESPONSE_DELAY_SAMPLES) {
|
|
7426
|
-
return {
|
|
7427
|
-
ok: false,
|
|
7428
|
-
error: `fixtureBehavior.responseDelaySamplesMs must contain between 1 and ${MAX_FIXTURE_RESPONSE_DELAY_SAMPLES} values.`
|
|
7429
|
-
};
|
|
7430
|
-
}
|
|
7431
|
-
const samples = [];
|
|
7432
|
-
for (let index = 0; index < record3.responseDelaySamplesMs.length; index += 1) {
|
|
7433
|
-
const value2 = record3.responseDelaySamplesMs[index];
|
|
7434
|
-
if (typeof value2 !== "number" || !Number.isSafeInteger(value2) || value2 < 0 || value2 > MAX_FIXTURE_RESPONSE_DELAY_MS) {
|
|
7435
|
-
return {
|
|
7436
|
-
ok: false,
|
|
7437
|
-
error: `fixtureBehavior.responseDelaySamplesMs[${index}] must be an integer between 0 and ${MAX_FIXTURE_RESPONSE_DELAY_MS}.`
|
|
7438
|
-
};
|
|
7439
|
-
}
|
|
7440
|
-
samples.push(value2);
|
|
7441
|
-
}
|
|
7442
|
-
return {
|
|
7443
|
-
ok: true,
|
|
7444
|
-
behavior: {
|
|
7445
|
-
version: FIXTURE_BEHAVIOR_VERSION,
|
|
7446
|
-
responseDelaySamplesMs: samples
|
|
7447
|
-
}
|
|
7448
|
-
};
|
|
7449
|
-
}
|
|
7450
|
-
function normalizeFixtureScopeValue(value, maxLength) {
|
|
7451
|
-
if (value === void 0) return {};
|
|
7452
|
-
if (typeof value !== "string" || !value.trim()) {
|
|
7453
|
-
return { error: "values must be non-empty strings." };
|
|
7454
|
-
}
|
|
7455
|
-
const normalized = value.trim().toLowerCase();
|
|
7456
|
-
if (normalized.length > maxLength) {
|
|
7457
|
-
return { error: `values must be at most ${maxLength} characters.` };
|
|
7458
|
-
}
|
|
7459
|
-
return { value: normalized };
|
|
7460
|
-
}
|
|
7461
|
-
|
|
7462
|
-
// src/cli/operations/play-run-options.ts
|
|
7463
|
-
var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
7464
|
-
"--dry-run",
|
|
7465
|
-
"--json",
|
|
7466
|
-
"--wait",
|
|
7467
|
-
"--tail",
|
|
7468
|
-
"--watch",
|
|
7469
|
-
"--no-wait",
|
|
7470
|
-
"--logs",
|
|
7471
|
-
"--debug",
|
|
7472
|
-
"--full",
|
|
7473
|
-
"--force",
|
|
7474
|
-
"--force-tool-refresh",
|
|
7475
|
-
"--open",
|
|
7476
|
-
"--debug-map-latency"
|
|
7477
|
-
]);
|
|
7478
|
-
var PLAY_RUN_HEADER_FLAG_USAGE = `--header requires "<name>: <value>", for example: --header 'x-deepline-absurd-release: 2026-09-07.1'`;
|
|
7479
|
-
var HTTP_HEADER_NAME_PATTERN = /^[!#$%&'*+\-.^_`|~0-9a-z]+$/;
|
|
7480
|
-
function parsePlayRunHeaderFlag(raw) {
|
|
7481
|
-
const separator = raw.indexOf(":");
|
|
7482
|
-
if (separator < 0) {
|
|
7483
|
-
throw new Error(
|
|
7484
|
-
`${PLAY_RUN_HEADER_FLAG_USAGE}. Got ${JSON.stringify(raw)} with no ":" separator.`
|
|
7485
|
-
);
|
|
7486
|
-
}
|
|
7487
|
-
const name = raw.slice(0, separator).trim().toLowerCase();
|
|
7488
|
-
const value = raw.slice(separator + 1).trim();
|
|
7489
|
-
if (!name) {
|
|
7490
|
-
throw new Error(
|
|
7491
|
-
`${PLAY_RUN_HEADER_FLAG_USAGE}. Got ${JSON.stringify(raw)} with an empty header name.`
|
|
7492
|
-
);
|
|
7493
|
-
}
|
|
7494
|
-
if (!HTTP_HEADER_NAME_PATTERN.test(name)) {
|
|
7495
|
-
throw new Error(
|
|
7496
|
-
`${PLAY_RUN_HEADER_FLAG_USAGE}. ${JSON.stringify(name)} is not a valid HTTP header name.`
|
|
7497
|
-
);
|
|
7498
|
-
}
|
|
7499
|
-
if (!value) {
|
|
7500
|
-
throw new Error(
|
|
7501
|
-
`${PLAY_RUN_HEADER_FLAG_USAGE}. Header ${JSON.stringify(name)} was given an empty value.`
|
|
7502
|
-
);
|
|
7503
|
-
}
|
|
7504
|
-
if (/[\u0000-\u001f\u007f]/.test(value)) {
|
|
7505
|
-
throw new Error(
|
|
7506
|
-
`${PLAY_RUN_HEADER_FLAG_USAGE}. Header ${JSON.stringify(name)} contains a control character.`
|
|
7507
|
-
);
|
|
7508
|
-
}
|
|
7509
|
-
return { name, value };
|
|
7510
|
-
}
|
|
7511
|
-
function isBarePlayRunDebugFlag(args, index) {
|
|
7512
|
-
return args[index] === "--debug" && (args[index + 1] === void 0 || args[index + 1].startsWith("--"));
|
|
7513
|
-
}
|
|
7514
|
-
function parseReferencedPlayTarget(target) {
|
|
7515
|
-
const trimmed = target.trim();
|
|
7516
|
-
const slashIndex = trimmed.indexOf("/");
|
|
7517
|
-
if (slashIndex <= 0 || slashIndex === trimmed.length - 1) {
|
|
7518
|
-
return { ownerSlug: null, playName: trimmed, unqualifiedPlayName: trimmed };
|
|
7519
|
-
}
|
|
7520
|
-
return {
|
|
7521
|
-
ownerSlug: trimmed.slice(0, slashIndex),
|
|
7522
|
-
playName: trimmed,
|
|
7523
|
-
unqualifiedPlayName: trimmed.slice(slashIndex + 1)
|
|
7524
|
-
};
|
|
7525
|
-
}
|
|
7526
|
-
function isFileTarget(target) {
|
|
7527
|
-
return existsSync(resolve4(target));
|
|
7528
|
-
}
|
|
7529
|
-
function looksLikeFilePath(target) {
|
|
7530
|
-
if (target.trim().toLowerCase().startsWith("prebuilt/")) {
|
|
7531
|
-
return false;
|
|
7532
|
-
}
|
|
7533
|
-
if (target.startsWith("./") || target.startsWith("../") || target.startsWith("/") || target.startsWith("~/")) {
|
|
7534
|
-
return true;
|
|
7535
|
-
}
|
|
7536
|
-
return target.includes("\\") || /\.(ts|js|mjs|play\.ts)$/.test(target);
|
|
7537
|
-
}
|
|
7538
|
-
function parsePositiveInteger(value, flagName) {
|
|
7539
|
-
const parsed = Number.parseInt(value, 10);
|
|
7540
|
-
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
7541
|
-
throw new Error(`${flagName} must be a positive integer.`);
|
|
7542
|
-
}
|
|
7543
|
-
return parsed;
|
|
7544
|
-
}
|
|
7545
|
-
function parseJsonInput(raw, flag = "--input") {
|
|
7546
|
-
const source = raw.startsWith("@") ? readFileSync(resolve4(raw.slice(1)), "utf-8") : raw;
|
|
7547
|
-
let parsed;
|
|
7548
|
-
try {
|
|
7549
|
-
parsed = JSON.parse(source);
|
|
7550
|
-
} catch {
|
|
7551
|
-
throw new DeeplineError(
|
|
7552
|
-
`${flag} expects a valid JSON object or @input.json. A bare file path is not JSON.${flag === "--input" ? " Use the field names and run example from plays check <file> or deepline describe <play>. --csv contacts.csv supplies input.csv only when the Play declares that field." : ""}`,
|
|
7553
|
-
void 0,
|
|
7554
|
-
"INVALID_JSON"
|
|
7555
|
-
);
|
|
7556
|
-
}
|
|
7557
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
7558
|
-
throw new DeeplineError(
|
|
7559
|
-
`${flag} must be a JSON object.`,
|
|
7560
|
-
void 0,
|
|
7561
|
-
"INVALID_JSON"
|
|
7562
|
-
);
|
|
7563
|
-
}
|
|
7564
|
-
return parsed;
|
|
7565
|
-
}
|
|
7566
|
-
function parseInputFieldFlag(rawFlag, nextArg) {
|
|
7567
|
-
const flag = rawFlag.slice(2);
|
|
7568
|
-
const equalsIndex = flag.indexOf("=");
|
|
7569
|
-
if (equalsIndex > 0) {
|
|
7570
|
-
const path = flag.slice(0, equalsIndex).trim();
|
|
7571
|
-
const value = flag.slice(equalsIndex + 1);
|
|
7572
|
-
if (!path) {
|
|
7573
|
-
throw new Error(`Invalid play input flag: ${rawFlag}`);
|
|
7574
|
-
}
|
|
7575
|
-
return { path, value };
|
|
7576
|
-
}
|
|
7577
|
-
if (!nextArg || nextArg.startsWith("--")) {
|
|
7578
|
-
throw new Error(`Play input flag ${rawFlag} requires a value.`);
|
|
7579
|
-
}
|
|
7580
|
-
return { path: flag, value: nextArg };
|
|
7581
|
-
}
|
|
7582
|
-
function parseInputFlagValue(raw) {
|
|
7583
|
-
const trimmed = raw.trim();
|
|
7584
|
-
if (!trimmed) return "";
|
|
7585
|
-
if (trimmed === "true" || trimmed === "false" || trimmed === "null" || trimmed.startsWith("{") || trimmed.startsWith("[") || /^-?\d+(\.\d+)?$/.test(trimmed)) {
|
|
7586
|
-
try {
|
|
7587
|
-
return JSON.parse(trimmed);
|
|
7588
|
-
} catch {
|
|
7589
|
-
return raw;
|
|
7590
|
-
}
|
|
7591
|
-
}
|
|
7592
|
-
return raw;
|
|
7593
|
-
}
|
|
7594
|
-
function parsePlayRunOptions(args, initialInput = null) {
|
|
7595
|
-
const selection = parseJsonFields(args, "run");
|
|
7596
|
-
args = selection.args;
|
|
7597
|
-
const usage2 = "Usage: deepline plays run <play-name> [--input '{...}'] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--full] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--full] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--profile <id>] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--full] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--profile <id>] [--live|--latest|--revision-id <id>] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--json] [--full] [--<input> value]\n Runs use the Absurd CJS runtime.\n --header '<name>: <value>' may repeat; each is sent on every request for this run.\n Unknown --<input> value flags, such as --limit 5, are passed into play input.\nRun `deepline plays run --help` for idempotent call caching and deepline.dataset guidance.";
|
|
7598
|
-
let filePath = null;
|
|
7599
|
-
let playName = null;
|
|
7600
|
-
let input = initialInput === null ? null : structuredClone(initialInput);
|
|
7601
|
-
let revisionId = null;
|
|
7602
|
-
let workflowId = null;
|
|
7603
|
-
let maxTotalCredits = null;
|
|
7604
|
-
let revisionSelector = null;
|
|
7605
|
-
const watch = !args.includes("--no-wait");
|
|
7606
|
-
const dryRun = args.includes("--dry-run");
|
|
7607
|
-
let jsonOutput = dryRun ? argsWantJson(args) : watch ? args.includes("--json") : argsWantJson(args);
|
|
7608
|
-
const fullJson = args.includes("--full");
|
|
7609
|
-
const force = args.includes("--force");
|
|
7610
|
-
const forceToolRefresh = args.includes("--force-tool-refresh");
|
|
7611
|
-
const open2 = args.includes("--open");
|
|
7612
|
-
const debugMapLatency = args.includes("--debug-map-latency");
|
|
7613
|
-
let logLevel = "info";
|
|
7614
|
-
let hasExplicitLogLevel = false;
|
|
7615
|
-
let waitTimeoutMs = null;
|
|
7616
|
-
let maxConcurrentExternalCalls = null;
|
|
7617
|
-
let maxConcurrentRows = null;
|
|
7618
|
-
let profile = null;
|
|
7619
|
-
let fixtureBehavior = null;
|
|
7620
|
-
let runIdFile = null;
|
|
7621
|
-
let headers = null;
|
|
7622
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
7623
|
-
const arg = args[index];
|
|
7624
|
-
if (arg === "--workflow-id") {
|
|
7625
|
-
const value = args[++index];
|
|
7626
|
-
if (!value || value.startsWith("--"))
|
|
7627
|
-
throw new Error("--workflow-id requires the original caller run ID.");
|
|
7628
|
-
workflowId = value;
|
|
7629
|
-
continue;
|
|
7630
|
-
}
|
|
7631
|
-
if (arg === "--max-total-credits") {
|
|
7632
|
-
const value = args[++index];
|
|
7633
|
-
if (value === void 0 || value.trim() === "" || !Number.isFinite(Number(value)) || Number(value) < 0)
|
|
7634
|
-
throw new Error(
|
|
7635
|
-
"--max-total-credits requires a non-negative number, including zero."
|
|
7636
|
-
);
|
|
7637
|
-
maxTotalCredits = Number(value);
|
|
7638
|
-
continue;
|
|
7639
|
-
}
|
|
7640
|
-
if (arg === "--header" || arg.startsWith("--header=")) {
|
|
7641
|
-
const raw = arg === "--header" ? args[index + 1] : arg.slice("--header=".length);
|
|
7642
|
-
if (raw === void 0 || arg === "--header" && raw.startsWith("--")) {
|
|
7643
|
-
throw new Error(`${PLAY_RUN_HEADER_FLAG_USAGE}. No value was given.`);
|
|
7644
|
-
}
|
|
7645
|
-
const header = parsePlayRunHeaderFlag(raw);
|
|
7646
|
-
headers ??= {};
|
|
7647
|
-
headers[header.name] = header.value;
|
|
7648
|
-
if (arg === "--header") index += 1;
|
|
7649
|
-
continue;
|
|
7650
|
-
}
|
|
7651
|
-
if (arg === "--file" && args[index + 1]) {
|
|
7652
|
-
filePath = args[++index];
|
|
7653
|
-
continue;
|
|
7654
|
-
}
|
|
7655
|
-
if (arg === "--name" && args[index + 1]) {
|
|
7656
|
-
playName = parseReferencedPlayTarget(args[++index]).playName;
|
|
7657
|
-
continue;
|
|
7658
|
-
}
|
|
7659
|
-
if ((arg === "--input" || arg === "-i") && args[index + 1]) {
|
|
7660
|
-
input = parseJsonInput(args[++index]);
|
|
7661
|
-
continue;
|
|
7662
|
-
}
|
|
7663
|
-
if (arg === "--log-level" || arg.startsWith("--log-level=")) {
|
|
7664
|
-
const value = arg === "--log-level" ? args[++index] : arg.slice("--log-level=".length);
|
|
7665
|
-
if (!value || value.startsWith("--")) {
|
|
7666
|
-
throw new Error(
|
|
7667
|
-
"--log-level requires one of: debug, info, warn, error."
|
|
7668
|
-
);
|
|
7669
|
-
}
|
|
7670
|
-
const parsed = parseLogLevel(value);
|
|
7671
|
-
if (!parsed) {
|
|
7672
|
-
throw new Error(
|
|
7673
|
-
`Unsupported --log-level ${JSON.stringify(value)}. Use debug, info, warn, or error.`
|
|
7674
|
-
);
|
|
7675
|
-
}
|
|
7676
|
-
logLevel = parsed;
|
|
7677
|
-
hasExplicitLogLevel = true;
|
|
7678
|
-
continue;
|
|
7679
|
-
}
|
|
7680
|
-
if (arg === "--run-id-file") {
|
|
7681
|
-
const value = args[index + 1];
|
|
7682
|
-
if (!value || value.startsWith("--")) {
|
|
7683
|
-
throw new Error("--run-id-file requires a destination path.");
|
|
7684
|
-
}
|
|
7685
|
-
runIdFile = value;
|
|
7686
|
-
index += 1;
|
|
7687
|
-
continue;
|
|
7688
|
-
}
|
|
7689
|
-
if (arg.startsWith("--run-id-file=")) {
|
|
7690
|
-
const value = arg.slice("--run-id-file=".length);
|
|
7691
|
-
if (!value) {
|
|
7692
|
-
throw new Error("--run-id-file requires a destination path.");
|
|
7693
|
-
}
|
|
7694
|
-
runIdFile = value;
|
|
7695
|
-
continue;
|
|
7696
|
-
}
|
|
7697
|
-
if (arg === "--revision-id" && args[index + 1]) {
|
|
7698
|
-
revisionId = args[++index];
|
|
7699
|
-
continue;
|
|
7700
|
-
}
|
|
7701
|
-
if (arg === "--profile") {
|
|
7702
|
-
const value = args[index + 1];
|
|
7703
|
-
if (!value) {
|
|
7704
|
-
throw new Error("--profile requires an execution profile id.");
|
|
7705
|
-
}
|
|
7706
|
-
profile = value.trim();
|
|
7707
|
-
resolveEnabledExecutionProfile(profile);
|
|
7708
|
-
index += 1;
|
|
7709
|
-
continue;
|
|
7710
|
-
}
|
|
7711
|
-
if (arg === "--max-concurrent-external-calls") {
|
|
7712
|
-
const value = args[index + 1];
|
|
7713
|
-
if (!value || value.startsWith("--")) {
|
|
7714
|
-
throw new Error(
|
|
7715
|
-
"--max-concurrent-external-calls requires a whole number."
|
|
7716
|
-
);
|
|
7717
|
-
}
|
|
7718
|
-
if (!/^[1-9]\d*$/.test(value)) {
|
|
7719
|
-
throw new Error(
|
|
7720
|
-
"--max-concurrent-external-calls requires a positive whole number."
|
|
7721
|
-
);
|
|
7722
|
-
}
|
|
7723
|
-
maxConcurrentExternalCalls = parsePositiveInteger(
|
|
7724
|
-
value,
|
|
7725
|
-
"--max-concurrent-external-calls"
|
|
7726
|
-
);
|
|
7727
|
-
resolveMaxConcurrentExternalCalls(maxConcurrentExternalCalls);
|
|
7728
|
-
index += 1;
|
|
7729
|
-
continue;
|
|
7730
|
-
}
|
|
7731
|
-
if (arg === "--max-concurrent-rows") {
|
|
7732
|
-
const value = args[index + 1];
|
|
7733
|
-
if (!value || value.startsWith("--")) {
|
|
7734
|
-
throw new Error("--max-concurrent-rows requires a whole number.");
|
|
7735
|
-
}
|
|
7736
|
-
if (!/^[1-9]\d*$/.test(value)) {
|
|
7737
|
-
throw new Error(
|
|
7738
|
-
"--max-concurrent-rows requires a positive whole number."
|
|
7739
|
-
);
|
|
7740
|
-
}
|
|
7741
|
-
maxConcurrentRows = parsePositiveInteger(value, "--max-concurrent-rows");
|
|
7742
|
-
resolveMaxConcurrentRows(maxConcurrentRows);
|
|
7743
|
-
index += 1;
|
|
7744
|
-
continue;
|
|
7745
|
-
}
|
|
7746
|
-
if (arg === "--fixture-behavior") {
|
|
7747
|
-
const value = args[index + 1];
|
|
7748
|
-
if (!value) {
|
|
7749
|
-
throw new Error(
|
|
7750
|
-
"--fixture-behavior requires a JSON object or @file path."
|
|
7751
|
-
);
|
|
7752
|
-
}
|
|
7753
|
-
const parsed = validateFixtureBehavior(
|
|
7754
|
-
parseJsonInput(value, "--fixture-behavior")
|
|
7755
|
-
);
|
|
7756
|
-
if (!parsed.ok || !parsed.behavior) {
|
|
7757
|
-
throw new Error(
|
|
7758
|
-
parsed.ok ? "--fixture-behavior is required." : parsed.error
|
|
7759
|
-
);
|
|
7760
|
-
}
|
|
7761
|
-
fixtureBehavior = parsed.behavior;
|
|
7762
|
-
index += 1;
|
|
7763
|
-
continue;
|
|
7764
|
-
}
|
|
7765
|
-
if (arg === "--live") {
|
|
7766
|
-
revisionSelector = "live";
|
|
7767
|
-
continue;
|
|
7768
|
-
}
|
|
7769
|
-
if (arg === "--latest") {
|
|
7770
|
-
revisionSelector = "latest";
|
|
7771
|
-
continue;
|
|
7772
|
-
}
|
|
7773
|
-
if (arg === "--out" || arg.startsWith("--out=")) {
|
|
7774
|
-
throw new Error(
|
|
7775
|
-
"--out is not a plays run flag. Run the play first, then export rows with: deepline runs export <run-id> --out output.csv"
|
|
7776
|
-
);
|
|
7777
|
-
}
|
|
7778
|
-
if (arg === "--no-open" || arg.startsWith("--no-open=")) {
|
|
7779
|
-
throw new Error(
|
|
7780
|
-
"--no-open was removed for `plays run`. Play page URLs are printed by default; pass --open to launch a browser."
|
|
7781
|
-
);
|
|
7782
|
-
}
|
|
7783
|
-
if (arg === "--poll-interval-ms" || arg === "--interval-ms") {
|
|
7784
|
-
throw new Error(
|
|
7785
|
-
`${arg} was removed. --watch polls the canonical run snapshot.`
|
|
7786
|
-
);
|
|
7787
|
-
}
|
|
7788
|
-
if ((arg === "--tail-timeout-ms" || arg === "--timeout-ms") && args[index + 1]) {
|
|
7789
|
-
waitTimeoutMs = parsePositiveInteger(args[++index], arg);
|
|
7790
|
-
continue;
|
|
7791
|
-
}
|
|
7792
|
-
if (arg === "--debug" && args[index + 1] && !args[index + 1].startsWith("--")) {
|
|
7793
|
-
input ??= {};
|
|
7794
|
-
setDottedInputValue(input, "debug", parseInputFlagValue(args[++index]));
|
|
7795
|
-
continue;
|
|
7796
|
-
}
|
|
7797
|
-
if (arg.startsWith("--debug=")) {
|
|
7798
|
-
input ??= {};
|
|
7799
|
-
setDottedInputValue(
|
|
7800
|
-
input,
|
|
7801
|
-
"debug",
|
|
7802
|
-
parseInputFlagValue(arg.slice("--debug=".length))
|
|
7803
|
-
);
|
|
7804
|
-
continue;
|
|
7805
|
-
}
|
|
7806
|
-
if (PLAY_RUN_RESERVED_BOOLEAN_FLAGS.has(arg)) {
|
|
7807
|
-
if (arg === "--watch") {
|
|
7808
|
-
continue;
|
|
7809
|
-
}
|
|
7810
|
-
if (arg === "--wait") {
|
|
7811
|
-
continue;
|
|
7812
|
-
}
|
|
7813
|
-
if (arg === "--json") {
|
|
7814
|
-
jsonOutput = true;
|
|
7815
|
-
continue;
|
|
6734
|
+
const revokedAtCheck = revokedFinalStatus(checkError);
|
|
6735
|
+
if (revokedAtCheck) {
|
|
6736
|
+
return { finalStatus: revokedAtCheck, outcomes: [] };
|
|
7816
6737
|
}
|
|
7817
|
-
if (
|
|
7818
|
-
|
|
7819
|
-
"
|
|
6738
|
+
if (checkError instanceof RetryableDeploymentError) {
|
|
6739
|
+
console.warn(
|
|
6740
|
+
"[deploy-worker] retryable failure, leaving non-terminal",
|
|
6741
|
+
{
|
|
6742
|
+
deploymentId: params.deploymentId,
|
|
6743
|
+
error: checkError.message.slice(0, 300)
|
|
6744
|
+
}
|
|
7820
6745
|
);
|
|
6746
|
+
throw checkError;
|
|
7821
6747
|
}
|
|
7822
|
-
continue;
|
|
7823
6748
|
}
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
6749
|
+
await setStatus({
|
|
6750
|
+
status: "failed",
|
|
6751
|
+
error: message.slice(0, 2e3),
|
|
6752
|
+
...monitorOutcomes.length > 0 ? { results: monitorResults() } : {},
|
|
6753
|
+
buildSeconds: buildSeconds(),
|
|
6754
|
+
...checkRunId ? { checkRunId } : {}
|
|
6755
|
+
}).catch(() => void 0);
|
|
6756
|
+
throw error;
|
|
6757
|
+
} finally {
|
|
6758
|
+
await rm(workDir, { recursive: true, force: true }).catch(() => void 0);
|
|
6759
|
+
}
|
|
6760
|
+
}
|
|
6761
|
+
function topoSortByPlayDependencies(plays) {
|
|
6762
|
+
const byName = new Map(plays.map((play) => [play.name, play]));
|
|
6763
|
+
const visited = /* @__PURE__ */ new Set();
|
|
6764
|
+
const ordered = [];
|
|
6765
|
+
const visit = (play, stack) => {
|
|
6766
|
+
if (visited.has(play.name)) return;
|
|
6767
|
+
if (stack.has(play.name)) {
|
|
6768
|
+
return;
|
|
7832
6769
|
}
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
6770
|
+
stack.add(play.name);
|
|
6771
|
+
const dependencyNames = /* @__PURE__ */ new Set([
|
|
6772
|
+
...(play.result.importedPlayDependencies ?? []).map(
|
|
6773
|
+
(dependency) => dependency.playName
|
|
6774
|
+
),
|
|
6775
|
+
...play.runPlayStringTargets
|
|
6776
|
+
]);
|
|
6777
|
+
for (const dependencyName of dependencyNames) {
|
|
6778
|
+
const target = byName.get(dependencyName);
|
|
6779
|
+
if (target) visit(target, stack);
|
|
7840
6780
|
}
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
}
|
|
7845
|
-
const explicitRevisionSelectors = [
|
|
7846
|
-
revisionId ? "--revision-id" : null,
|
|
7847
|
-
revisionSelector === "live" ? "--live" : null,
|
|
7848
|
-
revisionSelector === "latest" ? "--latest" : null
|
|
7849
|
-
].filter(Boolean);
|
|
7850
|
-
if (explicitRevisionSelectors.length > 1) {
|
|
7851
|
-
throw new Error(
|
|
7852
|
-
`Choose only one revision selector: ${explicitRevisionSelectors.join(", ")}.`
|
|
7853
|
-
);
|
|
7854
|
-
}
|
|
7855
|
-
if (filePath && explicitRevisionSelectors.length > 0) {
|
|
7856
|
-
throw new Error(
|
|
7857
|
-
"--live, --latest, and --revision-id only apply to named plays."
|
|
7858
|
-
);
|
|
7859
|
-
}
|
|
7860
|
-
if (debugMapLatency && logLevel === "info") logLevel = "debug";
|
|
7861
|
-
const usesDebugAlias = args.includes("--logs") || args.some((_, index) => isBarePlayRunDebugFlag(args, index));
|
|
7862
|
-
if (usesDebugAlias && hasExplicitLogLevel && logLevel !== "debug") {
|
|
7863
|
-
throw new Error(
|
|
7864
|
-
"--debug/--logs conflicts with a non-debug --log-level. Use one level selector."
|
|
7865
|
-
);
|
|
7866
|
-
}
|
|
7867
|
-
if (usesDebugAlias) logLevel = "debug";
|
|
7868
|
-
const explicitDebugLogs = usesDebugAlias || logLevel === "debug";
|
|
7869
|
-
const emitLogs = !jsonOutput || explicitDebugLogs || hasExplicitLogLevel;
|
|
7870
|
-
const verboseLogs = explicitDebugLogs || debugMapLatency;
|
|
7871
|
-
if (dryRun && !filePath)
|
|
7872
|
-
throw new Error("--dry-run currently requires a local Play file.");
|
|
7873
|
-
return {
|
|
7874
|
-
dryRun,
|
|
7875
|
-
target: filePath ? { kind: "file", path: filePath } : { kind: "name", name: playName },
|
|
7876
|
-
input,
|
|
7877
|
-
revisionId,
|
|
7878
|
-
workflowId,
|
|
7879
|
-
maxTotalCredits,
|
|
7880
|
-
revisionSelector,
|
|
7881
|
-
watch,
|
|
7882
|
-
emitLogs,
|
|
7883
|
-
verboseLogs,
|
|
7884
|
-
logLevel,
|
|
7885
|
-
jsonOutput,
|
|
7886
|
-
fullJson,
|
|
7887
|
-
jsonFields: selection.fields,
|
|
7888
|
-
waitTimeoutMs,
|
|
7889
|
-
force,
|
|
7890
|
-
forceToolRefresh,
|
|
7891
|
-
maxConcurrentExternalCalls,
|
|
7892
|
-
maxConcurrentRows,
|
|
7893
|
-
maxCredits: null,
|
|
7894
|
-
open: open2,
|
|
7895
|
-
profile,
|
|
7896
|
-
debugMapLatency,
|
|
7897
|
-
fixtureBehavior,
|
|
7898
|
-
runIdFile,
|
|
7899
|
-
headers
|
|
6781
|
+
stack.delete(play.name);
|
|
6782
|
+
visited.add(play.name);
|
|
6783
|
+
ordered.push(play);
|
|
7900
6784
|
};
|
|
6785
|
+
for (const play of plays) visit(play, /* @__PURE__ */ new Set());
|
|
6786
|
+
return ordered;
|
|
7901
6787
|
}
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
const
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
const
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
6788
|
+
|
|
6789
|
+
// src/cli/commands/plays-deploy.ts
|
|
6790
|
+
var MAX_DEPLOY_ATTEMPTS = 3;
|
|
6791
|
+
function renderOutcome(outcome) {
|
|
6792
|
+
const version = outcome.version === void 0 ? "" : outcome.previousVersion === void 0 ? ` v${outcome.version}` : ` v${outcome.previousVersion} -> v${outcome.version}`;
|
|
6793
|
+
const sdkUpdated = outcome.sdkUpdated ? " (SDK updated)" : "";
|
|
6794
|
+
const note = outcome.error ?? outcome.warning;
|
|
6795
|
+
return `${outcome.name} (${outcome.file}): ${outcome.status}${version}${sdkUpdated}${note ? ` - ${note}` : ""}`;
|
|
6796
|
+
}
|
|
6797
|
+
function printResult2(input) {
|
|
6798
|
+
const failed = input.status === "failed" || input.status === "cancelled";
|
|
6799
|
+
if (failed) process.exitCode = 1;
|
|
6800
|
+
printCommandEnvelope(
|
|
6801
|
+
{
|
|
6802
|
+
deployment: { ...input.deployment, status: input.status },
|
|
6803
|
+
plays: input.outcomes,
|
|
6804
|
+
render: {
|
|
6805
|
+
sections: [
|
|
6806
|
+
{
|
|
6807
|
+
title: `deployment ${input.deployment.id}`,
|
|
6808
|
+
lines: [
|
|
6809
|
+
`${input.directory}: ${input.status}`,
|
|
6810
|
+
...input.outcomes.map(renderOutcome),
|
|
6811
|
+
...failed && input.deployment.error ? [input.deployment.error] : [],
|
|
6812
|
+
`Details: deepline plays deployments ${input.deployment.id}`
|
|
6813
|
+
]
|
|
6814
|
+
}
|
|
6815
|
+
]
|
|
6816
|
+
}
|
|
6817
|
+
},
|
|
6818
|
+
{ json: input.json }
|
|
7925
6819
|
);
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
const
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
);
|
|
7983
|
-
|
|
6820
|
+
}
|
|
6821
|
+
async function handlePlaysDeploy(directory, options) {
|
|
6822
|
+
const root = await realpath(resolve2(directory ?? ".")).catch(() => {
|
|
6823
|
+
throw new Error(`No such directory: ${resolve2(directory ?? ".")}`);
|
|
6824
|
+
});
|
|
6825
|
+
const { http, config } = getAuthedHttpClient();
|
|
6826
|
+
const deliveryId = `local:${randomUUID()}`;
|
|
6827
|
+
const startDeployment = () => http.post("/api/v2/deployments", {
|
|
6828
|
+
deliveryId,
|
|
6829
|
+
...options.repo ? { repo: options.repo } : {},
|
|
6830
|
+
...options.ref ? { ref: options.ref } : {},
|
|
6831
|
+
...options.commit ? { commit: options.commit } : {}
|
|
6832
|
+
});
|
|
6833
|
+
const { bundleDeployPlayFile } = await loadPlayBundler();
|
|
6834
|
+
const workRoot = await mkdtemp2(join4(tmpdir(), "deepline-deploy-"));
|
|
6835
|
+
const consoleInfo = console.info;
|
|
6836
|
+
console.info = console.error;
|
|
6837
|
+
try {
|
|
6838
|
+
for (let attempt = 1; ; attempt += 1) {
|
|
6839
|
+
const { deployment } = await startDeployment();
|
|
6840
|
+
let result;
|
|
6841
|
+
try {
|
|
6842
|
+
result = await runDeployment(
|
|
6843
|
+
{
|
|
6844
|
+
deploymentId: deployment.id,
|
|
6845
|
+
// The workspace key drives its own deployment; there is no
|
|
6846
|
+
// separate deploy token to mint.
|
|
6847
|
+
deployToken: config.apiKey,
|
|
6848
|
+
appBaseUrl: config.baseUrl
|
|
6849
|
+
},
|
|
6850
|
+
{
|
|
6851
|
+
bundle: bundleDeployPlayFile,
|
|
6852
|
+
fetchImpl: fetchWithDeploymentProtection,
|
|
6853
|
+
// The plays are already here: "opening" the source is naming it.
|
|
6854
|
+
openSource: async () => ({
|
|
6855
|
+
open: async () => ({ repoRoot: root })
|
|
6856
|
+
}),
|
|
6857
|
+
target: {
|
|
6858
|
+
rootDirectory: "",
|
|
6859
|
+
manifestPath: options.manifest?.trim() ?? ""
|
|
6860
|
+
},
|
|
6861
|
+
workRoot
|
|
6862
|
+
}
|
|
6863
|
+
);
|
|
6864
|
+
} catch (error) {
|
|
6865
|
+
if (error instanceof RetryableDeploymentError && attempt < MAX_DEPLOY_ATTEMPTS) {
|
|
6866
|
+
process.stderr.write(
|
|
6867
|
+
`Deployment ${deployment.id} did not finish (${error.message}); retrying (${attempt + 1}/${MAX_DEPLOY_ATTEMPTS}).
|
|
6868
|
+
`
|
|
6869
|
+
);
|
|
6870
|
+
continue;
|
|
6871
|
+
}
|
|
6872
|
+
throw error;
|
|
6873
|
+
}
|
|
6874
|
+
const finished = await http.get(
|
|
6875
|
+
`/api/v2/deployments/${encodeURIComponent(deployment.id)}`
|
|
6876
|
+
).then((payload) => payload.deployment).catch(() => deployment);
|
|
6877
|
+
printResult2({
|
|
6878
|
+
directory: root,
|
|
6879
|
+
deployment: finished,
|
|
6880
|
+
status: result.finalStatus,
|
|
6881
|
+
outcomes: result.outcomes,
|
|
6882
|
+
json: options.json
|
|
6883
|
+
});
|
|
6884
|
+
return;
|
|
6885
|
+
}
|
|
6886
|
+
} finally {
|
|
6887
|
+
console.info = consoleInfo;
|
|
6888
|
+
await rm2(workRoot, { recursive: true, force: true });
|
|
7984
6889
|
}
|
|
7985
|
-
const hasExplicitLogLevel = options.logLevel !== void 0 || inputArgs.some(
|
|
7986
|
-
(arg) => arg === "--log-level" || arg.startsWith("--log-level=")
|
|
7987
|
-
);
|
|
7988
|
-
let logLevel = options.logLevel === void 0 ? base.logLevel : parseLogLevel(options.logLevel);
|
|
7989
|
-
if (!logLevel)
|
|
7990
|
-
throw new Error("--log-level requires one of: debug, info, warn, error.");
|
|
7991
|
-
const debugAlias = options.logs || options.debug === true || inputArgs.some(
|
|
7992
|
-
(arg, index) => arg === "--logs" || isBarePlayRunDebugFlag(inputArgs, index)
|
|
7993
|
-
);
|
|
7994
|
-
if (debugAlias && hasExplicitLogLevel && logLevel !== "debug")
|
|
7995
|
-
throw new Error(
|
|
7996
|
-
"--debug/--logs conflicts with a non-debug --log-level. Use one level selector."
|
|
7997
|
-
);
|
|
7998
|
-
const debugMapLatency = options.debugMapLatency ?? base.debugMapLatency;
|
|
7999
|
-
if (debugAlias || debugMapLatency && logLevel === "info")
|
|
8000
|
-
logLevel = "debug";
|
|
8001
|
-
const fullJson = options.full ?? base.fullJson;
|
|
8002
|
-
const jsonFields = options.json === void 0 ? base.jsonFields : parseJsonFields(
|
|
8003
|
-
[...fullJson ? ["--full"] : [], ...jsonFieldArgs(options.json)],
|
|
8004
|
-
"run"
|
|
8005
|
-
).fields;
|
|
8006
|
-
const watch = options.wait === false ? false : base.watch;
|
|
8007
|
-
const explicitJson = options.json !== void 0 ? options.json !== false : base.jsonOutput;
|
|
8008
|
-
const jsonOutput = dryRun || !watch ? explicitJson || argsWantJson([]) : explicitJson;
|
|
8009
|
-
const verboseLogs = Boolean(
|
|
8010
|
-
debugAlias || logLevel === "debug" || debugMapLatency
|
|
8011
|
-
);
|
|
8012
|
-
return {
|
|
8013
|
-
...base,
|
|
8014
|
-
...maintenancePolicy ? { maintenancePolicy } : {},
|
|
8015
|
-
target: resolvedTarget,
|
|
8016
|
-
dryRun,
|
|
8017
|
-
input: base.input,
|
|
8018
|
-
revisionId,
|
|
8019
|
-
workflowId: stringOption(options.workflowId, "--workflow-id") ?? base.workflowId,
|
|
8020
|
-
maxTotalCredits,
|
|
8021
|
-
revisionSelector: options.live ? "live" : options.latest ? "latest" : base.revisionSelector,
|
|
8022
|
-
profile,
|
|
8023
|
-
fixtureBehavior,
|
|
8024
|
-
watch,
|
|
8025
|
-
runIdFile: stringOption(options.runIdFile, "--run-id-file") ?? base.runIdFile,
|
|
8026
|
-
logLevel,
|
|
8027
|
-
emitLogs: !jsonOutput || verboseLogs || hasExplicitLogLevel,
|
|
8028
|
-
verboseLogs,
|
|
8029
|
-
jsonOutput,
|
|
8030
|
-
fullJson,
|
|
8031
|
-
jsonFields,
|
|
8032
|
-
waitTimeoutMs,
|
|
8033
|
-
force: options.force ?? base.force,
|
|
8034
|
-
forceToolRefresh: options.forceToolRefresh ?? base.forceToolRefresh,
|
|
8035
|
-
maxConcurrentExternalCalls: externalCalls,
|
|
8036
|
-
maxConcurrentRows: rows,
|
|
8037
|
-
maxCredits,
|
|
8038
|
-
open: options.open ?? base.open,
|
|
8039
|
-
debugMapLatency
|
|
8040
|
-
};
|
|
8041
6890
|
}
|
|
8042
6891
|
|
|
8043
6892
|
// src/plays/authoring-graph-path.ts
|
|
@@ -8202,7 +7051,7 @@ async function removeRunIdTempFile(path) {
|
|
|
8202
7051
|
}
|
|
8203
7052
|
}
|
|
8204
7053
|
async function preflightRunIdFile(path) {
|
|
8205
|
-
const destination =
|
|
7054
|
+
const destination = resolve3(path);
|
|
8206
7055
|
if (await pathExistsIncludingSymlink(destination)) {
|
|
8207
7056
|
throw new Error(
|
|
8208
7057
|
`--run-id-file destination already exists: ${destination}. Choose a new path so this run cannot overwrite another run identity.`
|
|
@@ -8317,9 +7166,9 @@ function traceCliSync(phase, fields2, run) {
|
|
|
8317
7166
|
}
|
|
8318
7167
|
}
|
|
8319
7168
|
function sleep(ms) {
|
|
8320
|
-
return new Promise((
|
|
7169
|
+
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
8321
7170
|
}
|
|
8322
|
-
function
|
|
7171
|
+
function parseReferencedPlayTarget(target) {
|
|
8323
7172
|
const trimmed = target.trim();
|
|
8324
7173
|
const slashIndex = trimmed.indexOf("/");
|
|
8325
7174
|
if (slashIndex <= 0 || slashIndex === trimmed.length - 1) {
|
|
@@ -8366,7 +7215,7 @@ function playSuggestionReference(play) {
|
|
|
8366
7215
|
return ownerSlug ? `${ownerSlug}/${play.name}` : play.name;
|
|
8367
7216
|
}
|
|
8368
7217
|
function scorePlayReferenceSuggestion(requested, play) {
|
|
8369
|
-
const parsed =
|
|
7218
|
+
const parsed = parseReferencedPlayTarget(requested);
|
|
8370
7219
|
const requestedTrimmed = requested.trim();
|
|
8371
7220
|
const requestedRef = requestedTrimmed.toLowerCase();
|
|
8372
7221
|
const requestedName = parsed.unqualifiedPlayName;
|
|
@@ -8444,7 +7293,7 @@ function rankPlayReferenceSuggestions(input) {
|
|
|
8444
7293
|
}).slice(0, input.limit ?? 5);
|
|
8445
7294
|
}
|
|
8446
7295
|
function searchQueryForMissingPlayReference(target) {
|
|
8447
|
-
return
|
|
7296
|
+
return parseReferencedPlayTarget(target).unqualifiedPlayName.replace(/[-_./]+/g, " ").replace(/\s+/g, " ").trim();
|
|
8448
7297
|
}
|
|
8449
7298
|
function buildPlayReferenceNotFoundMessage(input) {
|
|
8450
7299
|
const lines = [`Play not found: ${input.requested}`];
|
|
@@ -8453,9 +7302,7 @@ function buildPlayReferenceNotFoundMessage(input) {
|
|
|
8453
7302
|
for (const suggestion of input.suggestions) {
|
|
8454
7303
|
lines.push("", ` ${suggestion.reference}`);
|
|
8455
7304
|
if (input.command === "run") {
|
|
8456
|
-
lines.push(
|
|
8457
|
-
` deepline plays run ${suggestion.reference} --input '{...}'`
|
|
8458
|
-
);
|
|
7305
|
+
lines.push(` deepline run ${suggestion.reference} --input '{...}'`);
|
|
8459
7306
|
} else if (input.command === "get") {
|
|
8460
7307
|
lines.push(` deepline plays get ${suggestion.reference}`);
|
|
8461
7308
|
} else if (input.command === "check") {
|
|
@@ -8521,7 +7368,7 @@ async function isMissingRunPlayReferenceError(input) {
|
|
|
8521
7368
|
}
|
|
8522
7369
|
try {
|
|
8523
7370
|
await input.client.getPlay(
|
|
8524
|
-
|
|
7371
|
+
parseReferencedPlayTarget(input.playName).playName
|
|
8525
7372
|
);
|
|
8526
7373
|
return false;
|
|
8527
7374
|
} catch (lookupError) {
|
|
@@ -8529,7 +7376,7 @@ async function isMissingRunPlayReferenceError(input) {
|
|
|
8529
7376
|
}
|
|
8530
7377
|
}
|
|
8531
7378
|
async function assertCanonicalNamedPlayReference(client, target, options = {}) {
|
|
8532
|
-
const parsed =
|
|
7379
|
+
const parsed = parseReferencedPlayTarget(target);
|
|
8533
7380
|
let detail;
|
|
8534
7381
|
try {
|
|
8535
7382
|
detail = await client.getPlay(
|
|
@@ -8566,10 +7413,10 @@ function formatPlayListReference(play) {
|
|
|
8566
7413
|
return play.reference || play.name;
|
|
8567
7414
|
}
|
|
8568
7415
|
function defaultMaterializedPlayPath(reference) {
|
|
8569
|
-
return
|
|
7416
|
+
return resolve3(defaultStarterPlayPath(reference));
|
|
8570
7417
|
}
|
|
8571
7418
|
function defaultStarterPlayPath(reference) {
|
|
8572
|
-
const playName =
|
|
7419
|
+
const playName = parseReferencedPlayTarget(reference).unqualifiedPlayName;
|
|
8573
7420
|
const safeName = playName.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
8574
7421
|
return `./${safeName || "play"}.play.ts`;
|
|
8575
7422
|
}
|
|
@@ -8585,7 +7432,7 @@ function buildCloneEditStarter(play) {
|
|
|
8585
7432
|
};
|
|
8586
7433
|
}
|
|
8587
7434
|
function materializeRemotePlaySource(input) {
|
|
8588
|
-
if (
|
|
7435
|
+
if (isFileTarget(input.target)) {
|
|
8589
7436
|
return null;
|
|
8590
7437
|
}
|
|
8591
7438
|
const entrySource = input.source.files[input.source.entryFile];
|
|
@@ -8599,11 +7446,11 @@ function materializeRemotePlaySource(input) {
|
|
|
8599
7446
|
`Play ${input.playName} has ${files.length} source files. Use --out <directory> to write the complete bundle.`
|
|
8600
7447
|
);
|
|
8601
7448
|
}
|
|
8602
|
-
const outputDirectory =
|
|
7449
|
+
const outputDirectory = resolve3(input.outPath);
|
|
8603
7450
|
let created = 0;
|
|
8604
7451
|
let updated = 0;
|
|
8605
7452
|
for (const [logicalPath, sourceCode] of files) {
|
|
8606
|
-
const outputPath2 =
|
|
7453
|
+
const outputPath2 = resolve3(outputDirectory, logicalPath);
|
|
8607
7454
|
const outputRelativePath = relative3(outputDirectory, outputPath2);
|
|
8608
7455
|
if (!outputRelativePath || outputRelativePath.startsWith("..") || isAbsolute2(outputRelativePath)) {
|
|
8609
7456
|
throw new Error(
|
|
@@ -8611,11 +7458,11 @@ function materializeRemotePlaySource(input) {
|
|
|
8611
7458
|
);
|
|
8612
7459
|
}
|
|
8613
7460
|
mkdirSync(dirname2(outputPath2), { recursive: true });
|
|
8614
|
-
if (!
|
|
8615
|
-
|
|
7461
|
+
if (!existsSync(outputPath2)) {
|
|
7462
|
+
writeFileSync2(outputPath2, sourceCode, "utf-8");
|
|
8616
7463
|
created += 1;
|
|
8617
|
-
} else if (
|
|
8618
|
-
|
|
7464
|
+
} else if (readFileSync(outputPath2, "utf-8") !== sourceCode) {
|
|
7465
|
+
writeFileSync2(outputPath2, sourceCode, "utf-8");
|
|
8619
7466
|
updated += 1;
|
|
8620
7467
|
}
|
|
8621
7468
|
}
|
|
@@ -8627,15 +7474,15 @@ function materializeRemotePlaySource(input) {
|
|
|
8627
7474
|
};
|
|
8628
7475
|
}
|
|
8629
7476
|
const outputPath = input.outPath ?? defaultMaterializedPlayPath(input.playName);
|
|
8630
|
-
if (
|
|
8631
|
-
const existingSource =
|
|
7477
|
+
if (existsSync(outputPath)) {
|
|
7478
|
+
const existingSource = readFileSync(outputPath, "utf-8");
|
|
8632
7479
|
if (existingSource === entrySource) {
|
|
8633
7480
|
return { path: outputPath, status: "unchanged", created: false };
|
|
8634
7481
|
}
|
|
8635
|
-
|
|
7482
|
+
writeFileSync2(outputPath, entrySource, "utf-8");
|
|
8636
7483
|
return { path: outputPath, status: "updated", created: false };
|
|
8637
7484
|
}
|
|
8638
|
-
|
|
7485
|
+
writeFileSync2(outputPath, entrySource, "utf-8");
|
|
8639
7486
|
return { path: outputPath, status: "created", created: true };
|
|
8640
7487
|
}
|
|
8641
7488
|
function formatLoadedPlayMessage(materializedFile) {
|
|
@@ -8660,7 +7507,7 @@ To make your own version:
|
|
|
8660
7507
|
);
|
|
8661
7508
|
}
|
|
8662
7509
|
async function ensureEditableRemotePlay(client, target) {
|
|
8663
|
-
const parsed =
|
|
7510
|
+
const parsed = parseReferencedPlayTarget(target);
|
|
8664
7511
|
const detail = await client.getPlay(parsed.playName);
|
|
8665
7512
|
if (detail.play.ownerType === "deepline") {
|
|
8666
7513
|
throw buildReadonlyPrebuiltPlayError(formatPlayReference(detail.play));
|
|
@@ -8668,14 +7515,14 @@ async function ensureEditableRemotePlay(client, target) {
|
|
|
8668
7515
|
return detail;
|
|
8669
7516
|
}
|
|
8670
7517
|
function writeInlinePlay(code) {
|
|
8671
|
-
const filePath =
|
|
7518
|
+
const filePath = resolve3(INLINE_PLAY_FILE);
|
|
8672
7519
|
const source = inlinePlaySource(code);
|
|
8673
7520
|
try {
|
|
8674
|
-
|
|
7521
|
+
writeFileSync2(filePath, source, { flag: "wx" });
|
|
8675
7522
|
} catch (error) {
|
|
8676
7523
|
if (error.code === "EEXIST") {
|
|
8677
7524
|
throw new Error(
|
|
8678
|
-
`${filePath} already exists. Remove it, or run it with: deepline
|
|
7525
|
+
`${filePath} already exists. Remove it, or run it with: deepline run ${filePath}`
|
|
8679
7526
|
);
|
|
8680
7527
|
}
|
|
8681
7528
|
throw error;
|
|
@@ -8694,8 +7541,8 @@ function extractPlayName(code, filePath) {
|
|
|
8694
7541
|
}
|
|
8695
7542
|
throw buildMissingDefinePlayError(filePath);
|
|
8696
7543
|
}
|
|
8697
|
-
function
|
|
8698
|
-
return
|
|
7544
|
+
function isFileTarget(target) {
|
|
7545
|
+
return existsSync(resolve3(target));
|
|
8699
7546
|
}
|
|
8700
7547
|
function looksLikeRunId(target) {
|
|
8701
7548
|
return /^play\/[^/]+\/run\/[^/]+/.test(target.trim());
|
|
@@ -8707,7 +7554,7 @@ Use:
|
|
|
8707
7554
|
deepline runs logs ${input.runId}
|
|
8708
7555
|
deepline runs export ${input.runId} --out output.csv`;
|
|
8709
7556
|
}
|
|
8710
|
-
function
|
|
7557
|
+
function looksLikeFilePath(target) {
|
|
8711
7558
|
if (target.trim().toLowerCase().startsWith("prebuilt/")) {
|
|
8712
7559
|
return false;
|
|
8713
7560
|
}
|
|
@@ -8716,7 +7563,7 @@ function looksLikeFilePath2(target) {
|
|
|
8716
7563
|
}
|
|
8717
7564
|
return target.includes("\\") || /\.(ts|js|mjs|play\.ts)$/.test(target);
|
|
8718
7565
|
}
|
|
8719
|
-
function
|
|
7566
|
+
function parsePositiveInteger(value, flagName) {
|
|
8720
7567
|
const parsed = Number.parseInt(value, 10);
|
|
8721
7568
|
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
8722
7569
|
throw new Error(`${flagName} must be a positive integer.`);
|
|
@@ -8726,7 +7573,7 @@ function parsePositiveInteger2(value, flagName) {
|
|
|
8726
7573
|
function isLocalFilePathValue(value) {
|
|
8727
7574
|
if (typeof value !== "string" || !value.trim()) return false;
|
|
8728
7575
|
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(value.trim())) return false;
|
|
8729
|
-
return
|
|
7576
|
+
return existsSync(resolve3(value));
|
|
8730
7577
|
}
|
|
8731
7578
|
function inputContainsLocalFilePath(value) {
|
|
8732
7579
|
if (isLocalFilePathValue(value)) {
|
|
@@ -8772,7 +7619,7 @@ function collectLocalFileInputRefs(value, inputPath, key, out) {
|
|
|
8772
7619
|
const looksLikeFile = /\.[a-z0-9]{1,8}$/i.test(trimmed);
|
|
8773
7620
|
if (keyIsCsvData) {
|
|
8774
7621
|
out.push({ inputPath, value: trimmed, isCsvData: true });
|
|
8775
|
-
} else if (endsWithCsv || looksLikeFile &&
|
|
7622
|
+
} else if (endsWithCsv || looksLikeFile && existsSync(resolve3(trimmed))) {
|
|
8776
7623
|
out.push({ inputPath, value: trimmed, isCsvData: false });
|
|
8777
7624
|
}
|
|
8778
7625
|
return;
|
|
@@ -8814,8 +7661,8 @@ function preflightLocalFileInputs(runtimeInput) {
|
|
|
8814
7661
|
collectLocalFileInputRefs(value, key, key, refs);
|
|
8815
7662
|
}
|
|
8816
7663
|
for (const ref of refs) {
|
|
8817
|
-
const absolutePath =
|
|
8818
|
-
if (!
|
|
7664
|
+
const absolutePath = resolve3(ref.value);
|
|
7665
|
+
if (!existsSync(absolutePath)) {
|
|
8819
7666
|
throw new DeeplineError(
|
|
8820
7667
|
`Input ${ref.inputPath} references a local file that does not exist: ${ref.value} (resolved to ${absolutePath}). No run was created.`,
|
|
8821
7668
|
void 0,
|
|
@@ -8851,7 +7698,7 @@ function preflightLocalFileInputs(runtimeInput) {
|
|
|
8851
7698
|
function preflightCsvDataInput(ref, absolutePath) {
|
|
8852
7699
|
let content;
|
|
8853
7700
|
try {
|
|
8854
|
-
content =
|
|
7701
|
+
content = readFileSync(absolutePath, "utf-8");
|
|
8855
7702
|
} catch (error) {
|
|
8856
7703
|
throw new DeeplineError(
|
|
8857
7704
|
`Input ${ref.inputPath} CSV ${ref.value} is not readable: ${error instanceof Error ? error.message : String(error)}. No run was created.`,
|
|
@@ -8879,10 +7726,10 @@ async function stageFileInputArgs(input) {
|
|
|
8879
7726
|
codec: NODE_STAGED_FILE_CODEC,
|
|
8880
7727
|
resolveLocalFile: (value) => {
|
|
8881
7728
|
if (!isLocalFilePathValue(value)) return null;
|
|
8882
|
-
const absolutePath =
|
|
7729
|
+
const absolutePath = resolve3(value);
|
|
8883
7730
|
return {
|
|
8884
7731
|
logicalPath: basename(absolutePath),
|
|
8885
|
-
read: async () =>
|
|
7732
|
+
read: async () => readFileSync(absolutePath)
|
|
8886
7733
|
};
|
|
8887
7734
|
},
|
|
8888
7735
|
onStaging: (fileCount) => input.progress.phase(
|
|
@@ -8891,7 +7738,7 @@ async function stageFileInputArgs(input) {
|
|
|
8891
7738
|
});
|
|
8892
7739
|
}
|
|
8893
7740
|
function stageFile(logicalPath, absolutePath) {
|
|
8894
|
-
const buffer =
|
|
7741
|
+
const buffer = readFileSync(absolutePath);
|
|
8895
7742
|
return {
|
|
8896
7743
|
logicalPath,
|
|
8897
7744
|
contentBase64: buffer.toString("base64"),
|
|
@@ -8902,9 +7749,9 @@ function stageFile(logicalPath, absolutePath) {
|
|
|
8902
7749
|
}
|
|
8903
7750
|
function normalizePlayPath(filePath) {
|
|
8904
7751
|
try {
|
|
8905
|
-
return realpathSync.native(
|
|
7752
|
+
return realpathSync.native(resolve3(filePath));
|
|
8906
7753
|
} catch {
|
|
8907
|
-
return
|
|
7754
|
+
return resolve3(filePath);
|
|
8908
7755
|
}
|
|
8909
7756
|
}
|
|
8910
7757
|
var PlayBundleGraphError = class extends Error {
|
|
@@ -12277,7 +11124,7 @@ async function resolvePlayRunOutputStatus(input) {
|
|
|
12277
11124
|
}
|
|
12278
11125
|
var RUN_EXPORT_PAGE_SIZE = 5e3;
|
|
12279
11126
|
function runExportRetryCommand(runId, outPath, datasetPath, options = {}) {
|
|
12280
|
-
return `deepline runs export ${runId}${datasetPath ? ` --dataset ${shellQuote(datasetPath)}` : ""} --out ${shellQuote(
|
|
11127
|
+
return `deepline runs export ${runId}${datasetPath ? ` --dataset ${shellQuote(datasetPath)}` : ""} --out ${shellQuote(resolve3(outPath))}${options.format === "json" ? " --format json" : ""}${options.summary ? ` --summary ${options.summary}` : ""}`;
|
|
12281
11128
|
}
|
|
12282
11129
|
function extractRunPlayName(status) {
|
|
12283
11130
|
const run = status.run;
|
|
@@ -12373,7 +11220,8 @@ async function fetchBackingDatasetRows(input) {
|
|
|
12373
11220
|
runId: input.status.runId,
|
|
12374
11221
|
limit: RUN_EXPORT_PAGE_SIZE,
|
|
12375
11222
|
offset,
|
|
12376
|
-
rowMode: "all"
|
|
11223
|
+
rowMode: "all",
|
|
11224
|
+
...input.summary === "counts" ? { summary: input.summary } : {}
|
|
12377
11225
|
});
|
|
12378
11226
|
for (const row of page.rows) {
|
|
12379
11227
|
const key = readRecord(getRecordField(row, "data")) ? getStringField(row, "key") : null;
|
|
@@ -12507,7 +11355,7 @@ function assertDatasetHasExportableRows(input) {
|
|
|
12507
11355
|
input.status.runId,
|
|
12508
11356
|
input.outPath ?? "output.csv",
|
|
12509
11357
|
datasetLabel,
|
|
12510
|
-
|
|
11358
|
+
{ format: input.format, summary: input.summary }
|
|
12511
11359
|
);
|
|
12512
11360
|
const currentTableQueryCommand2 = input.rowsInfo.currentTableQueryCommand;
|
|
12513
11361
|
if (!TERMINAL_PLAY_STATUSES.has(input.status.status)) {
|
|
@@ -12678,7 +11526,8 @@ ${commands.join("\n")}`,
|
|
|
12678
11526
|
client,
|
|
12679
11527
|
status,
|
|
12680
11528
|
rowsInfo,
|
|
12681
|
-
retryCommand
|
|
11529
|
+
retryCommand,
|
|
11530
|
+
summary: options.summary
|
|
12682
11531
|
});
|
|
12683
11532
|
} catch (error) {
|
|
12684
11533
|
if (error instanceof DeeplineError && (error.code === "RUN_EXPORT_SCOPE_MISMATCH" || error.code === "RUN_EXPORT_NOT_READY")) {
|
|
@@ -12696,7 +11545,8 @@ ${commands.join("\n")}`,
|
|
|
12696
11545
|
datasetPath: options.datasetPath,
|
|
12697
11546
|
allowEmpty: options.allowEmpty,
|
|
12698
11547
|
outPath,
|
|
12699
|
-
format: options.format
|
|
11548
|
+
format: options.format,
|
|
11549
|
+
summary: options.summary
|
|
12700
11550
|
});
|
|
12701
11551
|
return writeExport(guarded2);
|
|
12702
11552
|
}
|
|
@@ -12708,7 +11558,8 @@ ${commands.join("\n")}`,
|
|
|
12708
11558
|
datasetPath: options.datasetPath,
|
|
12709
11559
|
allowEmpty: options.allowEmpty,
|
|
12710
11560
|
outPath,
|
|
12711
|
-
format: options.format
|
|
11561
|
+
format: options.format,
|
|
11562
|
+
summary: options.summary
|
|
12712
11563
|
});
|
|
12713
11564
|
return writeExport(guarded2);
|
|
12714
11565
|
}
|
|
@@ -12742,7 +11593,8 @@ ${commands.join("\n")}`,
|
|
|
12742
11593
|
datasetPath: options.datasetPath,
|
|
12743
11594
|
allowEmpty: options.allowEmpty,
|
|
12744
11595
|
outPath,
|
|
12745
|
-
format: options.format
|
|
11596
|
+
format: options.format,
|
|
11597
|
+
summary: options.summary
|
|
12746
11598
|
});
|
|
12747
11599
|
return writeExport(guarded);
|
|
12748
11600
|
}
|
|
@@ -12783,9 +11635,7 @@ function formatActiveRunConflictError(input) {
|
|
|
12783
11635
|
lines.push(` get: deepline runs get ${runId}`);
|
|
12784
11636
|
lines.push(` stop: deepline runs stop ${runId} --reason "stale lock"`);
|
|
12785
11637
|
}
|
|
12786
|
-
lines.push(
|
|
12787
|
-
` rerun: start another run with the same deepline plays run command`
|
|
12788
|
-
);
|
|
11638
|
+
lines.push(` rerun: run the same deepline run command again`);
|
|
12789
11639
|
return lines.join("\n");
|
|
12790
11640
|
}
|
|
12791
11641
|
var PLAY_SYNTAX_MIGRATION_ERROR_MARKERS = [
|
|
@@ -13379,14 +12229,14 @@ function printBundledRuntimeWarning(bundle) {
|
|
|
13379
12229
|
}
|
|
13380
12230
|
async function handlePlayCheck(args) {
|
|
13381
12231
|
const options = parsePlayCheckOptions(args);
|
|
13382
|
-
if (!
|
|
12232
|
+
if (!isFileTarget(options.target)) {
|
|
13383
12233
|
const client = new DeeplineClient();
|
|
13384
12234
|
try {
|
|
13385
12235
|
await assertCanonicalNamedPlayReference(client, options.target, {
|
|
13386
12236
|
command: "check"
|
|
13387
12237
|
});
|
|
13388
12238
|
const play = await client.describePlay(
|
|
13389
|
-
|
|
12239
|
+
parseReferencedPlayTarget(options.target).playName,
|
|
13390
12240
|
{ compact: true, pipeline: options.full }
|
|
13391
12241
|
);
|
|
13392
12242
|
const result = {
|
|
@@ -13416,7 +12266,7 @@ async function handlePlayCheck(args) {
|
|
|
13416
12266
|
});
|
|
13417
12267
|
return 0;
|
|
13418
12268
|
} catch (error) {
|
|
13419
|
-
const resolved =
|
|
12269
|
+
const resolved = resolve3(options.target);
|
|
13420
12270
|
const message = error instanceof Error && error.message ? error.message : `File not found: ${resolved}`;
|
|
13421
12271
|
if (options.jsonOutput) {
|
|
13422
12272
|
printCommandEnvelope(
|
|
@@ -13437,8 +12287,8 @@ async function handlePlayCheck(args) {
|
|
|
13437
12287
|
return 1;
|
|
13438
12288
|
}
|
|
13439
12289
|
}
|
|
13440
|
-
const absolutePlayPath =
|
|
13441
|
-
const sourceCode =
|
|
12290
|
+
const absolutePlayPath = resolve3(options.target);
|
|
12291
|
+
const sourceCode = readFileSync(absolutePlayPath, "utf-8");
|
|
13442
12292
|
const exportNames = resolvePlayCheckExportNames(sourceCode);
|
|
13443
12293
|
const outcomes = [];
|
|
13444
12294
|
for (const exportName of exportNames) {
|
|
@@ -13573,12 +12423,12 @@ async function handleFileBackedRun(options, hooks) {
|
|
|
13573
12423
|
process.argv.slice(2)
|
|
13574
12424
|
);
|
|
13575
12425
|
const progress = getActiveCliProgress() ?? createCliProgress(!options.jsonOutput);
|
|
13576
|
-
const absolutePlayPath =
|
|
12426
|
+
const absolutePlayPath = resolve3(options.target.path);
|
|
13577
12427
|
progress.phase("compiling play");
|
|
13578
12428
|
const sourceCode = traceCliSync(
|
|
13579
12429
|
"cli.play_file_read_source",
|
|
13580
12430
|
{ targetKind: "file" },
|
|
13581
|
-
() =>
|
|
12431
|
+
() => readFileSync(absolutePlayPath, "utf-8")
|
|
13582
12432
|
);
|
|
13583
12433
|
const runtimeInput = options.input ? { ...options.input } : {};
|
|
13584
12434
|
try {
|
|
@@ -13767,6 +12617,10 @@ async function handleFileBackedRun(options, hooks) {
|
|
|
13767
12617
|
options
|
|
13768
12618
|
);
|
|
13769
12619
|
hooks?.onTerminalStatus?.(outputStatus);
|
|
12620
|
+
if (hooks?.writeResult) {
|
|
12621
|
+
await hooks.writeResult(client, outputStatus);
|
|
12622
|
+
return outputStatus.status === "completed" ? 0 : 1;
|
|
12623
|
+
}
|
|
13770
12624
|
traceCliSync(
|
|
13771
12625
|
"cli.play_write_result",
|
|
13772
12626
|
{ targetKind: "file", playName },
|
|
@@ -13791,6 +12645,10 @@ async function handleFileBackedRun(options, hooks) {
|
|
|
13791
12645
|
openPlayDashboard(resolvedDashboardUrl, options.open);
|
|
13792
12646
|
progress.phase("started run");
|
|
13793
12647
|
progress.complete();
|
|
12648
|
+
if (hooks?.writeStarted) {
|
|
12649
|
+
hooks.writeStarted(started.workflowId, started.status ?? "started");
|
|
12650
|
+
return 0;
|
|
12651
|
+
}
|
|
13794
12652
|
writeStartedPlayRun({
|
|
13795
12653
|
runId: started.workflowId,
|
|
13796
12654
|
playName,
|
|
@@ -13981,6 +12839,10 @@ async function handleNamedRun(options, hooks) {
|
|
|
13981
12839
|
finalStatus.revisionId ?? selectedRevisionId
|
|
13982
12840
|
);
|
|
13983
12841
|
hooks?.onTerminalStatus?.(outputStatus);
|
|
12842
|
+
if (hooks?.writeResult) {
|
|
12843
|
+
await hooks.writeResult(client, outputStatus);
|
|
12844
|
+
return outputStatus.status === "completed" ? 0 : 1;
|
|
12845
|
+
}
|
|
13984
12846
|
traceCliSync(
|
|
13985
12847
|
"cli.play_write_result",
|
|
13986
12848
|
{ targetKind: "name", playName },
|
|
@@ -14007,6 +12869,10 @@ async function handleNamedRun(options, hooks) {
|
|
|
14007
12869
|
openPlayDashboard(resolvedDashboardUrl, options.open);
|
|
14008
12870
|
progress.phase("started run");
|
|
14009
12871
|
progress.complete();
|
|
12872
|
+
if (hooks?.writeStarted) {
|
|
12873
|
+
hooks.writeStarted(started.workflowId, started.status ?? "started");
|
|
12874
|
+
return 0;
|
|
12875
|
+
}
|
|
14010
12876
|
writeStartedPlayRun({
|
|
14011
12877
|
runId: started.workflowId,
|
|
14012
12878
|
playName: started.name ?? playName,
|
|
@@ -14023,11 +12889,119 @@ async function handleNamedRun(options, hooks) {
|
|
|
14023
12889
|
});
|
|
14024
12890
|
return 0;
|
|
14025
12891
|
}
|
|
12892
|
+
async function writePlayRunReceipt(client, status, output) {
|
|
12893
|
+
const terminal = TERMINAL_PLAY_STATUSES.has(status.status);
|
|
12894
|
+
const compact = compactPlayStatus(status);
|
|
12895
|
+
const errors = Array.isArray(compact.errors) ? compact.errors : [];
|
|
12896
|
+
const error = status.status === "failed" ? errors[0] ?? {
|
|
12897
|
+
message: compact.error ?? status.progress?.error ?? "Play failed. Inspect the run for details."
|
|
12898
|
+
} : null;
|
|
12899
|
+
const next = { status: `deepline runs get ${status.runId}` };
|
|
12900
|
+
const playName = /^play\/(.+)\/run\//.exec(status.runId)?.[1] ?? extractRunPlayName(status) ?? null;
|
|
12901
|
+
if (!terminal) {
|
|
12902
|
+
writeExecutionOutput(
|
|
12903
|
+
{ id: status.runId, status: status.status, next },
|
|
12904
|
+
output
|
|
12905
|
+
);
|
|
12906
|
+
return;
|
|
12907
|
+
}
|
|
12908
|
+
const catalog = Run.open({
|
|
12909
|
+
runPackage: status,
|
|
12910
|
+
datasets: LegacyRunDatasetCatalogAdapter.datasets(status)
|
|
12911
|
+
}).datasets();
|
|
12912
|
+
const datasets = catalog.returned().length ? catalog.returned() : catalog.recovered();
|
|
12913
|
+
const collections = [];
|
|
12914
|
+
const byId = /* @__PURE__ */ new Map();
|
|
12915
|
+
for (const dataset of datasets) {
|
|
12916
|
+
let info = dataset.info();
|
|
12917
|
+
try {
|
|
12918
|
+
info = await fetchBackingDatasetRows({
|
|
12919
|
+
client,
|
|
12920
|
+
status,
|
|
12921
|
+
rowsInfo: info,
|
|
12922
|
+
retryCommand: `deepline runs export ${status.runId}`
|
|
12923
|
+
}) ?? info;
|
|
12924
|
+
} catch (fetchError) {
|
|
12925
|
+
if (!info.complete || info.currentTable || fetchError instanceof DeeplineError && fetchError.code === "RUN_EXPORT_SCOPE_MISMATCH")
|
|
12926
|
+
throw fetchError;
|
|
12927
|
+
}
|
|
12928
|
+
if (!info.complete)
|
|
12929
|
+
throw new DeeplineError(
|
|
12930
|
+
`Dataset ${dataset.source} is incomplete. Export it with deepline runs export ${status.runId}; do not restart the run.`,
|
|
12931
|
+
void 0,
|
|
12932
|
+
"RUN_EXPORT_NOT_READY"
|
|
12933
|
+
);
|
|
12934
|
+
const collection = {
|
|
12935
|
+
source: dataset.source ?? "",
|
|
12936
|
+
...info.name ? { name: info.name } : {},
|
|
12937
|
+
rows: info.rows,
|
|
12938
|
+
columns: info.columns,
|
|
12939
|
+
complete: !info.currentTable,
|
|
12940
|
+
...info.exportedRowOutcomes ? { outcomes: info.exportedRowOutcomes } : {}
|
|
12941
|
+
};
|
|
12942
|
+
collections.push(collection);
|
|
12943
|
+
if (dataset.datasetId) byId.set(dataset.datasetId, collection);
|
|
12944
|
+
}
|
|
12945
|
+
const bySource = new Map(
|
|
12946
|
+
collections.map((collection) => [collection.source, collection])
|
|
12947
|
+
);
|
|
12948
|
+
const replaced = /* @__PURE__ */ new Set();
|
|
12949
|
+
const materialize = (value, source = "result") => {
|
|
12950
|
+
const handle = readRecord(value);
|
|
12951
|
+
if (!handle) return value;
|
|
12952
|
+
const collection = typeof handle.datasetId === "string" ? byId.get(handle.datasetId) : bySource.get(source);
|
|
12953
|
+
if (handle.kind === "dataset" && collection) {
|
|
12954
|
+
replaced.add(collection);
|
|
12955
|
+
return collection.rows;
|
|
12956
|
+
}
|
|
12957
|
+
return Object.fromEntries(
|
|
12958
|
+
Object.entries(handle).filter(([key]) => source !== "result" || key !== "_metadata").map(([key, child]) => [key, materialize(child, `${source}.${key}`)])
|
|
12959
|
+
);
|
|
12960
|
+
};
|
|
12961
|
+
const packagedOutputs = readRecord(getPlayRunPackage(status)?.outputs);
|
|
12962
|
+
const returned = status.result !== void 0 ? status.result : packagedOutputs ? Object.fromEntries(
|
|
12963
|
+
Object.entries(packagedOutputs).map(([key, value]) => [
|
|
12964
|
+
key,
|
|
12965
|
+
readRecord(value)?.kind === "value" ? readRecord(value)?.value : value
|
|
12966
|
+
])
|
|
12967
|
+
) : null;
|
|
12968
|
+
let data = materialize(returned);
|
|
12969
|
+
const recovered = collections.filter((c) => !replaced.has(c));
|
|
12970
|
+
if (recovered.length) {
|
|
12971
|
+
data = {
|
|
12972
|
+
result: data,
|
|
12973
|
+
datasets: Object.fromEntries(recovered.map((c) => [c.source, c.rows]))
|
|
12974
|
+
};
|
|
12975
|
+
}
|
|
12976
|
+
const byRows = new Map(collections.map((c) => [c.rows, c]));
|
|
12977
|
+
const allCollections = outputCollections(data).map(
|
|
12978
|
+
(collection) => byRows.get(collection.rows) ?? collection
|
|
12979
|
+
);
|
|
12980
|
+
writeExecutionOutput(
|
|
12981
|
+
{
|
|
12982
|
+
id: status.runId,
|
|
12983
|
+
status: status.status,
|
|
12984
|
+
data,
|
|
12985
|
+
...allCollections.length ? { collections: allCollections } : {},
|
|
12986
|
+
complete: allCollections.every((c) => c.complete === true) ? true : allCollections.some((c) => c.complete === false) ? false : null,
|
|
12987
|
+
error,
|
|
12988
|
+
credits: status.billingTotalCreditsRollup ?? status.billing?.totalCredits ?? null,
|
|
12989
|
+
...playName ? { page: buildPlayDashboardUrl(client.baseUrl, playName) } : {},
|
|
12990
|
+
warnings: [
|
|
12991
|
+
...buildRunWarnings(status, null),
|
|
12992
|
+
...status.status === "completed" && collections.length && collections.every((collection) => collection.rows.length === 0) ? ["Run completed with 0 output rows."] : []
|
|
12993
|
+
],
|
|
12994
|
+
next
|
|
12995
|
+
},
|
|
12996
|
+
output
|
|
12997
|
+
);
|
|
12998
|
+
}
|
|
12999
|
+
var TOOL_EXECUTION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
14026
13000
|
async function handlePlayRun(args, hooks) {
|
|
14027
13001
|
const parsedOptions = Array.isArray(args) ? parsePlayRunOptions(args) : args;
|
|
14028
13002
|
const options = parsedOptions.runIdFile ? {
|
|
14029
13003
|
...parsedOptions,
|
|
14030
|
-
runIdFile: parsedOptions.dryRun ?
|
|
13004
|
+
runIdFile: parsedOptions.dryRun ? resolve3(parsedOptions.runIdFile) : await preflightRunIdFile(parsedOptions.runIdFile)
|
|
14031
13005
|
} : parsedOptions;
|
|
14032
13006
|
const runHooks = options.runIdFile ? {
|
|
14033
13007
|
...hooks,
|
|
@@ -14081,13 +13055,13 @@ async function handlePlayRun(args, hooks) {
|
|
|
14081
13055
|
}
|
|
14082
13056
|
} : hooks;
|
|
14083
13057
|
if (options.target.kind === "file") {
|
|
14084
|
-
if (
|
|
13058
|
+
if (isFileTarget(options.target.path)) {
|
|
14085
13059
|
return handleFileBackedRun(options, runHooks);
|
|
14086
13060
|
}
|
|
14087
|
-
const resolved =
|
|
13061
|
+
const resolved = resolve3(options.target.path);
|
|
14088
13062
|
console.error(`File not found: ${resolved}`);
|
|
14089
13063
|
const dir = dirname2(resolved);
|
|
14090
|
-
if (
|
|
13064
|
+
if (existsSync(dir)) {
|
|
14091
13065
|
const base = basename(resolved);
|
|
14092
13066
|
try {
|
|
14093
13067
|
const siblings = readdirSync(dir).filter(
|
|
@@ -14116,7 +13090,7 @@ function parseRunIdPositional(args, usage2) {
|
|
|
14116
13090
|
continue;
|
|
14117
13091
|
}
|
|
14118
13092
|
if (arg.startsWith("--log-level=")) continue;
|
|
14119
|
-
if ((arg === "--out" || arg === "--format" || arg === "--metadata-out" || arg === "--reason" || arg === "--dataset" || arg === "--idempotency-key") && args[index + 1]) {
|
|
13093
|
+
if ((arg === "--out" || arg === "--format" || arg === "--summary" || arg === "--metadata-out" || arg === "--reason" || arg === "--dataset" || arg === "--idempotency-key") && args[index + 1]) {
|
|
14120
13094
|
index += 1;
|
|
14121
13095
|
continue;
|
|
14122
13096
|
}
|
|
@@ -14943,11 +13917,11 @@ async function handleRunLogs(args) {
|
|
|
14943
13917
|
continue;
|
|
14944
13918
|
}
|
|
14945
13919
|
if (arg === "--limit" && args[index + 1]) {
|
|
14946
|
-
limit =
|
|
13920
|
+
limit = parsePositiveInteger(args[++index], "--limit");
|
|
14947
13921
|
continue;
|
|
14948
13922
|
}
|
|
14949
13923
|
if (arg === "--out" && args[index + 1]) {
|
|
14950
|
-
outPath =
|
|
13924
|
+
outPath = resolve3(args[++index]);
|
|
14951
13925
|
continue;
|
|
14952
13926
|
}
|
|
14953
13927
|
if (arg === "--cursor" && args[index + 1]) {
|
|
@@ -14982,7 +13956,7 @@ async function handleRunLogs(args) {
|
|
|
14982
13956
|
if (outPath) {
|
|
14983
13957
|
const result2 = await client.runs.logs(runId, { all: true });
|
|
14984
13958
|
const logs = result2.entries.filter((line) => logLevelReaches(classifyLogLine(line).level, logLevel)).map((line) => classifyLogLine(line).line);
|
|
14985
|
-
|
|
13959
|
+
writeFileSync2(outPath, `${logs.join("\n")}${logs.length > 0 ? "\n" : ""}`);
|
|
14986
13960
|
printCommandEnvelope(
|
|
14987
13961
|
{
|
|
14988
13962
|
runId: result2.runId,
|
|
@@ -15450,7 +14424,7 @@ async function handleRunStopAll(args) {
|
|
|
15450
14424
|
async function handleRunExport(args) {
|
|
15451
14425
|
const selection = parseJsonFields(args, "export");
|
|
15452
14426
|
args = selection.args;
|
|
15453
|
-
const usage2 = "Usage: deepline runs export <run-id> [--dataset result.rows] --out <path> [--format csv|json] [--wait] [--timeout-ms 300000] [--metadata-out export.json] [--allow-empty] [--json]";
|
|
14427
|
+
const usage2 = "Usage: deepline runs export <run-id> [--dataset result.rows] --out <path> [--format csv|json] [--summary full|counts] [--wait] [--timeout-ms 300000] [--metadata-out export.json] [--allow-empty] [--json]";
|
|
15454
14428
|
let runId;
|
|
15455
14429
|
try {
|
|
15456
14430
|
runId = parseRunIdPositional(args, usage2);
|
|
@@ -15462,12 +14436,13 @@ async function handleRunExport(args) {
|
|
|
15462
14436
|
let datasetPath = null;
|
|
15463
14437
|
let metadataOutPath = null;
|
|
15464
14438
|
let format = "csv";
|
|
14439
|
+
let summary;
|
|
15465
14440
|
const wait = args.includes("--wait");
|
|
15466
14441
|
let waitTimeoutMs = 3e5;
|
|
15467
14442
|
for (let index = 0; index < args.length; index += 1) {
|
|
15468
14443
|
const arg = args[index];
|
|
15469
14444
|
if (arg === "--out" && args[index + 1]) {
|
|
15470
|
-
outPath =
|
|
14445
|
+
outPath = resolve3(args[++index]);
|
|
15471
14446
|
continue;
|
|
15472
14447
|
}
|
|
15473
14448
|
if (arg === "--dataset" && args[index + 1]) {
|
|
@@ -15475,11 +14450,22 @@ async function handleRunExport(args) {
|
|
|
15475
14450
|
continue;
|
|
15476
14451
|
}
|
|
15477
14452
|
if (arg === "--metadata-out" && args[index + 1]) {
|
|
15478
|
-
metadataOutPath =
|
|
14453
|
+
metadataOutPath = resolve3(args[++index]);
|
|
15479
14454
|
}
|
|
15480
14455
|
if (arg === "--format") format = args[++index] ?? "";
|
|
14456
|
+
if (arg === "--summary") {
|
|
14457
|
+
const value = args[++index];
|
|
14458
|
+
if (value !== "full" && value !== "counts") {
|
|
14459
|
+
throw new DeeplineError(
|
|
14460
|
+
"Invalid --summary. Choose full or counts.",
|
|
14461
|
+
void 0,
|
|
14462
|
+
"INVALID_ARGUMENT"
|
|
14463
|
+
);
|
|
14464
|
+
}
|
|
14465
|
+
summary = value;
|
|
14466
|
+
}
|
|
15481
14467
|
if (arg === "--timeout-ms") {
|
|
15482
|
-
waitTimeoutMs =
|
|
14468
|
+
waitTimeoutMs = parsePositiveInteger(args[++index] ?? "", arg);
|
|
15483
14469
|
if (!wait) {
|
|
15484
14470
|
throw new DeeplineError(
|
|
15485
14471
|
"--timeout-ms requires --wait.",
|
|
@@ -15540,7 +14526,8 @@ async function handleRunExport(args) {
|
|
|
15540
14526
|
const exportResult = await exportPlayStatusRows(client, status, outPath, {
|
|
15541
14527
|
datasetPath,
|
|
15542
14528
|
allowEmpty: args.includes("--allow-empty"),
|
|
15543
|
-
format
|
|
14529
|
+
format,
|
|
14530
|
+
summary
|
|
15544
14531
|
});
|
|
15545
14532
|
const source = exportResult?.rowsInfo.source ?? datasetPath ?? null;
|
|
15546
14533
|
const currentTableNotice = exportResult?.currentTable ? {
|
|
@@ -15558,7 +14545,7 @@ async function handleRunExport(args) {
|
|
|
15558
14545
|
status.runId,
|
|
15559
14546
|
outPath,
|
|
15560
14547
|
unambiguousName ?? datasetPath ?? exportResult?.datasetPath,
|
|
15561
|
-
{ format }
|
|
14548
|
+
{ format, summary }
|
|
15562
14549
|
) + (args.includes("--allow-empty") ? " --allow-empty" : "");
|
|
15563
14550
|
const fileLocation = format === "json" ? { json_path: exportResult?.path ?? null } : { csv_path: exportResult?.path ?? null };
|
|
15564
14551
|
const exportedRowOutcomes = exportResult?.rowsInfo.exportedRowOutcomes;
|
|
@@ -15611,7 +14598,7 @@ async function handleRunExport(args) {
|
|
|
15611
14598
|
payload.actions
|
|
15612
14599
|
);
|
|
15613
14600
|
if (metadataOutPath) {
|
|
15614
|
-
|
|
14601
|
+
writeFileSync2(
|
|
15615
14602
|
metadataOutPath,
|
|
15616
14603
|
`${JSON.stringify(payload, null, 2)}
|
|
15617
14604
|
`,
|
|
@@ -15675,7 +14662,7 @@ async function handlePlayGet(args) {
|
|
|
15675
14662
|
for (let index = 1; index < args.length; index += 1) {
|
|
15676
14663
|
const arg = args[index];
|
|
15677
14664
|
if (arg === "--out" && args[index + 1]) {
|
|
15678
|
-
outPath =
|
|
14665
|
+
outPath = resolve3(args[++index]);
|
|
15679
14666
|
}
|
|
15680
14667
|
if (arg === "--revision") {
|
|
15681
14668
|
const rawVersion = args[++index];
|
|
@@ -15696,9 +14683,9 @@ async function handlePlayGet(args) {
|
|
|
15696
14683
|
);
|
|
15697
14684
|
return 2;
|
|
15698
14685
|
}
|
|
15699
|
-
const playName =
|
|
14686
|
+
const playName = isFileTarget(target) ? extractPlayName(readFileSync(resolve3(target), "utf-8"), resolve3(target)) : parseReferencedPlayTarget(target).playName;
|
|
15700
14687
|
const includeSource = sourceOutput || outPath !== null;
|
|
15701
|
-
const detail =
|
|
14688
|
+
const detail = isFileTarget(target) ? await client.getPlay(
|
|
15702
14689
|
playName,
|
|
15703
14690
|
includeSource ? { source: sourceSelector } : void 0
|
|
15704
14691
|
) : await assertCanonicalNamedPlayReference(client, target, {
|
|
@@ -15814,7 +14801,7 @@ async function handlePlayVersions(args) {
|
|
|
15814
14801
|
command: "versions"
|
|
15815
14802
|
});
|
|
15816
14803
|
const versions = await client.listPlayVersions(
|
|
15817
|
-
|
|
14804
|
+
parseReferencedPlayTarget(playName).playName
|
|
15818
14805
|
);
|
|
15819
14806
|
if (jsonOutput) {
|
|
15820
14807
|
printCompactJson({ versions });
|
|
@@ -15948,7 +14935,7 @@ async function handlePlayList(args) {
|
|
|
15948
14935
|
` cost estimate: ${play.observedCost?.displayText ?? formatPlayCostEstimate(play.costEstimate)}`
|
|
15949
14936
|
);
|
|
15950
14937
|
}
|
|
15951
|
-
lines.push(` run: deepline
|
|
14938
|
+
lines.push(` run: deepline run ${reference}`);
|
|
15952
14939
|
}
|
|
15953
14940
|
if (page.hasMore) {
|
|
15954
14941
|
lines.push("List truncated \u2014 more plays are available.");
|
|
@@ -15980,7 +14967,7 @@ async function handlePlayPin(args, pinned) {
|
|
|
15980
14967
|
);
|
|
15981
14968
|
return 2;
|
|
15982
14969
|
}
|
|
15983
|
-
const parsedTarget =
|
|
14970
|
+
const parsedTarget = parseReferencedPlayTarget(target);
|
|
15984
14971
|
if (parsedTarget.ownerSlug) {
|
|
15985
14972
|
console.error(
|
|
15986
14973
|
`deepline plays ${pinned ? "pin" : "unpin"} accepts an org-owned Play identifier without a namespace. Use "${parsedTarget.unqualifiedPlayName}" instead of "${target}".`
|
|
@@ -16166,12 +15153,12 @@ async function handlePlayDescribe(args) {
|
|
|
16166
15153
|
);
|
|
16167
15154
|
return 2;
|
|
16168
15155
|
}
|
|
16169
|
-
if (
|
|
15156
|
+
if (isFileTarget(playName) || looksLikeFilePath(playName)) {
|
|
16170
15157
|
const message = "Local play files can be checked and run, but describe only supports saved/prebuilt play references.";
|
|
16171
|
-
const definedName =
|
|
15158
|
+
const definedName = isFileTarget(playName) ? (() => {
|
|
16172
15159
|
try {
|
|
16173
15160
|
return extractPlayName(
|
|
16174
|
-
|
|
15161
|
+
readFileSync(resolve3(playName), "utf-8"),
|
|
16175
15162
|
playName
|
|
16176
15163
|
);
|
|
16177
15164
|
} catch {
|
|
@@ -16202,7 +15189,7 @@ async function handlePlayDescribe(args) {
|
|
|
16202
15189
|
command: "describe"
|
|
16203
15190
|
});
|
|
16204
15191
|
const play = await client.describePlay(
|
|
16205
|
-
|
|
15192
|
+
parseReferencedPlayTarget(playName).playName,
|
|
16206
15193
|
{
|
|
16207
15194
|
compact: args.includes("--compact")
|
|
16208
15195
|
}
|
|
@@ -16223,7 +15210,7 @@ async function handlePlaySave(args) {
|
|
|
16223
15210
|
console.error(error instanceof Error ? error.message : String(error));
|
|
16224
15211
|
return 2;
|
|
16225
15212
|
}
|
|
16226
|
-
if (!
|
|
15213
|
+
if (!isFileTarget(options.target)) {
|
|
16227
15214
|
console.error(
|
|
16228
15215
|
"plays save requires a local .play.ts file. Use plays publish <play-name> to promote an existing saved revision."
|
|
16229
15216
|
);
|
|
@@ -16234,7 +15221,7 @@ async function handlePlaySave(args) {
|
|
|
16234
15221
|
graph = await traceCliSpan(
|
|
16235
15222
|
"cli.play_save_bundle_graph",
|
|
16236
15223
|
{ targetKind: "file" },
|
|
16237
|
-
() => collectBundledPlayGraph(
|
|
15224
|
+
() => collectBundledPlayGraph(resolve3(options.target))
|
|
16238
15225
|
);
|
|
16239
15226
|
assertPlayGraphAuthoring(graph);
|
|
16240
15227
|
} catch (error) {
|
|
@@ -16347,7 +15334,7 @@ async function handlePlayPublish(args) {
|
|
|
16347
15334
|
const { target: playName, useLatest } = options;
|
|
16348
15335
|
let revisionId = options.revisionId;
|
|
16349
15336
|
const client = new DeeplineClient();
|
|
16350
|
-
if (
|
|
15337
|
+
if (isFileTarget(playName)) {
|
|
16351
15338
|
if (revisionId || useLatest) {
|
|
16352
15339
|
console.error(
|
|
16353
15340
|
"--latest and --revision-id cannot be used when the target is a local play file."
|
|
@@ -16359,7 +15346,7 @@ async function handlePlayPublish(args) {
|
|
|
16359
15346
|
graph = await traceCliSpan(
|
|
16360
15347
|
"cli.play_publish_bundle_graph",
|
|
16361
15348
|
{ targetKind: "file" },
|
|
16362
|
-
() => collectBundledPlayGraph(
|
|
15349
|
+
() => collectBundledPlayGraph(resolve3(playName))
|
|
16363
15350
|
);
|
|
16364
15351
|
assertPlayGraphAuthoring(graph);
|
|
16365
15352
|
} catch (error) {
|
|
@@ -16503,7 +15490,7 @@ async function handlePlayPublish(args) {
|
|
|
16503
15490
|
printCompactJson(result2);
|
|
16504
15491
|
return 0;
|
|
16505
15492
|
}
|
|
16506
|
-
const resolvedName =
|
|
15493
|
+
const resolvedName = parseReferencedPlayTarget(playName).playName;
|
|
16507
15494
|
if (useLatest) {
|
|
16508
15495
|
const versions = await client.listPlayVersions(resolvedName);
|
|
16509
15496
|
const latest = versions[0];
|
|
@@ -16551,7 +15538,7 @@ async function handlePlayDelete(args) {
|
|
|
16551
15538
|
);
|
|
16552
15539
|
return 2;
|
|
16553
15540
|
}
|
|
16554
|
-
if (
|
|
15541
|
+
if (isFileTarget(playName) || looksLikeFilePath(playName)) {
|
|
16555
15542
|
console.error(
|
|
16556
15543
|
"Refusing to delete a local file. This command only moves a saved org-owned play to Trash."
|
|
16557
15544
|
);
|
|
@@ -16567,7 +15554,7 @@ async function handlePlayDelete(args) {
|
|
|
16567
15554
|
const client = new DeeplineClient();
|
|
16568
15555
|
let detail;
|
|
16569
15556
|
try {
|
|
16570
|
-
detail = await client.getPlay(
|
|
15557
|
+
detail = await client.getPlay(parseReferencedPlayTarget(playName).playName);
|
|
16571
15558
|
} catch (error) {
|
|
16572
15559
|
console.error(error instanceof Error ? error.message : String(error));
|
|
16573
15560
|
return 5;
|
|
@@ -16578,7 +15565,7 @@ async function handlePlayDelete(args) {
|
|
|
16578
15565
|
);
|
|
16579
15566
|
return 2;
|
|
16580
15567
|
}
|
|
16581
|
-
const resolvedName =
|
|
15568
|
+
const resolvedName = parseReferencedPlayTarget(
|
|
16582
15569
|
formatPlayReference(detail.play)
|
|
16583
15570
|
).playName;
|
|
16584
15571
|
if (args.includes("--dry-run")) {
|
|
@@ -16633,7 +15620,7 @@ async function handlePlayRestore(args) {
|
|
|
16633
15620
|
);
|
|
16634
15621
|
return 2;
|
|
16635
15622
|
}
|
|
16636
|
-
if (
|
|
15623
|
+
if (isFileTarget(playName) || looksLikeFilePath(playName)) {
|
|
16637
15624
|
console.error(
|
|
16638
15625
|
"Refusing to restore a local file. This command only restores a saved org-owned play from Trash."
|
|
16639
15626
|
);
|
|
@@ -16642,7 +15629,7 @@ async function handlePlayRestore(args) {
|
|
|
16642
15629
|
const client = new DeeplineClient();
|
|
16643
15630
|
try {
|
|
16644
15631
|
const result = await client.restorePlay(
|
|
16645
|
-
|
|
15632
|
+
parseReferencedPlayTarget(playName).playName
|
|
16646
15633
|
);
|
|
16647
15634
|
if (argsWantJson(args)) {
|
|
16648
15635
|
printCompactJson(result);
|
|
@@ -16678,9 +15665,10 @@ Concepts:
|
|
|
16678
15665
|
still recover that operation after resume; older authored editions retain
|
|
16679
15666
|
omitted-value behavior.
|
|
16680
15667
|
Completed calls are replay-safe during recovery of the same run; unfinished calls may execute again.
|
|
16681
|
-
A stable id recovers a completed call;
|
|
15668
|
+
A stable id recovers a completed call; each deepline run starts new work.
|
|
16682
15669
|
deepline.dataset adds row keys and row progress.
|
|
16683
|
-
|
|
15670
|
+
A named play runs its live revision; <play>@latest or <play>@<revision-id>
|
|
15671
|
+
runs another.
|
|
16684
15672
|
Installed npm and repo-local CLIs can run saved/prebuilt plays by name or
|
|
16685
15673
|
bundle local .play.ts files for development workflows.
|
|
16686
15674
|
Running a local file does not make it live; use publish or set-live for that.
|
|
@@ -16688,23 +15676,21 @@ Concepts:
|
|
|
16688
15676
|
New Plays start at person; publishing moves them to team, preserving folders.
|
|
16689
15677
|
|
|
16690
15678
|
Run and retrieve results:
|
|
16691
|
-
1.
|
|
16692
|
-
|
|
16693
|
-
2.
|
|
16694
|
-
|
|
16695
|
-
|
|
16696
|
-
3. Read
|
|
16697
|
-
4. Export
|
|
16698
|
-
|
|
16699
|
-
Repeating plays run starts another run; tail does not.
|
|
15679
|
+
1. Find a Play: deepline search "<input you have -> result you need>"
|
|
15680
|
+
Read its input contract: deepline describe <play-name>
|
|
15681
|
+
2. Run it: deepline run workflow.play.ts --input '{"csv":"contacts.csv"}' --csv-out results.csv
|
|
15682
|
+
Use the Play's own input fields. run waits, shows progress on stderr,
|
|
15683
|
+
saves the rows, and prints a receipt with the run id.
|
|
15684
|
+
3. Read it again: deepline runs get <run-id>
|
|
15685
|
+
4. Export another dataset: deepline runs export <run-id> --dataset <returned-selector> --out more.csv
|
|
15686
|
+
After a disconnect, follow the same run with deepline runs tail <run-id>.
|
|
16700
15687
|
|
|
16701
|
-
Input
|
|
16702
|
-
|
|
16703
|
-
--input
|
|
16704
|
-
Input fields belong to the Play contract. --file selects Play source, not data.
|
|
15688
|
+
Input:
|
|
15689
|
+
One JSON object: --input '{"csv":"contacts.csv","limit":5}', or
|
|
15690
|
+
--input-file input.json. Its fields are the Play contract's.
|
|
16705
15691
|
|
|
16706
15692
|
More options:
|
|
16707
|
-
deepline
|
|
15693
|
+
deepline run -h
|
|
16708
15694
|
deepline runs -h
|
|
16709
15695
|
deepline runs export -h
|
|
16710
15696
|
|
|
@@ -16741,7 +15727,7 @@ Common commands:
|
|
|
16741
15727
|
deepline search "name and company domain -> work email" --type prebuilts
|
|
16742
15728
|
deepline describe prebuilt/person-linkedin-to-email
|
|
16743
15729
|
deepline plays check prebuilt/name-and-domain-to-email-waterfall-batch
|
|
16744
|
-
deepline
|
|
15730
|
+
deepline run prebuilt/person-linkedin-to-email --input '{"linkedin_url":"..."}'
|
|
16745
15731
|
deepline plays get prebuilt/person-linkedin-to-email
|
|
16746
15732
|
`
|
|
16747
15733
|
);
|
|
@@ -16753,7 +15739,7 @@ Common commands:
|
|
|
16753
15739
|
).option("--json", "Emit the identity or admission response as JSON").action(
|
|
16754
15740
|
async (path, options) => {
|
|
16755
15741
|
const saved = JSON.parse(
|
|
16756
|
-
await readFileAsync(
|
|
15742
|
+
await readFileAsync(resolve3(path), "utf8")
|
|
16757
15743
|
);
|
|
16758
15744
|
const { callerPlayWorkflowIdMatchesRequest } = await import("./run-identity-MRNCEGV2.mjs");
|
|
16759
15745
|
if (saved.version !== 1 || typeof saved.workflowId !== "string" || typeof saved.orgId !== "string" || typeof saved.baseUrl !== "string" || !saved.request || saved.request.admissionOrgId !== saved.orgId || saved.request.workflowId !== saved.workflowId || !callerPlayWorkflowIdMatchesRequest(
|
|
@@ -16827,7 +15813,7 @@ Examples:
|
|
|
16827
15813
|
...options.full ? ["--full"] : []
|
|
16828
15814
|
]);
|
|
16829
15815
|
});
|
|
16830
|
-
play.command("run [target]").description("Run a named/prebuilt play or local play file.").allowUnknownOption(true).allowExcessArguments(true).addHelpText(
|
|
15816
|
+
play.command("run [target]", { hidden: true }).description("Run a named/prebuilt play or local play file.").allowUnknownOption(true).allowExcessArguments(true).addHelpText(
|
|
16831
15817
|
"after",
|
|
16832
15818
|
`
|
|
16833
15819
|
Play inputs:
|
|
@@ -16892,9 +15878,9 @@ Idempotent execution:
|
|
|
16892
15878
|
.dataset('companies_v1', companies)
|
|
16893
15879
|
.withColumn('cto', (row) => deepline.tools.execute({
|
|
16894
15880
|
id: 'find_cto',
|
|
16895
|
-
tool
|
|
15881
|
+
tool,
|
|
16896
15882
|
staleAfterSeconds: 86400,
|
|
16897
|
-
input: {
|
|
15883
|
+
input: { domain: row.domain },
|
|
16898
15884
|
}))
|
|
16899
15885
|
.run({ key: 'domain' });
|
|
16900
15886
|
|
|
@@ -16902,8 +15888,8 @@ Idempotent execution:
|
|
|
16902
15888
|
|
|
16903
15889
|
await deepline.tools.execute({
|
|
16904
15890
|
id: 'find_cto',
|
|
16905
|
-
tool
|
|
16906
|
-
input: {
|
|
15891
|
+
tool,
|
|
15892
|
+
input: { domain: row.domain },
|
|
16907
15893
|
staleAfterSeconds: 86400,
|
|
16908
15894
|
});
|
|
16909
15895
|
|
|
@@ -17232,12 +16218,12 @@ Examples:
|
|
|
17232
16218
|
);
|
|
17233
16219
|
const name = target || flagText;
|
|
17234
16220
|
const selectsFields = Boolean(target && flagText);
|
|
17235
|
-
const own = !name || options.compact || selectsFields || looksLikeRunId(name) ||
|
|
16221
|
+
const own = !name || options.compact || selectsFields || looksLikeRunId(name) || isFileTarget(name) || looksLikeFilePath(name);
|
|
17236
16222
|
if (own) {
|
|
17237
16223
|
process.exitCode = await ownView();
|
|
17238
16224
|
return;
|
|
17239
16225
|
}
|
|
17240
|
-
const { describeAnything } = await import("./describe-
|
|
16226
|
+
const { describeAnything } = await import("./describe-PNDQB7YS.mjs");
|
|
17241
16227
|
process.exitCode = await describeAnything(
|
|
17242
16228
|
name,
|
|
17243
16229
|
{
|
|
@@ -17261,7 +16247,7 @@ Notes:
|
|
|
17261
16247
|
Examples:
|
|
17262
16248
|
deepline plays versions --name my-play
|
|
17263
16249
|
deepline plays versions --name my-play
|
|
17264
|
-
deepline
|
|
16250
|
+
deepline run my-play@<revision-id>
|
|
17265
16251
|
`
|
|
17266
16252
|
).option("--name <name>", "Saved play name").option("--json", "Emit JSON output").action(async (options) => {
|
|
17267
16253
|
process.exitCode = await handlePlayVersions([
|
|
@@ -17305,7 +16291,7 @@ Notes:
|
|
|
17305
16291
|
and promotes that revision live. Use --expected-artifact with the hash from
|
|
17306
16292
|
plays check to refuse publishing bytes that changed after validation.
|
|
17307
16293
|
--dry-run bundles only and prints the exact artifact that would be published.
|
|
17308
|
-
Running a local file with
|
|
16294
|
+
Running a local file with deepline run leaves it unpublished.
|
|
17309
16295
|
Publishing moves personal locations into Team library, preserving folders.
|
|
17310
16296
|
Change location with: deepline plays settings set --play <play> --name path --value team/Research
|
|
17311
16297
|
|
|
@@ -17432,9 +16418,9 @@ Examples:
|
|
|
17432
16418
|
Concepts:
|
|
17433
16419
|
A run is one execution instance of a play. It has status, progress, logs,
|
|
17434
16420
|
returned result, dataset previews, recovery metadata, and optional dataset export.
|
|
17435
|
-
|
|
17436
|
-
runs watch attaches to
|
|
17437
|
-
|
|
16421
|
+
deepline run starts new work and follows it; --timeout 0 returns at once.
|
|
16422
|
+
runs watch attaches to existing work and follows its progress. Use it after
|
|
16423
|
+
a disconnect or --timeout 0 to reconnect to the same run.
|
|
17438
16424
|
get reads the current overview once. logs fetches persisted log history.
|
|
17439
16425
|
stop requests cancellation. rerun starts new work and may spend credits.
|
|
17440
16426
|
|
|
@@ -17514,7 +16500,7 @@ Examples:
|
|
|
17514
16500
|
]);
|
|
17515
16501
|
});
|
|
17516
16502
|
runs.command("get <runId>").description(
|
|
17517
|
-
"Get
|
|
16503
|
+
"Get a play run, or a tool call deepline run made, by the id its receipt gave."
|
|
17518
16504
|
).addHelpText(
|
|
17519
16505
|
"after",
|
|
17520
16506
|
`
|
|
@@ -17538,10 +16524,15 @@ Notes:
|
|
|
17538
16524
|
dashboardUrl (text: "play page:") links the run's play page; link it in a
|
|
17539
16525
|
final answer. --web-url prints only that URL (with --json: {"dashboardUrl"}).
|
|
17540
16526
|
|
|
16527
|
+
A tool call's id is the key deepline run gave it; runs get prints that
|
|
16528
|
+
call's receipt again, from its saved result, for 24 hours. It takes --json
|
|
16529
|
+
and no other option.
|
|
16530
|
+
|
|
17541
16531
|
Examples:
|
|
17542
16532
|
deepline runs get play/my-play/run/20260501t000000-000
|
|
17543
16533
|
deepline runs get play/my-play/run/20260501t000000-000
|
|
17544
16534
|
deepline runs get play/my-play/run/20260501t000000-000 --web-url
|
|
16535
|
+
deepline runs get 0b8f6a52-4f1e-4f43-9a63-1f0c5d2e8a71
|
|
17545
16536
|
deepline runs logs play/my-play/run/20260501t000000-000 --failed
|
|
17546
16537
|
deepline runs get play/my-play/run/20260501t000000-000 --full
|
|
17547
16538
|
deepline runs get play/my-play/run/20260501t000000-000 --input
|
|
@@ -17565,6 +16556,13 @@ Examples:
|
|
|
17565
16556
|
).addOption(
|
|
17566
16557
|
new Option2("--log-failed", "Attach terminal-failure logs").hideHelp()
|
|
17567
16558
|
).action(async (runId, options) => {
|
|
16559
|
+
if (TOOL_EXECUTION_ID.test(runId)) {
|
|
16560
|
+
const { getToolExecutionReceipt } = await import("./tools-3XNZ4J64.mjs");
|
|
16561
|
+
process.exitCode = await getToolExecutionReceipt(runId, {
|
|
16562
|
+
receiptJson: options.json !== void 0
|
|
16563
|
+
});
|
|
16564
|
+
return;
|
|
16565
|
+
}
|
|
17568
16566
|
process.exitCode = await handleRunGet([
|
|
17569
16567
|
runId,
|
|
17570
16568
|
...jsonFieldArgs(options.json),
|
|
@@ -17617,7 +16615,7 @@ Notes:
|
|
|
17617
16615
|
Common statuses include running, completed, failed, and stopped.
|
|
17618
16616
|
JSON runs[].id is the public ID accepted by runs get, watch, export, and stop.
|
|
17619
16617
|
runId and workflowId are compatibility aliases; temporalRunId is not the public ID.
|
|
17620
|
-
Use the
|
|
16618
|
+
Use the id your run's receipt gave for your execution, not the latest inventory entry.
|
|
17621
16619
|
--timing writes the inventory request duration and periodic long-read updates to stderr.
|
|
17622
16620
|
|
|
17623
16621
|
Examples:
|
|
@@ -17815,6 +16813,9 @@ Notes:
|
|
|
17815
16813
|
final fields without altering the export, use:
|
|
17816
16814
|
deepline csv show --csv output.csv --columns contact_id,email,email_source --format table
|
|
17817
16815
|
--json controls stdout metadata, not the file format.
|
|
16816
|
+
--summary counts keeps exact row counts while skipping column aggregates
|
|
16817
|
+
during retrieval. Every saved row and column is still exported. The default
|
|
16818
|
+
--summary full includes column aggregates.
|
|
17818
16819
|
--metadata-out writes the same export metadata object returned by --json,
|
|
17819
16820
|
including the source dataset path and row/column metadata.
|
|
17820
16821
|
--allow-empty permits a completed dataset with a known zero count and no
|
|
@@ -17832,7 +16833,7 @@ Examples:
|
|
|
17832
16833
|
deepline runs export play/my-play/run/20260501t000000-000 --format json --out rows.json
|
|
17833
16834
|
deepline runs export play/my-play/run/20260501t000000-000 --out rows.csv --wait --timeout-ms 600000
|
|
17834
16835
|
`
|
|
17835
|
-
).requiredOption("--out <path>", "Output file path").option("--format <format>", "File format: csv or json", "csv").option(
|
|
16836
|
+
).requiredOption("--out <path>", "Output file path").option("--format <format>", "File format: csv or json", "csv").option("--summary <mode>", "Row summary: full or counts (default: full)").option(
|
|
17836
16837
|
"--dataset <path>",
|
|
17837
16838
|
"Returned dataset handle path, such as result.rows"
|
|
17838
16839
|
).option("--metadata-out <path>", "Write export metadata JSON to a file").option("--allow-empty", "Allow a completed, healthy zero-row dataset").option(
|
|
@@ -17849,6 +16850,7 @@ Examples:
|
|
|
17849
16850
|
options.out,
|
|
17850
16851
|
"--format",
|
|
17851
16852
|
options.format,
|
|
16853
|
+
...options.summary ? ["--summary", options.summary] : [],
|
|
17852
16854
|
...options.metadataOut ? ["--metadata-out", options.metadataOut] : [],
|
|
17853
16855
|
...options.allowEmpty ? ["--allow-empty"] : [],
|
|
17854
16856
|
...options.wait ? ["--wait"] : [],
|
|
@@ -18018,7 +17020,7 @@ async function handlePlayShareStatus(args) {
|
|
|
18018
17020
|
console.error("Usage: deepline plays share status <play> [--json]");
|
|
18019
17021
|
return 2;
|
|
18020
17022
|
}
|
|
18021
|
-
const name =
|
|
17023
|
+
const name = parseReferencedPlayTarget(target).playName;
|
|
18022
17024
|
const status = await new DeeplineClient().getSharePage(name);
|
|
18023
17025
|
const outputStatus = shareStatusForOutput(status);
|
|
18024
17026
|
if (argsWantJson(args)) {
|
|
@@ -18060,7 +17062,7 @@ async function handlePlaySharePublish(args) {
|
|
|
18060
17062
|
);
|
|
18061
17063
|
return 2;
|
|
18062
17064
|
}
|
|
18063
|
-
const name =
|
|
17065
|
+
const name = parseReferencedPlayTarget(target).playName;
|
|
18064
17066
|
const client = new DeeplineClient();
|
|
18065
17067
|
let revisionId = shareFlagValue(args, "--revision-id");
|
|
18066
17068
|
let resolvedVersion;
|
|
@@ -18097,11 +17099,11 @@ async function handlePlaySharePublish(args) {
|
|
|
18097
17099
|
ok: false,
|
|
18098
17100
|
code: "NO_SUCCESSFUL_RUN",
|
|
18099
17101
|
message,
|
|
18100
|
-
next: `deepline
|
|
17102
|
+
next: `deepline run ${name}`
|
|
18101
17103
|
});
|
|
18102
17104
|
} else {
|
|
18103
17105
|
console.error(message);
|
|
18104
|
-
console.error(` deepline
|
|
17106
|
+
console.error(` deepline run ${name}`);
|
|
18105
17107
|
}
|
|
18106
17108
|
return 7;
|
|
18107
17109
|
}
|
|
@@ -18152,7 +17154,7 @@ async function handlePlayShareUpdate(args) {
|
|
|
18152
17154
|
);
|
|
18153
17155
|
return 2;
|
|
18154
17156
|
}
|
|
18155
|
-
const name =
|
|
17157
|
+
const name = parseReferencedPlayTarget(target).playName;
|
|
18156
17158
|
const seo = shareFlagValue(args, "--seo");
|
|
18157
17159
|
const seoIndexing = seo === "index" ? "index" : seo === "noindex" ? "noindex" : void 0;
|
|
18158
17160
|
const request = {
|
|
@@ -18176,7 +17178,7 @@ async function handlePlayShareRegenerate(args) {
|
|
|
18176
17178
|
);
|
|
18177
17179
|
return 2;
|
|
18178
17180
|
}
|
|
18179
|
-
const name =
|
|
17181
|
+
const name = parseReferencedPlayTarget(target).playName;
|
|
18180
17182
|
const client = new DeeplineClient();
|
|
18181
17183
|
let revisionId = shareFlagValue(args, "--revision-id");
|
|
18182
17184
|
const versionFlag = shareFlagValue(args, "--version");
|
|
@@ -18219,7 +17221,7 @@ async function handlePlayShareUnpublish(args) {
|
|
|
18219
17221
|
);
|
|
18220
17222
|
return 2;
|
|
18221
17223
|
}
|
|
18222
|
-
const name =
|
|
17224
|
+
const name = parseReferencedPlayTarget(target).playName;
|
|
18223
17225
|
const status = await new DeeplineClient().unpublishSharePage(name);
|
|
18224
17226
|
if (argsWantJson(args)) {
|
|
18225
17227
|
printCompactJson(status);
|
|
@@ -18293,5 +17295,7 @@ export {
|
|
|
18293
17295
|
truncateErrorForDisplay,
|
|
18294
17296
|
waitForPlayCompletionByWatch,
|
|
18295
17297
|
withTerminalPlayIdentity,
|
|
18296
|
-
|
|
17298
|
+
writeInlinePlay,
|
|
17299
|
+
writePlayRunIdFile,
|
|
17300
|
+
writePlayRunReceipt
|
|
18297
17301
|
};
|