deepline 0.3.480 → 0.3.481
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 +35 -1
- package/dist/bundling-sources/sdk/src/http-core.ts +2 -0
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +54 -31
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/legacy-radar-forward-routes.ts +569 -0
- package/dist/bundling-sources/shared_libs/monitors/legacy-radar-retirement.ts +451 -0
- package/dist/bundling-sources/shared_libs/monitors/package.json +5 -1
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-array-input-receipts.ts +13 -6
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +125 -22
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +16 -53
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +34 -48
- package/dist/bundling-sources/shared_libs/security/receipt-admission-token.ts +44 -0
- package/dist/cli/auth-EQWYBNIE.js +43 -0
- package/dist/cli/{auth-KMKFQX7X.mjs → auth-FYY65LYD.mjs} +5 -5
- package/dist/cli/{billing-G3Y5FTQM.mjs → billing-3MELYUTI.mjs} +7 -7
- package/dist/cli/{billing-R5RCTEW6.js → billing-TROHWBSE.js} +80 -80
- package/dist/cli/{chunk-4V6KEXCM.js → chunk-27BYXQU4.js} +1 -1
- package/dist/cli/{chunk-OQOXR6JL.js → chunk-4CIVXXSU.js} +26 -26
- package/dist/cli/{chunk-RPJSVGSC.js → chunk-5ONCPLWC.js} +16 -16
- package/dist/cli/{chunk-K7E2DO5P.js → chunk-6VKDKATO.js} +53 -53
- package/dist/cli/{chunk-WQBJHB63.js → chunk-6WWBVWFQ.js} +7 -7
- package/dist/cli/{chunk-LLEBPM3N.mjs → chunk-6ZMUAASO.mjs} +4 -4
- package/dist/cli/{chunk-IQ6WL36K.mjs → chunk-75LUK4E5.mjs} +1 -1
- package/dist/cli/{chunk-AKCYZDBO.mjs → chunk-7VVC4RZX.mjs} +1 -1
- package/dist/cli/{chunk-JBQKBDDN.mjs → chunk-ASQJUUGB.mjs} +5 -5
- package/dist/cli/{chunk-DIDWIPMA.mjs → chunk-BJ5UFTWL.mjs} +28 -7
- package/dist/cli/{chunk-JH77OHD5.js → chunk-BJMEXKZY.js} +2 -2
- package/dist/cli/{chunk-53LLOGNV.mjs → chunk-C7UIUKW6.mjs} +2 -2
- package/dist/cli/{chunk-LHU6BMDV.js → chunk-CM3KC74A.js} +3 -3
- package/dist/cli/{chunk-XNXE7YWI.mjs → chunk-CS2P3EQS.mjs} +2 -2
- package/dist/cli/{chunk-APFFHSPL.js → chunk-CUSWZTS7.js} +8 -8
- package/dist/cli/{chunk-6AYQK7Z6.js → chunk-D3UHG54V.js} +199 -178
- package/dist/cli/{chunk-PM2CT7HZ.mjs → chunk-EJTU6X6C.mjs} +3 -3
- package/dist/cli/{chunk-FZX2DGQZ.js → chunk-EPEAQA6O.js} +37 -37
- package/dist/cli/{chunk-57MJL2HU.mjs → chunk-EPZSX7FZ.mjs} +4 -4
- package/dist/cli/{chunk-FZ42SO3Q.mjs → chunk-FXLMDAAY.mjs} +1 -1
- package/dist/cli/chunk-GBAT5NMI.mjs +789 -0
- package/dist/cli/{chunk-VPO2D7WV.js → chunk-GJOKFJ2Y.js} +10 -10
- package/dist/cli/{chunk-JDMR33HS.js → chunk-GVAENVIG.js} +28 -19
- package/dist/cli/{chunk-NELMCOWK.mjs → chunk-HNRELVCS.mjs} +27 -18
- package/dist/cli/{chunk-SUTQCM7U.mjs → chunk-HXG7TYRS.mjs} +2 -2
- package/dist/cli/{chunk-PDDUX5UY.js → chunk-J4D3PCQ2.js} +5 -5
- package/dist/cli/{chunk-PC42DFZC.mjs → chunk-JE27DTQM.mjs} +3 -3
- package/dist/cli/{chunk-MEJJD7PA.js → chunk-KDU6TSGE.js} +2 -2
- package/dist/cli/{chunk-NVTVS4AV.js → chunk-KPXP2DIY.js} +7 -9
- package/dist/cli/chunk-KQSTV4MW.js +789 -0
- package/dist/cli/{chunk-2AYWC63S.mjs → chunk-LISZBUA7.mjs} +2 -2
- package/dist/cli/{chunk-44TVNYYV.mjs → chunk-LTOY2GUJ.mjs} +10 -10
- package/dist/cli/{chunk-OGXG46LY.js → chunk-MKDWU3ZI.js} +93 -93
- package/dist/cli/{chunk-MTMOYZMK.mjs → chunk-N5267HEH.mjs} +1 -1
- package/dist/cli/{chunk-T7EWDIVM.mjs → chunk-PDJS6LFI.mjs} +2 -1
- package/dist/cli/{chunk-QEV3GFDS.js → chunk-R4EFW2I2.js} +3 -3
- package/dist/cli/{chunk-KQNQCZLB.mjs → chunk-RV2GB7KW.mjs} +2 -2
- package/dist/cli/{chunk-PYIWO4GS.mjs → chunk-S5BM6NPJ.mjs} +3 -5
- package/dist/cli/{chunk-7LMLHUCP.mjs → chunk-S5WXSC3P.mjs} +5 -5
- package/dist/cli/{chunk-63QH6FL3.mjs → chunk-SOGLBLMH.mjs} +4 -4
- package/dist/cli/{chunk-5IVGZCKY.js → chunk-SVPM2E2U.js} +5 -5
- package/dist/cli/{chunk-ZSWY5E3W.mjs → chunk-UUGSZZZH.mjs} +1 -1
- package/dist/cli/{chunk-TBJ23WKT.js → chunk-VBDR2DP6.js} +3 -3
- package/dist/cli/{chunk-TXFURKHD.mjs → chunk-VRAOWHXJ.mjs} +1 -1
- package/dist/cli/{chunk-ASARTL6E.mjs → chunk-VTKAIGW6.mjs} +3 -3
- package/dist/cli/{chunk-DQYJXVAF.js → chunk-WF5QE2IW.js} +17 -16
- package/dist/cli/{chunk-NBXG4S2X.js → chunk-WICQQ7GY.js} +53 -53
- package/dist/cli/{chunk-FFSOXQEM.js → chunk-WTWRZ5ZI.js} +8 -8
- package/dist/cli/{chunk-LBZLV6QF.js → chunk-X4XZFIK6.js} +14 -14
- package/dist/cli/{chunk-A3PZKD47.js → chunk-X6MEQBAT.js} +21 -21
- package/dist/cli/{csv-P3AEI4G4.mjs → csv-2EG7JW7V.mjs} +4 -4
- package/dist/cli/{csv-57D62T7L.js → csv-OUALOZBF.js} +13 -13
- package/dist/cli/{db-FWFYU34R.js → db-7BTOI6YB.js} +28 -28
- package/dist/cli/{db-PJQMPZJP.mjs → db-ECDQWI2Y.mjs} +7 -7
- package/dist/cli/describe-EXSH6OZD.js +48 -0
- package/dist/cli/{describe-F57VZZML.mjs → describe-KO6WKQIB.mjs} +18 -18
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/{executions-ZAJGMAAT.mjs → executions-3VMFBZT4.mjs} +7 -7
- package/dist/cli/{executions-YBT7NTY5.js → executions-VZSG3F3E.js} +9 -9
- package/dist/cli/{feedback-YLYY2EG4.js → feedback-ASKBWRXR.js} +8 -8
- package/dist/cli/{feedback-L3ZQCSY6.mjs → feedback-SN7AVALN.mjs} +4 -4
- package/dist/cli/{git-M7735NWJ.mjs → git-W2DZXEAY.mjs} +5 -5
- package/dist/cli/git-X2XUKYYX.js +25 -0
- package/dist/cli/index.js +167 -144
- package/dist/cli/index.mjs +73 -50
- package/dist/cli/{legacy-noops-TX37UP3U.js → legacy-noops-6KOC6LV7.js} +8 -8
- package/dist/cli/{legacy-noops-PKNMQMGY.mjs → legacy-noops-R2SML7ED.mjs} +5 -5
- package/dist/cli/{monitors-U7AUIOFZ.mjs → monitors-4VGZGJBT.mjs} +8 -8
- package/dist/cli/{monitors-5YTGQSGD.js → monitors-OJXDYU4G.js} +92 -92
- package/dist/cli/{org-N6DSSLLD.js → org-AELMZFUT.js} +73 -73
- package/dist/cli/{org-SRKZRVVH.mjs → org-UGN5ZG2Y.mjs} +7 -7
- package/dist/cli/{pages-YPN54RCC.js → pages-L26N7MK3.js} +18 -18
- package/dist/cli/{pages-UOPJUFCF.mjs → pages-ZYPAAYSS.mjs} +7 -7
- package/dist/cli/{play-4IK4WXWU.mjs → play-ENYB7X4S.mjs} +125 -53
- package/dist/cli/{play-MEYZEYOV.js → play-VTZWB3N5.js} +620 -548
- package/dist/cli/{providers-UGHUYP4C.mjs → providers-BZQTVAQG.mjs} +7 -7
- package/dist/cli/{providers-VS5MK4ZH.js → providers-HWBY6MGQ.js} +10 -10
- package/dist/cli/{quickstart-GW2ERQ2A.js → quickstart-D54IJ3PX.js} +6 -6
- package/dist/cli/{quickstart-YBOQSLFV.mjs → quickstart-SSQJDWPB.mjs} +4 -4
- package/dist/cli/{run-IVGMLY3J.js → run-45NKE7UY.js} +37 -37
- package/dist/cli/{run-44JT5GJM.mjs → run-FR3TPYT3.mjs} +23 -23
- package/dist/cli/{search-43NY73VR.mjs → search-CZCWSR5L.mjs} +8 -8
- package/dist/cli/search-V2GJKQQQ.js +32 -0
- package/dist/cli/{secrets-DABUD3B7.js → secrets-KJ5ZEDWT.js} +16 -16
- package/dist/cli/{secrets-ONDQGW3B.mjs → secrets-KKK55B4Y.mjs} +7 -7
- package/dist/cli/{sessions-AIAKKLSR.mjs → sessions-2YKA54PH.mjs} +5 -5
- package/dist/cli/{sessions-4ILQMBKR.js → sessions-QCNPUTDZ.js} +6 -6
- package/dist/cli/{settings-HSGKYOJT.mjs → settings-4NI2AS5V.mjs} +12 -12
- package/dist/cli/{settings-BWNLL7TP.js → settings-KM3LCPWD.js} +79 -79
- package/dist/cli/{setup-LE4OVH4M.mjs → setup-BZF3M54I.mjs} +9 -9
- package/dist/cli/{setup-37QOD4UT.js → setup-V5MTS2AA.js} +47 -47
- package/dist/cli/skills-CRFYW767.js +33 -0
- package/dist/cli/{skills-A3ZVR2YX.mjs → skills-NXYNB3LP.mjs} +7 -7
- package/dist/cli/{tools-ITKPPUDT.mjs → tools-57MWFRIZ.mjs} +17 -17
- package/dist/cli/tools-Q662HPVJ.js +55 -0
- package/dist/cli/{update-XJOSCOK5.mjs → update-QM6H677U.mjs} +9 -9
- package/dist/cli/update-TYHKF7F5.js +33 -0
- package/dist/cli/{workflow-KYQYFSND.mjs → workflow-NHYDIUWY.mjs} +8 -8
- package/dist/cli/{workflow-LERZ3TYV.js → workflow-TGEC4ITO.js} +18 -18
- package/dist/{client-B9N1bcGc.d.mts → client-DJ3r8VQJ.d.mts} +1 -1
- package/dist/{client-Btw075Hq.d.ts → client-JPSNljtj.d.ts} +1 -1
- package/dist/{client-core-TulbIeRB.d.mts → client-core-3SJlNsKU.d.mts} +21 -2
- package/dist/{client-core-DvGWlwtX.d.ts → client-core-rCoQ5Xz3.d.ts} +21 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -10
- package/dist/index.mjs +7 -7
- package/dist/install-integrity.json +106 -104
- package/dist/plays/bundle-play-file.mjs +5426 -12
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/plays/run-request.js +4 -2
- package/dist/plays/run-request.mjs +3 -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 +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/package.json +1 -1
- package/dist/cli/auth-7FOB243B.js +0 -43
- package/dist/cli/chunk-7UFFWPQ2.js +0 -6188
- package/dist/cli/chunk-ZBSUXXZS.mjs +0 -6188
- package/dist/cli/describe-ZAYUBNUQ.js +0 -48
- package/dist/cli/git-A3433UTN.js +0 -25
- package/dist/cli/search-2XTYY7BF.js +0 -32
- package/dist/cli/skills-TULQXRQJ.js +0 -33
- package/dist/cli/tools-QYYBWDXU.js +0 -55
- package/dist/cli/update-XSMY7KWH.js +0 -33
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts
CHANGED
|
@@ -72,9 +72,7 @@ import {
|
|
|
72
72
|
RuntimeResourceFenceLostError,
|
|
73
73
|
type PlayRunnerRuntimeResource,
|
|
74
74
|
} from '../runner-backends/types';
|
|
75
|
-
import {
|
|
76
|
-
daytonaSandboxMatchesOperationIdentity,
|
|
77
|
-
} from '../runner-backends/backends/daytona-labels';
|
|
75
|
+
import { daytonaSandboxMatchesOperationIdentity } from '../runner-backends/backends/daytona-labels';
|
|
78
76
|
import type { PlayBundleArtifact } from '../../plays/artifact-types';
|
|
79
77
|
import {
|
|
80
78
|
readRuntimeSheetRowOutcomeCounts,
|
|
@@ -279,7 +277,6 @@ import {
|
|
|
279
277
|
absurdIntegrationEventBoundaryOutput,
|
|
280
278
|
absurdIntegrationEventName,
|
|
281
279
|
absurdAdoptionQueuesForReleases,
|
|
282
|
-
absurdContinuationWorkerId,
|
|
283
280
|
absurdQueueNameForRelease,
|
|
284
281
|
absurdReleaseIdForLaunch,
|
|
285
282
|
absurdRuntimeApiFromLaunch,
|
|
@@ -2020,9 +2017,15 @@ export async function executeAbsurdRuntimeLaunch(
|
|
|
2020
2017
|
params: AbsurdPlayRunTaskParams,
|
|
2021
2018
|
ctx: TaskContext,
|
|
2022
2019
|
deps: AbsurdRuntimeWorkerDeps,
|
|
2020
|
+
queueName = ABSURD_RUNS_QUEUE,
|
|
2023
2021
|
): Promise<AbsurdRuntimeResult> {
|
|
2024
2022
|
try {
|
|
2025
|
-
return await createAbsurdAttemptAdapter({
|
|
2023
|
+
return await createAbsurdAttemptAdapter({
|
|
2024
|
+
params,
|
|
2025
|
+
ctx,
|
|
2026
|
+
deps,
|
|
2027
|
+
queueName,
|
|
2028
|
+
}).execute();
|
|
2026
2029
|
} catch (error) {
|
|
2027
2030
|
if (!isRuntimeSchedulerCapacityError(error)) throw error;
|
|
2028
2031
|
throw new DeferTask(
|
|
@@ -2673,10 +2676,16 @@ export function createAbsurdAttemptAdapter(input: {
|
|
|
2673
2676
|
params: AbsurdPlayRunTaskParams;
|
|
2674
2677
|
ctx: TaskContext;
|
|
2675
2678
|
deps: AbsurdRuntimeWorkerDeps;
|
|
2679
|
+
queueName?: string;
|
|
2676
2680
|
}): AbsurdAttemptAdapter {
|
|
2677
2681
|
return {
|
|
2678
2682
|
execute: () =>
|
|
2679
|
-
executeAbsurdAttemptAdapter(
|
|
2683
|
+
executeAbsurdAttemptAdapter(
|
|
2684
|
+
input.params,
|
|
2685
|
+
input.ctx,
|
|
2686
|
+
input.deps,
|
|
2687
|
+
input.queueName,
|
|
2688
|
+
),
|
|
2680
2689
|
};
|
|
2681
2690
|
}
|
|
2682
2691
|
|
|
@@ -2689,6 +2698,7 @@ async function prepareAbsurdAttempt(input: {
|
|
|
2689
2698
|
deps: AbsurdRuntimeWorkerDeps;
|
|
2690
2699
|
options: Pick<PostgresSchedulerOptions, 'schema'>;
|
|
2691
2700
|
runId: string;
|
|
2701
|
+
queueName: string;
|
|
2692
2702
|
}) {
|
|
2693
2703
|
return input.deps.runWithClient(
|
|
2694
2704
|
async (client) => {
|
|
@@ -2742,7 +2752,7 @@ async function prepareAbsurdAttempt(input: {
|
|
|
2742
2752
|
runReleaseId,
|
|
2743
2753
|
workerReleaseId,
|
|
2744
2754
|
laneClaiming: laneState.laneClaiming,
|
|
2745
|
-
|
|
2755
|
+
claimedQueue: input.queueName,
|
|
2746
2756
|
});
|
|
2747
2757
|
if (disposition.kind === 'refuse') {
|
|
2748
2758
|
// Reuse the one operator-actionable message and remediation.
|
|
@@ -2753,7 +2763,16 @@ async function prepareAbsurdAttempt(input: {
|
|
|
2753
2763
|
});
|
|
2754
2764
|
}
|
|
2755
2765
|
if (disposition.kind === 'defer') {
|
|
2756
|
-
|
|
2766
|
+
console.info('[absurd-runtime.worker] rearmed_lane_deferred', {
|
|
2767
|
+
runId: input.runId,
|
|
2768
|
+
runReleaseId,
|
|
2769
|
+
workerReleaseId,
|
|
2770
|
+
queue: input.queueName,
|
|
2771
|
+
});
|
|
2772
|
+
throw new DeferTask(
|
|
2773
|
+
`Run ${input.runId} lane resumed claiming; yielding its queue claim.`,
|
|
2774
|
+
30,
|
|
2775
|
+
);
|
|
2757
2776
|
}
|
|
2758
2777
|
const adoptedParkedWake =
|
|
2759
2778
|
disposition.kind === 'adopt'
|
|
@@ -2823,6 +2842,37 @@ async function prepareAbsurdAttempt(input: {
|
|
|
2823
2842
|
};
|
|
2824
2843
|
}
|
|
2825
2844
|
|
|
2845
|
+
if (laneState.waitKind === 'detached_runner') {
|
|
2846
|
+
// State changed or its fence is unavailable. A live external execution
|
|
2847
|
+
// must never fall through to fresh assignment after a failed resume.
|
|
2848
|
+
const current = await readPostgresSchedulerResult(
|
|
2849
|
+
client,
|
|
2850
|
+
input.runId,
|
|
2851
|
+
input.options,
|
|
2852
|
+
);
|
|
2853
|
+
if (
|
|
2854
|
+
current &&
|
|
2855
|
+
['completed', 'failed', 'cancelled'].includes(current.status)
|
|
2856
|
+
) {
|
|
2857
|
+
return {
|
|
2858
|
+
kind: 'already_terminal' as const,
|
|
2859
|
+
launch,
|
|
2860
|
+
existing: current,
|
|
2861
|
+
};
|
|
2862
|
+
}
|
|
2863
|
+
console.error('[runtime.scheduler.detached_resume_authority_lost]', {
|
|
2864
|
+
runId: input.runId,
|
|
2865
|
+
attempt: preparation.nextAttempt - 1,
|
|
2866
|
+
runReleaseId,
|
|
2867
|
+
workerReleaseId,
|
|
2868
|
+
status: current?.status ?? null,
|
|
2869
|
+
});
|
|
2870
|
+
throw new DeferTask(
|
|
2871
|
+
`Run ${input.runId} detached runner lacks resumable attempt authority; inspect its persisted fence.`,
|
|
2872
|
+
30,
|
|
2873
|
+
);
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2826
2876
|
const generation = preparation.nextAttempt;
|
|
2827
2877
|
const leaseToken = randomUUID();
|
|
2828
2878
|
const initialRuntimeResource = isManagedSandboxRuntimeBackend(
|
|
@@ -2882,6 +2932,7 @@ async function prepareAbsurdAttemptForTask(input: {
|
|
|
2882
2932
|
deps: AbsurdRuntimeWorkerDeps;
|
|
2883
2933
|
options: Pick<PostgresSchedulerOptions, 'schema'>;
|
|
2884
2934
|
runId: string;
|
|
2935
|
+
queueName: string;
|
|
2885
2936
|
}) {
|
|
2886
2937
|
try {
|
|
2887
2938
|
return await prepareAbsurdAttempt(input);
|
|
@@ -2966,6 +3017,7 @@ async function executeAbsurdAttemptAdapter(
|
|
|
2966
3017
|
params: AbsurdPlayRunTaskParams,
|
|
2967
3018
|
ctx: TaskContext,
|
|
2968
3019
|
deps: AbsurdRuntimeWorkerDeps,
|
|
3020
|
+
queueName = ABSURD_RUNS_QUEUE,
|
|
2969
3021
|
): Promise<AbsurdRuntimeResult> {
|
|
2970
3022
|
const schedulerOptions: AbsurdSchedulerOptions =
|
|
2971
3023
|
normalizeAbsurdSchedulerOptions({ schema: params.schedulerSchema ?? null });
|
|
@@ -2974,7 +3026,7 @@ async function executeAbsurdAttemptAdapter(
|
|
|
2974
3026
|
const runId = params.runId;
|
|
2975
3027
|
|
|
2976
3028
|
const prepareAttempt = () =>
|
|
2977
|
-
prepareAbsurdAttemptForTask({ ctx, deps, options, runId });
|
|
3029
|
+
prepareAbsurdAttemptForTask({ ctx, deps, options, runId, queueName });
|
|
2978
3030
|
let prepared = await prepareAttempt();
|
|
2979
3031
|
while (prepared.kind === 'created_projection_pending') {
|
|
2980
3032
|
const delaySeconds = prepared.delaySeconds;
|
|
@@ -4666,8 +4718,7 @@ async function executeAssignedAbsurdAttempt(input: {
|
|
|
4666
4718
|
client,
|
|
4667
4719
|
{
|
|
4668
4720
|
operationKey: intent.leaseId,
|
|
4669
|
-
providerOperationToken:
|
|
4670
|
-
intent.providerOperationToken,
|
|
4721
|
+
providerOperationToken: intent.providerOperationToken,
|
|
4671
4722
|
orgId: intent.orgId,
|
|
4672
4723
|
runId: intent.runId,
|
|
4673
4724
|
sandboxId: intent.sandboxId,
|
|
@@ -6417,6 +6468,7 @@ export function createAbsurdRuntimeTasks(
|
|
|
6417
6468
|
params as AbsurdPlayRunTaskParams,
|
|
6418
6469
|
ctx,
|
|
6419
6470
|
resolved,
|
|
6471
|
+
queue,
|
|
6420
6472
|
),
|
|
6421
6473
|
);
|
|
6422
6474
|
// Register on both the current lane and every adopted continuation lane.
|
|
@@ -7964,6 +8016,62 @@ export const ABSURD_LANE_ADOPTION_SLOTS = 2;
|
|
|
7964
8016
|
/** Upper bound on simultaneously attached retired lanes. */
|
|
7965
8017
|
export const ABSURD_LANE_ADOPTION_MAX_QUEUES = 4;
|
|
7966
8018
|
|
|
8019
|
+
export async function discoverAbsurdAdoptionReleaseIds(
|
|
8020
|
+
client: PostgresSchedulerQueryClient,
|
|
8021
|
+
input: {
|
|
8022
|
+
environment: 'preview' | 'production';
|
|
8023
|
+
excludeReleaseIds: string[];
|
|
8024
|
+
},
|
|
8025
|
+
options: Pick<PostgresSchedulerOptions, 'schema'> = {},
|
|
8026
|
+
): Promise<string[]> {
|
|
8027
|
+
const lanes = await listPostgresSchedulerAdoptableReleaseLanes(
|
|
8028
|
+
client,
|
|
8029
|
+
input,
|
|
8030
|
+
options,
|
|
8031
|
+
);
|
|
8032
|
+
if (lanes.length === 0) return [];
|
|
8033
|
+
// Historical scheduler rows do not prove an engine task is runnable. In
|
|
8034
|
+
// particular, never manufacture empty queues for orphaned Run records.
|
|
8035
|
+
const presence = await client.query<{ queue: string; present: boolean }>(
|
|
8036
|
+
`SELECT queue,
|
|
8037
|
+
to_regclass(format('absurd.%I', 't_' || queue)) IS NOT NULL
|
|
8038
|
+
AND to_regclass(format('absurd.%I', 'r_' || queue)) IS NOT NULL
|
|
8039
|
+
AND EXISTS (
|
|
8040
|
+
SELECT 1 FROM pg_attribute
|
|
8041
|
+
WHERE attrelid = to_regclass(format('absurd.%I', 't_' || queue))
|
|
8042
|
+
AND attname = 'cancel_at' AND NOT attisdropped
|
|
8043
|
+
) AS present
|
|
8044
|
+
FROM unnest($1::text[]) AS queues(queue)`,
|
|
8045
|
+
[lanes.map((lane) => absurdQueueNameForRelease(lane.releaseId))],
|
|
8046
|
+
);
|
|
8047
|
+
const existing = new Set(
|
|
8048
|
+
presence.rows.filter((row) => row.present).map((row) => row.queue),
|
|
8049
|
+
);
|
|
8050
|
+
const due: string[] = [];
|
|
8051
|
+
for (const lane of lanes) {
|
|
8052
|
+
const queue = absurdQueueNameForRelease(lane.releaseId);
|
|
8053
|
+
if (!existing.has(queue)) continue;
|
|
8054
|
+
// Cancelled engine tasks cannot be claimed. Keep their existing durable
|
|
8055
|
+
// cancellation owner progressing without spending consumer attachments.
|
|
8056
|
+
await reconcileAbsurdRuntimeCancellations({
|
|
8057
|
+
client,
|
|
8058
|
+
queue,
|
|
8059
|
+
schedulerOptions: options,
|
|
8060
|
+
});
|
|
8061
|
+
const next = await readAbsurdQueueNextDue(client, queue);
|
|
8062
|
+
if (next.dueAt && next.dueAt.getTime() <= Date.now()) {
|
|
8063
|
+
due.push(lane.releaseId);
|
|
8064
|
+
}
|
|
8065
|
+
}
|
|
8066
|
+
if (existing.size < lanes.length) {
|
|
8067
|
+
console.warn('[absurd-runtime.worker] adoption_engine_queue_unreadable', {
|
|
8068
|
+
candidateQueues: lanes.length,
|
|
8069
|
+
unreadableQueues: lanes.length - existing.size,
|
|
8070
|
+
});
|
|
8071
|
+
}
|
|
8072
|
+
return due;
|
|
8073
|
+
}
|
|
8074
|
+
|
|
7967
8075
|
export type AbsurdAdoptedLaneWorker = {
|
|
7968
8076
|
queue: string;
|
|
7969
8077
|
close: () => Promise<void>;
|
|
@@ -8023,13 +8131,9 @@ export function absurdAdoptedLaneWorkerOptions(input: {
|
|
|
8023
8131
|
onError: (error: Error) => void;
|
|
8024
8132
|
}): WorkerOptions {
|
|
8025
8133
|
return {
|
|
8026
|
-
//
|
|
8027
|
-
//
|
|
8028
|
-
|
|
8029
|
-
workerId: absurdContinuationWorkerId({
|
|
8030
|
-
workerBase: input.workerBase,
|
|
8031
|
-
queue: input.queue,
|
|
8032
|
-
}),
|
|
8134
|
+
// Drain the stopped queue through ordinary engine claims, including fresh
|
|
8135
|
+
// queued work and retries. No second continuation-only engine filter.
|
|
8136
|
+
workerId: `${input.workerBase}:${input.queue}:drain`,
|
|
8033
8137
|
concurrency: ABSURD_LANE_ADOPTION_SLOTS,
|
|
8034
8138
|
claimTimeout: HEARTBEAT_CLAIM_TIMEOUT_SECONDS,
|
|
8035
8139
|
pollInterval: ABSURD_IDLE_POLL_INTERVAL_SECONDS,
|
|
@@ -9946,7 +10050,7 @@ export async function startRuntimeWorkerHost(
|
|
|
9946
10050
|
}
|
|
9947
10051
|
|
|
9948
10052
|
// One live version (lane handoff): attach the queues of lanes that have stopped
|
|
9949
|
-
// claiming and still hold
|
|
10053
|
+
// claiming and still hold due unfinished engine work, so a retired lane does not
|
|
9950
10054
|
// have to stay alive until its last sleeping run wakes. A draining lane
|
|
9951
10055
|
// attaches nothing — it is on its way out itself.
|
|
9952
10056
|
const adoptionStop = new AbortController();
|
|
@@ -9960,8 +10064,8 @@ export async function startRuntimeWorkerHost(
|
|
|
9960
10064
|
workerReleaseId: releaseId,
|
|
9961
10065
|
signal: adoptionStop.signal,
|
|
9962
10066
|
discoverAdoptableReleaseIds: async () => {
|
|
9963
|
-
|
|
9964
|
-
|
|
10067
|
+
return withRuntimeSchedulerClient(poolOptions, (client) =>
|
|
10068
|
+
discoverAbsurdAdoptionReleaseIds(
|
|
9965
10069
|
client,
|
|
9966
10070
|
{
|
|
9967
10071
|
environment: releaseEnvironment,
|
|
@@ -9970,7 +10074,6 @@ export async function startRuntimeWorkerHost(
|
|
|
9970
10074
|
schedulerOptions.schema ? { schema: schedulerOptions.schema } : {},
|
|
9971
10075
|
),
|
|
9972
10076
|
);
|
|
9973
|
-
return lanes.map((lane) => lane.releaseId);
|
|
9974
10077
|
},
|
|
9975
10078
|
startAdoptionWorker: async (adoptedQueue) => {
|
|
9976
10079
|
const adoptedClient = createAbsurdRuntimeClient(
|
|
@@ -282,56 +282,27 @@ export function assertAbsurdReleaseLaneMatches(input: {
|
|
|
282
282
|
throw new Error(
|
|
283
283
|
`absurd release lane mismatch for run ${input.runId}: the run was launched ` +
|
|
284
284
|
`on release "${input.runReleaseId}" but this worker serves release ` +
|
|
285
|
-
`"${input.workerReleaseId}"
|
|
286
|
-
`
|
|
285
|
+
`"${input.workerReleaseId}" while its admission lane still claims. ` +
|
|
286
|
+
`Remediation: reconcile the claiming switch or serve "${input.runReleaseId}" ` +
|
|
287
287
|
`(queue ${absurdQueueNameForRelease(input.runReleaseId)}).`,
|
|
288
288
|
);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
/**
|
|
292
|
-
* Seconds a foreign, non-adoptable task is parked for before the owning lane
|
|
293
|
-
* gets another chance at it. Matches the historical release-guard deferral so
|
|
294
|
-
* the observable retry cadence is unchanged.
|
|
295
|
-
*/
|
|
296
|
-
export const ABSURD_LANE_ADOPTION_DEFER_SECONDS = 30;
|
|
297
|
-
|
|
298
|
-
/** Absurd worker-id suffix that opts a poll loop into cross-lane claims. */
|
|
299
|
-
export const ABSURD_CONTINUATION_WORKER_SUFFIX = ':continuations';
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Worker id for an adoption poll loop. The `:continuations` suffix is load
|
|
303
|
-
* bearing: vendored `claim_task` patch (g) admits such a worker only for runs
|
|
304
|
-
* still `sleeping` or carrying a non-null event-wake payload, so a fresh or
|
|
305
|
-
* ordinary retry-pending task on the adopted queue is never handed to it.
|
|
306
|
-
*/
|
|
307
|
-
export function absurdContinuationWorkerId(input: {
|
|
308
|
-
workerBase: string;
|
|
309
|
-
queue: string;
|
|
310
|
-
}): string {
|
|
311
|
-
return `${input.workerBase}:${input.queue}${ABSURD_CONTINUATION_WORKER_SUFFIX}`;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
291
|
export type AbsurdReleaseLaneDisposition =
|
|
315
292
|
/** The run belongs to this worker's own lane. */
|
|
316
293
|
| { kind: 'own' }
|
|
317
|
-
/** A
|
|
294
|
+
/** A stopped lane drains on this compatible release. */
|
|
318
295
|
| { kind: 'adopt'; adoptedReleaseId: string }
|
|
319
|
-
/**
|
|
320
|
-
| { kind: 'defer'
|
|
321
|
-
/**
|
|
296
|
+
/** An attached drainer yields after its lane resumes claiming. */
|
|
297
|
+
| { kind: 'defer' }
|
|
298
|
+
/** The claimed queue does not belong to the active foreign lane. */
|
|
322
299
|
| { kind: 'refuse' };
|
|
323
300
|
|
|
324
301
|
/**
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
* `:continuations` fence already stops most cross-lane claims; this decides the
|
|
330
|
-
* cases the engine cannot see, because `sleeping` in the engine covers durable
|
|
331
|
-
* suspensions, retry backoff, and capacity deferrals alike.
|
|
332
|
-
*
|
|
333
|
-
* `laneClaiming` and `parkedInAdoptableWait` come from
|
|
334
|
-
* `readPostgresSchedulerRunLaneState`, never from a timer or a machine count.
|
|
302
|
+
* Admission ownership ends when a lane stops claiming. Thereafter the existing
|
|
303
|
+
* engine claim and attempt fence authorize compatible workers to drain it.
|
|
304
|
+
* A rearmed lane keeps its own work; attached drainers yield until discovery
|
|
305
|
+
* detaches them. A mismatched physical queue remains an operator error.
|
|
335
306
|
*/
|
|
336
307
|
export function resolveAbsurdReleaseLaneDisposition(input: {
|
|
337
308
|
runId: string;
|
|
@@ -339,8 +310,8 @@ export function resolveAbsurdReleaseLaneDisposition(input: {
|
|
|
339
310
|
workerReleaseId: string;
|
|
340
311
|
/** Does the run's OWN lane still claim work off its queue? */
|
|
341
312
|
laneClaiming: boolean;
|
|
342
|
-
/**
|
|
343
|
-
|
|
313
|
+
/** Actual engine registration queue, never a caller-authored launch field. */
|
|
314
|
+
claimedQueue?: string;
|
|
344
315
|
}): AbsurdReleaseLaneDisposition {
|
|
345
316
|
if (
|
|
346
317
|
input.runReleaseId === input.workerReleaseId ||
|
|
@@ -349,18 +320,10 @@ export function resolveAbsurdReleaseLaneDisposition(input: {
|
|
|
349
320
|
) {
|
|
350
321
|
return { kind: 'own' };
|
|
351
322
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return {
|
|
357
|
-
kind: 'defer',
|
|
358
|
-
reason:
|
|
359
|
-
`Run ${input.runId} rides retired release lane "${input.runReleaseId}" ` +
|
|
360
|
-
`but is not parked in an adoptable durable wait. Ordinary queued and ` +
|
|
361
|
-
`running work is never adopted; leaving it for its owning lane.`,
|
|
362
|
-
delaySeconds: ABSURD_LANE_ADOPTION_DEFER_SECONDS,
|
|
363
|
-
};
|
|
323
|
+
if (input.laneClaiming) {
|
|
324
|
+
return input.claimedQueue === absurdQueueNameForRelease(input.runReleaseId)
|
|
325
|
+
? { kind: 'defer' }
|
|
326
|
+
: { kind: 'refuse' };
|
|
364
327
|
}
|
|
365
328
|
return { kind: 'adopt', adoptedReleaseId: input.runReleaseId };
|
|
366
329
|
}
|
|
@@ -1036,6 +1036,8 @@ export function postgresSchedulerNotifyChannel(
|
|
|
1036
1036
|
return `${channel.slice(0, 63 - fingerprint.length - 1)}_${fingerprint}`;
|
|
1037
1037
|
}
|
|
1038
1038
|
const DEFAULT_POLL_INTERVAL_MS = 1_000;
|
|
1039
|
+
const STARTUP_TERMINAL_POLL_INTERVAL_MS = 250;
|
|
1040
|
+
const STARTUP_TERMINAL_POLL_DURATION_MS = 2_000;
|
|
1039
1041
|
const DEFAULT_RESULT_TIMEOUT_MS = 30_000;
|
|
1040
1042
|
|
|
1041
1043
|
const POSTGRES_SCHEDULER_NOT_CONFIGURED_MESSAGE =
|
|
@@ -7228,23 +7230,8 @@ export async function withPostgresSchedulerClosedReleaseAdmission<T>(
|
|
|
7228
7230
|
}
|
|
7229
7231
|
}
|
|
7230
7232
|
|
|
7231
|
-
/**
|
|
7232
|
-
|
|
7233
|
-
*
|
|
7234
|
-
* A run is adoptable only while it is parked in a durable wait whose wake is
|
|
7235
|
-
* pure scheduler state: a timed sleep, or an integration/HITL event boundary.
|
|
7236
|
-
* `detached_runner` is deliberately absent — that suspension holds live sandbox
|
|
7237
|
-
* compute behind a lane-pinned executor token and a scheduler-owned heartbeat
|
|
7238
|
-
* deadline, so its wake belongs to the lane that started the runner.
|
|
7239
|
-
*/
|
|
7240
|
-
export const POSTGRES_SCHEDULER_ADOPTABLE_WAIT_KINDS = [
|
|
7241
|
-
'sleep',
|
|
7242
|
-
'integration_event',
|
|
7243
|
-
'integration_event_batch',
|
|
7244
|
-
] as const;
|
|
7245
|
-
|
|
7246
|
-
export type PostgresSchedulerAdoptableWaitKind =
|
|
7247
|
-
(typeof POSTGRES_SCHEDULER_ADOPTABLE_WAIT_KINDS)[number];
|
|
7233
|
+
/** Once admission stops, compatible workers drain all remaining Run states. */
|
|
7234
|
+
const ADOPTABLE_RUN_SQL = "runs.status IN ('queued', 'running', 'waiting')";
|
|
7248
7235
|
|
|
7249
7236
|
const POSTGRES_SCHEDULER_RELEASE_CLAIMING_CONTROL_PREFIX =
|
|
7250
7237
|
'runtime_release_claiming:';
|
|
@@ -7376,6 +7363,7 @@ export type PostgresSchedulerRunLaneState = {
|
|
|
7376
7363
|
environment: 'preview' | 'production';
|
|
7377
7364
|
status: string;
|
|
7378
7365
|
waitKind: string | null;
|
|
7366
|
+
/** Legacy projection name: all nonterminal work is resumable after admission stops. */
|
|
7379
7367
|
parkedInAdoptableWait: boolean;
|
|
7380
7368
|
laneClaiming: boolean;
|
|
7381
7369
|
};
|
|
@@ -7393,9 +7381,6 @@ type RunLaneStateRow = {
|
|
|
7393
7381
|
function runLaneStateSelectionSql(
|
|
7394
7382
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
7395
7383
|
): string {
|
|
7396
|
-
const adoptableKinds = POSTGRES_SCHEDULER_ADOPTABLE_WAIT_KINDS.map(
|
|
7397
|
-
(kind) => `'${kind}'`,
|
|
7398
|
-
).join(', ');
|
|
7399
7384
|
return `
|
|
7400
7385
|
nullif(btrim(runs.launch_json ->> 'absurdReleaseId'), '') AS release_id,
|
|
7401
7386
|
coalesce(
|
|
@@ -7409,11 +7394,7 @@ function runLaneStateSelectionSql(
|
|
|
7409
7394
|
) AS environment,
|
|
7410
7395
|
runs.status AS status,
|
|
7411
7396
|
nullif(btrim(runs.suspension_json ->> 'kind'), '') AS wait_kind,
|
|
7412
|
-
|
|
7413
|
-
runs.status = 'waiting'
|
|
7414
|
-
AND nullif(btrim(runs.suspension_json ->> 'kind'), '')
|
|
7415
|
-
IN (${adoptableKinds})
|
|
7416
|
-
) AS parked,
|
|
7397
|
+
${ADOPTABLE_RUN_SQL} AS parked,
|
|
7417
7398
|
(
|
|
7418
7399
|
SELECT (control.value ->> 'claiming')::boolean
|
|
7419
7400
|
FROM ${tableName('control', options)} AS control
|
|
@@ -7447,11 +7428,11 @@ function runLaneStateFromRow(
|
|
|
7447
7428
|
|
|
7448
7429
|
/**
|
|
7449
7430
|
* One transactional read of everything the lane guard needs about a claimed
|
|
7450
|
-
* run: which lane owns it, whether that lane still claims, and whether
|
|
7451
|
-
*
|
|
7431
|
+
* run: which lane owns it, whether that lane still claims, and whether a compatible worker may
|
|
7432
|
+
* continue its existing work.
|
|
7452
7433
|
*
|
|
7453
|
-
* The scheduler run
|
|
7454
|
-
*
|
|
7434
|
+
* The scheduler run and attempt rows — not the engine task row — authorize
|
|
7435
|
+
* continuation. The engine cannot tell a durable suspension from a retry
|
|
7455
7436
|
* backoff or a capacity `DeferTask`, all of which sit in `sleeping`.
|
|
7456
7437
|
*/
|
|
7457
7438
|
export async function readPostgresSchedulerRunLaneState(
|
|
@@ -7472,9 +7453,9 @@ export async function readPostgresSchedulerRunLaneState(
|
|
|
7472
7453
|
}
|
|
7473
7454
|
|
|
7474
7455
|
/**
|
|
7475
|
-
* Discover
|
|
7476
|
-
*
|
|
7477
|
-
*
|
|
7456
|
+
* Discover stopped lanes with unfinished work in the caller's release
|
|
7457
|
+
* environment. No wait-kind or retry-history classification is needed: the
|
|
7458
|
+
* existing task claim and attempt ingress own execution authority.
|
|
7478
7459
|
*
|
|
7479
7460
|
* Both halves come from the runtime scheduler Postgres in one query, so a lane
|
|
7480
7461
|
* cannot be attached on the strength of a stale registry projection.
|
|
@@ -7487,9 +7468,6 @@ export async function listPostgresSchedulerAdoptableReleaseLanes(
|
|
|
7487
7468
|
},
|
|
7488
7469
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
7489
7470
|
): Promise<Array<{ releaseId: string; parkedRuns: number }>> {
|
|
7490
|
-
const adoptableKinds = POSTGRES_SCHEDULER_ADOPTABLE_WAIT_KINDS.map(
|
|
7491
|
-
(kind) => `'${kind}'`,
|
|
7492
|
-
).join(', ');
|
|
7493
7471
|
const result = await client.query<{
|
|
7494
7472
|
release_id: string;
|
|
7495
7473
|
parked_runs: string;
|
|
@@ -7500,9 +7478,7 @@ export async function listPostgresSchedulerAdoptableReleaseLanes(
|
|
|
7500
7478
|
nullif(btrim(runs.launch_json ->> 'absurdReleaseId'), '') AS release_id,
|
|
7501
7479
|
count(*)::text AS parked_runs
|
|
7502
7480
|
FROM ${tableName('runs', options)} AS runs
|
|
7503
|
-
WHERE
|
|
7504
|
-
AND nullif(btrim(runs.suspension_json ->> 'kind'), '')
|
|
7505
|
-
IN (${adoptableKinds})
|
|
7481
|
+
WHERE ${ADOPTABLE_RUN_SQL}
|
|
7506
7482
|
AND nullif(btrim(runs.launch_json ->> 'absurdReleaseId'), '') IS NOT NULL
|
|
7507
7483
|
AND NOT (
|
|
7508
7484
|
nullif(btrim(runs.launch_json ->> 'absurdReleaseId'), '')
|
|
@@ -7540,24 +7516,22 @@ export async function listPostgresSchedulerAdoptableReleaseLanes(
|
|
|
7540
7516
|
|
|
7541
7517
|
/**
|
|
7542
7518
|
* Retire-gate half for a lane that has stopped claiming: how much of its
|
|
7543
|
-
* remaining
|
|
7544
|
-
*
|
|
7519
|
+
* remaining work parked without live compute. This is deliberately stricter
|
|
7520
|
+
* than claim eligibility: a transferable Run is not proof that its old machine
|
|
7521
|
+
* can be retired. Keep engine-depth and resource-cleanup gates unchanged.
|
|
7545
7522
|
*/
|
|
7546
7523
|
export async function countPostgresSchedulerAdoptableParkedRuns(
|
|
7547
7524
|
client: PostgresSchedulerQueryClient,
|
|
7548
7525
|
input: { releaseId: string },
|
|
7549
7526
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
7550
7527
|
): Promise<number> {
|
|
7551
|
-
const adoptableKinds = POSTGRES_SCHEDULER_ADOPTABLE_WAIT_KINDS.map(
|
|
7552
|
-
(kind) => `'${kind}'`,
|
|
7553
|
-
).join(', ');
|
|
7554
7528
|
const result = await client.query<{ n: string }>(
|
|
7555
7529
|
`
|
|
7556
7530
|
SELECT count(*)::text AS n
|
|
7557
7531
|
FROM ${tableName('runs', options)} AS runs
|
|
7558
7532
|
WHERE runs.status = 'waiting'
|
|
7559
|
-
AND
|
|
7560
|
-
IN (
|
|
7533
|
+
AND runs.suspension_json ->> 'kind'
|
|
7534
|
+
IN ('sleep', 'integration_event', 'integration_event_batch')
|
|
7561
7535
|
AND runs.launch_json ->> 'absurdReleaseId' = $1
|
|
7562
7536
|
`,
|
|
7563
7537
|
[input.releaseId],
|
|
@@ -25791,17 +25765,29 @@ export function postgresSchedulerRunHandle(
|
|
|
25791
25765
|
|
|
25792
25766
|
return {
|
|
25793
25767
|
runId,
|
|
25794
|
-
observe: async function* observe({ signal } = {}) {
|
|
25768
|
+
observe: async function* observe({ signal, startupPolling } = {}) {
|
|
25795
25769
|
const poolOptions = resolve();
|
|
25796
25770
|
const hubLease = acquireTerminalHub(poolOptions, options);
|
|
25797
25771
|
const hub = hubLease?.hub ?? null;
|
|
25772
|
+
const startupPollDeadline = startupPolling
|
|
25773
|
+
? Date.now() + STARTUP_TERMINAL_POLL_DURATION_MS
|
|
25774
|
+
: 0;
|
|
25798
25775
|
try {
|
|
25799
25776
|
while (!signal?.aborted) {
|
|
25777
|
+
const startupRemainingMs = startupPollDeadline - Date.now();
|
|
25778
|
+
const pollIntervalMs =
|
|
25779
|
+
startupRemainingMs > 0
|
|
25780
|
+
? Math.min(
|
|
25781
|
+
waitIntervalMs(hub),
|
|
25782
|
+
STARTUP_TERMINAL_POLL_INTERVAL_MS,
|
|
25783
|
+
startupRemainingMs,
|
|
25784
|
+
)
|
|
25785
|
+
: waitIntervalMs(hub);
|
|
25800
25786
|
// Subscribe before reading so a notify between read and wait cannot
|
|
25801
25787
|
// be missed.
|
|
25802
25788
|
const hint = hub
|
|
25803
|
-
? waitForTerminalHint(hub, runId,
|
|
25804
|
-
: waitForTerminalPoll(
|
|
25789
|
+
? waitForTerminalHint(hub, runId, pollIntervalMs)
|
|
25790
|
+
: waitForTerminalPoll(pollIntervalMs);
|
|
25805
25791
|
const cancelOnAbort = () => hint.cancel();
|
|
25806
25792
|
signal?.addEventListener('abort', cancelOnAbort, { once: true });
|
|
25807
25793
|
try {
|
|
@@ -337,6 +337,50 @@ export async function mintSqlListenerDispatchRetryToken(input: {
|
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
+
/** A durable account-creation intent may prepare only its own Customer DB. */
|
|
341
|
+
export async function mintCustomerDbPreparationToken(input: {
|
|
342
|
+
orgId: string;
|
|
343
|
+
requestId: string;
|
|
344
|
+
callbackOrigin: string;
|
|
345
|
+
nowMs?: number;
|
|
346
|
+
}): Promise<string> {
|
|
347
|
+
const issuedAt = Math.floor((input.nowMs ?? Date.now()) / 1000);
|
|
348
|
+
return mint({
|
|
349
|
+
v: TOKEN_VERSION,
|
|
350
|
+
iss: TOKEN_ISSUER,
|
|
351
|
+
aud: 'deepline.customer_db.prepare',
|
|
352
|
+
purpose: 'customer_db_preparation',
|
|
353
|
+
org_id: input.orgId,
|
|
354
|
+
request_id: input.requestId,
|
|
355
|
+
callback_origin: input.callbackOrigin,
|
|
356
|
+
iat: issuedAt,
|
|
357
|
+
exp: issuedAt + TOKEN_TTL_SECONDS,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export async function verifyCustomerDbPreparationToken(
|
|
362
|
+
token: string,
|
|
363
|
+
callbackOrigin: string,
|
|
364
|
+
nowMs = Date.now(),
|
|
365
|
+
): Promise<{ orgId: string; requestId: string }> {
|
|
366
|
+
const claims = await verifyObservationToken(
|
|
367
|
+
token,
|
|
368
|
+
'deepline.customer_db.prepare',
|
|
369
|
+
nowMs,
|
|
370
|
+
);
|
|
371
|
+
if (
|
|
372
|
+
claims.purpose !== 'customer_db_preparation' ||
|
|
373
|
+
claims.callback_origin !== callbackOrigin ||
|
|
374
|
+
typeof claims.org_id !== 'string' ||
|
|
375
|
+
!claims.org_id ||
|
|
376
|
+
typeof claims.request_id !== 'string' ||
|
|
377
|
+
claims.request_id !== `customer-db:${claims.org_id}`
|
|
378
|
+
) {
|
|
379
|
+
throw new Error('Invalid Customer DB preparation authority.');
|
|
380
|
+
}
|
|
381
|
+
return { orgId: claims.org_id, requestId: claims.request_id };
|
|
382
|
+
}
|
|
383
|
+
|
|
340
384
|
/** Authorizes one invoice/threshold observation, never a payment, grant or fleet scan. */
|
|
341
385
|
export async function mintBillingDeliveryToken(input: {
|
|
342
386
|
stripeInvoiceId: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunk6VKDKATOjs = require('./chunk-6VKDKATO.js');
|
|
18
|
+
require('./chunk-6WWBVWFQ.js');
|
|
19
|
+
require('./chunk-VBDR2DP6.js');
|
|
20
|
+
require('./chunk-WF5QE2IW.js');
|
|
21
|
+
require('./chunk-ALJJRZNJ.js');
|
|
22
|
+
require('./chunk-XNYIZMNQ.js');
|
|
23
|
+
require('./chunk-DIAWYWT5.js');
|
|
24
|
+
require('./chunk-27BYXQU4.js');
|
|
25
|
+
require('./chunk-OG64RBAC.js');
|
|
26
|
+
require('./chunk-COGTRVWW.js');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunk6VKDKATOjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunk6VKDKATOjs.authStatusLine; exports.clearPendingClaim = _chunk6VKDKATOjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunk6VKDKATOjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunk6VKDKATOjs.handleRegister; exports.handleStatus = _chunk6VKDKATOjs.handleStatus; exports.handleWait = _chunk6VKDKATOjs.handleWait; exports.httpJson = _chunk6VKDKATOjs.httpJson; exports.readPendingAuthClaim = _chunk6VKDKATOjs.readPendingAuthClaim; exports.readStatusBanner = _chunk6VKDKATOjs.readStatusBanner; exports.registerAuthCommands = _chunk6VKDKATOjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunk6VKDKATOjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunk6VKDKATOjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunk6VKDKATOjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunk6VKDKATOjs.statusBannerLine;
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
reportSetupCompleted,
|
|
15
15
|
resolvePendingAuthClaimForResume,
|
|
16
16
|
statusBannerLine
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-EJTU6X6C.mjs";
|
|
18
|
+
import "./chunk-C7UIUKW6.mjs";
|
|
19
|
+
import "./chunk-VRAOWHXJ.mjs";
|
|
20
|
+
import "./chunk-PDJS6LFI.mjs";
|
|
21
21
|
import "./chunk-4QF2K7TM.mjs";
|
|
22
22
|
import "./chunk-DLIRSHV6.mjs";
|
|
23
23
|
import "./chunk-HBL4PM5Q.mjs";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-FXLMDAAY.mjs";
|
|
25
25
|
import "./chunk-WZYKRD7T.mjs";
|
|
26
26
|
import "./chunk-KRD6H754.mjs";
|
|
27
27
|
export {
|