deepline 0.3.45 → 0.3.46

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 +174 -168
  76. package/dist/cli/index.mjs +182 -169
  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
@@ -0,0 +1,206 @@
1
+ import type { EmailStatusExtractorConfig } from './email-status';
2
+ import type { DeeplineGetterValueMap } from './extractor-targets';
3
+ import type { PlayDataset, SerializedPlayDataset } from './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>;
@@ -9,7 +9,7 @@ import {
9
9
  normalizeUrlHostname,
10
10
  resolveRedirectUrl,
11
11
  UnsafeOutboundUrlError,
12
- } from '@shared_libs/security/outbound-url-policy';
12
+ } from './outbound-url-policy';
13
13
 
14
14
  type NodeSafeFetchOptions = {
15
15
  maxRedirects?: number;