deepline 0.3.451 → 0.3.453

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 (117) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +65 -0
  2. package/dist/bundling-sources/sdk/src/http.ts +2 -1
  3. package/dist/bundling-sources/sdk/src/index.ts +2 -0
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +63 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +5 -1
  7. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +49 -11
  8. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +4 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +6 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +3 -1
  11. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +17 -2
  12. package/dist/cli/{auth-YLBWEMRW.mjs → auth-6CXS55CN.mjs} +4 -4
  13. package/dist/cli/auth-AICIA232.js +40 -0
  14. package/dist/cli/{billing-GWG5D3P6.js → billing-QC52XTAD.js} +87 -74
  15. package/dist/cli/{billing-DUFOEOPT.mjs → billing-SWLTV6PV.mjs} +18 -5
  16. package/dist/cli/{chunk-37CPEQBE.mjs → chunk-2LDU5BMG.mjs} +3 -3
  17. package/dist/cli/{chunk-JUCEEIEC.mjs → chunk-43HOSM2F.mjs} +1 -1
  18. package/dist/cli/{chunk-E7V5CRA2.mjs → chunk-6CTVXF6X.mjs} +8 -8
  19. package/dist/cli/{chunk-BJOVX7EB.mjs → chunk-7557D4FM.mjs} +2 -2
  20. package/dist/cli/chunk-BX343KU7.mjs +155 -0
  21. package/dist/cli/{chunk-7VRWERTM.js → chunk-DMTAFWMS.js} +84 -50
  22. package/dist/cli/{chunk-XLOXUW5Y.mjs → chunk-FS2RMEJ7.mjs} +1 -1
  23. package/dist/cli/{chunk-EJ6YI46S.js → chunk-HUDUN4AR.js} +2 -2
  24. package/dist/cli/{chunk-OKTCLFKM.mjs → chunk-IFBLLSGH.mjs} +5 -5
  25. package/dist/cli/{chunk-33EM4SMH.mjs → chunk-IWFI6FTJ.mjs} +4 -153
  26. package/dist/cli/{chunk-ZPV7DMAA.mjs → chunk-IXVABCNA.mjs} +1 -1
  27. package/dist/cli/{chunk-O3KVUHCG.js → chunk-JOF3B22H.js} +20 -20
  28. package/dist/cli/{chunk-6TFACCXN.js → chunk-KFKM5J2N.js} +2 -2
  29. package/dist/cli/{chunk-WLVGRU5A.mjs → chunk-KQD6EFPD.mjs} +2 -2
  30. package/dist/cli/{chunk-HSKLAPMD.js → chunk-MP35NE55.js} +26 -26
  31. package/dist/cli/chunk-NOHA3SZJ.js +155 -0
  32. package/dist/cli/{chunk-Z3DBS4IB.js → chunk-NSQZUUYB.js} +81 -81
  33. package/dist/cli/{chunk-BQQLTSGC.mjs → chunk-P4UQCYKH.mjs} +4 -4
  34. package/dist/cli/{chunk-CH2WDSBC.js → chunk-PJWXEUUH.js} +8 -8
  35. package/dist/cli/{chunk-L2IUGWV5.js → chunk-RG644LJU.js} +1 -1
  36. package/dist/cli/{chunk-5DUMNKQG.js → chunk-RNCIPLU5.js} +50 -50
  37. package/dist/cli/{chunk-WDOWAOYB.js → chunk-RTR2KUU6.js} +10 -10
  38. package/dist/cli/{chunk-4C7HPD57.mjs → chunk-SQUJHT7O.mjs} +1 -1
  39. package/dist/cli/{chunk-ZNDE2BTH.js → chunk-V6AZQ4JH.js} +16 -16
  40. package/dist/cli/{chunk-F2DW7DFE.js → chunk-V7S2RUVE.js} +8 -8
  41. package/dist/cli/{chunk-C4NPWUZY.js → chunk-VG6WESY7.js} +73 -222
  42. package/dist/cli/{chunk-6G6KX7I7.js → chunk-WTTHH2K3.js} +6 -6
  43. package/dist/cli/{chunk-JRPNCMMN.js → chunk-WWZ4YJ6J.js} +35 -35
  44. package/dist/cli/{chunk-PJYTV24I.mjs → chunk-X2LUT22I.mjs} +2 -2
  45. package/dist/cli/{chunk-YXXIFMXI.mjs → chunk-XH4QC5ZX.mjs} +2 -2
  46. package/dist/cli/{chunk-3HT47QPJ.mjs → chunk-XNN3OTGT.mjs} +2 -2
  47. package/dist/cli/{chunk-LPPAJJJN.mjs → chunk-XV4463XW.mjs} +35 -1
  48. package/dist/cli/{chunk-TFCLUWDQ.js → chunk-YU6IE234.js} +6 -6
  49. package/dist/cli/{chunk-RFPP4Q66.mjs → chunk-ZVBLECZX.mjs} +3 -3
  50. package/dist/cli/{csv-RL7WQD6Y.mjs → csv-FON4ZQKC.mjs} +3 -3
  51. package/dist/cli/{csv-4CHXZQXO.js → csv-WIQB5XWZ.js} +12 -12
  52. package/dist/cli/{db-ZDBAWV7B.mjs → db-3KA62DOQ.mjs} +4 -4
  53. package/dist/cli/{db-MRI5IM2A.js → db-VMDDODCN.js} +25 -25
  54. package/dist/cli/{describe-RRQUUJQ3.mjs → describe-LGDK77QI.mjs} +13 -12
  55. package/dist/cli/{describe-2FYKXM5B.js → describe-NTAAHCCX.js} +17 -16
  56. package/dist/cli/describe-core.d.mts +1 -1
  57. package/dist/cli/describe-core.d.ts +1 -1
  58. package/dist/cli/{executions-KDBD47A5.js → executions-OT2KNJDO.js} +6 -6
  59. package/dist/cli/{executions-RJL76TJS.mjs → executions-TM6AMTQ7.mjs} +4 -4
  60. package/dist/cli/{feedback-2CE24NHD.js → feedback-4HQGY3TO.js} +7 -7
  61. package/dist/cli/{feedback-KOYLXHYE.mjs → feedback-HWLUVFE2.mjs} +3 -3
  62. package/dist/cli/git-QIZWO5BA.js +24 -0
  63. package/dist/cli/{git-RDUHU6L6.mjs → git-TDJVSPE6.mjs} +4 -4
  64. package/dist/cli/index.js +133 -131
  65. package/dist/cli/index.mjs +39 -37
  66. package/dist/cli/{legacy-noops-7FOMGBMN.js → legacy-noops-XH3FDLWT.js} +7 -7
  67. package/dist/cli/{legacy-noops-4HS2LYP6.mjs → legacy-noops-YB2PES43.mjs} +4 -4
  68. package/dist/cli/{monitors-IJXNK5BL.js → monitors-E3QFEJKF.js} +276 -124
  69. package/dist/cli/{monitors-JLBTNBVU.mjs → monitors-KQDDMSDR.mjs} +156 -4
  70. package/dist/cli/{org-OWP6K4AA.mjs → org-7X2C7YKA.mjs} +4 -4
  71. package/dist/cli/{org-JL7SW6VY.js → org-PMTLR7VP.js} +66 -66
  72. package/dist/cli/{play-FNOVKU74.mjs → play-7FNEPSVR.mjs} +11 -10
  73. package/dist/cli/{play-LLNZWHT6.js → play-RH22Z3D6.js} +284 -283
  74. package/dist/cli/{providers-WBOEOKE7.mjs → providers-HOEDJNUK.mjs} +4 -4
  75. package/dist/cli/{providers-E4XIEUC7.js → providers-X5NY5IQH.js} +7 -7
  76. package/dist/cli/{quickstart-3FUHKGEY.js → quickstart-FI4A6VTV.js} +5 -5
  77. package/dist/cli/{quickstart-6G5G3BVA.mjs → quickstart-NCL7P2US.mjs} +3 -3
  78. package/dist/cli/search-6FUMJBIY.js +30 -0
  79. package/dist/cli/{search-CNMB4Z6M.mjs → search-UHT7ZNPO.mjs} +5 -5
  80. package/dist/cli/{secrets-5FY5APVK.mjs → secrets-D4ZB5RKB.mjs} +4 -4
  81. package/dist/cli/{secrets-BDSWOYAT.js → secrets-TT6J3SZJ.js} +13 -13
  82. package/dist/cli/{sessions-PMIKVPQN.mjs → sessions-HRLJ6SLL.mjs} +4 -4
  83. package/dist/cli/{sessions-B7T2CHYK.js → sessions-SRQQZMM7.js} +5 -5
  84. package/dist/cli/{settings-RXQJRRLR.js → settings-EJIKXLC7.js} +76 -75
  85. package/dist/cli/{settings-4TAYLTPR.mjs → settings-PJJYPWU3.mjs} +9 -8
  86. package/dist/cli/{setup-ZTMETGSO.js → setup-3FL77Z33.js} +43 -42
  87. package/dist/cli/{setup-LVUISLVO.mjs → setup-DNI6ENFD.mjs} +8 -7
  88. package/dist/cli/skills-DEKOSL7F.js +30 -0
  89. package/dist/cli/{skills-NSJ43Z5Q.mjs → skills-FO7MY2OE.mjs} +6 -5
  90. package/dist/cli/tools-E6XRW6PW.js +45 -0
  91. package/dist/cli/{tools-CFCKIGDY.mjs → tools-F72WONN3.mjs} +13 -12
  92. package/dist/cli/update-6M3CAS4T.js +32 -0
  93. package/dist/cli/{update-HYOCBXJO.mjs → update-JZU33TC5.mjs} +8 -7
  94. package/dist/cli/{workflow-U6S4SWTF.js → workflow-BGKC73V2.js} +15 -15
  95. package/dist/cli/{workflow-RKX45RJ4.mjs → workflow-PQYQXQPH.mjs} +5 -5
  96. package/dist/{client-CPRaigLC.d.ts → client-D6XhrO0f.d.ts} +26 -1
  97. package/dist/{client-DstDI5TV.d.mts → client-mRA_esYI.d.mts} +26 -1
  98. package/dist/index.d.mts +2 -2
  99. package/dist/index.d.ts +2 -2
  100. package/dist/index.js +6 -6
  101. package/dist/index.mjs +3 -3
  102. package/dist/install-integrity.json +82 -80
  103. package/dist/plays/play-description.d.mts +1 -1
  104. package/dist/plays/play-description.d.ts +1 -1
  105. package/dist/plays/run-request.d.mts +1 -1
  106. package/dist/plays/run-request.d.ts +1 -1
  107. package/dist/release.d.mts +1 -1
  108. package/dist/release.d.ts +1 -1
  109. package/dist/release.js +2 -2
  110. package/dist/release.mjs +1 -1
  111. package/package.json +1 -1
  112. package/dist/cli/auth-WPQBEOES.js +0 -40
  113. package/dist/cli/git-DZ5GROPH.js +0 -24
  114. package/dist/cli/search-4ECC773X.js +0 -30
  115. package/dist/cli/skills-MIENPTOD.js +0 -29
  116. package/dist/cli/tools-CXJO5XSH.js +0 -44
  117. package/dist/cli/update-B2LQGEXF.js +0 -31
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;require('./chunk-I5YZLGMG.js');
2
2
 
3
3
 
4
- var _chunk7VRWERTMjs = require('./chunk-7VRWERTM.js');
4
+ var _chunkDMTAFWMSjs = require('./chunk-DMTAFWMS.js');
5
5
  require('./chunk-E4CABWXL.js');
6
6
  require('./chunk-JKVRBCZL.js');
7
7
  require('./chunk-KXMNM4AQ.js');
@@ -16,11 +16,14 @@ require('./chunk-UNEMDKXN.js');
16
16
  var _chunkIF75RD6Ujs = require('./chunk-IF75RD6U.js');
17
17
 
18
18
 
19
+ var _chunkNOHA3SZJjs = require('./chunk-NOHA3SZJ.js');
19
20
 
20
21
 
21
22
 
22
- var _chunk6G6KX7I7js = require('./chunk-6G6KX7I7.js');
23
- require('./chunk-WDOWAOYB.js');
23
+
24
+
25
+ var _chunkWTTHH2K3js = require('./chunk-WTTHH2K3.js');
26
+ require('./chunk-RTR2KUU6.js');
24
27
 
25
28
 
26
29
  var _chunkALJJRZNJjs = require('./chunk-ALJJRZNJ.js');
@@ -28,7 +31,7 @@ require('./chunk-XNYIZMNQ.js');
28
31
 
29
32
 
30
33
  var _chunkDIAWYWT5js = require('./chunk-DIAWYWT5.js');
31
- require('./chunk-L2IUGWV5.js');
34
+ require('./chunk-RG644LJU.js');
32
35
  require('./chunk-OG64RBAC.js');
33
36
  require('./chunk-COGTRVWW.js');
34
37
 
@@ -106,10 +109,10 @@ function reportMonitorsFailure(error, options) {
106
109
  const exitCode = monitorsErrorExitCode(error);
107
110
  const next = monitorsFailureNextCommand(error, exitCode, options);
108
111
  const retrySafe = exitCode === 5 && _optionalChain([options, 'optionalAccess', _9 => _9.retryCommand]) !== void 0;
109
- const wantsJson = _chunk6G6KX7I7js.shouldEmitJson.call(void 0, process.argv.includes("--json"));
112
+ const wantsJson = _chunkWTTHH2K3js.shouldEmitJson.call(void 0, process.argv.includes("--json"));
110
113
  if (wantsJson) {
111
- const payload = _chunk6G6KX7I7js.errorToJsonPayload.call(void 0, error);
112
- _chunk6G6KX7I7js.printJson.call(void 0, {
114
+ const payload = _chunkWTTHH2K3js.errorToJsonPayload.call(void 0, error);
115
+ _chunkWTTHH2K3js.printJson.call(void 0, {
113
116
  ok: false,
114
117
  exitCode,
115
118
  ...next ? { next } : {},
@@ -524,14 +527,14 @@ Preview the plan first with:
524
527
  );
525
528
  }
526
529
  async function handleMonitorsStatus(options) {
527
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.status();
530
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.status();
528
531
  const hasAccess = payload.has_access === true;
529
532
  const reason = typeof payload.reason === "string" && payload.reason.trim() ? payload.reason.trim() : void 0;
530
533
  const text = hasAccess ? `\u2713 You have access to Deepline Monitors${reason ? `
531
534
  ${reason}` : ""}
532
535
  ` : `\u2717 No access to Deepline Monitors${reason ? ` \u2014 ${reason}` : ""}
533
536
  `;
534
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
537
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
535
538
  { has_access: hasAccess, ...reason ? { reason } : {} },
536
539
  { json: options.json, text }
537
540
  );
@@ -597,14 +600,14 @@ async function handleMonitorsAvailable(toolId, options) {
597
600
  }
598
601
  }
599
602
  const tool = _nullishCoalesce(toolId, () => ( options.tool));
600
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.available(tool, {
603
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.available(tool, {
601
604
  ...options.provider ? { provider: options.provider } : {},
602
605
  ...options.search ? { search: options.search } : {},
603
606
  ...options.limit ? { limit: options.limit } : {},
604
607
  ...options.full ? { full: true } : {},
605
608
  ...options.compact ? { compact: true } : {}
606
609
  });
607
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, {
610
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, {
608
611
  json: options.json,
609
612
  // Human list view shows id + name + deployed_count ("deployed: N") so
610
613
  // can-deploy vs already-deployed is visible in one view. Describing a
@@ -707,14 +710,14 @@ async function handleMonitorsList(options) {
707
710
  "`--compact` is deprecated and now does nothing; returning the complete monitor records.\n"
708
711
  );
709
712
  }
710
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.list({
713
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.list({
711
714
  ...state ? { state } : {},
712
715
  ...options.status ? { status: options.status } : {},
713
716
  ...options.limit ? { limit: options.limit } : {},
714
717
  ...options.cursor ? { cursor: options.cursor } : {},
715
718
  ...options.includeConsumers ? { includeConsumers: true } : {}
716
719
  });
717
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, {
720
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, {
718
721
  json: options.json,
719
722
  text: renderDeployedListText(
720
723
  payload,
@@ -730,10 +733,119 @@ async function handleMonitorsCheck(definition, options) {
730
733
  argLabel: "<definition>",
731
734
  command: "deepline monitors check"
732
735
  });
733
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.check(
736
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.check(
734
737
  body
735
738
  );
736
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, { json: options.json });
739
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, { json: options.json });
740
+ }
741
+ function previewText(value) {
742
+ return typeof value === "string" && value.trim() ? value.trim() : "-";
743
+ }
744
+ function renderMonitorPreviewText(payload) {
745
+ const updates = Array.isArray(payload.updates) ? payload.updates : [];
746
+ const charge = _nullishCoalesce(asRecord(payload.charge), () => ( {}));
747
+ const lines = [
748
+ `Preview of ${previewText(payload.tool)}: ${updates.length} of ${String(_nullishCoalesce(payload.limit, () => ( "?")))} requested matches.`
749
+ ];
750
+ for (const item of updates) {
751
+ const content = _nullishCoalesce(asRecord(_optionalChain([asRecord, 'call', _21 => _21(item), 'optionalAccess', _22 => _22.content])), () => ( {}));
752
+ lines.push(
753
+ ` ${previewText(content.full_name)} | ${previewText(content.title)} | started ${previewText(content.start_date)} | ${previewText(content.seniority)}`
754
+ );
755
+ }
756
+ const credits = typeof charge.credits === "number" ? charge.credits : 0;
757
+ const perUpdate = charge.credits_per_update;
758
+ switch (charge.status) {
759
+ case "queued":
760
+ case "settled":
761
+ lines.push(
762
+ payload.replayed === true ? `Saved result: this preview charged ${credits} credits when it first ran, and this rerun charged nothing.` : `Charged ${credits} credits (${String(perUpdate)} per returned update).`
763
+ );
764
+ break;
765
+ case "free":
766
+ lines.push("No matches came back, so nothing was charged.");
767
+ break;
768
+ case "unconfirmed":
769
+ lines.push(
770
+ `The charge could not be confirmed: up to ${credits} credits may still post. Check deepline billing usage.`
771
+ );
772
+ break;
773
+ default:
774
+ lines.push("This preview was not charged.");
775
+ }
776
+ if (Array.isArray(payload.ignored_fields) && payload.ignored_fields.length) {
777
+ lines.push(
778
+ `Ignored for the preview: ${payload.ignored_fields.join(", ")} (still used on deploy).`
779
+ );
780
+ }
781
+ if (typeof payload.note === "string") lines.push(payload.note);
782
+ lines.push(`Preview key: ${String(payload.idempotency_key)}`);
783
+ return `${lines.join("\n")}
784
+ `;
785
+ }
786
+ async function handleMonitorsPreview(definition, options) {
787
+ const body = resolveMonitorJsonBody({
788
+ positional: definition,
789
+ file: options.file,
790
+ argLabel: "<definition>",
791
+ command: "deepline monitors preview"
792
+ });
793
+ const limit = options.limit === void 0 ? void 0 : Number(options.limit);
794
+ if (limit !== void 0 && !Number.isInteger(limit)) {
795
+ throw new MonitorsUsageError("--limit must be a whole number from 1 to 3.");
796
+ }
797
+ const wantsJson = _chunkWTTHH2K3js.shouldEmitJson.call(void 0, options.json);
798
+ if (options.idempotencyKey === void 0 && wantsJson) {
799
+ throw new MonitorsUsageError(
800
+ "--json requires --idempotency-key <key>. Choose a new key for each new preview and keep it: rerunning with the same key returns the result without paying again."
801
+ );
802
+ }
803
+ const idempotencyKey = _nullishCoalesce(options.idempotencyKey, () => ( `monitor-preview-${_crypto.randomUUID.call(void 0, )}`));
804
+ const progress = _chunkNOHA3SZJjs.createCliProgress.call(void 0, !wantsJson);
805
+ progress.phase(`Preview key: ${idempotencyKey}`);
806
+ try {
807
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.preview(
808
+ body,
809
+ { idempotencyKey, ...limit === void 0 ? {} : { limit } }
810
+ );
811
+ progress.complete();
812
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, {
813
+ json: options.json,
814
+ text: renderMonitorPreviewText(payload)
815
+ });
816
+ } catch (error) {
817
+ progress.fail();
818
+ if (previewRetryableWithSameKey(error)) {
819
+ process.stderr.write(
820
+ `To get this preview's result without paying again, rerun the same command with --idempotency-key ${idempotencyKey}. A new key runs a new, paid preview.
821
+ `
822
+ );
823
+ }
824
+ throw error;
825
+ }
826
+ }
827
+ var MONITOR_PREVIEW_SAME_KEY_RETRY_CODES = /* @__PURE__ */ new Set([
828
+ "EXECUTION_IN_PROGRESS",
829
+ "EXECUTION_RECOVERY_UNAVAILABLE",
830
+ "BILLING_UNAVAILABLE",
831
+ "monitor_preview_rate_limited",
832
+ "monitor_preview_provider_unavailable"
833
+ ]);
834
+ var MONITOR_PREVIEW_NEW_KEY_CODES = /* @__PURE__ */ new Set([
835
+ "EXECUTION_OUTCOME_UNKNOWN",
836
+ "monitor_preview_outcome_unknown"
837
+ ]);
838
+ function previewRetryableWithSameKey(error) {
839
+ if (!(error instanceof _chunkDIAWYWT5js.DeeplineError)) return true;
840
+ const code = error.code;
841
+ if (code !== void 0 && MONITOR_PREVIEW_NEW_KEY_CODES.has(code)) {
842
+ return false;
843
+ }
844
+ if (code !== void 0 && MONITOR_PREVIEW_SAME_KEY_RETRY_CODES.has(code)) {
845
+ return true;
846
+ }
847
+ const status = error.statusCode;
848
+ return status === void 0 || status === 0 || status >= 500;
737
849
  }
738
850
  async function handleMonitorsDeploy(definition, options) {
739
851
  const body = resolveMonitorJsonBody({
@@ -742,15 +854,15 @@ async function handleMonitorsDeploy(definition, options) {
742
854
  argLabel: "<definition>",
743
855
  command: "deepline monitors deploy"
744
856
  });
745
- const client = new (0, _chunk7VRWERTMjs.DeeplineClient)();
857
+ const client = new (0, _chunkDMTAFWMSjs.DeeplineClient)();
746
858
  const definitionArg = body;
747
859
  if (options.dryRun) {
748
860
  const payload2 = await client.monitors.deploy(definitionArg, {
749
861
  dryRun: true
750
862
  });
751
863
  const valid = payload2.valid !== false;
752
- const hasIdentityConflict = Boolean(_optionalChain([asRecord, 'call', _21 => _21(payload2), 'optionalAccess', _22 => _22.identity_conflict]));
753
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
864
+ const hasIdentityConflict = Boolean(_optionalChain([asRecord, 'call', _23 => _23(payload2), 'optionalAccess', _24 => _24.identity_conflict]));
865
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
754
866
  { dry_run: true, ...payload2 },
755
867
  { json: options.json, text: renderMonitorDeployPlan(payload2) }
756
868
  );
@@ -760,7 +872,7 @@ async function handleMonitorsDeploy(definition, options) {
760
872
  return;
761
873
  }
762
874
  const payload = await client.monitors.deploy(definitionArg);
763
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, {
875
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, {
764
876
  json: options.json,
765
877
  text: renderMonitorDeployCompletion(payload)
766
878
  });
@@ -772,29 +884,29 @@ async function handleMonitorsSync(definition, options) {
772
884
  argLabel: "<definition>",
773
885
  command: "deepline monitors sync"
774
886
  });
775
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.sync(body, {
887
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.sync(body, {
776
888
  ...options.dryRun ? { dryRun: true } : {},
777
889
  idempotencyKey: _nullishCoalesce(options.idempotencyKey, () => ( monitorJobIdempotencyKey("scalar-sync", void 0)))
778
890
  });
779
891
  if (options.dryRun) {
780
892
  const plan = payload;
781
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
893
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
782
894
  { dry_run: true, ...plan },
783
895
  { json: options.json, text: renderMonitorDeployPlan(plan) }
784
896
  );
785
897
  return;
786
898
  }
787
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, {
899
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, {
788
900
  json: options.json,
789
901
  text: renderMonitorJob(payload)
790
902
  });
791
903
  }
792
904
  async function handleScalarMonitorLifecycle(action, key, options) {
793
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors[action](key, {
905
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors[action](key, {
794
906
  ...options.dryRun ? { dryRun: true } : {},
795
907
  idempotencyKey: _nullishCoalesce(options.idempotencyKey, () => ( monitorJobIdempotencyKey(`${action}-${key}`, void 0)))
796
908
  });
797
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, {
909
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, {
798
910
  json: options.json,
799
911
  text: options.dryRun ? void 0 : renderMonitorJob(payload)
800
912
  });
@@ -808,14 +920,14 @@ function fleetIntegerOption(raw, flag) {
808
920
  return value;
809
921
  }
810
922
  function fleetIdempotencyKey(operation, supplied) {
811
- const normalized = _optionalChain([supplied, 'optionalAccess', _23 => _23.trim, 'call', _24 => _24()]);
923
+ const normalized = _optionalChain([supplied, 'optionalAccess', _25 => _25.trim, 'call', _26 => _26()]);
812
924
  if (supplied !== void 0 && !normalized) {
813
925
  throw new MonitorsUsageError("--idempotency-key must not be empty.");
814
926
  }
815
927
  return _nullishCoalesce(normalized, () => ( `monitor-fleet-${operation}-${_crypto.randomUUID.call(void 0, )}`));
816
928
  }
817
929
  function monitorJobIdempotencyKey(operation, supplied) {
818
- const normalized = _optionalChain([supplied, 'optionalAccess', _25 => _25.trim, 'call', _26 => _26()]);
930
+ const normalized = _optionalChain([supplied, 'optionalAccess', _27 => _27.trim, 'call', _28 => _28()]);
819
931
  if (supplied !== void 0 && !normalized) {
820
932
  throw new MonitorsUsageError("--idempotency-key must not be empty.");
821
933
  }
@@ -883,11 +995,11 @@ async function handleMonitorJobBatchDeploy(options, idempotencyKey) {
883
995
  lint.issues.filter((issue) => issue.severity === "error").map((issue) => `${issue.path || "batch"}: ${issue.message}`).join("; ")
884
996
  );
885
997
  }
886
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.batch.deploy(
998
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.batch.deploy(
887
999
  lint.normalized.monitors,
888
1000
  { idempotencyKey }
889
1001
  );
890
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
1002
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
891
1003
  {
892
1004
  ...payload,
893
1005
  idempotency_key: idempotencyKey,
@@ -897,7 +1009,7 @@ async function handleMonitorJobBatchDeploy(options, idempotencyKey) {
897
1009
  );
898
1010
  }
899
1011
  function namedBatchIdempotencyKey(batchId, intent, supplied) {
900
- return _optionalChain([supplied, 'optionalAccess', _27 => _27.trim, 'call', _28 => _28()]) || `monitor-batch-${intent}-${batchId}-${_crypto.randomUUID.call(void 0, )}`;
1012
+ return _optionalChain([supplied, 'optionalAccess', _29 => _29.trim, 'call', _30 => _30()]) || `monitor-batch-${intent}-${batchId}-${_crypto.randomUUID.call(void 0, )}`;
901
1013
  }
902
1014
  async function handleNamedMonitorBatchSync(batchId, options) {
903
1015
  if (!options.file) {
@@ -920,7 +1032,7 @@ async function handleNamedMonitorBatchSync(batchId, options) {
920
1032
  );
921
1033
  }
922
1034
  if (options.dryRun) {
923
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
1035
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
924
1036
  {
925
1037
  ok: true,
926
1038
  dry_run: true,
@@ -937,7 +1049,7 @@ async function handleNamedMonitorBatchSync(batchId, options) {
937
1049
  "sync",
938
1050
  options.idempotencyKey
939
1051
  );
940
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.batches.sync(
1052
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.batches.sync(
941
1053
  batchId,
942
1054
  lint.normalized.monitors,
943
1055
  {
@@ -945,14 +1057,14 @@ async function handleNamedMonitorBatchSync(batchId, options) {
945
1057
  ...parsedGeneration === void 0 ? {} : { expectedGeneration: parsedGeneration }
946
1058
  }
947
1059
  );
948
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
1060
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
949
1061
  { ...payload, idempotency_key: idempotencyKey },
950
1062
  { json: options.json, text: renderMonitorJob(payload) }
951
1063
  );
952
1064
  }
953
1065
  async function handleNamedMonitorBatchLifecycle(batchId, intent, options) {
954
1066
  if (options.dryRun) {
955
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
1067
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
956
1068
  {
957
1069
  ok: true,
958
1070
  dry_run: true,
@@ -968,17 +1080,17 @@ async function handleNamedMonitorBatchLifecycle(batchId, intent, options) {
968
1080
  intent,
969
1081
  options.idempotencyKey
970
1082
  );
971
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.batches[intent](batchId, {
1083
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.batches[intent](batchId, {
972
1084
  idempotencyKey
973
1085
  });
974
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
1086
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
975
1087
  { ...payload, idempotency_key: idempotencyKey },
976
1088
  { json: options.json, text: renderMonitorJob(payload) }
977
1089
  );
978
1090
  }
979
1091
  async function handleNamedMonitorBatchGet(batchId, options) {
980
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.batches.get(batchId);
981
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, {
1092
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.batches.get(batchId);
1093
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, {
982
1094
  json: options.json,
983
1095
  text: renderMonitorJob(payload)
984
1096
  });
@@ -992,7 +1104,7 @@ async function handleMonitorBatchLint(options) {
992
1104
  const result = _chunkIF75RD6Ujs.lintMonitorBatchInput.call(void 0,
993
1105
  readMonitorDefinitionsJsonFile(options.file)
994
1106
  );
995
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
1107
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
996
1108
  {
997
1109
  ok: !result.issues.some((issue) => issue.severity === "error"),
998
1110
  ...result.normalized ? { normalized: result.normalized } : {},
@@ -1012,7 +1124,7 @@ async function handleMonitorFleetLint(options) {
1012
1124
  const result = _chunkC374C22Yjs.lintMonitorFleetInput.call(void 0,
1013
1125
  readMonitorDefinitionsJsonFile(options.file)
1014
1126
  );
1015
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
1127
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
1016
1128
  {
1017
1129
  ok: !result.issues.some((issue) => issue.severity === "error"),
1018
1130
  ...result.normalized ? { normalized: result.normalized } : {},
@@ -1024,32 +1136,32 @@ async function handleMonitorFleetLint(options) {
1024
1136
  process.exitCode = 2;
1025
1137
  }
1026
1138
  async function handleMonitorJobGet(jobId, options) {
1027
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.jobs.get(jobId);
1028
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, {
1139
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.jobs.get(jobId);
1140
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, {
1029
1141
  json: options.json,
1030
1142
  text: renderMonitorJob(payload)
1031
1143
  });
1032
1144
  }
1033
1145
  async function handleMonitorJobWait(jobId, options) {
1034
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.jobs.wait(jobId, {
1146
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.jobs.wait(jobId, {
1035
1147
  timeoutMs: fleetTimeoutMs(options.timeout),
1036
1148
  pollIntervalMs: FLEET_POLL_INTERVAL_MS
1037
1149
  });
1038
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, {
1150
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, {
1039
1151
  json: options.json,
1040
1152
  text: renderMonitorJob(payload)
1041
1153
  });
1042
1154
  }
1043
1155
  async function handleMonitorJobLogs(jobId, options) {
1044
1156
  const limit = options.limit ? fleetIntegerOption(options.limit, "--limit") : void 0;
1045
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.jobs.logs(jobId, {
1157
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.jobs.logs(jobId, {
1046
1158
  ...limit === void 0 ? {} : { limit }
1047
1159
  });
1048
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, { json: options.json });
1160
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, { json: options.json });
1049
1161
  }
1050
1162
  async function handleMonitorJobCancel(jobId, options) {
1051
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.jobs.cancel(jobId);
1052
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, {
1163
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.jobs.cancel(jobId);
1164
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, {
1053
1165
  json: options.json,
1054
1166
  text: renderMonitorJob(payload)
1055
1167
  });
@@ -1347,7 +1459,7 @@ function renderFleetDeactivatePlan(payload, fleetId) {
1347
1459
  `;
1348
1460
  }
1349
1461
  function reportFleetState(payload, error, options) {
1350
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
1462
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
1351
1463
  {
1352
1464
  ...payload,
1353
1465
  code: error.code,
@@ -1364,7 +1476,7 @@ Next: ${error.next}
1364
1476
  process.exitCode = monitorsErrorExitCode(error);
1365
1477
  }
1366
1478
  function fleetSourceTable(value) {
1367
- const [schema, table, extra] = _nullishCoalesce(_optionalChain([value, 'optionalAccess', _29 => _29.trim, 'call', _30 => _30(), 'access', _31 => _31.split, 'call', _32 => _32(".")]), () => ( []));
1479
+ const [schema, table, extra] = _nullishCoalesce(_optionalChain([value, 'optionalAccess', _31 => _31.trim, 'call', _32 => _32(), 'access', _33 => _33.split, 'call', _34 => _34(".")]), () => ( []));
1368
1480
  if (!schema || !table || extra || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(schema) || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(table)) {
1369
1481
  throw new MonitorsUsageError(
1370
1482
  "--source must be a Customer DB table in schema.table form."
@@ -1373,7 +1485,7 @@ function fleetSourceTable(value) {
1373
1485
  return { schema, table };
1374
1486
  }
1375
1487
  function fleetColumnName(value, flag) {
1376
- const name = _optionalChain([value, 'optionalAccess', _33 => _33.trim, 'call', _34 => _34()]);
1488
+ const name = _optionalChain([value, 'optionalAccess', _35 => _35.trim, 'call', _36 => _36()]);
1377
1489
  if (!name || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
1378
1490
  throw new MonitorsUsageError(`${flag} must be a SQL column identifier.`);
1379
1491
  }
@@ -1418,13 +1530,13 @@ async function handleMonitorFleetsInit(fleetId, options) {
1418
1530
  }
1419
1531
  const source = fleetSourceTable(options.source);
1420
1532
  const key = fleetColumnName(options.key, "--key");
1421
- const keyType = _nullishCoalesce(_optionalChain([options, 'access', _35 => _35.keyType, 'optionalAccess', _36 => _36.trim, 'call', _37 => _37()]), () => ( "text"));
1533
+ const keyType = _nullishCoalesce(_optionalChain([options, 'access', _37 => _37.keyType, 'optionalAccess', _38 => _38.trim, 'call', _39 => _39()]), () => ( "text"));
1422
1534
  if (!["text", "uuid", "int4", "int8"].includes(keyType)) {
1423
1535
  throw new MonitorsUsageError(
1424
1536
  "--key-type must be text, uuid, int4, or int8."
1425
1537
  );
1426
1538
  }
1427
- const tool = _optionalChain([options, 'access', _38 => _38.tool, 'optionalAccess', _39 => _39.trim, 'call', _40 => _40()]);
1539
+ const tool = _optionalChain([options, 'access', _40 => _40.tool, 'optionalAccess', _41 => _41.trim, 'call', _42 => _42()]);
1428
1540
  if (!tool) throw new MonitorsUsageError("--tool is required.");
1429
1541
  if (!options.payload) {
1430
1542
  throw new MonitorsUsageError(
@@ -1433,7 +1545,7 @@ async function handleMonitorFleetsInit(fleetId, options) {
1433
1545
  }
1434
1546
  const payload = parseJsonObjectArg(options.payload, "--payload");
1435
1547
  const where = options.where ? parseJsonObjectArg(options.where, "--where") : void 0;
1436
- const out = _optionalChain([options, 'access', _41 => _41.out, 'optionalAccess', _42 => _42.trim, 'call', _43 => _43()]);
1548
+ const out = _optionalChain([options, 'access', _43 => _43.out, 'optionalAccess', _44 => _44.trim, 'call', _45 => _45()]);
1437
1549
  if (!out) throw new MonitorsUsageError("--out is required.");
1438
1550
  const authoredDefinition = {
1439
1551
  version: 2,
@@ -1462,7 +1574,7 @@ async function handleMonitorFleetsInit(fleetId, options) {
1462
1574
  _fs.writeFileSync.call(void 0, file, `${JSON.stringify(definition, null, 2)}
1463
1575
  `, "utf8");
1464
1576
  const next = `deepline monitors fleets deploy --file ${fleetShellArg(file)} --dry-run`;
1465
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
1577
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
1466
1578
  { schemaVersion: 2, file, definition, next },
1467
1579
  {
1468
1580
  json: options.json,
@@ -1502,8 +1614,8 @@ function fleetSyncCommandLine(target, options) {
1502
1614
  }
1503
1615
  async function handleMonitorFleetsSync(target, options, idempotencyKey) {
1504
1616
  const fileDefinitions = options.file ? readMonitorDefinitionsJsonFile(options.file) : void 0;
1505
- const usesDefinition = options.file !== void 0 || _optionalChain([target, 'optionalAccess', _44 => _44.trim, 'call', _45 => _45(), 'access', _46 => _46.startsWith, 'call', _47 => _47("{")]) === true;
1506
- if (!usesDefinition && !_optionalChain([target, 'optionalAccess', _48 => _48.trim, 'call', _49 => _49()])) {
1617
+ const usesDefinition = options.file !== void 0 || _optionalChain([target, 'optionalAccess', _46 => _46.trim, 'call', _47 => _47(), 'access', _48 => _48.startsWith, 'call', _49 => _49("{")]) === true;
1618
+ if (!usesDefinition && !_optionalChain([target, 'optionalAccess', _50 => _50.trim, 'call', _51 => _51()])) {
1507
1619
  throw new MonitorsUsageError(
1508
1620
  "sync needs a fleet: pass --file fleet.json to apply a definition, or <fleet-id> to re-plan the stored one.\n deepline monitors fleets sync --file fleet.json --dry-run\n deepline monitors fleets sync <fleet-id> --dry-run"
1509
1621
  );
@@ -1524,7 +1636,7 @@ async function handleMonitorFleetsSync(target, options, idempotencyKey) {
1524
1636
  'The Fleet definition has no id. Add a top-level "id" and re-run.'
1525
1637
  );
1526
1638
  }
1527
- const client = new (0, _chunk7VRWERTMjs.DeeplineClient)();
1639
+ const client = new (0, _chunkDMTAFWMSjs.DeeplineClient)();
1528
1640
  const payload = await client.monitors.fleets.sync(
1529
1641
  _nullishCoalesce(definition, () => ( fleetId)),
1530
1642
  {
@@ -1546,7 +1658,7 @@ async function handleMonitorFleetsSync(target, options, idempotencyKey) {
1546
1658
  }
1547
1659
  const accepted = { ...payload, idempotency_key: idempotencyKey };
1548
1660
  if (!options.wait || options.dryRun) {
1549
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, accepted, {
1661
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, accepted, {
1550
1662
  json: options.json,
1551
1663
  text: renderFleetSync(payload, {
1552
1664
  fleetId,
@@ -1572,7 +1684,7 @@ async function handleMonitorFleetsSync(target, options, idempotencyKey) {
1572
1684
  const status = fleetStatus(final);
1573
1685
  const summary = renderFleetGet(final);
1574
1686
  if (status === "converged") {
1575
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, envelope, { json: options.json, text: summary });
1687
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, envelope, { json: options.json, text: summary });
1576
1688
  return;
1577
1689
  }
1578
1690
  const driftCommand = `deepline monitors fleets get ${fleetShellArg(fleetId)} --drift`;
@@ -1605,14 +1717,14 @@ async function handleMonitorFleetsGet(fleetId, options) {
1605
1717
  );
1606
1718
  }
1607
1719
  const limit = options.limit === void 0 ? void 0 : fleetIntegerOption(options.limit, "--limit");
1608
- const client = new (0, _chunk7VRWERTMjs.DeeplineClient)();
1720
+ const client = new (0, _chunkDMTAFWMSjs.DeeplineClient)();
1609
1721
  const payload = await client.monitors.fleets.get(fleetId, {
1610
1722
  ...options.drift ? { drift: true } : {},
1611
1723
  ...limit !== void 0 ? { limit } : {}
1612
1724
  });
1613
1725
  const text = fleetId ? renderFleetGet(payload) : renderFleetList(payload);
1614
1726
  if (!options.check) {
1615
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, { json: options.json, text });
1727
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, { json: options.json, text });
1616
1728
  return;
1617
1729
  }
1618
1730
  const statuses = fleetId ? [fleetStatus(payload)] : (Array.isArray(payload.fleets) ? payload.fleets : []).map(
@@ -1620,7 +1732,7 @@ async function handleMonitorFleetsGet(fleetId, options) {
1620
1732
  );
1621
1733
  const unconverged = statuses.filter((status) => status !== "converged");
1622
1734
  if (unconverged.length === 0) {
1623
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, { json: options.json, text });
1735
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, { json: options.json, text });
1624
1736
  return;
1625
1737
  }
1626
1738
  const target = _nullishCoalesce(fleetId, () => ( "<fleet-id>"));
@@ -1659,13 +1771,13 @@ async function handleMonitorFleetsReactivate(fleetId, options, idempotencyKey) {
1659
1771
  ${fleetReactivateCommandLine(fleetId, options)}`
1660
1772
  );
1661
1773
  }
1662
- const client = new (0, _chunk7VRWERTMjs.DeeplineClient)();
1774
+ const client = new (0, _chunkDMTAFWMSjs.DeeplineClient)();
1663
1775
  const payload = await client.monitors.fleets.reactivate(fleetId, {
1664
1776
  idempotencyKey
1665
1777
  });
1666
1778
  const accepted = { ...payload, idempotency_key: idempotencyKey };
1667
1779
  if (!options.wait) {
1668
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, accepted, {
1780
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, accepted, {
1669
1781
  json: options.json,
1670
1782
  text: `Fleet ${fleetId} \u2014 ${readMonitorState(payload) ? `state ${readMonitorState(payload)}` : "reactivation accepted"}
1671
1783
  idempotency key ${idempotencyKey}
@@ -1688,7 +1800,7 @@ async function handleMonitorFleetsReactivate(fleetId, options, idempotencyKey) {
1688
1800
  const envelope = { ...accepted, ...final };
1689
1801
  const text = renderFleetGet(final);
1690
1802
  if (fleetStatus(final) === "converged") {
1691
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, envelope, { json: options.json, text });
1803
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, envelope, { json: options.json, text });
1692
1804
  return;
1693
1805
  }
1694
1806
  reportFleetState(
@@ -1730,7 +1842,7 @@ async function confirmFleetDeactivate(fleetId, plan) {
1730
1842
  }
1731
1843
  }
1732
1844
  async function handleMonitorFleetsDeactivate(fleetId, options, idempotencyKey) {
1733
- const client = new (0, _chunk7VRWERTMjs.DeeplineClient)();
1845
+ const client = new (0, _chunkDMTAFWMSjs.DeeplineClient)();
1734
1846
  if (options.dryRun) {
1735
1847
  const plan = await client.monitors.fleets.deactivate(fleetId, {
1736
1848
  dryRun: true,
@@ -1740,7 +1852,7 @@ async function handleMonitorFleetsDeactivate(fleetId, options, idempotencyKey) {
1740
1852
  command: "deepline monitors fleets deactivate",
1741
1853
  mutation: "fleet deactivate"
1742
1854
  });
1743
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, plan, {
1855
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, plan, {
1744
1856
  json: options.json,
1745
1857
  text: renderFleetDeactivatePlan(plan, fleetId)
1746
1858
  });
@@ -1778,7 +1890,7 @@ Preview the blast radius first:
1778
1890
  });
1779
1891
  const accepted = { ...payload, idempotency_key: idempotencyKey };
1780
1892
  if (payload.already === true) {
1781
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, accepted, {
1893
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, accepted, {
1782
1894
  json: options.json,
1783
1895
  text: `Fleet ${fleetId} is already deactivated.
1784
1896
  `
@@ -1790,7 +1902,7 @@ Preview the blast radius first:
1790
1902
  ` + (fleetServerNext(payload) ? `Next: ${fleetServerNext(payload)}
1791
1903
  ` : "");
1792
1904
  if (!options.wait) {
1793
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, accepted, {
1905
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, accepted, {
1794
1906
  json: options.json,
1795
1907
  text: acceptedText
1796
1908
  });
@@ -1812,7 +1924,7 @@ Preview the blast radius first:
1812
1924
  const envelope = { ...accepted, ...final };
1813
1925
  const summary = renderFleetGet(final);
1814
1926
  if (fleetStatus(final) === "deactivated") {
1815
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, envelope, { json: options.json, text: summary });
1927
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, envelope, { json: options.json, text: summary });
1816
1928
  return;
1817
1929
  }
1818
1930
  reportFleetState(
@@ -1843,7 +1955,7 @@ function handleMonitorFleetsOverview(options) {
1843
1955
  "Agent notes:",
1844
1956
  ...MONITOR_FLEET_AGENT_NOTES.map((note) => ` ${note}`)
1845
1957
  ];
1846
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
1958
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
1847
1959
  {
1848
1960
  schemaVersion: 1,
1849
1961
  lifecycle: MONITOR_FLEET_LIFECYCLE,
@@ -1900,8 +2012,8 @@ function renderMonitorGet(payload) {
1900
2012
  }
1901
2013
  for (const raw of Array.isArray(guidance.documentation) ? guidance.documentation : []) {
1902
2014
  const doc = asRecord(raw);
1903
- const label = asString(_optionalChain([doc, 'optionalAccess', _50 => _50.label]));
1904
- const url = asString(_optionalChain([doc, 'optionalAccess', _51 => _51.url]));
2015
+ const label = asString(_optionalChain([doc, 'optionalAccess', _52 => _52.label]));
2016
+ const url = asString(_optionalChain([doc, 'optionalAccess', _53 => _53.url]));
1905
2017
  if (label && url) lines.push(` Docs: ${label} \u2014 ${url}`);
1906
2018
  }
1907
2019
  const payloadExample = asRecord(guidance.payload_example);
@@ -1918,20 +2030,20 @@ function renderMonitorGet(payload) {
1918
2030
  );
1919
2031
  }
1920
2032
  const monitorSpec = asRecord(payload.monitor_spec);
1921
- if (_optionalChain([monitorSpec, 'optionalAccess', _52 => _52.available]) === false) {
2033
+ if (_optionalChain([monitorSpec, 'optionalAccess', _54 => _54.available]) === false) {
1922
2034
  lines.push(
1923
2035
  "",
1924
2036
  `Monitor spec: unavailable \u2014 ${_nullishCoalesce(asString(monitorSpec.message), () => ( "use the stored definition and check before an update."))}`
1925
2037
  );
1926
2038
  }
1927
- const specFields = Array.isArray(_optionalChain([monitorSpec, 'optionalAccess', _53 => _53.fields])) ? monitorSpec.fields.flatMap((value) => {
2039
+ const specFields = Array.isArray(_optionalChain([monitorSpec, 'optionalAccess', _55 => _55.fields])) ? monitorSpec.fields.flatMap((value) => {
1928
2040
  const field = asRecord(value);
1929
- const path = asString(_optionalChain([field, 'optionalAccess', _54 => _54.path]));
1930
- const description = asString(_optionalChain([field, 'optionalAccess', _55 => _55.description]));
1931
- const semantics = asString(_optionalChain([field, 'optionalAccess', _56 => _56.semantics]));
1932
- const applicability = asString(_optionalChain([field, 'optionalAccess', _57 => _57.applicability]));
1933
- const grammar = asRecord(_optionalChain([field, 'optionalAccess', _58 => _58.grammar]));
1934
- const grammarSyntax = asString(_optionalChain([grammar, 'optionalAccess', _59 => _59.syntax]));
2041
+ const path = asString(_optionalChain([field, 'optionalAccess', _56 => _56.path]));
2042
+ const description = asString(_optionalChain([field, 'optionalAccess', _57 => _57.description]));
2043
+ const semantics = asString(_optionalChain([field, 'optionalAccess', _58 => _58.semantics]));
2044
+ const applicability = asString(_optionalChain([field, 'optionalAccess', _59 => _59.applicability]));
2045
+ const grammar = asRecord(_optionalChain([field, 'optionalAccess', _60 => _60.grammar]));
2046
+ const grammarSyntax = asString(_optionalChain([grammar, 'optionalAccess', _61 => _61.syntax]));
1935
2047
  return path ? [
1936
2048
  {
1937
2049
  path,
@@ -1967,10 +2079,10 @@ function renderMonitorGet(payload) {
1967
2079
  const name = _nullishCoalesce(asString(play.name), () => ( "unnamed Play"));
1968
2080
  const listener = asString(play.listener_key);
1969
2081
  const health = asRecord(play.consumer_health);
1970
- const runStatus = asString(_optionalChain([health, 'optionalAccess', _60 => _60.last_run_status]));
1971
- const lastDelivery = asFiniteNumber(_optionalChain([health, 'optionalAccess', _61 => _61.last_delivery_at]));
1972
- const runId = asString(_optionalChain([health, 'optionalAccess', _62 => _62.last_run_id]));
1973
- const error = asString(_optionalChain([health, 'optionalAccess', _63 => _63.last_error]));
2082
+ const runStatus = asString(_optionalChain([health, 'optionalAccess', _62 => _62.last_run_status]));
2083
+ const lastDelivery = asFiniteNumber(_optionalChain([health, 'optionalAccess', _63 => _63.last_delivery_at]));
2084
+ const runId = asString(_optionalChain([health, 'optionalAccess', _64 => _64.last_run_id]));
2085
+ const error = asString(_optionalChain([health, 'optionalAccess', _65 => _65.last_error]));
1974
2086
  lines.push(` ${name}${listener ? ` (listener: ${listener})` : ""}:`);
1975
2087
  lines.push(
1976
2088
  ` Latest delivered event: ${lastDelivery !== void 0 ? new Date(lastDelivery).toISOString() : "never"}`,
@@ -1997,14 +2109,14 @@ function renderMonitorGet(payload) {
1997
2109
  );
1998
2110
  }
1999
2111
  }
2000
- if (_optionalChain([dependents, 'optionalAccess', _64 => _64.truncated]) === true) {
2112
+ if (_optionalChain([dependents, 'optionalAccess', _66 => _66.truncated]) === true) {
2001
2113
  lines.push(" Results are truncated.");
2002
2114
  }
2003
2115
  return `${lines.join("\n")}
2004
2116
  `;
2005
2117
  }
2006
2118
  async function handleMonitorsGet(key, options) {
2007
- const client = new (0, _chunk7VRWERTMjs.DeeplineClient)();
2119
+ const client = new (0, _chunkDMTAFWMSjs.DeeplineClient)();
2008
2120
  const payload = await client.monitors.get(key);
2009
2121
  const boundPlays = Array.isArray(payload.bound_plays) ? payload.bound_plays : null;
2010
2122
  const dependents = boundPlays ? {
@@ -2012,24 +2124,24 @@ async function handleMonitorsGet(key, options) {
2012
2124
  truncated: payload.consumer_health_truncated === true
2013
2125
  } : await client.monitors.dependents(key);
2014
2126
  const detail = { ...payload, dependents };
2015
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, detail, {
2127
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, detail, {
2016
2128
  json: options.json,
2017
2129
  text: renderMonitorGet(detail)
2018
2130
  });
2019
2131
  }
2020
2132
  async function handleMonitorsTest(key, payload, options) {
2021
2133
  const explicitPayload = parseJsonObjectArg(payload, "<payload>");
2022
- const result = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.test(key, explicitPayload);
2134
+ const result = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.test(key, explicitPayload);
2023
2135
  const text = `Monitor diagnostic for ${key}: ${result.accepted === true ? "accepted" : "rejected"}
2024
2136
  mode: validation_only (no rows written, credits spent, or Plays dispatched)
2025
2137
  persisted rows: ${_nullishCoalesce(asFiniteNumber(result.persisted_rows), () => ( 0))}
2026
2138
  dispatched bound Plays: ${_nullishCoalesce(asFiniteNumber(result.dispatched_bound_plays), () => ( 0))}
2027
2139
  `;
2028
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, result, { json: options.json, text });
2140
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, result, { json: options.json, text });
2029
2141
  }
2030
2142
  async function handleMonitorsValidate(key, options) {
2031
- const result = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.validate(key);
2032
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, result, { json: options.json });
2143
+ const result = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.validate(key);
2144
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, result, { json: options.json });
2033
2145
  if (result.valid === false) process.exitCode = 7;
2034
2146
  }
2035
2147
  async function confirmMonitorDelete(key) {
@@ -2047,14 +2159,14 @@ async function confirmMonitorDelete(key) {
2047
2159
  }
2048
2160
  }
2049
2161
  async function handleMonitorsDelete(key, options) {
2050
- const client = new (0, _chunk7VRWERTMjs.DeeplineClient)();
2162
+ const client = new (0, _chunkDMTAFWMSjs.DeeplineClient)();
2051
2163
  if (options.dryRun) {
2052
2164
  const payload2 = await client.monitors.delete(key, { dryRun: true });
2053
2165
  assertMonitorDryRunAcknowledged(payload2, {
2054
2166
  command: "deepline monitors delete",
2055
2167
  mutation: "delete"
2056
2168
  });
2057
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload2, {
2169
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload2, {
2058
2170
  json: options.json,
2059
2171
  text: renderMonitorDeletePlan(payload2, key)
2060
2172
  });
@@ -2074,7 +2186,7 @@ async function handleMonitorsDelete(key, options) {
2074
2186
  }
2075
2187
  }
2076
2188
  const payload = await client.monitors.delete(key);
2077
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, { json: options.json });
2189
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, { json: options.json });
2078
2190
  }
2079
2191
  async function handleMonitorsUpdate(key, patch, options) {
2080
2192
  const body = resolveMonitorJsonBody({
@@ -2083,29 +2195,29 @@ async function handleMonitorsUpdate(key, patch, options) {
2083
2195
  argLabel: "<patch>",
2084
2196
  command: `deepline monitors update ${key}`
2085
2197
  });
2086
- const payload = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.update(key, body);
2087
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, { json: options.json });
2198
+ const payload = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.update(key, body);
2199
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, { json: options.json });
2088
2200
  }
2089
2201
  async function handleMonitorsReactivate(key, options) {
2090
- const client = new (0, _chunk7VRWERTMjs.DeeplineClient)();
2202
+ const client = new (0, _chunkDMTAFWMSjs.DeeplineClient)();
2091
2203
  if (options.dryRun) {
2092
2204
  const payload2 = await client.monitors.reactivate(key, { dryRun: true });
2093
2205
  assertMonitorDryRunAcknowledged(payload2, {
2094
2206
  command: "deepline monitors reactivate",
2095
2207
  mutation: "reactivate"
2096
2208
  });
2097
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload2, {
2209
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload2, {
2098
2210
  json: options.json,
2099
2211
  text: renderMonitorReactivatePlan(payload2, key)
2100
2212
  });
2101
2213
  return;
2102
2214
  }
2103
2215
  const payload = await client.monitors.reactivate(key);
2104
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, payload, { json: options.json });
2216
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, payload, { json: options.json });
2105
2217
  }
2106
2218
  var MONITOR_VERB_POLL_INTERVAL_MS = 2e3;
2107
2219
  function monitorHealthLine(health) {
2108
- if (_optionalChain([health, 'access', _65 => _65.refresh, 'optionalAccess', _66 => _66.state]) === "running") {
2220
+ if (_optionalChain([health, 'access', _67 => _67.refresh, 'optionalAccess', _68 => _68.state]) === "running") {
2109
2221
  return `refreshing whole scope \xB7 scanned ${health.scanned} so far`;
2110
2222
  }
2111
2223
  const alignmentRequired = _nullishCoalesce(health.alignment_required, () => ( 0));
@@ -2150,7 +2262,7 @@ async function watchMonitorHealth(input) {
2150
2262
  while (Date.now() < deadlineAt) {
2151
2263
  const unresolved = last.observed.unknown + last.observed.unset;
2152
2264
  const alignmentRequired = _nullishCoalesce(last.alignment_required, () => ( 0));
2153
- if (_optionalChain([last, 'access', _67 => _67.refresh, 'optionalAccess', _68 => _68.state]) !== "running" && !last.truncated && last.needs_repair === 0 && (unresolved === 0 || alignmentRequired === unresolved)) {
2265
+ if (_optionalChain([last, 'access', _69 => _69.refresh, 'optionalAccess', _70 => _70.state]) !== "running" && !last.truncated && last.needs_repair === 0 && (unresolved === 0 || alignmentRequired === unresolved)) {
2154
2266
  return last;
2155
2267
  }
2156
2268
  await new Promise(
@@ -2162,13 +2274,13 @@ async function watchMonitorHealth(input) {
2162
2274
  return last;
2163
2275
  }
2164
2276
  function monitorHealthText(health) {
2165
- const partial = _optionalChain([health, 'access', _69 => _69.refresh, 'optionalAccess', _70 => _70.state]) === "running" ? " (refreshing \u2014 counts below are not final)" : health.truncated ? " (partial \u2014 scope larger than one read)" : "";
2277
+ const partial = _optionalChain([health, 'access', _71 => _71.refresh, 'optionalAccess', _72 => _72.state]) === "running" ? " (refreshing \u2014 counts below are not final)" : health.truncated ? " (partial \u2014 scope larger than one read)" : "";
2166
2278
  const unauditedMonitors = _nullishCoalesce(health.unaudited_monitors, () => ( []));
2167
2279
  const lines = [
2168
2280
  `scope: ${_nullishCoalesce(health.scope.fleet_id, () => ( "workspace"))}${partial}`,
2169
2281
  monitorHealthLine(health)
2170
2282
  ];
2171
- if ((_nullishCoalesce(_optionalChain([health, 'access', _71 => _71.batch_operations, 'optionalAccess', _72 => _72.length]), () => ( 0))) > 0) {
2283
+ if ((_nullishCoalesce(_optionalChain([health, 'access', _73 => _73.batch_operations, 'optionalAccess', _74 => _74.length]), () => ( 0))) > 0) {
2172
2284
  lines.push("");
2173
2285
  lines.push("batch work in progress:");
2174
2286
  for (const operation of _nullishCoalesce(health.batch_operations, () => ( []))) {
@@ -2223,8 +2335,8 @@ function monitorHealthText(health) {
2223
2335
  `;
2224
2336
  }
2225
2337
  async function handleMonitorsAudit(options) {
2226
- const client = new (0, _chunk7VRWERTMjs.DeeplineClient)();
2227
- const fleetId = _optionalChain([options, 'access', _73 => _73.fleet, 'optionalAccess', _74 => _74.trim, 'call', _75 => _75()]) || void 0;
2338
+ const client = new (0, _chunkDMTAFWMSjs.DeeplineClient)();
2339
+ const fleetId = _optionalChain([options, 'access', _75 => _75.fleet, 'optionalAccess', _76 => _76.trim, 'call', _77 => _77()]) || void 0;
2228
2340
  const scope = fleetId ? { fleetId } : {};
2229
2341
  let result = await client.monitors.audit(scope);
2230
2342
  const passes = [result.audit];
@@ -2267,7 +2379,7 @@ async function handleMonitorsAudit(options) {
2267
2379
  "",
2268
2380
  monitorHealthText(health)
2269
2381
  ].join("\n");
2270
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
2382
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
2271
2383
  { ...result, audit: { ...result.audit, totals }, health },
2272
2384
  { json: options.json, text }
2273
2385
  );
@@ -2275,15 +2387,15 @@ async function handleMonitorsAudit(options) {
2275
2387
  async function handleMonitorsRepair(options) {
2276
2388
  return await handleMonitorBatch("repair", {
2277
2389
  ...options,
2278
- ..._optionalChain([options, 'access', _76 => _76.fleet, 'optionalAccess', _77 => _77.trim, 'call', _78 => _78()]) ? {} : { target: "needs-repair" }
2390
+ ..._optionalChain([options, 'access', _78 => _78.fleet, 'optionalAccess', _79 => _79.trim, 'call', _80 => _80()]) ? {} : { target: "needs-repair" }
2279
2391
  });
2280
2392
  }
2281
2393
  async function handleMonitorsHealth(options) {
2282
- const fleetId = _optionalChain([options, 'access', _79 => _79.fleet, 'optionalAccess', _80 => _80.trim, 'call', _81 => _81()]) || void 0;
2283
- const health = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.health(
2394
+ const fleetId = _optionalChain([options, 'access', _81 => _81.fleet, 'optionalAccess', _82 => _82.trim, 'call', _83 => _83()]) || void 0;
2395
+ const health = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.health(
2284
2396
  fleetId ? { fleetId } : {}
2285
2397
  );
2286
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, health, {
2398
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, health, {
2287
2399
  json: options.json,
2288
2400
  text: monitorHealthText(health)
2289
2401
  });
@@ -2291,8 +2403,8 @@ async function handleMonitorsHealth(options) {
2291
2403
  function monitorBatchScope(options, kind) {
2292
2404
  const selectors = [
2293
2405
  options.target ? "target" : null,
2294
- _optionalChain([options, 'access', _82 => _82.fleet, 'optionalAccess', _83 => _83.trim, 'call', _84 => _84()]) ? "fleet" : null,
2295
- _optionalChain([options, 'access', _85 => _85.keys, 'optionalAccess', _86 => _86.trim, 'call', _87 => _87()]) ? "keys" : null
2406
+ _optionalChain([options, 'access', _84 => _84.fleet, 'optionalAccess', _85 => _85.trim, 'call', _86 => _86()]) ? "fleet" : null,
2407
+ _optionalChain([options, 'access', _87 => _87.keys, 'optionalAccess', _88 => _88.trim, 'call', _89 => _89()]) ? "keys" : null
2296
2408
  ].filter((value) => value !== null);
2297
2409
  if (selectors.length === 0 && kind === "audit") {
2298
2410
  return { kind: "target", target: "all" };
@@ -2303,7 +2415,7 @@ function monitorBatchScope(options, kind) {
2303
2415
  );
2304
2416
  }
2305
2417
  if (options.target) return { kind: "target", target: options.target };
2306
- if (_optionalChain([options, 'access', _88 => _88.fleet, 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()]))
2418
+ if (_optionalChain([options, 'access', _90 => _90.fleet, 'optionalAccess', _91 => _91.trim, 'call', _92 => _92()]))
2307
2419
  return { kind: "fleet", fleetId: options.fleet.trim() };
2308
2420
  const monitorKeys = (_nullishCoalesce(options.keys, () => ( ""))).split(",").map((key) => key.trim()).filter(Boolean);
2309
2421
  if (monitorKeys.length === 0) {
@@ -2314,7 +2426,7 @@ function monitorBatchScope(options, kind) {
2314
2426
  return { kind: "keys", monitorKeys };
2315
2427
  }
2316
2428
  function monitorBatchIdempotencyKey(kind, value) {
2317
- return _optionalChain([value, 'optionalAccess', _91 => _91.trim, 'call', _92 => _92()]) || `monitor-batch-${kind}-${_crypto.randomUUID.call(void 0, )}`;
2429
+ return _optionalChain([value, 'optionalAccess', _93 => _93.trim, 'call', _94 => _94()]) || `monitor-batch-${kind}-${_crypto.randomUUID.call(void 0, )}`;
2318
2430
  }
2319
2431
  function isCanonicalBatchJsonDocument(raw) {
2320
2432
  try {
@@ -2327,7 +2439,7 @@ function isCanonicalBatchJsonDocument(raw) {
2327
2439
  }
2328
2440
  }
2329
2441
  async function handleMonitorBatchDeploy(options) {
2330
- if (!_optionalChain([options, 'access', _93 => _93.file, 'optionalAccess', _94 => _94.trim, 'call', _95 => _95()])) {
2442
+ if (!_optionalChain([options, 'access', _95 => _95.file, 'optionalAccess', _96 => _96.trim, 'call', _97 => _97()])) {
2331
2443
  throw new MonitorsUsageError(
2332
2444
  "monitors batch deploy requires --file <monitors.ndjson>."
2333
2445
  );
@@ -2357,14 +2469,14 @@ async function handleMonitorBatchDeploy(options) {
2357
2469
  "deploy",
2358
2470
  options.idempotencyKey
2359
2471
  );
2360
- const result = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.batch.submit({
2472
+ const result = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.batch.submit({
2361
2473
  kind: "deploy",
2362
2474
  manifestNdjson,
2363
2475
  dryRun: options.dryRun === true,
2364
2476
  idempotencyKey
2365
2477
  });
2366
2478
  const operation = result.operation;
2367
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
2479
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
2368
2480
  { ...result, idempotency_key: idempotencyKey },
2369
2481
  {
2370
2482
  json: options.json,
@@ -2383,7 +2495,7 @@ async function handleMonitorBatch(kind, options) {
2383
2495
  );
2384
2496
  }
2385
2497
  const scope = monitorBatchScope(options, kind);
2386
- if (kind === "deactivate" && scope.kind === "target" && !_optionalChain([options, 'access', _96 => _96.reason, 'optionalAccess', _97 => _97.trim, 'call', _98 => _98()])) {
2498
+ if (kind === "deactivate" && scope.kind === "target" && !_optionalChain([options, 'access', _98 => _98.reason, 'optionalAccess', _99 => _99.trim, 'call', _100 => _100()])) {
2387
2499
  throw new MonitorsUsageError(
2388
2500
  "monitors batch deactivate --target requires --reason (for example insufficient_balance or billing_failure). Omit --reason with --keys for a customer-requested teardown."
2389
2501
  );
@@ -2392,11 +2504,11 @@ async function handleMonitorBatch(kind, options) {
2392
2504
  kind,
2393
2505
  options.idempotencyKey
2394
2506
  );
2395
- const result = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.batch.submit({
2507
+ const result = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.batch.submit({
2396
2508
  kind,
2397
2509
  scope,
2398
2510
  dryRun: options.dryRun === true,
2399
- ..._optionalChain([options, 'access', _99 => _99.reason, 'optionalAccess', _100 => _100.trim, 'call', _101 => _101()]) ? { deactivationReason: options.reason.trim() } : {},
2511
+ ..._optionalChain([options, 'access', _101 => _101.reason, 'optionalAccess', _102 => _102.trim, 'call', _103 => _103()]) ? { deactivationReason: options.reason.trim() } : {},
2400
2512
  idempotencyKey
2401
2513
  });
2402
2514
  const operation = result.operation;
@@ -2405,14 +2517,14 @@ async function handleMonitorBatch(kind, options) {
2405
2517
  `state ${operation.state} \xB7 retry key ${idempotencyKey}`,
2406
2518
  `inspect: deepline monitors batch get ${operation.runId}`
2407
2519
  ].join("\n");
2408
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0,
2520
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0,
2409
2521
  { ...result, idempotency_key: idempotencyKey },
2410
2522
  { json: options.json, text: `${text}
2411
2523
  ` }
2412
2524
  );
2413
2525
  }
2414
2526
  async function handleMonitorBatchGet(operationId, options) {
2415
- const result = await new (0, _chunk7VRWERTMjs.DeeplineClient)().monitors.batch.get(operationId, {
2527
+ const result = await new (0, _chunkDMTAFWMSjs.DeeplineClient)().monitors.batch.get(operationId, {
2416
2528
  ...options.cursor ? { cursor: options.cursor } : {}
2417
2529
  });
2418
2530
  const summary = _nullishCoalesce(result.operation.summary, () => ( {}));
@@ -2424,7 +2536,7 @@ async function handleMonitorBatchGet(operationId, options) {
2424
2536
  `results ${result.results.page.length}${result.results.isDone ? "" : " (more; pass --cursor)"}`
2425
2537
  ] : []
2426
2538
  ].join("\n");
2427
- _chunk6G6KX7I7js.printCommandEnvelope.call(void 0, result, { json: options.json, text: `${text}
2539
+ _chunkWTTHH2K3js.printCommandEnvelope.call(void 0, result, { json: options.json, text: `${text}
2428
2540
  ` });
2429
2541
  }
2430
2542
  function registerMonitorsCommands(program) {
@@ -2807,6 +2919,10 @@ Notes:
2807
2919
  \`deepline describe deepline_native.company_radar\`.
2808
2920
  Operational controls are Deepline-managed. Bind downstream automation in a
2809
2921
  Play with sqlListeners; monitor definitions never name Plays.
2922
+ When the definition can be previewed, the response includes a "preview"
2923
+ object with its price and the exact \`monitors preview\` command. A preview
2924
+ costs credits; check itself never does. "available": false means this
2925
+ definition has no preview. No "preview" field means the tool has none.
2810
2926
 
2811
2927
  Examples:
2812
2928
  deepline monitors check '{"key":"job-openings","tool":"deepline_native.company_radar","payload":{"domain":"stripe.com","radar_type":"company_job_openings"}}'
@@ -2818,6 +2934,42 @@ Examples:
2818
2934
  "Read the definition JSON from a file, or - for stdin"
2819
2935
  )
2820
2936
  ).action(monitorsAction(handleMonitorsCheck));
2937
+ withJsonOption(
2938
+ monitors.command("preview [definition]").description(
2939
+ "Sample a few recent matches for a monitor definition before deploying it. Costs credits."
2940
+ ).addHelpText(
2941
+ "after",
2942
+ `
2943
+ Notes:
2944
+ Takes the same definition as check and deploy. Nothing is created.
2945
+ Available today only for deepline_native.company_radar with radar_type
2946
+ company_new_hires. Any other tool or radar type answers
2947
+ monitor_preview_unavailable without spending anything: run check, then deploy.
2948
+ Each returned match costs the same as one match the deployed monitor would
2949
+ deliver. An empty preview is free. --limit is 1-3 (default 3).
2950
+ Run previews one at a time. A preview is a sample: it can miss matches, and
2951
+ an empty one does not mean the monitor will find nothing. Read "updates".
2952
+ payload.updates_since is ignored for the preview and still used on deploy.
2953
+ Deploy the same definition without --limit when the sample looks right.
2954
+ Every preview has a key, printed before it is sent. If the connection drops,
2955
+ rerun with --idempotency-key <key> to get the original result without paying
2956
+ again. A new key runs a new, paid preview. --json prints nothing before the
2957
+ result, so it requires --idempotency-key: choose the key yourself and keep it.
2958
+
2959
+ Examples:
2960
+ deepline monitors preview '{"key":"eng-hires","tool":"deepline_native.company_radar","payload":{"domain":"stripe.com","radar_type":"company_new_hires","departments":["Engineering"]}}'
2961
+ deepline monitors preview --file monitor.json --limit 2
2962
+ deepline monitors preview --file monitor.json --idempotency-key monitor-preview-<key>
2963
+ deepline monitors preview --file monitor.json --idempotency-key eng-hires-sample-1 --json
2964
+ `
2965
+ ).option(
2966
+ "-f, --file <path>",
2967
+ "Read the definition JSON from a file, or - for stdin"
2968
+ ).option("--limit <n>", "Matches to sample, 1-3 (default 3)").option(
2969
+ "--idempotency-key <key>",
2970
+ "Recover an earlier preview's result without paying again. Required with --json"
2971
+ )
2972
+ ).action(monitorsAction(handleMonitorsPreview));
2821
2973
  withJsonOption(
2822
2974
  monitors.command("deploy [definition]").description("Deploy a monitor from a definition.").addHelpText(
2823
2975
  "after",