deepline 0.3.523 → 0.3.525
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 +68 -60
- package/dist/bundling-sources/sdk/src/http-core.ts +14 -0
- package/dist/bundling-sources/sdk/src/plays/play-description.ts +1 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +10 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +60 -14
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-delivery.ts +9 -3
- package/dist/bundling-sources/shared_libs/observability/dlq.ts +19 -0
- package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
- package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +397 -22
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +473 -13
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +28 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-retry-summary.ts +202 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +60 -8
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +112 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +39 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts +13 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +10 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-retry-facts.ts +62 -0
- package/dist/cli/auth-K7PMRXNG.js +43 -0
- package/dist/cli/{auth-ENQUQS56.mjs → auth-TH3VGYBK.mjs} +5 -5
- package/dist/cli/{billing-6A27ULCX.mjs → billing-CMHFI2LN.mjs} +8 -8
- package/dist/cli/{billing-6HONTJOY.js → billing-TWKVUFU2.js} +83 -83
- package/dist/cli/{chunk-JMMNCJ7Z.js → chunk-2WFVLOB7.js} +1 -1
- package/dist/cli/{chunk-S4YKRH3W.js → chunk-4UWXFXQF.js} +3 -3
- package/dist/cli/{chunk-PCORO245.mjs → chunk-5BSGWIQD.mjs} +2 -2
- package/dist/cli/{chunk-SBGKKOCC.js → chunk-5JFAQUZS.js} +26 -26
- package/dist/cli/{chunk-RVHUW4TN.js → chunk-5YAJGRWB.js} +17 -17
- package/dist/cli/{chunk-ITJ7NB2D.mjs → chunk-7AOFSZJM.mjs} +3 -1
- package/dist/cli/{chunk-JVEFMOY2.mjs → chunk-7C4F4TLR.mjs} +1 -1
- package/dist/cli/{chunk-QMBL5ZIQ.mjs → chunk-7OF3A4KJ.mjs} +3 -3
- package/dist/cli/{chunk-326WVSWS.js → chunk-AVDEYOVP.js} +269 -269
- package/dist/cli/{chunk-GJYLC4JB.mjs → chunk-BNH4Y35W.mjs} +2 -2
- package/dist/cli/{chunk-ZWN4RXC2.js → chunk-CKTRQSRA.js} +22 -22
- package/dist/cli/{chunk-I62LJ7NU.mjs → chunk-CLTL7ZJI.mjs} +1 -1
- package/dist/cli/{chunk-IEVXYHGJ.js → chunk-CQSANB3V.js} +5 -5
- package/dist/cli/{chunk-QYXIODWH.js → chunk-CWRL6IQP.js} +44 -29
- package/dist/cli/{chunk-WVQOXYTQ.mjs → chunk-CZNEQMJR.mjs} +37 -34
- package/dist/cli/{chunk-4NWY7JBB.js → chunk-DYS3KWYF.js} +11 -11
- package/dist/cli/{chunk-HSVGP4CI.mjs → chunk-EP6YH6QJ.mjs} +2 -2
- package/dist/cli/{chunk-XYL26236.js → chunk-ESWM2JW4.js} +2 -2
- package/dist/cli/{chunk-6OZ2WSHD.mjs → chunk-ETHVJ2ZE.mjs} +1 -1
- package/dist/cli/{chunk-6DBRBWHC.mjs → chunk-GCLNX72G.mjs} +2 -2
- package/dist/cli/{chunk-R2VZVHJP.mjs → chunk-GESIFFQX.mjs} +1 -1
- package/dist/cli/{chunk-QSAC3IVI.mjs → chunk-IMO3HXWZ.mjs} +1 -1
- package/dist/cli/{chunk-JGZQBDYG.mjs → chunk-JVWSIA2V.mjs} +4 -4
- package/dist/cli/{chunk-7GNKAACY.js → chunk-KBOSALBI.js} +10 -10
- package/dist/cli/{chunk-K326BEVR.js → chunk-KEZ3KBWW.js} +10 -10
- package/dist/cli/{chunk-7M5FRSFP.mjs → chunk-KPINGHIF.mjs} +2 -2
- package/dist/cli/{chunk-UH3EAFFN.mjs → chunk-LAMGJQDY.mjs} +2 -2
- package/dist/cli/{chunk-UQN4VTZL.js → chunk-LE537GBC.js} +13 -6
- package/dist/cli/{chunk-PESMXAUG.js → chunk-LXKH4MKH.js} +6 -6
- package/dist/cli/{chunk-4V63IJCL.mjs → chunk-M43ZYNDA.mjs} +5 -5
- package/dist/cli/{chunk-XVXEARHC.js → chunk-MHBSRNI7.js} +41 -41
- package/dist/cli/{chunk-HUC5SGJQ.js → chunk-MRUFGOJR.js} +2 -2
- package/dist/cli/{chunk-RQN4PHRE.js → chunk-N4MMU3QF.js} +21 -21
- package/dist/cli/{chunk-2BRDHM4S.js → chunk-NB2ECLQE.js} +9 -9
- package/dist/cli/{chunk-DNXP3D5H.mjs → chunk-NO4URKKT.mjs} +5 -5
- package/dist/cli/{chunk-MZROKQV3.js → chunk-NRBCETWL.js} +44 -44
- package/dist/cli/{chunk-JCTTXLAZ.mjs → chunk-OWQF6WVH.mjs} +10 -3
- package/dist/cli/{chunk-NWTMQGPP.mjs → chunk-OXFIJYN3.mjs} +8 -8
- package/dist/cli/{chunk-FBMOBNJY.js → chunk-P62LON53.js} +2 -2
- package/dist/cli/{chunk-NMU3VR5U.js → chunk-PMH4GLMD.js} +1 -0
- package/dist/cli/{chunk-S3A4IXBQ.mjs → chunk-PSX3WHIH.mjs} +1 -0
- package/dist/cli/{chunk-N5MLEXZ7.js → chunk-QR7VYYNM.js} +176 -173
- package/dist/cli/{chunk-RKREB7MU.mjs → chunk-RMZ6CISE.mjs} +3 -3
- package/dist/cli/{chunk-V46J3UTM.js → chunk-S5LUY3KJ.js} +7 -7
- package/dist/cli/{chunk-MCXPJYBN.js → chunk-TFEGJEYO.js} +3 -3
- package/dist/cli/{chunk-MT3WG3KR.js → chunk-TO72GW5I.js} +16 -16
- package/dist/cli/{chunk-H7275EZU.mjs → chunk-TXSBPBHB.mjs} +5 -5
- package/dist/cli/{chunk-SXTVJIGB.mjs → chunk-U4M32NFS.mjs} +1 -1
- package/dist/cli/{chunk-5WFQXAD4.mjs → chunk-UQYKSOGO.mjs} +5 -5
- package/dist/cli/{chunk-KILRUAXF.mjs → chunk-UXF3ODJJ.mjs} +2 -2
- package/dist/cli/{chunk-36LQQL5C.js → chunk-V2GN4PLK.js} +5 -5
- package/dist/cli/{chunk-HUIFUE4L.js → chunk-V65J64FL.js} +53 -53
- package/dist/cli/{chunk-U6DLLV3S.mjs → chunk-VYIAWAKJ.mjs} +1 -1
- package/dist/cli/{chunk-WGVJA4I5.js → chunk-WA3FG7DH.js} +14 -14
- package/dist/cli/{chunk-MHTRYBXY.mjs → chunk-WEYFSBAD.mjs} +44 -29
- package/dist/cli/{chunk-LZL6V5M5.mjs → chunk-WGRDOPAK.mjs} +2 -2
- package/dist/cli/{chunk-NTLBZUHD.js → chunk-XYIECA7M.js} +4 -2
- package/dist/cli/{chunk-QOO5W5XS.mjs → chunk-YC7FKAJ4.mjs} +12 -12
- package/dist/cli/{chunk-BN5VKY4X.js → chunk-ZS2WHWWL.js} +7 -7
- package/dist/cli/{chunk-F3WRLFFM.mjs → chunk-ZWFTHEPT.mjs} +2 -2
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-UBACJK75.js → csv-5JHWVJ5N.js} +13 -13
- package/dist/cli/{csv-YFJ2JLUP.mjs → csv-OO554TPX.mjs} +4 -4
- package/dist/cli/{db-2ZPA2LZ7.js → db-CYQJ4OXF.js} +28 -28
- package/dist/cli/{db-NKGYTAQO.mjs → db-SQKJ6RKU.mjs} +7 -7
- package/dist/cli/describe-N7AKTUQV.mjs +50 -0
- package/dist/cli/describe-PASXOL3R.js +50 -0
- package/dist/cli/describe-core.d.mts +4 -2
- package/dist/cli/describe-core.d.ts +4 -2
- package/dist/cli/describe-core.js +5 -5
- package/dist/cli/describe-core.mjs +4 -4
- package/dist/cli/{executions-HTHQ7KKD.mjs → executions-F34DORW6.mjs} +7 -7
- package/dist/cli/{executions-NXMRGPIL.js → executions-K7EGCRKX.js} +9 -9
- package/dist/cli/{feedback-USP4T34P.mjs → feedback-GQHKCS66.mjs} +5 -5
- package/dist/cli/{feedback-TGVQACRO.js → feedback-NOQVCA3Q.js} +10 -10
- package/dist/cli/{git-KUONEHCD.mjs → git-2EEITXDB.mjs} +5 -5
- package/dist/cli/git-UU4YFJ2Q.js +25 -0
- package/dist/cli/index.js +146 -146
- package/dist/cli/index.mjs +45 -45
- package/dist/cli/{legacy-noops-B2GMHU42.mjs → legacy-noops-JHMY5XRB.mjs} +6 -6
- package/dist/cli/{legacy-noops-2JY3CQ24.js → legacy-noops-RFNHQ7RG.js} +9 -9
- package/dist/cli/{monitors-2OVBZJ6Z.mjs → monitors-RDMP6SPZ.mjs} +8 -8
- package/dist/cli/{monitors-XI6I52AX.js → monitors-UKRZ4BDK.js} +101 -101
- package/dist/cli/{org-5TUQ2H6Y.js → org-OX7TYTHV.js} +87 -87
- package/dist/cli/{org-BNJW764Y.mjs → org-RF3G4KMB.mjs} +7 -7
- package/dist/cli/{pages-QC3TQIPW.mjs → pages-FBM3MGSP.mjs} +7 -7
- package/dist/cli/{pages-UXCLX53Y.js → pages-MKQT5LFV.js} +19 -19
- package/dist/cli/{play-KRWMZ7FG.js → play-OOVX2DMV.js} +802 -713
- package/dist/cli/{play-45PPG5SZ.mjs → play-YWC2UORM.mjs} +197 -108
- package/dist/cli/{providers-RBUJ72Y3.js → providers-2CGZYLER.js} +10 -10
- package/dist/cli/{providers-JDT35MRL.mjs → providers-3PEQESIU.mjs} +7 -7
- package/dist/cli/{quickstart-JZ4Q3HFT.js → quickstart-6AANHKQZ.js} +6 -6
- package/dist/cli/{quickstart-GD2SWGAC.mjs → quickstart-KVB36SOW.mjs} +4 -4
- package/dist/cli/{run-JEAHA367.js → run-NJ7WV5TK.js} +46 -46
- package/dist/cli/{run-KIZ3HBI2.mjs → run-QC23NRKO.mjs} +27 -27
- package/dist/cli/{search-5UFNXHFK.mjs → search-7BMFFZI2.mjs} +9 -9
- package/dist/cli/search-NH4DTXUK.js +33 -0
- package/dist/cli/{search-output-HAXPKQO6.mjs → search-output-CALZ4ZI2.mjs} +4 -4
- package/dist/cli/{search-output-W3RDSVLE.js → search-output-XC2AVBFX.js} +6 -6
- package/dist/cli/{secrets-JAWT66B2.mjs → secrets-7ZHA57DI.mjs} +7 -7
- package/dist/cli/{secrets-PC7C2Q32.js → secrets-VHU4B2D4.js} +16 -16
- package/dist/cli/sessions-2TE5JWVP.js +18 -0
- package/dist/cli/{sessions-325V7G35.mjs → sessions-YYULWFZE.mjs} +6 -6
- package/dist/cli/{settings-FKHTA65P.mjs → settings-AVY4NNHI.mjs} +14 -14
- package/dist/cli/{settings-RGU6Y2QR.js → settings-WV77QJGD.js} +87 -87
- package/dist/cli/{setup-43GOYTFC.mjs → setup-AOUJ3RMU.mjs} +10 -10
- package/dist/cli/{setup-ZMZ7HU2I.js → setup-GE5TLTC4.js} +50 -50
- package/dist/cli/{skills-Q2VAHSXM.mjs → skills-FVWO2G66.mjs} +8 -8
- package/dist/cli/skills-OL7LD6QX.js +37 -0
- package/dist/cli/{tools-BUH7ZWDS.mjs → tools-URE655B4.mjs} +20 -20
- package/dist/cli/tools-VQ5JO6DI.js +57 -0
- package/dist/cli/{update-JFALWOHD.mjs → update-5B4G4345.mjs} +10 -10
- package/dist/cli/update-7ZOIOTZN.js +35 -0
- package/dist/cli/{artifacts-RBHR2DG4.mjs → views-GSECJ5IK.mjs} +77 -77
- package/dist/cli/views-IC762HEQ.js +270 -0
- package/dist/cli/{workflow-ISJKLY6X.mjs → workflow-6UQM565I.mjs} +8 -8
- package/dist/cli/{workflow-YELST32A.js → workflow-EME7ZEOV.js} +18 -18
- package/dist/{client-C2N7MofG.d.mts → client-Bd2meveV.d.mts} +1 -1
- package/dist/{client-C7lTRJjw.d.ts → client-CBCVhL8U.d.ts} +1 -1
- package/dist/{client-core-BTkDSKGn.d.mts → client-core-CGj8V9mw.d.mts} +110 -43
- package/dist/{client-core-hmhBi7Ib.d.ts → client-core-CsRRWCFy.d.ts} +110 -43
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -10
- package/dist/index.mjs +7 -7
- package/dist/install-integrity.json +120 -118
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/play-description.js +2 -2
- package/dist/plays/play-description.mjs +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/package.json +1 -1
- package/dist/cli/artifacts-RZTS2JHZ.js +0 -270
- package/dist/cli/auth-DPWYFQR5.js +0 -43
- package/dist/cli/describe-GX7DRKWZ.mjs +0 -50
- package/dist/cli/describe-WQZF7MEG.js +0 -50
- package/dist/cli/git-X3SCQREB.js +0 -25
- package/dist/cli/search-6JULJMD7.js +0 -33
- package/dist/cli/sessions-WFUCOJHZ.js +0 -18
- package/dist/cli/skills-3XTQ6FFM.js +0 -37
- package/dist/cli/tools-UK2R4YXQ.js +0 -57
- package/dist/cli/update-LNKPHS54.js +0 -35
|
@@ -295,7 +295,10 @@ import {
|
|
|
295
295
|
executeWithFreshnessReceipt,
|
|
296
296
|
latestCacheResultKey,
|
|
297
297
|
latestCacheResultOutput,
|
|
298
|
+
type LegacySlotSearch,
|
|
299
|
+
type ReplayRefusal,
|
|
298
300
|
parseLatestCacheResult,
|
|
301
|
+
type ReplayMismatchPolicy,
|
|
299
302
|
toolReadSemanticKey,
|
|
300
303
|
} from './freshness-receipt-execution';
|
|
301
304
|
import {
|
|
@@ -654,6 +657,13 @@ function recordReplayCallAdvance(key: string, advance: number): void {
|
|
|
654
657
|
}
|
|
655
658
|
}
|
|
656
659
|
|
|
660
|
+
/**
|
|
661
|
+
* Call-order slots past the highest one allocated in this attempt that the
|
|
662
|
+
* pre-binding slot search also inspects: siblings that started earlier in
|
|
663
|
+
* the original attempt but have not started yet in this one.
|
|
664
|
+
*/
|
|
665
|
+
const LEGACY_SLOT_SEARCH_LOOKAHEAD = 16;
|
|
666
|
+
|
|
657
667
|
function nextReplayableCallIndex(key: string, freshIndex: number): number {
|
|
658
668
|
const indexes = rowContext.getStore()?.replayCallIndexes;
|
|
659
669
|
if (!indexes) return freshIndex;
|
|
@@ -3163,6 +3173,51 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3163
3173
|
private readonly stepCallIndexByKey = new Map<string, number>();
|
|
3164
3174
|
private readonly toolCallIndexByKey = new Map<string, number>();
|
|
3165
3175
|
private readonly freshnessCallIndexByKey = new Map<string, number>();
|
|
3176
|
+
/**
|
|
3177
|
+
* Call-order artifacts only: the exact-request operation slot of each
|
|
3178
|
+
* call-order invocation id, consumed when the call reaches the freshness
|
|
3179
|
+
* layer. See `freshnessInvocationId`.
|
|
3180
|
+
*/
|
|
3181
|
+
private readonly exactRequestInvocationIds = new Map<
|
|
3182
|
+
string,
|
|
3183
|
+
{
|
|
3184
|
+
exactRequestInvocationId?: string;
|
|
3185
|
+
inputFingerprint: string;
|
|
3186
|
+
/** The invocation id itself is numbered among identical requests. */
|
|
3187
|
+
keyEncodesRequest?: true;
|
|
3188
|
+
/** This call's call-order slot, for the pre-binding slot search. */
|
|
3189
|
+
legacySlot?: { scope: string; index: number };
|
|
3190
|
+
}
|
|
3191
|
+
>();
|
|
3192
|
+
/**
|
|
3193
|
+
* Per call-order scope, for receipts recorded before bindings: whether each
|
|
3194
|
+
* slot read in this attempt held an unbound receipt, and which slots a call
|
|
3195
|
+
* has already proven and taken.
|
|
3196
|
+
*/
|
|
3197
|
+
private readonly legacySlotVerdicts = new Map<
|
|
3198
|
+
string,
|
|
3199
|
+
(unbound: boolean) => void
|
|
3200
|
+
>();
|
|
3201
|
+
private readonly legacySlotScopes = new Map<
|
|
3202
|
+
string,
|
|
3203
|
+
{
|
|
3204
|
+
/** Verdicts of slots allocated but not yet read, by index. */
|
|
3205
|
+
pending: Map<number, Promise<boolean>>;
|
|
3206
|
+
/** A slot of this scope held an unbound receipt in this attempt. */
|
|
3207
|
+
anyUnbound: boolean;
|
|
3208
|
+
/**
|
|
3209
|
+
* Slots taken by a proven pre-binding recovery, with the invocation
|
|
3210
|
+
* that took them. The same invocation may take its slot again (a row
|
|
3211
|
+
* re-entered after provider backpressure restores its call index);
|
|
3212
|
+
* a sibling may not.
|
|
3213
|
+
*/
|
|
3214
|
+
consumed: Map<number, string>;
|
|
3215
|
+
}
|
|
3216
|
+
>();
|
|
3217
|
+
/** Authored calls whose unverified recovery was already reported. */
|
|
3218
|
+
private readonly unverifiedRecoveryReported = new Set<string>();
|
|
3219
|
+
/** Replay refusals already reported, by code, operation and authored id. */
|
|
3220
|
+
private readonly replayRefusalsReported = new Map<string, number>();
|
|
3166
3221
|
/**
|
|
3167
3222
|
* Parent-level inline-child aggregates. Maintained only by the single-writer
|
|
3168
3223
|
* progress path (never per child) so concurrent fan-out cannot contend. See
|
|
@@ -4185,10 +4240,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
4185
4240
|
* slots. Callers pass the authored request without credentials, auth scope,
|
|
4186
4241
|
* or runtime-assigned keys, so the slot follows the authored effect.
|
|
4187
4242
|
*/
|
|
4188
|
-
private callSlotRequestDigest(request: unknown): string
|
|
4189
|
-
if (this.currentRuntimeSemantics.callSlotIdentity !== 'request_digest') {
|
|
4190
|
-
return undefined;
|
|
4191
|
-
}
|
|
4243
|
+
private callSlotRequestDigest(request: unknown): string {
|
|
4192
4244
|
return sha256Hex(stableStringify(request));
|
|
4193
4245
|
}
|
|
4194
4246
|
|
|
@@ -4196,10 +4248,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
4196
4248
|
private fetchCallSlotRequestDigest(
|
|
4197
4249
|
input: string | URL,
|
|
4198
4250
|
init: PlaySecretAwareRequestInit | SecretAwareRequestInit,
|
|
4199
|
-
): string
|
|
4200
|
-
if (this.currentRuntimeSemantics.callSlotIdentity !== 'request_digest') {
|
|
4201
|
-
return undefined;
|
|
4202
|
-
}
|
|
4251
|
+
): string {
|
|
4203
4252
|
const body = typeof init.body === 'string' ? init.body : null;
|
|
4204
4253
|
return this.callSlotRequestDigest({
|
|
4205
4254
|
method: (init.method ?? 'GET').toUpperCase(),
|
|
@@ -4237,23 +4286,249 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
4237
4286
|
// Edition 12 numbers same-id calls only among identical requests, so
|
|
4238
4287
|
// parallel calls started in another order on resume keep their own slot.
|
|
4239
4288
|
// Call-order artifacts keep their exact historical scope string.
|
|
4240
|
-
const
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4289
|
+
const exactRequestScope = stableStringify({
|
|
4290
|
+
...slotScope,
|
|
4291
|
+
request: requestDigest ?? null,
|
|
4292
|
+
});
|
|
4293
|
+
const slot = (scope: string) => {
|
|
4294
|
+
const freshIndex = this.freshnessCallIndexByKey.get(scope) ?? 0;
|
|
4295
|
+
this.freshnessCallIndexByKey.set(scope, freshIndex + 1);
|
|
4296
|
+
// Invocation identity follows authored scope and call order. Keep it
|
|
4297
|
+
// separate from the request/auth/action fingerprint used by reusable
|
|
4298
|
+
// result caching, so credential or response-contract changes cannot
|
|
4299
|
+
// mint a second provider operation key for the same authored effect.
|
|
4300
|
+
// A mapped row can be re-entered after provider backpressure; its
|
|
4301
|
+
// replay cursor restores the original call position.
|
|
4302
|
+
const index = nextReplayableCallIndex(`freshness:${scope}`, freshIndex);
|
|
4303
|
+
return { id: sha256Hex(`${scope}:${index}`), index };
|
|
4304
|
+
};
|
|
4305
|
+
if (this.currentRuntimeSemantics.callSlotIdentity === 'request_digest') {
|
|
4306
|
+
const invocationId = slot(exactRequestScope).id;
|
|
4307
|
+
if (requestDigest !== undefined) {
|
|
4308
|
+
this.exactRequestInvocationIds.set(invocationId, {
|
|
4309
|
+
inputFingerprint: requestDigest,
|
|
4310
|
+
keyEncodesRequest: true,
|
|
4311
|
+
});
|
|
4312
|
+
}
|
|
4313
|
+
return invocationId;
|
|
4314
|
+
}
|
|
4315
|
+
// A call-order slot is only a candidate: same-id calls started in another
|
|
4316
|
+
// order on replay take each other's slots. The call also records and
|
|
4317
|
+
// recovers its exact-request slot (numbered among identical requests, as
|
|
4318
|
+
// in edition 12), and the freshness layer verifies the request
|
|
4319
|
+
// fingerprint before returning a call-order slot's result.
|
|
4320
|
+
const callOrderScope = stableStringify(slotScope);
|
|
4321
|
+
const callOrder = slot(callOrderScope);
|
|
4322
|
+
if (requestDigest !== undefined) {
|
|
4323
|
+
this.exactRequestInvocationIds.set(callOrder.id, {
|
|
4324
|
+
exactRequestInvocationId: slot(exactRequestScope).id,
|
|
4325
|
+
inputFingerprint: requestDigest,
|
|
4326
|
+
// Only tools record request identities a slot search can prove.
|
|
4327
|
+
...(operation === 'tool'
|
|
4328
|
+
? { legacySlot: { scope: callOrderScope, index: callOrder.index } }
|
|
4329
|
+
: {}),
|
|
4330
|
+
});
|
|
4331
|
+
if (operation === 'tool') {
|
|
4332
|
+
this.registerLegacySlot(callOrder.id, callOrderScope, callOrder.index);
|
|
4333
|
+
}
|
|
4334
|
+
}
|
|
4335
|
+
return callOrder.id;
|
|
4336
|
+
}
|
|
4337
|
+
|
|
4338
|
+
/**
|
|
4339
|
+
* A tool is a read on replay mismatch only when its metadata proves it: no
|
|
4340
|
+
* invocation-scoped idempotency, no execution fence, not SQL, and either a
|
|
4341
|
+
* provider-declared reusable read (`legacySharedCacheReuseSupport`, which
|
|
4342
|
+
* refuses write/persist tags) or a `read_safe` server-error replay class.
|
|
4343
|
+
* Anything unproven, including a metadata lookup failure, fails loudly.
|
|
4344
|
+
*/
|
|
4345
|
+
private async toolReplayMismatchPolicy(
|
|
4346
|
+
toolId: string,
|
|
4347
|
+
input: Record<string, unknown>,
|
|
4348
|
+
): Promise<ReplayMismatchPolicy> {
|
|
4349
|
+
if (
|
|
4350
|
+
isCustomerDbDatasetTool(toolId) ||
|
|
4351
|
+
isAlwaysFreshIntegrationWriteTool(toolId)
|
|
4352
|
+
) {
|
|
4353
|
+
return 'fail';
|
|
4354
|
+
}
|
|
4355
|
+
try {
|
|
4356
|
+
const [scope, retry, reusable] = await Promise.all([
|
|
4357
|
+
this.#options.getToolIdempotencyScope?.(toolId),
|
|
4358
|
+
this.#options.getToolRetryPolicy?.(toolId, input),
|
|
4359
|
+
this.#options.getToolReusableResultSupport?.(toolId),
|
|
4360
|
+
]);
|
|
4361
|
+
if (scope === 'invocation' || retry?.requiresExecutionFence === true) {
|
|
4362
|
+
return 'fail';
|
|
4363
|
+
}
|
|
4364
|
+
return reusable?.supported === true ||
|
|
4365
|
+
retry?.providerServerErrorReplay === 'read_safe'
|
|
4366
|
+
? 'execute'
|
|
4367
|
+
: 'fail';
|
|
4368
|
+
} catch {
|
|
4369
|
+
return 'fail';
|
|
4370
|
+
}
|
|
4371
|
+
}
|
|
4372
|
+
|
|
4373
|
+
/**
|
|
4374
|
+
* Pre-binding slot search for one call: other call-order slots of its
|
|
4375
|
+
* scope, which a sibling started in another order may hold its own result
|
|
4376
|
+
* in. Only receipts proven by a recorded request identity are taken, each
|
|
4377
|
+
* at most once per attempt.
|
|
4378
|
+
*/
|
|
4379
|
+
/**
|
|
4380
|
+
* Registered when the slot is allocated, in allocation order, so a later
|
|
4381
|
+
* sibling can wait for this slot's verdict. Settled by the freshness layer
|
|
4382
|
+
* once the slot is read, or by `settleLegacySlot` when the call ends first.
|
|
4383
|
+
* A scope without unbound receipts is dropped once its slots settle, so
|
|
4384
|
+
* runs without pre-binding receipts keep no state here.
|
|
4385
|
+
*/
|
|
4386
|
+
private registerLegacySlot(
|
|
4387
|
+
invocationId: string,
|
|
4388
|
+
scopeKey: string,
|
|
4389
|
+
index: number,
|
|
4390
|
+
): void {
|
|
4391
|
+
// A re-entered row reuses its slot; release the earlier registration.
|
|
4392
|
+
this.settleLegacySlot(invocationId, { keepSlotEntry: true });
|
|
4393
|
+
let scope = this.legacySlotScopes.get(scopeKey);
|
|
4394
|
+
if (!scope) {
|
|
4395
|
+
scope = { pending: new Map(), anyUnbound: false, consumed: new Map() };
|
|
4396
|
+
this.legacySlotScopes.set(scopeKey, scope);
|
|
4397
|
+
}
|
|
4398
|
+
const state = scope;
|
|
4399
|
+
let resolve!: (unbound: boolean) => void;
|
|
4400
|
+
const verdict: Promise<boolean> = new Promise<boolean>(
|
|
4401
|
+
(settle) => (resolve = settle),
|
|
4402
|
+
).then((unbound) => {
|
|
4403
|
+
if (unbound) state.anyUnbound = true;
|
|
4404
|
+
if (state.pending.get(index) === verdict) state.pending.delete(index);
|
|
4405
|
+
if (
|
|
4406
|
+
state.pending.size === 0 &&
|
|
4407
|
+
!state.anyUnbound &&
|
|
4408
|
+
state.consumed.size === 0 &&
|
|
4409
|
+
this.legacySlotScopes.get(scopeKey) === state
|
|
4410
|
+
) {
|
|
4411
|
+
this.legacySlotScopes.delete(scopeKey);
|
|
4412
|
+
}
|
|
4413
|
+
return unbound;
|
|
4414
|
+
});
|
|
4415
|
+
state.pending.set(index, verdict);
|
|
4416
|
+
this.legacySlotVerdicts.set(invocationId, resolve);
|
|
4417
|
+
}
|
|
4418
|
+
|
|
4419
|
+
/** The call ended (or never reached the freshness layer): release waiters. */
|
|
4420
|
+
private settleLegacySlot(
|
|
4421
|
+
invocationId: string,
|
|
4422
|
+
options?: { keepSlotEntry: true },
|
|
4423
|
+
): void {
|
|
4424
|
+
this.legacySlotVerdicts.get(invocationId)?.(false);
|
|
4425
|
+
this.legacySlotVerdicts.delete(invocationId);
|
|
4426
|
+
if (!options?.keepSlotEntry) {
|
|
4427
|
+
this.exactRequestInvocationIds.delete(invocationId);
|
|
4428
|
+
}
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4431
|
+
private legacySlotSearch(
|
|
4432
|
+
invocationId: string,
|
|
4433
|
+
slot: { scope: string; index: number },
|
|
4434
|
+
): LegacySlotSearch {
|
|
4435
|
+
const scope = this.legacySlotScopes.get(slot.scope)!;
|
|
4436
|
+
const verdict = this.legacySlotVerdicts.get(invocationId);
|
|
4437
|
+
return {
|
|
4438
|
+
ownIndex: slot.index,
|
|
4439
|
+
reportOwnSlot: (unbound) => verdict?.(unbound),
|
|
4440
|
+
priorSlotsUnbound: async () => {
|
|
4441
|
+
await Promise.all(
|
|
4442
|
+
[...scope.pending]
|
|
4443
|
+
.filter(([index]) => index < slot.index)
|
|
4444
|
+
.map(([, observed]) => observed),
|
|
4445
|
+
);
|
|
4446
|
+
return scope.anyUnbound;
|
|
4447
|
+
},
|
|
4448
|
+
candidates: () => {
|
|
4449
|
+
const candidates: Array<{ index: number; invocationId: string }> = [];
|
|
4450
|
+
const allocated = Math.max(
|
|
4451
|
+
this.freshnessCallIndexByKey.get(slot.scope) ?? 0,
|
|
4452
|
+
slot.index + 1,
|
|
4453
|
+
);
|
|
4454
|
+
const end = allocated + LEGACY_SLOT_SEARCH_LOOKAHEAD;
|
|
4455
|
+
for (let index = 0; index < end; index += 1) {
|
|
4456
|
+
const claimant = scope.consumed.get(index);
|
|
4457
|
+
if (
|
|
4458
|
+
index === slot.index ||
|
|
4459
|
+
(claimant !== undefined && claimant !== invocationId)
|
|
4460
|
+
) {
|
|
4461
|
+
continue;
|
|
4462
|
+
}
|
|
4463
|
+
candidates.push({
|
|
4464
|
+
index,
|
|
4465
|
+
invocationId: sha256Hex(`${slot.scope}:${index}`),
|
|
4466
|
+
});
|
|
4467
|
+
}
|
|
4468
|
+
return candidates;
|
|
4469
|
+
},
|
|
4470
|
+
consume: (index) => {
|
|
4471
|
+
const claimant = scope.consumed.get(index);
|
|
4472
|
+
if (claimant !== undefined && claimant !== invocationId) return false;
|
|
4473
|
+
scope.consumed.set(index, invocationId);
|
|
4474
|
+
return true;
|
|
4475
|
+
},
|
|
4476
|
+
};
|
|
4477
|
+
}
|
|
4478
|
+
|
|
4479
|
+
/**
|
|
4480
|
+
* One structured line per replay refusal, emitted where the refusal is
|
|
4481
|
+
* decided, so a Play that catches the error cannot hide it. Rate-limited
|
|
4482
|
+
* per code, operation and authored id: the first refusal and then powers of
|
|
4483
|
+
* two, each carrying the running count. Never carries inputs, outputs or
|
|
4484
|
+
* secrets. Written to the run log and to the runner's stderr, which the
|
|
4485
|
+
* runtime log shipper forwards.
|
|
4486
|
+
*/
|
|
4487
|
+
private reportReplayRefusal(refusal: ReplayRefusal): void {
|
|
4488
|
+
const reportKey = `${refusal.code}:${refusal.operation}:${refusal.callId}`;
|
|
4489
|
+
const count = (this.replayRefusalsReported.get(reportKey) ?? 0) + 1;
|
|
4490
|
+
this.replayRefusalsReported.set(reportKey, count);
|
|
4491
|
+
if ((count & (count - 1)) !== 0) return;
|
|
4492
|
+
const line = JSON.stringify({
|
|
4493
|
+
event: 'durable_replay_refused',
|
|
4494
|
+
code: refusal.code,
|
|
4495
|
+
operation: refusal.operation,
|
|
4496
|
+
call_key: refusal.callId,
|
|
4497
|
+
ordinal: refusal.ordinal,
|
|
4498
|
+
rung: refusal.rung,
|
|
4499
|
+
reason: refusal.reason,
|
|
4500
|
+
...(refusal.slot ? { slot: refusal.slot } : {}),
|
|
4501
|
+
...(refusal.recordedIdentitySources
|
|
4502
|
+
? { recorded_identity_sources: refusal.recordedIdentitySources }
|
|
4503
|
+
: {}),
|
|
4504
|
+
run_id: this.currentRunId,
|
|
4505
|
+
org_id: this.#options.orgId ?? null,
|
|
4506
|
+
play_name: this.#options.playName ?? null,
|
|
4507
|
+
refusal_count: count,
|
|
4508
|
+
});
|
|
4509
|
+
this.runtimeLog(line, { level: 'error' });
|
|
4510
|
+
console.error(line);
|
|
4511
|
+
}
|
|
4512
|
+
|
|
4513
|
+
/** Rate-limited: once per authored call per run context. */
|
|
4514
|
+
private reportLegacyOperationRecovery(
|
|
4515
|
+
operation: DurableCtxOperation,
|
|
4516
|
+
id: string,
|
|
4517
|
+
): void {
|
|
4518
|
+
const reportKey = `${operation}:${id}`;
|
|
4519
|
+
if (this.unverifiedRecoveryReported.has(reportKey)) return;
|
|
4520
|
+
this.unverifiedRecoveryReported.add(reportKey);
|
|
4521
|
+
this.runtimeLog(
|
|
4522
|
+
JSON.stringify({
|
|
4523
|
+
event: 'durable_operation_recovery_legacy_proven',
|
|
4524
|
+
operation,
|
|
4525
|
+
call_key: id,
|
|
4526
|
+
proof: 'recorded_request_identity',
|
|
4527
|
+
}),
|
|
4244
4528
|
);
|
|
4245
|
-
const freshIndex = this.freshnessCallIndexByKey.get(scope) ?? 0;
|
|
4246
|
-
this.freshnessCallIndexByKey.set(scope, freshIndex + 1);
|
|
4247
|
-
// Invocation identity follows authored scope and call order. Keep it
|
|
4248
|
-
// separate from the request/auth/action fingerprint used by reusable
|
|
4249
|
-
// result caching, so credential or response-contract changes cannot mint
|
|
4250
|
-
// a second provider operation key for the same authored effect.
|
|
4251
|
-
// A mapped row can be re-entered after provider backpressure; its replay
|
|
4252
|
-
// cursor restores the original call position.
|
|
4253
|
-
const index = nextReplayableCallIndex(`freshness:${scope}`, freshIndex);
|
|
4254
|
-
return sha256Hex(`${scope}:${index}`);
|
|
4255
4529
|
}
|
|
4256
4530
|
|
|
4531
|
+
|
|
4257
4532
|
private async executeFreshnessControlledCall<T>(input: {
|
|
4258
4533
|
operation: DurableCtxOperation;
|
|
4259
4534
|
id: string;
|
|
@@ -4268,6 +4543,14 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
4268
4543
|
/** Names the tool in the shared-cache skip log. */
|
|
4269
4544
|
toolId?: string;
|
|
4270
4545
|
onOutcome?: (value: T, metadata: CallFreshnessMetadata) => T;
|
|
4546
|
+
/**
|
|
4547
|
+
* Whether this call is a read that may execute when its recorded slot
|
|
4548
|
+
* holds a different request. Omitted: it fails loudly instead.
|
|
4549
|
+
*/
|
|
4550
|
+
replayMismatchPolicy?: () => Promise<ReplayMismatchPolicy>;
|
|
4551
|
+
/** See `executeWithFreshnessReceipt`. */
|
|
4552
|
+
legacyRequestIdentities?: () => Promise<readonly string[]>;
|
|
4553
|
+
operationKeyEncodesRequest?: true;
|
|
4271
4554
|
}): Promise<T> {
|
|
4272
4555
|
const orgId = this.#options.orgId?.trim();
|
|
4273
4556
|
if (!orgId) {
|
|
@@ -4275,10 +4558,39 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
4275
4558
|
'Freshness-controlled calls require a resolved organization identity.',
|
|
4276
4559
|
);
|
|
4277
4560
|
}
|
|
4561
|
+
const slots = this.exactRequestInvocationIds.get(input.invocationId);
|
|
4562
|
+
this.exactRequestInvocationIds.delete(input.invocationId);
|
|
4278
4563
|
return executeWithFreshnessReceipt({
|
|
4279
4564
|
orgId,
|
|
4280
4565
|
semanticKey: input.semanticKey,
|
|
4281
4566
|
invocationId: input.invocationId,
|
|
4567
|
+
...(slots?.exactRequestInvocationId
|
|
4568
|
+
? { exactRequestInvocationId: slots.exactRequestInvocationId }
|
|
4569
|
+
: {}),
|
|
4570
|
+
...(slots ? { inputFingerprint: slots.inputFingerprint } : {}),
|
|
4571
|
+
...(slots?.keyEncodesRequest || input.operationKeyEncodesRequest
|
|
4572
|
+
? { operationKeyEncodesRequest: true as const }
|
|
4573
|
+
: {}),
|
|
4574
|
+
...(input.legacyRequestIdentities
|
|
4575
|
+
? { legacyRequestIdentities: input.legacyRequestIdentities }
|
|
4576
|
+
: {}),
|
|
4577
|
+
...(slots?.legacySlot &&
|
|
4578
|
+
this.legacySlotScopes.has(slots.legacySlot.scope)
|
|
4579
|
+
? {
|
|
4580
|
+
legacySlotSearch: this.legacySlotSearch(
|
|
4581
|
+
input.invocationId,
|
|
4582
|
+
slots.legacySlot,
|
|
4583
|
+
),
|
|
4584
|
+
}
|
|
4585
|
+
: {}),
|
|
4586
|
+
...(input.replayMismatchPolicy
|
|
4587
|
+
? { replayMismatchPolicy: input.replayMismatchPolicy }
|
|
4588
|
+
: {}),
|
|
4589
|
+
operation: input.operation,
|
|
4590
|
+
callId: input.id,
|
|
4591
|
+
onLegacyRecoveryProven: () =>
|
|
4592
|
+
this.reportLegacyOperationRecovery(input.operation, input.id),
|
|
4593
|
+
onRefusal: (refusal) => this.reportReplayRefusal(refusal),
|
|
4282
4594
|
runId: this.currentReceiptOwnerRunId,
|
|
4283
4595
|
receiptOwnerRunId: this.currentReceiptOwnerRunId,
|
|
4284
4596
|
// Launches admitted without run-scoped keys wrote this operation under
|
|
@@ -7192,6 +7504,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
7192
7504
|
onClaimedResult?: (output: T, receiptKey: string) => T;
|
|
7193
7505
|
shouldPersistFailure?: (error: unknown) => boolean;
|
|
7194
7506
|
transient?: boolean;
|
|
7507
|
+
/** A read-only request: executes when its replayed slot holds another. */
|
|
7508
|
+
replayReadSafe?: boolean;
|
|
7195
7509
|
markRunningBeforeExecute?: boolean;
|
|
7196
7510
|
requiresExecutionLock?: boolean;
|
|
7197
7511
|
executionLockTtlMs?: number;
|
|
@@ -7257,6 +7571,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
7257
7571
|
}),
|
|
7258
7572
|
),
|
|
7259
7573
|
policy,
|
|
7574
|
+
replayMismatchPolicy: async () =>
|
|
7575
|
+
opts.replayReadSafe === true ? 'execute' : 'fail',
|
|
7260
7576
|
execute: () => execute(null),
|
|
7261
7577
|
sharesResult: (value) =>
|
|
7262
7578
|
!(
|
|
@@ -14667,6 +14983,27 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14667
14983
|
toolId: string,
|
|
14668
14984
|
input: Record<string, unknown>,
|
|
14669
14985
|
options?: ToolCallOptions,
|
|
14986
|
+
): Promise<unknown> {
|
|
14987
|
+
let invocationId: string | null = null;
|
|
14988
|
+
try {
|
|
14989
|
+
return await this.executeToolInternalWithSlot(
|
|
14990
|
+
key,
|
|
14991
|
+
toolId,
|
|
14992
|
+
input,
|
|
14993
|
+
options,
|
|
14994
|
+
(allocated) => (invocationId = allocated),
|
|
14995
|
+
);
|
|
14996
|
+
} finally {
|
|
14997
|
+
if (invocationId) this.settleLegacySlot(invocationId);
|
|
14998
|
+
}
|
|
14999
|
+
}
|
|
15000
|
+
|
|
15001
|
+
private async executeToolInternalWithSlot(
|
|
15002
|
+
key: string,
|
|
15003
|
+
toolId: string,
|
|
15004
|
+
input: Record<string, unknown>,
|
|
15005
|
+
options: ToolCallOptions | undefined,
|
|
15006
|
+
onSlotAllocated: (invocationId: string) => void,
|
|
14670
15007
|
): Promise<unknown> {
|
|
14671
15008
|
if (!this.usesExplicitFreshness) {
|
|
14672
15009
|
return this.executeToolLegacyInternal(key, toolId, input, options);
|
|
@@ -14694,6 +15031,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14694
15031
|
normalizedKey,
|
|
14695
15032
|
this.callSlotRequestDigest({ toolId, input }),
|
|
14696
15033
|
);
|
|
15034
|
+
onSlotAllocated(invocationId);
|
|
14697
15035
|
const sqlTool = isCustomerDbDatasetTool(toolId);
|
|
14698
15036
|
const scalarCustomerDbQuery = sqlTool && input.result_mode === 'rows';
|
|
14699
15037
|
const liveDataset =
|
|
@@ -14767,6 +15105,30 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14767
15105
|
sqlTool && (sqlMutation || scalarCustomerDbQuery)
|
|
14768
15106
|
? { ...input, operation_key: `${this.historyRunId}:${invocationId}` }
|
|
14769
15107
|
: input;
|
|
15108
|
+
/**
|
|
15109
|
+
* The result-cache keys this call's execution records with its result
|
|
15110
|
+
* (`executeToolLegacyInternal`): each hashes the request input, credential
|
|
15111
|
+
* scope, action version and the run's cache epoch. They prove an unbound
|
|
15112
|
+
* recorded operation is this call's.
|
|
15113
|
+
*/
|
|
15114
|
+
const legacyRequestIdentities =
|
|
15115
|
+
(staleAfterSeconds: number | null | undefined) => async () => {
|
|
15116
|
+
const identity = {
|
|
15117
|
+
toolId,
|
|
15118
|
+
requestInput,
|
|
15119
|
+
executionAuthScopeDigest: authScope?.trim() || null,
|
|
15120
|
+
staleAfterSeconds: this.effectiveToolCallCachePolicy({
|
|
15121
|
+
...options,
|
|
15122
|
+
force: true,
|
|
15123
|
+
staleAfterSeconds,
|
|
15124
|
+
}).staleAfterSeconds,
|
|
15125
|
+
};
|
|
15126
|
+
const [keys, legacy] = await Promise.all([
|
|
15127
|
+
this.compatibleDurableToolCallCacheKeys(identity),
|
|
15128
|
+
this.legacyDurableToolCallCacheKey(identity),
|
|
15129
|
+
]);
|
|
15130
|
+
return legacy ? [...keys, legacy] : keys;
|
|
15131
|
+
};
|
|
14770
15132
|
|
|
14771
15133
|
if (
|
|
14772
15134
|
isAlwaysFreshIntegrationWriteTool(toolId) &&
|
|
@@ -14783,6 +15145,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14783
15145
|
semanticKey,
|
|
14784
15146
|
invocationId,
|
|
14785
15147
|
policy: { requested: policy.requested, effective: 0 },
|
|
15148
|
+
legacyRequestIdentities: legacyRequestIdentities(0),
|
|
14786
15149
|
execute: async () =>
|
|
14787
15150
|
await this.executeToolLegacyInternal(key, toolId, requestInput, {
|
|
14788
15151
|
...options,
|
|
@@ -14793,6 +15156,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14793
15156
|
}
|
|
14794
15157
|
|
|
14795
15158
|
if (liveDataset || isAlwaysFreshIntegrationTool(toolId)) {
|
|
15159
|
+
// Never recovered: release the exact-request slot it reserved.
|
|
15160
|
+
this.exactRequestInvocationIds.delete(invocationId);
|
|
14796
15161
|
const value = await this.executeToolLegacyInternal(
|
|
14797
15162
|
key,
|
|
14798
15163
|
toolId,
|
|
@@ -14824,6 +15189,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14824
15189
|
invocationId,
|
|
14825
15190
|
policy,
|
|
14826
15191
|
toolId,
|
|
15192
|
+
replayMismatchPolicy: () => this.toolReplayMismatchPolicy(toolId, input),
|
|
15193
|
+
legacyRequestIdentities: legacyRequestIdentities(
|
|
15194
|
+
options?.staleAfterSeconds,
|
|
15195
|
+
),
|
|
14827
15196
|
...(publishLatestOnRefresh
|
|
14828
15197
|
? { publishLatestOnRefresh: true as const }
|
|
14829
15198
|
: {}),
|
|
@@ -17397,6 +17766,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
17397
17766
|
invocationId,
|
|
17398
17767
|
staleAfterSeconds: options?.staleAfterSeconds,
|
|
17399
17768
|
transient: options?.transient === true,
|
|
17769
|
+
replayReadSafe: reusableReadMethod,
|
|
17400
17770
|
onRecovered: (output) => {
|
|
17401
17771
|
if (!output.ok) {
|
|
17402
17772
|
this.logCtxFetchHttpFailure({
|
|
@@ -17763,6 +18133,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
17763
18133
|
id: normalizedKey,
|
|
17764
18134
|
semanticKey,
|
|
17765
18135
|
invocationId: boundaryId,
|
|
18136
|
+
// The boundary is scoped by the authored semanticKey: an
|
|
18137
|
+
// unbound receipt under it is this declared request's.
|
|
18138
|
+
...(options?.semanticKey?.trim()
|
|
18139
|
+
? { operationKeyEncodesRequest: true as const }
|
|
18140
|
+
: {}),
|
|
17766
18141
|
policy: freshnessPolicy,
|
|
17767
18142
|
completedAt: (value) => value.completedAt,
|
|
17768
18143
|
sharesResult: (value) =>
|