deepline 0.3.45 → 0.3.47

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.
Files changed (88) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +2 -3
  2. package/dist/bundling-sources/sdk/src/errors.ts +2 -2
  3. package/dist/bundling-sources/sdk/src/http.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/play.ts +7 -10
  5. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +3 -3
  6. package/dist/bundling-sources/sdk/src/release.ts +3 -3
  7. package/dist/bundling-sources/sdk/src/version.ts +2 -2
  8. package/dist/bundling-sources/shared_libs/play-data-plane/contracts.ts +25 -0
  9. package/dist/bundling-sources/shared_libs/play-data-plane/index.ts +1 -0
  10. package/dist/bundling-sources/shared_libs/play-data-plane/sheet-contract.ts +1 -1
  11. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +19 -19
  12. package/dist/bundling-sources/shared_libs/play-runtime/backend.ts +5 -6
  13. package/dist/bundling-sources/shared_libs/play-runtime/cell-staleness.ts +1 -66
  14. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +11 -11
  15. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +3 -3
  16. package/dist/bundling-sources/shared_libs/play-runtime/dataset-id.ts +4 -3
  17. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +3 -4
  18. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +2 -2
  19. package/dist/bundling-sources/shared_libs/play-runtime/email-status.ts +1 -275
  20. package/dist/bundling-sources/shared_libs/play-runtime/execution-ledger-store.ts +1 -1
  21. package/dist/bundling-sources/shared_libs/play-runtime/extractor-targets.ts +1 -106
  22. package/dist/bundling-sources/shared_libs/play-runtime/gateway-postgres-admission.ts +1 -2
  23. package/dist/bundling-sources/shared_libs/play-runtime/governor/in-memory-rate-state-backend.ts +13 -4
  24. package/dist/bundling-sources/shared_libs/play-runtime/live-events.ts +1 -5
  25. package/dist/bundling-sources/shared_libs/play-runtime/map-row-identity.ts +2 -3
  26. package/dist/bundling-sources/shared_libs/play-runtime/map-row-outcome.ts +2 -1
  27. package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +1 -1
  28. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +1 -1
  29. package/dist/bundling-sources/shared_libs/play-runtime/projection.ts +5 -5
  30. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -3
  31. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +1 -1
  32. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +1 -1
  33. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +4 -4
  34. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-modal-fallback.ts +3 -3
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +8 -8
  36. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +1 -1
  37. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +4 -4
  38. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +7 -7
  39. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +7 -7
  40. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/bundle.ts +13 -2
  41. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/index.ts +2 -2
  42. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runner-events.ts +1 -1
  43. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +1 -1
  44. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +2 -2
  45. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +1 -1
  46. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +6 -3
  47. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +1 -1
  48. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constraints.ts +1 -2
  49. package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +55 -0
  50. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runtime-limits.ts +1 -109
  51. package/dist/bundling-sources/shared_libs/play-runtime/step-program-dataset-builder.ts +1 -1
  52. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +1 -1
  53. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +1 -1
  54. package/dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts +6 -5
  55. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +1 -1
  56. package/dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts +1 -206
  57. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +10 -7
  58. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +1 -1
  59. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +8 -3
  60. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +4 -4
  61. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +3 -6
  62. package/dist/bundling-sources/shared_libs/plays/cell-staleness.ts +66 -0
  63. package/dist/bundling-sources/shared_libs/plays/compiler-manifest.ts +1 -1
  64. package/dist/bundling-sources/shared_libs/plays/contracts.ts +2 -2
  65. package/dist/bundling-sources/shared_libs/plays/core.ts +466 -0
  66. package/dist/bundling-sources/shared_libs/plays/email-status.ts +287 -0
  67. package/dist/bundling-sources/shared_libs/plays/extractor-targets.ts +106 -0
  68. package/dist/bundling-sources/shared_libs/plays/row-identity.ts +1 -3
  69. package/dist/bundling-sources/shared_libs/plays/runtime-constraints.ts +2 -0
  70. package/dist/bundling-sources/shared_libs/plays/runtime-validation.ts +4 -2
  71. package/dist/bundling-sources/shared_libs/plays/sandbox-runtime-limits.ts +109 -0
  72. package/dist/bundling-sources/shared_libs/plays/tool-execution-error.ts +624 -0
  73. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +206 -0
  74. package/dist/bundling-sources/shared_libs/security/safe-outbound-fetch.ts +1 -1
  75. package/dist/cli/index.js +181 -169
  76. package/dist/cli/index.mjs +189 -170
  77. package/dist/{compiler-manifest-DwYe2C2S.d.mts → compiler-manifest-BuoqasqI.d.mts} +585 -540
  78. package/dist/{compiler-manifest-DwYe2C2S.d.ts → compiler-manifest-BuoqasqI.d.ts} +585 -540
  79. package/dist/index.d.mts +9 -2
  80. package/dist/index.d.ts +9 -2
  81. package/dist/index.js +47 -40
  82. package/dist/index.mjs +47 -40
  83. package/dist/install-integrity.json +13 -3
  84. package/dist/plays/bundle-play-file.d.mts +4 -61
  85. package/dist/plays/bundle-play-file.d.ts +4 -61
  86. package/dist/plays/bundle-play-file.mjs +157 -155
  87. package/package.json +9 -6
  88. /package/dist/bundling-sources/shared_libs/{play-runtime → plays}/tool-response-contract.ts +0 -0
@@ -1,206 +1 @@
1
- import type { EmailStatusExtractorConfig } from './email-status';
2
- import type { DeeplineGetterValueMap } from './extractor-targets';
3
- import type { PlayDataset, SerializedPlayDataset } from '../plays/dataset';
4
-
5
- export type ToolResultExecutionMetadata = {
6
- idempotent: true;
7
- cached: boolean;
8
- source: 'live' | 'checkpoint' | 'cache' | 'in_flight';
9
- cacheKey?: string;
10
- receiptRole?: 'owner' | 'follower';
11
- receiptKey?: string;
12
- attachedToReceiptKey?: string;
13
- };
14
-
15
- export type ToolResultTargetMetadata = {
16
- value: unknown;
17
- path: string;
18
- };
19
-
20
- export type ToolResultListMetadata = {
21
- path: string;
22
- count: number | null;
23
- keys: Record<string, string>;
24
- };
25
-
26
- export type ToolResultExtractorDescriptor = {
27
- paths: readonly string[];
28
- transforms?: readonly string[];
29
- enum?: readonly string[];
30
- overrides?: readonly ToolResultExtractorOverride[];
31
- emailStatus?: EmailStatusExtractorConfig;
32
- };
33
-
34
- export type ToolResultExtractorOverride = {
35
- paths: readonly string[];
36
- equals?: string | number | boolean | null;
37
- value: string | number | boolean | null;
38
- };
39
-
40
- export type ToolResultMetadata = {
41
- toolId: string;
42
- execution: ToolResultExecutionMetadata;
43
- targets: Record<string, ToolResultTargetMetadata>;
44
- lists: Record<string, ToolResultListMetadata>;
45
- /** Original declarations preserve semantic accessor names across replay. */
46
- listExtractorPaths?: readonly string[];
47
- extractors?: Record<string, ToolResultExtractorDescriptor>;
48
- };
49
-
50
- export type ToolResultTargetAccessor<T = unknown> = ToolResultTargetMetadata & {
51
- get(): T | null;
52
- };
53
-
54
- export type ToolResultListAccessor<
55
- T = Record<string, unknown>,
56
- TKey extends string = string,
57
- > = Omit<ToolResultListMetadata, 'keys'> & {
58
- keys: Partial<Record<TKey, string>> & Record<string, string>;
59
- get(): PlayDataset<T>;
60
- };
61
-
62
- export type ToolResultMetadataInput = {
63
- toolId: string;
64
- extractors?: Record<string, ToolResultExtractorDescriptor>;
65
- targetGetters?: Record<string, readonly string[]>;
66
- listExtractorPaths?: readonly string[];
67
- listIdentityGetters?: Record<string, readonly string[]>;
68
- };
69
-
70
- export type ToolResultEnvelope<
71
- TData = unknown,
72
- TMeta = Record<string, unknown>,
73
- > = {
74
- data: TData;
75
- meta?: TMeta;
76
- };
77
-
78
- export type SerializedToolExecuteResultV1 = {
79
- __kind: 'deepline.tool_execute_result.v1';
80
- status: string;
81
- job_id?: string;
82
- /** Deepline-owned execution/result metadata. */
83
- meta?: Record<string, unknown>;
84
- toolResponse: {
85
- /**
86
- * Raw provider/tool data with declared row-list payloads clipped to bounded
87
- * previews. Use list getters for row-shaped data.
88
- */
89
- raw: unknown;
90
- meta?: Record<string, unknown>;
91
- };
92
- listDatasets?: Record<string, SerializedPlayDataset<Record<string, unknown>>>;
93
- /** Full declared list rows used to rehydrate list Dataset Handles. */
94
- listRows?: Record<string, Array<Record<string, unknown>>>;
95
- /** Computed scalar/object getters preserved before raw list previews are clipped. */
96
- targetValues?: Record<string, ToolResultTargetMetadata>;
97
- metadata: ToolResultMetadataInput;
98
- execution: ToolResultExecutionMetadata;
99
- };
100
-
101
- /**
102
- * Canonical receipt form. Provider data is stored once as `rawV2`; the legacy
103
- * raw/meta view is recreated from the payload-free projection descriptor.
104
- */
105
- export type SerializedToolExecuteResultV2 = Omit<
106
- SerializedToolExecuteResultV1,
107
- '__kind' | 'toolResponse'
108
- > & {
109
- __kind: 'deepline.tool_execute_result.v2';
110
- toolResponse: {
111
- rawV2: unknown;
112
- view: 'data' | 'rawV2';
113
- /** Deepline-owned additions not already represented in `rawV2.meta`. */
114
- responseMeta?: Record<string, unknown>;
115
- };
116
- };
117
-
118
- export type SerializedToolExecuteResult =
119
- | SerializedToolExecuteResultV1
120
- | SerializedToolExecuteResultV2;
121
-
122
- export type ToolResponseEnvelope<
123
- TData = unknown,
124
- TMeta = Record<string, unknown>,
125
- > = {
126
- raw: TData;
127
- /** Complete parsed and scrubbed provider response, materialized from raw-v2. */
128
- rawV2?: unknown;
129
- /** Durable descriptor for deriving the legacy raw view from `rawV2`. */
130
- view?: 'data' | 'rawV2';
131
- meta?: TMeta;
132
- };
133
-
134
- export type ToolExecuteResultBase<
135
- TResult = unknown,
136
- TMeta = Record<string, unknown>,
137
- > = {
138
- status: string;
139
- job_id?: string;
140
- /** Deepline-owned execution/result metadata. */
141
- meta?: Record<string, unknown>;
142
- toolResponse: ToolResponseEnvelope<TResult, TMeta>;
143
- extractedValues: Record<string, ToolResultTargetAccessor>;
144
- extractedLists: Record<string, ToolResultListAccessor>;
145
- /** Convenience alias for play code. Serialized output uses toolResponse. */
146
- toolOutput: ToolResponseEnvelope<TResult, TMeta>;
147
- _metadata: {
148
- toolId: string;
149
- execution: ToolResultExecutionMetadata;
150
- targets: Record<string, { value: unknown; path: string }>;
151
- extractors?: Record<string, ToolResultExtractorDescriptor>;
152
- lists: Record<
153
- string,
154
- {
155
- path: string;
156
- count: number | null;
157
- keys: Record<string, string>;
158
- }
159
- >;
160
- /** Original declarations preserve semantic accessor names across replay. */
161
- listExtractorPaths?: readonly string[];
162
- };
163
- };
164
-
165
- export type ToolExecuteResultAccessors<
166
- TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>,
167
- TLists extends Record<string, Record<string, unknown>> = Record<
168
- string,
169
- Record<string, unknown>
170
- >,
171
- > = {
172
- extractedValues: {
173
- [K in keyof TExtracted]: ToolResultTargetAccessor<TExtracted[K]>;
174
- };
175
- extractedLists: {
176
- [K in keyof TLists]: ToolResultListAccessor<TLists[K]>;
177
- };
178
- };
179
-
180
- /**
181
- * Canonical result returned by Deepline tool execution.
182
- *
183
- * The top-level object is Deepline-owned execution metadata and semantic
184
- * extraction state. The canonical provider response lives under
185
- * `toolResponse.rawV2`; `toolResponse.raw` remains the legacy compatibility
186
- * projection. Response metadata lives under `toolResponse.meta`. Semantic single-value
187
- * getters live under `extractedValues.<name>.get()`, and list getters live
188
- * under `extractedLists.<name>.get()`.
189
- *
190
- * Use extractors first when a tool contract exposes them. Use list getters for
191
- * row-shaped data. Drop to `toolResponse.raw` only for provider-specific scalar
192
- * fields or bounded debugging context; persisted rows may clip declared lists to
193
- * previews.
194
- *
195
- * @sdkReference runtime 200
196
- */
197
- export type ToolExecuteResult<
198
- TResult = unknown,
199
- TMeta = Record<string, unknown>,
200
- TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>,
201
- TLists extends Record<string, Record<string, unknown>> = Record<
202
- string,
203
- Record<string, unknown>
204
- >,
205
- > = ToolExecuteResultBase<TResult, TMeta> &
206
- ToolExecuteResultAccessors<TExtracted, TLists>;
1
+ export * from '../plays/tool-result-types';
@@ -8,24 +8,24 @@ export type {
8
8
  ToolResultListAccessor,
9
9
  ToolResultTargetMetadata,
10
10
  ToolResultTargetAccessor,
11
- } from './tool-result-types';
11
+ } from '../plays/tool-result-types';
12
12
  export type {
13
13
  EmailDeliverability,
14
14
  EmailMxClass,
15
15
  EmailStatus,
16
16
  EmailStatusValue,
17
17
  EmailStatusVerdict,
18
- } from './email-status';
18
+ } from '../plays/email-status';
19
19
 
20
20
  import {
21
21
  buildEmailStatus,
22
22
  type EmailStatusExtractorConfig,
23
- } from './email-status';
23
+ } from '../plays/email-status';
24
24
  import {
25
25
  JOB_CHANGE_STATUS_VALUES,
26
26
  type JobChangeGetterValue,
27
27
  type JobChangeStatus,
28
- } from './extractor-targets';
28
+ } from '../plays/extractor-targets';
29
29
  import type {
30
30
  SerializedToolExecuteResult,
31
31
  ToolExecuteResult,
@@ -37,7 +37,7 @@ import type {
37
37
  ToolResultMetadataInput,
38
38
  ToolResultTargetAccessor,
39
39
  ToolResultTargetMetadata,
40
- } from './tool-result-types';
40
+ } from '../plays/tool-result-types';
41
41
  import {
42
42
  createDeferredPlayDataset,
43
43
  createPlayDataset,
@@ -47,13 +47,16 @@ import {
47
47
  type PlayDataset,
48
48
  type SerializedPlayDataset,
49
49
  } from '../plays/dataset';
50
- import { normalizeTableNamespace, sha256Hex } from '../plays/row-identity';
50
+ import {
51
+ normalizeTableNamespace,
52
+ sha256Hex,
53
+ } from '../plays/row-identity';
51
54
  import { listNameFromDeclaredPath } from './tool-result-paths';
52
55
  import {
53
56
  legacyRawFromToolResponseRawV2,
54
57
  providerMetaFromToolResponseRawV2,
55
58
  type ToolResponseView,
56
- } from './tool-response-contract';
59
+ } from '../plays/tool-response-contract';
57
60
 
58
61
  type PathSegment = string | number | '*';
59
62
 
@@ -1,5 +1,5 @@
1
1
  import { isReusableWorkReceiptState } from './work-receipt-state-machine';
2
- import type { ToolExecutionFailureV1 } from '../tool-execution-error';
2
+ import type { ToolExecutionFailureV1 } from '../plays/tool-execution-error';
3
3
 
4
4
  export type WorkReceiptFailureKind = 'terminal' | 'repairable';
5
5
 
@@ -1,5 +1,5 @@
1
- import type { ToolExecutionErrorSchemaVersion } from '../tool-execution-error';
2
- import type { ToolResponseContract } from '../play-runtime/tool-response-contract';
1
+ import type { ToolExecutionErrorSchemaVersion } from './tool-execution-error';
2
+ import type { ToolResponseContract } from './tool-response-contract';
3
3
  import type { PlayAuthoringContractEdition } from './authoring-contract';
4
4
 
5
5
  export type PlayPackageImport = {
@@ -36,7 +36,12 @@ export type PlayArtifactCompatibility = {
36
36
  };
37
37
 
38
38
  /** The only executable Play artifact contract. */
39
- export type PlayArtifactKind = 'cjs_node20';
39
+ export const PLAY_ARTIFACT_KINDS = {
40
+ cjsNode20: 'cjs_node20',
41
+ } as const;
42
+
43
+ export type PlayArtifactKind =
44
+ (typeof PLAY_ARTIFACT_KINDS)[keyof typeof PLAY_ARTIFACT_KINDS];
40
45
 
41
46
  export type PlayBundleArtifact = {
42
47
  codeFormat: 'cjs_module';
@@ -1,9 +1,9 @@
1
1
  import { Type, type Static, type TSchema } from '@sinclair/typebox';
2
2
  import { Value } from '@sinclair/typebox/value';
3
- import type { PreviousCell } from '../play-runtime/cell-staleness';
4
- import type { PlaySandboxRuntimeLimits } from '../play-runtime/sandbox-runtime-limits';
5
- import type { ToolExecuteResult } from '../play-runtime/tool-result-types';
6
- import type { ToolExecutionErrorSchemaVersion } from '../tool-execution-error';
3
+ import type { PreviousCell } from './cell-staleness';
4
+ import type { PlaySandboxRuntimeLimits } from './sandbox-runtime-limits';
5
+ import type { ToolExecuteResult } from './tool-result-types';
6
+ import type { ToolExecutionErrorSchemaVersion } from './tool-execution-error';
7
7
  import type { PlayDataset, PlayDatasetInput, PlayDatasetRow } from './dataset';
8
8
 
9
9
  export const LEGACY_PLAY_AUTHORING_CONTRACT_EDITION = 1 as const;
@@ -21,10 +21,7 @@ import {
21
21
  type Message,
22
22
  type Plugin,
23
23
  } from 'esbuild';
24
- import {
25
- PLAY_ARTIFACT_KINDS,
26
- type PlayArtifactKind,
27
- } from '../../play-runtime/backend';
24
+ import { PLAY_ARTIFACT_KINDS, type PlayArtifactKind } from '../artifact-types';
28
25
  import type { PlayCompilerManifest } from '../compiler-manifest';
29
26
  import type {
30
27
  PlayArtifactCompatibility,
@@ -56,8 +53,8 @@ export {
56
53
  type DocflowBindingResolution,
57
54
  type DocflowSymbolResolution,
58
55
  } from '../docflow-binding';
59
- import type { ToolExecutionErrorSchemaVersion } from '../../tool-execution-error';
60
- import type { PlaySandboxRuntimeDeclaration } from '../../play-runtime/sandbox-runtime-limits';
56
+ import type { ToolExecutionErrorSchemaVersion } from '../tool-execution-error';
57
+ import type { PlaySandboxRuntimeDeclaration } from '../sandbox-runtime-limits';
61
58
  import { validatePlaySourceFilesHaveNoInlineSecrets } from '../secret-guardrails';
62
59
  import { MAX_PLAY_BUNDLE_BYTES } from './limits';
63
60
  import { PLAY_AUTHORING_CONTRACT_EDITION } from '../authoring-contract';
@@ -0,0 +1,66 @@
1
+ /** Stored per-cell freshness and completion metadata. */
2
+ export type CellStalenessMeta = {
3
+ status?: string | null;
4
+ completedAt?: number | null;
5
+ staleAt?: number | null;
6
+ staleAfterSeconds?: number | null;
7
+ };
8
+
9
+ /**
10
+ * Previous durable cell value passed to object-column resolvers.
11
+ *
12
+ * The runtime supplies this when a row+column is being recomputed after a
13
+ * previous value existed. `value` has the same type that the column returns;
14
+ * freshness metadata lives beside it.
15
+ *
16
+ * @sdkReference runtime 120
17
+ */
18
+ export type PreviousCell<Value = unknown> = {
19
+ /** Previous completed value for this row+column. */
20
+ value: Value;
21
+ /** Millisecond timestamp when the previous value completed. */
22
+ completedAt?: number;
23
+ /** Millisecond timestamp when the previous value becomes stale; `null` means no expiry. */
24
+ staleAt?: number | null;
25
+ /** Resolved numeric TTL in seconds for the previous value, when present. */
26
+ staleAfterSeconds?: number;
27
+ };
28
+
29
+ export const DEEPLINE_CELL_META_FIELD = '__deeplineCellMeta';
30
+
31
+ export function previousCellFromValue<Value>(input: {
32
+ hasValue: boolean;
33
+ value: Value;
34
+ meta?: CellStalenessMeta | null;
35
+ }): PreviousCell<Value> | undefined {
36
+ if (!input.hasValue) {
37
+ return undefined;
38
+ }
39
+
40
+ const previous: PreviousCell<Value> = {
41
+ value: input.value,
42
+ };
43
+ if (
44
+ typeof input.meta?.completedAt === 'number' &&
45
+ Number.isFinite(input.meta.completedAt)
46
+ ) {
47
+ previous.completedAt = input.meta.completedAt;
48
+ }
49
+ if (
50
+ input.meta &&
51
+ Object.prototype.hasOwnProperty.call(input.meta, 'staleAt')
52
+ ) {
53
+ previous.staleAt =
54
+ typeof input.meta.staleAt === 'number' &&
55
+ Number.isFinite(input.meta.staleAt)
56
+ ? input.meta.staleAt
57
+ : null;
58
+ }
59
+ if (
60
+ typeof input.meta?.staleAfterSeconds === 'number' &&
61
+ Number.isFinite(input.meta.staleAfterSeconds)
62
+ ) {
63
+ previous.staleAfterSeconds = input.meta.staleAfterSeconds;
64
+ }
65
+ return previous;
66
+ }
@@ -1,4 +1,4 @@
1
- import type { PlayArtifactKind } from '../play-runtime/backend';
1
+ import type { PlayArtifactKind } from './artifact-types';
2
2
  import type { PlayStaticPipeline } from './static-pipeline';
3
3
  import type { AdmittedPlayAuthoringContract } from './authoring-contract';
4
4
 
@@ -2,7 +2,7 @@ import {
2
2
  SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS,
3
3
  TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
4
4
  type ToolExecutionErrorSchemaVersion,
5
- } from '../tool-execution-error';
5
+ } from './tool-execution-error';
6
6
  import { CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION } from './artifact-contract-version';
7
7
  import {
8
8
  PLAY_AUTHORING_CONTRACT_EDITION,
@@ -18,7 +18,7 @@ import {
18
18
  RAW_V2_TOOL_RESPONSE_RECEIPT_REVISION,
19
19
  UnsupportedToolResponseContractError,
20
20
  type ToolResponseContract,
21
- } from '../play-runtime/tool-response-contract';
21
+ } from './tool-response-contract';
22
22
 
23
23
  export type PlayContractSource = 'ad_hoc' | 'draft' | 'published';
24
24