deepline 0.3.110 → 0.3.112
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.ts +2 -1
- package/dist/bundling-sources/sdk/src/index.ts +1 -0
- package/dist/bundling-sources/sdk/src/play.ts +2 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-queue-health.ts +32 -25
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +10 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +1 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +3 -0
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +20 -0
- package/dist/cli/index.js +29 -1
- package/dist/cli/index.mjs +29 -1
- package/dist/{compiler-manifest-x14KL83E.d.mts → compiler-manifest-DfSnbCTW.d.mts} +487 -469
- package/dist/{compiler-manifest-x14KL83E.d.ts → compiler-manifest-DfSnbCTW.d.ts} +487 -469
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -2
- package/dist/index.mjs +4 -2
- package/dist/install-integrity.json +2 -2
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
|
@@ -2,295 +2,6 @@
|
|
|
2
2
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
3
3
|
import { Static } from '@sinclair/typebox';
|
|
4
4
|
|
|
5
|
-
declare const TOOL_EXECUTION_ERROR_SCHEMA_VERSION: 1;
|
|
6
|
-
declare const SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS: readonly [0, 1];
|
|
7
|
-
type ToolExecutionErrorSchemaVersion = (typeof SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS)[number];
|
|
8
|
-
/**
|
|
9
|
-
* The boundary responsible for a failed tool call.
|
|
10
|
-
*
|
|
11
|
-
* Use `provider` to distinguish a provider answer from caller input and
|
|
12
|
-
* Deepline infrastructure. `unknown` fails closed and must not trigger a
|
|
13
|
-
* waterfall fallback.
|
|
14
|
-
*
|
|
15
|
-
* @sdkReference errors 020
|
|
16
|
-
*/
|
|
17
|
-
type ToolExecutionErrorOrigin = 'caller' | 'provider' | 'deepline' | 'unknown';
|
|
18
|
-
/**
|
|
19
|
-
* The stable reason family for a failed tool call.
|
|
20
|
-
*
|
|
21
|
-
* Branch on this field only after narrowing to `ToolExecutionError`. Catch
|
|
22
|
-
* `ProviderTransientError` when the policy is simply “try the next read
|
|
23
|
-
* provider”; it is the safer and shorter waterfall contract.
|
|
24
|
-
*
|
|
25
|
-
* @sdkReference errors 030
|
|
26
|
-
*/
|
|
27
|
-
type ToolExecutionErrorCategory = 'validation' | 'authentication' | 'authorization' | 'rate_limit' | 'network' | 'upstream' | 'billing' | 'conflict' | 'internal' | 'unknown';
|
|
28
|
-
/**
|
|
29
|
-
* The transport failure observed when `category` is `network`.
|
|
30
|
-
*
|
|
31
|
-
* This is `null` for failures that are not network failures.
|
|
32
|
-
*
|
|
33
|
-
* @sdkReference errors 040
|
|
34
|
-
*/
|
|
35
|
-
type ToolExecutionNetworkKind = 'timeout' | 'dns' | 'connect' | 'reset' | 'unavailable' | 'unknown';
|
|
36
|
-
/**
|
|
37
|
-
* The request boundary on which a network failure occurred.
|
|
38
|
-
*
|
|
39
|
-
* `deepline_to_provider` is provider-side. Client and runtime scopes are
|
|
40
|
-
* Deepline transport failures and never qualify as provider fallthrough.
|
|
41
|
-
*
|
|
42
|
-
* @sdkReference errors 050
|
|
43
|
-
*/
|
|
44
|
-
type ToolExecutionNetworkScope = 'client_to_deepline' | 'runtime_to_deepline' | 'deepline_to_provider';
|
|
45
|
-
/**
|
|
46
|
-
* Bounded, primitive-only diagnostics explicitly approved for customers.
|
|
47
|
-
* Raw provider bodies, credentials, prompts, stacks, and causes never belong
|
|
48
|
-
* in this shared API/SDK/Play contract.
|
|
49
|
-
*
|
|
50
|
-
* @sdkReference errors 063
|
|
51
|
-
*/
|
|
52
|
-
type ToolExecutionPublicDetails = Readonly<Record<string, string | number | boolean | null>>;
|
|
53
|
-
/**
|
|
54
|
-
* Portable version-1 `tool_error` payload.
|
|
55
|
-
*
|
|
56
|
-
* This allowlisted shape crosses the API, runtime, and SDK boundaries.
|
|
57
|
-
* `message` remains on the Error object and is deliberately not a policy
|
|
58
|
-
* field.
|
|
59
|
-
*
|
|
60
|
-
* @sdkReference errors 064
|
|
61
|
-
*/
|
|
62
|
-
type ToolExecutionFailureV1 = {
|
|
63
|
-
/** Payload version. */
|
|
64
|
-
schemaVersion: typeof TOOL_EXECUTION_ERROR_SCHEMA_VERSION;
|
|
65
|
-
/** Public tool id passed to `tools.execute`. */
|
|
66
|
-
toolId: string;
|
|
67
|
-
/** Provider responsible for the operation, or `null`. */
|
|
68
|
-
provider: string | null;
|
|
69
|
-
/** Provider operation name, or `null`. */
|
|
70
|
-
operation: string | null;
|
|
71
|
-
/** Stable machine-readable failure code, or `null`. */
|
|
72
|
-
code: string | null;
|
|
73
|
-
/** Boundary responsible for the failure. */
|
|
74
|
-
origin: ToolExecutionErrorOrigin;
|
|
75
|
-
/** Stable reason family. */
|
|
76
|
-
category: ToolExecutionErrorCategory;
|
|
77
|
-
/** Whether repeating the same semantic call is delivery-safe. */
|
|
78
|
-
retryable: boolean;
|
|
79
|
-
/** HTTP status when one exists, or `null`. */
|
|
80
|
-
statusCode: number | null;
|
|
81
|
-
/** Provider or Deepline request id, or `null`. */
|
|
82
|
-
requestId: string | null;
|
|
83
|
-
/** Suggested same-call retry delay in milliseconds, or `null`. */
|
|
84
|
-
retryAfterMs: number | null;
|
|
85
|
-
/** Network failure kind, or `null`. */
|
|
86
|
-
networkKind: ToolExecutionNetworkKind | null;
|
|
87
|
-
/** Network boundary that failed, or `null`. */
|
|
88
|
-
networkScope: ToolExecutionNetworkScope | null;
|
|
89
|
-
/** Explicitly allowlisted customer diagnostics, when present. */
|
|
90
|
-
publicDetails?: ToolExecutionPublicDetails | null;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Constructor input for a structured tool failure.
|
|
94
|
-
*
|
|
95
|
-
* Deepline creates these values while decoding the versioned wire payload.
|
|
96
|
-
* Customer code normally reads `ToolExecutionError` fields instead of
|
|
97
|
-
* constructing an error.
|
|
98
|
-
*
|
|
99
|
-
* @sdkReference errors 065
|
|
100
|
-
*/
|
|
101
|
-
type ToolExecutionErrorOptions = Omit<ToolExecutionFailureV1, 'schemaVersion'> & {
|
|
102
|
-
/**
|
|
103
|
-
* Local diagnostic context inherited from DeeplineError. This is not part of
|
|
104
|
-
* the portable failure payload and is intentionally omitted by serialization.
|
|
105
|
-
*/
|
|
106
|
-
details?: Record<string, unknown>;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Provider-owned failure categories that may fall through to another read
|
|
110
|
-
* provider.
|
|
111
|
-
*
|
|
112
|
-
* @sdkReference errors 060
|
|
113
|
-
*/
|
|
114
|
-
type ProviderTransientErrorCategory = 'rate_limit' | 'network' | 'upstream';
|
|
115
|
-
/**
|
|
116
|
-
* Base error class shared by the SDK and play runtime.
|
|
117
|
-
*
|
|
118
|
-
* The global brand preserves `instanceof DeeplineError` when a bundled play
|
|
119
|
-
* and the runtime load separate physical copies of this module.
|
|
120
|
-
*
|
|
121
|
-
* @sdkReference errors 010
|
|
122
|
-
*/
|
|
123
|
-
declare class DeeplineError extends Error {
|
|
124
|
-
/** HTTP status when the failure crossed an HTTP boundary. */
|
|
125
|
-
statusCode?: number;
|
|
126
|
-
/** Stable machine-readable error code when one exists. */
|
|
127
|
-
code?: string;
|
|
128
|
-
/** Local diagnostic context; not a portable error contract. */
|
|
129
|
-
details?: Record<string, unknown>;
|
|
130
|
-
/**
|
|
131
|
-
* Construct a Deepline error.
|
|
132
|
-
*
|
|
133
|
-
* SDK and runtime code construct these errors. Application and Play code
|
|
134
|
-
* normally catches the public subclasses instead.
|
|
135
|
-
*
|
|
136
|
-
* @param message Human-readable failure summary.
|
|
137
|
-
* @param statusCode HTTP status when one exists.
|
|
138
|
-
* @param code Stable machine-readable code when one exists.
|
|
139
|
-
* @param details Local diagnostic context; never a portable error contract.
|
|
140
|
-
*/
|
|
141
|
-
constructor(message: string, statusCode?: number, code?: string, details?: Record<string, unknown>);
|
|
142
|
-
static [Symbol.hasInstance](value: unknown): boolean;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* A failed `tools.execute` call with stable, allowlisted provenance.
|
|
146
|
-
*
|
|
147
|
-
* `retryable` means Deepline's delivery/idempotency contract says it is safe
|
|
148
|
-
* to repeat the same semantic call. It does not describe durable receipt
|
|
149
|
-
* repairability and does not make arbitrary side-effecting fallbacks safe.
|
|
150
|
-
*
|
|
151
|
-
* In a Play, catch `ProviderTransientError` to continue a read waterfall and
|
|
152
|
-
* let every other `ToolExecutionError` remain loud. In an SDK client, catch
|
|
153
|
-
* this base class when you need structured diagnostics for every tool failure.
|
|
154
|
-
*
|
|
155
|
-
* @sdkReference errors 070
|
|
156
|
-
*/
|
|
157
|
-
declare class ToolExecutionError extends DeeplineError {
|
|
158
|
-
/** Public tool id passed to `tools.execute`. */
|
|
159
|
-
readonly toolId: string;
|
|
160
|
-
/** Provider responsible for the operation, or `null` when unattributed. */
|
|
161
|
-
readonly provider: string | null;
|
|
162
|
-
/** Provider operation name, or `null` when unavailable. */
|
|
163
|
-
readonly operation: string | null;
|
|
164
|
-
/** Boundary responsible for the failure. */
|
|
165
|
-
readonly origin: ToolExecutionErrorOrigin;
|
|
166
|
-
/** Stable reason family for policy and diagnostics. */
|
|
167
|
-
readonly category: ToolExecutionErrorCategory;
|
|
168
|
-
/**
|
|
169
|
-
* Whether repeating the same semantic call is delivery-safe.
|
|
170
|
-
*
|
|
171
|
-
* This does not mean the error may be ignored. Waterfall fallthrough is
|
|
172
|
-
* represented by `ProviderTransientError`.
|
|
173
|
-
*/
|
|
174
|
-
readonly retryable: boolean;
|
|
175
|
-
/** Provider or Deepline request id, or `null` when unavailable. */
|
|
176
|
-
readonly requestId: string | null;
|
|
177
|
-
/** Suggested same-call retry delay in milliseconds, or `null`. */
|
|
178
|
-
readonly retryAfterMs: number | null;
|
|
179
|
-
/** Network failure kind, or `null` for non-network failures. */
|
|
180
|
-
readonly networkKind: ToolExecutionNetworkKind | null;
|
|
181
|
-
/** Network boundary that failed, or `null` for non-network failures. */
|
|
182
|
-
readonly networkScope: ToolExecutionNetworkScope | null;
|
|
183
|
-
/** Explicitly allowlisted diagnostics safe for SDK and Play callers. */
|
|
184
|
-
readonly publicDetails: ToolExecutionPublicDetails | null;
|
|
185
|
-
/**
|
|
186
|
-
* Construct a structured tool error.
|
|
187
|
-
*
|
|
188
|
-
* Deepline constructs this from the versioned `tool_error` payload.
|
|
189
|
-
* Application and Play code should catch it rather than create it.
|
|
190
|
-
*/
|
|
191
|
-
constructor(message: string, options: ToolExecutionErrorOptions);
|
|
192
|
-
static [Symbol.hasInstance](value: unknown): boolean;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* A provider-owned transient failure that is safe to handle as an empty
|
|
196
|
-
* waterfall leg. Validation, auth, billing, Deepline, and unknown failures
|
|
197
|
-
* never satisfy this type.
|
|
198
|
-
*
|
|
199
|
-
* `retryable` remains independent: it says whether the same semantic call may
|
|
200
|
-
* be repeated safely. Falling through to a different read provider depends on
|
|
201
|
-
* this class, not on `retryable`.
|
|
202
|
-
*
|
|
203
|
-
* @sdkReference errors 080
|
|
204
|
-
*/
|
|
205
|
-
declare class ProviderTransientError extends ToolExecutionError {
|
|
206
|
-
/** Provider attribution is guaranteed for this subtype. */
|
|
207
|
-
readonly origin: "provider";
|
|
208
|
-
/** Provider failure category that made this error eligible for fallthrough. */
|
|
209
|
-
readonly category: ProviderTransientErrorCategory;
|
|
210
|
-
/** Constructed by Deepline when a provider-owned transient failure arrives. */
|
|
211
|
-
constructor(message: string, options: Omit<ToolExecutionErrorOptions, 'origin' | 'category'> & {
|
|
212
|
-
category: ProviderTransientErrorCategory;
|
|
213
|
-
});
|
|
214
|
-
static [Symbol.hasInstance](value: unknown): boolean;
|
|
215
|
-
}
|
|
216
|
-
/** Why a provider cannot serve the current read request. */
|
|
217
|
-
type ProviderUnavailableReason = ProviderTransientErrorCategory | 'account_capacity' | 'credentials_missing';
|
|
218
|
-
/**
|
|
219
|
-
* A provider failure that permits a read waterfall to try its next provider.
|
|
220
|
-
* A missing provider connection is included because another provider may still
|
|
221
|
-
* serve the read. Invalid credentials, caller input, and Deepline billing
|
|
222
|
-
* failures remain loud.
|
|
223
|
-
*/
|
|
224
|
-
type ProviderUnavailableError = ProviderTransientError | (ToolExecutionError & {
|
|
225
|
-
readonly origin: 'provider';
|
|
226
|
-
readonly code: 'PROVIDER_ACCOUNT_CAPACITY';
|
|
227
|
-
}) | (ToolExecutionError & {
|
|
228
|
-
readonly origin: 'caller';
|
|
229
|
-
readonly code: 'INTEGRATION_CREDENTIALS_MISSING';
|
|
230
|
-
});
|
|
231
|
-
/**
|
|
232
|
-
* Return the provider-specific reason a read cannot run right now.
|
|
233
|
-
*
|
|
234
|
-
* `null` means this error must stay loud: it is caller input, an invalid
|
|
235
|
-
* customer credential, Deepline billing, or an internal failure. A missing
|
|
236
|
-
* provider connection is different: an explicit read waterfall may continue
|
|
237
|
-
* to a configured fallback and record the unavailable leg.
|
|
238
|
-
*/
|
|
239
|
-
declare function getProviderUnavailableReason(error: unknown): ProviderUnavailableReason | null;
|
|
240
|
-
/**
|
|
241
|
-
* Whether a provider cannot serve this read right now.
|
|
242
|
-
*
|
|
243
|
-
* Use this in an explicit `catch` to advance a read-only waterfall. For
|
|
244
|
-
* diagnostics, use `getProviderUnavailableReason(error)`.
|
|
245
|
-
*/
|
|
246
|
-
declare function isProviderUnavailable(error: unknown): error is ProviderUnavailableError;
|
|
247
|
-
/** @deprecated Use isProviderUnavailable. */
|
|
248
|
-
declare const isProviderWaterfallUnavailableError: typeof isProviderUnavailable;
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Public tool-response contracts shared by the API, SDK, Play bundler, and
|
|
252
|
-
* runtime. This is a versioned response transformation contract: a change to
|
|
253
|
-
* the persisted public tool-result shape must introduce a new value here and
|
|
254
|
-
* have newly built Play artifacts select it. Receipt-cache revisions are
|
|
255
|
-
* intentionally separate: ordinary response-contract changes do not refresh
|
|
256
|
-
* durable receipts unless the response transformation changed as well.
|
|
257
|
-
*/
|
|
258
|
-
declare const V2_TOOL_RESPONSE_CONTRACT: "v2-tool-response";
|
|
259
|
-
declare const RAW_V2_TOOL_RESPONSE_CONTRACT: "raw-v2";
|
|
260
|
-
type ToolResponseContract = typeof V2_TOOL_RESPONSE_CONTRACT | typeof RAW_V2_TOOL_RESPONSE_CONTRACT;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Previous durable cell value passed to object-column resolvers.
|
|
264
|
-
*
|
|
265
|
-
* The runtime supplies this when a row+column is being recomputed after a
|
|
266
|
-
* previous value existed. `value` has the same type that the column returns;
|
|
267
|
-
* freshness metadata lives beside it.
|
|
268
|
-
*
|
|
269
|
-
* @sdkReference runtime 120
|
|
270
|
-
*/
|
|
271
|
-
type PreviousCell<Value = unknown> = {
|
|
272
|
-
/** Previous completed value for this row+column. */
|
|
273
|
-
value: Value;
|
|
274
|
-
/** Millisecond timestamp when the previous value completed. */
|
|
275
|
-
completedAt?: number;
|
|
276
|
-
/** Millisecond timestamp when the previous value becomes stale; `null` means no expiry. */
|
|
277
|
-
staleAt?: number | null;
|
|
278
|
-
/** Resolved numeric TTL in seconds for the previous value, when present. */
|
|
279
|
-
staleAfterSeconds?: number;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
type PlaySandboxRuntimeLimits = {
|
|
283
|
-
timeoutSeconds: number;
|
|
284
|
-
memoryGiB: number;
|
|
285
|
-
cpu: number;
|
|
286
|
-
diskGiB: number;
|
|
287
|
-
};
|
|
288
|
-
type PlaySandboxSize = 'standard';
|
|
289
|
-
type PlaySandboxRuntimeDeclaration = {
|
|
290
|
-
timeout?: string;
|
|
291
|
-
size?: PlaySandboxSize;
|
|
292
|
-
};
|
|
293
|
-
|
|
294
5
|
type EmailStatusVerdict = 'send' | 'send_with_caution' | 'verify_next' | 'hold' | 'drop';
|
|
295
6
|
type EmailStatusValue = 'valid' | 'invalid' | 'catch_all' | 'valid_catch_all' | 'unknown' | 'do_not_mail' | 'spamtrap' | 'abuse' | 'disposable';
|
|
296
7
|
type EmailDeliverability = 'high' | 'medium' | 'low' | 'unknown';
|
|
@@ -517,199 +228,506 @@ type PlayDatasetBacking = {
|
|
|
517
228
|
playName: string;
|
|
518
229
|
tableNamespace: string;
|
|
519
230
|
};
|
|
520
|
-
} | {
|
|
521
|
-
storage: 'r2_file';
|
|
522
|
-
file: PlayExecutionFileRef;
|
|
231
|
+
} | {
|
|
232
|
+
storage: 'r2_file';
|
|
233
|
+
file: PlayExecutionFileRef;
|
|
234
|
+
};
|
|
235
|
+
type PlayDatasetWorkProgressSummary = {
|
|
236
|
+
total: number;
|
|
237
|
+
executed: number;
|
|
238
|
+
reused: number;
|
|
239
|
+
skipped: number;
|
|
240
|
+
pending: number;
|
|
241
|
+
failed: number;
|
|
242
|
+
degraded?: boolean;
|
|
243
|
+
duplicates?: {
|
|
244
|
+
exact?: number;
|
|
245
|
+
semantic?: number;
|
|
246
|
+
rejected?: number;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
type PlayDatasetInput<T> = ReadonlyArray<T> | Iterable<T> | AsyncIterable<T> | PlayDataset<T>;
|
|
250
|
+
type PlayDatasetRow<TInput> = TInput extends PlayDataset<infer Row> ? Row : TInput extends ReadonlyArray<infer Row> ? Row : TInput extends Iterable<infer Row> ? Row : TInput extends AsyncIterable<infer Row> ? Row : never;
|
|
251
|
+
type PlayDatasetTransformOptions = {
|
|
252
|
+
key?: string;
|
|
253
|
+
sourceLabel?: string | null;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Durable handle for rows produced by `ctx.csv(...)` or `ctx.dataset(...).run()`.
|
|
257
|
+
*
|
|
258
|
+
* A `PlayDataset` is not a normal in-memory array. It points at runtime-managed
|
|
259
|
+
* rows, usually backed by persisted sheet storage, and carries metadata such as
|
|
260
|
+
* dataset kind, dataset id, table namespace, count, and preview rows.
|
|
261
|
+
*
|
|
262
|
+
* Pass dataset handles directly into later `ctx.dataset(...)` stages by default so
|
|
263
|
+
* Deepline keeps row progress, retries, memory use, and table output under
|
|
264
|
+
* runtime control. Use `count()` and `peek()` for bounded inspection. Use
|
|
265
|
+
* `materialize(limit)` or async iteration only when the dataset is intentionally
|
|
266
|
+
* small and bounded. `PlayDataset` intentionally does not expose `.rows`,
|
|
267
|
+
* `.toArray()`, `.length`, numeric indexing, spread, or synchronous iteration;
|
|
268
|
+
* those hide the runtime cost of loading persisted rows into memory or make
|
|
269
|
+
* behavior depend on whether rows happen to be resident.
|
|
270
|
+
*
|
|
271
|
+
* @sdkReference runtime 190
|
|
272
|
+
*/
|
|
273
|
+
interface PlayDataset<T> extends AsyncIterable<T> {
|
|
274
|
+
readonly [PLAY_DATASET_BRAND]: true;
|
|
275
|
+
/** Dataset kind. */
|
|
276
|
+
readonly datasetKind: PlayDatasetKind;
|
|
277
|
+
/** Dataset id. */
|
|
278
|
+
readonly datasetId: string;
|
|
279
|
+
/** Backing store info. */
|
|
280
|
+
readonly backing?: PlayDatasetBacking;
|
|
281
|
+
/** Display label. */
|
|
282
|
+
readonly sourceLabel?: string | null;
|
|
283
|
+
/** Runtime table name. */
|
|
284
|
+
readonly tableNamespace?: string | null;
|
|
285
|
+
/** Row count. */
|
|
286
|
+
count(): Promise<number>;
|
|
287
|
+
/** Preview rows. */
|
|
288
|
+
peek(limit?: number): Promise<T[]>;
|
|
289
|
+
/** First row, loading it asynchronously when necessary. */
|
|
290
|
+
first(): Promise<T | undefined>;
|
|
291
|
+
/** Row at an array-style index, loading it asynchronously when necessary. */
|
|
292
|
+
at(index: number): Promise<T | undefined>;
|
|
293
|
+
map<U>(mapper: (row: T, index: number) => U | Promise<U>, options?: PlayDatasetTransformOptions): PlayDataset<U>;
|
|
294
|
+
filter(predicate: (row: T, index: number) => boolean | Promise<boolean>, options?: PlayDatasetTransformOptions): PlayDataset<T>;
|
|
295
|
+
slice(start?: number, end?: number, options?: PlayDatasetTransformOptions): PlayDataset<T>;
|
|
296
|
+
take(limit: number, options?: PlayDatasetTransformOptions): PlayDataset<T>;
|
|
297
|
+
/**
|
|
298
|
+
* Explicit escape hatch for bounded result sets.
|
|
299
|
+
* Large datasets should flow by handle through Neon-backed storage, not
|
|
300
|
+
* through worker memory as giant arrays.
|
|
301
|
+
*/
|
|
302
|
+
materialize(options?: number | PlayDatasetMaterializeOptions): Promise<T[]>;
|
|
303
|
+
toJSON(): {
|
|
304
|
+
kind: 'dataset';
|
|
305
|
+
datasetKind: PlayDatasetKind;
|
|
306
|
+
datasetId: string;
|
|
307
|
+
count: number;
|
|
308
|
+
backing?: PlayDatasetBacking;
|
|
309
|
+
sourceLabel?: string | null;
|
|
310
|
+
tableNamespace?: string | null;
|
|
311
|
+
columns?: string[];
|
|
312
|
+
_metadata?: {
|
|
313
|
+
workProgress?: PlayDatasetWorkProgressSummary;
|
|
314
|
+
};
|
|
315
|
+
preview: T[];
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
type PlayDatasetMaterializeScope = 'result' | 'full_persisted_dataset';
|
|
319
|
+
type PlayDatasetMaterializeOptions = {
|
|
320
|
+
/** Rows returned by this operation, or every current row in its persisted dataset. */
|
|
321
|
+
scope?: PlayDatasetMaterializeScope;
|
|
322
|
+
/** Maximum number of rows to load into memory. */
|
|
323
|
+
limit?: number;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Customer pricing reported by the execution API, never provider spend.
|
|
328
|
+
* `credits_charged` and `cost_usd` describe the price of the original call;
|
|
329
|
+
* they do not acknowledge durable handoff or wallet posting. Receipt replay
|
|
330
|
+
* preserves this observation and does not imply a new charge or fresher state.
|
|
331
|
+
*/
|
|
332
|
+
type ToolResultBilling = {
|
|
333
|
+
credits_charged?: number;
|
|
334
|
+
cost_usd?: number;
|
|
335
|
+
/** Missing on historical responses. Pending pricing has no final amount. */
|
|
336
|
+
pricing_status?: 'final' | 'pending';
|
|
337
|
+
settlement_status?: 'pending' | 'queued' | 'settled' | 'requires_recovery';
|
|
338
|
+
estimated_credits?: number;
|
|
339
|
+
estimated_cost_usd?: number;
|
|
340
|
+
/** Preserve additive public pricing details across runtime/deployment skew. */
|
|
341
|
+
[key: string]: unknown;
|
|
342
|
+
};
|
|
343
|
+
type ToolResultExecutionMetadata = {
|
|
344
|
+
idempotent: true;
|
|
345
|
+
cached: boolean;
|
|
346
|
+
source: 'live' | 'checkpoint' | 'cache' | 'in_flight' | 'source_run';
|
|
347
|
+
cacheKey?: string;
|
|
348
|
+
receiptRole?: 'owner' | 'follower';
|
|
349
|
+
receiptKey?: string;
|
|
350
|
+
attachedToReceiptKey?: string;
|
|
351
|
+
};
|
|
352
|
+
type ToolResultTargetMetadata = {
|
|
353
|
+
value: unknown;
|
|
354
|
+
path: string;
|
|
355
|
+
};
|
|
356
|
+
type ToolResultListMetadata = {
|
|
357
|
+
path: string;
|
|
358
|
+
count: number | null;
|
|
359
|
+
keys: Record<string, string>;
|
|
360
|
+
};
|
|
361
|
+
type ToolResultExtractorDescriptor = {
|
|
362
|
+
paths: readonly string[];
|
|
363
|
+
transforms?: readonly string[];
|
|
364
|
+
enum?: readonly string[];
|
|
365
|
+
overrides?: readonly ToolResultExtractorOverride[];
|
|
366
|
+
emailStatus?: EmailStatusExtractorConfig;
|
|
367
|
+
};
|
|
368
|
+
type ToolResultExtractorOverride = {
|
|
369
|
+
paths: readonly string[];
|
|
370
|
+
equals?: string | number | boolean | null;
|
|
371
|
+
value: string | number | boolean | null;
|
|
372
|
+
};
|
|
373
|
+
type ToolResultTargetAccessor<T = unknown> = ToolResultTargetMetadata & {
|
|
374
|
+
get(): T | null;
|
|
375
|
+
};
|
|
376
|
+
type ToolResultListAccessor<T = Record<string, unknown>, TKey extends string = string> = Omit<ToolResultListMetadata, 'keys'> & {
|
|
377
|
+
keys: Partial<Record<TKey, string>> & Record<string, string>;
|
|
378
|
+
get(): PlayDataset<T>;
|
|
379
|
+
};
|
|
380
|
+
type ToolResponseEnvelope<TData = unknown, TMeta = Record<string, unknown>> = {
|
|
381
|
+
raw: TData;
|
|
382
|
+
/** Complete parsed and scrubbed provider response, materialized from raw-v2. */
|
|
383
|
+
rawV2?: unknown;
|
|
384
|
+
/** Durable descriptor for deriving the legacy raw view from `rawV2`. */
|
|
385
|
+
view?: 'data' | 'rawV2';
|
|
386
|
+
meta?: TMeta;
|
|
387
|
+
};
|
|
388
|
+
type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> = {
|
|
389
|
+
status: string;
|
|
390
|
+
job_id?: string;
|
|
391
|
+
/** Deepline-owned execution/result metadata. */
|
|
392
|
+
meta?: Record<string, unknown>;
|
|
393
|
+
billing?: ToolResultBilling;
|
|
394
|
+
toolResponse: ToolResponseEnvelope<TResult, TMeta>;
|
|
395
|
+
extractedValues: Record<string, ToolResultTargetAccessor>;
|
|
396
|
+
extractedLists: Record<string, ToolResultListAccessor>;
|
|
397
|
+
/** Convenience alias for play code. Serialized output uses toolResponse. */
|
|
398
|
+
toolOutput: ToolResponseEnvelope<TResult, TMeta>;
|
|
399
|
+
_metadata: {
|
|
400
|
+
toolId: string;
|
|
401
|
+
execution: ToolResultExecutionMetadata;
|
|
402
|
+
targets: Record<string, {
|
|
403
|
+
value: unknown;
|
|
404
|
+
path: string;
|
|
405
|
+
}>;
|
|
406
|
+
extractors?: Record<string, ToolResultExtractorDescriptor>;
|
|
407
|
+
lists: Record<string, {
|
|
408
|
+
path: string;
|
|
409
|
+
count: number | null;
|
|
410
|
+
keys: Record<string, string>;
|
|
411
|
+
}>;
|
|
412
|
+
/** Original declarations preserve semantic accessor names across replay. */
|
|
413
|
+
listExtractorPaths?: readonly string[];
|
|
414
|
+
};
|
|
523
415
|
};
|
|
524
|
-
type
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
failed: number;
|
|
531
|
-
degraded?: boolean;
|
|
532
|
-
duplicates?: {
|
|
533
|
-
exact?: number;
|
|
534
|
-
semantic?: number;
|
|
535
|
-
rejected?: number;
|
|
416
|
+
type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
|
|
417
|
+
extractedValues: {
|
|
418
|
+
[K in keyof TExtracted]: ToolResultTargetAccessor<TExtracted[K]>;
|
|
419
|
+
};
|
|
420
|
+
extractedLists: {
|
|
421
|
+
[K in keyof TLists]: ToolResultListAccessor<TLists[K]>;
|
|
536
422
|
};
|
|
537
423
|
};
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
424
|
+
/**
|
|
425
|
+
* Canonical result returned by Deepline tool execution.
|
|
426
|
+
*
|
|
427
|
+
* The top-level object is Deepline-owned execution metadata and semantic
|
|
428
|
+
* extraction state. The canonical provider response lives under
|
|
429
|
+
* `toolResponse.rawV2`; `toolResponse.raw` remains the legacy compatibility
|
|
430
|
+
* projection. Response metadata lives under `toolResponse.meta`. Semantic single-value
|
|
431
|
+
* getters live under `extractedValues.<name>.get()`, and list getters live
|
|
432
|
+
* under `extractedLists.<name>.get()`.
|
|
433
|
+
*
|
|
434
|
+
* Use extractors first when a tool contract exposes them. Use list getters for
|
|
435
|
+
* row-shaped data. Drop to `toolResponse.raw` only for provider-specific scalar
|
|
436
|
+
* fields or bounded debugging context; persisted rows may clip declared lists to
|
|
437
|
+
* previews.
|
|
438
|
+
*
|
|
439
|
+
* @sdkReference runtime 200
|
|
440
|
+
*/
|
|
441
|
+
type ToolExecuteResult<TResult = unknown, TMeta = Record<string, unknown>, TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = ToolExecuteResultBase<TResult, TMeta> & ToolExecuteResultAccessors<TExtracted, TLists>;
|
|
442
|
+
|
|
443
|
+
declare const TOOL_EXECUTION_ERROR_SCHEMA_VERSION: 1;
|
|
444
|
+
declare const SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS: readonly [0, 1];
|
|
445
|
+
type ToolExecutionErrorSchemaVersion = (typeof SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS)[number];
|
|
446
|
+
/**
|
|
447
|
+
* The boundary responsible for a failed tool call.
|
|
448
|
+
*
|
|
449
|
+
* Use `provider` to distinguish a provider answer from caller input and
|
|
450
|
+
* Deepline infrastructure. `unknown` fails closed and must not trigger a
|
|
451
|
+
* waterfall fallback.
|
|
452
|
+
*
|
|
453
|
+
* @sdkReference errors 020
|
|
454
|
+
*/
|
|
455
|
+
type ToolExecutionErrorOrigin = 'caller' | 'provider' | 'deepline' | 'unknown';
|
|
456
|
+
/**
|
|
457
|
+
* The stable reason family for a failed tool call.
|
|
458
|
+
*
|
|
459
|
+
* Branch on this field only after narrowing to `ToolExecutionError`. Catch
|
|
460
|
+
* `ProviderTransientError` when the policy is simply “try the next read
|
|
461
|
+
* provider”; it is the safer and shorter waterfall contract.
|
|
462
|
+
*
|
|
463
|
+
* @sdkReference errors 030
|
|
464
|
+
*/
|
|
465
|
+
type ToolExecutionErrorCategory = 'validation' | 'authentication' | 'authorization' | 'rate_limit' | 'network' | 'upstream' | 'billing' | 'conflict' | 'internal' | 'unknown';
|
|
466
|
+
/**
|
|
467
|
+
* The transport failure observed when `category` is `network`.
|
|
468
|
+
*
|
|
469
|
+
* This is `null` for failures that are not network failures.
|
|
470
|
+
*
|
|
471
|
+
* @sdkReference errors 040
|
|
472
|
+
*/
|
|
473
|
+
type ToolExecutionNetworkKind = 'timeout' | 'dns' | 'connect' | 'reset' | 'unavailable' | 'unknown';
|
|
474
|
+
/**
|
|
475
|
+
* The request boundary on which a network failure occurred.
|
|
476
|
+
*
|
|
477
|
+
* `deepline_to_provider` is provider-side. Client and runtime scopes are
|
|
478
|
+
* Deepline transport failures and never qualify as provider fallthrough.
|
|
479
|
+
*
|
|
480
|
+
* @sdkReference errors 050
|
|
481
|
+
*/
|
|
482
|
+
type ToolExecutionNetworkScope = 'client_to_deepline' | 'runtime_to_deepline' | 'deepline_to_provider';
|
|
483
|
+
/**
|
|
484
|
+
* Bounded, primitive-only diagnostics explicitly approved for customers.
|
|
485
|
+
* Raw provider bodies, credentials, prompts, stacks, and causes never belong
|
|
486
|
+
* in this shared API/SDK/Play contract.
|
|
487
|
+
*
|
|
488
|
+
* @sdkReference errors 063
|
|
489
|
+
*/
|
|
490
|
+
type ToolExecutionPublicDetails = Readonly<Record<string, string | number | boolean | null>>;
|
|
491
|
+
/**
|
|
492
|
+
* Portable version-1 `tool_error` payload.
|
|
493
|
+
*
|
|
494
|
+
* This allowlisted shape crosses the API, runtime, and SDK boundaries.
|
|
495
|
+
* `message` remains on the Error object and is deliberately not a policy
|
|
496
|
+
* field.
|
|
497
|
+
*
|
|
498
|
+
* @sdkReference errors 064
|
|
499
|
+
*/
|
|
500
|
+
type ToolExecutionFailureV1 = {
|
|
501
|
+
/** Payload version. */
|
|
502
|
+
schemaVersion: typeof TOOL_EXECUTION_ERROR_SCHEMA_VERSION;
|
|
503
|
+
/** Public tool id passed to `tools.execute`. */
|
|
504
|
+
toolId: string;
|
|
505
|
+
/** Provider responsible for the operation, or `null`. */
|
|
506
|
+
provider: string | null;
|
|
507
|
+
/** Provider operation name, or `null`. */
|
|
508
|
+
operation: string | null;
|
|
509
|
+
/** Stable machine-readable failure code, or `null`. */
|
|
510
|
+
code: string | null;
|
|
511
|
+
/** Boundary responsible for the failure. */
|
|
512
|
+
origin: ToolExecutionErrorOrigin;
|
|
513
|
+
/** Stable reason family. */
|
|
514
|
+
category: ToolExecutionErrorCategory;
|
|
515
|
+
/** Whether repeating the same semantic call is delivery-safe. */
|
|
516
|
+
retryable: boolean;
|
|
517
|
+
/** HTTP status when one exists, or `null`. */
|
|
518
|
+
statusCode: number | null;
|
|
519
|
+
/** Provider or Deepline request id, or `null`. */
|
|
520
|
+
requestId: string | null;
|
|
521
|
+
/** Suggested same-call retry delay in milliseconds, or `null`. */
|
|
522
|
+
retryAfterMs: number | null;
|
|
523
|
+
/** Network failure kind, or `null`. */
|
|
524
|
+
networkKind: ToolExecutionNetworkKind | null;
|
|
525
|
+
/** Network boundary that failed, or `null`. */
|
|
526
|
+
networkScope: ToolExecutionNetworkScope | null;
|
|
527
|
+
/** Explicitly allowlisted customer diagnostics, when present. */
|
|
528
|
+
publicDetails?: ToolExecutionPublicDetails | null;
|
|
529
|
+
};
|
|
530
|
+
/**
|
|
531
|
+
* Constructor input for a structured tool failure.
|
|
532
|
+
*
|
|
533
|
+
* Deepline creates these values while decoding the versioned wire payload.
|
|
534
|
+
* Customer code normally reads `ToolExecutionError` fields instead of
|
|
535
|
+
* constructing an error.
|
|
536
|
+
*
|
|
537
|
+
* @sdkReference errors 065
|
|
538
|
+
*/
|
|
539
|
+
type ToolExecutionErrorOptions = Omit<ToolExecutionFailureV1, 'schemaVersion'> & {
|
|
540
|
+
/**
|
|
541
|
+
* Local diagnostic context inherited from DeeplineError. This is not part of
|
|
542
|
+
* the portable failure payload and is intentionally omitted by serialization.
|
|
543
|
+
*/
|
|
544
|
+
details?: Record<string, unknown>;
|
|
543
545
|
};
|
|
544
546
|
/**
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
|
|
547
|
+
* Provider-owned failure categories that may fall through to another read
|
|
548
|
+
* provider.
|
|
549
|
+
*
|
|
550
|
+
* @sdkReference errors 060
|
|
551
|
+
*/
|
|
552
|
+
type ProviderTransientErrorCategory = 'rate_limit' | 'network' | 'upstream';
|
|
553
|
+
/**
|
|
554
|
+
* Base error class shared by the SDK and play runtime.
|
|
555
|
+
*
|
|
556
|
+
* The global brand preserves `instanceof DeeplineError` when a bundled play
|
|
557
|
+
* and the runtime load separate physical copies of this module.
|
|
558
|
+
*
|
|
559
|
+
* @sdkReference errors 010
|
|
560
|
+
*/
|
|
561
|
+
declare class DeeplineError extends Error {
|
|
562
|
+
/** HTTP status when the failure crossed an HTTP boundary. */
|
|
563
|
+
statusCode?: number;
|
|
564
|
+
/** Stable machine-readable error code when one exists. */
|
|
565
|
+
code?: string;
|
|
566
|
+
/** Local diagnostic context; not a portable error contract. */
|
|
567
|
+
details?: Record<string, unknown>;
|
|
568
|
+
/**
|
|
569
|
+
* Construct a Deepline error.
|
|
570
|
+
*
|
|
571
|
+
* SDK and runtime code construct these errors. Application and Play code
|
|
572
|
+
* normally catches the public subclasses instead.
|
|
573
|
+
*
|
|
574
|
+
* @param message Human-readable failure summary.
|
|
575
|
+
* @param statusCode HTTP status when one exists.
|
|
576
|
+
* @param code Stable machine-readable code when one exists.
|
|
577
|
+
* @param details Local diagnostic context; never a portable error contract.
|
|
578
|
+
*/
|
|
579
|
+
constructor(message: string, statusCode?: number, code?: string, details?: Record<string, unknown>);
|
|
580
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* A failed `tools.execute` call with stable, allowlisted provenance.
|
|
584
|
+
*
|
|
585
|
+
* `retryable` means Deepline's delivery/idempotency contract says it is safe
|
|
586
|
+
* to repeat the same semantic call. It does not describe durable receipt
|
|
587
|
+
* repairability and does not make arbitrary side-effecting fallbacks safe.
|
|
588
|
+
*
|
|
589
|
+
* In a Play, catch `ProviderTransientError` to continue a read waterfall and
|
|
590
|
+
* let every other `ToolExecutionError` remain loud. In an SDK client, catch
|
|
591
|
+
* this base class when you need structured diagnostics for every tool failure.
|
|
592
|
+
*
|
|
593
|
+
* @sdkReference errors 070
|
|
594
|
+
*/
|
|
595
|
+
declare class ToolExecutionError extends DeeplineError {
|
|
596
|
+
/** Public tool id passed to `tools.execute`. */
|
|
597
|
+
readonly toolId: string;
|
|
598
|
+
/** Provider responsible for the operation, or `null` when unattributed. */
|
|
599
|
+
readonly provider: string | null;
|
|
600
|
+
/** Provider operation name, or `null` when unavailable. */
|
|
601
|
+
readonly operation: string | null;
|
|
602
|
+
/** Boundary responsible for the failure. */
|
|
603
|
+
readonly origin: ToolExecutionErrorOrigin;
|
|
604
|
+
/** Stable reason family for policy and diagnostics. */
|
|
605
|
+
readonly category: ToolExecutionErrorCategory;
|
|
606
|
+
/**
|
|
607
|
+
* Whether repeating the same semantic call is delivery-safe.
|
|
608
|
+
*
|
|
609
|
+
* This does not mean the error may be ignored. Waterfall fallthrough is
|
|
610
|
+
* represented by `ProviderTransientError`.
|
|
611
|
+
*/
|
|
612
|
+
readonly retryable: boolean;
|
|
613
|
+
/** Provider or Deepline request id, or `null` when unavailable. */
|
|
614
|
+
readonly requestId: string | null;
|
|
615
|
+
/** Suggested same-call retry delay in milliseconds, or `null`. */
|
|
616
|
+
readonly retryAfterMs: number | null;
|
|
617
|
+
/** Network failure kind, or `null` for non-network failures. */
|
|
618
|
+
readonly networkKind: ToolExecutionNetworkKind | null;
|
|
619
|
+
/** Network boundary that failed, or `null` for non-network failures. */
|
|
620
|
+
readonly networkScope: ToolExecutionNetworkScope | null;
|
|
621
|
+
/** Explicitly allowlisted diagnostics safe for SDK and Play callers. */
|
|
622
|
+
readonly publicDetails: ToolExecutionPublicDetails | null;
|
|
623
|
+
/**
|
|
624
|
+
* Construct a structured tool error.
|
|
625
|
+
*
|
|
626
|
+
* Deepline constructs this from the versioned `tool_error` payload.
|
|
627
|
+
* Application and Play code should catch it rather than create it.
|
|
628
|
+
*/
|
|
629
|
+
constructor(message: string, options: ToolExecutionErrorOptions);
|
|
630
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* A provider-owned transient failure that is safe to handle as an empty
|
|
634
|
+
* waterfall leg. Validation, auth, billing, Deepline, and unknown failures
|
|
635
|
+
* never satisfy this type.
|
|
550
636
|
*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
* `materialize(limit)` or async iteration only when the dataset is intentionally
|
|
555
|
-
* small and bounded. `PlayDataset` intentionally does not expose `.rows`,
|
|
556
|
-
* `.toArray()`, `.length`, numeric indexing, spread, or synchronous iteration;
|
|
557
|
-
* those hide the runtime cost of loading persisted rows into memory or make
|
|
558
|
-
* behavior depend on whether rows happen to be resident.
|
|
637
|
+
* `retryable` remains independent: it says whether the same semantic call may
|
|
638
|
+
* be repeated safely. Falling through to a different read provider depends on
|
|
639
|
+
* this class, not on `retryable`.
|
|
559
640
|
*
|
|
560
|
-
* @sdkReference
|
|
641
|
+
* @sdkReference errors 080
|
|
561
642
|
*/
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
/** Runtime table name. */
|
|
573
|
-
readonly tableNamespace?: string | null;
|
|
574
|
-
/** Row count. */
|
|
575
|
-
count(): Promise<number>;
|
|
576
|
-
/** Preview rows. */
|
|
577
|
-
peek(limit?: number): Promise<T[]>;
|
|
578
|
-
/** First row, loading it asynchronously when necessary. */
|
|
579
|
-
first(): Promise<T | undefined>;
|
|
580
|
-
/** Row at an array-style index, loading it asynchronously when necessary. */
|
|
581
|
-
at(index: number): Promise<T | undefined>;
|
|
582
|
-
map<U>(mapper: (row: T, index: number) => U | Promise<U>, options?: PlayDatasetTransformOptions): PlayDataset<U>;
|
|
583
|
-
filter(predicate: (row: T, index: number) => boolean | Promise<boolean>, options?: PlayDatasetTransformOptions): PlayDataset<T>;
|
|
584
|
-
slice(start?: number, end?: number, options?: PlayDatasetTransformOptions): PlayDataset<T>;
|
|
585
|
-
take(limit: number, options?: PlayDatasetTransformOptions): PlayDataset<T>;
|
|
586
|
-
/**
|
|
587
|
-
* Explicit escape hatch for bounded result sets.
|
|
588
|
-
* Large datasets should flow by handle through Neon-backed storage, not
|
|
589
|
-
* through worker memory as giant arrays.
|
|
590
|
-
*/
|
|
591
|
-
materialize(options?: number | PlayDatasetMaterializeOptions): Promise<T[]>;
|
|
592
|
-
toJSON(): {
|
|
593
|
-
kind: 'dataset';
|
|
594
|
-
datasetKind: PlayDatasetKind;
|
|
595
|
-
datasetId: string;
|
|
596
|
-
count: number;
|
|
597
|
-
backing?: PlayDatasetBacking;
|
|
598
|
-
sourceLabel?: string | null;
|
|
599
|
-
tableNamespace?: string | null;
|
|
600
|
-
columns?: string[];
|
|
601
|
-
_metadata?: {
|
|
602
|
-
workProgress?: PlayDatasetWorkProgressSummary;
|
|
603
|
-
};
|
|
604
|
-
preview: T[];
|
|
605
|
-
};
|
|
643
|
+
declare class ProviderTransientError extends ToolExecutionError {
|
|
644
|
+
/** Provider attribution is guaranteed for this subtype. */
|
|
645
|
+
readonly origin: "provider";
|
|
646
|
+
/** Provider failure category that made this error eligible for fallthrough. */
|
|
647
|
+
readonly category: ProviderTransientErrorCategory;
|
|
648
|
+
/** Constructed by Deepline when a provider-owned transient failure arrives. */
|
|
649
|
+
constructor(message: string, options: Omit<ToolExecutionErrorOptions, 'origin' | 'category'> & {
|
|
650
|
+
category: ProviderTransientErrorCategory;
|
|
651
|
+
});
|
|
652
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
606
653
|
}
|
|
607
|
-
|
|
608
|
-
type
|
|
609
|
-
/** Rows returned by this operation, or every current row in its persisted dataset. */
|
|
610
|
-
scope?: PlayDatasetMaterializeScope;
|
|
611
|
-
/** Maximum number of rows to load into memory. */
|
|
612
|
-
limit?: number;
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
type ToolResultExecutionMetadata = {
|
|
616
|
-
idempotent: true;
|
|
617
|
-
cached: boolean;
|
|
618
|
-
source: 'live' | 'checkpoint' | 'cache' | 'in_flight' | 'source_run';
|
|
619
|
-
cacheKey?: string;
|
|
620
|
-
receiptRole?: 'owner' | 'follower';
|
|
621
|
-
receiptKey?: string;
|
|
622
|
-
attachedToReceiptKey?: string;
|
|
623
|
-
};
|
|
624
|
-
type ToolResultTargetMetadata = {
|
|
625
|
-
value: unknown;
|
|
626
|
-
path: string;
|
|
627
|
-
};
|
|
628
|
-
type ToolResultListMetadata = {
|
|
629
|
-
path: string;
|
|
630
|
-
count: number | null;
|
|
631
|
-
keys: Record<string, string>;
|
|
632
|
-
};
|
|
633
|
-
type ToolResultExtractorDescriptor = {
|
|
634
|
-
paths: readonly string[];
|
|
635
|
-
transforms?: readonly string[];
|
|
636
|
-
enum?: readonly string[];
|
|
637
|
-
overrides?: readonly ToolResultExtractorOverride[];
|
|
638
|
-
emailStatus?: EmailStatusExtractorConfig;
|
|
639
|
-
};
|
|
640
|
-
type ToolResultExtractorOverride = {
|
|
641
|
-
paths: readonly string[];
|
|
642
|
-
equals?: string | number | boolean | null;
|
|
643
|
-
value: string | number | boolean | null;
|
|
644
|
-
};
|
|
645
|
-
type ToolResultTargetAccessor<T = unknown> = ToolResultTargetMetadata & {
|
|
646
|
-
get(): T | null;
|
|
647
|
-
};
|
|
648
|
-
type ToolResultListAccessor<T = Record<string, unknown>, TKey extends string = string> = Omit<ToolResultListMetadata, 'keys'> & {
|
|
649
|
-
keys: Partial<Record<TKey, string>> & Record<string, string>;
|
|
650
|
-
get(): PlayDataset<T>;
|
|
651
|
-
};
|
|
652
|
-
type ToolResponseEnvelope<TData = unknown, TMeta = Record<string, unknown>> = {
|
|
653
|
-
raw: TData;
|
|
654
|
-
/** Complete parsed and scrubbed provider response, materialized from raw-v2. */
|
|
655
|
-
rawV2?: unknown;
|
|
656
|
-
/** Durable descriptor for deriving the legacy raw view from `rawV2`. */
|
|
657
|
-
view?: 'data' | 'rawV2';
|
|
658
|
-
meta?: TMeta;
|
|
659
|
-
};
|
|
660
|
-
type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> = {
|
|
661
|
-
status: string;
|
|
662
|
-
job_id?: string;
|
|
663
|
-
/** Deepline-owned execution/result metadata. */
|
|
664
|
-
meta?: Record<string, unknown>;
|
|
665
|
-
toolResponse: ToolResponseEnvelope<TResult, TMeta>;
|
|
666
|
-
extractedValues: Record<string, ToolResultTargetAccessor>;
|
|
667
|
-
extractedLists: Record<string, ToolResultListAccessor>;
|
|
668
|
-
/** Convenience alias for play code. Serialized output uses toolResponse. */
|
|
669
|
-
toolOutput: ToolResponseEnvelope<TResult, TMeta>;
|
|
670
|
-
_metadata: {
|
|
671
|
-
toolId: string;
|
|
672
|
-
execution: ToolResultExecutionMetadata;
|
|
673
|
-
targets: Record<string, {
|
|
674
|
-
value: unknown;
|
|
675
|
-
path: string;
|
|
676
|
-
}>;
|
|
677
|
-
extractors?: Record<string, ToolResultExtractorDescriptor>;
|
|
678
|
-
lists: Record<string, {
|
|
679
|
-
path: string;
|
|
680
|
-
count: number | null;
|
|
681
|
-
keys: Record<string, string>;
|
|
682
|
-
}>;
|
|
683
|
-
/** Original declarations preserve semantic accessor names across replay. */
|
|
684
|
-
listExtractorPaths?: readonly string[];
|
|
685
|
-
};
|
|
686
|
-
};
|
|
687
|
-
type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
|
|
688
|
-
extractedValues: {
|
|
689
|
-
[K in keyof TExtracted]: ToolResultTargetAccessor<TExtracted[K]>;
|
|
690
|
-
};
|
|
691
|
-
extractedLists: {
|
|
692
|
-
[K in keyof TLists]: ToolResultListAccessor<TLists[K]>;
|
|
693
|
-
};
|
|
694
|
-
};
|
|
654
|
+
/** Why a provider cannot serve the current read request. */
|
|
655
|
+
type ProviderUnavailableReason = ProviderTransientErrorCategory | 'account_capacity' | 'credentials_missing';
|
|
695
656
|
/**
|
|
696
|
-
*
|
|
657
|
+
* A provider failure that permits a read waterfall to try its next provider.
|
|
658
|
+
* A missing provider connection is included because another provider may still
|
|
659
|
+
* serve the read. Invalid credentials, caller input, and Deepline billing
|
|
660
|
+
* failures remain loud.
|
|
661
|
+
*/
|
|
662
|
+
type ProviderUnavailableError = ProviderTransientError | (ToolExecutionError & {
|
|
663
|
+
readonly origin: 'provider';
|
|
664
|
+
readonly code: 'PROVIDER_ACCOUNT_CAPACITY';
|
|
665
|
+
}) | (ToolExecutionError & {
|
|
666
|
+
readonly origin: 'caller';
|
|
667
|
+
readonly code: 'INTEGRATION_CREDENTIALS_MISSING';
|
|
668
|
+
});
|
|
669
|
+
/**
|
|
670
|
+
* Return the provider-specific reason a read cannot run right now.
|
|
697
671
|
*
|
|
698
|
-
*
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
|
|
703
|
-
|
|
672
|
+
* `null` means this error must stay loud: it is caller input, an invalid
|
|
673
|
+
* customer credential, Deepline billing, or an internal failure. A missing
|
|
674
|
+
* provider connection is different: an explicit read waterfall may continue
|
|
675
|
+
* to a configured fallback and record the unavailable leg.
|
|
676
|
+
*/
|
|
677
|
+
declare function getProviderUnavailableReason(error: unknown): ProviderUnavailableReason | null;
|
|
678
|
+
/**
|
|
679
|
+
* Whether a provider cannot serve this read right now.
|
|
704
680
|
*
|
|
705
|
-
* Use
|
|
706
|
-
*
|
|
707
|
-
|
|
708
|
-
|
|
681
|
+
* Use this in an explicit `catch` to advance a read-only waterfall. For
|
|
682
|
+
* diagnostics, use `getProviderUnavailableReason(error)`.
|
|
683
|
+
*/
|
|
684
|
+
declare function isProviderUnavailable(error: unknown): error is ProviderUnavailableError;
|
|
685
|
+
/** @deprecated Use isProviderUnavailable. */
|
|
686
|
+
declare const isProviderWaterfallUnavailableError: typeof isProviderUnavailable;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Public tool-response contracts shared by the API, SDK, Play bundler, and
|
|
690
|
+
* runtime. This is a versioned response transformation contract: a change to
|
|
691
|
+
* the persisted public tool-result shape must introduce a new value here and
|
|
692
|
+
* have newly built Play artifacts select it. Receipt-cache revisions are
|
|
693
|
+
* intentionally separate: ordinary response-contract changes do not refresh
|
|
694
|
+
* durable receipts unless the response transformation changed as well.
|
|
695
|
+
*/
|
|
696
|
+
declare const V2_TOOL_RESPONSE_CONTRACT: "v2-tool-response";
|
|
697
|
+
declare const RAW_V2_TOOL_RESPONSE_CONTRACT: "raw-v2";
|
|
698
|
+
type ToolResponseContract = typeof V2_TOOL_RESPONSE_CONTRACT | typeof RAW_V2_TOOL_RESPONSE_CONTRACT;
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Previous durable cell value passed to object-column resolvers.
|
|
709
702
|
*
|
|
710
|
-
*
|
|
703
|
+
* The runtime supplies this when a row+column is being recomputed after a
|
|
704
|
+
* previous value existed. `value` has the same type that the column returns;
|
|
705
|
+
* freshness metadata lives beside it.
|
|
706
|
+
*
|
|
707
|
+
* @sdkReference runtime 120
|
|
711
708
|
*/
|
|
712
|
-
type
|
|
709
|
+
type PreviousCell<Value = unknown> = {
|
|
710
|
+
/** Previous completed value for this row+column. */
|
|
711
|
+
value: Value;
|
|
712
|
+
/** Millisecond timestamp when the previous value completed. */
|
|
713
|
+
completedAt?: number;
|
|
714
|
+
/** Millisecond timestamp when the previous value becomes stale; `null` means no expiry. */
|
|
715
|
+
staleAt?: number | null;
|
|
716
|
+
/** Resolved numeric TTL in seconds for the previous value, when present. */
|
|
717
|
+
staleAfterSeconds?: number;
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
type PlaySandboxRuntimeLimits = {
|
|
721
|
+
timeoutSeconds: number;
|
|
722
|
+
memoryGiB: number;
|
|
723
|
+
cpu: number;
|
|
724
|
+
diskGiB: number;
|
|
725
|
+
};
|
|
726
|
+
type PlaySandboxSize = 'standard';
|
|
727
|
+
type PlaySandboxRuntimeDeclaration = {
|
|
728
|
+
timeout?: string;
|
|
729
|
+
size?: PlaySandboxSize;
|
|
730
|
+
};
|
|
713
731
|
|
|
714
732
|
declare const SUPPORTED_PLAY_AUTHORING_CONTRACT_EDITIONS: readonly [1, 2, 3, 4, 5, 6, 7];
|
|
715
733
|
type PlayAuthoringContractEdition = (typeof SUPPORTED_PLAY_AUTHORING_CONTRACT_EDITIONS)[number];
|
|
@@ -3155,4 +3173,4 @@ type PlayCompilerManifest = {
|
|
|
3155
3173
|
authoringContract?: AdmittedPlayAuthoringContract;
|
|
3156
3174
|
};
|
|
3157
3175
|
|
|
3158
|
-
export { type
|
|
3176
|
+
export { type DeeplineExtractorTarget as $, type AsyncPlayRunRef as A, type PlayAuthoringCallExecution as B, type PlayAuthoringCallOptions as C, type PlayAuthoringFetchResponse as D, type PlayAuthoringInputContract as E, type PlayRunId as F, type PlayAuthoringStepProgramStep as G, type PlayAuthoringRuntimeStepOptions as H, type PlaySqlListenerDeclaration as I, type PlaySqlListenerEvent as J, type PlaySqlListenerOperation as K, type PlaySqlQuery as L, type PlayAuthoringStepOptions as M, type PlayAuthoringStepProgram as N, type PlayAuthoringStepProgramResolver as O, type PlayArtifactKind as P, type PlayAuthoringStepResolver as Q, type PlayToolExecutionRequest as R, type PlayAuthoringStepProgramOptions as S, type ToolResultBilling as T, DeeplineError as U, ToolExecutionError as V, type ToolExecutionErrorOptions as W, CtxFetchHttpError as X, DEEPLINE_EXTRACTOR_TARGETS as Y, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS as Z, type DeeplineEmailStatusGetterValue as _, type PlayBundleArtifact as a, type DeeplineGetterValue as a0, type DeeplineGetterValueMap as a1, JOB_CHANGE_STATUS_VALUES as a2, type JobChangeStatus as a3, PHONE_STATUS_VALUES as a4, type PhoneStatus as a5, type PlayDataset as a6, type PlayDatasetInput as a7, type PreviousCell as a8, ProviderTransientError as a9, type ProviderTransientErrorCategory as aa, type ProviderUnavailableError as ab, type ProviderUnavailableReason as ac, type ToolExecutionErrorCategory as ad, type ToolExecutionErrorOrigin as ae, type ToolExecutionFailureV1 as af, type ToolExecutionNetworkKind as ag, type ToolExecutionNetworkScope as ah, type ToolExecutionPublicDetails as ai, getProviderUnavailableReason as aj, isDeeplineExtractorTarget as ak, isProviderUnavailable as al, isProviderWaterfallUnavailableError as am, type PlaySandboxRuntimeDeclaration as b, type PlayCompilerManifest as c, PLAY_ARTIFACT_KINDS as d, type PlayArtifactCompatibility as e, type PlayImportPolicy as f, type PlayPackageImport as g, type PlayRuntimeFeature as h, type PlayAuthoringColumnMap as i, type PlayAuthoringColumnResolver as j, type PlayAuthoringRuntimeContext as k, type PlayAuthoringConditionalStepResolver as l, type PlayAuthoringCsvInput as m, type PlayAuthoringCsvOptions as n, type PlayAuthoringDatasetBuilder as o, type PlayAuthoringDatasetColumnDefinition as p, type PlayAuthoringDatasetColumnRunInput as q, type ToolExecuteResult as r, type PlayAuthoringReferenceLike as s, type PlayReturnObject as t, type PlayAuthoringDefineConfig as u, type PlayAuthoringDefinedPlay as v, type PlayAuthoringFetchOptions as w, type PlayAuthoringFileInput as x, type PlayAuthoringAsyncCallOptions as y, type PlayAuthoringBindings as z };
|