deepline 0.3.323 → 0.3.324
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/context.ts +454 -129
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +407 -37
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +18 -4
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +16 -1
- package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +6 -2
- package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/gradient2-concurrency-controller.ts +15 -5
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-capacity-policy.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-concurrency-policy.ts +7 -2
- package/dist/bundling-sources/shared_libs/play-runtime/provider-row-retry-queue.ts +65 -0
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-flow.ts +34 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-map-row-feed.ts +116 -15
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +59 -6
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +294 -37
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +73 -0
- package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +41 -3
- package/dist/cli/{auth-4TYSEEPE.mjs → auth-6KWNR6AI.mjs} +4 -4
- package/dist/cli/auth-LKSTC3YV.js +31 -0
- package/dist/cli/{billing-HYX3OWXB.js → billing-CLLWHIAT.js} +70 -70
- package/dist/cli/{billing-QDER3JLM.mjs → billing-VQ2NUJLB.mjs} +4 -4
- package/dist/cli/{chunk-GUPKB4UE.js → chunk-2UQUOUAW.js} +2 -2
- package/dist/cli/{chunk-FGD2M25K.mjs → chunk-3ZKAKQYC.mjs} +1 -1
- package/dist/cli/{chunk-HJN5KR42.mjs → chunk-5CQ554BM.mjs} +1 -1
- package/dist/cli/{chunk-VN433ENM.mjs → chunk-5QZFWY7C.mjs} +2 -2
- package/dist/cli/{chunk-2HYJDTQT.mjs → chunk-AKM5JVPG.mjs} +2 -2
- package/dist/cli/{chunk-HSZD4VBE.js → chunk-D5YJHGST.js} +4 -4
- package/dist/cli/{chunk-CXJND6CJ.mjs → chunk-DO2VA5UP.mjs} +2 -2
- package/dist/cli/{chunk-YY6EASRE.mjs → chunk-EHSI2DMO.mjs} +4 -4
- package/dist/cli/{chunk-WOG5IKUF.js → chunk-EXKRHZRG.js} +220 -220
- package/dist/cli/{chunk-KLIHE4X5.js → chunk-G4F2AIQ5.js} +6 -6
- package/dist/cli/{chunk-LXUY7LRE.js → chunk-GMO3NBE2.js} +60 -60
- package/dist/cli/{chunk-M2WAAIM4.js → chunk-GROXVGGW.js} +6 -6
- package/dist/cli/{chunk-UE55ECMI.mjs → chunk-HHZDWBSQ.mjs} +1 -1
- package/dist/cli/{chunk-3OTHDXTV.mjs → chunk-I7RLL7LN.mjs} +1 -1
- package/dist/cli/{chunk-BEG62AQW.js → chunk-IXYR65PW.js} +1 -1
- package/dist/cli/{chunk-ZF6WOSMW.mjs → chunk-LHJKYMTS.mjs} +1 -1
- package/dist/cli/{chunk-UMUH2FVZ.js → chunk-N5E66DP3.js} +6 -6
- package/dist/cli/{chunk-OQPG3ND3.js → chunk-NC2ZXG2Y.js} +26 -26
- package/dist/cli/{chunk-BC3E7GEW.mjs → chunk-NIOFMRYW.mjs} +5 -5
- package/dist/cli/{chunk-3I4KDUKY.mjs → chunk-NQJQ3CLX.mjs} +3 -3
- package/dist/cli/{chunk-FNKBVKQX.js → chunk-PAA4FYCF.js} +15 -15
- package/dist/cli/{chunk-I7TAO4XH.js → chunk-QM2Z4FQF.js} +6 -6
- package/dist/cli/{chunk-W2V624T6.mjs → chunk-TJGJTB5T.mjs} +1 -1
- package/dist/cli/{chunk-EWFKMQFO.js → chunk-TZZNI2A4.js} +50 -50
- package/dist/cli/{chunk-JGTV5QNG.mjs → chunk-U2RPP53P.mjs} +6 -6
- package/dist/cli/{chunk-HUQVA5MR.js → chunk-V5PA6TCT.js} +48 -48
- package/dist/cli/{client-CEX7EHUM.mjs → client-VHUKTDAZ.mjs} +3 -3
- package/dist/cli/client-WMSTRUGP.js +20 -0
- package/dist/cli/{csv-GBPRJ6YU.js → csv-5MZY7HU5.js} +12 -12
- package/dist/cli/{csv-LR5KWOIK.mjs → csv-7DA4APB6.mjs} +3 -3
- package/dist/cli/{db-4BMCUU34.mjs → db-7UPW3N5U.mjs} +4 -4
- package/dist/cli/{db-VFKXAHQA.js → db-ICG3FUVE.js} +20 -20
- package/dist/cli/{describe-BYWGWALB.js → describe-VDRY2JCE.js} +15 -15
- package/dist/cli/{describe-VTLU5KX5.mjs → describe-ZAPGM5ND.mjs} +8 -8
- package/dist/cli/{executions-DU7I6YEU.js → executions-D5GYCY3A.js} +6 -6
- package/dist/cli/{executions-NGREVSY6.mjs → executions-TK3C2FAQ.mjs} +4 -4
- package/dist/cli/{feedback-PHPAWVHC.js → feedback-PZAZZUXF.js} +6 -6
- package/dist/cli/{feedback-GUY2CCGF.mjs → feedback-T4EIP5QR.mjs} +3 -3
- package/dist/cli/git-73N6EUZ3.js +23 -0
- package/dist/cli/{git-22YV3DFJ.mjs → git-WBFWIVO5.mjs} +4 -4
- package/dist/cli/index.js +75 -75
- package/dist/cli/index.mjs +31 -31
- package/dist/cli/{legacy-noops-YEQDVI6U.mjs → legacy-noops-DUCK7OKN.mjs} +4 -4
- package/dist/cli/{legacy-noops-V72GCF5R.js → legacy-noops-LRBJWXRK.js} +7 -7
- package/dist/cli/{monitors-MVJBQDQG.js → monitors-7S2SL62G.js} +85 -85
- package/dist/cli/{monitors-QOCAMBRV.mjs → monitors-WYH5AQIO.mjs} +4 -4
- package/dist/cli/{org-DMIOMJK6.js → org-EQNGGHPV.js} +60 -60
- package/dist/cli/{org-A53XV2UQ.mjs → org-XCSMLTUW.mjs} +4 -4
- package/dist/cli/{play-73L74CUW.mjs → play-A5ISFBJM.mjs} +7 -7
- package/dist/cli/play-CLC2Z5SO.js +152 -0
- package/dist/cli/{providers-PEOAZYM6.js → providers-DR2CLD3N.js} +7 -7
- package/dist/cli/{providers-6LDD5X5G.mjs → providers-KHTZFQ5I.mjs} +4 -4
- package/dist/cli/{quickstart-PXMC66UG.mjs → quickstart-KT4LKORA.mjs} +3 -3
- package/dist/cli/{quickstart-33IPDK2I.js → quickstart-NIRWI6YU.js} +5 -5
- package/dist/cli/search-DM7IQS5F.js +26 -0
- package/dist/cli/{search-FJEJDKPA.mjs → search-WCEXPBAT.mjs} +5 -5
- package/dist/cli/{secrets-3SCAG3T7.js → secrets-QSFEZGVE.js} +13 -13
- package/dist/cli/{secrets-Q3ZWHE5S.mjs → secrets-TN7DW3QR.mjs} +4 -4
- package/dist/cli/{sessions-QJB4LSNZ.js → sessions-LJS6W67T.js} +5 -5
- package/dist/cli/{sessions-RY3SCVN7.mjs → sessions-WSE5FN4H.mjs} +4 -4
- package/dist/cli/{settings-DLAE6POM.js → settings-FGS3VYJN.js} +74 -74
- package/dist/cli/{settings-VTYJKMI6.mjs → settings-Z3V53A6J.mjs} +7 -7
- package/dist/cli/{setup-UYQ4V4GP.mjs → setup-GMH4VJS3.mjs} +6 -6
- package/dist/cli/{setup-LM2VWSFE.js → setup-ZA234HEY.js} +41 -41
- package/dist/cli/skills-6APAQV6W.js +28 -0
- package/dist/cli/{skills-2OKHLQF7.mjs → skills-7G2RZMYH.mjs} +4 -4
- package/dist/cli/{tools-F5RYANCG.mjs → tools-7EE4BGXO.mjs} +6 -6
- package/dist/cli/tools-EPYUFWPB.js +38 -0
- package/dist/cli/update-FPVX3XJC.js +28 -0
- package/dist/cli/{update-5FDHGSNE.mjs → update-O5QEWS7K.mjs} +6 -6
- package/dist/cli/{workflow-TWQH53ZO.mjs → workflow-KE54RUTR.mjs} +5 -5
- package/dist/cli/{workflow-EQMKPCUV.js → workflow-M5PAAW3O.js} +15 -15
- package/dist/index.js +6 -6
- package/dist/index.mjs +3 -3
- package/dist/install-integrity.json +75 -74
- 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-KWPQ4JVV.js +0 -31
- package/dist/cli/client-YMQ2QFV7.js +0 -20
- package/dist/cli/git-W5NEI2BP.js +0 -23
- package/dist/cli/play-NBFCGFVC.js +0 -152
- package/dist/cli/search-FPUK2H6Y.js +0 -26
- package/dist/cli/skills-5NH6JX5H.js +0 -28
- package/dist/cli/tools-ZPGDY3I2.js +0 -38
- package/dist/cli/update-W5KBXMKC.js +0 -28
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts
CHANGED
|
@@ -4,21 +4,52 @@
|
|
|
4
4
|
* learn from copies of the same provider feedback. These CTEs are shared by
|
|
5
5
|
* pure-rate and concurrency-bearing admission, in the same atomic grant SQL.
|
|
6
6
|
*/
|
|
7
|
+
import { DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS } from '../governor/rate-state-backend';
|
|
8
|
+
|
|
7
9
|
const AIMD_RECOVERY_STEP_MS = 1_000;
|
|
8
10
|
// Increase relative to the learned rate, not by a fixed RPS amount: a long
|
|
9
11
|
// Retry-After can imply a very small quota, where even +1 RPS would be an
|
|
10
12
|
// enormous and repeated over-probe. A 25% clean-success step still recovers a
|
|
11
13
|
// healthy 1->5 RPS provider in eight observations instead of seventeen.
|
|
12
14
|
const AIMD_ADDITIVE_STEP_FRACTION = 0.25;
|
|
13
|
-
|
|
15
|
+
// Keep upward probes small enough to retain headroom after a productive
|
|
16
|
+
// decrease. Sparse successes use the earlier observation window; sustained
|
|
17
|
+
// useful work can establish another small probe each second.
|
|
18
|
+
const UNKNOWN_PROVIDER_PROBE_STEP_RPS = 0.1;
|
|
19
|
+
const UNKNOWN_PROVIDER_PROBE_INTERVAL_CAP_MS = 5_000;
|
|
20
|
+
const UNKNOWN_PROVIDER_PRODUCTIVE_RATE_FRACTION = 0.8;
|
|
14
21
|
export function acquireRateScopeSql(
|
|
15
22
|
table: string,
|
|
16
23
|
successesParameter: string,
|
|
17
24
|
minimumRateSql = 'NULL::float8',
|
|
25
|
+
unknownProvider = false,
|
|
18
26
|
): string {
|
|
19
27
|
const refillRate = `CASE WHEN ${minimumRateSql} IS NULL
|
|
20
28
|
THEN h.refill_per_sec
|
|
21
29
|
ELSE GREATEST(h.refill_per_sec, ${minimumRateSql}) END`;
|
|
30
|
+
const recoveryRate = unknownProvider
|
|
31
|
+
? `CASE WHEN ${refillRate} < ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}
|
|
32
|
+
THEN LEAST(${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}, ${refillRate} * 2)
|
|
33
|
+
ELSE ((${refillRate})::numeric + ${UNKNOWN_PROVIDER_PROBE_STEP_RPS})::float8 END`
|
|
34
|
+
: `${refillRate} * (1 + ${AIMD_ADDITIVE_STEP_FRACTION})`;
|
|
35
|
+
// Success counts are already applied once by the feedback writer. Measure
|
|
36
|
+
// this post-hold epoch, excluding Retry-After and earlier idle history. A
|
|
37
|
+
// productive second justifies a small new probe; a lone completion does not.
|
|
38
|
+
const productiveRecovery = `h.rate_observation_started_at_ms IS NOT NULL
|
|
39
|
+
AND nv.now_ms - h.rate_observation_started_at_ms >= ${AIMD_RECOVERY_STEP_MS}
|
|
40
|
+
AND h.rate_successes * 1000.0
|
|
41
|
+
/ GREATEST(${AIMD_RECOVERY_STEP_MS}, nv.now_ms - h.rate_observation_started_at_ms)
|
|
42
|
+
>= ${refillRate} * ${UNKNOWN_PROVIDER_PRODUCTIVE_RATE_FRACTION}`;
|
|
43
|
+
// Below useful seed capacity, a confirmed success can prove the next probe
|
|
44
|
+
// after one dispatch interval at the current rate. Keeping the floor's 500ms
|
|
45
|
+
// interval at 4/8 RPS waits through additional clean sends unnecessarily.
|
|
46
|
+
// Above that seed, preserve the slower productive/sparse observation window.
|
|
47
|
+
const backpressuredRecoveryInterval = unknownProvider
|
|
48
|
+
? `CASE WHEN ${refillRate} >= ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}
|
|
49
|
+
THEN CASE WHEN ${productiveRecovery} THEN ${AIMD_RECOVERY_STEP_MS}
|
|
50
|
+
ELSE LEAST(${UNKNOWN_PROVIDER_PROBE_INTERVAL_CAP_MS}, GREATEST(${AIMD_RECOVERY_STEP_MS}, h.rate_recovery_interval_ms)) END
|
|
51
|
+
ELSE LEAST(h.rate_recovery_interval_ms, CEIL(1000.0 / ${refillRate})) END`
|
|
52
|
+
: `LEAST(h.rate_recovery_interval_ms, ${AIMD_RECOVERY_STEP_MS})`;
|
|
22
53
|
return `provider_hold_rows AS (
|
|
23
54
|
SELECT * FROM ${table} WHERE bucket_id = $1 FOR UPDATE
|
|
24
55
|
), provider_hold AS (
|
|
@@ -28,22 +59,24 @@ export function acquireRateScopeSql(
|
|
|
28
59
|
h.tokens + GREATEST(0, nv.now_ms - h.refilled_at_ms) * ${refillRate} / 1000.0
|
|
29
60
|
) AS tokens_after_refill,
|
|
30
61
|
${successesParameter}::int = 0
|
|
31
|
-
|
|
62
|
+
-- A local no-progress pause remains an active observation episode,
|
|
63
|
+
-- even after the provider's shorter Retry-After has elapsed.
|
|
64
|
+
AND nv.now_ms - GREATEST(h.refilled_at_ms, h.next_dispatch_at_ms, h.retry_at_ms, h.cool_until_ms)
|
|
32
65
|
> GREATEST(1000, 2000.0 / ${refillRate}) AS observation_was_idle,
|
|
33
66
|
CASE WHEN ${successesParameter}::int > 0
|
|
34
67
|
AND h.rate_observation_started_at_ms IS NOT NULL
|
|
35
68
|
AND nv.now_ms - h.last_ramp_at_ms >= CASE WHEN h.seen_backpressure
|
|
36
|
-
THEN
|
|
69
|
+
THEN ${backpressuredRecoveryInterval}
|
|
37
70
|
ELSE h.rate_recovery_interval_ms END
|
|
38
71
|
AND h.retry_at_ms <= nv.now_ms
|
|
39
72
|
THEN LEAST(h.max_rps, CASE WHEN h.seen_backpressure
|
|
40
|
-
THEN ${
|
|
73
|
+
THEN ${recoveryRate}
|
|
41
74
|
ELSE ${refillRate} * 2 END)
|
|
42
75
|
ELSE ${refillRate} END AS next_refill_per_sec,
|
|
43
76
|
CASE WHEN ${successesParameter}::int > 0
|
|
44
77
|
AND h.rate_observation_started_at_ms IS NOT NULL
|
|
45
78
|
AND nv.now_ms - h.last_ramp_at_ms >= CASE WHEN h.seen_backpressure
|
|
46
|
-
THEN
|
|
79
|
+
THEN ${backpressuredRecoveryInterval}
|
|
47
80
|
ELSE h.rate_recovery_interval_ms END
|
|
48
81
|
AND h.retry_at_ms <= nv.now_ms
|
|
49
82
|
THEN nv.now_ms ELSE h.last_ramp_at_ms END AS next_ramp_at_ms
|
|
@@ -51,7 +84,16 @@ export function acquireRateScopeSql(
|
|
|
51
84
|
)`;
|
|
52
85
|
}
|
|
53
86
|
|
|
54
|
-
export function updateRateScopeSql(
|
|
87
|
+
export function updateRateScopeSql(
|
|
88
|
+
table: string,
|
|
89
|
+
unknownProvider = false,
|
|
90
|
+
): string {
|
|
91
|
+
// Floor recovery and productive probing measure different rates. Once the
|
|
92
|
+
// geometric ramp reaches useful capacity, start a fresh measurement instead
|
|
93
|
+
// of diluting its successful throughput with the earlier slow-start period.
|
|
94
|
+
const recoveredObservation = `${unknownProvider} AND ph.seen_backpressure
|
|
95
|
+
AND ph.refill_per_sec < ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}
|
|
96
|
+
AND ph.next_refill_per_sec >= ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}`;
|
|
55
97
|
return `updated_scope AS (
|
|
56
98
|
UPDATE ${table} h SET
|
|
57
99
|
tokens = ph.tokens_after_refill - (SELECT granted FROM grant_calc),
|
|
@@ -59,14 +101,25 @@ export function updateRateScopeSql(table: string): string {
|
|
|
59
101
|
refill_per_sec = ph.next_refill_per_sec,
|
|
60
102
|
last_ramp_at_ms = ph.next_ramp_at_ms,
|
|
61
103
|
rate_observation_started_at_ms = CASE
|
|
104
|
+
WHEN ${recoveredObservation} THEN CASE
|
|
105
|
+
WHEN (SELECT granted FROM grant_calc) > 0 THEN nv.now_ms ELSE NULL END
|
|
62
106
|
WHEN (SELECT granted FROM grant_calc) > 0 AND ph.observation_was_idle THEN nv.now_ms
|
|
63
107
|
WHEN (SELECT granted FROM grant_calc) > 0 THEN COALESCE(ph.rate_observation_started_at_ms, nv.now_ms)
|
|
64
108
|
ELSE ph.rate_observation_started_at_ms END,
|
|
65
109
|
rate_successes = CASE
|
|
110
|
+
WHEN ${recoveredObservation} THEN 0
|
|
66
111
|
WHEN (SELECT granted FROM grant_calc) > 0
|
|
67
112
|
AND ph.rate_observation_started_at_ms IS NULL THEN 0
|
|
68
113
|
WHEN (SELECT granted FROM grant_calc) > 0 AND ph.observation_was_idle THEN 0
|
|
69
114
|
ELSE ph.rate_successes END,
|
|
115
|
+
-- Do not turn an earlier productive measurement window into a failed
|
|
116
|
+
-- probe streak when an unknown provider starts a new run after idle.
|
|
117
|
+
-- Active Retry-After/local cooldowns are excluded by observation_was_idle.
|
|
118
|
+
rate_recovery_interval_ms = CASE
|
|
119
|
+
WHEN ${unknownProvider} AND (SELECT granted FROM grant_calc) > 0
|
|
120
|
+
AND ph.observation_was_idle AND ph.rate_successes > 0
|
|
121
|
+
THEN ${AIMD_RECOVERY_STEP_MS}
|
|
122
|
+
ELSE ph.rate_recovery_interval_ms END,
|
|
70
123
|
rate_throttle_ceiling_rps = CASE
|
|
71
124
|
WHEN (SELECT granted FROM grant_calc) > 0
|
|
72
125
|
AND ph.rate_observation_started_at_ms IS NULL THEN NULL
|