deepline 0.1.302 → 0.1.303
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/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 +56 -5
- package/dist/cli/index.mjs +56 -5
- 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
package/dist/cli/index.mjs
CHANGED
|
@@ -207,33 +207,68 @@ function applyBrand(value, brand) {
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
var DeeplineError = class _DeeplineError extends Error {
|
|
210
|
+
/** HTTP status when the failure crossed an HTTP boundary. */
|
|
211
|
+
statusCode;
|
|
212
|
+
/** Stable machine-readable error code when one exists. */
|
|
213
|
+
code;
|
|
214
|
+
/** Local diagnostic context; not a portable error contract. */
|
|
215
|
+
details;
|
|
216
|
+
/**
|
|
217
|
+
* Construct a Deepline error.
|
|
218
|
+
*
|
|
219
|
+
* SDK and runtime code construct these errors. Application and Play code
|
|
220
|
+
* normally catches the public subclasses instead.
|
|
221
|
+
*
|
|
222
|
+
* @param message Human-readable failure summary.
|
|
223
|
+
* @param statusCode HTTP status when one exists.
|
|
224
|
+
* @param code Stable machine-readable code when one exists.
|
|
225
|
+
* @param details Local diagnostic context; never a portable error contract.
|
|
226
|
+
*/
|
|
210
227
|
constructor(message, statusCode, code, details) {
|
|
211
228
|
super(message);
|
|
229
|
+
this.name = "DeeplineError";
|
|
212
230
|
this.statusCode = statusCode;
|
|
213
231
|
this.code = code;
|
|
214
232
|
this.details = details;
|
|
215
|
-
this.name = "DeeplineError";
|
|
216
233
|
applyBrand(this, DEEPLINE_ERROR_BRAND);
|
|
217
234
|
}
|
|
218
|
-
statusCode;
|
|
219
|
-
code;
|
|
220
|
-
details;
|
|
221
235
|
static [Symbol.hasInstance](value) {
|
|
222
236
|
if (this !== _DeeplineError) return nativeInstanceOf(this, value);
|
|
223
237
|
return hasBrand(value, DEEPLINE_ERROR_BRAND);
|
|
224
238
|
}
|
|
225
239
|
};
|
|
226
240
|
var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
|
|
241
|
+
/** Public tool id passed to `tools.execute`. */
|
|
227
242
|
toolId;
|
|
243
|
+
/** Provider responsible for the operation, or `null` when unattributed. */
|
|
228
244
|
provider;
|
|
245
|
+
/** Provider operation name, or `null` when unavailable. */
|
|
229
246
|
operation;
|
|
247
|
+
/** Boundary responsible for the failure. */
|
|
230
248
|
origin;
|
|
249
|
+
/** Stable reason family for policy and diagnostics. */
|
|
231
250
|
category;
|
|
251
|
+
/**
|
|
252
|
+
* Whether repeating the same semantic call is delivery-safe.
|
|
253
|
+
*
|
|
254
|
+
* This does not mean the error may be ignored. Waterfall fallthrough is
|
|
255
|
+
* represented by `ProviderTransientError`.
|
|
256
|
+
*/
|
|
232
257
|
retryable;
|
|
258
|
+
/** Provider or Deepline request id, or `null` when unavailable. */
|
|
233
259
|
requestId;
|
|
260
|
+
/** Suggested same-call retry delay in milliseconds, or `null`. */
|
|
234
261
|
retryAfterMs;
|
|
262
|
+
/** Network failure kind, or `null` for non-network failures. */
|
|
235
263
|
networkKind;
|
|
264
|
+
/** Network boundary that failed, or `null` for non-network failures. */
|
|
236
265
|
networkScope;
|
|
266
|
+
/**
|
|
267
|
+
* Construct a structured tool error.
|
|
268
|
+
*
|
|
269
|
+
* Deepline constructs this from the versioned `tool_error` payload.
|
|
270
|
+
* Application and Play code should catch it rather than create it.
|
|
271
|
+
*/
|
|
237
272
|
constructor(message, options) {
|
|
238
273
|
super(
|
|
239
274
|
message,
|
|
@@ -269,7 +304,9 @@ function isProviderTransientFailure(input2) {
|
|
|
269
304
|
return input2.origin === "provider" && (input2.category === "rate_limit" || input2.category === "network" || input2.category === "upstream");
|
|
270
305
|
}
|
|
271
306
|
var ProviderTransientError = class _ProviderTransientError extends ToolExecutionError {
|
|
307
|
+
/** Provider attribution is guaranteed for this subtype. */
|
|
272
308
|
origin = "provider";
|
|
309
|
+
/** Constructed by Deepline when a provider-owned transient failure arrives. */
|
|
273
310
|
constructor(message, options) {
|
|
274
311
|
super(message, {
|
|
275
312
|
...options,
|
|
@@ -423,6 +460,7 @@ function deserializeToolExecutionFailure(message, value, acceptedSchemaVersion)
|
|
|
423
460
|
|
|
424
461
|
// src/errors.ts
|
|
425
462
|
var AuthError = class extends DeeplineError {
|
|
463
|
+
/** Constructed by the SDK when Deepline rejects the caller's credentials. */
|
|
426
464
|
constructor(message = "Authentication failed. Check your DEEPLINE_API_KEY.") {
|
|
427
465
|
super(message, 401, "AUTH_ERROR");
|
|
428
466
|
this.name = "AuthError";
|
|
@@ -431,6 +469,7 @@ var AuthError = class extends DeeplineError {
|
|
|
431
469
|
var RateLimitError = class extends DeeplineError {
|
|
432
470
|
/** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
|
|
433
471
|
retryAfterMs;
|
|
472
|
+
/** Constructed by the SDK after exhausting HTTP-level rate-limit retries. */
|
|
434
473
|
constructor(retryAfterMs = 5e3, message) {
|
|
435
474
|
super(
|
|
436
475
|
message ?? `Rate limited. Retry after ${retryAfterMs}ms.`,
|
|
@@ -442,16 +481,27 @@ var RateLimitError = class extends DeeplineError {
|
|
|
442
481
|
}
|
|
443
482
|
};
|
|
444
483
|
var ToolRateLimitError = class extends RateLimitError {
|
|
484
|
+
/** Public tool id passed to `tools.execute`. */
|
|
445
485
|
toolId;
|
|
486
|
+
/** Provider responsible for the operation, or `null`. */
|
|
446
487
|
provider;
|
|
488
|
+
/** Provider operation name, or `null`. */
|
|
447
489
|
operation;
|
|
490
|
+
/** Stable machine-readable failure code when one exists. */
|
|
448
491
|
code;
|
|
492
|
+
/** Boundary responsible for the failure. */
|
|
449
493
|
origin;
|
|
494
|
+
/** Stable reason family for policy and diagnostics. */
|
|
450
495
|
category;
|
|
496
|
+
/** Whether repeating the same semantic call is delivery-safe. */
|
|
451
497
|
retryable;
|
|
498
|
+
/** Provider or Deepline request id, or `null`. */
|
|
452
499
|
requestId;
|
|
500
|
+
/** Network failure kind, or `null` for non-network failures. */
|
|
453
501
|
networkKind;
|
|
502
|
+
/** Network boundary that failed, or `null` for non-network failures. */
|
|
454
503
|
networkScope;
|
|
504
|
+
/** Constructed by the SDK after a structured tool HTTP 429. */
|
|
455
505
|
constructor(message, options) {
|
|
456
506
|
super(options.retryAfterMs ?? 5e3, message);
|
|
457
507
|
this.name = "ToolRateLimitError";
|
|
@@ -474,6 +524,7 @@ var ToolRateLimitError = class extends RateLimitError {
|
|
|
474
524
|
}
|
|
475
525
|
};
|
|
476
526
|
var ConfigError = class extends DeeplineError {
|
|
527
|
+
/** Construct a local SDK configuration failure. */
|
|
477
528
|
constructor(message) {
|
|
478
529
|
super(message, void 0, "CONFIG_ERROR");
|
|
479
530
|
this.name = "ConfigError";
|
|
@@ -971,7 +1022,7 @@ var SDK_RELEASE = {
|
|
|
971
1022
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
972
1023
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
973
1024
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
974
|
-
version: "0.1.
|
|
1025
|
+
version: "0.1.303",
|
|
975
1026
|
contracts: {
|
|
976
1027
|
api: {
|
|
977
1028
|
name: "sdk-http-api",
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as PlayCompilerManifest, D as DeeplineError, c as ToolExecutionError, d as ToolExecutionErrorOptions, T as ToolExecutionErrorSchemaVersion } from './tool-execution-error-
|
|
2
|
-
export { e as ProviderTransientError } from './tool-execution-error-
|
|
1
|
+
import { a as PlayCompilerManifest, D as DeeplineError, c as ToolExecutionError, d as ToolExecutionErrorOptions, T as ToolExecutionErrorSchemaVersion } from './tool-execution-error-YDz7UMl-.mjs';
|
|
2
|
+
export { e as ProviderTransientError, f as ProviderTransientErrorCategory, g as ToolExecutionErrorCategory, h as ToolExecutionErrorOrigin, i as ToolExecutionFailureV1, j as ToolExecutionNetworkKind, k as ToolExecutionNetworkScope } from './tool-execution-error-YDz7UMl-.mjs';
|
|
3
3
|
|
|
4
4
|
type PlayRuntimeSelection = {
|
|
5
5
|
environment: 'preview';
|
|
@@ -3168,28 +3168,6 @@ declare const SDK_VERSION: string;
|
|
|
3168
3168
|
/** @deprecated Transitional wire id for pre-major-header SDKs only. */
|
|
3169
3169
|
declare const SDK_API_CONTRACT: string;
|
|
3170
3170
|
|
|
3171
|
-
/**
|
|
3172
|
-
* Base error class for all Deepline SDK errors.
|
|
3173
|
-
*
|
|
3174
|
-
* Every error thrown by the SDK extends this class, so you can catch all
|
|
3175
|
-
* Deepline-specific errors with a single `catch (e) { if (e instanceof DeeplineError) }`.
|
|
3176
|
-
*
|
|
3177
|
-
* @example
|
|
3178
|
-
* ```typescript
|
|
3179
|
-
* import { DeeplineClient, DeeplineError, AuthError } from 'deepline';
|
|
3180
|
-
*
|
|
3181
|
-
* const client = new DeeplineClient();
|
|
3182
|
-
* try {
|
|
3183
|
-
* await client.executeTool('dropleads_search_people', { query: 'cto' });
|
|
3184
|
-
* } catch (err) {
|
|
3185
|
-
* if (err instanceof AuthError) {
|
|
3186
|
-
* console.error('Bad API key — run: deepline auth register');
|
|
3187
|
-
* } else if (err instanceof DeeplineError) {
|
|
3188
|
-
* console.error(`API error ${err.statusCode}: ${err.message}`);
|
|
3189
|
-
* }
|
|
3190
|
-
* }
|
|
3191
|
-
* ```
|
|
3192
|
-
*/
|
|
3193
3171
|
/**
|
|
3194
3172
|
* Thrown when the API rejects the request due to an invalid or missing API key.
|
|
3195
3173
|
*
|
|
@@ -3211,8 +3189,11 @@ declare const SDK_API_CONTRACT: string;
|
|
|
3211
3189
|
* }
|
|
3212
3190
|
* }
|
|
3213
3191
|
* ```
|
|
3192
|
+
*
|
|
3193
|
+
* @sdkReference errors 090
|
|
3214
3194
|
*/
|
|
3215
3195
|
declare class AuthError extends DeeplineError {
|
|
3196
|
+
/** Constructed by the SDK when Deepline rejects the caller's credentials. */
|
|
3216
3197
|
constructor(message?: string);
|
|
3217
3198
|
}
|
|
3218
3199
|
/**
|
|
@@ -3237,10 +3218,13 @@ declare class AuthError extends DeeplineError {
|
|
|
3237
3218
|
* }
|
|
3238
3219
|
* }
|
|
3239
3220
|
* ```
|
|
3221
|
+
*
|
|
3222
|
+
* @sdkReference errors 100
|
|
3240
3223
|
*/
|
|
3241
3224
|
declare class RateLimitError extends DeeplineError {
|
|
3242
3225
|
/** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
|
|
3243
3226
|
retryAfterMs: number;
|
|
3227
|
+
/** Constructed by the SDK after exhausting HTTP-level rate-limit retries. */
|
|
3244
3228
|
constructor(retryAfterMs?: number, message?: string);
|
|
3245
3229
|
}
|
|
3246
3230
|
/**
|
|
@@ -3248,18 +3232,37 @@ declare class RateLimitError extends DeeplineError {
|
|
|
3248
3232
|
* structured ToolExecutionError ontology. JavaScript has one prototype chain,
|
|
3249
3233
|
* so this class extends RateLimitError and carries ToolExecutionError's stable
|
|
3250
3234
|
* cross-bundle brand.
|
|
3235
|
+
*
|
|
3236
|
+
* This class appears in external SDK calls after HTTP 429 retries are
|
|
3237
|
+
* exhausted. It also satisfies `instanceof ToolExecutionError` and, for a
|
|
3238
|
+
* provider-owned rate limit, `instanceof ProviderTransientError`. Authored
|
|
3239
|
+
* Plays should use `ProviderTransientError`; they do not need this
|
|
3240
|
+
* compatibility class.
|
|
3241
|
+
*
|
|
3242
|
+
* @sdkReference errors 110
|
|
3251
3243
|
*/
|
|
3252
3244
|
declare class ToolRateLimitError extends RateLimitError {
|
|
3245
|
+
/** Public tool id passed to `tools.execute`. */
|
|
3253
3246
|
readonly toolId: string;
|
|
3247
|
+
/** Provider responsible for the operation, or `null`. */
|
|
3254
3248
|
readonly provider: string | null;
|
|
3249
|
+
/** Provider operation name, or `null`. */
|
|
3255
3250
|
readonly operation: string | null;
|
|
3251
|
+
/** Stable machine-readable failure code when one exists. */
|
|
3256
3252
|
readonly code: string | undefined;
|
|
3253
|
+
/** Boundary responsible for the failure. */
|
|
3257
3254
|
readonly origin: ToolExecutionError['origin'];
|
|
3255
|
+
/** Stable reason family for policy and diagnostics. */
|
|
3258
3256
|
readonly category: ToolExecutionError['category'];
|
|
3257
|
+
/** Whether repeating the same semantic call is delivery-safe. */
|
|
3259
3258
|
readonly retryable: boolean;
|
|
3259
|
+
/** Provider or Deepline request id, or `null`. */
|
|
3260
3260
|
readonly requestId: string | null;
|
|
3261
|
+
/** Network failure kind, or `null` for non-network failures. */
|
|
3261
3262
|
readonly networkKind: ToolExecutionError['networkKind'];
|
|
3263
|
+
/** Network boundary that failed, or `null` for non-network failures. */
|
|
3262
3264
|
readonly networkScope: ToolExecutionError['networkScope'];
|
|
3265
|
+
/** Constructed by the SDK after a structured tool HTTP 429. */
|
|
3263
3266
|
constructor(message: string, options: ToolExecutionErrorOptions);
|
|
3264
3267
|
}
|
|
3265
3268
|
/**
|
|
@@ -3280,8 +3283,11 @@ declare class ToolRateLimitError extends RateLimitError {
|
|
|
3280
3283
|
* }
|
|
3281
3284
|
* }
|
|
3282
3285
|
* ```
|
|
3286
|
+
*
|
|
3287
|
+
* @sdkReference errors 120
|
|
3283
3288
|
*/
|
|
3284
3289
|
declare class ConfigError extends DeeplineError {
|
|
3290
|
+
/** Construct a local SDK configuration failure. */
|
|
3285
3291
|
constructor(message: string);
|
|
3286
3292
|
}
|
|
3287
3293
|
|
|
@@ -3672,6 +3678,8 @@ type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> =
|
|
|
3672
3678
|
count: number | null;
|
|
3673
3679
|
keys: Record<string, string>;
|
|
3674
3680
|
}>;
|
|
3681
|
+
/** Original declarations preserve semantic accessor names across replay. */
|
|
3682
|
+
listExtractorPaths?: readonly string[];
|
|
3675
3683
|
};
|
|
3676
3684
|
};
|
|
3677
3685
|
type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as PlayCompilerManifest, D as DeeplineError, c as ToolExecutionError, d as ToolExecutionErrorOptions, T as ToolExecutionErrorSchemaVersion } from './tool-execution-error-
|
|
2
|
-
export { e as ProviderTransientError } from './tool-execution-error-
|
|
1
|
+
import { a as PlayCompilerManifest, D as DeeplineError, c as ToolExecutionError, d as ToolExecutionErrorOptions, T as ToolExecutionErrorSchemaVersion } from './tool-execution-error-YDz7UMl-.js';
|
|
2
|
+
export { e as ProviderTransientError, f as ProviderTransientErrorCategory, g as ToolExecutionErrorCategory, h as ToolExecutionErrorOrigin, i as ToolExecutionFailureV1, j as ToolExecutionNetworkKind, k as ToolExecutionNetworkScope } from './tool-execution-error-YDz7UMl-.js';
|
|
3
3
|
|
|
4
4
|
type PlayRuntimeSelection = {
|
|
5
5
|
environment: 'preview';
|
|
@@ -3168,28 +3168,6 @@ declare const SDK_VERSION: string;
|
|
|
3168
3168
|
/** @deprecated Transitional wire id for pre-major-header SDKs only. */
|
|
3169
3169
|
declare const SDK_API_CONTRACT: string;
|
|
3170
3170
|
|
|
3171
|
-
/**
|
|
3172
|
-
* Base error class for all Deepline SDK errors.
|
|
3173
|
-
*
|
|
3174
|
-
* Every error thrown by the SDK extends this class, so you can catch all
|
|
3175
|
-
* Deepline-specific errors with a single `catch (e) { if (e instanceof DeeplineError) }`.
|
|
3176
|
-
*
|
|
3177
|
-
* @example
|
|
3178
|
-
* ```typescript
|
|
3179
|
-
* import { DeeplineClient, DeeplineError, AuthError } from 'deepline';
|
|
3180
|
-
*
|
|
3181
|
-
* const client = new DeeplineClient();
|
|
3182
|
-
* try {
|
|
3183
|
-
* await client.executeTool('dropleads_search_people', { query: 'cto' });
|
|
3184
|
-
* } catch (err) {
|
|
3185
|
-
* if (err instanceof AuthError) {
|
|
3186
|
-
* console.error('Bad API key — run: deepline auth register');
|
|
3187
|
-
* } else if (err instanceof DeeplineError) {
|
|
3188
|
-
* console.error(`API error ${err.statusCode}: ${err.message}`);
|
|
3189
|
-
* }
|
|
3190
|
-
* }
|
|
3191
|
-
* ```
|
|
3192
|
-
*/
|
|
3193
3171
|
/**
|
|
3194
3172
|
* Thrown when the API rejects the request due to an invalid or missing API key.
|
|
3195
3173
|
*
|
|
@@ -3211,8 +3189,11 @@ declare const SDK_API_CONTRACT: string;
|
|
|
3211
3189
|
* }
|
|
3212
3190
|
* }
|
|
3213
3191
|
* ```
|
|
3192
|
+
*
|
|
3193
|
+
* @sdkReference errors 090
|
|
3214
3194
|
*/
|
|
3215
3195
|
declare class AuthError extends DeeplineError {
|
|
3196
|
+
/** Constructed by the SDK when Deepline rejects the caller's credentials. */
|
|
3216
3197
|
constructor(message?: string);
|
|
3217
3198
|
}
|
|
3218
3199
|
/**
|
|
@@ -3237,10 +3218,13 @@ declare class AuthError extends DeeplineError {
|
|
|
3237
3218
|
* }
|
|
3238
3219
|
* }
|
|
3239
3220
|
* ```
|
|
3221
|
+
*
|
|
3222
|
+
* @sdkReference errors 100
|
|
3240
3223
|
*/
|
|
3241
3224
|
declare class RateLimitError extends DeeplineError {
|
|
3242
3225
|
/** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
|
|
3243
3226
|
retryAfterMs: number;
|
|
3227
|
+
/** Constructed by the SDK after exhausting HTTP-level rate-limit retries. */
|
|
3244
3228
|
constructor(retryAfterMs?: number, message?: string);
|
|
3245
3229
|
}
|
|
3246
3230
|
/**
|
|
@@ -3248,18 +3232,37 @@ declare class RateLimitError extends DeeplineError {
|
|
|
3248
3232
|
* structured ToolExecutionError ontology. JavaScript has one prototype chain,
|
|
3249
3233
|
* so this class extends RateLimitError and carries ToolExecutionError's stable
|
|
3250
3234
|
* cross-bundle brand.
|
|
3235
|
+
*
|
|
3236
|
+
* This class appears in external SDK calls after HTTP 429 retries are
|
|
3237
|
+
* exhausted. It also satisfies `instanceof ToolExecutionError` and, for a
|
|
3238
|
+
* provider-owned rate limit, `instanceof ProviderTransientError`. Authored
|
|
3239
|
+
* Plays should use `ProviderTransientError`; they do not need this
|
|
3240
|
+
* compatibility class.
|
|
3241
|
+
*
|
|
3242
|
+
* @sdkReference errors 110
|
|
3251
3243
|
*/
|
|
3252
3244
|
declare class ToolRateLimitError extends RateLimitError {
|
|
3245
|
+
/** Public tool id passed to `tools.execute`. */
|
|
3253
3246
|
readonly toolId: string;
|
|
3247
|
+
/** Provider responsible for the operation, or `null`. */
|
|
3254
3248
|
readonly provider: string | null;
|
|
3249
|
+
/** Provider operation name, or `null`. */
|
|
3255
3250
|
readonly operation: string | null;
|
|
3251
|
+
/** Stable machine-readable failure code when one exists. */
|
|
3256
3252
|
readonly code: string | undefined;
|
|
3253
|
+
/** Boundary responsible for the failure. */
|
|
3257
3254
|
readonly origin: ToolExecutionError['origin'];
|
|
3255
|
+
/** Stable reason family for policy and diagnostics. */
|
|
3258
3256
|
readonly category: ToolExecutionError['category'];
|
|
3257
|
+
/** Whether repeating the same semantic call is delivery-safe. */
|
|
3259
3258
|
readonly retryable: boolean;
|
|
3259
|
+
/** Provider or Deepline request id, or `null`. */
|
|
3260
3260
|
readonly requestId: string | null;
|
|
3261
|
+
/** Network failure kind, or `null` for non-network failures. */
|
|
3261
3262
|
readonly networkKind: ToolExecutionError['networkKind'];
|
|
3263
|
+
/** Network boundary that failed, or `null` for non-network failures. */
|
|
3262
3264
|
readonly networkScope: ToolExecutionError['networkScope'];
|
|
3265
|
+
/** Constructed by the SDK after a structured tool HTTP 429. */
|
|
3263
3266
|
constructor(message: string, options: ToolExecutionErrorOptions);
|
|
3264
3267
|
}
|
|
3265
3268
|
/**
|
|
@@ -3280,8 +3283,11 @@ declare class ToolRateLimitError extends RateLimitError {
|
|
|
3280
3283
|
* }
|
|
3281
3284
|
* }
|
|
3282
3285
|
* ```
|
|
3286
|
+
*
|
|
3287
|
+
* @sdkReference errors 120
|
|
3283
3288
|
*/
|
|
3284
3289
|
declare class ConfigError extends DeeplineError {
|
|
3290
|
+
/** Construct a local SDK configuration failure. */
|
|
3285
3291
|
constructor(message: string);
|
|
3286
3292
|
}
|
|
3287
3293
|
|
|
@@ -3672,6 +3678,8 @@ type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> =
|
|
|
3672
3678
|
count: number | null;
|
|
3673
3679
|
keys: Record<string, string>;
|
|
3674
3680
|
}>;
|
|
3681
|
+
/** Original declarations preserve semantic accessor names across replay. */
|
|
3682
|
+
listExtractorPaths?: readonly string[];
|
|
3675
3683
|
};
|
|
3676
3684
|
};
|
|
3677
3685
|
type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
|
package/dist/index.js
CHANGED
|
@@ -116,33 +116,68 @@ function applyBrand(value, brand) {
|
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
var DeeplineError = class _DeeplineError extends Error {
|
|
119
|
+
/** HTTP status when the failure crossed an HTTP boundary. */
|
|
120
|
+
statusCode;
|
|
121
|
+
/** Stable machine-readable error code when one exists. */
|
|
122
|
+
code;
|
|
123
|
+
/** Local diagnostic context; not a portable error contract. */
|
|
124
|
+
details;
|
|
125
|
+
/**
|
|
126
|
+
* Construct a Deepline error.
|
|
127
|
+
*
|
|
128
|
+
* SDK and runtime code construct these errors. Application and Play code
|
|
129
|
+
* normally catches the public subclasses instead.
|
|
130
|
+
*
|
|
131
|
+
* @param message Human-readable failure summary.
|
|
132
|
+
* @param statusCode HTTP status when one exists.
|
|
133
|
+
* @param code Stable machine-readable code when one exists.
|
|
134
|
+
* @param details Local diagnostic context; never a portable error contract.
|
|
135
|
+
*/
|
|
119
136
|
constructor(message, statusCode, code, details) {
|
|
120
137
|
super(message);
|
|
138
|
+
this.name = "DeeplineError";
|
|
121
139
|
this.statusCode = statusCode;
|
|
122
140
|
this.code = code;
|
|
123
141
|
this.details = details;
|
|
124
|
-
this.name = "DeeplineError";
|
|
125
142
|
applyBrand(this, DEEPLINE_ERROR_BRAND);
|
|
126
143
|
}
|
|
127
|
-
statusCode;
|
|
128
|
-
code;
|
|
129
|
-
details;
|
|
130
144
|
static [Symbol.hasInstance](value) {
|
|
131
145
|
if (this !== _DeeplineError) return nativeInstanceOf(this, value);
|
|
132
146
|
return hasBrand(value, DEEPLINE_ERROR_BRAND);
|
|
133
147
|
}
|
|
134
148
|
};
|
|
135
149
|
var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
|
|
150
|
+
/** Public tool id passed to `tools.execute`. */
|
|
136
151
|
toolId;
|
|
152
|
+
/** Provider responsible for the operation, or `null` when unattributed. */
|
|
137
153
|
provider;
|
|
154
|
+
/** Provider operation name, or `null` when unavailable. */
|
|
138
155
|
operation;
|
|
156
|
+
/** Boundary responsible for the failure. */
|
|
139
157
|
origin;
|
|
158
|
+
/** Stable reason family for policy and diagnostics. */
|
|
140
159
|
category;
|
|
160
|
+
/**
|
|
161
|
+
* Whether repeating the same semantic call is delivery-safe.
|
|
162
|
+
*
|
|
163
|
+
* This does not mean the error may be ignored. Waterfall fallthrough is
|
|
164
|
+
* represented by `ProviderTransientError`.
|
|
165
|
+
*/
|
|
141
166
|
retryable;
|
|
167
|
+
/** Provider or Deepline request id, or `null` when unavailable. */
|
|
142
168
|
requestId;
|
|
169
|
+
/** Suggested same-call retry delay in milliseconds, or `null`. */
|
|
143
170
|
retryAfterMs;
|
|
171
|
+
/** Network failure kind, or `null` for non-network failures. */
|
|
144
172
|
networkKind;
|
|
173
|
+
/** Network boundary that failed, or `null` for non-network failures. */
|
|
145
174
|
networkScope;
|
|
175
|
+
/**
|
|
176
|
+
* Construct a structured tool error.
|
|
177
|
+
*
|
|
178
|
+
* Deepline constructs this from the versioned `tool_error` payload.
|
|
179
|
+
* Application and Play code should catch it rather than create it.
|
|
180
|
+
*/
|
|
146
181
|
constructor(message, options) {
|
|
147
182
|
super(
|
|
148
183
|
message,
|
|
@@ -178,7 +213,9 @@ function isProviderTransientFailure(input) {
|
|
|
178
213
|
return input.origin === "provider" && (input.category === "rate_limit" || input.category === "network" || input.category === "upstream");
|
|
179
214
|
}
|
|
180
215
|
var ProviderTransientError = class _ProviderTransientError extends ToolExecutionError {
|
|
216
|
+
/** Provider attribution is guaranteed for this subtype. */
|
|
181
217
|
origin = "provider";
|
|
218
|
+
/** Constructed by Deepline when a provider-owned transient failure arrives. */
|
|
182
219
|
constructor(message, options) {
|
|
183
220
|
super(message, {
|
|
184
221
|
...options,
|
|
@@ -332,6 +369,7 @@ function deserializeToolExecutionFailure(message, value, acceptedSchemaVersion)
|
|
|
332
369
|
|
|
333
370
|
// src/errors.ts
|
|
334
371
|
var AuthError = class extends DeeplineError {
|
|
372
|
+
/** Constructed by the SDK when Deepline rejects the caller's credentials. */
|
|
335
373
|
constructor(message = "Authentication failed. Check your DEEPLINE_API_KEY.") {
|
|
336
374
|
super(message, 401, "AUTH_ERROR");
|
|
337
375
|
this.name = "AuthError";
|
|
@@ -340,6 +378,7 @@ var AuthError = class extends DeeplineError {
|
|
|
340
378
|
var RateLimitError = class extends DeeplineError {
|
|
341
379
|
/** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
|
|
342
380
|
retryAfterMs;
|
|
381
|
+
/** Constructed by the SDK after exhausting HTTP-level rate-limit retries. */
|
|
343
382
|
constructor(retryAfterMs = 5e3, message) {
|
|
344
383
|
super(
|
|
345
384
|
message ?? `Rate limited. Retry after ${retryAfterMs}ms.`,
|
|
@@ -351,16 +390,27 @@ var RateLimitError = class extends DeeplineError {
|
|
|
351
390
|
}
|
|
352
391
|
};
|
|
353
392
|
var ToolRateLimitError = class extends RateLimitError {
|
|
393
|
+
/** Public tool id passed to `tools.execute`. */
|
|
354
394
|
toolId;
|
|
395
|
+
/** Provider responsible for the operation, or `null`. */
|
|
355
396
|
provider;
|
|
397
|
+
/** Provider operation name, or `null`. */
|
|
356
398
|
operation;
|
|
399
|
+
/** Stable machine-readable failure code when one exists. */
|
|
357
400
|
code;
|
|
401
|
+
/** Boundary responsible for the failure. */
|
|
358
402
|
origin;
|
|
403
|
+
/** Stable reason family for policy and diagnostics. */
|
|
359
404
|
category;
|
|
405
|
+
/** Whether repeating the same semantic call is delivery-safe. */
|
|
360
406
|
retryable;
|
|
407
|
+
/** Provider or Deepline request id, or `null`. */
|
|
361
408
|
requestId;
|
|
409
|
+
/** Network failure kind, or `null` for non-network failures. */
|
|
362
410
|
networkKind;
|
|
411
|
+
/** Network boundary that failed, or `null` for non-network failures. */
|
|
363
412
|
networkScope;
|
|
413
|
+
/** Constructed by the SDK after a structured tool HTTP 429. */
|
|
364
414
|
constructor(message, options) {
|
|
365
415
|
super(options.retryAfterMs ?? 5e3, message);
|
|
366
416
|
this.name = "ToolRateLimitError";
|
|
@@ -383,6 +433,7 @@ var ToolRateLimitError = class extends RateLimitError {
|
|
|
383
433
|
}
|
|
384
434
|
};
|
|
385
435
|
var ConfigError = class extends DeeplineError {
|
|
436
|
+
/** Construct a local SDK configuration failure. */
|
|
386
437
|
constructor(message) {
|
|
387
438
|
super(message, void 0, "CONFIG_ERROR");
|
|
388
439
|
this.name = "ConfigError";
|
|
@@ -709,7 +760,7 @@ var SDK_RELEASE = {
|
|
|
709
760
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
710
761
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
711
762
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
712
|
-
version: "0.1.
|
|
763
|
+
version: "0.1.303",
|
|
713
764
|
contracts: {
|
|
714
765
|
api: {
|
|
715
766
|
name: "sdk-http-api",
|
|
@@ -6154,6 +6205,11 @@ function normalizeTableNamespace(value) {
|
|
|
6154
6205
|
);
|
|
6155
6206
|
}
|
|
6156
6207
|
|
|
6208
|
+
// ../shared_libs/play-runtime/tool-result-paths.ts
|
|
6209
|
+
function listNameFromDeclaredPath(path) {
|
|
6210
|
+
return String(path || "").split(".").filter(Boolean).at(-1)?.replace(/[^A-Za-z0-9_$]/g, "") || null;
|
|
6211
|
+
}
|
|
6212
|
+
|
|
6157
6213
|
// ../shared_libs/play-runtime/tool-result.ts
|
|
6158
6214
|
var TARGET_FALLBACK_KEYS = {
|
|
6159
6215
|
email: [/^email$/i, /^address$/i, /email/i],
|
|
@@ -6494,38 +6550,33 @@ function coerceToEnum(value, descriptor) {
|
|
|
6494
6550
|
function resolveListRows(result, listExtractorPaths) {
|
|
6495
6551
|
const lists = {};
|
|
6496
6552
|
for (const rawPath of listExtractorPaths ?? []) {
|
|
6553
|
+
const listName = listNameFromDeclaredPath(rawPath);
|
|
6554
|
+
if (!listName) continue;
|
|
6497
6555
|
const path = normalizeResultPath(rawPath);
|
|
6498
6556
|
if (!path) continue;
|
|
6499
6557
|
const candidates = [...candidateResultPaths(rawPath)].filter(
|
|
6500
6558
|
(candidate, index, all) => candidate && all.indexOf(candidate) === index
|
|
6501
6559
|
);
|
|
6502
|
-
let
|
|
6503
|
-
let rows = null;
|
|
6560
|
+
let resolved = null;
|
|
6504
6561
|
let emptyMatch = null;
|
|
6505
6562
|
for (const candidate of candidates) {
|
|
6506
|
-
|
|
6507
|
-
if (!
|
|
6563
|
+
const candidateRows = normalizeRows(getAtPath(result, candidate));
|
|
6564
|
+
if (!candidateRows) {
|
|
6508
6565
|
continue;
|
|
6509
6566
|
}
|
|
6510
|
-
if (
|
|
6511
|
-
|
|
6567
|
+
if (candidateRows.length > 0) {
|
|
6568
|
+
resolved = { path: candidate, rows: candidateRows };
|
|
6512
6569
|
break;
|
|
6513
6570
|
}
|
|
6514
|
-
emptyMatch ??= { path: candidate, rows };
|
|
6515
|
-
}
|
|
6516
|
-
if (!rows && emptyMatch) {
|
|
6517
|
-
resolvedPath = emptyMatch.path;
|
|
6518
|
-
rows = emptyMatch.rows;
|
|
6571
|
+
emptyMatch ??= { path: candidate, rows: candidateRows };
|
|
6519
6572
|
}
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
const name = storedPath.split(".").filter(Boolean).at(-1)?.replace(/\[\d+\]$/, "");
|
|
6523
|
-
const listName = name || storedPath;
|
|
6573
|
+
resolved ??= emptyMatch;
|
|
6574
|
+
if (!resolved) continue;
|
|
6524
6575
|
const existing = lists[listName];
|
|
6525
|
-
if (existing?.rows.length && rows.length === 0) {
|
|
6576
|
+
if (existing?.rows.length && resolved.rows.length === 0) {
|
|
6526
6577
|
continue;
|
|
6527
6578
|
}
|
|
6528
|
-
lists[listName] =
|
|
6579
|
+
lists[listName] = resolved;
|
|
6529
6580
|
}
|
|
6530
6581
|
return lists;
|
|
6531
6582
|
}
|
|
@@ -6759,6 +6810,7 @@ function createToolExecuteResult(input) {
|
|
|
6759
6810
|
toolId: input.metadata.toolId,
|
|
6760
6811
|
execution: input.execution,
|
|
6761
6812
|
targets,
|
|
6813
|
+
listExtractorPaths: [...input.metadata.listExtractorPaths ?? []],
|
|
6762
6814
|
...input.metadata.extractors ? { extractors: input.metadata.extractors } : {},
|
|
6763
6815
|
lists
|
|
6764
6816
|
};
|
|
@@ -6800,6 +6852,19 @@ function attachToolResultListDataset(result, input) {
|
|
|
6800
6852
|
count: input.count,
|
|
6801
6853
|
keys: input.keys ?? existing?.keys ?? {}
|
|
6802
6854
|
};
|
|
6855
|
+
const declaredPaths = result._metadata.listExtractorPaths ?? [];
|
|
6856
|
+
const inputCandidates = new Set(candidateResultPaths(input.path));
|
|
6857
|
+
const equivalentDeclaration = declaredPaths.find(
|
|
6858
|
+
(path) => candidateResultPaths(path).some(
|
|
6859
|
+
(candidate) => inputCandidates.has(candidate)
|
|
6860
|
+
)
|
|
6861
|
+
);
|
|
6862
|
+
result._metadata.listExtractorPaths = equivalentDeclaration ? [...declaredPaths] : [
|
|
6863
|
+
...declaredPaths.filter(
|
|
6864
|
+
(path) => listNameFromDeclaredPath(path) !== input.name
|
|
6865
|
+
),
|
|
6866
|
+
input.path
|
|
6867
|
+
];
|
|
6803
6868
|
const accessor = {
|
|
6804
6869
|
path: input.path,
|
|
6805
6870
|
count: input.count,
|