deepline 0.1.302 → 0.1.304
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/errors.ts +40 -22
- package/dist/bundling-sources/sdk/src/index.ts +9 -1
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result-paths.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +33 -24
- package/dist/bundling-sources/shared_libs/tool-execution-error.ts +132 -3
- package/dist/cli/index.js +64 -13
- package/dist/cli/index.mjs +64 -13
- package/dist/index.d.mts +32 -24
- package/dist/index.d.ts +32 -24
- package/dist/index.js +87 -22
- package/dist/index.mjs +87 -22
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/{tool-execution-error-9mH4i-mJ.d.mts → tool-execution-error-YDz7UMl-.d.mts} +127 -5
- package/dist/{tool-execution-error-9mH4i-mJ.d.ts → tool-execution-error-YDz7UMl-.d.ts} +127 -5
- package/package.json +1 -1
|
@@ -240,25 +240,89 @@ type PlayCompilerManifest = {
|
|
|
240
240
|
declare const TOOL_EXECUTION_ERROR_SCHEMA_VERSION: 1;
|
|
241
241
|
declare const SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS: readonly [0, 1];
|
|
242
242
|
type ToolExecutionErrorSchemaVersion = (typeof SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS)[number];
|
|
243
|
+
/**
|
|
244
|
+
* The boundary responsible for a failed tool call.
|
|
245
|
+
*
|
|
246
|
+
* Use `provider` to distinguish a provider answer from caller input and
|
|
247
|
+
* Deepline infrastructure. `unknown` fails closed and must not trigger a
|
|
248
|
+
* waterfall fallback.
|
|
249
|
+
*
|
|
250
|
+
* @sdkReference errors 020
|
|
251
|
+
*/
|
|
243
252
|
type ToolExecutionErrorOrigin = 'caller' | 'provider' | 'deepline' | 'unknown';
|
|
253
|
+
/**
|
|
254
|
+
* The stable reason family for a failed tool call.
|
|
255
|
+
*
|
|
256
|
+
* Branch on this field only after narrowing to `ToolExecutionError`. Catch
|
|
257
|
+
* `ProviderTransientError` when the policy is simply “try the next read
|
|
258
|
+
* provider”; it is the safer and shorter waterfall contract.
|
|
259
|
+
*
|
|
260
|
+
* @sdkReference errors 030
|
|
261
|
+
*/
|
|
244
262
|
type ToolExecutionErrorCategory = 'validation' | 'authentication' | 'authorization' | 'rate_limit' | 'network' | 'upstream' | 'billing' | 'conflict' | 'internal' | 'unknown';
|
|
263
|
+
/**
|
|
264
|
+
* The transport failure observed when `category` is `network`.
|
|
265
|
+
*
|
|
266
|
+
* This is `null` for failures that are not network failures.
|
|
267
|
+
*
|
|
268
|
+
* @sdkReference errors 040
|
|
269
|
+
*/
|
|
245
270
|
type ToolExecutionNetworkKind = 'timeout' | 'dns' | 'connect' | 'reset' | 'unavailable' | 'unknown';
|
|
271
|
+
/**
|
|
272
|
+
* The request boundary on which a network failure occurred.
|
|
273
|
+
*
|
|
274
|
+
* `deepline_to_provider` is provider-side. Client and runtime scopes are
|
|
275
|
+
* Deepline transport failures and never qualify as provider fallthrough.
|
|
276
|
+
*
|
|
277
|
+
* @sdkReference errors 050
|
|
278
|
+
*/
|
|
246
279
|
type ToolExecutionNetworkScope = 'client_to_deepline' | 'runtime_to_deepline' | 'deepline_to_provider';
|
|
280
|
+
/**
|
|
281
|
+
* Portable version-1 `tool_error` payload.
|
|
282
|
+
*
|
|
283
|
+
* This allowlisted shape crosses the API, runtime, and SDK boundaries.
|
|
284
|
+
* `message` remains on the Error object and is deliberately not a policy
|
|
285
|
+
* field.
|
|
286
|
+
*
|
|
287
|
+
* @sdkReference errors 064
|
|
288
|
+
*/
|
|
247
289
|
type ToolExecutionFailureV1 = {
|
|
290
|
+
/** Payload version. */
|
|
248
291
|
schemaVersion: typeof TOOL_EXECUTION_ERROR_SCHEMA_VERSION;
|
|
292
|
+
/** Public tool id passed to `tools.execute`. */
|
|
249
293
|
toolId: string;
|
|
294
|
+
/** Provider responsible for the operation, or `null`. */
|
|
250
295
|
provider: string | null;
|
|
296
|
+
/** Provider operation name, or `null`. */
|
|
251
297
|
operation: string | null;
|
|
298
|
+
/** Stable machine-readable failure code, or `null`. */
|
|
252
299
|
code: string | null;
|
|
300
|
+
/** Boundary responsible for the failure. */
|
|
253
301
|
origin: ToolExecutionErrorOrigin;
|
|
302
|
+
/** Stable reason family. */
|
|
254
303
|
category: ToolExecutionErrorCategory;
|
|
304
|
+
/** Whether repeating the same semantic call is delivery-safe. */
|
|
255
305
|
retryable: boolean;
|
|
306
|
+
/** HTTP status when one exists, or `null`. */
|
|
256
307
|
statusCode: number | null;
|
|
308
|
+
/** Provider or Deepline request id, or `null`. */
|
|
257
309
|
requestId: string | null;
|
|
310
|
+
/** Suggested same-call retry delay in milliseconds, or `null`. */
|
|
258
311
|
retryAfterMs: number | null;
|
|
312
|
+
/** Network failure kind, or `null`. */
|
|
259
313
|
networkKind: ToolExecutionNetworkKind | null;
|
|
314
|
+
/** Network boundary that failed, or `null`. */
|
|
260
315
|
networkScope: ToolExecutionNetworkScope | null;
|
|
261
316
|
};
|
|
317
|
+
/**
|
|
318
|
+
* Constructor input for a structured tool failure.
|
|
319
|
+
*
|
|
320
|
+
* Deepline creates these values while decoding the versioned wire payload.
|
|
321
|
+
* Customer code normally reads `ToolExecutionError` fields instead of
|
|
322
|
+
* constructing an error.
|
|
323
|
+
*
|
|
324
|
+
* @sdkReference errors 065
|
|
325
|
+
*/
|
|
262
326
|
type ToolExecutionErrorOptions = Omit<ToolExecutionFailureV1, 'schemaVersion'> & {
|
|
263
327
|
/**
|
|
264
328
|
* Local diagnostic context inherited from DeeplineError. This is not part of
|
|
@@ -266,18 +330,40 @@ type ToolExecutionErrorOptions = Omit<ToolExecutionFailureV1, 'schemaVersion'> &
|
|
|
266
330
|
*/
|
|
267
331
|
details?: Record<string, unknown>;
|
|
268
332
|
};
|
|
333
|
+
/**
|
|
334
|
+
* Provider-owned failure categories that may fall through to another read
|
|
335
|
+
* provider.
|
|
336
|
+
*
|
|
337
|
+
* @sdkReference errors 060
|
|
338
|
+
*/
|
|
269
339
|
type ProviderTransientErrorCategory = 'rate_limit' | 'network' | 'upstream';
|
|
270
340
|
/**
|
|
271
341
|
* Base error class shared by the SDK and play runtime.
|
|
272
342
|
*
|
|
273
343
|
* The global brand preserves `instanceof DeeplineError` when a bundled play
|
|
274
344
|
* and the runtime load separate physical copies of this module.
|
|
345
|
+
*
|
|
346
|
+
* @sdkReference errors 010
|
|
275
347
|
*/
|
|
276
348
|
declare class DeeplineError extends Error {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
349
|
+
/** HTTP status when the failure crossed an HTTP boundary. */
|
|
350
|
+
statusCode?: number;
|
|
351
|
+
/** Stable machine-readable error code when one exists. */
|
|
352
|
+
code?: string;
|
|
353
|
+
/** Local diagnostic context; not a portable error contract. */
|
|
354
|
+
details?: Record<string, unknown>;
|
|
355
|
+
/**
|
|
356
|
+
* Construct a Deepline error.
|
|
357
|
+
*
|
|
358
|
+
* SDK and runtime code construct these errors. Application and Play code
|
|
359
|
+
* normally catches the public subclasses instead.
|
|
360
|
+
*
|
|
361
|
+
* @param message Human-readable failure summary.
|
|
362
|
+
* @param statusCode HTTP status when one exists.
|
|
363
|
+
* @param code Stable machine-readable code when one exists.
|
|
364
|
+
* @param details Local diagnostic context; never a portable error contract.
|
|
365
|
+
*/
|
|
366
|
+
constructor(message: string, statusCode?: number, code?: string, details?: Record<string, unknown>);
|
|
281
367
|
static [Symbol.hasInstance](value: unknown): boolean;
|
|
282
368
|
}
|
|
283
369
|
/**
|
|
@@ -286,18 +372,45 @@ declare class DeeplineError extends Error {
|
|
|
286
372
|
* `retryable` means Deepline's delivery/idempotency contract says it is safe
|
|
287
373
|
* to repeat the same semantic call. It does not describe durable receipt
|
|
288
374
|
* repairability and does not make arbitrary side-effecting fallbacks safe.
|
|
375
|
+
*
|
|
376
|
+
* In a Play, catch `ProviderTransientError` to continue a read waterfall and
|
|
377
|
+
* let every other `ToolExecutionError` remain loud. In an SDK client, catch
|
|
378
|
+
* this base class when you need structured diagnostics for every tool failure.
|
|
379
|
+
*
|
|
380
|
+
* @sdkReference errors 070
|
|
289
381
|
*/
|
|
290
382
|
declare class ToolExecutionError extends DeeplineError {
|
|
383
|
+
/** Public tool id passed to `tools.execute`. */
|
|
291
384
|
readonly toolId: string;
|
|
385
|
+
/** Provider responsible for the operation, or `null` when unattributed. */
|
|
292
386
|
readonly provider: string | null;
|
|
387
|
+
/** Provider operation name, or `null` when unavailable. */
|
|
293
388
|
readonly operation: string | null;
|
|
389
|
+
/** Boundary responsible for the failure. */
|
|
294
390
|
readonly origin: ToolExecutionErrorOrigin;
|
|
391
|
+
/** Stable reason family for policy and diagnostics. */
|
|
295
392
|
readonly category: ToolExecutionErrorCategory;
|
|
393
|
+
/**
|
|
394
|
+
* Whether repeating the same semantic call is delivery-safe.
|
|
395
|
+
*
|
|
396
|
+
* This does not mean the error may be ignored. Waterfall fallthrough is
|
|
397
|
+
* represented by `ProviderTransientError`.
|
|
398
|
+
*/
|
|
296
399
|
readonly retryable: boolean;
|
|
400
|
+
/** Provider or Deepline request id, or `null` when unavailable. */
|
|
297
401
|
readonly requestId: string | null;
|
|
402
|
+
/** Suggested same-call retry delay in milliseconds, or `null`. */
|
|
298
403
|
readonly retryAfterMs: number | null;
|
|
404
|
+
/** Network failure kind, or `null` for non-network failures. */
|
|
299
405
|
readonly networkKind: ToolExecutionNetworkKind | null;
|
|
406
|
+
/** Network boundary that failed, or `null` for non-network failures. */
|
|
300
407
|
readonly networkScope: ToolExecutionNetworkScope | null;
|
|
408
|
+
/**
|
|
409
|
+
* Construct a structured tool error.
|
|
410
|
+
*
|
|
411
|
+
* Deepline constructs this from the versioned `tool_error` payload.
|
|
412
|
+
* Application and Play code should catch it rather than create it.
|
|
413
|
+
*/
|
|
301
414
|
constructor(message: string, options: ToolExecutionErrorOptions);
|
|
302
415
|
static [Symbol.hasInstance](value: unknown): boolean;
|
|
303
416
|
}
|
|
@@ -305,14 +418,23 @@ declare class ToolExecutionError extends DeeplineError {
|
|
|
305
418
|
* A provider-owned transient failure that is safe to handle as an empty
|
|
306
419
|
* waterfall leg. Validation, auth, billing, Deepline, and unknown failures
|
|
307
420
|
* never satisfy this type.
|
|
421
|
+
*
|
|
422
|
+
* `retryable` remains independent: it says whether the same semantic call may
|
|
423
|
+
* be repeated safely. Falling through to a different read provider depends on
|
|
424
|
+
* this class, not on `retryable`.
|
|
425
|
+
*
|
|
426
|
+
* @sdkReference errors 080
|
|
308
427
|
*/
|
|
309
428
|
declare class ProviderTransientError extends ToolExecutionError {
|
|
429
|
+
/** Provider attribution is guaranteed for this subtype. */
|
|
310
430
|
readonly origin: "provider";
|
|
431
|
+
/** Provider failure category that made this error eligible for fallthrough. */
|
|
311
432
|
readonly category: ProviderTransientErrorCategory;
|
|
433
|
+
/** Constructed by Deepline when a provider-owned transient failure arrives. */
|
|
312
434
|
constructor(message: string, options: Omit<ToolExecutionErrorOptions, 'origin' | 'category'> & {
|
|
313
435
|
category: ProviderTransientErrorCategory;
|
|
314
436
|
});
|
|
315
437
|
static [Symbol.hasInstance](value: unknown): boolean;
|
|
316
438
|
}
|
|
317
439
|
|
|
318
|
-
export { DeeplineError as D, type PlayArtifactKind as P, type ToolExecutionErrorSchemaVersion as T, type PlayCompilerManifest as a, PLAY_ARTIFACT_KINDS as b, ToolExecutionError as c, type ToolExecutionErrorOptions as d, ProviderTransientError as e };
|
|
440
|
+
export { DeeplineError as D, type PlayArtifactKind as P, type ToolExecutionErrorSchemaVersion as T, type PlayCompilerManifest as a, PLAY_ARTIFACT_KINDS as b, ToolExecutionError as c, type ToolExecutionErrorOptions as d, ProviderTransientError as e, type ProviderTransientErrorCategory as f, type ToolExecutionErrorCategory as g, type ToolExecutionErrorOrigin as h, type ToolExecutionFailureV1 as i, type ToolExecutionNetworkKind as j, type ToolExecutionNetworkScope as k };
|