deepline 0.3.519 → 0.3.520

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +160 -2
  3. package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +22 -0
  4. package/dist/cli/{artifacts-YRKH7KNC.js → artifacts-4DSPSIU5.js} +18 -18
  5. package/dist/cli/{artifacts-ZZULJ6X5.mjs → artifacts-D6PU7SBC.mjs} +6 -6
  6. package/dist/cli/{auth-WU2BDO3T.mjs → auth-MXKNPUXW.mjs} +5 -5
  7. package/dist/cli/auth-TH4JV6BH.js +43 -0
  8. package/dist/cli/{billing-DG62VVXW.mjs → billing-SQ26NKGH.mjs} +6 -6
  9. package/dist/cli/{billing-MUMMBMQK.js → billing-WEYCNJIR.js} +79 -79
  10. package/dist/cli/{chunk-XUCAH3LN.js → chunk-2BJILUE3.js} +10 -10
  11. package/dist/cli/{chunk-UB2REJPL.mjs → chunk-2EDGA7OE.mjs} +2 -2
  12. package/dist/cli/{chunk-ZQ23WQP3.js → chunk-3YHS4BLB.js} +2 -2
  13. package/dist/cli/{chunk-ORNLTNBN.js → chunk-4VR5OTYP.js} +44 -44
  14. package/dist/cli/{chunk-F6XD4CRW.js → chunk-5ECMRQCL.js} +1 -1
  15. package/dist/cli/{chunk-N3LUYBOB.mjs → chunk-5TEXJM6F.mjs} +10 -10
  16. package/dist/cli/{chunk-NIJE62ZD.mjs → chunk-6GI7BYSL.mjs} +1 -1
  17. package/dist/cli/{chunk-NH22WUUG.mjs → chunk-6T2LB43P.mjs} +2 -2
  18. package/dist/cli/{chunk-IMIHYCJ5.mjs → chunk-6VY2SJ6B.mjs} +5 -5
  19. package/dist/cli/{chunk-4ECU5DI3.js → chunk-6XJA23MZ.js} +26 -26
  20. package/dist/cli/{chunk-P62S3ZMS.js → chunk-74MOIEDC.js} +11 -11
  21. package/dist/cli/{chunk-GO467AXG.js → chunk-7QAX5VBT.js} +41 -41
  22. package/dist/cli/{chunk-EMV6EHK2.js → chunk-7VJKHJY7.js} +9 -9
  23. package/dist/cli/{chunk-AL7FDMD6.mjs → chunk-A5VR463F.mjs} +1 -1
  24. package/dist/cli/{chunk-RQDD2VV3.js → chunk-AM7HMWNA.js} +5 -5
  25. package/dist/cli/{chunk-RHQKDHCX.mjs → chunk-ASGGZ6BI.mjs} +2 -2
  26. package/dist/cli/{chunk-S7R4O62I.js → chunk-AVW2LKRF.js} +6 -6
  27. package/dist/cli/{chunk-TT2XB433.js → chunk-BHAP6FIZ.js} +4 -4
  28. package/dist/cli/{chunk-52DFTRVC.js → chunk-D5VTWJ7K.js} +16 -16
  29. package/dist/cli/{chunk-YRU46P7H.mjs → chunk-DQQ6FDE6.mjs} +1 -1
  30. package/dist/cli/{chunk-C7ZD4LXZ.js → chunk-FWGTBR3W.js} +2 -2
  31. package/dist/cli/{chunk-G2QD575P.js → chunk-GVTHFDKN.js} +6 -6
  32. package/dist/cli/{chunk-PK6VYYEY.js → chunk-I4GBCKBL.js} +5 -5
  33. package/dist/cli/{chunk-XBS4RDKU.js → chunk-JO2MQ6XR.js} +96 -96
  34. package/dist/cli/{chunk-HKKC7J6K.mjs → chunk-KCISDDNK.mjs} +6 -6
  35. package/dist/cli/{chunk-3CUIIVGR.mjs → chunk-KKSMHTQO.mjs} +1 -1
  36. package/dist/cli/{chunk-E6YWCXII.js → chunk-KTAOVRXT.js} +16 -16
  37. package/dist/cli/{chunk-LKYLIZ5X.js → chunk-LUIPBI6P.js} +2 -2
  38. package/dist/cli/{chunk-25WXWSFS.js → chunk-LYIJ3YUP.js} +22 -22
  39. package/dist/cli/{chunk-J4X4RNSP.mjs → chunk-M6YHS5V7.mjs} +3 -3
  40. package/dist/cli/{chunk-CRE3OGHH.mjs → chunk-NLIO6QLP.mjs} +2 -2
  41. package/dist/cli/{chunk-FEJKDR67.mjs → chunk-NNUJQ5O2.mjs} +1 -1
  42. package/dist/cli/{chunk-A7W3CCU5.mjs → chunk-NPRSGUHB.mjs} +5 -5
  43. package/dist/cli/{chunk-MI5DKOBD.mjs → chunk-NWSKBWQM.mjs} +2 -2
  44. package/dist/cli/{chunk-I3ICKVYH.js → chunk-ORAWUIMN.js} +53 -53
  45. package/dist/cli/{chunk-CBMTBMIJ.mjs → chunk-QQGRQRCS.mjs} +1 -1
  46. package/dist/cli/{chunk-SBF4K3QF.mjs → chunk-QSWPDYOP.mjs} +4 -4
  47. package/dist/cli/{chunk-FJAGGBDR.mjs → chunk-SHB2BNI6.mjs} +23 -1
  48. package/dist/cli/{chunk-R3OAKFHJ.mjs → chunk-TQTQ3YYA.mjs} +5 -5
  49. package/dist/cli/{chunk-Y7D6L4M7.mjs → chunk-U5646OVV.mjs} +5 -5
  50. package/dist/cli/{chunk-BQYXIAJM.js → chunk-UA4MXESL.js} +3 -3
  51. package/dist/cli/{chunk-AXA5DFY5.mjs → chunk-V6BUWQBI.mjs} +1 -1
  52. package/dist/cli/{chunk-FTJ2D3XD.mjs → chunk-VSLU4JZV.mjs} +3 -3
  53. package/dist/cli/{chunk-O655PVT4.js → chunk-VSPNBBRT.js} +29 -7
  54. package/dist/cli/{chunk-5A2SIIPH.mjs → chunk-XU57CH42.mjs} +1 -1
  55. package/dist/cli/{chunk-UMPHUAGZ.js → chunk-XXDY7K7F.js} +3 -3
  56. package/dist/cli/{chunk-4PWBHYH4.js → chunk-Y5QYWFRI.js} +7 -7
  57. package/dist/cli/{chunk-HXPHRSNM.js → chunk-YHHLLONU.js} +14 -14
  58. package/dist/cli/{chunk-RQ2BHYUM.mjs → chunk-YP3G2CP6.mjs} +2 -2
  59. package/dist/cli/{chunk-RU5JRQKJ.mjs → chunk-YVQLXMJU.mjs} +2 -2
  60. package/dist/cli/{csv-3TUJHAOW.mjs → csv-T7HIELZ2.mjs} +4 -4
  61. package/dist/cli/{csv-BKWIYPMK.js → csv-VJNR6FOZ.js} +13 -13
  62. package/dist/cli/{db-EJMJDKDA.js → db-JF2I54V7.js} +27 -27
  63. package/dist/cli/{db-I75IQ7XI.mjs → db-OE2EXZXL.mjs} +6 -6
  64. package/dist/cli/describe-4FLGKRCA.js +50 -0
  65. package/dist/cli/{describe-RUFLLRIN.mjs → describe-HXZZC3LC.mjs} +18 -18
  66. package/dist/cli/describe-core.d.mts +2 -2
  67. package/dist/cli/describe-core.d.ts +2 -2
  68. package/dist/cli/{executions-VW3MYJEE.mjs → executions-4BXRIJFF.mjs} +6 -6
  69. package/dist/cli/{executions-TQJCMUUG.js → executions-UQ2H6MJZ.js} +8 -8
  70. package/dist/cli/{feedback-UFAEXH5B.js → feedback-MKFN7DYY.js} +10 -10
  71. package/dist/cli/{feedback-76342G7E.mjs → feedback-TXF5CQKA.mjs} +5 -5
  72. package/dist/cli/git-B2QO3SLK.js +25 -0
  73. package/dist/cli/{git-L5XKAODI.mjs → git-MG3NAV65.mjs} +5 -5
  74. package/dist/cli/index.js +141 -141
  75. package/dist/cli/index.mjs +43 -43
  76. package/dist/cli/{legacy-noops-DM66YISP.js → legacy-noops-R76I2OWW.js} +9 -9
  77. package/dist/cli/{legacy-noops-DKAZ7JG3.mjs → legacy-noops-XSDY46XD.mjs} +6 -6
  78. package/dist/cli/{monitors-NKDIH4TY.js → monitors-FS3DIDM7.js} +100 -100
  79. package/dist/cli/{monitors-QXEJI54B.mjs → monitors-NVT5YQKV.mjs} +7 -7
  80. package/dist/cli/{org-NKIIBUNO.js → org-SBI6FC6D.js} +72 -72
  81. package/dist/cli/{org-KZQCVREB.mjs → org-XU7JONWS.mjs} +6 -6
  82. package/dist/cli/{pages-UJUFCJEL.js → pages-2CZFJJV6.js} +18 -18
  83. package/dist/cli/{pages-E7IT5SWT.mjs → pages-AFB5DVBR.mjs} +6 -6
  84. package/dist/cli/{play-AKL5E2DF.mjs → play-EQEIT5S4.mjs} +18 -18
  85. package/dist/cli/{play-SPI5MO67.js → play-WZH72UGC.js} +317 -317
  86. package/dist/cli/{providers-6HSSVI74.mjs → providers-3VXTATHF.mjs} +6 -6
  87. package/dist/cli/{providers-4NVQ3FSC.js → providers-SHSVUQA3.js} +9 -9
  88. package/dist/cli/{quickstart-EHLEHSMI.mjs → quickstart-45YS4SOD.mjs} +4 -4
  89. package/dist/cli/{quickstart-FEQD7S4Z.js → quickstart-KPVPK3VL.js} +6 -6
  90. package/dist/cli/{run-GH6ECTJF.js → run-U5RWBX5J.js} +41 -41
  91. package/dist/cli/{run-IWVM7BD6.mjs → run-XEHRZT57.mjs} +23 -23
  92. package/dist/cli/{search-X4CDMN7J.mjs → search-V7XIWBQ2.mjs} +8 -8
  93. package/dist/cli/search-Z2V43OPM.js +33 -0
  94. package/dist/cli/{search-output-PJ7N5WUQ.mjs → search-output-3KAJUV2A.mjs} +4 -4
  95. package/dist/cli/{search-output-IIYMGZTQ.js → search-output-ZNIICV5Z.js} +6 -6
  96. package/dist/cli/{secrets-QPP2FXID.js → secrets-53TUV6JK.js} +15 -15
  97. package/dist/cli/{secrets-4YPMC7XZ.mjs → secrets-SCSG3QXJ.mjs} +6 -6
  98. package/dist/cli/sessions-BOJCVLR7.js +18 -0
  99. package/dist/cli/{sessions-BEOI47VZ.mjs → sessions-MCTHLLK3.mjs} +6 -6
  100. package/dist/cli/{settings-VHULXNY3.mjs → settings-Q2HKACSE.mjs} +13 -13
  101. package/dist/cli/{settings-FZDONKPW.js → settings-ZNOXOIX2.js} +86 -86
  102. package/dist/cli/{setup-LZ6IN5JS.js → setup-GO4EULLY.js} +50 -50
  103. package/dist/cli/{setup-5IV3NHGD.mjs → setup-WKM35SZJ.mjs} +10 -10
  104. package/dist/cli/skills-B4BAH2B2.js +37 -0
  105. package/dist/cli/{skills-FZAFBW5J.mjs → skills-DZZLW6OV.mjs} +8 -8
  106. package/dist/cli/{tools-TLBH3RFK.mjs → tools-EKVSK6X4.mjs} +17 -17
  107. package/dist/cli/tools-Z5NCKIAB.js +57 -0
  108. package/dist/cli/{update-KPLIZYOV.mjs → update-FPHYVHSC.mjs} +10 -10
  109. package/dist/cli/update-XCL7F5T6.js +35 -0
  110. package/dist/cli/{workflow-ACHPT3DD.js → workflow-27H3NCNY.js} +17 -17
  111. package/dist/cli/{workflow-GYJOYYWK.mjs → workflow-5YAZK5EI.mjs} +7 -7
  112. package/dist/{client-CswZYCGj.d.ts → client-DhEOE19l.d.ts} +1 -1
  113. package/dist/{client-core-C1xVOg8Y.d.mts → client-core-BGiSMrBD.d.mts} +1 -1
  114. package/dist/{client-core-D2pLt36Q.d.ts → client-core-DYCGaRBZ.d.ts} +1 -1
  115. package/dist/{client-CpSiHSti.d.mts → client-lJmz2QwF.d.mts} +1 -1
  116. package/dist/index.d.mts +3 -3
  117. package/dist/index.d.ts +3 -3
  118. package/dist/index.js +9 -9
  119. package/dist/index.mjs +6 -6
  120. package/dist/install-integrity.json +108 -108
  121. package/dist/plays/play-description.d.mts +1 -1
  122. package/dist/plays/play-description.d.ts +1 -1
  123. package/dist/plays/run-request.d.mts +1 -1
  124. package/dist/plays/run-request.d.ts +1 -1
  125. package/dist/release.d.mts +1 -1
  126. package/dist/release.d.ts +1 -1
  127. package/dist/release.js +2 -2
  128. package/dist/release.mjs +1 -1
  129. package/dist/server.d.mts +2 -2
  130. package/dist/server.d.ts +2 -2
  131. package/dist/server.js +5 -5
  132. package/dist/server.mjs +3 -3
  133. package/package.json +1 -1
  134. package/dist/cli/auth-DF6WJLN2.js +0 -43
  135. package/dist/cli/describe-EAK3MPTG.js +0 -50
  136. package/dist/cli/git-OOCPCIGZ.js +0 -25
  137. package/dist/cli/search-NIRYA3VL.js +0 -33
  138. package/dist/cli/sessions-5I2IFTW7.js +0 -18
  139. package/dist/cli/skills-WJWLFSHI.js +0 -37
  140. package/dist/cli/tools-SH35NRGU.js +0 -57
  141. package/dist/cli/update-MA46YSGR.js +0 -35
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
205
205
  // getters keep their established compatibility behavior.
206
206
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
207
207
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
208
- version: '0.3.519',
208
+ version: '0.3.520',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -692,6 +692,127 @@ const authoredStepContext = new AsyncLocalStorage<{
692
692
  invocationId?: string;
693
693
  }>();
694
694
  const toolExecutionOverrides = new AsyncLocalStorage<{ force: boolean }>();
695
+
696
+ /**
697
+ * Diagnostic split of one direct tool call, recorded only in the existing
698
+ * `DEEPLINE_RUNTIME_RECEIPT_TRACE=1` mode. It observes wall clocks around
699
+ * awaits that already happen; it never changes what is awaited or in which
700
+ * order. Receipt and admission times are summed over possibly overlapping
701
+ * calls, so they are labelled `_summed` and are not subtracted blindly.
702
+ */
703
+ type ToolCallPhaseClock = {
704
+ startedAt: number;
705
+ firstDispatchAt: number | null;
706
+ lastResponseParsedAt: number | null;
707
+ providerDispatches: number;
708
+ receiptCallsBeforeDispatch: number;
709
+ receiptMsBeforeDispatch: number;
710
+ receiptCallsAfterResponse: number;
711
+ receiptMsAfterResponse: number;
712
+ budgetChargeMs: number;
713
+ providerPermitMs: number;
714
+ };
715
+ const toolCallPhaseClock = new AsyncLocalStorage<ToolCallPhaseClock>();
716
+
717
+ function newToolCallPhaseClock(): ToolCallPhaseClock {
718
+ return {
719
+ startedAt: performance.now(),
720
+ firstDispatchAt: null,
721
+ lastResponseParsedAt: null,
722
+ providerDispatches: 0,
723
+ receiptCallsBeforeDispatch: 0,
724
+ receiptMsBeforeDispatch: 0,
725
+ receiptCallsAfterResponse: 0,
726
+ receiptMsAfterResponse: 0,
727
+ budgetChargeMs: 0,
728
+ providerPermitMs: 0,
729
+ };
730
+ }
731
+
732
+ function recordToolCallReceiptWall(startedAt: number): void {
733
+ const clock = toolCallPhaseClock.getStore();
734
+ if (!clock) return;
735
+ const elapsed = performance.now() - startedAt;
736
+ if (clock.firstDispatchAt === null) {
737
+ clock.receiptCallsBeforeDispatch += 1;
738
+ clock.receiptMsBeforeDispatch += elapsed;
739
+ } else if (clock.lastResponseParsedAt !== null) {
740
+ clock.receiptCallsAfterResponse += 1;
741
+ clock.receiptMsAfterResponse += elapsed;
742
+ }
743
+ }
744
+
745
+ const TRACED_RECEIPT_HANDLERS = [
746
+ 'getRuntimeStepReceipt',
747
+ 'getRuntimeStepReceipts',
748
+ 'claimRuntimeStepReceipt',
749
+ 'claimRuntimeStepReceipts',
750
+ 'markRuntimeStepReceiptRunning',
751
+ 'markRuntimeStepReceiptsRunning',
752
+ 'completeRuntimeStepReceipt',
753
+ 'completeRuntimeStepReceipts',
754
+ 'completeRuntimeStepReceiptsByReference',
755
+ 'publishLatestCacheResult',
756
+ 'acquireRuntimeReceiptExecutionLock',
757
+ 'releaseRuntimeReceiptExecutionLock',
758
+ ] as const satisfies ReadonlyArray<keyof ContextOptions>;
759
+
760
+ /**
761
+ * Time each receipt handler call into the calling tool call's clock. A handler
762
+ * keeps its exact return value (sync or promise) and its errors; only a
763
+ * settlement callback is attached.
764
+ */
765
+ function traceReceiptHandlers(options: ContextOptions): ContextOptions {
766
+ const traced: Record<string, unknown> = { ...options };
767
+ for (const name of TRACED_RECEIPT_HANDLERS) {
768
+ const handler = options[name] as
769
+ | ((...args: unknown[]) => unknown)
770
+ | undefined;
771
+ if (typeof handler !== 'function') continue;
772
+ traced[name] = (...args: unknown[]) => {
773
+ const startedAt = performance.now();
774
+ // Keep the receiver: a handler may be a method of its options object.
775
+ const result = handler.apply(options, args);
776
+ if (
777
+ result !== null &&
778
+ typeof result === 'object' &&
779
+ typeof (result as PromiseLike<unknown>).then === 'function'
780
+ ) {
781
+ void Promise.resolve(result).then(
782
+ () => recordToolCallReceiptWall(startedAt),
783
+ () => recordToolCallReceiptWall(startedAt),
784
+ );
785
+ } else {
786
+ recordToolCallReceiptWall(startedAt);
787
+ }
788
+ return result;
789
+ };
790
+ }
791
+ return traced as ContextOptions;
792
+ }
793
+
794
+ function formatToolCallPhaseSplit(
795
+ toolId: string,
796
+ clock: ToolCallPhaseClock,
797
+ ): string | null {
798
+ if (clock.firstDispatchAt === null || clock.lastResponseParsedAt === null)
799
+ return null;
800
+ const now = performance.now();
801
+ const ms = (value: number) => Math.max(0, Math.round(value));
802
+ return (
803
+ `[perf] tool call id=${toolId} phase=call_split ` +
804
+ `total_ms=${ms(now - clock.startedAt)} ` +
805
+ `pre_dispatch_ms=${ms(clock.firstDispatchAt - clock.startedAt)} ` +
806
+ `post_response_ms=${ms(now - clock.lastResponseParsedAt)} ` +
807
+ `provider_dispatches=${clock.providerDispatches} ` +
808
+ `receipt_calls_pre=${clock.receiptCallsBeforeDispatch} ` +
809
+ `receipt_ms_pre_summed=${ms(clock.receiptMsBeforeDispatch)} ` +
810
+ `receipt_calls_post=${clock.receiptCallsAfterResponse} ` +
811
+ `receipt_ms_post_summed=${ms(clock.receiptMsAfterResponse)} ` +
812
+ `budget_charge_ms=${ms(clock.budgetChargeMs)} ` +
813
+ `provider_permit_ms_summed=${ms(clock.providerPermitMs)}`
814
+ );
815
+ }
695
816
  const PROGRESS_HEARTBEAT_INTERVAL_MS = 1_000;
696
817
 
697
818
  const PURE_JS_HEARTBEAT_ROW_INTERVAL = 250;
@@ -2919,6 +3040,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2919
3040
  { resolve: (value: unknown) => void; reject: (reason: unknown) => void }
2920
3041
  >();
2921
3042
  #options: ContextOptions;
3043
+ /** Per-call phase split under the existing receipt trace mode. */
3044
+ #callSplitTrace = false;
2922
3045
  private readonly rootRuntimeContract: PlayArtifactRuntimeContract;
2923
3046
  private readonly datasetRowInputs = new DatasetRowInputView();
2924
3047
  private readonly executionScope: RunExecutionScope;
@@ -3572,7 +3695,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
3572
3695
  ...options,
3573
3696
  fixtureBehavior: fixtureBehavior.behavior,
3574
3697
  };
3575
- this.#options = options;
3698
+ this.#callSplitTrace = process.env.DEEPLINE_RUNTIME_RECEIPT_TRACE === '1';
3699
+ this.#options = this.#callSplitTrace
3700
+ ? traceReceiptHandlers(options)
3701
+ : options;
3576
3702
  this.checkpoint = options.checkpoint ?? emptyCheckpoint();
3577
3703
  this.mapFrames = new MapExecutionFrameStore(this.checkpoint, (event) =>
3578
3704
  this.emitExecutionEvent(event),
@@ -14456,8 +14582,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
14456
14582
  tool: toolId,
14457
14583
  };
14458
14584
  let result: unknown;
14585
+ // Direct calls only: a dataset row's calls can share dispatch groups, so
14586
+ // an async-context clock would not belong to one call.
14587
+ const phaseClock =
14588
+ this.#callSplitTrace && !row ? newToolCallPhaseClock() : null;
14459
14589
  try {
14460
- result = await this.executeToolInternal(key, toolId, input, options);
14590
+ result = phaseClock
14591
+ ? await toolCallPhaseClock.run(phaseClock, () =>
14592
+ this.executeToolInternal(key, toolId, input, options),
14593
+ )
14594
+ : await this.executeToolInternal(key, toolId, input, options);
14461
14595
  } catch (error) {
14462
14596
  // Parking is control flow, not a failed tool execution.
14463
14597
  if (
@@ -14510,6 +14644,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
14510
14644
  duration_ms: Math.max(0, Date.now() - startedAt),
14511
14645
  }),
14512
14646
  );
14647
+ const split = phaseClock
14648
+ ? formatToolCallPhaseSplit(toolId, phaseClock)
14649
+ : null;
14650
+ if (split) this.runtimeLog(split);
14513
14651
  return result;
14514
14652
  }
14515
14653
 
@@ -20997,6 +21135,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
20997
21135
  const acquireProviderPermit = async (signal?: AbortSignal) => {
20998
21136
  options?.onProviderAdmissionPending?.();
20999
21137
  logProvider429RetryPhase('provider_permit_wait_started');
21138
+ const permitStartedAt = performance.now();
21000
21139
  const permit = await this.resourceGovernor.acquireProviderPermit({
21001
21140
  toolId,
21002
21141
  signal,
@@ -21010,6 +21149,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
21010
21149
  providerPacingGrant = permit.pacingGrant ?? null;
21011
21150
  providerGatewayDispatchProof = permit.gatewayDispatchProof ?? null;
21012
21151
  providerTelemetryKey = permit.provider;
21152
+ const phaseClock = toolCallPhaseClock.getStore();
21153
+ if (phaseClock)
21154
+ phaseClock.providerPermitMs +=
21155
+ performance.now() - permitStartedAt;
21013
21156
  logProvider429RetryPhase('provider_permit_acquired');
21014
21157
  return permit;
21015
21158
  };
@@ -21018,7 +21161,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
21018
21161
  // transport loop. A budget breach is a run-control outcome, never a
21019
21162
  // transport failure that may be retried or row-isolated.
21020
21163
  if (!toolCallCharged) {
21164
+ const budgetStartedAt = performance.now();
21021
21165
  await this.resourceGovernor.chargeToolCall();
21166
+ const phaseClock = toolCallPhaseClock.getStore();
21167
+ if (phaseClock)
21168
+ phaseClock.budgetChargeMs += performance.now() - budgetStartedAt;
21022
21169
  toolCallCharged = true;
21023
21170
  }
21024
21171
 
@@ -21409,6 +21556,14 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
21409
21556
  true;
21410
21557
  if (!dispatchedWithProviderPermit)
21411
21558
  recordProviderDispatch();
21559
+ const dispatchPhaseClock =
21560
+ toolCallPhaseClock.getStore();
21561
+ if (dispatchPhaseClock) {
21562
+ dispatchPhaseClock.firstDispatchAt ??=
21563
+ performance.now();
21564
+ dispatchPhaseClock.providerDispatches += 1;
21565
+ dispatchPhaseClock.lastResponseParsedAt = null;
21566
+ }
21412
21567
  const dispatchedResponse = await fetch(
21413
21568
  dispatchedWithProviderPermit
21414
21569
  ? `${url}${TOOL_EXECUTE_PROVIDER_PERMIT_PATH_SUFFIX}`
@@ -21721,6 +21876,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
21721
21876
  }
21722
21877
  activeProviderRequest?.release();
21723
21878
  activeProviderRequest = null;
21879
+ if (dispatchPhaseClock)
21880
+ dispatchPhaseClock.lastResponseParsedAt =
21881
+ performance.now();
21724
21882
  return {
21725
21883
  response: dispatchedResponse,
21726
21884
  responseData: dispatchedResponseData,
@@ -52,6 +52,19 @@ export const EXECUTE_SERVER_TIMING_STAGES = [
52
52
  'execute',
53
53
  'identity',
54
54
  'usage_schedule',
55
+ // Handler slices that previously had no stage of their own. Each is a
56
+ // disjoint wall inside `total`; none overlaps the stages above.
57
+ // - `request_parse` body read/JSON parse, actor and route params, and the
58
+ // gateway attestation HMAC checks, after `auth`
59
+ // - `entitlements` tool entitlement read (only tools with tool limits)
60
+ // - `response_build` success-path async metadata, managed-create metadata
61
+ // and response serialization, after billing settlement
62
+ // - `call_evidence` runner calls only: clone, parse and re-serialize the
63
+ // response to attach provider call evidence
64
+ 'request_parse',
65
+ 'entitlements',
66
+ 'response_build',
67
+ 'call_evidence',
55
68
  // Managed AI inference slices: `ai_prepare` includes request preparation and
56
69
  // contains `ai_billing_authorize`; `ai_provider_work_start` is the durable
57
70
  // pre-call transition; `ai_gateway_first_output` is the time to the first
@@ -92,6 +105,15 @@ export const EXECUTE_SERVER_TIMING_STAGES = [
92
105
  'body_parse',
93
106
  'dispatch_pool',
94
107
  'dispatch_callback',
108
+ // Relay pre-dispatch slices: upstream admission queueing, the
109
+ // retired-attempt fence (a refresh can wait up to 250 ms), and gateway-side
110
+ // provider permit validation. The relay appends them only when the request
111
+ // took that step. Like the relay stages above, the app handler's own header
112
+ // lists every stage at zero, and the later relay entry wins for a reader, so
113
+ // a zero here can also mean the relay did not take the step.
114
+ 'relay_admission',
115
+ 'attempt_fence',
116
+ 'permit_validate',
95
117
  // The execution relay measures its own upstream fetch. `upstream_headers`
96
118
  // contains the app handler's `total`; subtracting those two clocks leaves
97
119
  // only the Vercel/platform-or-transit boundary, never a made-up provider
@@ -1,22 +1,22 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkPK6VYYEYjs = require('./chunk-PK6VYYEY.js');
4
- require('./chunk-O655PVT4.js');
3
+ var _chunkI4GBCKBLjs = require('./chunk-I4GBCKBL.js');
4
+ require('./chunk-VSPNBBRT.js');
5
5
  require('./chunk-E4CABWXL.js');
6
6
  require('./chunk-6Y3DDRRN.js');
7
7
  require('./chunk-NMU3VR5U.js');
8
8
  require('./chunk-WSGXBROE.js');
9
9
 
10
10
 
11
- var _chunk4PWBHYH4js = require('./chunk-4PWBHYH4.js');
11
+ var _chunkY5QYWFRIjs = require('./chunk-Y5QYWFRI.js');
12
12
 
13
13
 
14
- var _chunkBQYXIAJMjs = require('./chunk-BQYXIAJM.js');
15
- require('./chunk-TT2XB433.js');
14
+ var _chunkUA4MXESLjs = require('./chunk-UA4MXESL.js');
15
+ require('./chunk-BHAP6FIZ.js');
16
16
  require('./chunk-T2N3B7IQ.js');
17
17
  require('./chunk-XNYIZMNQ.js');
18
18
  require('./chunk-SQWET4SL.js');
19
- require('./chunk-F6XD4CRW.js');
19
+ require('./chunk-5ECMRQCL.js');
20
20
  require('./chunk-OG64RBAC.js');
21
21
  require('./chunk-COGTRVWW.js');
22
22
 
@@ -24,7 +24,7 @@ require('./chunk-COGTRVWW.js');
24
24
  var _promises = require('fs/promises');
25
25
  var ARTIFACTS_FEATURE = "artifacts";
26
26
  function print(command, json, data, lines) {
27
- _chunk4PWBHYH4js.printCommandEnvelope.call(void 0,
27
+ _chunkY5QYWFRIjs.printCommandEnvelope.call(void 0,
28
28
  { command, ...data, render: { sections: [{ title: command, lines }] } },
29
29
  { json: Boolean(json), text: `${lines.join("\n")}
30
30
  ` }
@@ -56,7 +56,7 @@ function artifactLines(artifact) {
56
56
  ];
57
57
  }
58
58
  function registerArtifactsCommands(program) {
59
- const artifacts = program.command("artifacts", { hidden: !_chunkBQYXIAJMjs.cliFeatureEnabled.call(void 0, ARTIFACTS_FEATURE) }).description(
59
+ const artifacts = program.command("artifacts", { hidden: !_chunkUA4MXESLjs.cliFeatureEnabled.call(void 0, ARTIFACTS_FEATURE) }).description(
60
60
  "Show what a Play returns at a fixed URL on artifacts.deepline.com."
61
61
  ).addHelpText(
62
62
  "after",
@@ -69,7 +69,7 @@ Examples:
69
69
  );
70
70
  artifacts.command("list").description("List this workspace's artifacts.").option("--cursor <cursor>", "Continue from a previous page of results").option("--limit <n>", "Results per request, up to 100", Number).option("--json", "Emit raw JSON response").action(
71
71
  async (options) => run(async () => {
72
- const result = await new (0, _chunkPK6VYYEYjs.DeeplineClient)().listArtifacts({
72
+ const result = await new (0, _chunkI4GBCKBLjs.DeeplineClient)().listArtifacts({
73
73
  cursor: options.cursor,
74
74
  limit: options.limit
75
75
  });
@@ -84,7 +84,7 @@ Examples:
84
84
  );
85
85
  artifacts.command("get <id>").description("Show one artifact and what you may do with it.").option("--json", "Emit raw JSON response").action(
86
86
  async (id, options) => run(async () => {
87
- const artifact = await new (0, _chunkPK6VYYEYjs.DeeplineClient)().getArtifact(id);
87
+ const artifact = await new (0, _chunkI4GBCKBLjs.DeeplineClient)().getArtifact(id);
88
88
  print("artifacts get", options.json, artifact, [
89
89
  ...artifactLines(artifact),
90
90
  ` saved input ${JSON.stringify(artifact.input)}`
@@ -106,7 +106,7 @@ Examples:
106
106
  `
107
107
  ).action(
108
108
  async (options) => run(async () => {
109
- const artifact = await new (0, _chunkPK6VYYEYjs.DeeplineClient)().createArtifact({
109
+ const artifact = await new (0, _chunkI4GBCKBLjs.DeeplineClient)().createArtifact({
110
110
  name: options.name,
111
111
  play: options.play,
112
112
  ...options.input !== void 0 ? {
@@ -146,7 +146,7 @@ Examples:
146
146
  "Nothing to change. See: deepline artifacts edit --help"
147
147
  );
148
148
  }
149
- const artifact = await new (0, _chunkPK6VYYEYjs.DeeplineClient)().updateArtifact(id, fields);
149
+ const artifact = await new (0, _chunkI4GBCKBLjs.DeeplineClient)().updateArtifact(id, fields);
150
150
  print(
151
151
  "artifacts edit",
152
152
  options.json,
@@ -157,7 +157,7 @@ Examples:
157
157
  );
158
158
  artifacts.command("runs <id>").description("List runs of the artifact's Play, newest first.").option("--limit <n>", "Runs to list, up to 100", Number).option("--json", "Emit raw JSON response").action(
159
159
  async (id, options) => run(async () => {
160
- const result = await new (0, _chunkPK6VYYEYjs.DeeplineClient)().listArtifactRuns(id, {
160
+ const result = await new (0, _chunkI4GBCKBLjs.DeeplineClient)().listArtifactRuns(id, {
161
161
  limit: options.limit
162
162
  });
163
163
  print("artifacts runs", options.json, result, [
@@ -176,7 +176,7 @@ Examples:
176
176
  ).option("--json", "Emit raw JSON response").action(
177
177
  async (id, options) => run(async () => {
178
178
  const input = options.input !== void 0 ? await readJsonOption(options.input, "--input") : void 0;
179
- const started = await new (0, _chunkPK6VYYEYjs.DeeplineClient)().refreshArtifact(id, input);
179
+ const started = await new (0, _chunkI4GBCKBLjs.DeeplineClient)().refreshArtifact(id, input);
180
180
  print("artifacts refresh", options.json, started, [
181
181
  `Started run ${started.workflowId}.`,
182
182
  `Watch it: deepline runs get ${started.workflowId}`
@@ -190,7 +190,7 @@ Examples:
190
190
  if (access !== "workspace" && access !== "public") {
191
191
  throw new Error("Access is workspace or public.");
192
192
  }
193
- const artifact = await new (0, _chunkPK6VYYEYjs.DeeplineClient)().setArtifactAccess(
193
+ const artifact = await new (0, _chunkI4GBCKBLjs.DeeplineClient)().setArtifactAccess(
194
194
  id,
195
195
  access
196
196
  );
@@ -204,7 +204,7 @@ Examples:
204
204
  );
205
205
  artifacts.command("delete <id>").description("Delete an artifact. Its Play and runs are not touched.").option("--json", "Emit raw JSON response").action(
206
206
  async (id, options) => run(async () => {
207
- const result = await new (0, _chunkPK6VYYEYjs.DeeplineClient)().deleteArtifact(id);
207
+ const result = await new (0, _chunkI4GBCKBLjs.DeeplineClient)().deleteArtifact(id);
208
208
  print("artifacts delete", options.json, result, [
209
209
  `Deleted artifact ${id}.`
210
210
  ]);
@@ -215,7 +215,7 @@ Examples:
215
215
  );
216
216
  permissions.command("get", { isDefault: true }).description("Show the workspace's artifact rules and what you may do.").option("--json", "Emit raw JSON response").action(
217
217
  async (options) => run(async () => {
218
- const result = await new (0, _chunkPK6VYYEYjs.DeeplineClient)().getArtifactPermissions();
218
+ const result = await new (0, _chunkI4GBCKBLjs.DeeplineClient)().getArtifactPermissions();
219
219
  print("artifacts permissions", options.json, result, [
220
220
  ...Object.entries(result.rules).map(
221
221
  ([verb, level]) => `${verb}: ${level}`
@@ -253,7 +253,7 @@ Examples:
253
253
  "Pass at least one rule. See: deepline artifacts permissions set --help"
254
254
  );
255
255
  }
256
- const result = await new (0, _chunkPK6VYYEYjs.DeeplineClient)().setArtifactPermissions(rules);
256
+ const result = await new (0, _chunkI4GBCKBLjs.DeeplineClient)().setArtifactPermissions(rules);
257
257
  print(
258
258
  "artifacts permissions set",
259
259
  options.json,
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  DeeplineClient
3
- } from "./chunk-NH22WUUG.mjs";
4
- import "./chunk-FJAGGBDR.mjs";
3
+ } from "./chunk-6T2LB43P.mjs";
4
+ import "./chunk-SHB2BNI6.mjs";
5
5
  import "./chunk-L2VKAASU.mjs";
6
6
  import "./chunk-HT675XNR.mjs";
7
7
  import "./chunk-S3A4IXBQ.mjs";
8
8
  import "./chunk-BMCRTI6Z.mjs";
9
9
  import {
10
10
  printCommandEnvelope
11
- } from "./chunk-CRE3OGHH.mjs";
11
+ } from "./chunk-NLIO6QLP.mjs";
12
12
  import {
13
13
  cliFeatureEnabled
14
- } from "./chunk-CBMTBMIJ.mjs";
15
- import "./chunk-5A2SIIPH.mjs";
14
+ } from "./chunk-QQGRQRCS.mjs";
15
+ import "./chunk-XU57CH42.mjs";
16
16
  import "./chunk-QNHHZ63P.mjs";
17
17
  import "./chunk-DLIRSHV6.mjs";
18
18
  import "./chunk-ZPGGW27Q.mjs";
19
- import "./chunk-NIJE62ZD.mjs";
19
+ import "./chunk-6GI7BYSL.mjs";
20
20
  import "./chunk-WZYKRD7T.mjs";
21
21
  import "./chunk-KRD6H754.mjs";
22
22
 
@@ -14,14 +14,14 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-FTJ2D3XD.mjs";
18
- import "./chunk-CRE3OGHH.mjs";
19
- import "./chunk-CBMTBMIJ.mjs";
20
- import "./chunk-5A2SIIPH.mjs";
17
+ } from "./chunk-VSLU4JZV.mjs";
18
+ import "./chunk-NLIO6QLP.mjs";
19
+ import "./chunk-QQGRQRCS.mjs";
20
+ import "./chunk-XU57CH42.mjs";
21
21
  import "./chunk-QNHHZ63P.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-ZPGGW27Q.mjs";
24
- import "./chunk-NIJE62ZD.mjs";
24
+ import "./chunk-6GI7BYSL.mjs";
25
25
  import "./chunk-WZYKRD7T.mjs";
26
26
  import "./chunk-KRD6H754.mjs";
27
27
  export {
@@ -0,0 +1,43 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+ var _chunkORAWUIMNjs = require('./chunk-ORAWUIMN.js');
18
+ require('./chunk-Y5QYWFRI.js');
19
+ require('./chunk-UA4MXESL.js');
20
+ require('./chunk-BHAP6FIZ.js');
21
+ require('./chunk-T2N3B7IQ.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-SQWET4SL.js');
24
+ require('./chunk-5ECMRQCL.js');
25
+ require('./chunk-OG64RBAC.js');
26
+ require('./chunk-COGTRVWW.js');
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkORAWUIMNjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkORAWUIMNjs.authStatusLine; exports.clearPendingClaim = _chunkORAWUIMNjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkORAWUIMNjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkORAWUIMNjs.handleRegister; exports.handleStatus = _chunkORAWUIMNjs.handleStatus; exports.handleWait = _chunkORAWUIMNjs.handleWait; exports.httpJson = _chunkORAWUIMNjs.httpJson; exports.readPendingAuthClaim = _chunkORAWUIMNjs.readPendingAuthClaim; exports.readStatusBanner = _chunkORAWUIMNjs.readStatusBanner; exports.registerAuthCommands = _chunkORAWUIMNjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunkORAWUIMNjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkORAWUIMNjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkORAWUIMNjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkORAWUIMNjs.statusBannerLine;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DeeplineClient
3
- } from "./chunk-NH22WUUG.mjs";
3
+ } from "./chunk-6T2LB43P.mjs";
4
4
  import {
5
5
  iterateCursorPages,
6
6
  requireBillingIdempotencyKey
7
- } from "./chunk-FJAGGBDR.mjs";
7
+ } from "./chunk-SHB2BNI6.mjs";
8
8
  import "./chunk-L2VKAASU.mjs";
9
9
  import "./chunk-HT675XNR.mjs";
10
10
  import "./chunk-S3A4IXBQ.mjs";
@@ -22,9 +22,9 @@ import {
22
22
  openInBrowser,
23
23
  printCommandEnvelope,
24
24
  shouldEmitJson
25
- } from "./chunk-CRE3OGHH.mjs";
26
- import "./chunk-CBMTBMIJ.mjs";
27
- import "./chunk-5A2SIIPH.mjs";
25
+ } from "./chunk-NLIO6QLP.mjs";
26
+ import "./chunk-QQGRQRCS.mjs";
27
+ import "./chunk-XU57CH42.mjs";
28
28
  import {
29
29
  AuthError,
30
30
  ConfigError
@@ -33,7 +33,7 @@ import "./chunk-DLIRSHV6.mjs";
33
33
  import {
34
34
  DeeplineError
35
35
  } from "./chunk-ZPGGW27Q.mjs";
36
- import "./chunk-NIJE62ZD.mjs";
36
+ import "./chunk-6GI7BYSL.mjs";
37
37
  import "./chunk-WZYKRD7T.mjs";
38
38
  import "./chunk-KRD6H754.mjs";
39
39