deepline 0.3.460 → 0.3.462
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/client-core.ts +7593 -0
- package/dist/bundling-sources/sdk/src/client.ts +8 -7366
- package/dist/bundling-sources/sdk/src/http-core.ts +1239 -0
- package/dist/bundling-sources/sdk/src/http.ts +6 -1231
- package/dist/bundling-sources/sdk/src/index.ts +4 -1
- package/dist/bundling-sources/sdk/src/play.ts +5 -5
- package/dist/bundling-sources/sdk/src/plays/client-core.ts +437 -0
- package/dist/bundling-sources/sdk/src/plays/client.ts +4 -421
- package/dist/bundling-sources/sdk/src/plays/input-example.ts +3 -4
- package/dist/bundling-sources/sdk/src/plays/play-description.ts +1 -1
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -1
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/server.ts +43 -0
- package/dist/bundling-sources/sdk/src/types.ts +15 -5
- package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +15 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +28 -0
- package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +0 -307
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +3 -0
- package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +3 -2
- package/dist/bundling-sources/shared_libs/monitors/package.json +2 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +34 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +59 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +94 -1
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +35 -1
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-failure-codes.ts +24 -0
- package/dist/bundling-sources/shared_libs/observability/dlq.ts +32 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +57 -3
- package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +66 -1
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +36 -7
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +250 -11
- package/dist/bundling-sources/shared_libs/play-runtime/array-input-store.ts +319 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +991 -359
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +110 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +155 -6
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +110 -6
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +127 -13
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +14 -1
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +57 -1
- package/dist/bundling-sources/shared_libs/play-runtime/free-company-lookup-batching.ts +218 -0
- package/dist/bundling-sources/shared_libs/play-runtime/gateway-postgres-admission.ts +42 -5
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-budget-state-backend.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +92 -31
- package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +69 -14
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +93 -23
- package/dist/bundling-sources/shared_libs/play-runtime/governor/in-memory-rate-state-backend.ts +15 -4
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +22 -18
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +190 -14
- package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +131 -0
- package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +77 -2
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +271 -2
- package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +51 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +27 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-text-for-log.ts +63 -0
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts +112 -16
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +104 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +265 -151
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-gateway-transport.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +35 -14
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-labels.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +136 -70
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +237 -36
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +148 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +285 -32
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +251 -56
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +29 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/sandbox-create-outcome.ts +27 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +22 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +1397 -382
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-array-input-receipts.ts +920 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +38 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-flow.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +26 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +30 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +14 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +31 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +20 -7
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +1496 -320
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +31 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1389 -129
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +162 -23
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +499 -115
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +377 -9
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +117 -8
- package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +25 -0
- package/dist/bundling-sources/shared_libs/play-runtime/terminal-runtime-performance.ts +391 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +40 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/mapped-calls.ts +171 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/receipt-cohort.ts +16 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +26 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +16 -2
- package/dist/bundling-sources/shared_libs/play-runtime/transport-error-diagnostics.ts +28 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +55 -5
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +41 -1
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +4 -0
- package/dist/bundling-sources/shared_libs/plays/dataset.ts +9 -3
- package/dist/bundling-sources/shared_libs/plays/deploy/manifest-contract.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +3 -2
- package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +2 -2
- package/dist/bundling-sources/shared_libs/plays/run-output-summary.ts +66 -0
- package/dist/bundling-sources/shared_libs/plays/script-entry.ts +1 -1
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +43 -1
- package/dist/bundling-sources/shared_libs/product-notifications/content.ts +9 -0
- package/dist/bundling-sources/shared_libs/product-notifications/email.ts +91 -13
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +3 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +41 -24
- package/dist/bundling-sources/shared_libs/security/attested-client-ip.ts +91 -0
- package/dist/bundling-sources/shared_libs/security/internal-actor.ts +0 -11
- package/dist/cli/{auth-HKA6ZVHQ.mjs → auth-JDLEY7VU.mjs} +5 -4
- package/dist/cli/auth-UXKY6TCC.js +41 -0
- package/dist/cli/{billing-MTO2ZZ3G.js → billing-HXAXB3XZ.js} +152 -78
- package/dist/cli/{billing-26G44S5N.mjs → billing-SDHLBLMV.mjs} +84 -10
- package/dist/cli/{chunk-BHGII2D6.js → chunk-3ACMRZRV.js} +8 -6
- package/dist/cli/{chunk-S4Q2XCGM.mjs → chunk-3KZCFOZ6.mjs} +1 -1
- package/dist/cli/chunk-4KQ6SIBC.mjs +1038 -0
- package/dist/cli/{chunk-Z2GUFYT6.js → chunk-5LEAXRHV.js} +11 -11
- package/dist/cli/{chunk-XAYO3Q2X.mjs → chunk-6NNVJDVR.mjs} +7 -5
- package/dist/cli/{chunk-NMJ4D2WO.js → chunk-6PMCRYDA.js} +216 -91
- package/dist/cli/{chunk-OMM54B3X.mjs → chunk-6RNQGWFD.mjs} +16 -806
- package/dist/cli/{chunk-EBU7LQ64.js → chunk-6V7KVRR5.js} +3 -3
- package/dist/cli/{chunk-RDPTDDKX.js → chunk-7LFIMWMW.js} +2 -2
- package/dist/cli/chunk-7MJ6VI2T.mjs +19 -0
- package/dist/cli/chunk-7SWNPNML.js +1039 -0
- package/dist/cli/{chunk-CTRPCARW.mjs → chunk-7U3XNPOA.mjs} +267 -38
- package/dist/cli/{chunk-RBTTUYZZ.js → chunk-7VZHXVOQ.js} +1 -1
- package/dist/cli/{chunk-YVBWO647.mjs → chunk-AT636LLU.mjs} +2 -2
- package/dist/cli/{chunk-VTODQWQA.js → chunk-BGTPIMSM.js} +392 -261
- package/dist/cli/{chunk-KADIT5NV.mjs → chunk-CKSOY47X.mjs} +2 -2
- package/dist/cli/{chunk-7DH2FD7Y.mjs → chunk-D464JW3N.mjs} +5 -85
- package/dist/cli/chunk-D6DXOUTO.mjs +827 -0
- package/dist/cli/{describe-QW54QQNB.js → chunk-EM4TXCCI.js} +27 -44
- package/dist/cli/chunk-F6QV42MC.mjs +91 -0
- package/dist/cli/chunk-FKVYR3QA.mjs +1039 -0
- package/dist/cli/{chunk-LMAULZLF.js → chunk-GEGW5HPZ.js} +29 -27
- package/dist/cli/{chunk-M52JQSLK.js → chunk-HUB3CCM2.js} +13 -4
- package/dist/cli/{chunk-YHTQM5XI.js → chunk-I6VHOU5O.js} +27 -27
- package/dist/cli/{chunk-Z2XUZC34.js → chunk-IAYSWZDJ.js} +188 -76
- package/dist/cli/chunk-JF3TLIMQ.js +19 -0
- package/dist/cli/{chunk-HDFRJ4IT.mjs → chunk-JVHOS3K3.mjs} +177 -65
- package/dist/cli/{chunk-LAWEURCT.mjs → chunk-LFXLQEZN.mjs} +1 -1
- package/dist/cli/{chunk-2PBN4SZE.js → chunk-LROWFPGN.js} +16 -16
- package/dist/cli/{chunk-SLEUWLJE.mjs → chunk-MSY22NQW.mjs} +5 -5
- package/dist/cli/{chunk-LVJOFUU7.mjs → chunk-MUUQZIOF.mjs} +23 -49
- package/dist/cli/{chunk-2XHWOQF4.js → chunk-NBLSCHKK.js} +52 -50
- package/dist/cli/{chunk-526R2HON.mjs → chunk-NHRWZPWZ.mjs} +4 -2
- package/dist/cli/{chunk-KXMNM4AQ.js → chunk-NMU3VR5U.js} +4 -5
- package/dist/cli/{chunk-W3BE3CHK.mjs → chunk-O2RX5A66.mjs} +14 -12
- package/dist/cli/{chunk-UKFZT7RF.js → chunk-OMQ23IXL.js} +2 -2
- package/dist/cli/{chunk-LJTFZOHU.js → chunk-OPJAJBD4.js} +28 -54
- package/dist/cli/{chunk-MLFR6DVF.mjs → chunk-PHSEINNH.mjs} +5 -5
- package/dist/cli/{chunk-3DNKFH2G.mjs → chunk-PKHVSIJG.mjs} +19 -1
- package/dist/cli/{chunk-WIYWSYDS.mjs → chunk-Q2EIZKVX.mjs} +3 -3
- package/dist/cli/{chunk-VJAEA4CS.js → chunk-QJZ6WNWD.js} +8 -8
- package/dist/cli/{chunk-EIMG75BT.mjs → chunk-S3A4IXBQ.mjs} +4 -5
- package/dist/cli/{chunk-RZSTT45F.mjs → chunk-S42YIQNE.mjs} +13 -8
- package/dist/cli/{chunk-YULBYKAK.mjs → chunk-S6UAJR6V.mjs} +3 -3
- package/dist/cli/{chunk-G7L27KZB.mjs → chunk-TKAQR3IB.mjs} +31 -21
- package/dist/cli/{chunk-QWRHGGUH.js → chunk-UAJFWWZE.js} +20 -2
- package/dist/cli/{chunk-ZR2RLI4O.mjs → chunk-UDRPEZ5F.mjs} +223 -92
- package/dist/cli/{chunk-QGAWTBIR.js → chunk-ULK7JGGI.js} +511 -282
- package/dist/cli/chunk-V335HGX5.js +1038 -0
- package/dist/cli/{chunk-NH6JSJW6.mjs → chunk-V3MEA7NB.mjs} +7 -5
- package/dist/cli/{chunk-NRGGFVVB.js → chunk-VFGVXXZP.js} +37 -35
- package/dist/cli/chunk-VLEVVDWG.js +91 -0
- package/dist/cli/{chunk-R2GLGLDR.mjs → chunk-VPHN2HAL.mjs} +216 -91
- package/dist/cli/{chunk-CFUTOWE4.js → chunk-WG3KGAII.js} +8 -88
- package/dist/cli/{describe-TOMIAT37.mjs → chunk-WIY6U6GD.mjs} +19 -36
- package/dist/cli/{chunk-YS2YBSJB.js → chunk-XANRM3QA.js} +6 -6
- package/dist/cli/{chunk-KGQNIA37.js → chunk-XQCTG5OO.js} +44 -34
- package/dist/cli/{chunk-EJGBLXDZ.mjs → chunk-XZAFIOUQ.mjs} +1 -1
- package/dist/cli/chunk-Y4DPU4OM.js +827 -0
- package/dist/cli/chunk-YT5EODJO.js +920 -0
- package/dist/cli/{chunk-2WRO2UJ5.js → chunk-ZGQSFYD2.js} +56 -51
- package/dist/cli/{chunk-OJ6RUKVT.mjs → chunk-ZUK6LIJB.mjs} +10 -1
- package/dist/cli/command-docs.d.mts +5 -0
- package/dist/cli/command-docs.d.ts +5 -0
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-6FNFYJUC.js → csv-C56GSCEU.js} +13 -12
- package/dist/cli/{csv-MDHT4BKK.mjs → csv-L54JS7TF.mjs} +4 -3
- package/dist/cli/{db-D6AMVOEW.js → db-MOGRMZTA.js} +30 -27
- package/dist/cli/{db-74O3RFWY.mjs → db-YVBUW2DX.mjs} +10 -7
- package/dist/cli/describe-KYEULWPG.js +48 -0
- package/dist/cli/describe-NLZKKT7C.mjs +48 -0
- package/dist/cli/describe-core.d.mts +153 -5
- package/dist/cli/describe-core.d.ts +153 -5
- package/dist/cli/describe-core.js +9 -5
- package/dist/cli/describe-core.mjs +10 -6
- package/dist/cli/{executions-N4FMGVSC.js → executions-A7L4ULPP.js} +9 -7
- package/dist/cli/{executions-PVSF4HUF.mjs → executions-ZBGSTT37.mjs} +7 -5
- package/dist/cli/{feedback-OB7NANZW.mjs → feedback-G6GU37FD.mjs} +6 -5
- package/dist/cli/{feedback-WFSPCAI2.js → feedback-OHLY7RYD.js} +10 -9
- package/dist/cli/getting-started.d.mts +6 -6
- package/dist/cli/getting-started.d.ts +6 -6
- package/dist/cli/getting-started.js +2 -2
- package/dist/cli/getting-started.mjs +1 -1
- package/dist/cli/git-P76N4NDQ.js +25 -0
- package/dist/cli/{git-FHUSPAEU.mjs → git-PKZW3QD5.mjs} +5 -4
- package/dist/cli/index.js +152 -142
- package/dist/cli/index.mjs +56 -46
- package/dist/cli/{legacy-noops-ECHNA5HN.js → legacy-noops-5LM3D724.js} +8 -7
- package/dist/cli/{legacy-noops-HMK4BSCI.mjs → legacy-noops-LJJYG6YA.mjs} +5 -4
- package/dist/cli/{monitors-U7VQ3EZM.mjs → monitors-72QV4ALO.mjs} +19 -6
- package/dist/cli/{monitors-XLLFNENH.js → monitors-UX3H5DC2.js} +103 -90
- package/dist/cli/{org-6H3USO5M.mjs → org-6RRRKOCP.mjs} +9 -6
- package/dist/cli/{org-QX6ER2HN.js → org-IF7ISUVB.js} +70 -67
- package/dist/cli/pages-3SU3HKL7.js +252 -0
- package/dist/cli/pages-DXDYYKEK.mjs +252 -0
- package/dist/cli/{play-MOB2WYOR.mjs → play-AHASKRLA.mjs} +512 -1508
- package/dist/cli/{play-WNB7HBZK.js → play-EUIUVLUH.js} +1090 -2086
- package/dist/cli/{providers-CXEZ23E2.mjs → providers-GWGE3WY3.mjs} +7 -5
- package/dist/cli/{providers-7M3DISKX.js → providers-V5WU4VXJ.js} +10 -8
- package/dist/cli/{quickstart-ZFCHKHF6.mjs → quickstart-OXKQ5ZST.mjs} +5 -4
- package/dist/cli/{quickstart-CLJT4AZL.js → quickstart-QP65I5PF.js} +13 -12
- package/dist/cli/run-6MM72IGL.mjs +443 -0
- package/dist/cli/run-F3FTYS56.js +443 -0
- package/dist/cli/search-OYKOOI7A.js +32 -0
- package/dist/cli/{search-FVYWYIC3.mjs → search-ZMEBVJZB.mjs} +8 -6
- package/dist/cli/{secrets-YRLKZQS5.js → secrets-ACND5N6A.js} +16 -14
- package/dist/cli/{secrets-WAMPTQFC.mjs → secrets-XRCJFF3L.mjs} +7 -5
- package/dist/cli/{sessions-IQ332BJH.mjs → sessions-RTK3CEW6.mjs} +5 -4
- package/dist/cli/{sessions-44J6WIVU.js → sessions-ZGRJPCFF.js} +6 -5
- package/dist/cli/{settings-4IJR2I2T.js → settings-PD5KWQQZ.js} +80 -77
- package/dist/cli/{settings-22S6NIFQ.mjs → settings-XDRBPRDE.mjs} +14 -11
- package/dist/cli/{setup-OZUPKKPW.mjs → setup-3HPYAOCC.mjs} +12 -10
- package/dist/cli/{setup-3FWSRNOX.js → setup-E2Q6PXHC.js} +53 -51
- package/dist/cli/{skills-5CW3NFP3.mjs → skills-OOQFMPOV.mjs} +7 -6
- package/dist/cli/skills-XYWV52KB.js +31 -0
- package/dist/cli/tools-ASCDZJCK.js +55 -0
- package/dist/cli/tools-C5ZT3UIC.mjs +55 -0
- package/dist/cli/update-5RQSEIFM.js +33 -0
- package/dist/cli/{update-IBULOV7P.mjs → update-ZWJTADIW.mjs} +9 -8
- package/dist/cli/{workflow-MVZT7MWT.mjs → workflow-23NMPAJ7.mjs} +10 -8
- package/dist/cli/{workflow-Z7FW6GT2.js → workflow-TCXU5YJV.js} +20 -18
- package/dist/client-DS2IWYZF.d.ts +10 -0
- package/dist/client-DTwnz_AW.d.mts +10 -0
- package/dist/{client-CYqG23K1.d.ts → client-core-B_6HAIBy.d.ts} +385 -12
- package/dist/{client-BbU5_j7n.d.mts → client-core-DzBSlY1U.d.mts} +385 -12
- package/dist/{compiler-manifest-CWz_sNOQ.d.mts → compiler-manifest-Dcyd3-Zd.d.mts} +43 -1
- package/dist/{compiler-manifest-CWz_sNOQ.d.ts → compiler-manifest-Dcyd3-Zd.d.ts} +43 -1
- package/dist/errors-d-sTrZhe.d.mts +142 -0
- package/dist/errors-yQwfgrcX.d.ts +142 -0
- package/dist/{index-BF2JB_Ug.d.mts → index-C6oXchjN.d.mts} +1 -1
- package/dist/{index-4NPXDzlD.d.ts → index-P56zy_z5.d.ts} +1 -1
- package/dist/index.d.mts +11 -147
- package/dist/index.d.ts +11 -147
- package/dist/index.js +15 -11
- package/dist/index.mjs +14 -10
- package/dist/install-integrity.json +141 -104
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +2 -1
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/play-description.js +2 -2
- package/dist/plays/play-description.mjs +1 -1
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +17 -0
- package/dist/server.d.ts +17 -0
- package/dist/server.js +76 -0
- package/dist/server.mjs +76 -0
- package/package.json +6 -1
- package/dist/cli/auth-VDOCNR7H.js +0 -40
- package/dist/cli/chunk-PQUUWFXY.js +0 -95
- package/dist/cli/chunk-QJLKYYPX.js +0 -1710
- package/dist/cli/chunk-YBWAG72P.mjs +0 -95
- package/dist/cli/git-4PMBJSH5.js +0 -24
- package/dist/cli/search-4CCQCTVD.js +0 -30
- package/dist/cli/skills-LMNM6B5F.js +0 -30
- package/dist/cli/tools-AGBBDJ7P.js +0 -45
- package/dist/cli/tools-NOPBDRGW.mjs +0 -45
- package/dist/cli/update-U3W6USVD.js +0 -32
|
@@ -0,0 +1,1039 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkIAYSWZDJjs = require('./chunk-IAYSWZDJ.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk3ACMRZRVjs = require('./chunk-3ACMRZRV.js');
|
|
10
|
+
|
|
11
|
+
// src/cli/describe-options.ts
|
|
12
|
+
function addDescribeOptions(command, options = {}) {
|
|
13
|
+
command.option(
|
|
14
|
+
"--prebuilt",
|
|
15
|
+
"Show the Deepline tool or play, not a play your workspace created under the same name"
|
|
16
|
+
).option("--tool", "Same as --prebuilt").option(
|
|
17
|
+
"--verbose",
|
|
18
|
+
"Show secondary fields, and fill in every input and read every output in the examples"
|
|
19
|
+
).option(
|
|
20
|
+
"--cli-example",
|
|
21
|
+
"Show only the CLI example, and explain how it takes inputs and returns outputs"
|
|
22
|
+
).option(
|
|
23
|
+
"--play-example",
|
|
24
|
+
"Show only the in-play example, and explain how it takes inputs and returns outputs"
|
|
25
|
+
).option("--no-example", "Hide the run examples").option(
|
|
26
|
+
"--full-schema",
|
|
27
|
+
`Print every field: a long schema unfolded (over ${_chunkIAYSWZDJjs.SCHEMA_LINE_LIMIT} lines), list rows, and a tool's raw response`
|
|
28
|
+
).option(
|
|
29
|
+
"--fields <names>",
|
|
30
|
+
"Show only these fields, comma-separated, plus every required input"
|
|
31
|
+
).option(
|
|
32
|
+
"--feature <name[=value]>",
|
|
33
|
+
"Describe one feature of a tool, such as a model: --feature model=openai/gpt-5.6-luna. A tool lists its features."
|
|
34
|
+
).option(
|
|
35
|
+
"-o, --out <path>",
|
|
36
|
+
"Save the output to this file instead of printing it"
|
|
37
|
+
);
|
|
38
|
+
if (options.schemaOnly !== false) {
|
|
39
|
+
command.option(
|
|
40
|
+
"--schema-only",
|
|
41
|
+
"Print only the schema, with every field, and nothing else"
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (options.json !== false) {
|
|
45
|
+
command.option(
|
|
46
|
+
"--json",
|
|
47
|
+
"Print JSON instead of text; with --schema-only, only the input and output JSON Schemas"
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return command;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/cli/execution-observation.ts
|
|
54
|
+
var _fs = require('fs');
|
|
55
|
+
function writeObservation(observation) {
|
|
56
|
+
const path = process.env.DEEPLINE_EXECUTION_OBSERVATION_PATH;
|
|
57
|
+
const invocationId = process.env.DEEPLINE_EXECUTION_OBSERVATION_ID;
|
|
58
|
+
if (!path || !invocationId) return;
|
|
59
|
+
const pending = `${path}.pending`;
|
|
60
|
+
try {
|
|
61
|
+
_fs.writeFileSync.call(void 0,
|
|
62
|
+
pending,
|
|
63
|
+
JSON.stringify({
|
|
64
|
+
schema_version: 1,
|
|
65
|
+
invocation_id: invocationId,
|
|
66
|
+
...observation
|
|
67
|
+
}),
|
|
68
|
+
{ mode: 384 }
|
|
69
|
+
);
|
|
70
|
+
_fs.renameSync.call(void 0, pending, path);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
console.error(
|
|
73
|
+
"[execution-observation] could not write the configured diagnostic sink",
|
|
74
|
+
{ kind: observation.kind }
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function recordApiResponse(observation) {
|
|
79
|
+
writeObservation({
|
|
80
|
+
kind: "api_response",
|
|
81
|
+
received_at_ms: observation.receivedAtMs,
|
|
82
|
+
state: observation.state,
|
|
83
|
+
http_status: observation.httpStatus
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function recordPlayTermination(run) {
|
|
87
|
+
if (typeof run.id !== "string" || !["completed", "failed", "cancelled", "canceled"].includes(
|
|
88
|
+
String(run.status)
|
|
89
|
+
) || typeof run.finishedAt !== "number" || !Number.isSafeInteger(run.finishedAt) || run.finishedAt <= 0)
|
|
90
|
+
return;
|
|
91
|
+
writeObservation({
|
|
92
|
+
kind: "play_terminal",
|
|
93
|
+
run: { id: run.id, status: run.status, finishedAt: run.finishedAt }
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ../plays/table-csv.ts
|
|
98
|
+
var TABLE_EXPORT_ERROR_COLUMN = "_error";
|
|
99
|
+
var UNRECORDED_FAILURE_REASON = "Row failed without a recorded reason.";
|
|
100
|
+
function tableCellText(value) {
|
|
101
|
+
if (value === null || value === void 0) return "";
|
|
102
|
+
if (typeof value === "string") return value;
|
|
103
|
+
if (typeof value === "number" || typeof value === "bigint" || typeof value === "boolean")
|
|
104
|
+
return String(value);
|
|
105
|
+
if (value instanceof Date) return value.toISOString();
|
|
106
|
+
if (typeof value === "symbol" || typeof value === "function") return "";
|
|
107
|
+
try {
|
|
108
|
+
return _nullishCoalesce(JSON.stringify(
|
|
109
|
+
value,
|
|
110
|
+
(_key, nested) => typeof nested === "bigint" ? nested.toString() : nested
|
|
111
|
+
), () => ( ""));
|
|
112
|
+
} catch (e2) {
|
|
113
|
+
return String(value);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function csvField(value) {
|
|
117
|
+
const text = tableCellText(value);
|
|
118
|
+
return /[",\r\n]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text;
|
|
119
|
+
}
|
|
120
|
+
function csvRecord(values) {
|
|
121
|
+
return `${values.map(csvField).join(",")}
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
function isFailedRow(row) {
|
|
125
|
+
return row.status === "failed";
|
|
126
|
+
}
|
|
127
|
+
function tableExportHasFailedRows(rows) {
|
|
128
|
+
for (const row of rows) if (isFailedRow(row)) return true;
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
function tableExportErrorCell(row) {
|
|
132
|
+
if (!isFailedRow(row)) return "";
|
|
133
|
+
const reason = typeof row.error === "string" ? row.error.trim() : "";
|
|
134
|
+
return reason || UNRECORDED_FAILURE_REASON;
|
|
135
|
+
}
|
|
136
|
+
function tableExportColumns(columns, withError) {
|
|
137
|
+
if (!withError) return [...columns];
|
|
138
|
+
return [
|
|
139
|
+
...columns.filter((column) => column !== TABLE_EXPORT_ERROR_COLUMN),
|
|
140
|
+
TABLE_EXPORT_ERROR_COLUMN
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
function tableExportCells(row, columns, withError) {
|
|
144
|
+
return tableExportColumns(columns, withError).map(
|
|
145
|
+
(column) => column === TABLE_EXPORT_ERROR_COLUMN && withError ? tableExportErrorCell(row) : Object.hasOwn(row.data, column) ? row.data[column] : void 0
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function tableCsvText(header, records) {
|
|
149
|
+
let text = csvRecord(header);
|
|
150
|
+
for (const record2 of records) text += csvRecord(record2);
|
|
151
|
+
return text;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/cli/run-dataset-order.ts
|
|
155
|
+
function underscoreKeysLast(keys) {
|
|
156
|
+
return [...keys].sort(
|
|
157
|
+
(left, right) => Number(left.startsWith("_")) - Number(right.startsWith("_"))
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
function orderRunExportJson(value) {
|
|
161
|
+
const copies = /* @__PURE__ */ new WeakMap();
|
|
162
|
+
function visit(item) {
|
|
163
|
+
if (item === null || typeof item !== "object") return item;
|
|
164
|
+
if (copies.has(item)) return copies.get(item);
|
|
165
|
+
if (Array.isArray(item)) {
|
|
166
|
+
const copy2 = [];
|
|
167
|
+
copies.set(item, copy2);
|
|
168
|
+
for (const element of item) copy2.push(visit(element));
|
|
169
|
+
return copy2;
|
|
170
|
+
}
|
|
171
|
+
const prototype = Object.getPrototypeOf(item);
|
|
172
|
+
if (prototype !== Object.prototype && prototype !== null) return item;
|
|
173
|
+
const record2 = item;
|
|
174
|
+
const copy = /* @__PURE__ */ Object.create(null);
|
|
175
|
+
copies.set(item, copy);
|
|
176
|
+
for (const key of underscoreKeysLast(Object.keys(record2))) {
|
|
177
|
+
copy[key] = visit(record2[key]);
|
|
178
|
+
}
|
|
179
|
+
return copy;
|
|
180
|
+
}
|
|
181
|
+
return visit(value);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// src/cli/execution-output.ts
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
var _os = require('os');
|
|
197
|
+
var _path = require('path');
|
|
198
|
+
var _crypto = require('crypto');
|
|
199
|
+
|
|
200
|
+
// src/cli/run-dataset-csv.ts
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
var RunDatasetCsv = class _RunDatasetCsv {
|
|
204
|
+
#projection;
|
|
205
|
+
constructor(input) {
|
|
206
|
+
const rows = input.rows.map(projectRunDatasetRow);
|
|
207
|
+
this.#projection = {
|
|
208
|
+
rows,
|
|
209
|
+
columns: runDatasetCsvColumns(rows, input.columns)
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
static from(input) {
|
|
213
|
+
return new _RunDatasetCsv(input);
|
|
214
|
+
}
|
|
215
|
+
projection() {
|
|
216
|
+
return this.#projection;
|
|
217
|
+
}
|
|
218
|
+
write(outPath) {
|
|
219
|
+
const absolutePath = _path.resolve.call(void 0, outPath);
|
|
220
|
+
const { rows, columns } = this.#projection;
|
|
221
|
+
_fs.writeFileSync.call(void 0,
|
|
222
|
+
absolutePath,
|
|
223
|
+
tableCsvText(
|
|
224
|
+
columns,
|
|
225
|
+
rows.map((data) => tableExportCells({ data }, columns, false))
|
|
226
|
+
),
|
|
227
|
+
"utf-8"
|
|
228
|
+
);
|
|
229
|
+
return absolutePath;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
function projectRunDatasetCsv(input) {
|
|
233
|
+
return RunDatasetCsv.from(input).projection();
|
|
234
|
+
}
|
|
235
|
+
function writeRunDatasetCsv(input) {
|
|
236
|
+
return RunDatasetCsv.from(input).write(input.outPath);
|
|
237
|
+
}
|
|
238
|
+
function projectRunDatasetRow(row) {
|
|
239
|
+
return Object.fromEntries(
|
|
240
|
+
Object.entries(row).map(([column, value]) => [
|
|
241
|
+
column,
|
|
242
|
+
projectRunDatasetCell(value)
|
|
243
|
+
])
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
function projectRunDatasetCell(value) {
|
|
247
|
+
const logicalValue = parseSerializedDatasetValue(value);
|
|
248
|
+
if (logicalValue === null || logicalValue === void 0) return logicalValue;
|
|
249
|
+
if (typeof logicalValue === "object") {
|
|
250
|
+
return _chunk3ACMRZRVjs.csvSafeJsonString.call(void 0, canonicalDatasetJson(logicalValue));
|
|
251
|
+
}
|
|
252
|
+
return logicalValue;
|
|
253
|
+
}
|
|
254
|
+
function canonicalDatasetJson(value) {
|
|
255
|
+
return canonicalDatasetJsonValue(value, /* @__PURE__ */ new WeakSet());
|
|
256
|
+
}
|
|
257
|
+
function canonicalDatasetJsonValue(value, ancestors) {
|
|
258
|
+
if (Array.isArray(value)) {
|
|
259
|
+
if (ancestors.has(value)) return value;
|
|
260
|
+
ancestors.add(value);
|
|
261
|
+
const normalized2 = value.map(
|
|
262
|
+
(item) => canonicalDatasetJsonValue(item, ancestors)
|
|
263
|
+
);
|
|
264
|
+
ancestors.delete(value);
|
|
265
|
+
return normalized2;
|
|
266
|
+
}
|
|
267
|
+
if (!value || typeof value !== "object" || value instanceof Date) {
|
|
268
|
+
return value;
|
|
269
|
+
}
|
|
270
|
+
if (ancestors.has(value)) return value;
|
|
271
|
+
ancestors.add(value);
|
|
272
|
+
const record2 = value;
|
|
273
|
+
const normalized = Object.fromEntries(
|
|
274
|
+
underscoreKeysLast(
|
|
275
|
+
Object.keys(record2).sort((left, right) => left.localeCompare(right))
|
|
276
|
+
).map((key) => [key, canonicalDatasetJsonValue(record2[key], ancestors)])
|
|
277
|
+
);
|
|
278
|
+
ancestors.delete(value);
|
|
279
|
+
return normalized;
|
|
280
|
+
}
|
|
281
|
+
function parseSerializedDatasetValue(value) {
|
|
282
|
+
if (typeof value !== "string") return value;
|
|
283
|
+
const text = value.trim();
|
|
284
|
+
if (!text || !["{", "["].includes(_nullishCoalesce(text[0], () => ( "")))) return value;
|
|
285
|
+
try {
|
|
286
|
+
return JSON.parse(text);
|
|
287
|
+
} catch (e3) {
|
|
288
|
+
return value;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function runDatasetCsvColumns(rows, declaredColumns) {
|
|
292
|
+
const columns = [];
|
|
293
|
+
const seen = /* @__PURE__ */ new Set();
|
|
294
|
+
const add = (column) => {
|
|
295
|
+
if (!column || seen.has(column)) return;
|
|
296
|
+
seen.add(column);
|
|
297
|
+
columns.push(column);
|
|
298
|
+
};
|
|
299
|
+
for (const column of declaredColumns) add(column);
|
|
300
|
+
for (const row of rows) {
|
|
301
|
+
for (const column of Object.keys(row)) add(column);
|
|
302
|
+
}
|
|
303
|
+
return underscoreKeysLast(columns);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// src/cli/value-outline.ts
|
|
307
|
+
var OUTLINE_LINES = 32;
|
|
308
|
+
var ITEMS_SHOWN = 3;
|
|
309
|
+
var VALUE_CHARACTERS = 60;
|
|
310
|
+
function isRecord(value) {
|
|
311
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
312
|
+
}
|
|
313
|
+
function isContainer(value) {
|
|
314
|
+
return Array.isArray(value) && value.length > 0 || isRecord(value) && Object.keys(value).length > 0;
|
|
315
|
+
}
|
|
316
|
+
function node(label, value) {
|
|
317
|
+
const children = !isContainer(value) ? null : Array.isArray(value) ? value.some(isContainer) ? value.map((item) => node(null, item)) : null : Object.entries(value).filter(([, child]) => child !== void 0).map(([key, child]) => node(key, child));
|
|
318
|
+
return { label, value, children, shown: 0 };
|
|
319
|
+
}
|
|
320
|
+
function wanted(parent, left) {
|
|
321
|
+
const count = _nullishCoalesce(_optionalChain([parent, 'access', _ => _.children, 'optionalAccess', _2 => _2.length]), () => ( 0));
|
|
322
|
+
if (!Array.isArray(parent.value)) return count;
|
|
323
|
+
const first = parent.value[0];
|
|
324
|
+
const perItem = isRecord(first) ? Math.max(1, Object.keys(first).length) : 1;
|
|
325
|
+
return Math.min(count, Math.max(ITEMS_SHOWN, Math.floor(left / perItem)));
|
|
326
|
+
}
|
|
327
|
+
function shareLines(wants, total) {
|
|
328
|
+
const grants = wants.map(() => 0);
|
|
329
|
+
let left = total;
|
|
330
|
+
let open = wants.flatMap((want, index) => want > 0 ? [index] : []);
|
|
331
|
+
while (left > 0 && open.length) {
|
|
332
|
+
const each = Math.floor(left / open.length);
|
|
333
|
+
if (each === 0) {
|
|
334
|
+
for (const index of open.slice(0, left)) grants[index] += 1;
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
for (const index of open) {
|
|
338
|
+
const grant = Math.min(each, wants[index] - grants[index]);
|
|
339
|
+
grants[index] += grant;
|
|
340
|
+
left -= grant;
|
|
341
|
+
}
|
|
342
|
+
open = open.filter((index) => grants[index] < wants[index]);
|
|
343
|
+
}
|
|
344
|
+
return grants;
|
|
345
|
+
}
|
|
346
|
+
function cut(text) {
|
|
347
|
+
return text.length > VALUE_CHARACTERS ? `${text.slice(0, VALUE_CHARACTERS)}\u2026` : text;
|
|
348
|
+
}
|
|
349
|
+
function valueText(value) {
|
|
350
|
+
if (Array.isArray(value)) {
|
|
351
|
+
if (!value.length) return "[]";
|
|
352
|
+
const items = value.map((item) => cut(_nullishCoalesce(JSON.stringify(item), () => ( "null"))));
|
|
353
|
+
const text = `[${items.join(", ")}]`;
|
|
354
|
+
return text.length <= VALUE_CHARACTERS ? text : `[${items[0]}, \u2026 ${value.length} items]`;
|
|
355
|
+
}
|
|
356
|
+
if (isRecord(value)) return "{}";
|
|
357
|
+
return typeof value === "string" ? JSON.stringify(cut(value)) : String(_nullishCoalesce(JSON.stringify(value), () => ( "null")));
|
|
358
|
+
}
|
|
359
|
+
function foldedText(value) {
|
|
360
|
+
if (Array.isArray(value)) return `[${value.length} items]`;
|
|
361
|
+
return `{ ${cut(Object.keys(value).join(", "))} }`;
|
|
362
|
+
}
|
|
363
|
+
function countNote(item) {
|
|
364
|
+
const total = _nullishCoalesce(_optionalChain([item, 'access', _3 => _3.children, 'optionalAccess', _4 => _4.length]), () => ( 0));
|
|
365
|
+
if (Array.isArray(item.value)) {
|
|
366
|
+
return item.shown < total ? `(${item.shown} of ${total} items)` : `(${total} ${total === 1 ? "item" : "items"})`;
|
|
367
|
+
}
|
|
368
|
+
return item.shown < total ? `(${item.shown} of ${total} fields)` : "";
|
|
369
|
+
}
|
|
370
|
+
function renderChildren(parent, indent) {
|
|
371
|
+
return (_nullishCoalesce(parent.children, () => ( []))).slice(0, parent.shown).flatMap((child) => renderNode(child, indent));
|
|
372
|
+
}
|
|
373
|
+
function renderNode(item, indent) {
|
|
374
|
+
const prefix = item.label === null ? "- " : `${item.label}: `;
|
|
375
|
+
if (!item.children) return [`${indent}${prefix}${valueText(item.value)}`];
|
|
376
|
+
if (!item.shown) return [`${indent}${prefix}${foldedText(item.value)}`];
|
|
377
|
+
const note = countNote(item);
|
|
378
|
+
const children = renderChildren(item, `${indent} `);
|
|
379
|
+
if (mergesWithFirstField(item)) {
|
|
380
|
+
const [first, ...rest] = children;
|
|
381
|
+
const head = `${indent}- ${first.slice(indent.length + 2)}`;
|
|
382
|
+
return [note ? `${head} ${note}` : head, ...rest];
|
|
383
|
+
}
|
|
384
|
+
return [`${indent}${prefix.trimEnd()}${note ? ` ${note}` : ""}`, ...children];
|
|
385
|
+
}
|
|
386
|
+
function mergesWithFirstField(item) {
|
|
387
|
+
return item.label === null && isRecord(item.value) && item.shown > 0;
|
|
388
|
+
}
|
|
389
|
+
function anythingHidden(item) {
|
|
390
|
+
if (!item.children) return false;
|
|
391
|
+
if (item.shown < item.children.length) return true;
|
|
392
|
+
return item.children.some(anythingHidden);
|
|
393
|
+
}
|
|
394
|
+
function outlineLines(value, budget = OUTLINE_LINES) {
|
|
395
|
+
const root = node("", value);
|
|
396
|
+
if (!root.children)
|
|
397
|
+
return { lines: [valueText(value)], note: "", cut: false };
|
|
398
|
+
let left = budget;
|
|
399
|
+
let level = [root];
|
|
400
|
+
while (level.length) {
|
|
401
|
+
const wants = level.map((parent) => wanted(parent, left));
|
|
402
|
+
const items = level.map(
|
|
403
|
+
(parent, index) => parent.label === null && isRecord(parent.value) && wants[index] > 0
|
|
404
|
+
);
|
|
405
|
+
let returned = items.filter(Boolean).length;
|
|
406
|
+
if (left + returned <= 0) break;
|
|
407
|
+
let grants = shareLines(wants, left + returned);
|
|
408
|
+
for (; ; ) {
|
|
409
|
+
const merged = grants.filter((grant, index) => items[index] && grant > 0);
|
|
410
|
+
if (merged.length === returned) break;
|
|
411
|
+
returned = merged.length;
|
|
412
|
+
grants = shareLines(wants, left + returned);
|
|
413
|
+
}
|
|
414
|
+
left += returned;
|
|
415
|
+
const next = [];
|
|
416
|
+
level.forEach((parent, index) => {
|
|
417
|
+
parent.shown = grants[index];
|
|
418
|
+
left -= parent.shown;
|
|
419
|
+
next.push(
|
|
420
|
+
...parent.children.slice(0, parent.shown).filter((child) => child.children)
|
|
421
|
+
);
|
|
422
|
+
});
|
|
423
|
+
level = next;
|
|
424
|
+
}
|
|
425
|
+
return {
|
|
426
|
+
lines: renderChildren(root, ""),
|
|
427
|
+
note: countNote(root),
|
|
428
|
+
cut: anythingHidden(root)
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function merge(a, b) {
|
|
432
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
433
|
+
return a.map((item, index) => merge(item, b[index]));
|
|
434
|
+
}
|
|
435
|
+
if (isRecord(a) && isRecord(b)) {
|
|
436
|
+
const merged = { ...a };
|
|
437
|
+
for (const [key, value] of Object.entries(b)) {
|
|
438
|
+
merged[key] = key in merged ? merge(merged[key], value) : value;
|
|
439
|
+
}
|
|
440
|
+
return merged;
|
|
441
|
+
}
|
|
442
|
+
return b === void 0 ? a : b;
|
|
443
|
+
}
|
|
444
|
+
function pick(value, path) {
|
|
445
|
+
if (!path.length) return value;
|
|
446
|
+
if (Array.isArray(value)) return value.map((item) => pick(item, path));
|
|
447
|
+
if (!isRecord(value) || !(path[0] in value)) return void 0;
|
|
448
|
+
const child = pick(value[path[0]], path.slice(1));
|
|
449
|
+
return child === void 0 ? void 0 : { [path[0]]: child };
|
|
450
|
+
}
|
|
451
|
+
function pickFields(value, paths) {
|
|
452
|
+
const missing = [];
|
|
453
|
+
let picked;
|
|
454
|
+
for (const path of paths) {
|
|
455
|
+
const one = pick(value, path.split("."));
|
|
456
|
+
const found = Array.isArray(one) ? one.some((item) => item !== void 0) : one !== void 0;
|
|
457
|
+
if (found) picked = picked === void 0 ? one : merge(picked, one);
|
|
458
|
+
else missing.push(path);
|
|
459
|
+
}
|
|
460
|
+
return { value: picked, missing };
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// src/cli/execution-output.ts
|
|
464
|
+
var ExecutionOutputError = class extends Error {
|
|
465
|
+
};
|
|
466
|
+
var JSON_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
|
|
467
|
+
function dataOnStdout(options) {
|
|
468
|
+
return options.jsonOut === "-" || (_nullishCoalesce(options.csvOut, () => ( []))).some((target) => target.path === "-");
|
|
469
|
+
}
|
|
470
|
+
function listPath(source) {
|
|
471
|
+
return source.replace(/^\//, "").replace(/\//g, ".").replace(/^result(\.|$)/, "");
|
|
472
|
+
}
|
|
473
|
+
function valueAt(value, path) {
|
|
474
|
+
return path.split(".").reduce((at, key) => record(at) ? at[key] : void 0, value);
|
|
475
|
+
}
|
|
476
|
+
function validateExecutionOutput(options) {
|
|
477
|
+
const toStdout = [
|
|
478
|
+
["--json-out", options.jsonOut],
|
|
479
|
+
...(_nullishCoalesce(options.csvOut, () => ( []))).map((target) => ["--csv-out", target.path]),
|
|
480
|
+
["--logs-out", options.logsOut]
|
|
481
|
+
].filter(([, path]) => path === "-");
|
|
482
|
+
if ((_nullishCoalesce(options.csvOut, () => ( []))).filter((target) => !target.list).length > 1) {
|
|
483
|
+
throw new Error(
|
|
484
|
+
"Only one --csv-out may leave out the list name; name the others as list=path."
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
if (toStdout.length > 1) {
|
|
488
|
+
throw new Error(
|
|
489
|
+
`Only one of ${toStdout.map(([flag]) => flag).join(" and ")} may write to stdout.`
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
if (options.receiptOut === "-") {
|
|
493
|
+
throw new Error(
|
|
494
|
+
"--receipt-out takes a file. Use --json to print the receipt as JSON."
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
const paths = [
|
|
498
|
+
options.jsonOut,
|
|
499
|
+
...(_nullishCoalesce(options.csvOut, () => ( []))).map((target) => target.path),
|
|
500
|
+
options.receiptOut,
|
|
501
|
+
options.logsOut
|
|
502
|
+
].filter((p) => p !== void 0 && p !== "-");
|
|
503
|
+
const resolved = paths.map((p) => {
|
|
504
|
+
if (!p.trim()) throw new Error("Output filenames must not be empty.");
|
|
505
|
+
const absolute = _path.resolve.call(void 0, p);
|
|
506
|
+
if (_fs.existsSync.call(void 0, absolute))
|
|
507
|
+
throw new Error(
|
|
508
|
+
`Output file already exists: ${absolute}. Choose a new filename.`
|
|
509
|
+
);
|
|
510
|
+
_fs.accessSync.call(void 0, _path.dirname.call(void 0, absolute), _fs.constants.W_OK);
|
|
511
|
+
return _path.join.call(void 0,
|
|
512
|
+
_fs.realpathSync.call(void 0, _path.dirname.call(void 0, absolute)),
|
|
513
|
+
absolute.slice(_path.dirname.call(void 0, absolute).length + 1)
|
|
514
|
+
);
|
|
515
|
+
});
|
|
516
|
+
if (new Set(resolved).size !== resolved.length) {
|
|
517
|
+
throw new Error(
|
|
518
|
+
"--json-out, --csv-out, --receipt-out and --logs-out must use different files."
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
function preflightExecutionOutput(options) {
|
|
523
|
+
try {
|
|
524
|
+
validateExecutionOutput(options);
|
|
525
|
+
return true;
|
|
526
|
+
} catch (error) {
|
|
527
|
+
writeExecutionOutput(
|
|
528
|
+
{
|
|
529
|
+
id: null,
|
|
530
|
+
status: "failed",
|
|
531
|
+
error: {
|
|
532
|
+
message: error instanceof Error ? error.message : String(error)
|
|
533
|
+
},
|
|
534
|
+
ran: false
|
|
535
|
+
},
|
|
536
|
+
// A rejected destination must not be opened, nor may errors pollute data stdout.
|
|
537
|
+
{
|
|
538
|
+
receiptJson: options.receiptJson,
|
|
539
|
+
...dataOnStdout(options) ? { jsonOut: "-" } : {}
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
function record(value) {
|
|
546
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
547
|
+
}
|
|
548
|
+
function pointerPart(key) {
|
|
549
|
+
return key.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
550
|
+
}
|
|
551
|
+
function outputCollections(data, source = "") {
|
|
552
|
+
if (Array.isArray(data)) return [{ source, rows: data, complete: null }];
|
|
553
|
+
if (!record(data)) return [];
|
|
554
|
+
return Object.entries(data).flatMap(
|
|
555
|
+
([key, value]) => outputCollections(value, `${source}/${pointerPart(key)}`)
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
function mergeSchema(a, b) {
|
|
559
|
+
if (!Object.keys(a).length) return b;
|
|
560
|
+
if (!Object.keys(b).length) return a;
|
|
561
|
+
if (a.type !== b.type || a.anyOf || b.anyOf) {
|
|
562
|
+
const variants = [
|
|
563
|
+
...Array.isArray(a.anyOf) ? a.anyOf : [a],
|
|
564
|
+
...Array.isArray(b.anyOf) ? b.anyOf : [b]
|
|
565
|
+
];
|
|
566
|
+
const byType = /* @__PURE__ */ new Map();
|
|
567
|
+
for (const variant of variants) {
|
|
568
|
+
const previous = byType.get(variant.type);
|
|
569
|
+
byType.set(
|
|
570
|
+
variant.type,
|
|
571
|
+
previous ? mergeSchema(previous, variant) : variant
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
return { anyOf: [...byType.values()] };
|
|
575
|
+
}
|
|
576
|
+
if (a.type === "array")
|
|
577
|
+
return {
|
|
578
|
+
type: "array",
|
|
579
|
+
items: mergeSchema(a.items, b.items)
|
|
580
|
+
};
|
|
581
|
+
if (a.type !== "object") return a;
|
|
582
|
+
const properties = { ...a.properties };
|
|
583
|
+
for (const [key, value] of Object.entries(
|
|
584
|
+
b.properties
|
|
585
|
+
)) {
|
|
586
|
+
Object.defineProperty(properties, key, {
|
|
587
|
+
value: properties[key] && Object.hasOwn(properties, key) ? mergeSchema(properties[key], value) : value,
|
|
588
|
+
enumerable: true,
|
|
589
|
+
configurable: true,
|
|
590
|
+
writable: true
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
return {
|
|
594
|
+
type: "object",
|
|
595
|
+
properties,
|
|
596
|
+
required: a.required.filter(
|
|
597
|
+
(key) => b.required.includes(key)
|
|
598
|
+
)
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
function observedSchema(value) {
|
|
602
|
+
if (value === null) return { type: "null" };
|
|
603
|
+
if (Array.isArray(value))
|
|
604
|
+
return {
|
|
605
|
+
type: "array",
|
|
606
|
+
items: value.reduce(
|
|
607
|
+
(schema, item) => mergeSchema(schema, observedSchema(_nullishCoalesce(item, () => ( null)))),
|
|
608
|
+
{}
|
|
609
|
+
)
|
|
610
|
+
};
|
|
611
|
+
if (record(value)) {
|
|
612
|
+
const entries = Object.entries(value).filter(
|
|
613
|
+
([, item]) => item !== void 0
|
|
614
|
+
);
|
|
615
|
+
return {
|
|
616
|
+
type: "object",
|
|
617
|
+
properties: Object.fromEntries(
|
|
618
|
+
entries.map(([key, item]) => [key, observedSchema(item)])
|
|
619
|
+
),
|
|
620
|
+
required: entries.map(([key]) => key)
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
return { type: typeof value === "number" ? "number" : typeof value };
|
|
624
|
+
}
|
|
625
|
+
function csvColumns(collection, fields) {
|
|
626
|
+
const prefix = listPath(collection.source);
|
|
627
|
+
const columns = (_nullishCoalesce(fields, () => ( []))).flatMap(
|
|
628
|
+
(field) => !prefix ? [field] : field.startsWith(`${prefix}.`) ? [field.slice(prefix.length + 1)] : []
|
|
629
|
+
);
|
|
630
|
+
if (!columns.length) return csvText(collection.rows, collection.columns);
|
|
631
|
+
return csvText(
|
|
632
|
+
collection.rows.map(
|
|
633
|
+
(row) => Object.fromEntries(
|
|
634
|
+
columns.map((column) => [column, valueAt(row, column)])
|
|
635
|
+
)
|
|
636
|
+
),
|
|
637
|
+
columns
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
function csvText(rows, columns = []) {
|
|
641
|
+
const projection = projectRunDatasetCsv({
|
|
642
|
+
rows: rows.map((row) => record(row) ? row : { value: row }),
|
|
643
|
+
columns
|
|
644
|
+
});
|
|
645
|
+
return _chunk3ACMRZRVjs.csvStringFromRows.call(void 0, projection.rows, projection.columns);
|
|
646
|
+
}
|
|
647
|
+
function writeExecutionOutput(result, options) {
|
|
648
|
+
let temp;
|
|
649
|
+
const temporary = (name) => _path.join.call(void 0, temp ??= _fs.mkdtempSync.call(void 0, _path.join.call(void 0, _os.tmpdir.call(void 0, ), "deepline-output-")), name);
|
|
650
|
+
const jsonText = (value) => `${JSON.stringify(value, null, 2)}
|
|
651
|
+
`;
|
|
652
|
+
const persist = (path, content) => {
|
|
653
|
+
const absolute = _path.resolve.call(void 0, path);
|
|
654
|
+
const staging = _path.join.call(void 0, _path.dirname.call(void 0, absolute), `.deepline-${_crypto.randomUUID.call(void 0, )}.tmp`);
|
|
655
|
+
try {
|
|
656
|
+
_fs.writeFileSync.call(void 0, staging, content, { flag: "wx", mode: 384 });
|
|
657
|
+
_fs.linkSync.call(void 0, staging, absolute);
|
|
658
|
+
} finally {
|
|
659
|
+
if (_fs.existsSync.call(void 0, staging)) _fs.unlinkSync.call(void 0, staging);
|
|
660
|
+
}
|
|
661
|
+
return absolute;
|
|
662
|
+
};
|
|
663
|
+
let stdoutData;
|
|
664
|
+
const artifact = (destination, content, format, source, rowCount, complete) => {
|
|
665
|
+
const stdout = destination === "-";
|
|
666
|
+
if (stdout) stdoutData = content;
|
|
667
|
+
return {
|
|
668
|
+
path: stdout ? null : persist(destination, content),
|
|
669
|
+
destination: stdout ? "stdout" : "file",
|
|
670
|
+
format,
|
|
671
|
+
source,
|
|
672
|
+
rowCount,
|
|
673
|
+
complete
|
|
674
|
+
};
|
|
675
|
+
};
|
|
676
|
+
let savedJson;
|
|
677
|
+
const ensureJson = () => savedJson ??= persist(temporary("result.json"), jsonText(result.data));
|
|
678
|
+
try {
|
|
679
|
+
const hasData = result.data !== void 0;
|
|
680
|
+
const collections = _nullishCoalesce(result.collections, () => ( (hasData ? outputCollections(result.data).map((collection) => ({
|
|
681
|
+
...collection,
|
|
682
|
+
complete: _nullishCoalesce(result.complete, () => ( null))
|
|
683
|
+
})) : [])));
|
|
684
|
+
const ordered = collections.map((c, index) => ({ ...c, index })).sort((a, b) => b.rows.length - a.rows.length || a.index - b.index);
|
|
685
|
+
const csvTargets = hasData ? _nullishCoalesce(options.csvOut, () => ( [])) : [];
|
|
686
|
+
if (csvTargets.length && !ordered.length)
|
|
687
|
+
throw new Error(
|
|
688
|
+
"This result has no row list to write as CSV. Use --json-out."
|
|
689
|
+
);
|
|
690
|
+
const underFields = ordered.find((collection) => {
|
|
691
|
+
const prefix = listPath(collection.source);
|
|
692
|
+
return prefix && _optionalChain([options, 'access', _5 => _5.fields, 'optionalAccess', _6 => _6.some, 'call', _7 => _7((field) => field.startsWith(`${prefix}.`))]);
|
|
693
|
+
});
|
|
694
|
+
const declaredList = ordered.find(
|
|
695
|
+
(collection) => _optionalChain([result, 'access', _8 => _8.declared, 'optionalAccess', _9 => _9.some, 'call', _10 => _10(
|
|
696
|
+
({ path }) => path !== null && path === listPath(collection.source)
|
|
697
|
+
)])
|
|
698
|
+
);
|
|
699
|
+
const defaultList = _nullishCoalesce(_nullishCoalesce(underFields, () => ( declaredList)), () => ( ordered[0]));
|
|
700
|
+
const csvFor = /* @__PURE__ */ new Map();
|
|
701
|
+
for (const target of csvTargets) {
|
|
702
|
+
const chosen = target.list ? ordered.find(
|
|
703
|
+
(collection) => collection.name === target.list || listPath(collection.source) === target.list || listPath(collection.source).endsWith(`.${target.list}`)
|
|
704
|
+
) : defaultList;
|
|
705
|
+
if (!chosen) {
|
|
706
|
+
throw new Error(
|
|
707
|
+
`No row list named "${target.list}". The lists are: ${ordered.map((collection) => _nullishCoalesce(collection.name, () => ( (listPath(collection.source) || "(top level)")))).join(", ")}`
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
csvFor.set(chosen, target);
|
|
711
|
+
}
|
|
712
|
+
const outputs = { json: null, csv: [] };
|
|
713
|
+
if (hasData && (options.jsonOut || !csvTargets.length)) {
|
|
714
|
+
outputs.json = artifact(
|
|
715
|
+
_nullishCoalesce(options.jsonOut, () => ( temporary("result.json"))),
|
|
716
|
+
jsonText(result.data),
|
|
717
|
+
"json",
|
|
718
|
+
"",
|
|
719
|
+
Array.isArray(result.data) ? result.data.length : null,
|
|
720
|
+
_nullishCoalesce(result.complete, () => ( null))
|
|
721
|
+
);
|
|
722
|
+
savedJson = _nullishCoalesce(outputs.json.path, () => ( void 0));
|
|
723
|
+
}
|
|
724
|
+
const summaries = ordered.map((collection) => {
|
|
725
|
+
const target = csvFor.get(collection);
|
|
726
|
+
const csv = target ? artifact(
|
|
727
|
+
target.path,
|
|
728
|
+
csvColumns(collection, options.fields),
|
|
729
|
+
"csv",
|
|
730
|
+
collection.source,
|
|
731
|
+
collection.rows.length,
|
|
732
|
+
collection.complete
|
|
733
|
+
) : null;
|
|
734
|
+
if (csv) outputs.csv.push(csv);
|
|
735
|
+
return {
|
|
736
|
+
source: collection.source,
|
|
737
|
+
rowCount: collection.rows.length,
|
|
738
|
+
complete: collection.complete,
|
|
739
|
+
outcomes: _nullishCoalesce(collection.outcomes, () => ( null)),
|
|
740
|
+
columns: _optionalChain([collection, 'access', _11 => _11.columns, 'optionalAccess', _12 => _12.length]) ? collection.columns : columnsOf(collection.rows),
|
|
741
|
+
csv: csv ? _nullishCoalesce(csv.path, () => ( "stdout")) : null
|
|
742
|
+
};
|
|
743
|
+
});
|
|
744
|
+
const schemaFile = hasData ? persist(
|
|
745
|
+
temporary("result.schema.json"),
|
|
746
|
+
jsonText({
|
|
747
|
+
$schema: JSON_SCHEMA_DIALECT,
|
|
748
|
+
...observedSchema(result.data)
|
|
749
|
+
})
|
|
750
|
+
) : null;
|
|
751
|
+
const receipt = {
|
|
752
|
+
status: result.status,
|
|
753
|
+
id: result.id,
|
|
754
|
+
name: _nullishCoalesce(options.label, () => ( null)),
|
|
755
|
+
credits: _nullishCoalesce(result.credits, () => ( null)),
|
|
756
|
+
outputs,
|
|
757
|
+
page: _nullishCoalesce(result.page, () => ( null)),
|
|
758
|
+
price: _nullishCoalesce(result.price, () => ( null)),
|
|
759
|
+
declaredOutputs: (_nullishCoalesce(result.declared, () => ( []))).map(({ name, path }) => ({
|
|
760
|
+
name,
|
|
761
|
+
path
|
|
762
|
+
})),
|
|
763
|
+
schemaFile,
|
|
764
|
+
logsFile: _nullishCoalesce(options.logsFile, () => ( null)),
|
|
765
|
+
collections: summaries,
|
|
766
|
+
warnings: _nullishCoalesce(result.warnings, () => ( [])),
|
|
767
|
+
error: _nullishCoalesce(result.error, () => ( null)),
|
|
768
|
+
next: _nullishCoalesce(result.next, () => ( {}))
|
|
769
|
+
};
|
|
770
|
+
const receiptFile = options.receiptOut ? persist(options.receiptOut, jsonText(receipt)) : null;
|
|
771
|
+
printReceipt(receipt, options, {
|
|
772
|
+
receiptFile,
|
|
773
|
+
data: hasData ? result.data : void 0,
|
|
774
|
+
ran: result.ran,
|
|
775
|
+
declared: result.declared
|
|
776
|
+
});
|
|
777
|
+
if (stdoutData !== void 0) process.stdout.write(stdoutData);
|
|
778
|
+
} catch (error) {
|
|
779
|
+
let recoveryFile = null;
|
|
780
|
+
try {
|
|
781
|
+
if (result.data !== void 0) recoveryFile = ensureJson();
|
|
782
|
+
} catch (e4) {
|
|
783
|
+
}
|
|
784
|
+
const failure = {
|
|
785
|
+
status: "output_failed",
|
|
786
|
+
id: result.id,
|
|
787
|
+
name: _nullishCoalesce(options.label, () => ( null)),
|
|
788
|
+
credits: _nullishCoalesce(result.credits, () => ( null)),
|
|
789
|
+
outputs: { json: null, csv: [] },
|
|
790
|
+
page: _nullishCoalesce(result.page, () => ( null)),
|
|
791
|
+
price: _nullishCoalesce(result.price, () => ( null)),
|
|
792
|
+
declaredOutputs: [],
|
|
793
|
+
schemaFile: null,
|
|
794
|
+
logsFile: _nullishCoalesce(options.logsFile, () => ( null)),
|
|
795
|
+
collections: [],
|
|
796
|
+
warnings: [],
|
|
797
|
+
error: {
|
|
798
|
+
message: error instanceof Error ? error.message : String(error),
|
|
799
|
+
recoveryFile
|
|
800
|
+
},
|
|
801
|
+
next: _nullishCoalesce(result.next, () => ( {}))
|
|
802
|
+
};
|
|
803
|
+
printReceipt(failure, options, { receiptFile: null, ran: result.ran });
|
|
804
|
+
throw new ExecutionOutputError(
|
|
805
|
+
`Output failed${result.id ? ` for ${result.id}` : ""}: ${error instanceof Error ? error.message : String(error)}. Do not re-execute paid work.`,
|
|
806
|
+
{ cause: error }
|
|
807
|
+
);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
var EXAMPLE_CHARACTERS = 40;
|
|
811
|
+
var HEADLINES = {
|
|
812
|
+
completed: "Completed",
|
|
813
|
+
failed: "Failed",
|
|
814
|
+
cancelled: "Cancelled",
|
|
815
|
+
running: "Still running",
|
|
816
|
+
queued: "Started",
|
|
817
|
+
pending: "Started",
|
|
818
|
+
output_failed: "Ran, but the output could not be written",
|
|
819
|
+
dry_run: "Dry run, nothing sent"
|
|
820
|
+
};
|
|
821
|
+
var NEXT_NOTES = {
|
|
822
|
+
billing: "what this call cost",
|
|
823
|
+
status: "check on the run",
|
|
824
|
+
export: "save its rows once it finishes",
|
|
825
|
+
getActorRun: "check the Apify run",
|
|
826
|
+
getDatasetItems: "read the Apify run\u2019s items"
|
|
827
|
+
};
|
|
828
|
+
function exampleOf(value) {
|
|
829
|
+
return typeof value === "string" && value.length > EXAMPLE_CHARACTERS ? `${value.slice(0, EXAMPLE_CHARACTERS)}\u2026` : value;
|
|
830
|
+
}
|
|
831
|
+
function annotated(schema, values) {
|
|
832
|
+
const present = values.filter((value) => value !== void 0);
|
|
833
|
+
const first = present.find(
|
|
834
|
+
(value) => value !== null && typeof value !== "object"
|
|
835
|
+
);
|
|
836
|
+
const node2 = { ...schema };
|
|
837
|
+
if (first !== void 0) node2.example = exampleOf(first);
|
|
838
|
+
if (Array.isArray(schema.anyOf)) {
|
|
839
|
+
node2.anyOf = schema.anyOf.map(
|
|
840
|
+
(variant) => annotated(variant, present)
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
if (record(schema.properties)) {
|
|
844
|
+
const rows = present.filter(record);
|
|
845
|
+
node2.properties = Object.fromEntries(
|
|
846
|
+
Object.entries(schema.properties).map(([key, child]) => [
|
|
847
|
+
key,
|
|
848
|
+
annotated(
|
|
849
|
+
child,
|
|
850
|
+
rows.map((row) => row[key])
|
|
851
|
+
)
|
|
852
|
+
])
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
if (schema.type === "array" && record(schema.items)) {
|
|
856
|
+
const lists = present.filter(Array.isArray);
|
|
857
|
+
node2.items = annotated(schema.items, lists.flat());
|
|
858
|
+
const lengths = lists.map((list) => list.length);
|
|
859
|
+
const [low, high] = [Math.min(...lengths), Math.max(...lengths)];
|
|
860
|
+
const items = high === 1 ? "item" : "items";
|
|
861
|
+
if (lengths.length === 1) node2.description = `${low} ${items}`;
|
|
862
|
+
else if (lengths.length > 1) {
|
|
863
|
+
node2.description = low === high ? `${low} ${items} each` : `${low}-${high} items each`;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return node2;
|
|
867
|
+
}
|
|
868
|
+
function shapeLines(title, data) {
|
|
869
|
+
const schema = annotated(observedSchema(data), [data]);
|
|
870
|
+
const block = (heading, fieldSchema) => {
|
|
871
|
+
const { lines, folded } = _chunkIAYSWZDJjs.fieldBlockLines.call(void 0,
|
|
872
|
+
heading,
|
|
873
|
+
_chunkIAYSWZDJjs.schemaFields.call(void 0, fieldSchema)
|
|
874
|
+
);
|
|
875
|
+
return [
|
|
876
|
+
...lines,
|
|
877
|
+
...folded ? ["Long result: deeper objects show only their field names."] : [],
|
|
878
|
+
"Types are what this result contained; a field that was only ever null shows as null."
|
|
879
|
+
];
|
|
880
|
+
};
|
|
881
|
+
if (record(schema.properties)) return block(title, schema);
|
|
882
|
+
if (schema.type === "array" && record(schema.items) && record(schema.items.properties)) {
|
|
883
|
+
const count = Array.isArray(data) ? data.length : 0;
|
|
884
|
+
return block(`${title}
|
|
885
|
+
A list of ${count} items, each:`, schema.items);
|
|
886
|
+
}
|
|
887
|
+
const value = Array.isArray(data) ? `a list of ${data.length} values` : data === null ? "null" : `${typeof data}, ${JSON.stringify(exampleOf(data))}`;
|
|
888
|
+
return [`${title} ${value}`];
|
|
889
|
+
}
|
|
890
|
+
function receiptText(receipt, options, extra) {
|
|
891
|
+
const headline = _nullishCoalesce(HEADLINES[receipt.status], () => ( receipt.status));
|
|
892
|
+
const sections = [
|
|
893
|
+
[
|
|
894
|
+
options.label ? `${headline}: ${options.label}` : headline,
|
|
895
|
+
...receipt.id ? [`Id: ${receipt.id}`] : [],
|
|
896
|
+
...receipt.credits !== null ? [
|
|
897
|
+
`Cost: ${receipt.credits} ${receipt.credits === 1 ? "credit" : "credits"}`
|
|
898
|
+
] : [],
|
|
899
|
+
...receipt.price ? [`Price: ${receipt.price}`] : []
|
|
900
|
+
]
|
|
901
|
+
];
|
|
902
|
+
const { csv, json } = receipt.outputs;
|
|
903
|
+
const data = [];
|
|
904
|
+
for (const artifact of csv) {
|
|
905
|
+
data.push(
|
|
906
|
+
`Rows: ${_nullishCoalesce(artifact.path, () => ( "stdout"))} (${artifact.rowCount} rows from ${listPath(_nullishCoalesce(artifact.source, () => ( ""))) || "the result"})`
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
if (extra.data !== void 0) {
|
|
910
|
+
const title = json ? `Result: ${_nullishCoalesce(json.path, () => ( "stdout"))}` : "Result (not saved; --json-out saves all of it):";
|
|
911
|
+
data.push(...resultLines(title, extra.data, extra.declared, options));
|
|
912
|
+
if (receipt.schemaFile) {
|
|
913
|
+
data.push(`Full JSON Schema: ${receipt.schemaFile}`);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
if (receipt.logsFile) data.push(`Logs: ${receipt.logsFile}`);
|
|
917
|
+
if (receipt.page) data.push(`Page: ${receipt.page}`);
|
|
918
|
+
if (data.length) sections.push(data);
|
|
919
|
+
const problems = [];
|
|
920
|
+
if (receipt.warnings.length) {
|
|
921
|
+
problems.push(
|
|
922
|
+
"Warnings:",
|
|
923
|
+
...receipt.warnings.map((warning) => ` - ${warning}`)
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
if (receipt.error) {
|
|
927
|
+
const error = receipt.error;
|
|
928
|
+
problems.push(
|
|
929
|
+
`Error: ${record(error) && typeof error.message === "string" ? error.message : JSON.stringify(error)}`
|
|
930
|
+
);
|
|
931
|
+
if (record(error) && typeof error.recoveryFile === "string") {
|
|
932
|
+
problems.push(
|
|
933
|
+
`The data was saved to ${error.recoveryFile}; do not run again.`
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
if (extra.ran === false) problems.push("Nothing ran.");
|
|
938
|
+
if (problems.length) sections.push(problems);
|
|
939
|
+
const next = Object.entries(receipt.next);
|
|
940
|
+
if (next.length) {
|
|
941
|
+
const width = Math.max(...next.map(([, command]) => command.length));
|
|
942
|
+
sections.push([
|
|
943
|
+
"Next:",
|
|
944
|
+
...next.map(
|
|
945
|
+
([key, command]) => NEXT_NOTES[key] ? ` ${command.padEnd(width)} # ${NEXT_NOTES[key]}` : ` ${command}`
|
|
946
|
+
)
|
|
947
|
+
]);
|
|
948
|
+
}
|
|
949
|
+
if (extra.receiptFile) {
|
|
950
|
+
sections.push([`JSON receipt: ${extra.receiptFile}`]);
|
|
951
|
+
}
|
|
952
|
+
return `${sections.map((lines) => lines.join("\n")).join("\n\n")}
|
|
953
|
+
`;
|
|
954
|
+
}
|
|
955
|
+
function columnsOf(rows) {
|
|
956
|
+
const columns = /* @__PURE__ */ new Set();
|
|
957
|
+
for (const row of rows) {
|
|
958
|
+
if (record(row)) for (const key of Object.keys(row)) columns.add(key);
|
|
959
|
+
}
|
|
960
|
+
return [...columns];
|
|
961
|
+
}
|
|
962
|
+
function resultLines(title, data, declared, options) {
|
|
963
|
+
if (options.full) {
|
|
964
|
+
const sources = (_nullishCoalesce(declared, () => ( []))).flatMap(
|
|
965
|
+
({ name, path }) => path ? [`${name} at ${path}`] : []
|
|
966
|
+
);
|
|
967
|
+
return [
|
|
968
|
+
...shapeLines(title, data),
|
|
969
|
+
...sources.length ? [`Declared outputs: ${sources.join(", ")}`] : []
|
|
970
|
+
];
|
|
971
|
+
}
|
|
972
|
+
const budget = _nullishCoalesce(options.lines, () => ( OUTLINE_LINES));
|
|
973
|
+
const indented = (lines) => lines.map((line) => ` ${line}`);
|
|
974
|
+
const more = "Not everything is shown: --lines <n> shows more, --fields <paths> picks fields, --full shows every field's type.";
|
|
975
|
+
if (_optionalChain([options, 'access', _13 => _13.fields, 'optionalAccess', _14 => _14.length])) {
|
|
976
|
+
const { value, missing } = pickFields(data, options.fields);
|
|
977
|
+
const outline2 = value === void 0 ? null : outlineLines(value, budget);
|
|
978
|
+
return [
|
|
979
|
+
`${title}${_optionalChain([outline2, 'optionalAccess', _15 => _15.note]) ? ` ${outline2.note}` : ""}`,
|
|
980
|
+
...indented(_nullishCoalesce(_optionalChain([outline2, 'optionalAccess', _16 => _16.lines]), () => ( []))),
|
|
981
|
+
...missing.map((path) => `No field at ${path}.`),
|
|
982
|
+
..._optionalChain([outline2, 'optionalAccess', _17 => _17.cut]) ? [more] : []
|
|
983
|
+
];
|
|
984
|
+
}
|
|
985
|
+
if (_optionalChain([declared, 'optionalAccess', _18 => _18.length])) {
|
|
986
|
+
const outline2 = outlineLines(
|
|
987
|
+
Object.fromEntries(declared.map(({ name, value }) => [name, value])),
|
|
988
|
+
budget
|
|
989
|
+
);
|
|
990
|
+
return [
|
|
991
|
+
title,
|
|
992
|
+
"Outputs, as the tool declares them:",
|
|
993
|
+
...indented(outline2.lines),
|
|
994
|
+
outline2.cut ? more : "--full shows every field of the result; --fields <paths> picks fields."
|
|
995
|
+
];
|
|
996
|
+
}
|
|
997
|
+
const outline = outlineLines(data, budget);
|
|
998
|
+
return [
|
|
999
|
+
`${title}${outline.note ? ` ${outline.note}` : ""}`,
|
|
1000
|
+
...indented(outline.lines),
|
|
1001
|
+
...outline.cut ? [more] : []
|
|
1002
|
+
];
|
|
1003
|
+
}
|
|
1004
|
+
function printReceipt(receipt, options, extra) {
|
|
1005
|
+
const text = options.receiptJson ? `${JSON.stringify(receipt, null, 2)}
|
|
1006
|
+
` : receiptText(receipt, options, extra);
|
|
1007
|
+
(dataOnStdout(options) ? process.stderr : process.stdout).write(text);
|
|
1008
|
+
}
|
|
1009
|
+
function openLogDestination(output) {
|
|
1010
|
+
if (output.logsOut === "-") {
|
|
1011
|
+
return (line) => process.stdout.write(`${line}
|
|
1012
|
+
`);
|
|
1013
|
+
}
|
|
1014
|
+
const path = _path.resolve.call(void 0,
|
|
1015
|
+
_nullishCoalesce(output.logsOut, () => ( _path.join.call(void 0, _fs.mkdtempSync.call(void 0, _path.join.call(void 0, _os.tmpdir.call(void 0, ), "deepline-logs-")), "logs.txt")))
|
|
1016
|
+
);
|
|
1017
|
+
_fs.writeFileSync.call(void 0, path, "", { flag: "wx", mode: 384 });
|
|
1018
|
+
output.logsFile = path;
|
|
1019
|
+
process.stderr.write(`Live logs: ${path}
|
|
1020
|
+
`);
|
|
1021
|
+
return (line) => _fs.appendFileSync.call(void 0, path, `${line}
|
|
1022
|
+
`);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
exports.addDescribeOptions = addDescribeOptions; exports.recordApiResponse = recordApiResponse; exports.recordPlayTermination = recordPlayTermination; exports.TABLE_EXPORT_ERROR_COLUMN = TABLE_EXPORT_ERROR_COLUMN; exports.tableExportHasFailedRows = tableExportHasFailedRows; exports.tableExportErrorCell = tableExportErrorCell; exports.underscoreKeysLast = underscoreKeysLast; exports.orderRunExportJson = orderRunExportJson; exports.writeRunDatasetCsv = writeRunDatasetCsv; exports.preflightExecutionOutput = preflightExecutionOutput; exports.outputCollections = outputCollections; exports.writeExecutionOutput = writeExecutionOutput; exports.openLogDestination = openLogDestination;
|