deepline 0.3.474 → 0.3.475
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/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +39 -15
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +18 -8
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +59 -34
- package/dist/cli/auth-7GVCW24N.js +41 -0
- package/dist/cli/{auth-QMANU5PV.mjs → auth-CFDYJ7FZ.mjs} +5 -5
- package/dist/cli/{billing-YJAP4VZN.mjs → billing-PEXWWLRT.mjs} +6 -6
- package/dist/cli/{billing-WZ5POBZX.js → billing-XLIL3FLK.js} +79 -79
- package/dist/cli/{chunk-PGKELBIY.js → chunk-3MQJJ6YX.js} +51 -51
- package/dist/cli/{chunk-Z27NSLPC.mjs → chunk-3QSFSHCJ.mjs} +1 -1
- package/dist/cli/{chunk-UKX4FESF.mjs → chunk-3WVA7E7O.mjs} +2 -2
- package/dist/cli/{chunk-JEYX3345.mjs → chunk-42F6LTBJ.mjs} +3 -3
- package/dist/cli/{chunk-BB4RZMWA.mjs → chunk-4QHAP3MR.mjs} +5 -5
- package/dist/cli/{chunk-IK3VOGDR.js → chunk-4QHQ3WYW.js} +21 -21
- package/dist/cli/{chunk-YVJ6IWVD.mjs → chunk-6PRYHABU.mjs} +1 -1
- package/dist/cli/{chunk-3ODBCZLL.js → chunk-7SWRXZ4A.js} +93 -93
- package/dist/cli/{chunk-MNK4ZK2C.mjs → chunk-7U3L2S7X.mjs} +10 -10
- package/dist/cli/{chunk-475V572K.js → chunk-7XTBEYLS.js} +36 -36
- package/dist/cli/{chunk-MKSB2FTU.mjs → chunk-AD7KL6AI.mjs} +4 -4
- package/dist/cli/{chunk-ORQYKA4I.js → chunk-B7NJ5JQ2.js} +4 -4
- package/dist/cli/{chunk-RXITRC37.js → chunk-BLW2K6YH.js} +3 -3
- package/dist/cli/{chunk-JSXMJSBE.js → chunk-BSK2TGB4.js} +8 -8
- package/dist/cli/{chunk-KKWQ24VM.mjs → chunk-BVAYLXMH.mjs} +2 -2
- package/dist/cli/{chunk-JCNJQH6X.js → chunk-CKSRTD45.js} +1 -1
- package/dist/cli/{chunk-G3UHAYRX.js → chunk-D3Q4FUFS.js} +8 -8
- package/dist/cli/{chunk-MXUJVCKV.mjs → chunk-D6SXN34W.mjs} +4 -4
- package/dist/cli/{chunk-26CZVDQN.mjs → chunk-DIMKSDF6.mjs} +2 -2
- package/dist/cli/{chunk-YX762HFK.mjs → chunk-EA45HSEC.mjs} +2 -2
- package/dist/cli/{chunk-LHOEWAVD.js → chunk-F4FNMXI3.js} +53 -53
- package/dist/cli/{chunk-THDXVSNL.mjs → chunk-FC4C7MZM.mjs} +4 -4
- package/dist/cli/{chunk-N62MS3XJ.js → chunk-G4SGYWKV.js} +6 -6
- package/dist/cli/{chunk-ZRWQKTSX.mjs → chunk-HALAYT3Y.mjs} +3 -3
- package/dist/cli/{chunk-7IYOWIEJ.mjs → chunk-HMHH7JQD.mjs} +2 -2
- package/dist/cli/{chunk-XP7FAYLN.js → chunk-KTWXY73Q.js} +5 -5
- package/dist/cli/{chunk-3MZPWIOE.mjs → chunk-M27SSAQ7.mjs} +1 -1
- package/dist/cli/{chunk-RLQIGBFK.js → chunk-M4QO3GRD.js} +3 -3
- package/dist/cli/{chunk-4C34LGI4.js → chunk-M7K5BCWP.js} +10 -10
- package/dist/cli/{chunk-RGIQ5ZJX.mjs → chunk-MUDOASYL.mjs} +2 -2
- package/dist/cli/{chunk-YFDTF2XC.js → chunk-NBVYS6VG.js} +9 -9
- package/dist/cli/{chunk-YK64UZXN.mjs → chunk-NGOKBSBH.mjs} +1 -1
- package/dist/cli/{chunk-35SZHTRW.mjs → chunk-NHQP4UPJ.mjs} +5 -5
- package/dist/cli/{chunk-AIPTW3EK.js → chunk-QKMWQTMI.js} +3 -3
- package/dist/cli/{chunk-3NRZFMX4.js → chunk-TLPW2SHS.js} +6 -6
- package/dist/cli/{chunk-XNP7XTBN.js → chunk-TZRTT7EI.js} +26 -26
- package/dist/cli/{chunk-STLJYWUC.js → chunk-U3F63UWD.js} +7 -7
- package/dist/cli/{chunk-AWJKYS25.js → chunk-VBGPRRJ6.js} +2 -2
- package/dist/cli/{chunk-EIKONWW7.mjs → chunk-VD3E3QMI.mjs} +1 -1
- package/dist/cli/{chunk-DQZBERDL.mjs → chunk-VFP3MFLD.mjs} +1 -1
- package/dist/cli/{chunk-ZGC2SUAA.mjs → chunk-VTCXSICG.mjs} +2 -2
- package/dist/cli/{chunk-UGYLGT7B.mjs → chunk-YAAQNDP6.mjs} +1 -1
- package/dist/cli/{chunk-JJVYUKLY.mjs → chunk-YMS7VYFA.mjs} +1 -1
- package/dist/cli/{chunk-CXBEZAPU.js → chunk-Z5VSBCFV.js} +16 -16
- package/dist/cli/{chunk-YKNULB7V.js → chunk-ZANUM4XV.js} +5 -5
- package/dist/cli/{chunk-EK2TAZJZ.js → chunk-ZQYBKDPA.js} +2 -2
- package/dist/cli/{csv-ENKCFCSM.js → csv-4YHSYV2C.js} +13 -13
- package/dist/cli/{csv-QCLQOIEA.mjs → csv-WC7ILC7P.mjs} +4 -4
- package/dist/cli/{db-5TLBZDT3.js → db-APZNM2GI.js} +27 -27
- package/dist/cli/{db-P25LGP33.mjs → db-I5PV6NTC.mjs} +6 -6
- package/dist/cli/describe-OR7FZBCD.js +48 -0
- package/dist/cli/{describe-W2H5DHR6.mjs → describe-XH5F3X5W.mjs} +17 -17
- package/dist/cli/{executions-VYZCYUBR.mjs → executions-PIY4XM7T.mjs} +6 -6
- package/dist/cli/{executions-YHFAWJOJ.js → executions-VIXFKZYU.js} +8 -8
- package/dist/cli/{feedback-K2FWYYLZ.mjs → feedback-IGDHBWGT.mjs} +4 -4
- package/dist/cli/{feedback-RJF3QSBB.js → feedback-WCLIFQTR.js} +8 -8
- package/dist/cli/git-CKN2F32Y.js +25 -0
- package/dist/cli/{git-S3APUPLL.mjs → git-FRICPPTA.mjs} +5 -5
- package/dist/cli/index.js +135 -135
- package/dist/cli/index.mjs +40 -40
- package/dist/cli/{legacy-noops-3SWNRE7Z.js → legacy-noops-DSFOPYDY.js} +8 -8
- package/dist/cli/{legacy-noops-ICYZACTW.mjs → legacy-noops-ROAXEG6D.mjs} +5 -5
- package/dist/cli/{monitors-DEZCEQLB.mjs → monitors-FZ5PRLW6.mjs} +7 -7
- package/dist/cli/{monitors-VRIWTRPG.js → monitors-KUCYQLU5.js} +91 -91
- package/dist/cli/{org-IQW5ZIAO.mjs → org-DRNND5XU.mjs} +6 -6
- package/dist/cli/{org-NX752DTE.js → org-SRHMWKQR.js} +72 -72
- package/dist/cli/{pages-YIBWYGVS.js → pages-TEJQIHTU.js} +17 -17
- package/dist/cli/{pages-5WQRVVKX.mjs → pages-XNGA356T.mjs} +6 -6
- package/dist/cli/{play-3EXNH3HD.js → play-GCGFQSFP.js} +306 -306
- package/dist/cli/{play-WOMJXS4O.mjs → play-NE45ROIZ.mjs} +17 -17
- package/dist/cli/{providers-XDVPYRTS.mjs → providers-57TJOSMV.mjs} +6 -6
- package/dist/cli/{providers-C2WYSR2Y.js → providers-VHMUR63R.js} +9 -9
- package/dist/cli/{quickstart-7RABZF66.js → quickstart-BPXWO4UD.js} +6 -6
- package/dist/cli/{quickstart-YMSIL2TK.mjs → quickstart-K3SH4NXP.mjs} +4 -4
- package/dist/cli/{run-5QVVWFGL.js → run-553AAXDU.js} +36 -36
- package/dist/cli/{run-A4JD6TAR.mjs → run-ZRWJUEN2.mjs} +22 -22
- package/dist/cli/{search-2TOSF2G3.mjs → search-BW6XRS4I.mjs} +7 -7
- package/dist/cli/search-WF26AUDJ.js +32 -0
- package/dist/cli/{secrets-Q7UVOSNM.js → secrets-AMYQYUL5.js} +15 -15
- package/dist/cli/{secrets-BUN4ORE7.mjs → secrets-OYYCFGZE.mjs} +6 -6
- package/dist/cli/{sessions-IAOORI6X.mjs → sessions-O4SVVOMO.mjs} +5 -5
- package/dist/cli/{sessions-NXQOQ4HX.js → sessions-RYCJUMJ2.js} +6 -6
- package/dist/cli/{settings-WD4KSY5S.js → settings-7R5FQKII.js} +78 -78
- package/dist/cli/{settings-BMI373AI.mjs → settings-QK7DHDU7.mjs} +11 -11
- package/dist/cli/{setup-3IA7BVPE.js → setup-OTQDQHDN.js} +44 -44
- package/dist/cli/{setup-55VIWAWR.mjs → setup-VDAAVCKK.mjs} +9 -9
- package/dist/cli/{skills-GKITMBTM.mjs → skills-HRK5O5JO.mjs} +7 -7
- package/dist/cli/skills-VNLMEOXW.js +31 -0
- package/dist/cli/tools-C3MUHL7G.js +55 -0
- package/dist/cli/{tools-XHCFC7GP.mjs → tools-O7BM62QV.mjs} +16 -16
- package/dist/cli/update-TCKTU6QJ.js +33 -0
- package/dist/cli/{update-SWB24YKE.mjs → update-UHKHCSTY.mjs} +9 -9
- package/dist/cli/{workflow-5QPMFI3Z.js → workflow-7Z5NCTGG.js} +17 -17
- package/dist/cli/{workflow-XO4CKUA7.mjs → workflow-T2EDR7L4.mjs} +7 -7
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +96 -96
- 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.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-O6KAH543.js +0 -41
- package/dist/cli/describe-44L7OBGM.js +0 -48
- package/dist/cli/git-F3EI5DY5.js +0 -25
- package/dist/cli/search-772R7YHI.js +0 -32
- package/dist/cli/skills-PUUTFMP3.js +0 -31
- package/dist/cli/tools-3WX7TUUG.js +0 -55
- package/dist/cli/update-PC3CLODV.js +0 -33
|
@@ -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.475',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts
CHANGED
|
@@ -78,29 +78,51 @@ export function acquireRateScopeSql(
|
|
|
78
78
|
const observationWasIdle = `${successesParameter}::int = 0
|
|
79
79
|
AND nv.now_ms - GREATEST(h.refilled_at_ms, h.next_dispatch_at_ms, h.retry_at_ms, h.cool_until_ms)
|
|
80
80
|
> GREATEST(1000, 2000.0 / ${refillRate})`;
|
|
81
|
-
// A denied refill may fold a completion before the next
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
const recoverySuccess =
|
|
86
|
-
|
|
87
|
-
? `(${successesParameter}::int > 0 OR (
|
|
81
|
+
// A denied refill may fold a completion before the next recovery interval.
|
|
82
|
+
// Keep it available for one later ramp rather than requiring another call at
|
|
83
|
+
// the old pace. The baseline consumes it once. Unknown-provider upward probes
|
|
84
|
+
// above useful seed capacity retain their separate observation policy.
|
|
85
|
+
const recoverySuccess = probeBaselineSupported
|
|
86
|
+
? `(${successesParameter}::int > 0 OR (
|
|
88
87
|
h.seen_backpressure
|
|
89
|
-
AND ${refillRate} < ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}
|
|
88
|
+
AND (${!unknownProvider} OR ${refillRate} < ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS})
|
|
90
89
|
AND h.rate_probe_started_at_ms >= h.last_ramp_at_ms
|
|
91
90
|
AND h.rate_probe_started_at_ms >= h.rate_observation_started_at_ms
|
|
92
91
|
AND h.rate_successes > h.rate_probe_successes_at_ramp
|
|
93
92
|
AND NOT (${observationWasIdle})
|
|
94
93
|
))`
|
|
95
|
-
|
|
94
|
+
: `${successesParameter}::int > 0`;
|
|
95
|
+
// Known-provider feedback can arrive before its recovery interval. Wake at
|
|
96
|
+
// that opportunity instead of sleeping an entire old, slow token interval;
|
|
97
|
+
// the baseline below consumes each confirmed success for at most one ramp.
|
|
98
|
+
const pendingRecoveryWaitMs =
|
|
99
|
+
!unknownProvider && probeBaselineSupported
|
|
100
|
+
? `CASE WHEN ${recoverySuccess}
|
|
101
|
+
AND h.seen_backpressure
|
|
102
|
+
AND h.rate_observation_started_at_ms IS NOT NULL
|
|
103
|
+
AND GREATEST(h.retry_at_ms, h.cool_until_ms) <= nv.now_ms
|
|
104
|
+
AND nv.now_ms < h.last_ramp_at_ms + ${backpressuredRecoveryInterval}
|
|
105
|
+
THEN h.last_ramp_at_ms + ${backpressuredRecoveryInterval} - nv.now_ms
|
|
106
|
+
ELSE NULL END`
|
|
107
|
+
: 'NULL::bigint';
|
|
108
|
+
// A provider's elapsed hold authorizes one shared recovery probe. Requiring
|
|
109
|
+
// a whole token at the newly learned rate would add another wait when the
|
|
110
|
+
// measured quota cycle is longer than Retry-After itself. The first grant
|
|
111
|
+
// starts an observation epoch, so competing callers cannot reuse this floor.
|
|
112
|
+
const postHoldProbeDue = `h.seen_backpressure
|
|
113
|
+
AND h.rate_observation_started_at_ms IS NULL
|
|
114
|
+
AND h.retry_at_ms > 0
|
|
115
|
+
AND GREATEST(h.retry_at_ms, h.cool_until_ms) <= nv.now_ms`;
|
|
96
116
|
return `provider_hold_rows AS (
|
|
97
117
|
SELECT * FROM ${table} WHERE bucket_id = $1 FOR UPDATE
|
|
98
118
|
), provider_hold AS (
|
|
99
119
|
SELECT h.*,
|
|
100
|
-
|
|
120
|
+
${postHoldProbeDue} AS post_hold_probe_due,
|
|
121
|
+
${pendingRecoveryWaitMs} AS pending_recovery_wait_ms,
|
|
122
|
+
GREATEST(CASE WHEN ${postHoldProbeDue} THEN 1.0 ELSE 0.0 END, LEAST(
|
|
101
123
|
GREATEST(CASE WHEN h.seen_backpressure THEN 1 ELSE h.capacity END, ${refillRate}),
|
|
102
124
|
h.tokens + GREATEST(0, nv.now_ms - h.refilled_at_ms) * ${refillRate} / 1000.0
|
|
103
|
-
) AS tokens_after_refill,
|
|
125
|
+
)) AS tokens_after_refill,
|
|
104
126
|
${observationWasIdle} AS observation_was_idle,
|
|
105
127
|
CASE WHEN ${recoverySuccess}
|
|
106
128
|
AND h.rate_observation_started_at_ms IS NOT NULL
|
|
@@ -140,7 +162,9 @@ export function updateRateScopeSql(
|
|
|
140
162
|
const floorRampedObservation = `${unknownProvider} AND ph.seen_backpressure
|
|
141
163
|
AND ph.refill_per_sec < ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}
|
|
142
164
|
AND ph.next_refill_per_sec > ph.refill_per_sec`;
|
|
143
|
-
const
|
|
165
|
+
const knownRampedObservation = `${!unknownProvider} AND ph.seen_backpressure
|
|
166
|
+
AND ph.next_refill_per_sec > ph.refill_per_sec`;
|
|
167
|
+
const idleFloorObservation = `${unknownProvider} AND ph.observation_was_idle
|
|
144
168
|
AND ph.refill_per_sec < ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}`;
|
|
145
169
|
const rebaseProbe =
|
|
146
170
|
'ph.rate_probe_started_at_ms < ph.last_ramp_at_ms OR ph.rate_probe_started_at_ms < COALESCE(ph.rate_observation_started_at_ms, 0) OR ph.rate_probe_successes_at_ramp > ph.rate_successes';
|
|
@@ -163,16 +187,16 @@ export function updateRateScopeSql(
|
|
|
163
187
|
WHEN (SELECT granted FROM grant_calc) > 0 AND ph.observation_was_idle THEN 0
|
|
164
188
|
ELSE ph.rate_successes END,
|
|
165
189
|
${
|
|
166
|
-
|
|
190
|
+
probeBaselineSupported
|
|
167
191
|
? `rate_probe_successes_at_ramp = CASE
|
|
168
192
|
WHEN ${recoveredObservation} THEN 0
|
|
169
193
|
WHEN (SELECT granted FROM grant_calc) > 0
|
|
170
194
|
AND (ph.rate_observation_started_at_ms IS NULL OR ph.observation_was_idle) THEN 0
|
|
171
195
|
WHEN ${idleFloorObservation} THEN ph.rate_successes
|
|
172
|
-
WHEN ${floorRampedObservation} OR ${probedObservation} OR (${rebaseProbe}) THEN ph.rate_successes
|
|
196
|
+
WHEN ${knownRampedObservation} OR ${floorRampedObservation} OR ${probedObservation} OR (${rebaseProbe}) THEN ph.rate_successes
|
|
173
197
|
ELSE ph.rate_probe_successes_at_ramp END,
|
|
174
198
|
rate_probe_started_at_ms = CASE
|
|
175
|
-
WHEN ${idleFloorObservation} OR ${recoveredObservation} OR ${floorRampedObservation} OR ${probedObservation} OR (${rebaseProbe}) THEN nv.now_ms
|
|
199
|
+
WHEN ${knownRampedObservation} OR ${idleFloorObservation} OR ${recoveredObservation} OR ${floorRampedObservation} OR ${probedObservation} OR (${rebaseProbe}) THEN nv.now_ms
|
|
176
200
|
WHEN (SELECT granted FROM grant_calc) > 0
|
|
177
201
|
AND (ph.rate_observation_started_at_ms IS NULL OR ph.observation_was_idle) THEN nv.now_ms
|
|
178
202
|
ELSE ph.rate_probe_started_at_ms END,`
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts
CHANGED
|
@@ -1444,7 +1444,12 @@ async function acquirePureRate(
|
|
|
1444
1444
|
LEAST(
|
|
1445
1445
|
${effectiveCapacitySql('normalized', 'refill_per_sec', unknownProvider)},
|
|
1446
1446
|
ph.tokens_after_refill,
|
|
1447
|
-
|
|
1447
|
+
GREATEST(CASE WHEN ph.post_hold_probe_due
|
|
1448
|
+
AND LEAST(b.tokens, sc.capacity)
|
|
1449
|
+
+ GREATEST(0, nv.now_ms - b.refilled_at_ms) / 1000.0
|
|
1450
|
+
* CASE WHEN sc.adaptive_max_configured
|
|
1451
|
+
THEN sc.max_rps ELSE b.max_rps END >= 1
|
|
1452
|
+
THEN 1.0 ELSE 0.0 END, LEAST(b.tokens, sc.capacity)
|
|
1448
1453
|
+ GREATEST(0, nv.now_ms - b.refilled_at_ms) / 1000.0
|
|
1449
1454
|
* LEAST(
|
|
1450
1455
|
CASE
|
|
@@ -1452,7 +1457,7 @@ async function acquirePureRate(
|
|
|
1452
1457
|
ELSE b.max_rps
|
|
1453
1458
|
END,
|
|
1454
1459
|
GREATEST(sc.min_rps, ph.refill_per_sec)
|
|
1455
|
-
)
|
|
1460
|
+
))
|
|
1456
1461
|
) AS tokens_after_refill
|
|
1457
1462
|
FROM ${bucketTableName(input)} b
|
|
1458
1463
|
JOIN seed_config sc ON sc.rule_id = b.rule_id
|
|
@@ -1683,7 +1688,7 @@ async function acquirePureRate(
|
|
|
1683
1688
|
(SELECT cool_until_ms FROM cooling),
|
|
1684
1689
|
(SELECT retry_at_ms FROM cooling)
|
|
1685
1690
|
) - (SELECT now_ms FROM refreshed LIMIT 1)${fair?.waitBranch ?? ''}
|
|
1686
|
-
ELSE (
|
|
1691
|
+
ELSE LEAST((SELECT pending_recovery_wait_ms FROM provider_hold), (
|
|
1687
1692
|
SELECT CEIL(
|
|
1688
1693
|
MAX(
|
|
1689
1694
|
(
|
|
@@ -1699,7 +1704,7 @@ async function acquirePureRate(
|
|
|
1699
1704
|
)
|
|
1700
1705
|
)::bigint
|
|
1701
1706
|
FROM updated
|
|
1702
|
-
)
|
|
1707
|
+
))
|
|
1703
1708
|
END AS wait_ms
|
|
1704
1709
|
`,
|
|
1705
1710
|
[
|
|
@@ -1964,7 +1969,12 @@ async function grantWithConcurrency(
|
|
|
1964
1969
|
LEAST(
|
|
1965
1970
|
${effectiveCapacitySql('normalized', 'refill_per_sec', unknownProvider)},
|
|
1966
1971
|
ph.tokens_after_refill,
|
|
1967
|
-
|
|
1972
|
+
GREATEST(CASE WHEN ph.post_hold_probe_due
|
|
1973
|
+
AND LEAST(b.tokens, sc.capacity)
|
|
1974
|
+
+ GREATEST(0, nv.now_ms - b.refilled_at_ms) / 1000.0
|
|
1975
|
+
* CASE WHEN sc.adaptive_max_configured
|
|
1976
|
+
THEN sc.max_rps ELSE b.max_rps END >= 1
|
|
1977
|
+
THEN 1.0 ELSE 0.0 END, LEAST(b.tokens, sc.capacity)
|
|
1968
1978
|
+ GREATEST(0, nv.now_ms - b.refilled_at_ms) / 1000.0
|
|
1969
1979
|
* LEAST(
|
|
1970
1980
|
CASE
|
|
@@ -1972,7 +1982,7 @@ async function grantWithConcurrency(
|
|
|
1972
1982
|
ELSE b.max_rps
|
|
1973
1983
|
END,
|
|
1974
1984
|
GREATEST(sc.min_rps, ph.refill_per_sec)
|
|
1975
|
-
)
|
|
1985
|
+
))
|
|
1976
1986
|
) AS tokens_after_refill
|
|
1977
1987
|
FROM ${bucketTableName(input)} b
|
|
1978
1988
|
JOIN seed_config sc ON sc.rule_id = b.rule_id
|
|
@@ -2306,7 +2316,7 @@ async function grantWithConcurrency(
|
|
|
2306
2316
|
(SELECT retry_at_ms FROM cooling)
|
|
2307
2317
|
) - (SELECT now_ms FROM refreshed LIMIT 1)${fair?.waitBranch ?? ''}
|
|
2308
2318
|
WHEN (SELECT free FROM free_slots) <= 0 THEN $7::bigint
|
|
2309
|
-
ELSE (
|
|
2319
|
+
ELSE LEAST((SELECT pending_recovery_wait_ms FROM provider_hold), (
|
|
2310
2320
|
SELECT CEIL(
|
|
2311
2321
|
MAX(
|
|
2312
2322
|
(
|
|
@@ -2323,7 +2333,7 @@ async function grantWithConcurrency(
|
|
|
2323
2333
|
)
|
|
2324
2334
|
)::bigint
|
|
2325
2335
|
FROM updated
|
|
2326
|
-
)
|
|
2336
|
+
))
|
|
2327
2337
|
END AS wait_ms
|
|
2328
2338
|
`,
|
|
2329
2339
|
[
|
|
@@ -16389,7 +16389,6 @@ export async function executePostgresSchedulerClaim(
|
|
|
16389
16389
|
execute: PostgresSchedulerAttemptExecutor,
|
|
16390
16390
|
options: PostgresSchedulerClaimExecutionOptions = {},
|
|
16391
16391
|
): Promise<PostgresSchedulerWorkerOnceResult> {
|
|
16392
|
-
let runtimeResources: unknown[] = [];
|
|
16393
16392
|
let runnerFailureResult: Extract<
|
|
16394
16393
|
PlayRunnerResult,
|
|
16395
16394
|
{ status: 'failed' }
|
|
@@ -16445,11 +16444,6 @@ export async function executePostgresSchedulerClaim(
|
|
|
16445
16444
|
},
|
|
16446
16445
|
options,
|
|
16447
16446
|
);
|
|
16448
|
-
runtimeResources = await readPostgresSchedulerRuntimeResourcesForRun(
|
|
16449
|
-
client,
|
|
16450
|
-
{ runId: claim.runId },
|
|
16451
|
-
options,
|
|
16452
|
-
);
|
|
16453
16447
|
// A PlayRunnerResult envelope ({status, output, logs, steps, ...}) is the
|
|
16454
16448
|
// executor's transport shape; the run's terminal result — what the ledger
|
|
16455
16449
|
// run.completed event and `runs get` expose — is the play's own output.
|
|
@@ -16587,31 +16581,9 @@ export async function executePostgresSchedulerClaim(
|
|
|
16587
16581
|
`Postgres scheduler worker failed after losing lease for ${claim.runId}/${claim.attempt}: ${message}`,
|
|
16588
16582
|
);
|
|
16589
16583
|
}
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
{
|
|
16594
|
-
runId: claim.runId,
|
|
16595
|
-
billingEndedAt: runnerTerminalReceivedAtMs ?? Date.now(),
|
|
16596
|
-
terminalReason,
|
|
16597
|
-
},
|
|
16598
|
-
options,
|
|
16599
|
-
).catch((settlementError) => {
|
|
16600
|
-
console.warn('[postgres-scheduler.resource_settlement_failed]', {
|
|
16601
|
-
runId: claim.runId,
|
|
16602
|
-
terminalReason,
|
|
16603
|
-
error:
|
|
16604
|
-
settlementError instanceof Error
|
|
16605
|
-
? settlementError.message
|
|
16606
|
-
: String(settlementError),
|
|
16607
|
-
});
|
|
16608
|
-
});
|
|
16609
|
-
runtimeResources = await readPostgresSchedulerRuntimeResourcesForRun(
|
|
16610
|
-
client,
|
|
16611
|
-
{ runId: claim.runId },
|
|
16612
|
-
options,
|
|
16613
|
-
).catch(() => []);
|
|
16614
|
-
}
|
|
16584
|
+
// The failure statement already stamps every sandbox and persists its
|
|
16585
|
+
// cleanup/billing obligations. Return to terminal projection without
|
|
16586
|
+
// reacquiring custody locks or reading resources that this caller never uses.
|
|
16615
16587
|
return {
|
|
16616
16588
|
status: 'failed',
|
|
16617
16589
|
runId: claim.runId,
|
|
@@ -19477,6 +19449,27 @@ export async function readPostgresSchedulerTerminalArrayInputIntent(
|
|
|
19477
19449
|
return readTerminalArrayInputIntentForScope(client, input, options);
|
|
19478
19450
|
}
|
|
19479
19451
|
|
|
19452
|
+
/**
|
|
19453
|
+
* Prove delivery before exposing the same run's terminal cleanup intent.
|
|
19454
|
+
* Fold the optional-column probe into that proof, preserving old schemas
|
|
19455
|
+
* without another round trip or copying the wide run tuple to JSON.
|
|
19456
|
+
*/
|
|
19457
|
+
export async function assertPostgresRunLedgerDeliveryAndReadTerminalArrayInputIntent(
|
|
19458
|
+
client: PostgresSchedulerQueryClient,
|
|
19459
|
+
input: Parameters<typeof assertPostgresRunLedgerDelivery>[1],
|
|
19460
|
+
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
19461
|
+
): Promise<{ playName: string | null; started: boolean }> {
|
|
19462
|
+
const markerPresent = await provePostgresRunLedgerDelivery(
|
|
19463
|
+
client,
|
|
19464
|
+
input,
|
|
19465
|
+
options,
|
|
19466
|
+
true,
|
|
19467
|
+
);
|
|
19468
|
+
return markerPresent
|
|
19469
|
+
? readTerminalArrayInputIntentRow(client, input, options)
|
|
19470
|
+
: { playName: null, started: false };
|
|
19471
|
+
}
|
|
19472
|
+
|
|
19480
19473
|
/** Internal dispatch already owns the run's outbox lease; receiver reads also bind its org. */
|
|
19481
19474
|
async function readTerminalArrayInputIntentForScope(
|
|
19482
19475
|
client: PostgresSchedulerQueryClient,
|
|
@@ -19499,6 +19492,14 @@ async function readTerminalArrayInputIntentForScope(
|
|
|
19499
19492
|
if (column.rows[0]?.present !== true) {
|
|
19500
19493
|
return { playName: null, started: false };
|
|
19501
19494
|
}
|
|
19495
|
+
return readTerminalArrayInputIntentRow(client, input, options);
|
|
19496
|
+
}
|
|
19497
|
+
|
|
19498
|
+
async function readTerminalArrayInputIntentRow(
|
|
19499
|
+
client: PostgresSchedulerQueryClient,
|
|
19500
|
+
input: { orgId?: string; runId: string },
|
|
19501
|
+
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
19502
|
+
): Promise<{ playName: string | null; started: boolean }> {
|
|
19502
19503
|
const run = await client.query<{
|
|
19503
19504
|
array_input_started: boolean;
|
|
19504
19505
|
play_name: string;
|
|
@@ -19529,6 +19530,15 @@ export async function assertPostgresRunLedgerDelivery(
|
|
|
19529
19530
|
},
|
|
19530
19531
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
19531
19532
|
): Promise<void> {
|
|
19533
|
+
await provePostgresRunLedgerDelivery(client, input, options);
|
|
19534
|
+
}
|
|
19535
|
+
|
|
19536
|
+
async function provePostgresRunLedgerDelivery(
|
|
19537
|
+
client: PostgresSchedulerQueryClient,
|
|
19538
|
+
input: Parameters<typeof assertPostgresRunLedgerDelivery>[1],
|
|
19539
|
+
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
19540
|
+
readArrayInputMarker = false,
|
|
19541
|
+
): Promise<boolean> {
|
|
19532
19542
|
const result = await client.query<{
|
|
19533
19543
|
delivery_key: string;
|
|
19534
19544
|
event_type: string;
|
|
@@ -19539,6 +19549,7 @@ export async function assertPostgresRunLedgerDelivery(
|
|
|
19539
19549
|
blocked: boolean;
|
|
19540
19550
|
payload_json: unknown;
|
|
19541
19551
|
created_at: Date;
|
|
19552
|
+
array_input_marker_present?: boolean;
|
|
19542
19553
|
}>(
|
|
19543
19554
|
`
|
|
19544
19555
|
SELECT outbox.delivery_key,
|
|
@@ -19551,6 +19562,16 @@ export async function assertPostgresRunLedgerDelivery(
|
|
|
19551
19562
|
outbox.failed_at IS NOT NULL AS blocked,
|
|
19552
19563
|
outbox.payload_json,
|
|
19553
19564
|
outbox.created_at
|
|
19565
|
+
${
|
|
19566
|
+
readArrayInputMarker
|
|
19567
|
+
? `, EXISTS (
|
|
19568
|
+
SELECT 1 FROM pg_attribute
|
|
19569
|
+
WHERE attrelid = to_regclass($3)
|
|
19570
|
+
AND attname = 'array_input_started'
|
|
19571
|
+
AND NOT attisdropped
|
|
19572
|
+
) AS array_input_marker_present`
|
|
19573
|
+
: ''
|
|
19574
|
+
}
|
|
19554
19575
|
FROM ${tableName('outbox', options)} AS outbox
|
|
19555
19576
|
JOIN ${tableName('runs', options)} AS runs ON runs.run_id = outbox.run_id
|
|
19556
19577
|
WHERE outbox.run_id = $1 AND runs.org_id = $2
|
|
@@ -19562,7 +19583,9 @@ export async function assertPostgresRunLedgerDelivery(
|
|
|
19562
19583
|
-- their own delivery without changing the drain's convergence behavior.
|
|
19563
19584
|
LIMIT ${RUN_LEDGER_PROJECTION_PREFIX_MAX_FACTS}
|
|
19564
19585
|
`,
|
|
19565
|
-
|
|
19586
|
+
readArrayInputMarker
|
|
19587
|
+
? [input.runId, input.orgId, tableName('runs', options)]
|
|
19588
|
+
: [input.runId, input.orgId],
|
|
19566
19589
|
);
|
|
19567
19590
|
const rows = result.rows;
|
|
19568
19591
|
const leaseOwner = input.leaseOwner?.trim() || rows[0]?.lease_owner;
|
|
@@ -19656,7 +19679,8 @@ export async function assertPostgresRunLedgerDelivery(
|
|
|
19656
19679
|
input.idempotencyKey === batchKey ||
|
|
19657
19680
|
legacySingletonKey)
|
|
19658
19681
|
) {
|
|
19659
|
-
if (input.projectedEvents === undefined)
|
|
19682
|
+
if (input.projectedEvents === undefined)
|
|
19683
|
+
return rows[0]?.array_input_marker_present === true;
|
|
19660
19684
|
const prefixEvents: PlayRunLedgerIngressEvent[] = [];
|
|
19661
19685
|
for (const prefixRow of prefix) {
|
|
19662
19686
|
prefixEvents.push(
|
|
@@ -19696,7 +19720,8 @@ export async function assertPostgresRunLedgerDelivery(
|
|
|
19696
19720
|
expectedEventCandidates: expectedProjectionCandidates,
|
|
19697
19721
|
...(input.projectionChunk ? { chunk: input.projectionChunk } : {}),
|
|
19698
19722
|
});
|
|
19699
|
-
if (projectionMismatch === null)
|
|
19723
|
+
if (projectionMismatch === null)
|
|
19724
|
+
return rows[0]?.array_input_marker_present === true;
|
|
19700
19725
|
throw new RunLedgerProjectionLeaseLostError(
|
|
19701
19726
|
'projected_events_mismatch',
|
|
19702
19727
|
projectionMismatch,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunk3MQJJ6YXjs = require('./chunk-3MQJJ6YX.js');
|
|
17
|
+
require('./chunk-U3F63UWD.js');
|
|
18
|
+
require('./chunk-BLW2K6YH.js');
|
|
19
|
+
require('./chunk-B7NJ5JQ2.js');
|
|
20
|
+
require('./chunk-ALJJRZNJ.js');
|
|
21
|
+
require('./chunk-XNYIZMNQ.js');
|
|
22
|
+
require('./chunk-DIAWYWT5.js');
|
|
23
|
+
require('./chunk-CKSRTD45.js');
|
|
24
|
+
require('./chunk-OG64RBAC.js');
|
|
25
|
+
require('./chunk-COGTRVWW.js');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunk3MQJJ6YXjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunk3MQJJ6YXjs.authStatusLine; exports.clearPendingClaim = _chunk3MQJJ6YXjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunk3MQJJ6YXjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunk3MQJJ6YXjs.handleRegister; exports.handleStatus = _chunk3MQJJ6YXjs.handleStatus; exports.handleWait = _chunk3MQJJ6YXjs.handleWait; exports.httpJson = _chunk3MQJJ6YXjs.httpJson; exports.readPendingAuthClaim = _chunk3MQJJ6YXjs.readPendingAuthClaim; exports.readStatusBanner = _chunk3MQJJ6YXjs.readStatusBanner; exports.registerAuthCommands = _chunk3MQJJ6YXjs.registerAuthCommands; exports.reportSetupCompleted = _chunk3MQJJ6YXjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunk3MQJJ6YXjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunk3MQJJ6YXjs.statusBannerLine;
|
|
@@ -13,14 +13,14 @@ import {
|
|
|
13
13
|
reportSetupCompleted,
|
|
14
14
|
resolvePendingAuthClaimForResume,
|
|
15
15
|
statusBannerLine
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-42F6LTBJ.mjs";
|
|
17
|
+
import "./chunk-BVAYLXMH.mjs";
|
|
18
|
+
import "./chunk-NGOKBSBH.mjs";
|
|
19
|
+
import "./chunk-3QSFSHCJ.mjs";
|
|
20
20
|
import "./chunk-4QF2K7TM.mjs";
|
|
21
21
|
import "./chunk-DLIRSHV6.mjs";
|
|
22
22
|
import "./chunk-HBL4PM5Q.mjs";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-YAAQNDP6.mjs";
|
|
24
24
|
import "./chunk-WZYKRD7T.mjs";
|
|
25
25
|
import "./chunk-KRD6H754.mjs";
|
|
26
26
|
export {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeeplineClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DIMKSDF6.mjs";
|
|
4
4
|
import {
|
|
5
5
|
iterateCursorPages,
|
|
6
6
|
requireBillingIdempotencyKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VFP3MFLD.mjs";
|
|
8
8
|
import "./chunk-L2VKAASU.mjs";
|
|
9
9
|
import "./chunk-NELMCOWK.mjs";
|
|
10
10
|
import "./chunk-S3A4IXBQ.mjs";
|
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
openInBrowser,
|
|
16
16
|
printCommandEnvelope,
|
|
17
17
|
shouldEmitJson
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-BVAYLXMH.mjs";
|
|
19
|
+
import "./chunk-NGOKBSBH.mjs";
|
|
20
|
+
import "./chunk-3QSFSHCJ.mjs";
|
|
21
21
|
import {
|
|
22
22
|
AuthError,
|
|
23
23
|
ConfigError
|
|
@@ -26,7 +26,7 @@ import "./chunk-DLIRSHV6.mjs";
|
|
|
26
26
|
import {
|
|
27
27
|
DeeplineError
|
|
28
28
|
} from "./chunk-HBL4PM5Q.mjs";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-YAAQNDP6.mjs";
|
|
30
30
|
import "./chunk-WZYKRD7T.mjs";
|
|
31
31
|
import "./chunk-KRD6H754.mjs";
|
|
32
32
|
|