deepline 0.3.72 → 0.3.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +551 -571
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +40 -10
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +2 -14
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/native-batch.ts +9 -92
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/receipt-cohort.ts +159 -621
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +19 -13
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +1 -4
- package/dist/bundling-sources/shared_libs/plays/tool-response-contract.ts +2 -4
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts
CHANGED
|
@@ -48,6 +48,8 @@ export type RuntimeStepToolResultReceiptsInput = {
|
|
|
48
48
|
*/
|
|
49
49
|
executionLock?: {
|
|
50
50
|
required?: boolean;
|
|
51
|
+
/** Provider-operation identity; defaults to the result-cache receipt. */
|
|
52
|
+
key?: string;
|
|
51
53
|
ttlMs?: number;
|
|
52
54
|
waitMs?: number;
|
|
53
55
|
pollMs?: number;
|
|
@@ -88,6 +90,7 @@ type OwnedReceipt = {
|
|
|
88
90
|
ownerRunId: string;
|
|
89
91
|
force: boolean;
|
|
90
92
|
executionLockOwnerId: string | null;
|
|
93
|
+
executionLockKey: string | null;
|
|
91
94
|
lockLost: boolean;
|
|
92
95
|
completedByAnotherOwner: ToolExecuteResult | null;
|
|
93
96
|
heartbeatTimer: ReturnType<typeof setTimeout> | null;
|
|
@@ -99,9 +102,9 @@ type OwnedReceipt = {
|
|
|
99
102
|
*
|
|
100
103
|
* Tool results deliberately use the store's immutable completed-cache mode:
|
|
101
104
|
* a cache hit is reused, execution does not publish a `running` row, and the
|
|
102
|
-
* winner inserts one serialized ToolExecuteResult.
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
+
* winner inserts one canonical serialized ToolExecuteResult. Response
|
|
106
|
+
* presentation is materialized after cache recovery; only actions that
|
|
107
|
+
* explicitly require an execution fence acquire the optional lock below.
|
|
105
108
|
*/
|
|
106
109
|
export function createRuntimeStepToolResultReceipts(
|
|
107
110
|
input: RuntimeStepToolResultReceiptsInput,
|
|
@@ -164,7 +167,7 @@ export function createRuntimeStepToolResultReceipts(
|
|
|
164
167
|
return;
|
|
165
168
|
}
|
|
166
169
|
await input.store.releaseExecutionLock({
|
|
167
|
-
receiptKey: record.resultReceiptKey,
|
|
170
|
+
receiptKey: record.executionLockKey ?? record.resultReceiptKey,
|
|
168
171
|
ownerExecutionId: record.executionLockOwnerId,
|
|
169
172
|
});
|
|
170
173
|
record.executionLockOwnerId = null;
|
|
@@ -177,7 +180,7 @@ export function createRuntimeStepToolResultReceipts(
|
|
|
177
180
|
return 'active';
|
|
178
181
|
}
|
|
179
182
|
const renewed = await input.store.acquireExecutionLock({
|
|
180
|
-
receiptKey: record.resultReceiptKey,
|
|
183
|
+
receiptKey: record.executionLockKey ?? record.resultReceiptKey,
|
|
181
184
|
ownerExecutionId: record.executionLockOwnerId,
|
|
182
185
|
ttlMs: lock.ttlMs,
|
|
183
186
|
});
|
|
@@ -238,7 +241,7 @@ export function createRuntimeStepToolResultReceipts(
|
|
|
238
241
|
const acquireExecutionLock = async (
|
|
239
242
|
resultReceiptKey: string,
|
|
240
243
|
force: boolean,
|
|
241
|
-
): Promise<string | null> => {
|
|
244
|
+
): Promise<{ ownerId: string; key: string } | null> => {
|
|
242
245
|
if (!lock.required || !input.store.enabled) return null;
|
|
243
246
|
if (
|
|
244
247
|
!input.store.acquireExecutionLock ||
|
|
@@ -249,11 +252,12 @@ export function createRuntimeStepToolResultReceipts(
|
|
|
249
252
|
);
|
|
250
253
|
}
|
|
251
254
|
|
|
255
|
+
const executionLockKey = lock.key || resultReceiptKey;
|
|
252
256
|
const ownerExecutionId = `tool-result:${crypto.randomUUID()}`;
|
|
253
257
|
const deadline = Date.now() + lock.waitMs;
|
|
254
258
|
while (true) {
|
|
255
259
|
const acquired = await input.store.acquireExecutionLock({
|
|
256
|
-
receiptKey:
|
|
260
|
+
receiptKey: executionLockKey,
|
|
257
261
|
ownerExecutionId,
|
|
258
262
|
ttlMs: lock.ttlMs,
|
|
259
263
|
});
|
|
@@ -265,13 +269,13 @@ export function createRuntimeStepToolResultReceipts(
|
|
|
265
269
|
const cached = await readCompleted(resultReceiptKey, 'in_flight');
|
|
266
270
|
if (cached) {
|
|
267
271
|
await input.store.releaseExecutionLock({
|
|
268
|
-
receiptKey:
|
|
272
|
+
receiptKey: executionLockKey,
|
|
269
273
|
ownerExecutionId,
|
|
270
274
|
});
|
|
271
275
|
return null;
|
|
272
276
|
}
|
|
273
277
|
}
|
|
274
|
-
return ownerExecutionId;
|
|
278
|
+
return { ownerId: ownerExecutionId, key: executionLockKey };
|
|
275
279
|
}
|
|
276
280
|
|
|
277
281
|
if (!force) {
|
|
@@ -299,11 +303,11 @@ export function createRuntimeStepToolResultReceipts(
|
|
|
299
303
|
if (cached) return { kind: 'completed', result: cached };
|
|
300
304
|
}
|
|
301
305
|
|
|
302
|
-
const
|
|
306
|
+
const executionLock = await acquireExecutionLock(
|
|
303
307
|
resultReceiptKey,
|
|
304
308
|
candidate.force,
|
|
305
309
|
);
|
|
306
|
-
if (input.store.enabled && !candidate.force && !
|
|
310
|
+
if (input.store.enabled && !candidate.force && !executionLock) {
|
|
307
311
|
const cached = await readCompleted(resultReceiptKey, 'cache');
|
|
308
312
|
if (cached) return { kind: 'completed', result: cached };
|
|
309
313
|
// The only non-lock reason to get here is a store without a lock
|
|
@@ -311,12 +315,13 @@ export function createRuntimeStepToolResultReceipts(
|
|
|
311
315
|
}
|
|
312
316
|
|
|
313
317
|
const leaseId =
|
|
314
|
-
|
|
318
|
+
executionLock?.ownerId ?? `tool-result:${crypto.randomUUID()}`;
|
|
315
319
|
owned.set(leaseId, {
|
|
316
320
|
resultReceiptKey,
|
|
317
321
|
ownerRunId,
|
|
318
322
|
force: candidate.force,
|
|
319
|
-
executionLockOwnerId,
|
|
323
|
+
executionLockOwnerId: executionLock?.ownerId ?? null,
|
|
324
|
+
executionLockKey: executionLock?.key ?? null,
|
|
320
325
|
lockLost: false,
|
|
321
326
|
completedByAnotherOwner: null,
|
|
322
327
|
heartbeatTimer: null,
|
|
@@ -505,6 +510,7 @@ function normalizeExecutionLock(
|
|
|
505
510
|
}
|
|
506
511
|
return {
|
|
507
512
|
required: input?.required === true,
|
|
513
|
+
key: input?.key?.trim() ?? '',
|
|
508
514
|
ttlMs: Math.floor(ttlMs),
|
|
509
515
|
waitMs: Math.floor(waitMs),
|
|
510
516
|
pollMs: Math.floor(pollMs),
|
|
@@ -50,10 +50,7 @@ export type PlayContractCompatibilitySnapshot = {
|
|
|
50
50
|
authoringContractEdition?: PlayAuthoringContractEdition;
|
|
51
51
|
/** Immutable execute-result transport selected when the artifact is built. */
|
|
52
52
|
toolResponseContract?: ToolResponseContract;
|
|
53
|
-
/**
|
|
54
|
-
* Deliberate receipt-cache boundary for a response transformation. Missing
|
|
55
|
-
* preserves the original namespace of artifacts written before this field.
|
|
56
|
-
*/
|
|
53
|
+
/** Legacy response metadata; it does not change completed-result caching. */
|
|
57
54
|
toolResponseReceiptRevision?: string;
|
|
58
55
|
};
|
|
59
56
|
|
|
@@ -10,9 +10,8 @@ export const V2_TOOL_RESPONSE_CONTRACT = 'v2-tool-response' as const;
|
|
|
10
10
|
export const RAW_V2_TOOL_RESPONSE_CONTRACT = 'raw-v2' as const;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* bump for ordinary protocol, authoring, or transport contract changes.
|
|
13
|
+
* Legacy artifact compatibility metadata. It is carried through published
|
|
14
|
+
* artifacts but does not partition completed-result cache entries.
|
|
16
15
|
*/
|
|
17
16
|
export const RAW_V2_TOOL_RESPONSE_RECEIPT_REVISION = 'raw-v2-receipt-v1';
|
|
18
17
|
const TOOL_RESPONSE_RECEIPT_REVISION_PATTERN =
|
|
@@ -36,7 +35,6 @@ export function isToolResponseContract(
|
|
|
36
35
|
/**
|
|
37
36
|
* Preserves the distinction between an old artifact with no declared response
|
|
38
37
|
* contract and an artifact that explicitly selected the legacy V2 contract.
|
|
39
|
-
* Receipt reuse is controlled separately by `toolResponseReceiptRevision`.
|
|
40
38
|
*/
|
|
41
39
|
export function declaredToolResponseContract(
|
|
42
40
|
value: unknown,
|
package/dist/cli/index.js
CHANGED
|
@@ -1214,7 +1214,7 @@ var SDK_RELEASE = {
|
|
|
1214
1214
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
1215
1215
|
// getters keep their established compatibility behavior.
|
|
1216
1216
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
1217
|
-
version: "0.3.
|
|
1217
|
+
version: "0.3.73",
|
|
1218
1218
|
updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
|
|
1219
1219
|
packageCapabilities: {
|
|
1220
1220
|
updatePreferences: 1
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1199,7 +1199,7 @@ var SDK_RELEASE = {
|
|
|
1199
1199
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
1200
1200
|
// getters keep their established compatibility behavior.
|
|
1201
1201
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
1202
|
-
version: "0.3.
|
|
1202
|
+
version: "0.3.73",
|
|
1203
1203
|
updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
|
|
1204
1204
|
packageCapabilities: {
|
|
1205
1205
|
updatePreferences: 1
|
package/dist/index.js
CHANGED
|
@@ -832,7 +832,7 @@ var SDK_RELEASE = {
|
|
|
832
832
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
833
833
|
// getters keep their established compatibility behavior.
|
|
834
834
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
835
|
-
version: "0.3.
|
|
835
|
+
version: "0.3.73",
|
|
836
836
|
updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
|
|
837
837
|
packageCapabilities: {
|
|
838
838
|
updatePreferences: 1
|
package/dist/index.mjs
CHANGED
|
@@ -744,7 +744,7 @@ var SDK_RELEASE = {
|
|
|
744
744
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
745
745
|
// getters keep their established compatibility behavior.
|
|
746
746
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
747
|
-
version: "0.3.
|
|
747
|
+
version: "0.3.73",
|
|
748
748
|
updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
|
|
749
749
|
packageCapabilities: {
|
|
750
750
|
updatePreferences: 1
|