deepline 0.3.68 → 0.3.70

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.
@@ -748,6 +748,8 @@ export type MonitorListEntry = {
748
748
  monitor_key?: string;
749
749
  status?: string;
750
750
  tool?: string;
751
+ /** Generic provider-authored event category for this deployed monitor. */
752
+ type?: string;
751
753
  name?: string;
752
754
  configured?: boolean;
753
755
  active?: boolean;
@@ -199,7 +199,7 @@ export const SDK_RELEASE = {
199
199
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
- version: '0.3.68',
202
+ version: '0.3.70',
203
203
  updateSummary:
204
204
  'Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.',
205
205
  packageCapabilities: {
@@ -915,6 +915,8 @@ export interface PlayRunListItem {
915
915
  startTime?: string | null;
916
916
  /** Unix epoch milliseconds when the run started, returned by normalized V2 run summaries. */
917
917
  startedAt?: number | string | null;
918
+ /** Unix epoch milliseconds when the run was created. */
919
+ createdAt?: number | string | null;
918
920
  /** ISO 8601 timestamp when the run finished. */
919
921
  closeTime?: string | null;
920
922
  /** Unix epoch milliseconds when the run finished, returned by normalized V2 run summaries. */
@@ -3662,6 +3662,27 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
3662
3662
  };
3663
3663
  }
3664
3664
 
3665
+ /**
3666
+ * A Deepline admission limit is decided before provider dispatch; the
3667
+ * execute endpoint also releases its billing reservation on that path.
3668
+ * Reclaim only this explicit, structured failure. A timeout, unreadable
3669
+ * body, provider error, or unknown receipt can follow billable provider
3670
+ * work and must remain behind its durable idempotency fence.
3671
+ */
3672
+ private canRetryWithoutProviderDispatch(
3673
+ receipt: RuntimeStepReceipt,
3674
+ ): boolean {
3675
+ const failure = receipt.errorPayload;
3676
+ return (
3677
+ receipt.status === 'failed' &&
3678
+ failure?.schemaVersion === 1 &&
3679
+ failure.origin === 'deepline' &&
3680
+ failure.category === 'rate_limit' &&
3681
+ failure.code === 'RATE_LIMIT' &&
3682
+ failure.retryable === true
3683
+ );
3684
+ }
3685
+
3665
3686
  /**
3666
3687
  * Dispatch a batched runtime-step-receipt request in bounded chunks and
3667
3688
  * concatenate the aligned result arrays back into one array positioned
@@ -11010,6 +11031,22 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
11010
11031
  );
11011
11032
  for (const [key, receipt] of claimed) claims.set(key, receipt);
11012
11033
  }
11034
+ const safeFailedKeys = receipts.flatMap((receipt) => {
11035
+ const claimed = claims.get(receipt.resultReceiptKey);
11036
+ return claimed && this.canRetryWithoutProviderDispatch(claimed)
11037
+ ? [receipt.resultReceiptKey]
11038
+ : [];
11039
+ });
11040
+ if (safeFailedKeys.length > 0) {
11041
+ const refreshed = await this.claimRuntimeStepReceipts(
11042
+ safeFailedKeys,
11043
+ this.currentReceiptOwnerRunId,
11044
+ false,
11045
+ false,
11046
+ true,
11047
+ );
11048
+ for (const [key, receipt] of refreshed) claims.set(key, receipt);
11049
+ }
11013
11050
  return await recordsFor(
11014
11051
  receipts.map((receipt) => receipt.resultReceiptKey),
11015
11052
  claims,
@@ -12238,6 +12275,23 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12238
12275
  for (const [receiptKey, claim] of failedRefreshClaims) {
12239
12276
  claims.set(receiptKey, claim);
12240
12277
  }
12278
+ const safeFailedReceiptKeys = [...claims]
12279
+ .filter(([, claim]) =>
12280
+ this.canRetryWithoutProviderDispatch(claim),
12281
+ )
12282
+ .map(([receiptKey]) => receiptKey);
12283
+ if (safeFailedReceiptKeys.length > 0) {
12284
+ const refreshed = await this.claimRuntimeStepReceipts(
12285
+ safeFailedReceiptKeys,
12286
+ this.currentReceiptOwnerRunId,
12287
+ false,
12288
+ false,
12289
+ true,
12290
+ );
12291
+ for (const [receiptKey, claim] of refreshed) {
12292
+ claims.set(receiptKey, claim);
12293
+ }
12294
+ }
12241
12295
  const claimedRequests: ToolCallRequest[] = [...localOnlyRequests];
12242
12296
  const durableRecoveredRequests: ToolCallRequest[] = [];
12243
12297
  const resolveRequestsFromReceipt = async (
@@ -13377,8 +13431,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
13377
13431
  );
13378
13432
  }
13379
13433
  const materialized = lifecycle.materialized!;
13380
- const selectedResponse =
13381
- lifecycle.finishResponse ?? lifecycle.pollResponse;
13434
+ const selectedResponse = lifecycle.finishResponse ?? lifecycle.pollResponse;
13382
13435
  return {
13383
13436
  ...selectedResponse,
13384
13437
  status: