deepline 0.3.522 → 0.3.523
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 +118 -0
- package/dist/bundling-sources/sdk/src/index.ts +3 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +47 -18
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/db-session-renewal.ts +209 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +16 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-modal-fallback.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +38 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +92 -10
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +96 -25
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +139 -17
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts +26 -3
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +145 -5
- package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +190 -10
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +85 -5
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +21 -11
- package/dist/cli/{artifacts-RY2MK74N.mjs → artifacts-RBHR2DG4.mjs} +6 -6
- package/dist/cli/{artifacts-GIZZH5VA.js → artifacts-RZTS2JHZ.js} +18 -18
- package/dist/cli/auth-DPWYFQR5.js +43 -0
- package/dist/cli/{auth-YIBY5IKT.mjs → auth-ENQUQS56.mjs} +5 -5
- package/dist/cli/{billing-G3IX3SNY.mjs → billing-6A27ULCX.mjs} +7 -7
- package/dist/cli/{billing-UDKL53GI.js → billing-6HONTJOY.js} +82 -82
- package/dist/cli/{chunk-4DFWDA2Q.js → chunk-2BRDHM4S.js} +9 -9
- package/dist/cli/{chunk-EJBW7Y6Z.js → chunk-326WVSWS.js} +108 -96
- package/dist/cli/{chunk-7JEN3FX4.js → chunk-36LQQL5C.js} +5 -5
- package/dist/cli/{chunk-GVKW3LCA.js → chunk-4NWY7JBB.js} +11 -11
- package/dist/cli/{chunk-RKE5YTHY.mjs → chunk-4V63IJCL.mjs} +5 -5
- package/dist/cli/{chunk-VFCVH2LV.mjs → chunk-5WFQXAD4.mjs} +5 -5
- package/dist/cli/{chunk-4TUMKJZX.mjs → chunk-6DBRBWHC.mjs} +2 -2
- package/dist/cli/{chunk-CFXERH7F.mjs → chunk-6OZ2WSHD.mjs} +1 -1
- package/dist/cli/{chunk-5H22VJPE.js → chunk-7GNKAACY.js} +6 -6
- package/dist/cli/{chunk-G65FJ5JX.mjs → chunk-7M5FRSFP.mjs} +2 -2
- package/dist/cli/{chunk-PDLRUZ42.mjs → chunk-DNXP3D5H.mjs} +5 -5
- package/dist/cli/{chunk-OAQIVJFY.mjs → chunk-F3WRLFFM.mjs} +2 -2
- package/dist/cli/{chunk-RI672VNY.js → chunk-FBMOBNJY.js} +2 -2
- package/dist/cli/{chunk-NDNG3MAT.mjs → chunk-H7275EZU.mjs} +5 -5
- package/dist/cli/{chunk-C6WGMODR.mjs → chunk-HSVGP4CI.mjs} +2 -2
- package/dist/cli/{chunk-DNJJ3ULJ.js → chunk-HUC5SGJQ.js} +2 -2
- package/dist/cli/{chunk-DARD7TJ7.js → chunk-HUIFUE4L.js} +53 -53
- package/dist/cli/{chunk-52MHE7B4.mjs → chunk-I62LJ7NU.mjs} +1 -1
- package/dist/cli/{chunk-BZY335JP.js → chunk-IEVXYHGJ.js} +5 -5
- package/dist/cli/{chunk-FQQAAR3Q.mjs → chunk-JCTTXLAZ.mjs} +1 -1
- package/dist/cli/{chunk-3KMGVOBM.mjs → chunk-JGZQBDYG.mjs} +4 -4
- package/dist/cli/{chunk-ZUAKRBZB.js → chunk-JMMNCJ7Z.js} +1 -1
- package/dist/cli/{chunk-UV6XCHOZ.mjs → chunk-JVEFMOY2.mjs} +1 -1
- package/dist/cli/{chunk-FNHUDCJE.js → chunk-K326BEVR.js} +10 -10
- package/dist/cli/{chunk-MD524MRB.mjs → chunk-KILRUAXF.mjs} +1 -1
- package/dist/cli/{chunk-XXY4E57R.mjs → chunk-LZL6V5M5.mjs} +2 -2
- package/dist/cli/{chunk-GMYDVW7Z.js → chunk-MCXPJYBN.js} +3 -3
- package/dist/cli/{chunk-VE6FHVXZ.mjs → chunk-MHTRYBXY.mjs} +78 -1
- package/dist/cli/{chunk-ISUUSSS4.js → chunk-MT3WG3KR.js} +16 -16
- package/dist/cli/{chunk-37SXIFIU.js → chunk-MZROKQV3.js} +44 -44
- package/dist/cli/{chunk-4MF44THR.js → chunk-N5MLEXZ7.js} +50 -8
- package/dist/cli/{chunk-XR6TN5DT.mjs → chunk-NWTMQGPP.mjs} +6 -6
- package/dist/cli/{chunk-Y3LDRCMB.mjs → chunk-PCORO245.mjs} +2 -2
- package/dist/cli/{chunk-534YYHIF.js → chunk-PESMXAUG.js} +6 -6
- package/dist/cli/{chunk-RDJTCW3I.mjs → chunk-QMBL5ZIQ.mjs} +3 -3
- package/dist/cli/{chunk-LFSOBW7E.mjs → chunk-QOO5W5XS.mjs} +22 -10
- package/dist/cli/{chunk-ZZ7U4YJS.mjs → chunk-QSAC3IVI.mjs} +1 -1
- package/dist/cli/{chunk-HYR34KFA.js → chunk-QYXIODWH.js} +78 -1
- package/dist/cli/{chunk-BONXEWYF.mjs → chunk-RKREB7MU.mjs} +3 -3
- package/dist/cli/{chunk-KMBF3N2Z.js → chunk-RQN4PHRE.js} +16 -16
- package/dist/cli/{chunk-XT25FX6T.js → chunk-S4YKRH3W.js} +3 -3
- package/dist/cli/{chunk-F5D623KO.js → chunk-SBGKKOCC.js} +26 -26
- package/dist/cli/{chunk-5477PEHL.mjs → chunk-SXTVJIGB.mjs} +1 -1
- package/dist/cli/{chunk-7J5PLHII.mjs → chunk-U6DLLV3S.mjs} +1 -1
- package/dist/cli/{chunk-ENWJFUWK.mjs → chunk-UH3EAFFN.mjs} +2 -2
- package/dist/cli/{chunk-DLDWAPA5.js → chunk-UQN4VTZL.js} +4 -4
- package/dist/cli/{chunk-DRDZBRXV.js → chunk-V46J3UTM.js} +7 -7
- package/dist/cli/{chunk-5BQPEHEP.js → chunk-WGVJA4I5.js} +14 -14
- package/dist/cli/{chunk-SFMCKB57.mjs → chunk-WVQOXYTQ.mjs} +44 -2
- package/dist/cli/{chunk-VIM6I7RC.js → chunk-XVXEARHC.js} +41 -41
- package/dist/cli/{chunk-6SJPZV5E.js → chunk-XYL26236.js} +2 -2
- package/dist/cli/{chunk-ZZLZCO6Y.js → chunk-ZWN4RXC2.js} +22 -22
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-3HIE4VCO.js → csv-UBACJK75.js} +13 -13
- package/dist/cli/{csv-PE35WGRO.mjs → csv-YFJ2JLUP.mjs} +4 -4
- package/dist/cli/{db-O2YRTTDO.js → db-2ZPA2LZ7.js} +27 -27
- package/dist/cli/{db-L7ZMMQKW.mjs → db-NKGYTAQO.mjs} +6 -6
- package/dist/cli/{describe-NI324Y2M.mjs → describe-GX7DRKWZ.mjs} +18 -18
- package/dist/cli/describe-WQZF7MEG.js +50 -0
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/{executions-T6KU2OKK.mjs → executions-HTHQ7KKD.mjs} +6 -6
- package/dist/cli/{executions-VH4DKLFI.js → executions-NXMRGPIL.js} +8 -8
- package/dist/cli/{feedback-ZLC6G5OK.js → feedback-TGVQACRO.js} +10 -10
- package/dist/cli/{feedback-SCSJC3FX.mjs → feedback-USP4T34P.mjs} +5 -5
- package/dist/cli/{git-I4LVQCID.mjs → git-KUONEHCD.mjs} +5 -5
- package/dist/cli/git-X3SCQREB.js +25 -0
- package/dist/cli/index.js +145 -145
- package/dist/cli/index.mjs +44 -44
- package/dist/cli/{legacy-noops-UPFWEHPG.js → legacy-noops-2JY3CQ24.js} +9 -9
- package/dist/cli/{legacy-noops-44FQ2256.mjs → legacy-noops-B2GMHU42.mjs} +6 -6
- package/dist/cli/{monitors-LMSASWXE.mjs → monitors-2OVBZJ6Z.mjs} +7 -7
- package/dist/cli/{monitors-JN6IQGK6.js → monitors-XI6I52AX.js} +100 -100
- package/dist/cli/{org-F7O3ZU5O.js → org-5TUQ2H6Y.js} +235 -72
- package/dist/cli/{org-QYLVEE7A.mjs → org-BNJW764Y.mjs} +169 -6
- package/dist/cli/{pages-5XE4LBZN.mjs → pages-QC3TQIPW.mjs} +6 -6
- package/dist/cli/{pages-KEL3Y4L4.js → pages-UXCLX53Y.js} +18 -18
- package/dist/cli/{play-MWQG3G32.mjs → play-45PPG5SZ.mjs} +18 -18
- package/dist/cli/{play-OURHH6KV.js → play-KRWMZ7FG.js} +317 -317
- package/dist/cli/{providers-IQY7LUBB.mjs → providers-JDT35MRL.mjs} +6 -6
- package/dist/cli/{providers-ZCBWPE3C.js → providers-RBUJ72Y3.js} +9 -9
- package/dist/cli/{quickstart-L45NGRMI.mjs → quickstart-GD2SWGAC.mjs} +4 -4
- package/dist/cli/{quickstart-O53OXTN6.js → quickstart-JZ4Q3HFT.js} +6 -6
- package/dist/cli/{run-W745Z3Z5.js → run-JEAHA367.js} +41 -41
- package/dist/cli/{run-VCSIWLEU.mjs → run-KIZ3HBI2.mjs} +23 -23
- package/dist/cli/{search-THELKULN.mjs → search-5UFNXHFK.mjs} +8 -8
- package/dist/cli/search-6JULJMD7.js +33 -0
- package/dist/cli/{search-output-N7MJLYYD.mjs → search-output-HAXPKQO6.mjs} +4 -4
- package/dist/cli/{search-output-SJW7LEOM.js → search-output-W3RDSVLE.js} +6 -6
- package/dist/cli/{secrets-44ST3FJH.mjs → secrets-JAWT66B2.mjs} +6 -6
- package/dist/cli/{secrets-GDXPX3KB.js → secrets-PC7C2Q32.js} +15 -15
- package/dist/cli/{sessions-LYCBI77S.mjs → sessions-325V7G35.mjs} +6 -6
- package/dist/cli/sessions-WFUCOJHZ.js +18 -0
- package/dist/cli/{settings-GXPDMJFG.mjs → settings-FKHTA65P.mjs} +13 -13
- package/dist/cli/{settings-3WOFF642.js → settings-RGU6Y2QR.js} +86 -86
- package/dist/cli/{setup-YM6JEB64.mjs → setup-43GOYTFC.mjs} +10 -10
- package/dist/cli/{setup-YHLMBJP4.js → setup-ZMZ7HU2I.js} +50 -50
- package/dist/cli/skills-3XTQ6FFM.js +37 -0
- package/dist/cli/{skills-WX4XWEAT.mjs → skills-Q2VAHSXM.mjs} +8 -8
- package/dist/cli/{tools-K24VSQ7S.mjs → tools-BUH7ZWDS.mjs} +17 -17
- package/dist/cli/tools-UK2R4YXQ.js +57 -0
- package/dist/cli/{update-PSSCF5AT.mjs → update-JFALWOHD.mjs} +10 -10
- package/dist/cli/update-LNKPHS54.js +35 -0
- package/dist/cli/{workflow-DGOPYATO.mjs → workflow-ISJKLY6X.mjs} +7 -7
- package/dist/cli/{workflow-FPVI3NIA.js → workflow-YELST32A.js} +17 -17
- package/dist/{client-DA71-2_u.d.mts → client-C2N7MofG.d.mts} +1 -1
- package/dist/{client-B-2Am2y6.d.ts → client-C7lTRJjw.d.ts} +1 -1
- package/dist/{client-core-BXbds1cb.d.mts → client-core-BTkDSKGn.d.mts} +79 -2
- package/dist/{client-core-C0IzDKMJ.d.ts → client-core-hmhBi7Ib.d.ts} +79 -2
- package/dist/{compiler-manifest-B4mIIbw7.d.mts → compiler-manifest-DsxsQP-T.d.mts} +14 -7
- package/dist/{compiler-manifest-B4mIIbw7.d.ts → compiler-manifest-DsxsQP-T.d.ts} +14 -7
- package/dist/{errors-Gj9i5Rkd.d.ts → errors-Bk5h1D-C.d.ts} +1 -1
- package/dist/{errors-C2F4qzAq.d.mts → errors-qdJUVQ3g.d.mts} +1 -1
- package/dist/{index-5JZBufdF.d.mts → index-PaupwX1B.d.mts} +1 -1
- package/dist/{index-BXtSj8bv.d.ts → index-bL66eHYz.d.ts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +117 -116
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +7 -5
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-JSES2JOQ.js +0 -43
- package/dist/cli/describe-EB336DAO.js +0 -50
- package/dist/cli/git-23T7TXAH.js +0 -25
- package/dist/cli/search-R6K7ZAMU.js +0 -33
- package/dist/cli/sessions-2V5ZFOWL.js +0 -18
- package/dist/cli/skills-XNGADDO6.js +0 -37
- package/dist/cli/tools-ROUMCB7B.js +0 -57
- package/dist/cli/update-RXURGIRW.js +0 -35
|
@@ -2430,6 +2430,68 @@ export type WorkspaceCreateResult = {
|
|
|
2430
2430
|
request_id?: string;
|
|
2431
2431
|
};
|
|
2432
2432
|
|
|
2433
|
+
/** One key a service account holds. Never key material. */
|
|
2434
|
+
export type WorkspaceServiceAccountKey = {
|
|
2435
|
+
id: string;
|
|
2436
|
+
keyPrefix: string;
|
|
2437
|
+
keyLast4: string;
|
|
2438
|
+
status: string;
|
|
2439
|
+
createdAt: number;
|
|
2440
|
+
lastUsedAt: number | null;
|
|
2441
|
+
};
|
|
2442
|
+
|
|
2443
|
+
/**
|
|
2444
|
+
* A workspace member that is not a person: it owns API keys so production
|
|
2445
|
+
* credentials keep working when people leave. It cannot sign in, and its role
|
|
2446
|
+
* is read, run, or member.
|
|
2447
|
+
*/
|
|
2448
|
+
export type WorkspaceServiceAccount = {
|
|
2449
|
+
id: string;
|
|
2450
|
+
userId: string;
|
|
2451
|
+
memberId: string | null;
|
|
2452
|
+
name: string;
|
|
2453
|
+
role: string | null;
|
|
2454
|
+
createdAt: number;
|
|
2455
|
+
createdByUserId: string;
|
|
2456
|
+
activeKeyCount: number;
|
|
2457
|
+
lastUsedAt: number | null;
|
|
2458
|
+
/** Present for admins; null for other members. */
|
|
2459
|
+
keys: WorkspaceServiceAccountKey[] | null;
|
|
2460
|
+
};
|
|
2461
|
+
|
|
2462
|
+
/** Create, change, and delete service accounts and their keys. Admin only, except list. */
|
|
2463
|
+
export type WorkspaceServiceAccountsNamespace = {
|
|
2464
|
+
list: () => Promise<{ serviceAccounts: WorkspaceServiceAccount[] }>;
|
|
2465
|
+
create: (options: {
|
|
2466
|
+
name: string;
|
|
2467
|
+
role: string;
|
|
2468
|
+
}) => Promise<{ serviceAccount: WorkspaceServiceAccount }>;
|
|
2469
|
+
setRole: (
|
|
2470
|
+
serviceAccountId: string,
|
|
2471
|
+
role: string,
|
|
2472
|
+
) => Promise<{ serviceAccount: WorkspaceServiceAccount }>;
|
|
2473
|
+
delete: (
|
|
2474
|
+
serviceAccountId: string,
|
|
2475
|
+
) => Promise<{ id: string; revokedKeyCount: number }>;
|
|
2476
|
+
/**
|
|
2477
|
+
* A service account holds one active key; this is refused while it has one.
|
|
2478
|
+
* The returned `apiKey` is shown once; Deepline stores only its hash.
|
|
2479
|
+
*/
|
|
2480
|
+
createKey: (
|
|
2481
|
+
serviceAccountId: string,
|
|
2482
|
+
) => Promise<{ apiKey: string; key: WorkspaceServiceAccountKey }>;
|
|
2483
|
+
/** Revoke the active key and issue its replacement in one step; shown once. */
|
|
2484
|
+
rotateKey: (serviceAccountId: string) => Promise<{
|
|
2485
|
+
apiKey: string;
|
|
2486
|
+
key: WorkspaceServiceAccountKey;
|
|
2487
|
+
revokedKeyIds: string[];
|
|
2488
|
+
}>;
|
|
2489
|
+
revokeKey: (
|
|
2490
|
+
serviceAccountId: string,
|
|
2491
|
+
keyId: string,
|
|
2492
|
+
) => Promise<{ keyId: string; status: string }>;
|
|
2493
|
+
};
|
|
2494
|
+
|
|
2433
2495
|
/** Deliberate workspace lifecycle operations. */
|
|
2434
2496
|
export type WorkspacesNamespace = {
|
|
2435
2497
|
/** One page of current workspace memberships and effective grants. */
|
|
@@ -2451,6 +2513,7 @@ export type WorkspacesNamespace = {
|
|
|
2451
2513
|
name: string;
|
|
2452
2514
|
idempotencyKey: string;
|
|
2453
2515
|
}) => Promise<WorkspaceCreateResult>;
|
|
2516
|
+
serviceAccounts: WorkspaceServiceAccountsNamespace;
|
|
2454
2517
|
};
|
|
2455
2518
|
|
|
2456
2519
|
/** One authenticated per-request usage event from `/api/v2/usage/events`. */
|
|
@@ -3170,6 +3233,49 @@ export class DeeplineClient {
|
|
|
3170
3233
|
{ role: grants.join(',') },
|
|
3171
3234
|
),
|
|
3172
3235
|
create: (options) => this.createWorkspace(options),
|
|
3236
|
+
serviceAccounts: {
|
|
3237
|
+
list: () => this.http.get('/api/v2/auth/workspace/service-accounts'),
|
|
3238
|
+
// Creating an account or a key is not idempotent, so a transport
|
|
3239
|
+
// retry or localhost failover after a lost response could report a
|
|
3240
|
+
// false failure or mint a second live key. Surface the ambiguity;
|
|
3241
|
+
// `list` shows what exists.
|
|
3242
|
+
create: (options) =>
|
|
3243
|
+
this.http.post(
|
|
3244
|
+
'/api/v2/auth/workspace/service-accounts',
|
|
3245
|
+
options,
|
|
3246
|
+
undefined,
|
|
3247
|
+
{ maxRetries: 0, exactUrlOnly: true },
|
|
3248
|
+
),
|
|
3249
|
+
setRole: (serviceAccountId, role) =>
|
|
3250
|
+
this.http.patch(
|
|
3251
|
+
`/api/v2/auth/workspace/service-accounts/${encodeURIComponent(serviceAccountId)}`,
|
|
3252
|
+
{ role },
|
|
3253
|
+
),
|
|
3254
|
+
delete: (serviceAccountId) =>
|
|
3255
|
+
this.http.delete(
|
|
3256
|
+
`/api/v2/auth/workspace/service-accounts/${encodeURIComponent(serviceAccountId)}`,
|
|
3257
|
+
),
|
|
3258
|
+
createKey: (serviceAccountId) =>
|
|
3259
|
+
this.http.post(
|
|
3260
|
+
`/api/v2/auth/workspace/service-accounts/${encodeURIComponent(serviceAccountId)}/keys`,
|
|
3261
|
+
{},
|
|
3262
|
+
undefined,
|
|
3263
|
+
{ maxRetries: 0, exactUrlOnly: true },
|
|
3264
|
+
),
|
|
3265
|
+
// A retried rotate after a lost response would revoke the key it
|
|
3266
|
+
// just issued, so it is not retried either.
|
|
3267
|
+
rotateKey: (serviceAccountId) =>
|
|
3268
|
+
this.http.post(
|
|
3269
|
+
`/api/v2/auth/workspace/service-accounts/${encodeURIComponent(serviceAccountId)}/keys/rotate`,
|
|
3270
|
+
{},
|
|
3271
|
+
undefined,
|
|
3272
|
+
{ maxRetries: 0, exactUrlOnly: true },
|
|
3273
|
+
),
|
|
3274
|
+
revokeKey: (serviceAccountId, keyId) =>
|
|
3275
|
+
this.http.delete(
|
|
3276
|
+
`/api/v2/auth/workspace/service-accounts/${encodeURIComponent(serviceAccountId)}/keys/${encodeURIComponent(keyId)}`,
|
|
3277
|
+
),
|
|
3278
|
+
},
|
|
3173
3279
|
};
|
|
3174
3280
|
this.monitors = {
|
|
3175
3281
|
status: () => this.getMonitorsAccess(),
|
|
@@ -5876,6 +5982,18 @@ export class DeeplineClient {
|
|
|
5876
5982
|
return this.http.get('/api/v2/settings/notifications');
|
|
5877
5983
|
}
|
|
5878
5984
|
|
|
5985
|
+
/** Fresh balance of the active workspace's own provider credential. */
|
|
5986
|
+
async getIntegrationBalance(provider: string): Promise<{
|
|
5987
|
+
provider: string;
|
|
5988
|
+
credentialScope: 'customer';
|
|
5989
|
+
unit: string;
|
|
5990
|
+
observedAt: string;
|
|
5991
|
+
balance: { value: number; status: 'reported'; source: string };
|
|
5992
|
+
}> {
|
|
5993
|
+
const params = new URLSearchParams({ provider });
|
|
5994
|
+
return this.http.get(`/api/v2/integrations/balance?${params}`);
|
|
5995
|
+
}
|
|
5996
|
+
|
|
5879
5997
|
/** Get the dashboard link where a workspace owner or admin can connect a provider. */
|
|
5880
5998
|
async getIntegrationConnectLink(
|
|
5881
5999
|
provider: string,
|
|
@@ -131,6 +131,9 @@ export type {
|
|
|
131
131
|
BillingUsageOptions,
|
|
132
132
|
BillingUsageResult,
|
|
133
133
|
WorkspaceCreateResult,
|
|
134
|
+
WorkspaceServiceAccount,
|
|
135
|
+
WorkspaceServiceAccountKey,
|
|
136
|
+
WorkspaceServiceAccountsNamespace,
|
|
134
137
|
WorkspacesNamespace,
|
|
135
138
|
MonitorsNamespace,
|
|
136
139
|
MonitorsAccessStatus,
|
|
@@ -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.523',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -364,6 +364,7 @@ import {
|
|
|
364
364
|
import {
|
|
365
365
|
isAlwaysFreshIntegrationTool,
|
|
366
366
|
isAlwaysFreshIntegrationWriteTool,
|
|
367
|
+
reusableWindowEligibility,
|
|
367
368
|
} from './tool-cache-policy';
|
|
368
369
|
import { isAbortLikeError, isRowIsolationExemptError } from './row-isolation';
|
|
369
370
|
import {
|
|
@@ -7348,8 +7349,18 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
7348
7349
|
return this.currentExecutionScope.logical.runId;
|
|
7349
7350
|
}
|
|
7350
7351
|
|
|
7352
|
+
/**
|
|
7353
|
+
* `id` keeps its admitted meaning: inside an inline child it is the
|
|
7354
|
+
* composition namespace, which repeats across parent runs. `rootId` is the
|
|
7355
|
+
* run at the root of the inline composition tree (the executing run), so it
|
|
7356
|
+
* is the per-run value authors need for external idempotency keys.
|
|
7357
|
+
*/
|
|
7351
7358
|
get run(): PlayAuthoringRunScope {
|
|
7352
|
-
return {
|
|
7359
|
+
return {
|
|
7360
|
+
id: this.currentRunId,
|
|
7361
|
+
rootId: this.currentExecutionScope.logical.rootRunId,
|
|
7362
|
+
actor: this.#options.runActor ?? null,
|
|
7363
|
+
};
|
|
7353
7364
|
}
|
|
7354
7365
|
|
|
7355
7366
|
private get currentReceiptOwnerRunId(): string {
|
|
@@ -14696,27 +14707,39 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14696
14707
|
// A positive or null window on any tool call is the author's explicit
|
|
14697
14708
|
// acceptance of reuse, including for writes, sends and purchases: a hit
|
|
14698
14709
|
// returns the recorded answer and suppresses that repeat on purpose. Only
|
|
14699
|
-
// calls that are structurally not answers stay refused
|
|
14700
|
-
//
|
|
14710
|
+
// calls that are structurally not answers stay refused, by the same rule
|
|
14711
|
+
// `plays check` applies (reusableWindowEligibility). This refusal is the
|
|
14712
|
+
// backstop for dynamic tool ids and inputs the checker cannot read.
|
|
14713
|
+
const reuseVerdict = reusableWindowEligibility({
|
|
14714
|
+
kind: 'tool',
|
|
14715
|
+
toolId,
|
|
14716
|
+
input,
|
|
14717
|
+
});
|
|
14718
|
+
if (policy.effective !== 0 && 'message' in reuseVerdict) {
|
|
14719
|
+
throw new Error(reuseVerdict.message);
|
|
14720
|
+
}
|
|
14701
14721
|
const eventWait =
|
|
14702
14722
|
policy.effective === 0 && !refreshMayPublish
|
|
14703
14723
|
? null
|
|
14704
14724
|
: ((await this.#options.getIntegrationEventWaitHandler?.(toolId)) ??
|
|
14705
14725
|
null);
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14709
|
-
|
|
14710
|
-
|
|
14711
|
-
|
|
14726
|
+
// A registered event-wait handler refuses reuse even for a tool id the
|
|
14727
|
+
// rule does not list.
|
|
14728
|
+
const effectiveVerdict = eventWait
|
|
14729
|
+
? reusableWindowEligibility({
|
|
14730
|
+
kind: 'tool',
|
|
14731
|
+
toolId,
|
|
14732
|
+
input,
|
|
14733
|
+
eventWait: true,
|
|
14734
|
+
})
|
|
14735
|
+
: reuseVerdict;
|
|
14736
|
+
if (policy.effective !== 0 && 'message' in effectiveVerdict) {
|
|
14737
|
+
throw new Error(effectiveVerdict.message);
|
|
14738
|
+
}
|
|
14739
|
+
const mustExecuteEveryTime = 'message' in effectiveVerdict;
|
|
14712
14740
|
// A refresh of a reusable call still publishes its fresh result as the
|
|
14713
14741
|
// request's newest shared result; an authored 0 never does.
|
|
14714
14742
|
const publishLatestOnRefresh = refreshMayPublish && !mustExecuteEveryTime;
|
|
14715
|
-
if (policy.effective !== 0 && mustExecuteEveryTime) {
|
|
14716
|
-
throw new Error(
|
|
14717
|
-
`Tool ${toolId} cannot reuse an older result; use staleAfterSeconds: 0. Live datasets, event waits, Customer DB mutations, and Workspace operations are never reused.`,
|
|
14718
|
-
);
|
|
14719
|
-
}
|
|
14720
14743
|
|
|
14721
14744
|
// Independent lookups of one tool's identity: the first call per tool pays
|
|
14722
14745
|
// two gateway requests, so ask for both at once.
|
|
@@ -17276,13 +17299,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
17276
17299
|
}
|
|
17277
17300
|
} else if (
|
|
17278
17301
|
this.usesExplicitFreshness &&
|
|
17279
|
-
!reusableReadMethod &&
|
|
17280
17302
|
options?.staleAfterSeconds !== undefined &&
|
|
17281
17303
|
options.staleAfterSeconds !== 0
|
|
17282
17304
|
) {
|
|
17283
|
-
|
|
17284
|
-
|
|
17285
|
-
);
|
|
17305
|
+
const verdict = reusableWindowEligibility({ kind: 'fetch', method });
|
|
17306
|
+
if ('message' in verdict) throw new Error(verdict.message);
|
|
17286
17307
|
}
|
|
17287
17308
|
const urlContainsResolvedSecret =
|
|
17288
17309
|
this.secretRedactor.containsRegisteredSecret(url, {
|
|
@@ -20518,6 +20539,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
20518
20539
|
.catch(() => null);
|
|
20519
20540
|
const retrySafeTransientHttp =
|
|
20520
20541
|
retryPolicy?.retrySafeTransientHttp === true;
|
|
20542
|
+
const providerServerErrorReplay =
|
|
20543
|
+
retryPolicy?.providerServerErrorReplay ?? 'never';
|
|
20521
20544
|
const requiresExecutionFence =
|
|
20522
20545
|
retryPolicy?.requiresExecutionFence === true;
|
|
20523
20546
|
// Fenced execution is an operation-specific opt-in. A gateway may
|
|
@@ -21824,6 +21847,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21824
21847
|
transientHttpRetrySafe:
|
|
21825
21848
|
retrySafeTransientHttp || fixtureReplaySafe,
|
|
21826
21849
|
executionFenced: usesDurableInvocationFence,
|
|
21850
|
+
providerServerErrorReplay,
|
|
21827
21851
|
});
|
|
21828
21852
|
let failure = classifyToolExecuteHttpFailure({
|
|
21829
21853
|
toolId,
|
|
@@ -21840,6 +21864,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21840
21864
|
transientHttpRetrySafe:
|
|
21841
21865
|
retrySafeTransientHttp || fixtureReplaySafe,
|
|
21842
21866
|
executionFenced: usesDurableInvocationFence,
|
|
21867
|
+
providerServerErrorReplay,
|
|
21843
21868
|
providerLatencyMs:
|
|
21844
21869
|
Date.now() - dispatchedProviderCallStartedAt,
|
|
21845
21870
|
});
|
|
@@ -21865,6 +21890,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21865
21890
|
transientHttpRetrySafe:
|
|
21866
21891
|
retrySafeTransientHttp || fixtureReplaySafe,
|
|
21867
21892
|
executionFenced: usesDurableInvocationFence,
|
|
21893
|
+
providerServerErrorReplay,
|
|
21868
21894
|
providerLatencyMs:
|
|
21869
21895
|
Date.now() - dispatchedProviderCallStartedAt,
|
|
21870
21896
|
});
|
|
@@ -22378,6 +22404,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
22378
22404
|
fixtureReplaySafe ||
|
|
22379
22405
|
Boolean(asyncExecutionRecovery),
|
|
22380
22406
|
executionFenced: usesDurableInvocationFence,
|
|
22407
|
+
providerServerErrorReplay,
|
|
22381
22408
|
});
|
|
22382
22409
|
const failure =
|
|
22383
22410
|
preclassifiedHttpFailure.current?.failure ??
|
|
@@ -22394,6 +22421,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
22394
22421
|
fixtureReplaySafe ||
|
|
22395
22422
|
Boolean(asyncExecutionRecovery),
|
|
22396
22423
|
executionFenced: usesDurableInvocationFence,
|
|
22424
|
+
providerServerErrorReplay,
|
|
22397
22425
|
...(providerCallElapsedMs !== null
|
|
22398
22426
|
? { providerLatencyMs: providerCallElapsedMs }
|
|
22399
22427
|
: {}),
|
|
@@ -22636,6 +22664,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
22636
22664
|
const billingRetryIdentity = toolExecuteBillingRetryIdentity({
|
|
22637
22665
|
failure,
|
|
22638
22666
|
executionFenced: usesDurableInvocationFence,
|
|
22667
|
+
asyncExecutionRecovery: Boolean(asyncExecutionRecovery),
|
|
22639
22668
|
httpFailureAttempt,
|
|
22640
22669
|
invocationAttempt,
|
|
22641
22670
|
});
|
|
@@ -1153,6 +1153,7 @@ export interface ContextOptions {
|
|
|
1153
1153
|
) => Promise<{
|
|
1154
1154
|
retrySafeTransientHttp?: boolean;
|
|
1155
1155
|
requiresExecutionFence?: boolean;
|
|
1156
|
+
providerServerErrorReplay?: 'idempotent_key' | 'read_safe' | 'never';
|
|
1156
1157
|
} | null>;
|
|
1157
1158
|
getToolActionCacheVersion?: (toolId: string) => Promise<string> | string;
|
|
1158
1159
|
/**
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
DB_LOGICAL_TABLES,
|
|
5
|
+
DB_SESSION_OPERATIONS,
|
|
6
|
+
PRELOADED_RUNTIME_DB_SESSION_TTL_SECONDS,
|
|
7
|
+
createDbSessionResponseSchema,
|
|
8
|
+
type CreateDbSessionResponse,
|
|
9
|
+
type PreloadedRuntimeDbSession,
|
|
10
|
+
} from './db-session';
|
|
11
|
+
import {
|
|
12
|
+
dbSessionPostgresUrlAad,
|
|
13
|
+
decryptDbSessionPostgresUrl,
|
|
14
|
+
encryptDbSessionPostgresUrl,
|
|
15
|
+
} from './db-session-crypto';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Admission seals a run's Runtime DB sessions once, for the executor-token
|
|
19
|
+
* lifetime. A run that sleeps or waits past that lifetime would otherwise wake
|
|
20
|
+
* with sessions that every reader rejects as expired. Each attempt's
|
|
21
|
+
* executor-token issuance therefore renews them, under the attempt lease,
|
|
22
|
+
* whenever they would expire before the attempt's own token does. This slack
|
|
23
|
+
* keeps the first attempt of a promptly claimed run on its admission sessions:
|
|
24
|
+
* it is smaller than the runner's post-runtime headroom, so user code can never
|
|
25
|
+
* outlive a session it reused.
|
|
26
|
+
*/
|
|
27
|
+
export const PRELOADED_RUNTIME_DB_SESSION_ATTEMPT_RENEWAL_SLACK_MS = 5 * 60_000;
|
|
28
|
+
|
|
29
|
+
/** The lifetime a renewed session receives, from the renewing attempt's start. */
|
|
30
|
+
export const PRELOADED_RUNTIME_DB_SESSION_RENEWAL_TTL_MS =
|
|
31
|
+
PRELOADED_RUNTIME_DB_SESSION_TTL_SECONDS * 1000;
|
|
32
|
+
|
|
33
|
+
function sessionExpiresAtMs(preloaded: unknown): number | null {
|
|
34
|
+
if (!preloaded || typeof preloaded !== 'object') return null;
|
|
35
|
+
const session = (preloaded as { session?: unknown }).session;
|
|
36
|
+
if (!session || typeof session !== 'object') return null;
|
|
37
|
+
const expiresAt = (session as { expiresAt?: unknown }).expiresAt;
|
|
38
|
+
if (typeof expiresAt !== 'string') return null;
|
|
39
|
+
const parsed = Date.parse(expiresAt);
|
|
40
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Whether a new attempt starting at `nowMs` needs renewed sessions: some
|
|
45
|
+
* stored session would expire before a token minted now. An entry without a
|
|
46
|
+
* readable expiry is never matched by a reader, so renewal leaves it alone and
|
|
47
|
+
* it cannot make renewal due.
|
|
48
|
+
*/
|
|
49
|
+
export function preloadedRuntimeDbSessionsRenewalDue(
|
|
50
|
+
sessions: readonly unknown[],
|
|
51
|
+
nowMs: number,
|
|
52
|
+
): boolean {
|
|
53
|
+
return sessions.some((preloaded) => sessionRenewalDue(preloaded, nowMs));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function sessionRenewalDue(preloaded: unknown, nowMs: number): boolean {
|
|
57
|
+
const expiresAtMs = sessionExpiresAtMs(preloaded);
|
|
58
|
+
return (
|
|
59
|
+
expiresAtMs !== null &&
|
|
60
|
+
expiresAtMs <
|
|
61
|
+
nowMs +
|
|
62
|
+
PRELOADED_RUNTIME_DB_SESSION_RENEWAL_TTL_MS -
|
|
63
|
+
PRELOADED_RUNTIME_DB_SESSION_ATTEMPT_RENEWAL_SLACK_MS
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Re-seal each stored session that is due (it would expire before a token
|
|
69
|
+
* minted now) with a fresh id and expiry and nothing else
|
|
70
|
+
* changed: the same org, Play, table namespace, logical table, operations,
|
|
71
|
+
* limits, relations, execution role, and database location. The database URL
|
|
72
|
+
* is the one admission sealed, decrypted with the run's own unwrap key (which
|
|
73
|
+
* also authenticates the stored metadata) and sealed again under that key, so
|
|
74
|
+
* a renewal can never widen scope or move a run to another location.
|
|
75
|
+
*
|
|
76
|
+
* Entries that are not due, and entries that a reader could never use for
|
|
77
|
+
* this run (malformed, another org or Play, a public-key envelope that was
|
|
78
|
+
* never a preload, or a bundle that does not authenticate under the run's
|
|
79
|
+
* key), are returned unchanged (the same object), so their readers keep
|
|
80
|
+
* failing exactly as before. An unrenewable expired entry therefore leaves
|
|
81
|
+
* the array identical and cannot make every later attempt renew again.
|
|
82
|
+
*/
|
|
83
|
+
export async function renewPreloadedRuntimeDbSessions(input: {
|
|
84
|
+
sessions: readonly PreloadedRuntimeDbSession[];
|
|
85
|
+
unwrapKey: string;
|
|
86
|
+
orgId: string;
|
|
87
|
+
playName: string;
|
|
88
|
+
nowMs: number;
|
|
89
|
+
}): Promise<PreloadedRuntimeDbSession[]> {
|
|
90
|
+
const unwrapKey = input.unwrapKey.trim();
|
|
91
|
+
if (!unwrapKey) {
|
|
92
|
+
throw new Error(
|
|
93
|
+
'Renewing preloaded Runtime DB sessions requires the run unwrap key.',
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
const expiresAt = new Date(
|
|
97
|
+
input.nowMs + PRELOADED_RUNTIME_DB_SESSION_RENEWAL_TTL_MS,
|
|
98
|
+
).toISOString();
|
|
99
|
+
return await Promise.all(
|
|
100
|
+
input.sessions.map(async (preloaded) => {
|
|
101
|
+
if (!sessionRenewalDue(preloaded, input.nowMs)) return preloaded;
|
|
102
|
+
const parsed = createDbSessionResponseSchema.safeParse(
|
|
103
|
+
preloaded?.session,
|
|
104
|
+
);
|
|
105
|
+
if (!parsed.success) return preloaded;
|
|
106
|
+
const session = parsed.data;
|
|
107
|
+
if (
|
|
108
|
+
session.target.orgId !== input.orgId ||
|
|
109
|
+
session.playName !== input.playName
|
|
110
|
+
) {
|
|
111
|
+
return preloaded;
|
|
112
|
+
}
|
|
113
|
+
// Spread the stored object so fields this build does not know survive;
|
|
114
|
+
// the AAD is computed from the parsed view every reader also uses.
|
|
115
|
+
const stored = preloaded.session as unknown as Record<string, unknown>;
|
|
116
|
+
const {
|
|
117
|
+
postgresUrl,
|
|
118
|
+
encryptedPostgresUrl,
|
|
119
|
+
...sessionWithoutUrl
|
|
120
|
+
}: CreateDbSessionResponse = session;
|
|
121
|
+
const renewedIdentity = { sessionId: randomUUID(), expiresAt };
|
|
122
|
+
if (!encryptedPostgresUrl) {
|
|
123
|
+
// Harness-only plain sessions carry no sealed URL to re-key.
|
|
124
|
+
return {
|
|
125
|
+
...preloaded,
|
|
126
|
+
session: {
|
|
127
|
+
...stored,
|
|
128
|
+
...renewedIdentity,
|
|
129
|
+
} as unknown as CreateDbSessionResponse,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (encryptedPostgresUrl.alg !== 'A256GCM') return preloaded;
|
|
133
|
+
void postgresUrl;
|
|
134
|
+
let sealedUrl: string;
|
|
135
|
+
try {
|
|
136
|
+
sealedUrl = await decryptDbSessionPostgresUrl({
|
|
137
|
+
encrypted: encryptedPostgresUrl,
|
|
138
|
+
secret: unwrapKey,
|
|
139
|
+
aad: dbSessionPostgresUrlAad(sessionWithoutUrl),
|
|
140
|
+
});
|
|
141
|
+
} catch {
|
|
142
|
+
// Every reader fails this same unwrap loudly when it uses the entry.
|
|
143
|
+
// Renewal never re-seals a bundle it could not authenticate.
|
|
144
|
+
return preloaded;
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
...preloaded,
|
|
148
|
+
session: {
|
|
149
|
+
...stored,
|
|
150
|
+
...renewedIdentity,
|
|
151
|
+
encryptedPostgresUrl: await encryptDbSessionPostgresUrl({
|
|
152
|
+
postgresUrl: sealedUrl,
|
|
153
|
+
secret: unwrapKey,
|
|
154
|
+
aad: dbSessionPostgresUrlAad({
|
|
155
|
+
...sessionWithoutUrl,
|
|
156
|
+
...renewedIdentity,
|
|
157
|
+
}),
|
|
158
|
+
}),
|
|
159
|
+
} as unknown as CreateDbSessionResponse,
|
|
160
|
+
};
|
|
161
|
+
}),
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Read an executor-token response's optional `preloadedDbSessions`. Returns
|
|
167
|
+
* the array only when every entry is a well-formed preloaded session whose
|
|
168
|
+
* envelope agrees with its session target; otherwise null, so the caller keeps
|
|
169
|
+
* the launch's stored sessions. Absence, an empty array, or any malformed entry
|
|
170
|
+
* all mean "nothing renewed".
|
|
171
|
+
*/
|
|
172
|
+
export function parseRenewedPreloadedRuntimeDbSessions(
|
|
173
|
+
value: unknown,
|
|
174
|
+
): PreloadedRuntimeDbSession[] | null {
|
|
175
|
+
if (!Array.isArray(value) || value.length === 0) return null;
|
|
176
|
+
const parsed: PreloadedRuntimeDbSession[] = [];
|
|
177
|
+
for (const entry of value) {
|
|
178
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
const candidate = entry as Record<string, unknown>;
|
|
182
|
+
const { tableNamespace, logicalTable, operations } = candidate;
|
|
183
|
+
if (
|
|
184
|
+
typeof tableNamespace !== 'string' ||
|
|
185
|
+
!tableNamespace.trim() ||
|
|
186
|
+
typeof logicalTable !== 'string' ||
|
|
187
|
+
!(DB_LOGICAL_TABLES as readonly string[]).includes(logicalTable) ||
|
|
188
|
+
!Array.isArray(operations) ||
|
|
189
|
+
operations.length === 0 ||
|
|
190
|
+
!operations.every(
|
|
191
|
+
(operation) =>
|
|
192
|
+
typeof operation === 'string' &&
|
|
193
|
+
(DB_SESSION_OPERATIONS as readonly string[]).includes(operation),
|
|
194
|
+
)
|
|
195
|
+
) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
const session = createDbSessionResponseSchema.safeParse(candidate.session);
|
|
199
|
+
if (
|
|
200
|
+
!session.success ||
|
|
201
|
+
session.data.target.tableNamespace !== tableNamespace ||
|
|
202
|
+
session.data.target.logicalTable !== logicalTable
|
|
203
|
+
) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
parsed.push(entry as PreloadedRuntimeDbSession);
|
|
207
|
+
}
|
|
208
|
+
return parsed;
|
|
209
|
+
}
|
|
@@ -47,13 +47,23 @@ export const DURABLE_RUNS_ROLLOUT = {
|
|
|
47
47
|
sharedReadCacheWrites: true,
|
|
48
48
|
/**
|
|
49
49
|
* A provider's 5xx is retried inside the attempt with exponential backoff
|
|
50
|
-
* and jitter, sending the same provider idempotency key,
|
|
51
|
-
* action
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
50
|
+
* and jitter, sending the same provider idempotency key, but only for an
|
|
51
|
+
* action that is classified for it (`retry.providerServerErrorReplay` of
|
|
52
|
+
* `idempotent_key` or `read_safe`, or `retrySafeTransientHttp`). A write,
|
|
53
|
+
* upsert, create or send, a paid call whose 5xx is ambiguous after
|
|
54
|
+
* dispatch, and any unclassified action is never resent. Only successes are
|
|
55
|
+
* final for the classified actions. The runner decides; the gateway
|
|
56
|
+
* previous-outcome check only validates the recorded outcome.
|
|
57
|
+
*
|
|
58
|
+
* Known limit: a provider that ignores idempotency keys may still apply a
|
|
59
|
+
* classified write twice if its classification is wrong, so a new replaying
|
|
60
|
+
* action needs review (`tests/fixtures/provider-server-error-replay.json`).
|
|
61
|
+
* Each call is retried at most twice (3 sends), a provider Retry-After wait
|
|
62
|
+
* is capped at 30 s, and the retries never charge the run-wide retry
|
|
63
|
+
* budget. Off again stops new retries; a call already retried keeps its
|
|
64
|
+
* recorded attempts.
|
|
55
65
|
*/
|
|
56
|
-
retryProviderServerErrors:
|
|
66
|
+
retryProviderServerErrors: true,
|
|
57
67
|
/**
|
|
58
68
|
* `runs resume` continues a stopped run. Off, the API refuses with
|
|
59
69
|
* `resume_unavailable`; readers for resumed runs ship regardless.
|
|
@@ -6,6 +6,7 @@ import type { ToolResultMetadataInput } from '../tool-result';
|
|
|
6
6
|
|
|
7
7
|
/** The app's runtime tool metadata as the runner receives it over HTTP. */
|
|
8
8
|
export type RuntimeToolMetadata = {
|
|
9
|
+
/** The pre-edition-11 shared-cache gate; only the legacy latest-cache path reads it. */
|
|
9
10
|
reusableResult?: { supported: boolean; unavailableReason: string | null };
|
|
10
11
|
provider?: string | null;
|
|
11
12
|
operation?: string | null;
|
|
@@ -17,6 +18,7 @@ export type RuntimeToolMetadata = {
|
|
|
17
18
|
idempotencyScope?: 'invocation';
|
|
18
19
|
retrySafeTransientHttp?: boolean;
|
|
19
20
|
requiresExecutionFence?: boolean;
|
|
21
|
+
providerServerErrorReplay?: 'idempotent_key' | 'read_safe' | 'never';
|
|
20
22
|
};
|
|
21
23
|
targetGetters?: Record<string, string[]>;
|
|
22
24
|
listExtractorPaths?: string[];
|
|
@@ -102,6 +104,9 @@ export function createRuntimeToolHooks(input: {
|
|
|
102
104
|
return {
|
|
103
105
|
retrySafeTransientHttp: metadata.retry?.retrySafeTransientHttp === true,
|
|
104
106
|
requiresExecutionFence: metadata.retry?.requiresExecutionFence === true,
|
|
107
|
+
// Absent (an older metadata reader or an unclassified action) is `never`.
|
|
108
|
+
providerServerErrorReplay:
|
|
109
|
+
metadata.retry?.providerServerErrorReplay ?? 'never',
|
|
105
110
|
};
|
|
106
111
|
},
|
|
107
112
|
getToolActionCacheVersion: async (toolId) => {
|