deepline 0.3.73 → 0.3.74

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.
@@ -54,7 +54,7 @@ export const MONITOR_FLEET_DOCUMENTATION = {
54
54
  summary:
55
55
  'A Monitor Fleet keeps one bounded, sticky set of ordinary monitors aligned with Customer DB rows.',
56
56
  authoredFields: {
57
- id: 'Stable lowercase fleet id used by sync, pause, resume, and deactivate.',
57
+ id: 'Stable lowercase fleet id used by sync, get, and deactivate.',
58
58
  source:
59
59
  'Customer DB table, unique row key, and optional equality filters that select candidate rows.',
60
60
  member:
@@ -199,7 +199,7 @@ export const SDK_RELEASE = {
199
199
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
- version: '0.3.73',
202
+ version: '0.3.74',
203
203
  updateSummary:
204
204
  '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.',
205
205
  packageCapabilities: {
@@ -7,8 +7,10 @@
7
7
  * limit against. Two copies of that number would drift, and the drift would
8
8
  * only be visible as a mutation that refuses a plan the SDK admitted.
9
9
  *
10
- * `packages/sdk/src/monitor-fleet-contract.ts` re-exports it, so customer-facing
11
- * code keeps importing it from the contract module and never learns this file
12
- * exists.
10
+ * `packages/sdk/src/monitor-fleet-contract.ts` cannot import this file - the
11
+ * workspace-architecture ratchet forbids new `shared_libs` edges from packages
12
+ * - so it mirrors the literal, and `tests/lib/monitors/monitor-fleet-limits-
13
+ * mirror.test.ts` holds the two equal by name. Everything outside Convex reads
14
+ * the contract module's copy and never learns this file exists.
13
15
  */
14
16
  export const MONITOR_FLEET_MAX_MEMBERS = 1_000;
@@ -100,7 +100,6 @@ import {
100
100
  import { CTX_FETCH_EGRESS_TOOL_ID } from './builtin-pacing';
101
101
  import {
102
102
  legacyRawFromToolResponseRawV2,
103
- normalizeToolResponseContract,
104
103
  providerMetaFromToolResponseRawV2,
105
104
  RAW_V2_TOOL_RESPONSE_CONTRACT,
106
105
  type ToolResponseContract,
@@ -115,7 +114,6 @@ import {
115
114
  isProviderUnavailable,
116
115
  serializeToolExecutionFailure,
117
116
  ToolExecutionError,
118
- TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
119
117
  TOOL_EXECUTION_ERROR_SCHEMA_HEADER,
120
118
  type ToolExecutionErrorSchemaVersion,
121
119
  type ToolExecutionFailureV1,
@@ -195,6 +193,10 @@ import {
195
193
  type PlayAuthoringRunScope,
196
194
  type PlayAuthoringRuntimeContext,
197
195
  } from '../plays/authoring-contract';
196
+ import {
197
+ resolvePlayArtifactRuntimeContract,
198
+ type PlayArtifactRuntimeContract,
199
+ } from './play-artifact-runtime-contract';
198
200
  import {
199
201
  LOG_LEVELS,
200
202
  formatCtxFetchHttpFailureDiagnostic,
@@ -407,14 +409,8 @@ type InlineCompositionStore = {
407
409
  governor: PlayExecutionGovernor;
408
410
  playName: string;
409
411
  staticPipeline: ContextOptions['staticPipeline'];
410
- /** Immutable error contract pinned by the child play artifact. */
411
- toolErrorSchemaVersion: ToolExecutionErrorSchemaVersion;
412
- /** Immutable authoring semantics pinned by the child play artifact. */
413
- authoringContractEdition: PlayAuthoringContractEdition;
414
- /** Execute response contract pinned by the child artifact. */
415
- toolResponseContract: ToolResponseContract;
416
- /** Explicit response-transform revision used for durable receipt identity. */
417
- toolResponseReceiptRevision?: string;
412
+ /** Immutable compatibility projection of the child Play artifact. */
413
+ runtimeContract: PlayArtifactRuntimeContract;
418
414
  };
419
415
  const inlineCompositionContext =
420
416
  new AsyncLocalStorage<InlineCompositionStore>();
@@ -1089,7 +1085,10 @@ export function resolveToolRuntimeTimeoutMs(
1089
1085
  authoringContractEdition: PlayAuthoringContractEdition = PLAY_AUTHORING_CONTRACT_EDITION,
1090
1086
  ): number | undefined {
1091
1087
  if (requestedTimeoutMs !== undefined) {
1092
- if (authoringContractEdition >= 2) {
1088
+ if (
1089
+ resolvePlayArtifactRuntimeContract({ authoringContractEdition }).semantics
1090
+ .validation === 'strict'
1091
+ ) {
1093
1092
  validatePlayAuthoringField(
1094
1093
  'ctx.tools.execute.timeoutMs',
1095
1094
  requestedTimeoutMs,
@@ -2115,6 +2114,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2115
2114
  { active: number; waiters: Array<() => void> }
2116
2115
  >();
2117
2116
  #options: ContextOptions;
2117
+ private readonly rootRuntimeContract: PlayArtifactRuntimeContract;
2118
2118
  private readonly executionScope: RunExecutionScope;
2119
2119
  private logBuffer: string[] = [];
2120
2120
  private readonly logRateLimitState = new Map<
@@ -2253,7 +2253,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2253
2253
  assertNoSecretTaint(request.input, 'ctx.tools.execute input');
2254
2254
  if (
2255
2255
  request.timeoutMs !== undefined &&
2256
- this.currentAuthoringContractEdition >= 2
2256
+ this.currentRuntimeSemantics.validation === 'strict'
2257
2257
  ) {
2258
2258
  validatePlayAuthoringField(
2259
2259
  'ctx.tools.execute.timeoutMs',
@@ -2262,7 +2262,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2262
2262
  }
2263
2263
  if (
2264
2264
  request.receiptWaitMs !== undefined &&
2265
- this.currentAuthoringContractEdition >= 2
2265
+ this.currentRuntimeSemantics.validation === 'strict'
2266
2266
  ) {
2267
2267
  validatePlayAuthoringField(
2268
2268
  'ctx.tools.execute.receiptWaitMs',
@@ -2406,7 +2406,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2406
2406
  }
2407
2407
  const handle = createSecretHandle(name.trim());
2408
2408
  const value =
2409
- this.currentAuthoringContractEdition >= 4
2409
+ this.currentRuntimeSemantics.secrets.value === 'plaintext_promise'
2410
2410
  ? createPlaintextSecretPromise(handle.name, () =>
2411
2411
  this.resolveSecretHandle(handle),
2412
2412
  )
@@ -2430,6 +2430,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2430
2430
  };
2431
2431
 
2432
2432
  constructor(options: ContextOptions) {
2433
+ this.rootRuntimeContract =
2434
+ options.artifactRuntimeContract ??
2435
+ resolvePlayArtifactRuntimeContract({
2436
+ authoringContractEdition: options.authoringContractEdition,
2437
+ toolResponseContract: options.toolResponseContract,
2438
+ toolResponseReceiptRevision: options.toolResponseReceiptRevision,
2439
+ });
2433
2440
  const fixtureBehavior = validateFixtureBehavior(options.fixtureBehavior);
2434
2441
  if (fixtureBehavior.ok === false) {
2435
2442
  throw new Error(fixtureBehavior.error);
@@ -2749,20 +2756,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2749
2756
 
2750
2757
  /**
2751
2758
  * Inline children share this context's queues, but not its artifact contract.
2752
- * Each child tool call must preserve the error shape pinned when that child
2753
- * was published, even when the parent was published under another schema.
2759
+ * Each child uses its own admitted semantics and response projection even
2760
+ * when the parent was published under another artifact contract.
2754
2761
  */
2755
2762
  private get currentToolErrorSchemaVersion(): ToolExecutionErrorSchemaVersion {
2756
- // Historical artifacts must not turn durable structured failures back into
2757
- // strings. Every runtime tool call and receipt rehydration uses v1.
2758
- return TOOL_EXECUTION_ERROR_SCHEMA_VERSION;
2763
+ return this.currentRuntimeContract.toolErrorSchemaVersion;
2759
2764
  }
2760
2765
 
2761
2766
  private get currentToolResponseContract(): ToolResponseContract {
2762
- return normalizeToolResponseContract(
2763
- this.activeInlineComposition?.toolResponseContract ??
2764
- this.#options.toolResponseContract,
2765
- );
2767
+ return this.currentRuntimeContract.toolResponseContract;
2766
2768
  }
2767
2769
 
2768
2770
  /**
@@ -2775,6 +2777,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2775
2777
  private get hasPinnedToolResponseContract(): boolean {
2776
2778
  return (
2777
2779
  this.activeInlineComposition !== null ||
2780
+ this.#options.artifactRuntimeContract !== undefined ||
2778
2781
  this.#options.toolResponseContract !== undefined
2779
2782
  );
2780
2783
  }
@@ -2784,20 +2787,23 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2784
2787
  * changes the completed-result cache identity.
2785
2788
  */
2786
2789
  private get currentToolResponseReceiptRevision(): string | undefined {
2787
- if (this.activeInlineComposition) {
2788
- return this.activeInlineComposition.toolResponseReceiptRevision;
2789
- }
2790
- return this.#options.toolResponseReceiptRevision;
2790
+ return this.currentRuntimeContract.toolResponseReceiptRevision;
2791
2791
  }
2792
2792
 
2793
2793
  private get currentAuthoringContractEdition(): PlayAuthoringContractEdition {
2794
+ return this.currentRuntimeContract.semantics.authoringContractEdition;
2795
+ }
2796
+
2797
+ private get currentRuntimeContract(): PlayArtifactRuntimeContract {
2794
2798
  return (
2795
- this.activeInlineComposition?.authoringContractEdition ??
2796
- this.#options.authoringContractEdition ??
2797
- PLAY_AUTHORING_CONTRACT_EDITION
2799
+ this.activeInlineComposition?.runtimeContract ?? this.rootRuntimeContract
2798
2800
  );
2799
2801
  }
2800
2802
 
2803
+ private get currentRuntimeSemantics() {
2804
+ return this.currentRuntimeContract.semantics;
2805
+ }
2806
+
2801
2807
  private recordPlayCallStep(input: {
2802
2808
  playId: string;
2803
2809
  execution?: 'inline';
@@ -9326,7 +9332,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9326
9332
  }
9327
9333
  if (
9328
9334
  options?.timeoutMs !== undefined &&
9329
- this.currentAuthoringContractEdition >= 2
9335
+ this.currentRuntimeSemantics.validation === 'strict'
9330
9336
  ) {
9331
9337
  validatePlayAuthoringField(
9332
9338
  'ctx.tools.execute.timeoutMs',
@@ -9335,7 +9341,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9335
9341
  }
9336
9342
  if (
9337
9343
  options?.receiptWaitMs !== undefined &&
9338
- this.currentAuthoringContractEdition >= 2
9344
+ this.currentRuntimeSemantics.validation === 'strict'
9339
9345
  ) {
9340
9346
  validatePlayAuthoringField(
9341
9347
  'ctx.tools.execute.receiptWaitMs',
@@ -10164,8 +10170,6 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10164
10170
  const childCompatibility = normalizePlayContractCompatibility(
10165
10171
  childCompatibilitySnapshot,
10166
10172
  );
10167
- const childToolErrorSchemaVersion =
10168
- childCompatibility.toolErrorSchemaVersion;
10169
10173
  const childToolResponseContract = childCompatibility.toolResponseContract;
10170
10174
  const childToolResponseReceiptRevision =
10171
10175
  childCompatibility.toolResponseReceiptRevision;
@@ -10240,11 +10244,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10240
10244
  governor: inlineChildGovernor,
10241
10245
  playName: resolvedName,
10242
10246
  staticPipeline: resolvedPlay.staticPipeline ?? null,
10243
- toolErrorSchemaVersion: childToolErrorSchemaVersion,
10244
- toolResponseContract: childToolResponseContract,
10245
- toolResponseReceiptRevision: childToolResponseReceiptRevision,
10246
- authoringContractEdition:
10247
- childCompatibility.authoringContractEdition,
10247
+ runtimeContract: resolvePlayArtifactRuntimeContract({
10248
+ authoringContractEdition:
10249
+ childCompatibility.authoringContractEdition,
10250
+ toolResponseContract: childToolResponseContract,
10251
+ toolResponseReceiptRevision: childToolResponseReceiptRevision,
10252
+ }),
10248
10253
  },
10249
10254
  () => this.executeResolvedPlay(resolvedPlay, this, input),
10250
10255
  );
@@ -10553,7 +10558,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10553
10558
  async sleep(ms: number): Promise<void> {
10554
10559
  this.assertInlineChildContract('suspending_child');
10555
10560
  const delayMs =
10556
- this.currentAuthoringContractEdition >= 2
10561
+ this.currentRuntimeSemantics.validation === 'strict'
10557
10562
  ? (validatePlayAuthoringField('ctx.sleep.ms', ms), ms)
10558
10563
  : Math.max(0, Math.round(ms));
10559
10564
  if (this.#options.durableBoundaries) {
@@ -10679,14 +10684,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10679
10684
  ...secretHeaderMarkers,
10680
10685
  },
10681
10686
  row: rowFetchScope,
10682
- // Edition 5 changes non-2xx responses from cached values to
10683
- // non-cacheable errors. Partition those receipts from editions
10684
- // 1–4 so a republished artifact makes a fresh request instead of
10685
- // inheriting a legacy error record.
10686
- ...(this.currentAuthoringContractEdition >= 5
10687
+ // A pinned fetch policy that turns non-2xx responses into typed,
10688
+ // non-cacheable errors needs its own receipt epoch. Preserve the
10689
+ // historical epoch selected by the artifact rather than deriving a
10690
+ // new cache key from every future authoring edition.
10691
+ ...(this.currentRuntimeSemantics.fetch.receiptIdentityEdition !==
10692
+ null
10687
10693
  ? {
10688
10694
  authoringContractEdition:
10689
- this.currentAuthoringContractEdition,
10695
+ this.currentRuntimeSemantics.fetch.receiptIdentityEdition,
10690
10696
  }
10691
10697
  : {}),
10692
10698
  }),
@@ -10702,7 +10708,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10702
10708
  httpStatus: output.status,
10703
10709
  });
10704
10710
  }
10705
- if (!output.ok && this.currentAuthoringContractEdition >= 5) {
10711
+ if (
10712
+ !output.ok &&
10713
+ this.currentRuntimeSemantics.fetch.httpFailure ===
10714
+ 'throw_typed_error'
10715
+ ) {
10706
10716
  throw new CtxFetchHttpError(output);
10707
10717
  }
10708
10718
  return output;
@@ -10710,7 +10720,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10710
10720
  shouldPersistFailure: (error) =>
10711
10721
  !(
10712
10722
  error instanceof CtxFetchHttpError &&
10713
- this.currentAuthoringContractEdition >= 5
10723
+ !this.currentRuntimeSemantics.fetch.persistHttpFailure
10714
10724
  ),
10715
10725
  execute: async ({ retainExternalCallSlot }) => {
10716
10726
  const secretHeaders = await this.resolveSecretAuth(secretAuth);
@@ -10914,11 +10924,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10914
10924
  });
10915
10925
  }
10916
10926
 
10917
- // Edition 5 adopts normal fetch semantics: a non-2xx response is
10918
- // a failed durable operation. Throw before checkpoint/receipt
10919
- // completion so the failure is never cached. Editions 1–4 retain
10920
- // their response-record behavior for the same upstream response.
10921
- if (!output.ok && this.currentAuthoringContractEdition >= 5) {
10927
+ // The artifact-pinned fetch policy decides whether a non-2xx
10928
+ // response is a returned record or a failed durable operation.
10929
+ // Throw before checkpoint/receipt completion so the throwing
10930
+ // policy never caches its failure.
10931
+ if (
10932
+ !output.ok &&
10933
+ this.currentRuntimeSemantics.fetch.httpFailure ===
10934
+ 'throw_typed_error'
10935
+ ) {
10922
10936
  throw new CtxFetchHttpError(output);
10923
10937
  }
10924
10938
 
@@ -11310,15 +11324,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
11310
11324
  async () =>
11311
11325
  await recordsFor(
11312
11326
  resultReceiptKeys,
11313
- await this.getRuntimeStepReceipts(
11314
- [...new Set(
11327
+ await this.getRuntimeStepReceipts([
11328
+ ...new Set(
11315
11329
  resultReceiptKeys.flatMap((receiptKey) => [
11316
11330
  receiptKey,
11317
11331
  ...(input.requestForReceipt.get(receiptKey)
11318
11332
  ?.legacyReceiptKeys ?? []),
11319
11333
  ]),
11320
- )],
11321
- ),
11334
+ ),
11335
+ ]),
11322
11336
  ),
11323
11337
  ),
11324
11338
  complete: async ({ receipts }) => {
@@ -52,6 +52,7 @@ import type {
52
52
  } from '../plays/tool-execution-error';
53
53
  import type { FixtureBehavior } from './fixture-behavior';
54
54
  import type { ToolResponseContract } from '../plays/tool-response-contract';
55
+ import type { PlayArtifactRuntimeContract } from './play-artifact-runtime-contract';
55
56
 
56
57
  export interface RowState {
57
58
  results: Map<string, unknown>;
@@ -576,6 +577,13 @@ export type IntegrationEventWaitHandler = {
576
577
  };
577
578
 
578
579
  export interface ContextOptions {
580
+ /**
581
+ * Immutable worker projection resolved once from the admitted Play artifact.
582
+ * Runner kernels pass this rather than separately interpreting artifact
583
+ * semantics, response presentation, and receipt revision. Direct/local
584
+ * callers may omit it and use the compatibility fields below.
585
+ */
586
+ artifactRuntimeContract?: PlayArtifactRuntimeContract;
579
587
  /** Immutable logical and physical execution identity for this context. */
580
588
  executionScope?: RunExecutionScope;
581
589
  /** Authoring semantics pinned by the immutable artifact. */
@@ -0,0 +1,62 @@
1
+ import {
2
+ PLAY_AUTHORING_CONTRACT_EDITION,
3
+ type PlayAuthoringContractEdition,
4
+ } from '../plays/authoring-contract';
5
+ import {
6
+ normalizeToolResponseContract,
7
+ type ToolResponseContract,
8
+ } from '../plays/tool-response-contract';
9
+ import {
10
+ TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
11
+ type ToolExecutionErrorSchemaVersion,
12
+ } from '../plays/tool-execution-error';
13
+ import {
14
+ resolvePlayRuntimeSemantics,
15
+ type PlayRuntimeSemantics,
16
+ } from './play-runtime-semantics';
17
+
18
+ /**
19
+ * One immutable worker view of the behavior admitted with a Play artifact.
20
+ *
21
+ * This is deliberately separate from the scheduler/worker execution protocol
22
+ * and runner/gateway HTTP contract. It owns only customer-visible Play
23
+ * behavior and receipt materialization decisions.
24
+ */
25
+ export type PlayArtifactRuntimeContract = Readonly<{
26
+ semantics: PlayRuntimeSemantics;
27
+ toolErrorSchemaVersion: ToolExecutionErrorSchemaVersion;
28
+ toolResponseContract: ToolResponseContract;
29
+ toolResponseReceiptRevision?: string;
30
+ }>;
31
+
32
+ export type PlayArtifactRuntimeContractInput = {
33
+ authoringContractEdition?: PlayAuthoringContractEdition | null;
34
+ toolResponseContract?: ToolResponseContract | null;
35
+ toolResponseReceiptRevision?: string | null;
36
+ };
37
+
38
+ /**
39
+ * Resolve once at the runner boundary, then pass this value through the
40
+ * PlayContext. Missing input here means a newly constructed context, not a
41
+ * historical persisted artifact; persisted launch readers must normalize their
42
+ * absent edition to the legacy value before calling this Module.
43
+ */
44
+ export function resolvePlayArtifactRuntimeContract(
45
+ input: PlayArtifactRuntimeContractInput = {},
46
+ ): PlayArtifactRuntimeContract {
47
+ const toolResponseReceiptRevision =
48
+ input.toolResponseReceiptRevision ?? undefined;
49
+ return Object.freeze({
50
+ semantics: resolvePlayRuntimeSemantics(
51
+ input.authoringContractEdition ?? PLAY_AUTHORING_CONTRACT_EDITION,
52
+ ),
53
+ // Historic string-only failures are deliberately upgraded at the runtime
54
+ // boundary. Rehydrating an old artifact must not regress a structured
55
+ // durable failure into an unbranchable string.
56
+ toolErrorSchemaVersion: TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
57
+ toolResponseContract: normalizeToolResponseContract(
58
+ input.toolResponseContract,
59
+ ),
60
+ ...(toolResponseReceiptRevision ? { toolResponseReceiptRevision } : {}),
61
+ });
62
+ }
@@ -0,0 +1,122 @@
1
+ import {
2
+ normalizePlayAuthoringContractEdition,
3
+ type PlayAuthoringContractEdition,
4
+ } from '../plays/authoring-contract';
5
+
6
+ export type PlayRuntimeValidationSemantics = 'legacy' | 'strict';
7
+ export type PlayRuntimeSecretValueSemantics =
8
+ | 'opaque_handle'
9
+ | 'plaintext_promise';
10
+ export type PlayRuntimeFetchHttpFailureSemantics =
11
+ | 'return_response'
12
+ | 'throw_typed_error';
13
+
14
+ /**
15
+ * Immutable worker-side projection of the semantics pinned by a Play artifact.
16
+ *
17
+ * Runtime features consume these named policies. They must not infer behavior
18
+ * from an edition number or the worker image SHA. The edition remains available
19
+ * only for diagnostics and compatibility identities that historically used it.
20
+ */
21
+ export type PlayRuntimeSemantics = Readonly<{
22
+ authoringContractEdition: PlayAuthoringContractEdition;
23
+ validation: PlayRuntimeValidationSemantics;
24
+ secrets: Readonly<{
25
+ value: PlayRuntimeSecretValueSemantics;
26
+ }>;
27
+ fetch: Readonly<{
28
+ httpFailure: PlayRuntimeFetchHttpFailureSemantics;
29
+ persistHttpFailure: boolean;
30
+ /**
31
+ * Historical ctx.fetch receipt-key epoch. Keep this stable across an
32
+ * unrelated future authoring edition; change it only when an old response
33
+ * cannot be replayed under the new fetch policy.
34
+ */
35
+ receiptIdentityEdition: PlayAuthoringContractEdition | null;
36
+ }>;
37
+ }>;
38
+
39
+ function definePlayRuntimeSemantics(
40
+ semantics: PlayRuntimeSemantics,
41
+ ): PlayRuntimeSemantics {
42
+ return Object.freeze({
43
+ ...semantics,
44
+ secrets: Object.freeze({ ...semantics.secrets }),
45
+ fetch: Object.freeze({ ...semantics.fetch }),
46
+ });
47
+ }
48
+
49
+ const LEGACY_SEMANTICS = {
50
+ validation: 'legacy',
51
+ secrets: { value: 'opaque_handle' },
52
+ fetch: {
53
+ httpFailure: 'return_response',
54
+ persistHttpFailure: true,
55
+ receiptIdentityEdition: null,
56
+ },
57
+ } as const;
58
+
59
+ const STRICT_SEMANTICS = {
60
+ ...LEGACY_SEMANTICS,
61
+ validation: 'strict',
62
+ } as const;
63
+
64
+ const PLAINTEXT_SECRET_SEMANTICS = {
65
+ ...STRICT_SEMANTICS,
66
+ secrets: { value: 'plaintext_promise' },
67
+ } as const;
68
+
69
+ /**
70
+ * Exhaustive compatibility registry for worker-visible Play behavior.
71
+ *
72
+ * Adding an authoring edition fails type checking until its semantics are
73
+ * declared here. Entries are fully materialized and frozen so every context
74
+ * using the same edition shares one cached contract projection.
75
+ */
76
+ const PLAY_RUNTIME_SEMANTICS_BY_EDITION = {
77
+ 1: definePlayRuntimeSemantics({
78
+ authoringContractEdition: 1,
79
+ ...LEGACY_SEMANTICS,
80
+ }),
81
+ 2: definePlayRuntimeSemantics({
82
+ authoringContractEdition: 2,
83
+ ...STRICT_SEMANTICS,
84
+ }),
85
+ 3: definePlayRuntimeSemantics({
86
+ authoringContractEdition: 3,
87
+ ...STRICT_SEMANTICS,
88
+ }),
89
+ 4: definePlayRuntimeSemantics({
90
+ authoringContractEdition: 4,
91
+ ...PLAINTEXT_SECRET_SEMANTICS,
92
+ }),
93
+ 5: definePlayRuntimeSemantics({
94
+ authoringContractEdition: 5,
95
+ ...PLAINTEXT_SECRET_SEMANTICS,
96
+ fetch: {
97
+ httpFailure: 'throw_typed_error',
98
+ persistHttpFailure: false,
99
+ receiptIdentityEdition: 5,
100
+ },
101
+ }),
102
+ 6: definePlayRuntimeSemantics({
103
+ authoringContractEdition: 6,
104
+ ...PLAINTEXT_SECRET_SEMANTICS,
105
+ fetch: {
106
+ httpFailure: 'throw_typed_error',
107
+ persistHttpFailure: false,
108
+ // Preserve the existing edition-6 receipt identity. Future unrelated
109
+ // editions may retain this epoch rather than partitioning the cache.
110
+ receiptIdentityEdition: 6,
111
+ },
112
+ }),
113
+ } satisfies Record<PlayAuthoringContractEdition, PlayRuntimeSemantics>;
114
+
115
+ export function resolvePlayRuntimeSemantics(
116
+ authoringContractEdition: unknown,
117
+ ): PlayRuntimeSemantics {
118
+ const edition = normalizePlayAuthoringContractEdition(
119
+ authoringContractEdition,
120
+ );
121
+ return PLAY_RUNTIME_SEMANTICS_BY_EDITION[edition];
122
+ }
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.73",
1217
+ version: "0.3.74",
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
@@ -31595,7 +31595,7 @@ var MONITOR_FLEET_REMOVAL_GRACE_MS = 7 * 24 * 60 * 6e4;
31595
31595
  var MONITOR_FLEET_DOCUMENTATION = {
31596
31596
  summary: "A Monitor Fleet keeps one bounded, sticky set of ordinary monitors aligned with Customer DB rows.",
31597
31597
  authoredFields: {
31598
- id: "Stable lowercase fleet id used by sync, pause, resume, and deactivate.",
31598
+ id: "Stable lowercase fleet id used by sync, get, and deactivate.",
31599
31599
  source: "Customer DB table, unique row key, and optional equality filters that select candidate rows.",
31600
31600
  member: "Ordinary monitor tool, stable key template, and payload evaluated for each selected source row.",
31601
31601
  selection: "Deterministic ranking and an active-member limit between 1 and 1,000."
@@ -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.73",
1202
+ version: "0.3.74",
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
@@ -31664,7 +31664,7 @@ var MONITOR_FLEET_REMOVAL_GRACE_MS = 7 * 24 * 60 * 6e4;
31664
31664
  var MONITOR_FLEET_DOCUMENTATION = {
31665
31665
  summary: "A Monitor Fleet keeps one bounded, sticky set of ordinary monitors aligned with Customer DB rows.",
31666
31666
  authoredFields: {
31667
- id: "Stable lowercase fleet id used by sync, pause, resume, and deactivate.",
31667
+ id: "Stable lowercase fleet id used by sync, get, and deactivate.",
31668
31668
  source: "Customer DB table, unique row key, and optional equality filters that select candidate rows.",
31669
31669
  member: "Ordinary monitor tool, stable key template, and payload evaluated for each selected source row.",
31670
31670
  selection: "Deterministic ranking and an active-member limit between 1 and 1,000."
package/dist/index.d.mts CHANGED
@@ -1956,7 +1956,7 @@ declare const MONITOR_FLEET_AUTHORING_CONTRACT_CHANGELOG: readonly [{
1956
1956
  declare const MONITOR_FLEET_DOCUMENTATION: {
1957
1957
  readonly summary: "A Monitor Fleet keeps one bounded, sticky set of ordinary monitors aligned with Customer DB rows.";
1958
1958
  readonly authoredFields: {
1959
- readonly id: "Stable lowercase fleet id used by sync, pause, resume, and deactivate.";
1959
+ readonly id: "Stable lowercase fleet id used by sync, get, and deactivate.";
1960
1960
  readonly source: "Customer DB table, unique row key, and optional equality filters that select candidate rows.";
1961
1961
  readonly member: "Ordinary monitor tool, stable key template, and payload evaluated for each selected source row.";
1962
1962
  readonly selection: "Deterministic ranking and an active-member limit between 1 and 1,000.";
package/dist/index.d.ts CHANGED
@@ -1956,7 +1956,7 @@ declare const MONITOR_FLEET_AUTHORING_CONTRACT_CHANGELOG: readonly [{
1956
1956
  declare const MONITOR_FLEET_DOCUMENTATION: {
1957
1957
  readonly summary: "A Monitor Fleet keeps one bounded, sticky set of ordinary monitors aligned with Customer DB rows.";
1958
1958
  readonly authoredFields: {
1959
- readonly id: "Stable lowercase fleet id used by sync, pause, resume, and deactivate.";
1959
+ readonly id: "Stable lowercase fleet id used by sync, get, and deactivate.";
1960
1960
  readonly source: "Customer DB table, unique row key, and optional equality filters that select candidate rows.";
1961
1961
  readonly member: "Ordinary monitor tool, stable key template, and payload evaluated for each selected source row.";
1962
1962
  readonly selection: "Deterministic ranking and an active-member limit between 1 and 1,000.";
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.73",
835
+ version: "0.3.74",
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
@@ -10629,7 +10629,7 @@ var MONITOR_FLEET_REMOVAL_GRACE_MS = 7 * 24 * 60 * 6e4;
10629
10629
  var MONITOR_FLEET_DOCUMENTATION = {
10630
10630
  summary: "A Monitor Fleet keeps one bounded, sticky set of ordinary monitors aligned with Customer DB rows.",
10631
10631
  authoredFields: {
10632
- id: "Stable lowercase fleet id used by sync, pause, resume, and deactivate.",
10632
+ id: "Stable lowercase fleet id used by sync, get, and deactivate.",
10633
10633
  source: "Customer DB table, unique row key, and optional equality filters that select candidate rows.",
10634
10634
  member: "Ordinary monitor tool, stable key template, and payload evaluated for each selected source row.",
10635
10635
  selection: "Deterministic ranking and an active-member limit between 1 and 1,000."
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.73",
747
+ version: "0.3.74",
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
@@ -10541,7 +10541,7 @@ var MONITOR_FLEET_REMOVAL_GRACE_MS = 7 * 24 * 60 * 6e4;
10541
10541
  var MONITOR_FLEET_DOCUMENTATION = {
10542
10542
  summary: "A Monitor Fleet keeps one bounded, sticky set of ordinary monitors aligned with Customer DB rows.",
10543
10543
  authoredFields: {
10544
- id: "Stable lowercase fleet id used by sync, pause, resume, and deactivate.",
10544
+ id: "Stable lowercase fleet id used by sync, get, and deactivate.",
10545
10545
  source: "Customer DB table, unique row key, and optional equality filters that select candidate rows.",
10546
10546
  member: "Ordinary monitor tool, stable key template, and payload evaluated for each selected source row.",
10547
10547
  selection: "Deterministic ranking and an active-member limit between 1 and 1,000."
@@ -106,12 +106,14 @@
106
106
  "dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts",
107
107
  "dist/bundling-sources/shared_libs/play-runtime/pacing.ts",
108
108
  "dist/bundling-sources/shared_libs/play-runtime/persistence-latch.ts",
109
+ "dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts",
109
110
  "dist/bundling-sources/shared_libs/play-runtime/play-call-execution.ts",
110
111
  "dist/bundling-sources/shared_libs/play-runtime/play-input.ts",
111
112
  "dist/bundling-sources/shared_libs/play-runtime/play-latency-trace.ts",
112
113
  "dist/bundling-sources/shared_libs/play-runtime/play-node-scope.ts",
113
114
  "dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts",
114
115
  "dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts",
116
+ "dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts",
115
117
  "dist/bundling-sources/shared_libs/play-runtime/postgres-json.ts",
116
118
  "dist/bundling-sources/shared_libs/play-runtime/profiles.ts",
117
119
  "dist/bundling-sources/shared_libs/play-runtime/projection.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.3.73",
3
+ "version": "0.3.74",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",