deepline 0.3.484 → 0.3.485
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 +91 -30
- package/dist/bundling-sources/sdk/src/compat.ts +13 -0
- package/dist/bundling-sources/sdk/src/plays/client-core.ts +4 -1
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +143 -9
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +31 -4
- package/dist/bundling-sources/sdk/src/tool-calls.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +32 -3
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +126 -41
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +231 -25
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-runtime-config.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +130 -19
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +105 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +4 -2
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +194 -56
- package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +11 -6
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +30 -0
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +195 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +20 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +102 -23
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +9 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +25 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +133 -82
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +58 -16
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-sandbox-absence.ts +171 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +69 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +100 -40
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +5 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +6 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-errors.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-writer.ts +87 -31
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +204 -6
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +39 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +44 -15
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +60 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +649 -38
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +25 -33
- package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +21 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +1 -1
- package/dist/cli/auth-ABZBH55L.js +43 -0
- package/dist/cli/{auth-EBFOTF7X.mjs → auth-OWMUENCU.mjs} +5 -5
- package/dist/cli/{billing-G2G3EF3I.js → billing-2FMNQGOX.js} +80 -80
- package/dist/cli/{billing-2ZOIMW5V.mjs → billing-JX4H3VFF.mjs} +7 -7
- package/dist/cli/{chunk-M4PG7FGC.js → chunk-2ILND7XX.js} +2 -2
- package/dist/cli/{chunk-WXRM3UC6.mjs → chunk-2ZEQ43B7.mjs} +3 -3
- package/dist/cli/{chunk-PU52JXKA.mjs → chunk-3DBW6C7M.mjs} +13 -4
- package/dist/cli/{chunk-4OVHIWE7.mjs → chunk-3DYU3JQN.mjs} +2 -2
- package/dist/cli/{chunk-QIDDTIVZ.js → chunk-3OF7NSGR.js} +322 -294
- package/dist/cli/{chunk-YWC5AN26.mjs → chunk-3Z24NKW7.mjs} +62 -34
- package/dist/cli/{chunk-RLLEH2SP.js → chunk-5DCQWQCP.js} +26 -26
- package/dist/cli/{chunk-DEXSQGXB.mjs → chunk-62PJ6PK7.mjs} +5 -5
- package/dist/cli/{chunk-6NPWXE32.mjs → chunk-676NZ7K4.mjs} +1 -1
- package/dist/cli/{chunk-FRD5WFT4.js → chunk-775AZTO7.js} +323 -247
- package/dist/cli/{chunk-4OEOM6GP.mjs → chunk-ACTUAZYP.mjs} +5 -5
- package/dist/cli/{chunk-ZOKM7DVA.js → chunk-AFADYKFE.js} +8 -8
- package/dist/cli/{chunk-GVAENVIG.js → chunk-AUQQVDAB.js} +110 -21
- package/dist/cli/{chunk-U7IJAGWB.js → chunk-BSKPQB2P.js} +7 -7
- package/dist/cli/chunk-C6QWRSMQ.js +42 -0
- package/dist/cli/{chunk-AK7UKQ5R.js → chunk-CSBMKHTV.js} +5 -5
- package/dist/cli/{chunk-YHA3EV3I.mjs → chunk-CW6TAQBF.mjs} +15 -4
- package/dist/cli/{chunk-UT4YMA2N.js → chunk-DMNVM34J.js} +5 -4
- package/dist/cli/{chunk-XZXIWPT3.mjs → chunk-E73JXJA3.mjs} +1 -1
- package/dist/cli/{chunk-5KNRQWHE.js → chunk-EC2CVPN5.js} +3 -3
- package/dist/cli/{chunk-IXWQOVNW.js → chunk-ECIXZNSW.js} +87 -76
- package/dist/cli/{chunk-LTZXLYKE.mjs → chunk-FJY6K3BG.mjs} +93 -17
- package/dist/cli/{chunk-TRLDJNVE.mjs → chunk-G5PI3RNT.mjs} +1 -1
- package/dist/cli/{chunk-WYUCDLVR.mjs → chunk-GHHJWCMD.mjs} +2 -1
- package/dist/cli/{chunk-FQK7BULS.js → chunk-HKGXGGIV.js} +1 -1
- package/dist/cli/{chunk-2AWYJXBX.js → chunk-IHMYIHF4.js} +5 -5
- package/dist/cli/{chunk-SD7QWZTV.mjs → chunk-INW22YP7.mjs} +1 -1
- package/dist/cli/{chunk-OWUZKXE7.mjs → chunk-J7EENGKJ.mjs} +1 -1
- package/dist/cli/{chunk-TIRSKEZH.mjs → chunk-JD6HKNKD.mjs} +1 -1
- package/dist/cli/{chunk-OHKKDPA5.js → chunk-JQXUWYWX.js} +13 -13
- package/dist/cli/{chunk-EACX7QXO.mjs → chunk-KZTNNLIL.mjs} +2 -2
- package/dist/cli/{chunk-7K5CWKKZ.mjs → chunk-L352NOE3.mjs} +2 -2
- package/dist/cli/{chunk-KGOC6HGI.js → chunk-L7IQ3DFH.js} +53 -53
- package/dist/cli/{chunk-4IOY2SCQ.js → chunk-LOX3BISD.js} +4 -4
- package/dist/cli/{chunk-6GRZEYSG.js → chunk-NKPTM7SK.js} +7 -7
- package/dist/cli/{chunk-VEVGM6B5.js → chunk-NLRTFJGH.js} +14 -14
- package/dist/cli/{chunk-UKM74PAA.js → chunk-NRNWPWBW.js} +37 -37
- package/dist/cli/{chunk-HNRELVCS.mjs → chunk-ONONSV2Q.mjs} +96 -7
- package/dist/cli/{chunk-CYWBAV5H.js → chunk-OW4OTEFF.js} +16 -16
- package/dist/cli/{chunk-5K5CAND4.mjs → chunk-RZE5I2XJ.mjs} +4 -4
- package/dist/cli/{chunk-3XQIVEAT.js → chunk-S3WQJ5VG.js} +3 -3
- package/dist/cli/{chunk-4SFC2XUF.mjs → chunk-SR6S4EYG.mjs} +5 -5
- package/dist/cli/{chunk-UWOY74RU.js → chunk-T4G2T5DS.js} +21 -21
- package/dist/cli/{chunk-TN2GW57M.mjs → chunk-TMCC7ORQ.mjs} +1 -1
- package/dist/cli/{chunk-HEI3BWIV.mjs → chunk-TSCUWWTM.mjs} +1 -1
- package/dist/cli/{chunk-DBJ62RAO.js → chunk-TVW6USSG.js} +3 -3
- package/dist/cli/{chunk-NW4QJE54.js → chunk-U6WEGDD3.js} +2 -2
- package/dist/cli/{chunk-V7JCMBLU.mjs → chunk-UPHXGZCE.mjs} +4 -4
- package/dist/cli/{chunk-C62NI2X6.js → chunk-UQ3LQ6IF.js} +5 -5
- package/dist/cli/{chunk-5GOG5ZGC.mjs → chunk-VZYTLWOM.mjs} +2 -2
- package/dist/cli/{chunk-AF7MOUZP.mjs → chunk-W33OL4F2.mjs} +2 -2
- package/dist/cli/{chunk-ZM2YPJQJ.js → chunk-XK5DMLZE.js} +5 -1
- package/dist/cli/{chunk-LJ5747UC.mjs → chunk-XRDXNAAY.mjs} +5 -1
- package/dist/cli/{chunk-YGN77QA5.mjs → chunk-YDA3PMKK.mjs} +3 -3
- package/dist/cli/{csv-S3CHUKI6.js → csv-HFEQPGNY.js} +13 -13
- package/dist/cli/{csv-NLWVWD3H.mjs → csv-OHF3Y5KB.mjs} +4 -4
- package/dist/cli/{db-OGRPAEEM.mjs → db-M456OUXD.mjs} +7 -7
- package/dist/cli/{db-WBSKMMOH.js → db-VLQKCYQS.js} +28 -28
- package/dist/cli/describe-CP35DZ5Z.js +49 -0
- package/dist/cli/{describe-FAD3Z7LN.mjs → describe-M6VXFYVL.mjs} +21 -21
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/describe-core.js +4 -4
- package/dist/cli/describe-core.mjs +3 -3
- package/dist/cli/{executions-LYCL344R.mjs → executions-4FGRBPJF.mjs} +7 -7
- package/dist/cli/{executions-SOAZHCY4.js → executions-GKINJZI6.js} +9 -9
- package/dist/cli/{feedback-AVF6V7SV.mjs → feedback-D2WMGK3V.mjs} +4 -4
- package/dist/cli/{feedback-OROUPUNJ.js → feedback-ZH5K7WV7.js} +8 -8
- package/dist/cli/git-IDALMZDN.js +25 -0
- package/dist/cli/{git-J5N5M57H.mjs → git-OCIJ5ME4.mjs} +5 -5
- package/dist/cli/index.js +142 -139
- package/dist/cli/index.mjs +45 -42
- package/dist/cli/{legacy-noops-QAQMZMEG.js → legacy-noops-QNIVP7LO.js} +8 -8
- package/dist/cli/{legacy-noops-ENRRM7BL.mjs → legacy-noops-V6Q2X34P.mjs} +5 -5
- package/dist/cli/{monitors-CKQ65WRL.mjs → monitors-2USHTG5G.mjs} +8 -8
- package/dist/cli/{monitors-SFMQ5LFR.js → monitors-5DNK7W2K.js} +92 -92
- package/dist/cli/{org-3UNTDLT2.js → org-RPGM5AN4.js} +73 -73
- package/dist/cli/{org-K4UIEU5P.mjs → org-TL2YPYSE.mjs} +7 -7
- package/dist/cli/{pages-NKZTGB4C.js → pages-PNUKPFWV.js} +18 -18
- package/dist/cli/{pages-6GPGBIAH.mjs → pages-XDEW6EE3.mjs} +7 -7
- package/dist/cli/{play-BDEADESI.js → play-F5LHRKV5.js} +858 -632
- package/dist/cli/{play-62BEE7IX.mjs → play-WINNQ4HZ.mjs} +372 -146
- package/dist/cli/{providers-SXGP44GH.js → providers-BD4IS5U5.js} +10 -10
- package/dist/cli/{providers-X3CUWMFP.mjs → providers-PXGL3FRE.mjs} +7 -7
- package/dist/cli/{quickstart-XQ4426M4.js → quickstart-7LVF6HZF.js} +6 -6
- package/dist/cli/{quickstart-7LN22BKX.mjs → quickstart-XTH3UQWZ.mjs} +4 -4
- package/dist/cli/{run-XXSN3B5A.mjs → run-MBMUENR7.mjs} +26 -26
- package/dist/cli/{run-PBJ4ZJ4W.js → run-NH2BAWPA.js} +41 -41
- package/dist/cli/{search-M75VMADD.mjs → search-BMRWBV66.mjs} +8 -8
- package/dist/cli/search-R3MQJQMT.js +32 -0
- package/dist/cli/{search-output-F6HCFYEI.js → search-output-5NNT337U.js} +22 -16
- package/dist/cli/{search-output-NUQAKWDM.mjs → search-output-QKKRD4MF.mjs} +14 -8
- package/dist/cli/{secrets-J2H6V33R.mjs → secrets-AWEXBTJV.mjs} +7 -7
- package/dist/cli/{secrets-LRYY4QPE.js → secrets-KQSTOREN.js} +16 -16
- package/dist/cli/{sessions-YPF62CZE.js → sessions-DSPLZYCJ.js} +6 -6
- package/dist/cli/{sessions-IMT336UV.mjs → sessions-RO25Q67X.mjs} +5 -5
- package/dist/cli/{settings-35YYC5WA.js → settings-7JXIKNKI.js} +79 -79
- package/dist/cli/{settings-PDWVQIGH.mjs → settings-JMGXGK4Z.mjs} +12 -12
- package/dist/cli/{setup-UR7GOR7H.js → setup-5QFAQQRW.js} +47 -47
- package/dist/cli/{setup-DG5DISSE.mjs → setup-ZQZ47FHB.mjs} +9 -9
- package/dist/cli/skills-EDZXY7DV.js +33 -0
- package/dist/cli/{skills-U6NJD5J7.mjs → skills-W3H2DL56.mjs} +7 -7
- package/dist/cli/{tools-2HGEOELR.mjs → tools-2BZCVNBS.mjs} +19 -19
- package/dist/cli/tools-2EY2ETCZ.js +56 -0
- package/dist/cli/{update-FRAYBAHK.mjs → update-GAWYMGAW.mjs} +9 -9
- package/dist/cli/update-UKDQKNBY.js +33 -0
- package/dist/cli/{workflow-DDKVTF36.mjs → workflow-M6LLHQ2I.mjs} +8 -8
- package/dist/cli/{workflow-JKKLOMBX.js → workflow-ZPTDFPKW.js} +18 -18
- package/dist/{client-DJ3r8VQJ.d.mts → client-BkbDHRIg.d.mts} +1 -1
- package/dist/{client-JPSNljtj.d.ts → client-D3hVHXjK.d.ts} +1 -1
- package/dist/{client-core-3SJlNsKU.d.mts → client-core-BZoSMKcY.d.mts} +30 -15
- package/dist/{client-core-rCoQ5Xz3.d.ts → client-core-DUdVqO_m.d.ts} +30 -15
- package/dist/{compiler-manifest-gkO9ZkVg.d.mts → compiler-manifest-BFTwq1HI.d.mts} +1 -1
- package/dist/{compiler-manifest-gkO9ZkVg.d.ts → compiler-manifest-BFTwq1HI.d.ts} +1 -1
- package/dist/{errors-Cc92LKH-.d.ts → errors-c3pMsylw.d.ts} +1 -1
- package/dist/{errors-CeCCOKSA.d.mts → errors-w31ybrQM.d.mts} +1 -1
- package/dist/{index-DJQKdV76.d.ts → index-CQ-15-QL.d.ts} +1 -1
- package/dist/{index-DsqWJL3Q.d.mts → index-DvNtxucX.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +10 -10
- package/dist/index.mjs +7 -7
- package/dist/install-integrity.json +117 -116
- 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 -2
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/plays/run-request.js +12 -2
- package/dist/plays/run-request.mjs +11 -1
- 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 +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/package.json +1 -1
- package/dist/cli/auth-L5CSV3UO.js +0 -43
- package/dist/cli/chunk-KA2LNIUP.js +0 -33
- package/dist/cli/describe-UIAYCHWW.js +0 -49
- package/dist/cli/git-ATMWC27D.js +0 -25
- package/dist/cli/search-IGHLRLBD.js +0 -32
- package/dist/cli/skills-4U5WC4MJ.js +0 -33
- package/dist/cli/tools-PYJTQVVS.js +0 -56
- package/dist/cli/update-344OTRFM.js +0 -33
|
@@ -176,18 +176,22 @@ import {
|
|
|
176
176
|
isPlayRunPackage,
|
|
177
177
|
mintStagedPlayFileUploads,
|
|
178
178
|
normalizePlayRunStart,
|
|
179
|
+
CLI_PLAY_RUN_CALLER_INTENT_V2_START_STREAM_PATH,
|
|
179
180
|
CLI_PLAY_RUN_START_STREAM_PATH,
|
|
181
|
+
CliPlayAdmissionCallerIntentV2UnsupportedError,
|
|
180
182
|
CLI_PLAY_RUN_SUPPORTED_HEADER,
|
|
181
183
|
CliPlayAdmissionUnsupportedError,
|
|
182
184
|
PLAY_RUN_START_STREAM_PATH,
|
|
183
185
|
stagePlayFiles,
|
|
184
186
|
preparePlayRunAdmission,
|
|
187
|
+
submitPreparedPlayRunAdmission,
|
|
185
188
|
readPlayRunAdmissionCapability,
|
|
186
189
|
type MintStagedFileUpload,
|
|
187
190
|
type PlayRunAdmissionCapability,
|
|
188
191
|
type PlayRunStartOptions,
|
|
189
192
|
type ResolvedStartPlayRunRequest,
|
|
190
193
|
} from './plays/run-request';
|
|
194
|
+
import { SDK_API_MAJOR } from './version';
|
|
191
195
|
import type { PlayCompilerManifest } from '../../shared_libs/plays/compiler-manifest.js';
|
|
192
196
|
import type { EnrichCompiledConfig } from './cli/enrich-play-compiler';
|
|
193
197
|
import { COORDINATOR_INTERNAL_TOKEN_HEADER } from '../../shared_libs/play-runtime/coordinator-headers.js';
|
|
@@ -3596,36 +3600,80 @@ export class DeeplineClient {
|
|
|
3596
3600
|
*/
|
|
3597
3601
|
async preparePlayRunAdmission(
|
|
3598
3602
|
request: StartPlayRunRequest,
|
|
3599
|
-
options?:
|
|
3600
|
-
cliAdmission?: boolean;
|
|
3601
|
-
/** @internal Capability response prefetched by the CLI during local preparation. */
|
|
3602
|
-
admissionCapability?:
|
|
3603
|
-
| Promise<PlayRunAdmissionCapability>
|
|
3604
|
-
| PlayRunAdmissionCapability;
|
|
3605
|
-
onSubmission?: (intent: {
|
|
3606
|
-
workflowId: string;
|
|
3607
|
-
orgId: string;
|
|
3608
|
-
request: Record<string, unknown>;
|
|
3609
|
-
}) => void | Promise<void>;
|
|
3610
|
-
},
|
|
3603
|
+
options?: PlayRunStartOptions,
|
|
3611
3604
|
) {
|
|
3612
3605
|
const resolved = resolveStartPlayRunRequest(request, this.environment);
|
|
3613
3606
|
const prepared = await preparePlayRunAdmission(
|
|
3614
3607
|
this.http,
|
|
3615
3608
|
resolved.request,
|
|
3616
3609
|
options?.onSubmission,
|
|
3617
|
-
|
|
3618
|
-
...(options && Object.hasOwn(options, 'admissionCapability')
|
|
3619
|
-
? { admissionCapability: options.admissionCapability }
|
|
3620
|
-
: {}),
|
|
3621
|
-
},
|
|
3610
|
+
options,
|
|
3622
3611
|
);
|
|
3623
3612
|
const bodyJson = JSON.stringify(prepared.body);
|
|
3624
|
-
const
|
|
3613
|
+
const runtimeHeaders = runtimeSelectionHeaders(
|
|
3614
|
+
resolved.runtime,
|
|
3615
|
+
this.environment,
|
|
3616
|
+
);
|
|
3617
|
+
const headers = options?.cliAdmission
|
|
3618
|
+
? {
|
|
3619
|
+
...runtimeHeaders,
|
|
3620
|
+
'X-Deepline-API-Major': String(SDK_API_MAJOR),
|
|
3621
|
+
}
|
|
3622
|
+
: runtimeHeaders;
|
|
3625
3623
|
const http = this.http;
|
|
3626
3624
|
let submitted = false;
|
|
3627
3625
|
return {
|
|
3628
3626
|
...prepared,
|
|
3627
|
+
async start(
|
|
3628
|
+
startOptions?: Pick<PlayRunStartOptions, 'cliAdmission' | 'signal'>,
|
|
3629
|
+
) {
|
|
3630
|
+
if (submitted && !prepared.supportsCallerIntent) {
|
|
3631
|
+
throw new DeeplineError(
|
|
3632
|
+
'This server has not enabled caller-owned admission recovery. Do not retry an ambiguous start.',
|
|
3633
|
+
409,
|
|
3634
|
+
'PLAY_RUN_ADMISSION_RECOVERY_UNSUPPORTED',
|
|
3635
|
+
);
|
|
3636
|
+
}
|
|
3637
|
+
if (submitted) {
|
|
3638
|
+
// Re-prove the pinned intent before retrying. Caller-intent v2 is
|
|
3639
|
+
// checked by the versioned POST response itself; legacy admission
|
|
3640
|
+
// uses the capability reader.
|
|
3641
|
+
if (!options?.callerIntentV2) {
|
|
3642
|
+
await preparePlayRunAdmission(
|
|
3643
|
+
http,
|
|
3644
|
+
JSON.parse(bodyJson) as ResolvedStartPlayRunRequest,
|
|
3645
|
+
undefined,
|
|
3646
|
+
{ signal: startOptions?.signal ?? options?.signal },
|
|
3647
|
+
);
|
|
3648
|
+
}
|
|
3649
|
+
}
|
|
3650
|
+
submitted = true;
|
|
3651
|
+
try {
|
|
3652
|
+
return await submitPreparedPlayRunAdmission(
|
|
3653
|
+
http,
|
|
3654
|
+
JSON.parse(bodyJson) as Record<string, unknown>,
|
|
3655
|
+
prepared.workflowId,
|
|
3656
|
+
prepared.supportsCallerIntent,
|
|
3657
|
+
headers,
|
|
3658
|
+
{
|
|
3659
|
+
cliAdmission: startOptions?.cliAdmission ?? options?.cliAdmission,
|
|
3660
|
+
callerIntentV2: options?.callerIntentV2,
|
|
3661
|
+
signal: startOptions?.signal ?? options?.signal,
|
|
3662
|
+
},
|
|
3663
|
+
);
|
|
3664
|
+
} catch (error) {
|
|
3665
|
+
if (
|
|
3666
|
+
error instanceof CliPlayAdmissionUnsupportedError ||
|
|
3667
|
+
error instanceof CliPlayAdmissionCallerIntentV2UnsupportedError
|
|
3668
|
+
) {
|
|
3669
|
+
// These errors are raised only after an authoritative 404/405
|
|
3670
|
+
// from the admission route, so the fallback route cannot create
|
|
3671
|
+
// a second run.
|
|
3672
|
+
submitted = false;
|
|
3673
|
+
}
|
|
3674
|
+
throw error;
|
|
3675
|
+
}
|
|
3676
|
+
},
|
|
3629
3677
|
async *startStream(streamOptions?: { signal?: AbortSignal }) {
|
|
3630
3678
|
if (submitted && !prepared.supportsCallerIntent) {
|
|
3631
3679
|
throw new DeeplineError(
|
|
@@ -3638,17 +3686,21 @@ export class DeeplineClient {
|
|
|
3638
3686
|
// A later transport attempt may reach a rolled-back server or a
|
|
3639
3687
|
// different workspace. Re-prove support for the pinned intent,
|
|
3640
3688
|
// without rebuilding it or persisting another submission journal.
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3689
|
+
if (!options?.callerIntentV2) {
|
|
3690
|
+
await preparePlayRunAdmission(
|
|
3691
|
+
http,
|
|
3692
|
+
JSON.parse(bodyJson) as ResolvedStartPlayRunRequest,
|
|
3693
|
+
undefined,
|
|
3694
|
+
{ signal: streamOptions?.signal },
|
|
3695
|
+
);
|
|
3696
|
+
}
|
|
3647
3697
|
}
|
|
3648
3698
|
submitted = true;
|
|
3649
|
-
const streamPath = options?.
|
|
3650
|
-
?
|
|
3651
|
-
:
|
|
3699
|
+
const streamPath = options?.callerIntentV2
|
|
3700
|
+
? CLI_PLAY_RUN_CALLER_INTENT_V2_START_STREAM_PATH
|
|
3701
|
+
: options?.cliAdmission
|
|
3702
|
+
? CLI_PLAY_RUN_START_STREAM_PATH
|
|
3703
|
+
: PLAY_RUN_START_STREAM_PATH;
|
|
3652
3704
|
let cliAdmissionSupported = false;
|
|
3653
3705
|
try {
|
|
3654
3706
|
for await (const event of http.streamSse<PlayLiveEvent>(streamPath, {
|
|
@@ -3676,6 +3728,13 @@ export class DeeplineClient {
|
|
|
3676
3728
|
error instanceof DeeplineError &&
|
|
3677
3729
|
(error.statusCode === 404 || error.statusCode === 405)
|
|
3678
3730
|
) {
|
|
3731
|
+
if (options.callerIntentV2) {
|
|
3732
|
+
submitted = false;
|
|
3733
|
+
throw new CliPlayAdmissionCallerIntentV2UnsupportedError(
|
|
3734
|
+
error.statusCode,
|
|
3735
|
+
);
|
|
3736
|
+
}
|
|
3737
|
+
submitted = false;
|
|
3679
3738
|
throw new CliPlayAdmissionUnsupportedError(error.statusCode);
|
|
3680
3739
|
}
|
|
3681
3740
|
throw error;
|
|
@@ -3689,8 +3748,10 @@ export class DeeplineClient {
|
|
|
3689
3748
|
* preparation so the network round trip can overlap with compilation.
|
|
3690
3749
|
* @internal
|
|
3691
3750
|
*/
|
|
3692
|
-
async prefetchPlayRunAdmissionCapability(
|
|
3693
|
-
|
|
3751
|
+
async prefetchPlayRunAdmissionCapability(options?: {
|
|
3752
|
+
signal?: AbortSignal;
|
|
3753
|
+
}): Promise<PlayRunAdmissionCapability> {
|
|
3754
|
+
return readPlayRunAdmissionCapability(this.http, options);
|
|
3694
3755
|
}
|
|
3695
3756
|
|
|
3696
3757
|
/**
|
|
@@ -4206,7 +4267,7 @@ export class DeeplineClient {
|
|
|
4206
4267
|
*/
|
|
4207
4268
|
async getPlayStatus(
|
|
4208
4269
|
workflowId: string,
|
|
4209
|
-
options?: { billing?: boolean; full?: boolean },
|
|
4270
|
+
options?: { billing?: boolean; full?: boolean; runStatus?: boolean },
|
|
4210
4271
|
): Promise<PlayStatus> {
|
|
4211
4272
|
return this.playClient.getPlayStatus(workflowId, options);
|
|
4212
4273
|
}
|
|
@@ -378,6 +378,8 @@ export async function checkSdkCompatibility(
|
|
|
378
378
|
timeoutMs?: number;
|
|
379
379
|
/** Disable cache writes and invalidation for commands that permit no local maintenance. */
|
|
380
380
|
persistCache?: boolean;
|
|
381
|
+
/** Stop this check when the enclosing CLI operation reaches its deadline. */
|
|
382
|
+
signal?: AbortSignal;
|
|
381
383
|
/** Optional read-only catalog result carried by the same live check. */
|
|
382
384
|
catalog?: {
|
|
383
385
|
toolId: string;
|
|
@@ -394,6 +396,9 @@ export async function checkSdkCompatibility(
|
|
|
394
396
|
return { response: null, error: null };
|
|
395
397
|
}
|
|
396
398
|
const controller = new AbortController();
|
|
399
|
+
const abortFromCaller = () => controller.abort(options.signal?.reason);
|
|
400
|
+
if (options.signal?.aborted) abortFromCaller();
|
|
401
|
+
else options.signal?.addEventListener('abort', abortFromCaller, { once: true });
|
|
397
402
|
const timeout = setTimeout(
|
|
398
403
|
() => controller.abort(),
|
|
399
404
|
options.timeoutMs ?? CHECK_TIMEOUT_MS,
|
|
@@ -439,6 +444,7 @@ export async function checkSdkCompatibility(
|
|
|
439
444
|
const raw = (await response.json().catch(() => null)) as
|
|
440
445
|
| (SdkCompatibilityResponse & { catalog_metadata?: unknown })
|
|
441
446
|
| null;
|
|
447
|
+
options.signal?.throwIfAborted();
|
|
442
448
|
// Only a policy-shaped body counts as a response. A JSON error page from
|
|
443
449
|
// a proxy is a failed check: it is never cached, and it falls through to
|
|
444
450
|
// the cached-policy fallback below like a network error would.
|
|
@@ -469,6 +475,12 @@ export async function checkSdkCompatibility(
|
|
|
469
475
|
}
|
|
470
476
|
return { response: data, error: null };
|
|
471
477
|
} catch (error) {
|
|
478
|
+
if (options.signal?.aborted) {
|
|
479
|
+
return {
|
|
480
|
+
response: null,
|
|
481
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
482
|
+
};
|
|
483
|
+
}
|
|
472
484
|
// Live compat policy must win when the server is reachable: rollback and
|
|
473
485
|
// support-floor changes are blocking controls. The cache is only a
|
|
474
486
|
// resilience fallback for transient network failures.
|
|
@@ -497,6 +509,7 @@ export async function checkSdkCompatibility(
|
|
|
497
509
|
};
|
|
498
510
|
} finally {
|
|
499
511
|
clearTimeout(timeout);
|
|
512
|
+
options.signal?.removeEventListener('abort', abortFromCaller);
|
|
500
513
|
}
|
|
501
514
|
}
|
|
502
515
|
|
|
@@ -331,7 +331,7 @@ export class PlayClient {
|
|
|
331
331
|
|
|
332
332
|
async getPlayStatus(
|
|
333
333
|
workflowId: string,
|
|
334
|
-
options?: { billing?: boolean; full?: boolean },
|
|
334
|
+
options?: { billing?: boolean; full?: boolean; runStatus?: boolean },
|
|
335
335
|
): Promise<PlayStatus> {
|
|
336
336
|
const params = new URLSearchParams();
|
|
337
337
|
if (options?.billing === false) {
|
|
@@ -343,6 +343,9 @@ export class PlayClient {
|
|
|
343
343
|
const query = params.size > 0 ? `?${params.toString()}` : '';
|
|
344
344
|
const response = await this.http.get<Record<string, unknown>>(
|
|
345
345
|
`/api/v2/runs/${encodeURIComponent(workflowId)}${query}`,
|
|
346
|
+
options?.runStatus === true
|
|
347
|
+
? { headers: { 'x-deepline-run-status': '1' } }
|
|
348
|
+
: undefined,
|
|
346
349
|
);
|
|
347
350
|
return normalizePlayStatus(response);
|
|
348
351
|
}
|
|
@@ -34,9 +34,13 @@ export { DeeplineError };
|
|
|
34
34
|
/** Canonical admission; the CLI adapter adds compatibility before this handler. */
|
|
35
35
|
export const PLAY_RUN_START_PATH = '/api/v2/plays/run';
|
|
36
36
|
export const CLI_PLAY_RUN_START_PATH = `${PLAY_RUN_START_PATH}/cli`;
|
|
37
|
+
export const CLI_PLAY_RUN_CALLER_INTENT_V2_PATH = `${CLI_PLAY_RUN_START_PATH}/caller-intent-v2`;
|
|
37
38
|
export const CLI_PLAY_RUN_SUPPORTED_HEADER = 'x-deepline-cli-play-admission';
|
|
39
|
+
export const CLI_PLAY_RUN_CALLER_INTENT_V2_SUPPORTED_HEADER =
|
|
40
|
+
'x-deepline-cli-play-caller-intent-v2';
|
|
38
41
|
export const PLAY_RUN_START_STREAM_PATH = `${PLAY_RUN_START_PATH}?stream=true`;
|
|
39
42
|
export const CLI_PLAY_RUN_START_STREAM_PATH = `${CLI_PLAY_RUN_START_PATH}?stream=true`;
|
|
43
|
+
export const CLI_PLAY_RUN_CALLER_INTENT_V2_START_STREAM_PATH = `${CLI_PLAY_RUN_CALLER_INTENT_V2_PATH}?stream=true`;
|
|
40
44
|
export const PLAY_FILES_STAGE_PATH = '/api/v2/plays/files/stage';
|
|
41
45
|
export const PLAY_FILES_STAGE_MINT_PATH = `${PLAY_FILES_STAGE_PATH}/mint`;
|
|
42
46
|
|
|
@@ -85,15 +89,52 @@ export type ResolvedStartPlayRunRequest = StartPlayRunRequest;
|
|
|
85
89
|
|
|
86
90
|
export type PlayRunStartOptions = {
|
|
87
91
|
signal?: AbortSignal;
|
|
92
|
+
/** @internal Deadline for CLI admission preparation and intent persistence. */
|
|
93
|
+
deadlineAt?: number;
|
|
94
|
+
/** @internal Capability read that may overlap with local Play compilation. */
|
|
95
|
+
admissionCapability?:
|
|
96
|
+
| Promise<PlayRunAdmissionCapability>
|
|
97
|
+
| PlayRunAdmissionCapability;
|
|
88
98
|
onSubmission?: (intent: {
|
|
89
99
|
workflowId: string;
|
|
90
100
|
orgId: string;
|
|
91
101
|
request: Record<string, unknown>;
|
|
92
102
|
}) => void | Promise<void>;
|
|
93
|
-
/** @internal CLI
|
|
103
|
+
/** @internal CLI Play admission checks compatibility in the same request. */
|
|
94
104
|
cliAdmission?: boolean;
|
|
105
|
+
/** @internal Uses the versioned CLI route to avoid a separate capability GET. */
|
|
106
|
+
callerIntentV2?: boolean;
|
|
95
107
|
};
|
|
96
108
|
|
|
109
|
+
async function awaitWithAbort<T>(
|
|
110
|
+
value: PromiseLike<T> | T,
|
|
111
|
+
signal?: AbortSignal,
|
|
112
|
+
): Promise<T> {
|
|
113
|
+
if (!signal) return await value;
|
|
114
|
+
signal.throwIfAborted();
|
|
115
|
+
|
|
116
|
+
let removeAbortListener = () => {};
|
|
117
|
+
const aborted = new Promise<never>((_resolve, reject) => {
|
|
118
|
+
const onAbort = () => {
|
|
119
|
+
reject(
|
|
120
|
+
signal.reason ??
|
|
121
|
+
Object.assign(new Error('Play admission was aborted.'), {
|
|
122
|
+
name: 'AbortError',
|
|
123
|
+
}),
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
127
|
+
removeAbortListener = () => signal.removeEventListener('abort', onAbort);
|
|
128
|
+
if (signal.aborted) onAbort();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
try {
|
|
132
|
+
return await Promise.race([Promise.resolve(value), aborted]);
|
|
133
|
+
} finally {
|
|
134
|
+
removeAbortListener();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
97
138
|
/** Only the transport can prove that the named action never dispatched. */
|
|
98
139
|
export class CliPlayAdmissionUnsupportedError extends DeeplineError {
|
|
99
140
|
constructor(status: number) {
|
|
@@ -105,6 +146,17 @@ export class CliPlayAdmissionUnsupportedError extends DeeplineError {
|
|
|
105
146
|
}
|
|
106
147
|
}
|
|
107
148
|
|
|
149
|
+
/** The route is absent, so no request reached an admission handler. */
|
|
150
|
+
export class CliPlayAdmissionCallerIntentV2UnsupportedError extends DeeplineError {
|
|
151
|
+
constructor(status: number) {
|
|
152
|
+
super(
|
|
153
|
+
'This server does not support versioned CLI Play admission.',
|
|
154
|
+
status,
|
|
155
|
+
'CLI_PLAY_CALLER_INTENT_V2_UNSUPPORTED',
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
108
160
|
/** The exact JSON body `POST /api/v2/plays/run` receives. Key order is part of the contract. */
|
|
109
161
|
export function buildPlayRunStartBody(
|
|
110
162
|
request: ResolvedStartPlayRunRequest,
|
|
@@ -196,6 +248,8 @@ export async function preparePlayRunAdmission(
|
|
|
196
248
|
}) => void | Promise<void>,
|
|
197
249
|
options?: {
|
|
198
250
|
signal?: AbortSignal;
|
|
251
|
+
deadlineAt?: number;
|
|
252
|
+
callerIntentV2?: boolean;
|
|
199
253
|
admissionCapability?:
|
|
200
254
|
| Promise<PlayRunAdmissionCapability>
|
|
201
255
|
| PlayRunAdmissionCapability;
|
|
@@ -205,17 +259,39 @@ export async function preparePlayRunAdmission(
|
|
|
205
259
|
workflowId?: string;
|
|
206
260
|
supportsCallerIntent: boolean;
|
|
207
261
|
}> {
|
|
262
|
+
const assertAdmissionActive = () => {
|
|
263
|
+
options?.signal?.throwIfAborted();
|
|
264
|
+
if (options?.deadlineAt !== undefined && Date.now() >= options.deadlineAt) {
|
|
265
|
+
const error = new Error('Play admission exceeded its wait deadline.');
|
|
266
|
+
error.name = 'AbortError';
|
|
267
|
+
throw error;
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
const callerIntentV2 = options?.callerIntentV2 === true;
|
|
271
|
+
if (
|
|
272
|
+
callerIntentV2 &&
|
|
273
|
+
(onSubmission || request.maxTotalCredits !== undefined)
|
|
274
|
+
) {
|
|
275
|
+
throw new DeeplineError(
|
|
276
|
+
'Versioned CLI Play admission requires a new, unjournaled run without a strict total budget.',
|
|
277
|
+
409,
|
|
278
|
+
'CLI_PLAY_CALLER_INTENT_V2_INELIGIBLE',
|
|
279
|
+
);
|
|
280
|
+
}
|
|
208
281
|
// The reader ships before the writer. An older route ignores workflowId;
|
|
209
282
|
// that response cannot prove an identity can be reused safely after a timeout.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
283
|
+
assertAdmissionActive();
|
|
284
|
+
const capability = callerIntentV2
|
|
285
|
+
? null
|
|
286
|
+
: options && Object.hasOwn(options, 'admissionCapability')
|
|
287
|
+
? await awaitWithAbort(options.admissionCapability, options.signal)
|
|
213
288
|
: await readPlayRunAdmissionCapability(http, options);
|
|
214
289
|
const supportsCallerIntent =
|
|
215
|
-
capability?.admissionContract === 'caller-intent-v1';
|
|
216
|
-
|
|
290
|
+
callerIntentV2 || capability?.admissionContract === 'caller-intent-v1';
|
|
291
|
+
assertAdmissionActive();
|
|
217
292
|
if (
|
|
218
293
|
supportsCallerIntent &&
|
|
294
|
+
!callerIntentV2 &&
|
|
219
295
|
(!capability?.orgId ||
|
|
220
296
|
(request.admissionOrgId && request.admissionOrgId !== capability.orgId))
|
|
221
297
|
) {
|
|
@@ -265,7 +341,9 @@ export async function preparePlayRunAdmission(
|
|
|
265
341
|
JSON.stringify(
|
|
266
342
|
buildPlayRunStartBody({
|
|
267
343
|
...request,
|
|
268
|
-
...(supportsCallerIntent
|
|
344
|
+
...(supportsCallerIntent && !callerIntentV2
|
|
345
|
+
? { admissionOrgId: capability!.orgId }
|
|
346
|
+
: {}),
|
|
269
347
|
}),
|
|
270
348
|
),
|
|
271
349
|
) as Record<string, unknown>;
|
|
@@ -292,6 +370,9 @@ export async function preparePlayRunAdmission(
|
|
|
292
370
|
'PLAY_RUN_ADMISSION_RECOVERY_UNSUPPORTED',
|
|
293
371
|
);
|
|
294
372
|
}
|
|
373
|
+
// A slow capability read must not persist a recoverable intent after the
|
|
374
|
+
// caller's wait deadline has already elapsed.
|
|
375
|
+
assertAdmissionActive();
|
|
295
376
|
await onSubmission({
|
|
296
377
|
workflowId,
|
|
297
378
|
orgId: capability.orgId,
|
|
@@ -355,29 +436,70 @@ export async function startPlayRun(
|
|
|
355
436
|
options?.onSubmission,
|
|
356
437
|
options,
|
|
357
438
|
);
|
|
439
|
+
return submitPreparedPlayRunAdmission(
|
|
440
|
+
http,
|
|
441
|
+
submittedBody,
|
|
442
|
+
workflowId,
|
|
443
|
+
supportsCallerIntent,
|
|
444
|
+
headers,
|
|
445
|
+
options,
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** Submit a body prepared once, so an ambiguous retry can keep its identity. */
|
|
450
|
+
export async function submitPreparedPlayRunAdmission(
|
|
451
|
+
http: PlayRunHttp,
|
|
452
|
+
submittedBody: Record<string, unknown>,
|
|
453
|
+
workflowId: string | undefined,
|
|
454
|
+
supportsCallerIntent: boolean,
|
|
455
|
+
headers?: Record<string, string>,
|
|
456
|
+
options?: Pick<
|
|
457
|
+
PlayRunStartOptions,
|
|
458
|
+
'cliAdmission' | 'callerIntentV2' | 'signal'
|
|
459
|
+
>,
|
|
460
|
+
): Promise<PlayRunStart> {
|
|
358
461
|
let cliAdmissionSupported = false;
|
|
462
|
+
let callerIntentV2Supported = false;
|
|
359
463
|
let response: Record<string, unknown>;
|
|
360
464
|
try {
|
|
361
465
|
response = await http.post<Record<string, unknown>>(
|
|
362
|
-
options?.
|
|
466
|
+
options?.callerIntentV2
|
|
467
|
+
? CLI_PLAY_RUN_CALLER_INTENT_V2_PATH
|
|
468
|
+
: options?.cliAdmission
|
|
469
|
+
? CLI_PLAY_RUN_START_PATH
|
|
470
|
+
: PLAY_RUN_START_PATH,
|
|
363
471
|
submittedBody,
|
|
364
472
|
headers,
|
|
365
473
|
{
|
|
366
474
|
maxRetries: 0,
|
|
367
475
|
exactUrlOnly: true,
|
|
368
476
|
...(options?.signal ? { signal: options.signal } : {}),
|
|
369
|
-
...(options?.cliAdmission
|
|
477
|
+
...(options?.cliAdmission || options?.callerIntentV2
|
|
370
478
|
? {
|
|
371
479
|
onResponse: (response: Response) => {
|
|
372
480
|
cliAdmissionSupported =
|
|
373
481
|
response.headers.get(CLI_PLAY_RUN_SUPPORTED_HEADER) ===
|
|
374
482
|
'true';
|
|
483
|
+
callerIntentV2Supported =
|
|
484
|
+
response.headers.get(
|
|
485
|
+
CLI_PLAY_RUN_CALLER_INTENT_V2_SUPPORTED_HEADER,
|
|
486
|
+
) === 'true';
|
|
375
487
|
},
|
|
376
488
|
}
|
|
377
489
|
: {}),
|
|
378
490
|
},
|
|
379
491
|
);
|
|
380
492
|
} catch (error) {
|
|
493
|
+
if (
|
|
494
|
+
options?.callerIntentV2 &&
|
|
495
|
+
!callerIntentV2Supported &&
|
|
496
|
+
error instanceof DeeplineError &&
|
|
497
|
+
(error.statusCode === 404 || error.statusCode === 405)
|
|
498
|
+
) {
|
|
499
|
+
throw new CliPlayAdmissionCallerIntentV2UnsupportedError(
|
|
500
|
+
error.statusCode,
|
|
501
|
+
);
|
|
502
|
+
}
|
|
381
503
|
if (
|
|
382
504
|
options?.cliAdmission &&
|
|
383
505
|
!cliAdmissionSupported &&
|
|
@@ -419,6 +541,18 @@ export async function startPlayRun(
|
|
|
419
541
|
}
|
|
420
542
|
throw error;
|
|
421
543
|
}
|
|
544
|
+
if (options?.callerIntentV2 && !callerIntentV2Supported) {
|
|
545
|
+
throw new DeeplineError(
|
|
546
|
+
'The versioned CLI Play admission response did not prove its contract. Inspect this run before submitting again.',
|
|
547
|
+
undefined,
|
|
548
|
+
'PLAY_RUN_ADMISSION_CONTRACT_UNKNOWN',
|
|
549
|
+
{
|
|
550
|
+
...(workflowId ? { runId: workflowId, workflowId } : {}),
|
|
551
|
+
admissionState: 'unknown',
|
|
552
|
+
recoverySupported: supportsCallerIntent,
|
|
553
|
+
},
|
|
554
|
+
);
|
|
555
|
+
}
|
|
422
556
|
const started = normalizePlayRunStart(response);
|
|
423
557
|
if (
|
|
424
558
|
options?.cliAdmission &&
|
|
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
|
|
|
205
205
|
// getters keep their established compatibility behavior.
|
|
206
206
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
207
207
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
208
|
-
version: '0.3.
|
|
208
|
+
version: '0.3.485',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -11,8 +11,11 @@ import { isTransientPlayRunReadError } from './read-errors';
|
|
|
11
11
|
|
|
12
12
|
/** Steady-state cadence for the small authenticated REST snapshot. */
|
|
13
13
|
export const RUN_WATCH_POLL_INTERVAL_MS = 2_000;
|
|
14
|
-
|
|
14
|
+
// Keep terminal detection responsive during short Plays; long runs use the
|
|
15
|
+
// two-second steady-state cadence below.
|
|
16
|
+
const RUN_WATCH_STARTUP_POLL_INTERVAL_MS = 300;
|
|
15
17
|
const RUN_WATCH_STARTUP_WINDOW_MS = 6_000;
|
|
18
|
+
export const TERMINAL_LOG_PROJECTION_RETRY_LIMIT = 3;
|
|
16
19
|
|
|
17
20
|
type WatchHttp = {
|
|
18
21
|
get<T = unknown>(
|
|
@@ -207,13 +210,13 @@ export async function* watchRunEvents(
|
|
|
207
210
|
let consecutiveFailures = 0;
|
|
208
211
|
let outageNoticeSent = false;
|
|
209
212
|
let pollCount = 0;
|
|
213
|
+
let terminalLogProjectionRetries = 0;
|
|
210
214
|
|
|
211
215
|
while (!signal?.aborted) {
|
|
212
216
|
const pollStartedAt = Date.now();
|
|
213
217
|
const poll = ++pollCount;
|
|
214
|
-
// Keep
|
|
215
|
-
//
|
|
216
|
-
// after Daytona finishes starting a fresh sandbox.
|
|
218
|
+
// Keep terminal detection responsive through the sandbox startup window,
|
|
219
|
+
// then reduce snapshot reads for runs that continue beyond it.
|
|
217
220
|
const pollIntervalMs =
|
|
218
221
|
options.pollIntervalMs ??
|
|
219
222
|
(pollStartedAt - watchStartedAt < RUN_WATCH_STARTUP_WINDOW_MS
|
|
@@ -301,6 +304,30 @@ export async function* watchRunEvents(
|
|
|
301
304
|
}
|
|
302
305
|
consecutiveFailures = 0;
|
|
303
306
|
|
|
307
|
+
// Lifecycle and canonical log projections advance independently. Retry the
|
|
308
|
+
// terminal log projection briefly, then let authoritative terminal status
|
|
309
|
+
// close the watcher with logsUnavailable still visible on the snapshot.
|
|
310
|
+
const terminalLogsPending =
|
|
311
|
+
isTerminalPlayRunLiveStatus(snapshot.status) &&
|
|
312
|
+
snapshot.logsUnavailable &&
|
|
313
|
+
!options.omitTerminalLogs;
|
|
314
|
+
if (terminalLogsPending) {
|
|
315
|
+
if (terminalLogProjectionRetries < TERMINAL_LOG_PROJECTION_RETRY_LIMIT) {
|
|
316
|
+
terminalLogProjectionRetries += 1;
|
|
317
|
+
const remaining = Math.max(
|
|
318
|
+
0,
|
|
319
|
+
pollIntervalMs - (Date.now() - pollStartedAt),
|
|
320
|
+
);
|
|
321
|
+
if (!(await waitForNextPoll(remaining, signal))) return;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
options.onNotice?.(
|
|
325
|
+
`[watch] terminal status is complete, but final logs are unavailable in this watch; fetch retained logs with deepline runs logs ${runId}`,
|
|
326
|
+
);
|
|
327
|
+
} else {
|
|
328
|
+
terminalLogProjectionRetries = 0;
|
|
329
|
+
}
|
|
330
|
+
|
|
304
331
|
// Give the consumer the same durable status it would otherwise fetch
|
|
305
332
|
// before emitting terminal events that cause that serial HTTP request.
|
|
306
333
|
if (terminalStatus) {
|
|
@@ -161,7 +161,7 @@ export type ExecuteToolRawOptions = {
|
|
|
161
161
|
export type ExecutionRecovery = {
|
|
162
162
|
/** Stable caller key used to resume or replay this execution. */
|
|
163
163
|
idempotencyKey: string;
|
|
164
|
-
/**
|
|
164
|
+
/** State of the provider execution and its durable receipt. */
|
|
165
165
|
state: 'running' | 'completed' | 'outcome_unknown';
|
|
166
166
|
/** Whether this response came from an existing durable execution. */
|
|
167
167
|
replayed: boolean;
|
|
@@ -193,7 +193,13 @@ export interface ToolPricingSummary {
|
|
|
193
193
|
* Largest single charge any call to this tool settled in the trailing
|
|
194
194
|
* window. A recorded worst case, not a rate, quote, or ceiling.
|
|
195
195
|
*/
|
|
196
|
-
observedMax?: {
|
|
196
|
+
observedMax?: {
|
|
197
|
+
creditsPerCall: number;
|
|
198
|
+
windowDays: number;
|
|
199
|
+
/** Mean charge and the number of charges it covers, when counted. */
|
|
200
|
+
avgCreditsPerCall?: number;
|
|
201
|
+
sampleCount?: number;
|
|
202
|
+
};
|
|
197
203
|
}
|
|
198
204
|
|
|
199
205
|
/** A discoverable provider, returned by {@link DeeplineClient.listProviders}. */
|
|
@@ -174,18 +174,35 @@ export const RuntimeSheetColumns = {
|
|
|
174
174
|
input: SheetIdentity & {
|
|
175
175
|
rows:
|
|
176
176
|
| readonly Record<string, unknown>[]
|
|
177
|
-
| ((
|
|
177
|
+
| ((
|
|
178
|
+
inferableFields: readonly string[],
|
|
179
|
+
) => Promise<readonly Record<string, unknown>[]>);
|
|
178
180
|
columns: readonly PhysicalSheetColumnProjection[];
|
|
179
181
|
/** Opt in only when the caller can roll back and restart the whole transaction. */
|
|
180
182
|
lockMode?: WriteLockMode;
|
|
181
183
|
},
|
|
182
184
|
): Promise<RuntimeSheetColumnTypes> {
|
|
183
185
|
await lock(client, input, input.lockMode);
|
|
184
|
-
const rows =
|
|
185
|
-
typeof input.rows === 'function' ? await input.rows() : input.rows;
|
|
186
186
|
const columns = new Map(
|
|
187
187
|
(await inspect(client, input)).map((column) => [column.name, column]),
|
|
188
188
|
);
|
|
189
|
+
const inferableFields = [
|
|
190
|
+
...new Set(
|
|
191
|
+
input.columns.flatMap((projection) => {
|
|
192
|
+
const column = columns.get(projection.sqlName);
|
|
193
|
+
return column?.marker === UNDECIDED || column?.marker === NATIVE
|
|
194
|
+
? [projection.fieldName]
|
|
195
|
+
: [];
|
|
196
|
+
}),
|
|
197
|
+
),
|
|
198
|
+
];
|
|
199
|
+
// Always evaluate accepted rows, including when no fields need inference.
|
|
200
|
+
// The Adapter owns the acceptance predicate and may lock those rows; its
|
|
201
|
+
// row count also determines whether missing columns must fail loudly.
|
|
202
|
+
const rows =
|
|
203
|
+
typeof input.rows === 'function'
|
|
204
|
+
? await input.rows(inferableFields)
|
|
205
|
+
: input.rows;
|
|
189
206
|
for (const projection of rows.length > 0 ? input.columns : []) {
|
|
190
207
|
const column = columns.get(projection.sqlName);
|
|
191
208
|
if (!column)
|
|
@@ -262,6 +279,18 @@ export const RuntimeSheetColumns = {
|
|
|
262
279
|
);
|
|
263
280
|
},
|
|
264
281
|
|
|
282
|
+
/** Project inference inputs without changing accepted-row cardinality. */
|
|
283
|
+
jsonTypeEvidenceSql(input: {
|
|
284
|
+
jsonExpression: string;
|
|
285
|
+
fieldsExpression: string;
|
|
286
|
+
}): string {
|
|
287
|
+
return `COALESCE((
|
|
288
|
+
SELECT jsonb_object_agg(column_type_fields.field, (${input.jsonExpression}) -> column_type_fields.field)
|
|
289
|
+
FROM unnest(${input.fieldsExpression}) AS column_type_fields(field)
|
|
290
|
+
WHERE (${input.jsonExpression}) ? column_type_fields.field
|
|
291
|
+
), '{}'::jsonb)`;
|
|
292
|
+
},
|
|
293
|
+
|
|
265
294
|
jsonValueSql(
|
|
266
295
|
jsonExpression: string,
|
|
267
296
|
tableReference: string,
|