deepline 0.3.294 → 0.3.296
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/compat.ts +35 -7
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +108 -35
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +25 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +14 -1
- package/dist/cli/auth-JCGIDVDF.mjs +31 -0
- package/dist/cli/auth-QDWV3TXX.js +31 -0
- package/dist/cli/billing-OQBSIXRG.mjs +1749 -0
- package/dist/cli/billing-YBK3J4WP.js +1749 -0
- package/dist/cli/chunk-2C3AVPTY.js +5688 -0
- package/dist/cli/chunk-2MZ5EQZE.mjs +499 -0
- package/dist/cli/chunk-3KC45UVF.js +150 -0
- package/dist/cli/chunk-3XX5TEA4.js +15 -0
- package/dist/cli/chunk-4MBOJQPL.mjs +0 -0
- package/dist/cli/chunk-4Y6CG4GE.js +2240 -0
- package/dist/cli/chunk-4ZB3CJRD.js +1269 -0
- package/dist/cli/chunk-5JLQPVNX.js +3056 -0
- package/dist/cli/chunk-6A3TJUWC.js +76 -0
- package/dist/cli/chunk-6HPEDBSJ.js +1995 -0
- package/dist/cli/chunk-7D6QG5KF.js +890 -0
- package/dist/cli/chunk-7P5AA3SN.js +344 -0
- package/dist/cli/chunk-7UAO5MWV.mjs +190 -0
- package/dist/cli/chunk-A7427JJH.js +190 -0
- package/dist/cli/chunk-AQRTLPHZ.js +735 -0
- package/dist/cli/chunk-AYHLUHE5.js +52 -0
- package/dist/cli/chunk-BZ77OTRF.mjs +923 -0
- package/dist/cli/chunk-CBVIJSHF.mjs +560 -0
- package/dist/cli/chunk-COGTRVWW.js +30 -0
- package/dist/cli/chunk-DLIRSHV6.mjs +28 -0
- package/dist/cli/chunk-DYWHXO7O.mjs +34 -0
- package/dist/cli/chunk-EDWJY6T4.mjs +3056 -0
- package/dist/cli/chunk-EXMLR72R.mjs +0 -0
- package/dist/cli/chunk-G46HHFNB.mjs +1269 -0
- package/dist/cli/chunk-GAMFK2ZP.mjs +148 -0
- package/dist/cli/chunk-GLKUGBTP.mjs +2240 -0
- package/dist/cli/chunk-GONRLVV3.js +3440 -0
- package/dist/cli/chunk-GVUJJJ5G.mjs +76 -0
- package/dist/cli/chunk-H7HIDGZ7.mjs +150 -0
- package/dist/cli/chunk-HUZXWOSK.mjs +503 -0
- package/dist/cli/chunk-I5YZLGMG.js +1 -0
- package/dist/cli/chunk-ITOFSXIU.mjs +15 -0
- package/dist/cli/chunk-J2D3VDOU.mjs +5688 -0
- package/dist/cli/chunk-J5NA2TTX.js +503 -0
- package/dist/cli/chunk-JCS5TPNY.mjs +3440 -0
- package/dist/cli/chunk-JNNOCMQY.js +47 -0
- package/dist/cli/chunk-KRD6H754.mjs +30 -0
- package/dist/cli/chunk-L4HBNHFW.js +34 -0
- package/dist/cli/chunk-LA46MMTL.js +560 -0
- package/dist/cli/chunk-LIKFCE7Z.js +190 -0
- package/dist/cli/chunk-MIMASXO4.mjs +389 -0
- package/dist/cli/chunk-NPPJX3BL.mjs +1995 -0
- package/dist/cli/chunk-NTEZFZLE.mjs +890 -0
- package/dist/cli/chunk-NXDRDJ4K.js +389 -0
- package/dist/cli/chunk-NXGCO4JB.mjs +344 -0
- package/dist/cli/chunk-OG64RBAC.js +6 -0
- package/dist/cli/chunk-OWJZUE3Y.mjs +103 -0
- package/dist/cli/chunk-QSIO4TX2.mjs +190 -0
- package/dist/cli/chunk-RCUE5C5C.mjs +735 -0
- package/dist/cli/chunk-SDK3ZA2C.js +103 -0
- package/dist/cli/chunk-SFLARO4Y.mjs +47 -0
- package/dist/cli/chunk-TAC3JIFE.mjs +354 -0
- package/dist/cli/chunk-UC6GHEL4.js +499 -0
- package/dist/cli/chunk-UFS752TU.mjs +52 -0
- package/dist/cli/chunk-UNEMDKXN.js +1 -0
- package/dist/cli/chunk-WB6Z2Q44.mjs +1622 -0
- package/dist/cli/chunk-WJYPBHTE.js +148 -0
- package/dist/cli/chunk-WOHBA5PV.js +354 -0
- package/dist/cli/chunk-WZYKRD7T.mjs +6 -0
- package/dist/cli/chunk-XNYIZMNQ.js +28 -0
- package/dist/cli/chunk-ZDO3TO3M.js +1622 -0
- package/dist/cli/chunk-ZDOC4HFL.js +923 -0
- package/dist/cli/client-CZDA4JKO.mjs +20 -0
- package/dist/cli/client-IZGIN2ZA.js +20 -0
- package/dist/cli/csv-6KOMZA2H.mjs +585 -0
- package/dist/cli/csv-UTEQY3NA.js +585 -0
- package/dist/cli/db-D5EP6TKO.mjs +486 -0
- package/dist/cli/db-SIBLPIKC.js +486 -0
- package/dist/cli/executions-2PHT57IO.js +28 -0
- package/dist/cli/executions-DFWM2YYY.mjs +28 -0
- package/dist/cli/feedback-GZW37JMI.mjs +107 -0
- package/dist/cli/feedback-IQVWIJZ4.js +107 -0
- package/dist/cli/getting-started.js +18 -76
- package/dist/cli/getting-started.mjs +10 -37
- package/dist/cli/git-563GYLMA.js +23 -0
- package/dist/cli/git-B72Y4FFQ.mjs +23 -0
- package/dist/cli/index.js +291 -54294
- package/dist/cli/index.mjs +209 -54352
- package/dist/cli/legacy-noops-37F5MX2P.mjs +157 -0
- package/dist/cli/legacy-noops-IFGVDCOM.js +157 -0
- package/dist/cli/monitors-42H6LOVT.mjs +3251 -0
- package/dist/cli/monitors-GQCHXBXZ.js +3251 -0
- package/dist/cli/org-4GCPBTGR.js +849 -0
- package/dist/cli/org-JYZA3ZRJ.mjs +849 -0
- package/dist/cli/play-46ZJ4FMI.js +18439 -0
- package/dist/cli/play-Q2XV3FZZ.mjs +18439 -0
- package/dist/cli/providers-CTKQP45X.mjs +95 -0
- package/dist/cli/providers-PCNF5E3K.js +95 -0
- package/dist/cli/proxy-env-EBANZHPV.js +161 -0
- package/dist/cli/proxy-env-M4ZHXHRL.mjs +161 -0
- package/dist/cli/quickstart-FTHWRVWN.js +69 -0
- package/dist/cli/quickstart-X7EVVWRG.mjs +69 -0
- package/dist/cli/search-73YPOFDO.mjs +18 -0
- package/dist/cli/search-XA5UVC3G.js +18 -0
- package/dist/cli/secrets-OUMPT4FX.mjs +400 -0
- package/dist/cli/secrets-UOEVR73Q.js +400 -0
- package/dist/cli/sessions-CMKXCN5Y.js +15 -0
- package/dist/cli/sessions-ZIFGDZE7.mjs +15 -0
- package/dist/cli/settings-OO5R3G52.mjs +846 -0
- package/dist/cli/settings-ULZT2NIC.js +846 -0
- package/dist/cli/setup-6GZH52OZ.mjs +1257 -0
- package/dist/cli/setup-DHGERXPZ.js +1257 -0
- package/dist/cli/skills-Q7NUCS2W.js +28 -0
- package/dist/cli/skills-T3EY2656.mjs +28 -0
- package/dist/cli/tools-BIMOAOTX.mjs +2955 -0
- package/dist/cli/tools-ODXVCKO7.js +2955 -0
- package/dist/cli/update-UMB3ULBR.js +28 -0
- package/dist/cli/update-X4HX7Z3M.mjs +28 -0
- package/dist/cli/workflow-EAUFVPIP.mjs +1936 -0
- package/dist/cli/workflow-IVLCPFTG.js +1936 -0
- package/dist/helpers.js +6 -32
- package/dist/helpers.mjs +2 -0
- package/dist/index.js +1972 -12825
- package/dist/index.mjs +1910 -12672
- package/dist/install-integrity.json +110 -0
- package/dist/monitor-fleet-contract.js +31 -730
- package/dist/monitor-fleet-contract.mjs +18 -667
- package/dist/monitor-input-contract.js +10 -390
- package/dist/monitor-input-contract.mjs +7 -348
- package/dist/plays/bundle-play-file.mjs +13 -5178
- package/dist/plays/csv-data-input.js +5 -3132
- package/dist/plays/csv-data-input.mjs +5 -3105
- package/dist/plays/run-request.js +56 -664
- package/dist/plays/run-request.mjs +30 -588
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +5 -212
- package/dist/release.mjs +5 -185
- package/package.json +1 -1
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { SDK_API_CONTRACT, SDK_API_MAJOR, SDK_VERSION } from './version.js';
|
|
2
|
-
import {
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import {
|
|
4
|
+
existsSync,
|
|
5
|
+
mkdirSync,
|
|
6
|
+
readFileSync,
|
|
7
|
+
renameSync,
|
|
8
|
+
rmSync,
|
|
9
|
+
writeFileSync,
|
|
10
|
+
} from 'node:fs';
|
|
3
11
|
import { homedir } from 'node:os';
|
|
4
12
|
import { dirname, join } from 'node:path';
|
|
5
13
|
import { sdkCliStateDirPath } from './config.js';
|
|
@@ -96,6 +104,21 @@ type CompatCacheFile = {
|
|
|
96
104
|
>;
|
|
97
105
|
};
|
|
98
106
|
|
|
107
|
+
function writeCompatibilityCacheFile(
|
|
108
|
+
path: string,
|
|
109
|
+
cache: CompatCacheFile,
|
|
110
|
+
): void {
|
|
111
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
112
|
+
const tempPath = `${path}.${process.pid}.${randomUUID()}.tmp`;
|
|
113
|
+
try {
|
|
114
|
+
writeFileSync(tempPath, `${JSON.stringify(cache, null, 2)}\n`);
|
|
115
|
+
// Concurrent CLI processes must never see a partially written policy.
|
|
116
|
+
renameSync(tempPath, path);
|
|
117
|
+
} finally {
|
|
118
|
+
rmSync(tempPath, { force: true });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
99
122
|
function shouldSkipCompatibilityCheck(): boolean {
|
|
100
123
|
const value =
|
|
101
124
|
process.env.DEEPLINE_SKIP_SDK_COMPAT_CHECK?.trim().toLowerCase();
|
|
@@ -273,7 +296,7 @@ function invalidateCachedCompatibility(
|
|
|
273
296
|
const entries = existing.entries ?? {};
|
|
274
297
|
delete entries[compatibilityCacheKey(baseUrl, command, skillsVersion)];
|
|
275
298
|
delete entries[legacyCompatibilityCacheKey(baseUrl, command)];
|
|
276
|
-
|
|
299
|
+
writeCompatibilityCacheFile(cachePath, { entries });
|
|
277
300
|
} catch {
|
|
278
301
|
// A cache that cannot be edited simply expires on its own TTL.
|
|
279
302
|
}
|
|
@@ -287,16 +310,21 @@ function writeCachedCompatibility(
|
|
|
287
310
|
): void {
|
|
288
311
|
try {
|
|
289
312
|
const path = sdkCompatibilityCachePath(baseUrl);
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
313
|
+
let existing: CompatCacheFile = {};
|
|
314
|
+
if (existsSync(path)) {
|
|
315
|
+
try {
|
|
316
|
+
existing = JSON.parse(readFileSync(path, 'utf8')) as CompatCacheFile;
|
|
317
|
+
} catch {
|
|
318
|
+
// A failed or overlapping old write can corrupt the optional cache.
|
|
319
|
+
// Replace it with this live policy instead of failing every future write.
|
|
320
|
+
}
|
|
321
|
+
}
|
|
293
322
|
const entries = existing.entries ?? {};
|
|
294
323
|
entries[compatibilityCacheKey(baseUrl, command, skillsVersion)] = {
|
|
295
324
|
savedAt: Date.now(),
|
|
296
325
|
response,
|
|
297
326
|
};
|
|
298
|
-
|
|
299
|
-
writeFileSync(path, `${JSON.stringify({ entries }, null, 2)}\n`);
|
|
327
|
+
writeCompatibilityCacheFile(path, { entries });
|
|
300
328
|
} catch {
|
|
301
329
|
// Compatibility checks are advisory unless the server explicitly responds
|
|
302
330
|
// with a blocking policy. Cache failures must not block normal CLI usage.
|
|
@@ -200,7 +200,7 @@ export const SDK_RELEASE = {
|
|
|
200
200
|
// getters keep their established compatibility behavior.
|
|
201
201
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
202
202
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
203
|
-
version: '0.3.
|
|
203
|
+
version: '0.3.296',
|
|
204
204
|
updateSummary:
|
|
205
205
|
'Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.',
|
|
206
206
|
packageCapabilities: {
|
|
@@ -193,6 +193,7 @@ import {
|
|
|
193
193
|
readAbsurdSchemaSql,
|
|
194
194
|
} from './absurd-pool';
|
|
195
195
|
import {
|
|
196
|
+
isImmutableRuntimeExecutionRecoveryOrigin,
|
|
196
197
|
runtimeApiBaseUrlFromLaunch,
|
|
197
198
|
runtimeTokenOriginFromLaunch,
|
|
198
199
|
} from './runtime-api-origin';
|
|
@@ -349,11 +350,15 @@ const POSTGRES_SCHEDULER_SCHEMA_INIT_STATEMENT_TIMEOUT_MS = 60_000;
|
|
|
349
350
|
// v58 installs deferred outbox readers while retaining synchronous writers
|
|
350
351
|
// until the separately operated, reader-first cutover.
|
|
351
352
|
// v59 adds origin identity bulk projection and independent durable search progress.
|
|
352
|
-
|
|
353
|
+
// v60 indexes all sandbox leases by Run, including released custody history.
|
|
354
|
+
// This marker records deployment work, never a runtime schema floor.
|
|
355
|
+
export const POSTGRES_SCHEDULER_SCHEMA_VERSION = 60;
|
|
353
356
|
const POSTGRES_SCHEDULER_SCHEMA_MIGRATIONS_TABLE =
|
|
354
357
|
'scheduler_schema_migrations';
|
|
355
358
|
export const POSTGRES_SCHEDULER_OPEN_RECOVERY_INDEX =
|
|
356
359
|
'runtime_scheduler_runs_open_recovery_idx';
|
|
360
|
+
export const POSTGRES_SCHEDULER_SANDBOX_CUSTODY_INDEX =
|
|
361
|
+
'runtime_scheduler_sandbox_capacity_leases_custody_idx';
|
|
357
362
|
const POSTGRES_SCHEDULER_DEPENDENCY_CIRCUITS_TABLE =
|
|
358
363
|
'runtime_dependency_circuits';
|
|
359
364
|
/**
|
|
@@ -2693,6 +2698,12 @@ export async function ensurePostgresSchedulerSchema(
|
|
|
2693
2698
|
const hasLegacyAdmissionRows =
|
|
2694
2699
|
legacyAdmissionRows?.rows[0]?.present === true;
|
|
2695
2700
|
if (schemaCoreIsCurrent) {
|
|
2701
|
+
if (!options?.deferRuntimeAdminIndexes) {
|
|
2702
|
+
await ensurePostgresSchedulerSandboxCustodyIndex(client, {
|
|
2703
|
+
schema,
|
|
2704
|
+
concurrently: false,
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2696
2707
|
await ensurePostgresSchedulerLaunchAdmissionFunctions(client, options);
|
|
2697
2708
|
if (!schemaIsCurrent) {
|
|
2698
2709
|
await ensurePostgresSchedulerTerminalComputeBillingOutboxTrigger(
|
|
@@ -3163,6 +3174,12 @@ export async function ensurePostgresSchedulerSchema(
|
|
|
3163
3174
|
(run_id, provider, sandbox_id)
|
|
3164
3175
|
WHERE released_at IS NULL
|
|
3165
3176
|
`);
|
|
3177
|
+
if (!options?.deferRuntimeAdminIndexes) {
|
|
3178
|
+
await client.query(`
|
|
3179
|
+
CREATE INDEX IF NOT EXISTS ${POSTGRES_SCHEDULER_SANDBOX_CUSTODY_INDEX}
|
|
3180
|
+
ON ${tableName('runtime_sandbox_capacity_leases', options)} (run_id, lease_id)
|
|
3181
|
+
`);
|
|
3182
|
+
}
|
|
3166
3183
|
// Deletion note: runtime outbox producers were removed from the legacy
|
|
3167
3184
|
// store path, but the table stays in bootstrap while run-read-model/admin
|
|
3168
3185
|
// callers still import the projector against existing runtime_scheduler
|
|
@@ -4122,7 +4139,17 @@ export type PostgresSchedulerIndexState =
|
|
|
4122
4139
|
| { kind: 'invalid'; ready: boolean }
|
|
4123
4140
|
| { kind: 'ready' };
|
|
4124
4141
|
|
|
4142
|
+
// Custody locks include released history. The active-resource partial index
|
|
4143
|
+
// cannot serve that read while the transaction owns the Run and attempt locks.
|
|
4144
|
+
// This is a deploy-owned optimization, never a runtime admission prerequisite.
|
|
4145
|
+
const POSTGRES_SCHEDULER_SANDBOX_CUSTODY_INDEX_DEFINITION = {
|
|
4146
|
+
name: POSTGRES_SCHEDULER_SANDBOX_CUSTODY_INDEX,
|
|
4147
|
+
table: 'runtime_sandbox_capacity_leases',
|
|
4148
|
+
definition: '(run_id, lease_id)',
|
|
4149
|
+
} as const;
|
|
4150
|
+
|
|
4125
4151
|
const POSTGRES_SCHEDULER_RUNTIME_ADMIN_INDEXES = [
|
|
4152
|
+
POSTGRES_SCHEDULER_SANDBOX_CUSTODY_INDEX_DEFINITION,
|
|
4126
4153
|
{
|
|
4127
4154
|
name: 'runtime_scheduler_attempts_active_status_created_idx',
|
|
4128
4155
|
table: 'attempts',
|
|
@@ -4337,38 +4364,73 @@ export async function ensurePostgresSchedulerRuntimeAdminIndexesConcurrently(
|
|
|
4337
4364
|
client: PostgresSchedulerQueryClient,
|
|
4338
4365
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
4339
4366
|
): Promise<void> {
|
|
4340
|
-
const schema = schemaName(options);
|
|
4341
4367
|
for (const index of POSTGRES_SCHEDULER_RUNTIME_ADMIN_INDEXES) {
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4368
|
+
await ensurePostgresSchedulerIndex(client, index, options, true);
|
|
4369
|
+
}
|
|
4370
|
+
}
|
|
4371
|
+
|
|
4372
|
+
async function ensurePostgresSchedulerIndex(
|
|
4373
|
+
client: PostgresSchedulerQueryClient,
|
|
4374
|
+
index: { name: string; table: string; definition: string },
|
|
4375
|
+
options: Pick<PostgresSchedulerOptions, 'schema'> | undefined,
|
|
4376
|
+
concurrently: boolean,
|
|
4377
|
+
): Promise<void> {
|
|
4378
|
+
const schema = schemaName(options);
|
|
4379
|
+
const state = await readPostgresSchedulerIndexState(
|
|
4380
|
+
client,
|
|
4381
|
+
index.name,
|
|
4382
|
+
index.table,
|
|
4383
|
+
options,
|
|
4384
|
+
);
|
|
4385
|
+
if (state.kind === 'ready') return;
|
|
4386
|
+
const mode = concurrently ? 'CONCURRENTLY ' : '';
|
|
4387
|
+
if (state.kind === 'invalid') {
|
|
4388
|
+
await client.query(
|
|
4389
|
+
`DROP INDEX ${mode}IF EXISTS ${quoteIdent(schema)}.${quoteIdent(index.name)}`,
|
|
4347
4390
|
);
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
index.
|
|
4362
|
-
options,
|
|
4391
|
+
}
|
|
4392
|
+
await client.query(`
|
|
4393
|
+
CREATE INDEX ${mode}IF NOT EXISTS ${quoteIdent(index.name)}
|
|
4394
|
+
ON ${tableName(index.table, options)} ${index.definition}
|
|
4395
|
+
`);
|
|
4396
|
+
const installed = await readPostgresSchedulerIndexState(
|
|
4397
|
+
client,
|
|
4398
|
+
index.name,
|
|
4399
|
+
index.table,
|
|
4400
|
+
options,
|
|
4401
|
+
);
|
|
4402
|
+
if (installed.kind !== 'ready') {
|
|
4403
|
+
throw new Error(
|
|
4404
|
+
`Runtime scheduler index ${schema}.${index.name} is not valid and ready after creation.`,
|
|
4363
4405
|
);
|
|
4364
|
-
if (installed.kind !== 'ready') {
|
|
4365
|
-
throw new Error(
|
|
4366
|
-
`Runtime scheduler index ${schema}.${index.name} is not valid and ready after concurrent creation.`,
|
|
4367
|
-
);
|
|
4368
|
-
}
|
|
4369
4406
|
}
|
|
4370
4407
|
}
|
|
4371
4408
|
|
|
4409
|
+
export async function readPostgresSchedulerSandboxCustodyIndexState(
|
|
4410
|
+
client: PostgresSchedulerQueryClient,
|
|
4411
|
+
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
4412
|
+
): Promise<PostgresSchedulerIndexState> {
|
|
4413
|
+
return readPostgresSchedulerIndexState(
|
|
4414
|
+
client,
|
|
4415
|
+
POSTGRES_SCHEDULER_SANDBOX_CUSTODY_INDEX,
|
|
4416
|
+
'runtime_sandbox_capacity_leases',
|
|
4417
|
+
options,
|
|
4418
|
+
);
|
|
4419
|
+
}
|
|
4420
|
+
|
|
4421
|
+
/** Shared schemas build concurrently; only quiesced run-scoped schemas opt out. */
|
|
4422
|
+
export async function ensurePostgresSchedulerSandboxCustodyIndex(
|
|
4423
|
+
client: PostgresSchedulerQueryClient,
|
|
4424
|
+
options: Pick<PostgresSchedulerOptions, 'schema'> & { concurrently: boolean },
|
|
4425
|
+
): Promise<void> {
|
|
4426
|
+
await ensurePostgresSchedulerIndex(
|
|
4427
|
+
client,
|
|
4428
|
+
POSTGRES_SCHEDULER_SANDBOX_CUSTODY_INDEX_DEFINITION,
|
|
4429
|
+
options,
|
|
4430
|
+
options.concurrently,
|
|
4431
|
+
);
|
|
4432
|
+
}
|
|
4433
|
+
|
|
4372
4434
|
export async function readPostgresSchedulerOpenRecoveryIndexState(
|
|
4373
4435
|
client: PostgresSchedulerQueryClient,
|
|
4374
4436
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
@@ -20976,12 +21038,12 @@ async function loadPostgresSchedulerRuntimeApiForRun(
|
|
|
20976
21038
|
);
|
|
20977
21039
|
}
|
|
20978
21040
|
|
|
20979
|
-
//
|
|
20980
|
-
//
|
|
20981
|
-
//
|
|
20982
|
-
//
|
|
20983
|
-
//
|
|
20984
|
-
//
|
|
21041
|
+
// Reuse only gateway-issued run.progress authority. A prefix advertisement
|
|
21042
|
+
// remains reusable only for the same immutable app build; mutable receivers
|
|
21043
|
+
// must reacquire their current receipt shape on every drain. Every delivery
|
|
21044
|
+
// still claims, renews, and proves its own live lease at append. The complete
|
|
21045
|
+
// authority/routing and internal-token fingerprint isolates each run, schema,
|
|
21046
|
+
// origin, and authority. Cache loss or signer rotation never owns delivery.
|
|
20985
21047
|
const RUN_LEDGER_DISPATCH_TOKEN_CACHE_MS = 30_000;
|
|
20986
21048
|
const RUN_LEDGER_DISPATCH_TOKEN_CACHE_ENTRIES = 256;
|
|
20987
21049
|
const runLedgerDispatchTokens = new Map<
|
|
@@ -21025,6 +21087,9 @@ async function requestRunLedgerDispatchToken(
|
|
|
21025
21087
|
executorToken: cached.token,
|
|
21026
21088
|
reused: true,
|
|
21027
21089
|
cacheKey,
|
|
21090
|
+
...(cached.runLedgerIngressPrefixBatching
|
|
21091
|
+
? { runLedgerIngressPrefixBatching: true as const }
|
|
21092
|
+
: {}),
|
|
21028
21093
|
};
|
|
21029
21094
|
runLedgerDispatchTokens.delete(cacheKey);
|
|
21030
21095
|
const url = `${runtimeApiBaseUrlFromLaunch(input.launch).replace(/\/$/, '')}/api/v2/internal/play-runtime/run-ledger-dispatch-token`;
|
|
@@ -21096,6 +21161,11 @@ async function requestRunLedgerDispatchToken(
|
|
|
21096
21161
|
: 'invalid response',
|
|
21097
21162
|
});
|
|
21098
21163
|
}
|
|
21164
|
+
const reusablePrefix =
|
|
21165
|
+
body.runLedgerIngressPrefixBatching === true &&
|
|
21166
|
+
isImmutableRuntimeExecutionRecoveryOrigin(
|
|
21167
|
+
runtimeApiBaseUrlFromLaunch(input.launch),
|
|
21168
|
+
);
|
|
21099
21169
|
// Decode only the lifetime, never an authentication decision: the app
|
|
21100
21170
|
// validates the signature, run scope, and live delivery lease on append.
|
|
21101
21171
|
// Opaque/older token formats continue to work without this optimization.
|
|
@@ -21107,7 +21177,7 @@ async function requestRunLedgerDispatchToken(
|
|
|
21107
21177
|
).toString(),
|
|
21108
21178
|
) as { exp?: unknown };
|
|
21109
21179
|
if (
|
|
21110
|
-
body.runLedgerIngressPrefixBatching === undefined &&
|
|
21180
|
+
(body.runLedgerIngressPrefixBatching === undefined || reusablePrefix) &&
|
|
21111
21181
|
typeof claims.exp === 'number' &&
|
|
21112
21182
|
Number.isFinite(claims.exp)
|
|
21113
21183
|
) {
|
|
@@ -21119,6 +21189,9 @@ async function requestRunLedgerDispatchToken(
|
|
|
21119
21189
|
runLedgerDispatchTokens.set(cacheKey, {
|
|
21120
21190
|
token: body.executorToken,
|
|
21121
21191
|
expiresAt,
|
|
21192
|
+
...(reusablePrefix
|
|
21193
|
+
? { runLedgerIngressPrefixBatching: true as const }
|
|
21194
|
+
: {}),
|
|
21122
21195
|
});
|
|
21123
21196
|
while (
|
|
21124
21197
|
runLedgerDispatchTokens.size > RUN_LEDGER_DISPATCH_TOKEN_CACHE_ENTRIES
|
|
@@ -21132,7 +21205,7 @@ async function requestRunLedgerDispatchToken(
|
|
|
21132
21205
|
} catch {
|
|
21133
21206
|
// A cache miss never changes delivery or hides a gateway rejection.
|
|
21134
21207
|
}
|
|
21135
|
-
if (body.runLedgerIngressPrefixBatching !== undefined) {
|
|
21208
|
+
if (body.runLedgerIngressPrefixBatching !== undefined && !reusablePrefix) {
|
|
21136
21209
|
runLedgerDispatchTokens.delete(cacheKey);
|
|
21137
21210
|
}
|
|
21138
21211
|
return {
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import type { PlaySchedulerSubmitInput } from '../scheduler-backend';
|
|
2
2
|
|
|
3
|
+
const RUNTIME_EXECUTION_RECOVERY_DEPLOYMENT_HOST_RE =
|
|
4
|
+
/^deepline(?:-api-[a-z0-9]+|-(?!api-)[a-z0-9]+)-aero-team-0f650658\.vercel\.app$/;
|
|
5
|
+
|
|
6
|
+
/** A recovery reader must remain on one immutable, Deepline-owned app build. */
|
|
7
|
+
export function isImmutableRuntimeExecutionRecoveryOrigin(
|
|
8
|
+
origin: string,
|
|
9
|
+
): boolean {
|
|
10
|
+
try {
|
|
11
|
+
const url = new URL(origin);
|
|
12
|
+
return (
|
|
13
|
+
url.origin === origin &&
|
|
14
|
+
url.protocol === 'https:' &&
|
|
15
|
+
url.username === '' &&
|
|
16
|
+
url.password === '' &&
|
|
17
|
+
url.port === '' &&
|
|
18
|
+
url.pathname === '/' &&
|
|
19
|
+
url.search === '' &&
|
|
20
|
+
url.hash === '' &&
|
|
21
|
+
RUNTIME_EXECUTION_RECOVERY_DEPLOYMENT_HOST_RE.test(url.hostname)
|
|
22
|
+
);
|
|
23
|
+
} catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
3
28
|
/**
|
|
4
29
|
* Resolve the app origin used for authenticated runtime API calls.
|
|
5
30
|
*
|
|
@@ -348,11 +348,24 @@ function formatInsufficientCreditsMessage(input: {
|
|
|
348
348
|
? ` Add credits at ${billingUrl}.`
|
|
349
349
|
: '';
|
|
350
350
|
const minimum = input.billing.minimum_balance_credits;
|
|
351
|
+
const estimate = input.billing.estimated_credits;
|
|
352
|
+
const estimatedPrice =
|
|
353
|
+
typeof estimate === 'number'
|
|
354
|
+
? ` Estimated price: ${formatCreditAmount(estimate)}.`
|
|
355
|
+
: '';
|
|
351
356
|
if (
|
|
352
357
|
typeof minimum === 'number' &&
|
|
353
358
|
input.billing.required_credits === minimum
|
|
354
359
|
) {
|
|
355
|
-
return `Workspace balance ${balance} is below the ${formatCreditAmount(minimum)}-credit workspace minimum for starting a billable call (${operation}); this is a workspace-wide minimum, separate from the tool's own price.${addSuffix}`;
|
|
360
|
+
return `Workspace balance ${balance} is below the ${formatCreditAmount(minimum)}-credit workspace minimum for starting a billable call (${operation}); this is a workspace-wide minimum, separate from the tool's own price.${estimatedPrice}${addSuffix}`;
|
|
361
|
+
}
|
|
362
|
+
// A required balance above the call's estimate is headroom, not a price.
|
|
363
|
+
if (
|
|
364
|
+
typeof estimate === 'number' &&
|
|
365
|
+
typeof input.billing.required_credits === 'number' &&
|
|
366
|
+
input.billing.required_credits > estimate
|
|
367
|
+
) {
|
|
368
|
+
return `Workspace balance ${balance} is below the ${required}-credit balance required to start ${operation}; this is a required balance, not the price.${estimatedPrice}${addSuffix}`;
|
|
356
369
|
}
|
|
357
370
|
return `Workspace balance ${balance} < required ${required} for ${operation}.${addSuffix}`;
|
|
358
371
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EXIT_WORKSPACE_MISMATCH,
|
|
3
|
+
clearPendingClaim,
|
|
4
|
+
clearSatisfiedPendingClaim,
|
|
5
|
+
handleRegister,
|
|
6
|
+
handleStatus,
|
|
7
|
+
handleWait,
|
|
8
|
+
readPendingAuthClaim,
|
|
9
|
+
registerAuthCommands,
|
|
10
|
+
reportSetupCompleted,
|
|
11
|
+
resolvePendingAuthClaimForResume
|
|
12
|
+
} from "./chunk-BZ77OTRF.mjs";
|
|
13
|
+
import "./chunk-NTEZFZLE.mjs";
|
|
14
|
+
import "./chunk-NPPJX3BL.mjs";
|
|
15
|
+
import "./chunk-DLIRSHV6.mjs";
|
|
16
|
+
import "./chunk-QSIO4TX2.mjs";
|
|
17
|
+
import "./chunk-NXGCO4JB.mjs";
|
|
18
|
+
import "./chunk-WZYKRD7T.mjs";
|
|
19
|
+
import "./chunk-KRD6H754.mjs";
|
|
20
|
+
export {
|
|
21
|
+
EXIT_WORKSPACE_MISMATCH,
|
|
22
|
+
clearPendingClaim,
|
|
23
|
+
clearSatisfiedPendingClaim,
|
|
24
|
+
handleRegister,
|
|
25
|
+
handleStatus,
|
|
26
|
+
handleWait,
|
|
27
|
+
readPendingAuthClaim,
|
|
28
|
+
registerAuthCommands,
|
|
29
|
+
reportSetupCompleted,
|
|
30
|
+
resolvePendingAuthClaimForResume
|
|
31
|
+
};
|
|
@@ -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 _chunkZDOC4HFLjs = require('./chunk-ZDOC4HFL.js');
|
|
13
|
+
require('./chunk-7D6QG5KF.js');
|
|
14
|
+
require('./chunk-6HPEDBSJ.js');
|
|
15
|
+
require('./chunk-XNYIZMNQ.js');
|
|
16
|
+
require('./chunk-LIKFCE7Z.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 = _chunkZDOC4HFLjs.EXIT_WORKSPACE_MISMATCH; exports.clearPendingClaim = _chunkZDOC4HFLjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkZDOC4HFLjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkZDOC4HFLjs.handleRegister; exports.handleStatus = _chunkZDOC4HFLjs.handleStatus; exports.handleWait = _chunkZDOC4HFLjs.handleWait; exports.readPendingAuthClaim = _chunkZDOC4HFLjs.readPendingAuthClaim; exports.registerAuthCommands = _chunkZDOC4HFLjs.registerAuthCommands; exports.reportSetupCompleted = _chunkZDOC4HFLjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkZDOC4HFLjs.resolvePendingAuthClaimForResume;
|