deepline 0.3.315 → 0.3.317
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/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/overview.ts +17 -10
- package/dist/bundling-sources/sdk/src/types.ts +6 -5
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +217 -488
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +4 -1
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +13 -4
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/live-events.ts +31 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +444 -51
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +22 -43
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +4 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +136 -87
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +24 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-errors.ts +94 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +5 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +20 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +18 -12
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +396 -35
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +123 -19
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +3 -2
- package/dist/cli/auth-XPLGQ2KO.js +31 -0
- package/dist/cli/{auth-OVWOO5NP.mjs → auth-YAHBE5WU.mjs} +4 -4
- package/dist/cli/{billing-W3OXKWNE.mjs → billing-AY4OS7MR.mjs} +4 -4
- package/dist/cli/{billing-SRZL7UOH.js → billing-ORZDEMH2.js} +70 -70
- package/dist/cli/{chunk-OJP4FCCX.js → chunk-2FKXFTOF.js} +48 -48
- package/dist/cli/{chunk-OJ243ZA5.js → chunk-2HKPAZVJ.js} +1 -1
- package/dist/cli/{chunk-LOWURQMF.js → chunk-342BTES3.js} +50 -50
- package/dist/cli/{chunk-FGAK6FET.js → chunk-3NRNDPAE.js} +26 -26
- package/dist/cli/{chunk-GK67FYMS.mjs → chunk-5BLF3HDM.mjs} +5 -5
- package/dist/cli/{chunk-TZ5KUDPP.mjs → chunk-5OFRM64Y.mjs} +1 -1
- package/dist/cli/{chunk-US4S3E4Y.mjs → chunk-7PZFGB7L.mjs} +1 -1
- package/dist/cli/{chunk-YL42TF53.js → chunk-AMJYFPFK.js} +6 -6
- package/dist/cli/{chunk-PPONZ6IE.js → chunk-AW355CLN.js} +15 -15
- package/dist/cli/{chunk-TQK662WG.js → chunk-BGBYK2T3.js} +60 -60
- package/dist/cli/{chunk-TQ3F77AC.mjs → chunk-CGGM4CE6.mjs} +3 -3
- package/dist/cli/{chunk-FTJQO757.mjs → chunk-D5MHSO5T.mjs} +1 -1
- package/dist/cli/{chunk-Y42UERUY.js → chunk-DSTUP75H.js} +6 -6
- package/dist/cli/{chunk-HNKHMHJ7.mjs → chunk-FRK2AGSG.mjs} +1 -1
- package/dist/cli/{chunk-OUIIYFG3.mjs → chunk-GX3WO4M4.mjs} +2 -2
- package/dist/cli/{chunk-OYJCNCUW.js → chunk-GYOLWON6.js} +2 -2
- package/dist/cli/{chunk-N5V2SBB2.mjs → chunk-KP7W5NO6.mjs} +1 -1
- package/dist/cli/{chunk-L5TSFCJ6.mjs → chunk-KXOXXVYJ.mjs} +2 -2
- package/dist/cli/{chunk-B473QUQU.mjs → chunk-L6ERGROE.mjs} +4 -4
- package/dist/cli/{chunk-R3IFZDJL.mjs → chunk-LI6YPPBR.mjs} +2 -2
- package/dist/cli/{chunk-IGE7EJJY.mjs → chunk-NDFBAMVI.mjs} +19 -15
- package/dist/cli/{chunk-JF4O5OMH.mjs → chunk-OTI562P3.mjs} +1 -1
- package/dist/cli/{chunk-AO4IWPP7.mjs → chunk-PSHIZP3K.mjs} +17 -15
- package/dist/cli/{chunk-VYK23G2C.js → chunk-QFKVAUIQ.js} +239 -235
- package/dist/cli/{chunk-AZWQJAQF.mjs → chunk-QPKHOZI3.mjs} +1 -1
- package/dist/cli/{chunk-URVZGYGG.js → chunk-SUPQQYGY.js} +4 -4
- package/dist/cli/{chunk-C5WSTXUB.js → chunk-TJ2V2JA3.js} +537 -535
- package/dist/cli/{chunk-6BJACIVK.js → chunk-UGQHYOT4.js} +1 -1
- package/dist/cli/{chunk-IALPYID6.js → chunk-XSEMQ4II.js} +3 -3
- package/dist/cli/{chunk-SNFSO2AN.js → chunk-Z5NRL7A7.js} +6 -6
- package/dist/cli/{client-WQ3J5BSH.mjs → client-QNLVLW54.mjs} +3 -3
- package/dist/cli/client-ZW5VAHWD.js +20 -0
- package/dist/cli/{csv-36ARCBNQ.mjs → csv-AKZASZP6.mjs} +3 -3
- package/dist/cli/{csv-CENMEWDH.js → csv-PW6S3SMJ.js} +12 -12
- package/dist/cli/{db-JU7XLKQM.mjs → db-DNF53LDS.mjs} +4 -4
- package/dist/cli/{db-6DQZG6NB.js → db-FLDYET2D.js} +20 -20
- package/dist/cli/{describe-VUD4AFBY.js → describe-JDAEOCYQ.js} +17 -17
- package/dist/cli/{describe-34ALEEFO.mjs → describe-U6RGIFMA.mjs} +10 -10
- package/dist/cli/{executions-H2UXS6FP.js → executions-DASCB6LS.js} +6 -6
- package/dist/cli/{executions-H66BMN6N.mjs → executions-W6BBU2HN.mjs} +4 -4
- package/dist/cli/{feedback-Q7LXXLSH.mjs → feedback-BVWPDWZG.mjs} +3 -3
- package/dist/cli/{feedback-YSYFQSAB.js → feedback-N3MBCT4A.js} +6 -6
- package/dist/cli/{git-XV43NSWN.mjs → git-4GJOKOLU.mjs} +4 -4
- package/dist/cli/git-WVHH3QXQ.js +23 -0
- package/dist/cli/index.js +171 -98
- package/dist/cli/index.mjs +114 -41
- package/dist/cli/{legacy-noops-Z2DTZQN3.mjs → legacy-noops-5XMSV7WL.mjs} +4 -4
- package/dist/cli/{legacy-noops-RGDW6SCA.js → legacy-noops-D7C7ZVKK.js} +7 -7
- package/dist/cli/{monitors-I75KZ2BP.js → monitors-NYP4LG3K.js} +85 -85
- package/dist/cli/{monitors-OFQ56O4S.mjs → monitors-Y4RKWAS5.mjs} +4 -4
- package/dist/cli/{org-75AH6RIB.js → org-PYKQMP6F.js} +60 -60
- package/dist/cli/{org-ZYMCU6XO.mjs → org-XZ26CUCV.mjs} +4 -4
- package/dist/cli/play-BYZCR4PP.js +152 -0
- package/dist/cli/{play-BKXM76DV.mjs → play-FYHIYZ3W.mjs} +9 -9
- package/dist/cli/{providers-GWG2WFIY.mjs → providers-3UG7NK55.mjs} +4 -4
- package/dist/cli/{providers-Z77MM7ID.js → providers-QS5X236G.js} +7 -7
- package/dist/cli/{quickstart-I4RECIQC.js → quickstart-GMASUT7T.js} +5 -5
- package/dist/cli/{quickstart-BGVIV374.mjs → quickstart-PHHHHHWO.mjs} +3 -3
- package/dist/cli/search-52CC3OVI.js +26 -0
- package/dist/cli/{search-TIKBP3RE.mjs → search-AVGITJP4.mjs} +5 -5
- package/dist/cli/{secrets-SNGRI4KS.js → secrets-HY5E6F6G.js} +13 -13
- package/dist/cli/{secrets-YCHKLWKC.mjs → secrets-RBEZRQ6P.mjs} +4 -4
- package/dist/cli/{sessions-WXLADGDX.js → sessions-7CDLWLVV.js} +5 -5
- package/dist/cli/{sessions-IRDG6ZRX.mjs → sessions-ME5R5FTG.mjs} +4 -4
- package/dist/cli/{settings-KZALJDXW.mjs → settings-X4JQLBB6.mjs} +7 -7
- package/dist/cli/{settings-72J4BVF6.js → settings-ZCVJPOFP.js} +74 -74
- package/dist/cli/{setup-FFB3KLFD.js → setup-DROGU6MC.js} +41 -41
- package/dist/cli/{setup-4KCA7ESV.mjs → setup-NEILS2UF.mjs} +6 -6
- package/dist/cli/skills-KUV3WWW5.js +28 -0
- package/dist/cli/{skills-MQZPYUQ3.mjs → skills-PC57GDXZ.mjs} +4 -4
- package/dist/cli/{tools-M3WKRZ5T.mjs → tools-IFJUWQC5.mjs} +6 -6
- package/dist/cli/tools-NHDAOQPB.js +38 -0
- package/dist/cli/update-DRWQCVXJ.js +28 -0
- package/dist/cli/{update-QJMNYGNF.mjs → update-N4HSH2TJ.mjs} +6 -6
- package/dist/cli/{workflow-6T2EUFCN.mjs → workflow-2OZBTUU2.mjs} +5 -5
- package/dist/cli/{workflow-35UUOZ5E.js → workflow-LP4Z6RF5.js} +15 -15
- package/dist/{client-Dh_4Ph1R.d.ts → client-BV68GMPo.d.ts} +7 -6
- package/dist/{client-CvpZsBqt.d.mts → client-D9ACjiRC.d.mts} +7 -6
- package/dist/{compiler-manifest-wOKNiXpa.d.mts → compiler-manifest-BXcZ4P4W.d.mts} +2 -2
- package/dist/{compiler-manifest-wOKNiXpa.d.ts → compiler-manifest-BXcZ4P4W.d.ts} +2 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/index.mjs +4 -4
- package/dist/install-integrity.json +82 -82
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/plays/bundle-play-file.mjs +2 -2
- 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/package.json +1 -1
- package/dist/cli/auth-P2TTZU36.js +0 -31
- package/dist/cli/client-CXFPFCIG.js +0 -20
- package/dist/cli/git-SYFCYIFP.js +0 -23
- package/dist/cli/play-OKXUWPMO.js +0 -152
- package/dist/cli/search-3KISUDDT.js +0 -26
- package/dist/cli/skills-XGOK4GRW.js +0 -28
- package/dist/cli/tools-LEAJ7EPW.js +0 -38
- package/dist/cli/update-ZN6LDUHS.js +0 -28
|
@@ -523,10 +523,24 @@ export function startRunLedgerOutboxRecovery(
|
|
|
523
523
|
/**
|
|
524
524
|
* Latency budget for the inline `run.created` attempt made by an admitting
|
|
525
525
|
* process after its Runtime Postgres commit. The whole attempt (claim, token,
|
|
526
|
-
* append, acknowledgement) must settle or be abandoned inside this bound
|
|
527
|
-
*
|
|
526
|
+
* append, acknowledgement) must settle or be abandoned inside this bound. An
|
|
527
|
+
* abandoned attempt then gets `RUN_CREATED_INLINE_RELEASE_GRACE_MS` to hand
|
|
528
|
+
* its lease back, so an admission response is never held longer than the two
|
|
529
|
+
* together for projection.
|
|
528
530
|
*/
|
|
529
531
|
export const RUN_CREATED_INLINE_DELIVERY_DEADLINE_MS = 1_500;
|
|
532
|
+
/**
|
|
533
|
+
* How long an abandoned inline attempt may keep its caller while it gives the
|
|
534
|
+
* lease back. The caller is the only owner of that release: a serverless
|
|
535
|
+
* invocation can be suspended as soon as the admitting request returns, and a
|
|
536
|
+
* release left running in the background then never lands. The row stays
|
|
537
|
+
* leased until `RUN_CREATED_INLINE_DELIVERY_LEASE_SECONDS` expires, and until
|
|
538
|
+
* then no other deliverer may claim it, so an API or CLI run waits behind its
|
|
539
|
+
* own `run.created` gate for about five seconds. One fresh checkout and one
|
|
540
|
+
* fenced UPDATE fit well inside this bound; if they do not, the lease expiry
|
|
541
|
+
* remains the fallback, exactly as before.
|
|
542
|
+
*/
|
|
543
|
+
export const RUN_CREATED_INLINE_RELEASE_GRACE_MS = 500;
|
|
530
544
|
/**
|
|
531
545
|
* The inline attempt's lease is the scheduler minimum. If the admitting
|
|
532
546
|
* process is frozen or killed mid-attempt, the durable projector can reclaim
|
|
@@ -545,9 +559,38 @@ export type RunCreatedInlineDeliveryOutcome =
|
|
|
545
559
|
* shared idempotency key made any duplicate ledger append a no-op.
|
|
546
560
|
*/
|
|
547
561
|
| { status: 'superseded'; durationMs: number }
|
|
548
|
-
|
|
562
|
+
/**
|
|
563
|
+
* The deadline elapsed. `leaseSettled` is true only when the abandoned
|
|
564
|
+
* attempt finished before this returned and holds no lease: its release
|
|
565
|
+
* statement completed, or it never took one. False means the lease, if one
|
|
566
|
+
* was taken, is left to expire: the release failed, the grace elapsed
|
|
567
|
+
* first, or the attempt itself failed. `attemptError` then names that
|
|
568
|
+
* failure's class, so a failed attempt that held nothing is not counted as
|
|
569
|
+
* a stranded lease.
|
|
570
|
+
*/
|
|
571
|
+
| {
|
|
572
|
+
status: 'timed_out';
|
|
573
|
+
durationMs: number;
|
|
574
|
+
leaseSettled: boolean;
|
|
575
|
+
attemptError?: string;
|
|
576
|
+
}
|
|
549
577
|
| { status: 'error'; durationMs: number; error: string };
|
|
550
578
|
|
|
579
|
+
const INLINE_ATTEMPT_ERROR_CLASS_MAX_CHARS = 80;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* A short, bounded label for a failed attempt: the error's name and, for a
|
|
583
|
+
* database error, its SQLSTATE. Never the message, which can carry run ids.
|
|
584
|
+
*/
|
|
585
|
+
function inlineAttemptErrorClass(error: unknown): string {
|
|
586
|
+
const name =
|
|
587
|
+
error instanceof Error && error.name.trim() ? error.name.trim() : 'Error';
|
|
588
|
+
const code = (error as { code?: unknown } | null | undefined)?.code;
|
|
589
|
+
const label =
|
|
590
|
+
typeof code === 'string' && code.trim() ? `${name}:${code.trim()}` : name;
|
|
591
|
+
return label.slice(0, INLINE_ATTEMPT_ERROR_CLASS_MAX_CHARS);
|
|
592
|
+
}
|
|
593
|
+
|
|
551
594
|
/**
|
|
552
595
|
* One bounded, idempotent attempt to deliver exactly `run-created:<runId>`
|
|
553
596
|
* from the admitting process, right after the admission commit.
|
|
@@ -561,8 +604,10 @@ export type RunCreatedInlineDeliveryOutcome =
|
|
|
561
604
|
* one ledger admission and one `delivered_at`. The projector remains the
|
|
562
605
|
* durable owner: every non-delivered outcome leaves the row pending for it.
|
|
563
606
|
*
|
|
564
|
-
* Never throws and never exceeds `deadlineMs
|
|
565
|
-
* append and releases its lease without charging a
|
|
607
|
+
* Never throws and never exceeds `deadlineMs` plus the release grace. A
|
|
608
|
+
* deadline abandons the append and releases its lease without charging a
|
|
609
|
+
* retry, and that release completes before this returns whenever it fits the
|
|
610
|
+
* grace: nothing else keeps the admitting invocation alive for it.
|
|
566
611
|
*/
|
|
567
612
|
export async function deliverRunCreatedOutboxEventInline(input: {
|
|
568
613
|
runId: string;
|
|
@@ -570,6 +615,8 @@ export async function deliverRunCreatedOutboxEventInline(input: {
|
|
|
570
615
|
schedulerOptions?: Pick<PostgresSchedulerOptions, 'schema'>;
|
|
571
616
|
tokenAuthority: RunLedgerOutboxTokenAuthority;
|
|
572
617
|
deadlineMs?: number;
|
|
618
|
+
/** Test seam; clamped to `RUN_CREATED_INLINE_RELEASE_GRACE_MS`. */
|
|
619
|
+
releaseGraceMs?: number;
|
|
573
620
|
now?: () => number;
|
|
574
621
|
}): Promise<RunCreatedInlineDeliveryOutcome> {
|
|
575
622
|
const now = input.now ?? Date.now;
|
|
@@ -582,11 +629,23 @@ export async function deliverRunCreatedOutboxEventInline(input: {
|
|
|
582
629
|
input.deadlineMs ?? RUN_CREATED_INLINE_DELIVERY_DEADLINE_MS,
|
|
583
630
|
),
|
|
584
631
|
);
|
|
632
|
+
const releaseGraceMs = Math.max(
|
|
633
|
+
1,
|
|
634
|
+
Math.min(
|
|
635
|
+
RUN_CREATED_INLINE_RELEASE_GRACE_MS,
|
|
636
|
+
input.releaseGraceMs ?? RUN_CREATED_INLINE_RELEASE_GRACE_MS,
|
|
637
|
+
),
|
|
638
|
+
);
|
|
585
639
|
const runId = input.runId.trim();
|
|
586
640
|
if (!runId) {
|
|
587
641
|
return { status: 'error', durationMs: 0, error: 'missing run id' };
|
|
588
642
|
}
|
|
589
643
|
const controller = new AbortController();
|
|
644
|
+
// What the abandoned attempt reported about its own tail.
|
|
645
|
+
const abandoned: { releaseFailed: boolean; errorClass: string | null } = {
|
|
646
|
+
releaseFailed: false,
|
|
647
|
+
errorClass: null,
|
|
648
|
+
};
|
|
590
649
|
const attempt = dispatchRunLedgerOutboxToLedgerBatchOnceWithClientScope(
|
|
591
650
|
input.withClient,
|
|
592
651
|
{
|
|
@@ -596,18 +655,28 @@ export async function deliverRunCreatedOutboxEventInline(input: {
|
|
|
596
655
|
leaseSeconds: RUN_CREATED_INLINE_DELIVERY_LEASE_SECONDS,
|
|
597
656
|
tokenAuthority: input.tokenAuthority,
|
|
598
657
|
signal: controller.signal,
|
|
658
|
+
onAbortedLeaseRelease: (released) => {
|
|
659
|
+
abandoned.releaseFailed = !released;
|
|
660
|
+
},
|
|
599
661
|
},
|
|
600
662
|
input.schedulerOptions ?? {},
|
|
601
663
|
).then(
|
|
602
664
|
(result): RunCreatedInlineDeliveryOutcome => {
|
|
603
|
-
if (result.attempted === 0) {
|
|
604
|
-
return { status: 'not_claimed', durationMs: elapsed() };
|
|
605
|
-
}
|
|
606
665
|
if (result.projected > 0) {
|
|
607
666
|
return { status: 'delivered', durationMs: elapsed() };
|
|
608
667
|
}
|
|
609
668
|
if (controller.signal.aborted) {
|
|
610
|
-
|
|
669
|
+
// Settled after the deadline without delivering. The lease was
|
|
670
|
+
// never taken or its release statement completed, unless the abort
|
|
671
|
+
// branch reported that the release could not run.
|
|
672
|
+
return {
|
|
673
|
+
status: 'timed_out',
|
|
674
|
+
durationMs: elapsed(),
|
|
675
|
+
leaseSettled: !abandoned.releaseFailed,
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
if (result.attempted === 0) {
|
|
679
|
+
return { status: 'not_claimed', durationMs: elapsed() };
|
|
611
680
|
}
|
|
612
681
|
if (result.failed === 0 && result.retrying === 0) {
|
|
613
682
|
return { status: 'superseded', durationMs: elapsed() };
|
|
@@ -617,28 +686,63 @@ export async function deliverRunCreatedOutboxEventInline(input: {
|
|
|
617
686
|
durationMs: elapsed(),
|
|
618
687
|
};
|
|
619
688
|
},
|
|
620
|
-
(error: unknown): RunCreatedInlineDeliveryOutcome =>
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
689
|
+
(error: unknown): RunCreatedInlineDeliveryOutcome => {
|
|
690
|
+
abandoned.errorClass = inlineAttemptErrorClass(error);
|
|
691
|
+
return {
|
|
692
|
+
status: 'error',
|
|
693
|
+
durationMs: elapsed(),
|
|
694
|
+
error: error instanceof Error ? error.message : String(error),
|
|
695
|
+
};
|
|
696
|
+
},
|
|
625
697
|
);
|
|
698
|
+
const DEADLINE = Symbol('deadline');
|
|
699
|
+
const GRACE = Symbol('grace');
|
|
626
700
|
let deadline: ReturnType<typeof setTimeout> | undefined;
|
|
627
|
-
|
|
701
|
+
let grace: ReturnType<typeof setTimeout> | undefined;
|
|
702
|
+
const deadlineElapsed = new Promise<typeof DEADLINE>((resolve) => {
|
|
628
703
|
deadline = setTimeout(() => {
|
|
629
|
-
// Abort the append
|
|
630
|
-
// release
|
|
704
|
+
// Abort the append. The attempt's own tail is a short, lease-fenced
|
|
705
|
+
// release; it cannot fail the caller.
|
|
631
706
|
controller.abort(
|
|
632
707
|
new Error('Inline run.created delivery deadline elapsed.'),
|
|
633
708
|
);
|
|
634
|
-
resolve(
|
|
709
|
+
resolve(DEADLINE);
|
|
635
710
|
}, deadlineMs);
|
|
636
711
|
deadline.unref?.();
|
|
637
712
|
});
|
|
638
713
|
try {
|
|
639
|
-
|
|
714
|
+
const first = await Promise.race([attempt, deadlineElapsed]);
|
|
715
|
+
if (first !== DEADLINE) return first;
|
|
716
|
+
// The attempt is abandoned, and this caller is the only owner of its
|
|
717
|
+
// release. Wait for that tail, bounded, instead of returning while the
|
|
718
|
+
// lease is still held: the admitting invocation may be suspended as soon
|
|
719
|
+
// as this resolves, which would strand the lease until it expires.
|
|
720
|
+
const graceElapsed = new Promise<typeof GRACE>((resolve) => {
|
|
721
|
+
grace = setTimeout(() => resolve(GRACE), releaseGraceMs);
|
|
722
|
+
grace.unref?.();
|
|
723
|
+
});
|
|
724
|
+
const tail = await Promise.race([attempt, graceElapsed]);
|
|
725
|
+
if (tail !== GRACE) {
|
|
726
|
+
// The acknowledgement was already in flight when the deadline fired.
|
|
727
|
+
if (tail.status === 'delivered') return tail;
|
|
728
|
+
// The attempt reported its own lease state (see the mapping above).
|
|
729
|
+
if (tail.status === 'timed_out') return tail;
|
|
730
|
+
}
|
|
731
|
+
// The grace elapsed with the tail still running, or the attempt failed.
|
|
732
|
+
// Either way nothing proves the lease was handed back, so it is reported
|
|
733
|
+
// as left to expire. A failed attempt names its error class, because it
|
|
734
|
+
// may have held no lease at all.
|
|
735
|
+
return {
|
|
736
|
+
status: 'timed_out',
|
|
737
|
+
durationMs: elapsed(),
|
|
738
|
+
leaseSettled: false,
|
|
739
|
+
...(tail !== GRACE && abandoned.errorClass
|
|
740
|
+
? { attemptError: abandoned.errorClass }
|
|
741
|
+
: {}),
|
|
742
|
+
};
|
|
640
743
|
} finally {
|
|
641
744
|
if (deadline) clearTimeout(deadline);
|
|
745
|
+
if (grace) clearTimeout(grace);
|
|
642
746
|
}
|
|
643
747
|
}
|
|
644
748
|
|
|
@@ -13,6 +13,19 @@ export const WORK_RECEIPT_KEY_FORMAT = {
|
|
|
13
13
|
separator: ':',
|
|
14
14
|
} as const;
|
|
15
15
|
|
|
16
|
+
/** Reserved scalar admission fact, distinct from customer-authored work output. */
|
|
17
|
+
export const RUNTIME_SHEET_WRITE_INTENT_RECEIPT_KIND =
|
|
18
|
+
'runtime-sheet-write-intent';
|
|
19
|
+
|
|
20
|
+
/** Keep internal sheet admission facts out of customer work-output projections. */
|
|
21
|
+
export function workReceiptOutputPredicateSql(keyColumn = 'k'): string {
|
|
22
|
+
const keySql = `convert_from(${keyColumn}, 'UTF8')`;
|
|
23
|
+
const intentPrefix = encodeURIComponent(
|
|
24
|
+
`["${RUNTIME_SHEET_WRITE_INTENT_RECEIPT_KIND}",`,
|
|
25
|
+
);
|
|
26
|
+
return `NOT (starts_with(${keySql}, '${WORK_RECEIPT_KEY_FORMAT.prefix}${WORK_RECEIPT_KEY_FORMAT.separator}') AND starts_with(split_part(${keySql}, '${WORK_RECEIPT_KEY_FORMAT.separator}', 4), '${intentPrefix}'))`;
|
|
27
|
+
}
|
|
28
|
+
|
|
16
29
|
export const WORK_RECEIPT_STATUS_CODE = {
|
|
17
30
|
queued: 0,
|
|
18
31
|
pending: 0,
|
|
@@ -117,6 +117,7 @@ export async function mintWorkflowExecutorToken(input: {
|
|
|
117
117
|
terminalContract?: DirectCompletedTerminalContract | null;
|
|
118
118
|
capabilities?: readonly RuntimeExecutionCapability[];
|
|
119
119
|
runtimeOrigin?: string | null;
|
|
120
|
+
runLedgerIngressPrefixOrigin?: string | null;
|
|
120
121
|
}) {
|
|
121
122
|
const playName = input.playName?.trim() || input.workflowId;
|
|
122
123
|
return mintWorkflowRunExecutionToken({
|
|
@@ -138,6 +139,7 @@ export async function mintWorkflowExecutorToken(input: {
|
|
|
138
139
|
terminalContract: input.terminalContract,
|
|
139
140
|
capabilities: input.capabilities,
|
|
140
141
|
runtimeOrigin: input.runtimeOrigin,
|
|
142
|
+
runLedgerIngressPrefixOrigin: input.runLedgerIngressPrefixOrigin,
|
|
141
143
|
});
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -1548,7 +1548,7 @@ export interface PlayAuthoringRuntimeContext {
|
|
|
1548
1548
|
): Promise<T>;
|
|
1549
1549
|
|
|
1550
1550
|
/**
|
|
1551
|
-
* Execute a guarded HTTP request. By default
|
|
1551
|
+
* Execute a guarded HTTP request. By default, completed responses are durably reused; `staleAfterSeconds` governs only that completed call receipt, never dataset/request identity. Failed requests do not publish completed cache entries. A headers timeout leaves an upstream write's outcome unknown and does not establish whether its body was sent. The transport does not automatically retry that timed-out write, but a later invocation can execute it again. Mutating requests require provider-supported idempotency with the same key retained across retries and replay. Deadlines are platform-controlled; callers may cancel through `init.signal`. Pass `{ transient: true }` for short-lived credential exchanges or other response data that must not be retained in a receipt or checkpoint. Edition 5+ throws `CtxFetchHttpError` for non-2xx; catch it only when the Play intentionally recovers, otherwise let it fail the Play. Editions 1–4 retain their previous response projections.
|
|
1552
1552
|
*
|
|
1553
1553
|
* @sdkReference runtime 170 ctx.fetch(key, url, init)
|
|
1554
1554
|
*/
|
|
@@ -3033,7 +3033,8 @@ export const PLAY_AUTHORING_FIELD_REGISTRY = {
|
|
|
3033
3033
|
required: false,
|
|
3034
3034
|
resolution: 'runtime-allowed',
|
|
3035
3035
|
issueCode: 'play_authoring_fetch_idempotency_required',
|
|
3036
|
-
description:
|
|
3036
|
+
description:
|
|
3037
|
+
'Required for mutating HTTP methods. The provider must support idempotency, and the same key must be retained across retries and replay.',
|
|
3037
3038
|
errorMessage: 'Idempotency-Key must be a non-empty string when provided.',
|
|
3038
3039
|
},
|
|
3039
3040
|
} as const satisfies Record<
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk2FKXFTOFjs = require('./chunk-2FKXFTOF.js');
|
|
13
|
+
require('./chunk-DSTUP75H.js');
|
|
14
|
+
require('./chunk-SUPQQYGY.js');
|
|
15
|
+
require('./chunk-XNYIZMNQ.js');
|
|
16
|
+
require('./chunk-UGQHYOT4.js');
|
|
17
|
+
require('./chunk-7P5AA3SN.js');
|
|
18
|
+
require('./chunk-OG64RBAC.js');
|
|
19
|
+
require('./chunk-COGTRVWW.js');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunk2FKXFTOFjs.EXIT_WORKSPACE_MISMATCH; exports.clearPendingClaim = _chunk2FKXFTOFjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunk2FKXFTOFjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunk2FKXFTOFjs.handleRegister; exports.handleStatus = _chunk2FKXFTOFjs.handleStatus; exports.handleWait = _chunk2FKXFTOFjs.handleWait; exports.readPendingAuthClaim = _chunk2FKXFTOFjs.readPendingAuthClaim; exports.registerAuthCommands = _chunk2FKXFTOFjs.registerAuthCommands; exports.reportSetupCompleted = _chunk2FKXFTOFjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunk2FKXFTOFjs.resolvePendingAuthClaimForResume;
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
registerAuthCommands,
|
|
10
10
|
reportSetupCompleted,
|
|
11
11
|
resolvePendingAuthClaimForResume
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-GX3WO4M4.mjs";
|
|
13
|
+
import "./chunk-FRK2AGSG.mjs";
|
|
14
|
+
import "./chunk-QPKHOZI3.mjs";
|
|
15
15
|
import "./chunk-DLIRSHV6.mjs";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-OTI562P3.mjs";
|
|
17
17
|
import "./chunk-NXGCO4JB.mjs";
|
|
18
18
|
import "./chunk-WZYKRD7T.mjs";
|
|
19
19
|
import "./chunk-KRD6H754.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeeplineClient,
|
|
3
3
|
iterateCursorPages
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NDFBAMVI.mjs";
|
|
5
5
|
import "./chunk-CBVIJSHF.mjs";
|
|
6
6
|
import {
|
|
7
7
|
createTimestampedName,
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
openInBrowser,
|
|
10
10
|
printCommandEnvelope,
|
|
11
11
|
shouldEmitJson
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FRK2AGSG.mjs";
|
|
13
13
|
import {
|
|
14
14
|
AuthError,
|
|
15
15
|
ConfigError
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QPKHOZI3.mjs";
|
|
17
17
|
import "./chunk-DLIRSHV6.mjs";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-OTI562P3.mjs";
|
|
19
19
|
import "./chunk-6IKARAYD.mjs";
|
|
20
20
|
import {
|
|
21
21
|
DeeplineError
|