deepline 0.3.495 → 0.3.497

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 (156) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +91 -1
  2. package/dist/bundling-sources/sdk/src/plays/run-request.ts +5 -19
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/shared_libs/monitors/billing/credit-recovery.ts +79 -0
  5. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
  6. package/dist/bundling-sources/shared_libs/observability/scheduled-work-control.ts +19 -3
  7. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +7 -1
  8. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-gateway-drain.ts +110 -66
  9. package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +57 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +15 -0
  11. package/dist/bundling-sources/shared_libs/plays/docflow.ts +28 -12
  12. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +26 -6
  13. package/dist/bundling-sources/shared_libs/product-notifications/slack-payload.ts +4 -1
  14. package/dist/cli/auth-553ZBCPJ.js +43 -0
  15. package/dist/cli/{auth-B2YUNFQ6.mjs → auth-OAKBFUQD.mjs} +5 -5
  16. package/dist/cli/{billing-5TR7ZBZM.mjs → billing-AM6D2KN5.mjs} +7 -7
  17. package/dist/cli/{billing-2Q7TMNRE.js → billing-FUB6HQZ5.js} +80 -80
  18. package/dist/cli/{chunk-RBBOUPME.mjs → chunk-3DHPKENA.mjs} +1 -1
  19. package/dist/cli/{chunk-XR6RCBB3.mjs → chunk-3IVAGF4P.mjs} +10 -10
  20. package/dist/cli/{chunk-TUAEM76Y.js → chunk-3KG2FUU4.js} +108 -65
  21. package/dist/cli/{chunk-SC5GHGFD.mjs → chunk-4MR7LZXF.mjs} +2 -2
  22. package/dist/cli/{chunk-DFK5IJMT.mjs → chunk-5GXYXU45.mjs} +1 -1
  23. package/dist/cli/{chunk-H5L2Q2GI.mjs → chunk-5IBHSACU.mjs} +2 -2
  24. package/dist/cli/{chunk-CTFR52JC.js → chunk-6TA2H7CY.js} +26 -26
  25. package/dist/cli/{chunk-ZBQBH4IT.js → chunk-77IAUCTB.js} +3 -3
  26. package/dist/cli/{chunk-XAOLMEN5.js → chunk-7FFNSYMJ.js} +14 -14
  27. package/dist/cli/{chunk-XKYQR3QK.js → chunk-7RBIOOCQ.js} +3 -3
  28. package/dist/cli/{chunk-LQKZG5RN.js → chunk-A66Y2LCW.js} +53 -53
  29. package/dist/cli/{chunk-Z33PZUWG.js → chunk-B4Q3EBQX.js} +5 -5
  30. package/dist/cli/{chunk-T4PGA6UD.js → chunk-BBHGJE73.js} +1 -1
  31. package/dist/cli/{chunk-UDFO2MWA.js → chunk-BRUDMG56.js} +41 -41
  32. package/dist/cli/{chunk-DVQHG6AM.mjs → chunk-CS2AEAD6.mjs} +63 -11
  33. package/dist/cli/{chunk-Y2DUGUUU.js → chunk-DKSTMQ3F.js} +21 -21
  34. package/dist/cli/{chunk-PKV5CD3W.js → chunk-EQR5O2D2.js} +87 -35
  35. package/dist/cli/{chunk-L5ZXEYTQ.mjs → chunk-EWQ3KY5U.mjs} +6 -6
  36. package/dist/cli/{chunk-JRBQC6L4.mjs → chunk-FISH2MI2.mjs} +2 -2
  37. package/dist/cli/{chunk-PEIOQKTA.js → chunk-FVS5MJQ5.js} +3 -3
  38. package/dist/cli/{chunk-TSKVPEVZ.mjs → chunk-HRODQDTB.mjs} +46 -3
  39. package/dist/cli/{chunk-7YNZRALI.mjs → chunk-IURXJPGH.mjs} +3 -3
  40. package/dist/cli/{chunk-TCNILHMS.js → chunk-JDFYCHNV.js} +5 -5
  41. package/dist/cli/{chunk-TMO7W4P2.mjs → chunk-KFJV3BZX.mjs} +1 -1
  42. package/dist/cli/{chunk-S2QARJLX.mjs → chunk-KUX3HYJI.mjs} +1 -1
  43. package/dist/cli/{chunk-KG2FUYWB.mjs → chunk-LPCK5KK5.mjs} +3 -3
  44. package/dist/cli/{chunk-TFMV3NKL.mjs → chunk-M2WIEW2E.mjs} +1 -1
  45. package/dist/cli/{chunk-I66IWCY4.mjs → chunk-MBOAXLWC.mjs} +4 -4
  46. package/dist/cli/{chunk-CAWE3MS2.js → chunk-OEI6HXMK.js} +16 -16
  47. package/dist/cli/{chunk-UKGOZOTT.js → chunk-OWDK2PVH.js} +8 -8
  48. package/dist/cli/{chunk-7LLUJQM5.mjs → chunk-SJID5WMV.mjs} +4 -4
  49. package/dist/cli/{chunk-WVL5HGUG.js → chunk-SJM7MKOE.js} +2 -2
  50. package/dist/cli/{chunk-PHO53W67.js → chunk-SLS3HUVC.js} +4 -4
  51. package/dist/cli/{chunk-MG3WST3Z.mjs → chunk-TGAYN34A.mjs} +2 -2
  52. package/dist/cli/{chunk-SR6VS5PG.mjs → chunk-THD6KA67.mjs} +4 -4
  53. package/dist/cli/{chunk-OFBDI5S3.mjs → chunk-UETGYJYH.mjs} +2 -2
  54. package/dist/cli/{chunk-B3ROCZ5Y.js → chunk-UV7AT2D4.js} +2 -2
  55. package/dist/cli/{chunk-XX6PRYFI.js → chunk-V2EVSEUD.js} +16 -16
  56. package/dist/cli/{chunk-ZB6UYG5I.mjs → chunk-VMOVB2FN.mjs} +5 -5
  57. package/dist/cli/{chunk-UMFZQREB.js → chunk-WKCMARFR.js} +94 -94
  58. package/dist/cli/{chunk-ACVT5LPN.js → chunk-WXW7YJDO.js} +53 -53
  59. package/dist/cli/{chunk-FLJSK32S.mjs → chunk-WZ3A35ZD.mjs} +1 -1
  60. package/dist/cli/{chunk-MAMEKGLI.js → chunk-XLYJ7MJX.js} +7 -7
  61. package/dist/cli/{chunk-CKLJAQIV.mjs → chunk-XNLXHU6L.mjs} +5 -5
  62. package/dist/cli/{chunk-FC4JGTFC.mjs → chunk-XX7WLKOQ.mjs} +1 -1
  63. package/dist/cli/{chunk-HJ5LYO6U.mjs → chunk-YQ66NC4J.mjs} +2 -2
  64. package/dist/cli/{chunk-7OGADAAA.js → chunk-YUEFDOME.js} +6 -6
  65. package/dist/cli/{chunk-5OKQPDYJ.js → chunk-ZLYKN4AJ.js} +7 -7
  66. package/dist/cli/{csv-DZQ77T67.js → csv-PMBYKVUU.js} +13 -13
  67. package/dist/cli/{csv-5UQXKWLE.mjs → csv-U2GOFP3M.mjs} +4 -4
  68. package/dist/cli/{db-F62BVFTP.mjs → db-DKFOTZGZ.mjs} +7 -7
  69. package/dist/cli/{db-JIPLUHA6.js → db-GREVTMIR.js} +28 -28
  70. package/dist/cli/describe-BL5NNHV5.js +50 -0
  71. package/dist/cli/{describe-J7KYHONJ.mjs → describe-SWXA6L62.mjs} +18 -18
  72. package/dist/cli/describe-core.d.mts +3 -3
  73. package/dist/cli/describe-core.d.ts +3 -3
  74. package/dist/cli/{executions-XQ4FNJ27.js → executions-2RRAESQK.js} +9 -9
  75. package/dist/cli/{executions-XB4F2KZD.mjs → executions-EBRFC5JR.mjs} +7 -7
  76. package/dist/cli/{feedback-5CR4CJ6W.mjs → feedback-4A57QLX2.mjs} +4 -4
  77. package/dist/cli/{feedback-Q6JRCMDV.js → feedback-N6ML7IRH.js} +8 -8
  78. package/dist/cli/{git-P5WBBUT3.mjs → git-6D2WQPOS.mjs} +5 -5
  79. package/dist/cli/git-7TSX5V57.js +25 -0
  80. package/dist/cli/index.js +137 -137
  81. package/dist/cli/index.mjs +40 -40
  82. package/dist/cli/{legacy-noops-H5JJVYZ2.mjs → legacy-noops-CL5QWXGH.mjs} +5 -5
  83. package/dist/cli/{legacy-noops-EJAB6III.js → legacy-noops-DXRJARNC.js} +8 -8
  84. package/dist/cli/{monitors-QPFAT2J5.mjs → monitors-SGMEGGJO.mjs} +190 -8
  85. package/dist/cli/{monitors-7DOGM7RO.js → monitors-XWKDVHYL.js} +318 -136
  86. package/dist/cli/{org-BH7ATDIJ.mjs → org-55BI5RQF.mjs} +7 -7
  87. package/dist/cli/{org-QOBB4IN3.js → org-QKQ57PDN.js} +73 -73
  88. package/dist/cli/{pages-PLTE54KM.js → pages-FOIR5UH4.js} +19 -19
  89. package/dist/cli/{pages-PJH2TXZQ.mjs → pages-LM4QACOM.mjs} +7 -7
  90. package/dist/cli/{play-ULTJ3LPA.mjs → play-7VA26O6E.mjs} +36 -61
  91. package/dist/cli/{play-XZAPTF3T.js → play-S44FXGD7.js} +634 -659
  92. package/dist/cli/{providers-6NUTRVE4.mjs → providers-QAVIR5E2.mjs} +7 -7
  93. package/dist/cli/{providers-SKXLW7M3.js → providers-RDSHID7C.js} +10 -10
  94. package/dist/cli/{quickstart-JFCIIGII.js → quickstart-EREQPM3G.js} +6 -6
  95. package/dist/cli/{quickstart-5HMJMXVT.mjs → quickstart-IL4HQYE4.mjs} +4 -4
  96. package/dist/cli/{run-2BJZPY4K.mjs → run-4XZNJR7N.mjs} +23 -23
  97. package/dist/cli/{run-BRAXLCBC.js → run-TBUUV5EG.js} +37 -37
  98. package/dist/cli/search-GCANFVVZ.js +32 -0
  99. package/dist/cli/{search-IDXSB2CV.mjs → search-SYT5UT5G.mjs} +8 -8
  100. package/dist/cli/{search-output-CJ4TNYF7.js → search-output-5F3EEQ34.js} +6 -6
  101. package/dist/cli/{search-output-AATMH4QG.mjs → search-output-Y3IKZ3TX.mjs} +4 -4
  102. package/dist/cli/{secrets-UQNEJSNG.mjs → secrets-AKAU2N3K.mjs} +7 -7
  103. package/dist/cli/{secrets-6SMKTBFT.js → secrets-PZWJ2ES5.js} +16 -16
  104. package/dist/cli/{sessions-W3KU4Q4X.js → sessions-UMHA7K23.js} +6 -6
  105. package/dist/cli/{sessions-MHTUVPSR.mjs → sessions-Z5C26IS7.mjs} +5 -5
  106. package/dist/cli/{settings-KNYJ6GXK.mjs → settings-S5BM3SVI.mjs} +12 -12
  107. package/dist/cli/{settings-BA52NEU5.js → settings-WGJYWTJZ.js} +79 -79
  108. package/dist/cli/{setup-D5HCJAVU.js → setup-6K6ERKOH.js} +49 -49
  109. package/dist/cli/{setup-TLTZ2YCO.mjs → setup-E4HRXP2X.mjs} +9 -9
  110. package/dist/cli/{skills-DPLM4EGS.mjs → skills-HIZA7YAN.mjs} +7 -7
  111. package/dist/cli/skills-J3GQHHHL.js +36 -0
  112. package/dist/cli/{tools-I4ZOJV23.mjs → tools-FS5S6BT7.mjs} +17 -17
  113. package/dist/cli/tools-RZYKMOUX.js +57 -0
  114. package/dist/cli/{update-VIFS7IK5.mjs → update-4CJPTG3L.mjs} +9 -9
  115. package/dist/cli/update-CATZW7GA.js +34 -0
  116. package/dist/cli/{workflow-7REPOHXM.js → workflow-TYSZ5JWS.js} +18 -18
  117. package/dist/cli/{workflow-TAQBNDV7.mjs → workflow-UMSXOIOS.mjs} +8 -8
  118. package/dist/{client-CKVH6tmp.d.ts → client-Cj3UqrCZ.d.ts} +1 -1
  119. package/dist/{client-BDT_LwuM.d.mts → client-DSCTVVRj.d.mts} +1 -1
  120. package/dist/{client-core-CEixe_C0.d.mts → client-core-B-8DTIN1.d.mts} +44 -3
  121. package/dist/{client-core-RS-d-vtY.d.ts → client-core-dI4KTuWS.d.ts} +44 -3
  122. package/dist/{compiler-manifest-CPEF48NM.d.mts → compiler-manifest-DlXDyndN.d.mts} +2 -0
  123. package/dist/{compiler-manifest-CPEF48NM.d.ts → compiler-manifest-DlXDyndN.d.ts} +2 -0
  124. package/dist/{errors-BWbPzqwo.d.mts → errors-BtriA2ld.d.mts} +1 -1
  125. package/dist/{errors-B-PJXveg.d.ts → errors-DmcLykM7.d.ts} +1 -1
  126. package/dist/{index-CvVxPpE8.d.ts → index--Jw-slHY.d.ts} +1 -1
  127. package/dist/{index-BJ8AA1F9.d.mts → index-DI0sR_fX.d.mts} +1 -1
  128. package/dist/index.d.mts +7 -7
  129. package/dist/index.d.ts +7 -7
  130. package/dist/index.js +10 -10
  131. package/dist/index.mjs +7 -7
  132. package/dist/install-integrity.json +110 -110
  133. package/dist/plays/bundle-play-file.d.mts +3 -3
  134. package/dist/plays/bundle-play-file.d.ts +3 -3
  135. package/dist/plays/play-description.d.mts +2 -2
  136. package/dist/plays/play-description.d.ts +2 -2
  137. package/dist/plays/run-request.d.mts +2 -2
  138. package/dist/plays/run-request.d.ts +2 -2
  139. package/dist/plays/run-request.js +2 -2
  140. package/dist/plays/run-request.mjs +1 -1
  141. package/dist/release.d.mts +1 -1
  142. package/dist/release.d.ts +1 -1
  143. package/dist/release.js +2 -2
  144. package/dist/release.mjs +1 -1
  145. package/dist/server.d.mts +4 -4
  146. package/dist/server.d.ts +4 -4
  147. package/dist/server.js +6 -6
  148. package/dist/server.mjs +4 -4
  149. package/package.json +1 -1
  150. package/dist/cli/auth-GAOWVOK4.js +0 -43
  151. package/dist/cli/describe-BA4RAZ7J.js +0 -50
  152. package/dist/cli/git-EAO432S2.js +0 -25
  153. package/dist/cli/search-4MU2G6HV.js +0 -32
  154. package/dist/cli/skills-SVUWVXCE.js +0 -36
  155. package/dist/cli/tools-RJSP76HX.js +0 -57
  156. package/dist/cli/update-YT6JPIC6.js +0 -34
@@ -1,10 +1,10 @@
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 _chunkZ33PZUWGjs = require('./chunk-Z33PZUWG.js');
5
- require('./chunk-TUAEM76Y.js');
4
+ var _chunkB4Q3EBQXjs = require('./chunk-B4Q3EBQX.js');
5
+ require('./chunk-3KG2FUU4.js');
6
6
  require('./chunk-E4CABWXL.js');
7
- require('./chunk-PKV5CD3W.js');
7
+ require('./chunk-EQR5O2D2.js');
8
8
  require('./chunk-NMU3VR5U.js');
9
9
  require('./chunk-XDVT3GOM.js');
10
10
 
@@ -17,15 +17,15 @@ require('./chunk-UNEMDKXN.js');
17
17
  var _chunkIF75RD6Ujs = require('./chunk-IF75RD6U.js');
18
18
 
19
19
 
20
- var _chunkXKYQR3QKjs = require('./chunk-XKYQR3QK.js');
20
+ var _chunk7RBIOOCQjs = require('./chunk-7RBIOOCQ.js');
21
21
 
22
22
 
23
23
 
24
24
 
25
25
 
26
- var _chunkMAMEKGLIjs = require('./chunk-MAMEKGLI.js');
27
- require('./chunk-ZBQBH4IT.js');
28
- require('./chunk-PHO53W67.js');
26
+ var _chunkXLYJ7MJXjs = require('./chunk-XLYJ7MJX.js');
27
+ require('./chunk-77IAUCTB.js');
28
+ require('./chunk-SLS3HUVC.js');
29
29
 
30
30
 
31
31
  var _chunkALJJRZNJjs = require('./chunk-ALJJRZNJ.js');
@@ -33,7 +33,7 @@ require('./chunk-XNYIZMNQ.js');
33
33
 
34
34
 
35
35
  var _chunkDIAWYWT5js = require('./chunk-DIAWYWT5.js');
36
- require('./chunk-T4PGA6UD.js');
36
+ require('./chunk-BBHGJE73.js');
37
37
  require('./chunk-OG64RBAC.js');
38
38
  require('./chunk-COGTRVWW.js');
39
39
 
@@ -111,10 +111,10 @@ function reportMonitorsFailure(error, options) {
111
111
  const exitCode = monitorsErrorExitCode(error);
112
112
  const next = monitorsFailureNextCommand(error, exitCode, options);
113
113
  const retrySafe = exitCode === 5 && _optionalChain([options, 'optionalAccess', _9 => _9.retryCommand]) !== void 0;
114
- const wantsJson = _chunkMAMEKGLIjs.shouldEmitJson.call(void 0, process.argv.includes("--json"));
114
+ const wantsJson = _chunkXLYJ7MJXjs.shouldEmitJson.call(void 0, process.argv.includes("--json"));
115
115
  if (wantsJson) {
116
- const payload = _chunkMAMEKGLIjs.errorToJsonPayload.call(void 0, error);
117
- _chunkMAMEKGLIjs.printJson.call(void 0, {
116
+ const payload = _chunkXLYJ7MJXjs.errorToJsonPayload.call(void 0, error);
117
+ _chunkXLYJ7MJXjs.printJson.call(void 0, {
118
118
  ok: false,
119
119
  exitCode,
120
120
  ...next ? { next } : {},
@@ -529,14 +529,14 @@ Preview the plan first with:
529
529
  );
530
530
  }
531
531
  async function handleMonitorsStatus(options) {
532
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.status();
532
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.status();
533
533
  const hasAccess = payload.has_access === true;
534
534
  const reason = typeof payload.reason === "string" && payload.reason.trim() ? payload.reason.trim() : void 0;
535
535
  const text = hasAccess ? `\u2713 You have access to Deepline Monitors${reason ? `
536
536
  ${reason}` : ""}
537
537
  ` : `\u2717 No access to Deepline Monitors${reason ? ` \u2014 ${reason}` : ""}
538
538
  `;
539
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
539
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
540
540
  { has_access: hasAccess, ...reason ? { reason } : {} },
541
541
  { json: options.json, text }
542
542
  );
@@ -602,14 +602,14 @@ async function handleMonitorsAvailable(toolId, options) {
602
602
  }
603
603
  }
604
604
  const tool = _nullishCoalesce(toolId, () => ( options.tool));
605
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.available(tool, {
605
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.available(tool, {
606
606
  ...options.provider ? { provider: options.provider } : {},
607
607
  ...options.search ? { search: options.search } : {},
608
608
  ...options.limit ? { limit: options.limit } : {},
609
609
  ...options.full ? { full: true } : {},
610
610
  ...options.compact ? { compact: true } : {}
611
611
  });
612
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, {
612
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
613
613
  json: options.json,
614
614
  // Human list view shows id + name + deployed_count ("deployed: N") so
615
615
  // can-deploy vs already-deployed is visible in one view. Describing a
@@ -712,14 +712,14 @@ async function handleMonitorsList(options) {
712
712
  "`--compact` is deprecated and now does nothing; returning the complete monitor records.\n"
713
713
  );
714
714
  }
715
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.list({
715
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.list({
716
716
  ...state ? { state } : {},
717
717
  ...options.status ? { status: options.status } : {},
718
718
  ...options.limit ? { limit: options.limit } : {},
719
719
  ...options.cursor ? { cursor: options.cursor } : {},
720
720
  ...options.includeConsumers ? { includeConsumers: true } : {}
721
721
  });
722
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, {
722
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
723
723
  json: options.json,
724
724
  text: renderDeployedListText(
725
725
  payload,
@@ -728,6 +728,121 @@ async function handleMonitorsList(options) {
728
728
  )
729
729
  });
730
730
  }
731
+ var LEDGER_STATUS_LABELS = {
732
+ active: "Active",
733
+ setting_up: "Setting up",
734
+ paused_credits: "Paused \xB7 out of credits",
735
+ paused_cap: "Paused \xB7 spending cap",
736
+ paused_billing: "Paused \xB7 billing issue",
737
+ stopped: "Stopped"
738
+ };
739
+ function ledgerPlayLabel(play) {
740
+ const name = _nullishCoalesce(asString(play.name), () => ( "Play"));
741
+ const notes = [];
742
+ if (play.failing === true) notes.push("failing");
743
+ if (play.state === "blocked") notes.push("blocked");
744
+ else if (play.state === "inactive") notes.push("inactive");
745
+ if (play.applicability === "some") notes.push("some findings");
746
+ if (play.update_only === true) notes.push("updates only");
747
+ return notes.length > 0 ? `${name} (${notes.join(", ")})` : name;
748
+ }
749
+ var LEDGER_WINDOW_LABELS = {
750
+ "1d": "today",
751
+ "7d": "7d",
752
+ "30d": "30d",
753
+ "90d": "90d",
754
+ "1y": "1y"
755
+ };
756
+ function ledgerFindingsText(findings, windowLabel) {
757
+ const count = asFiniteNumber(_optionalChain([findings, 'optionalAccess', _21 => _21.count]));
758
+ if (count === void 0) return "findings not counted yet";
759
+ const since = asString(_optionalChain([findings, 'optionalAccess', _22 => _22.counting_since]));
760
+ return `${count.toLocaleString("en-US")} ${count === 1 ? "finding" : "findings"} ${windowLabel}${since ? ` (counting since ${since})` : ""}`;
761
+ }
762
+ function renderMonitorLedgerText(payload) {
763
+ const monitors = Array.isArray(payload.monitors) ? payload.monitors : null;
764
+ if (!monitors) return void 0;
765
+ const window = _nullishCoalesce(asString(_optionalChain([asRecord, 'call', _23 => _23(payload.applied), 'optionalAccess', _24 => _24.window])), () => ( "30d"));
766
+ const windowLabel = _nullishCoalesce(LEDGER_WINDOW_LABELS[window], () => ( window));
767
+ const lines = [];
768
+ const failing = Array.isArray(payload.failing_plays) ? payload.failing_plays : [];
769
+ for (const raw of failing) {
770
+ const play = asRecord(raw);
771
+ if (!play) continue;
772
+ lines.push(
773
+ `! ${_nullishCoalesce(asString(play.name), () => ( "A Play"))} is failing: ${_nullishCoalesce(asString(play.error), () => ( "latest run failed"))}${asString(play.run_id) ? ` (run ${asString(play.run_id)})` : ""}`
774
+ );
775
+ }
776
+ const total = asFiniteNumber(payload.total);
777
+ lines.push(
778
+ monitors.length === 0 ? "No monitors matched." : total !== void 0 && total > monitors.length ? `Monitors (${monitors.length} of ${total}):` : `Monitors (${monitors.length}):`
779
+ );
780
+ for (const raw of monitors) {
781
+ const entry = asRecord(raw);
782
+ const key = entry ? asString(entry.key) : void 0;
783
+ if (!entry || !key) continue;
784
+ const signal = asRecord(entry.signal);
785
+ const subject = asRecord(entry.subject);
786
+ const status = _nullishCoalesce(asString(entry.ledger_status), () => ( "unknown"));
787
+ const plays = asRecord(entry.plays);
788
+ const shown = Array.isArray(_optionalChain([plays, 'optionalAccess', _25 => _25.shown])) ? plays.shown : [];
789
+ const more = _nullishCoalesce(asFiniteNumber(_optionalChain([plays, 'optionalAccess', _26 => _26.more_count])), () => ( 0));
790
+ const playText = shown.length === 0 ? "No Play" : `${shown.map((play) => ledgerPlayLabel(_nullishCoalesce(asRecord(play), () => ( {})))).join(", ")}${more > 0 ? `, +${more} more` : ""}`;
791
+ lines.push(
792
+ `- ${_nullishCoalesce(asString(entry.name), () => ( key))} [${key}] \xB7 ${_nullishCoalesce(_nullishCoalesce(asString(_optionalChain([signal, 'optionalAccess', _27 => _27.label])), () => ( asString(entry.type))), () => ( "monitor"))}${asString(_optionalChain([subject, 'optionalAccess', _28 => _28.value])) ? ` \xB7 ${asString(_optionalChain([subject, 'optionalAccess', _29 => _29.value]))}` : ""}`,
793
+ ` ${_nullishCoalesce(LEDGER_STATUS_LABELS[status], () => ( status))} \xB7 ${ledgerFindingsText(asRecord(entry.findings), windowLabel)} \xB7 set up ${_nullishCoalesce(_optionalChain([asString, 'call', _30 => _30(entry.installed_at), 'optionalAccess', _31 => _31.slice, 'call', _32 => _32(0, 10)]), () => ( "unknown"))} \xB7 triggers: ${playText}`
794
+ );
795
+ }
796
+ const next = asString(payload.next_cursor);
797
+ if (next) lines.push(`More: --cursor ${next}`);
798
+ return lines.join("\n");
799
+ }
800
+ var LEDGER_SORTS = ["recent", "installed", "name", "findings"];
801
+ var LEDGER_WINDOWS = ["1d", "7d", "30d", "90d", "1y"];
802
+ async function handleMonitorsLedger(key, options) {
803
+ const client = new (0, _chunkB4Q3EBQXjs.DeeplineClient)();
804
+ if (options.findings) {
805
+ if (!key) {
806
+ throw new MonitorsUsageError(
807
+ "--findings needs a monitor key: deepline monitors ledger <key> --findings"
808
+ );
809
+ }
810
+ const payload2 = await client.monitors.ledgerFindings(key, {
811
+ ...options.cursor ? { cursor: options.cursor } : {}
812
+ });
813
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload2, { json: options.json });
814
+ return;
815
+ }
816
+ if (key) {
817
+ const payload2 = await client.monitors.ledgerGet(key);
818
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload2, { json: options.json });
819
+ return;
820
+ }
821
+ if (options.sort !== void 0 && !LEDGER_SORTS.includes(options.sort)) {
822
+ throw new MonitorsUsageError(
823
+ `--sort must be recent, installed, name, or findings; received ${options.sort}.`
824
+ );
825
+ }
826
+ if (options.window !== void 0 && !LEDGER_WINDOWS.includes(options.window)) {
827
+ throw new MonitorsUsageError(
828
+ `--window must be 1d, 7d, 30d, 90d, or 1y; received ${options.window}.`
829
+ );
830
+ }
831
+ const payload = await client.monitors.ledger({
832
+ ...options.search ? { search: options.search } : {},
833
+ ..._optionalChain([options, 'access', _33 => _33.state, 'optionalAccess', _34 => _34.length]) ? { states: options.state } : {},
834
+ ..._optionalChain([options, 'access', _35 => _35.signal, 'optionalAccess', _36 => _36.length]) ? { signals: options.signal } : {},
835
+ ...options.play ? { play: options.play } : {},
836
+ ...options.sort ? { sort: options.sort } : {},
837
+ ...options.window ? { window: options.window } : {},
838
+ ...options.limit ? { limit: options.limit } : {},
839
+ ...options.cursor ? { cursor: options.cursor } : {}
840
+ });
841
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
842
+ json: options.json,
843
+ text: renderMonitorLedgerText(payload)
844
+ });
845
+ }
731
846
  async function handleMonitorsCheck(definition, options) {
732
847
  const body = resolveMonitorJsonBody({
733
848
  positional: definition,
@@ -735,10 +850,10 @@ async function handleMonitorsCheck(definition, options) {
735
850
  argLabel: "<definition>",
736
851
  command: "deepline monitors check"
737
852
  });
738
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.check(
853
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.check(
739
854
  body
740
855
  );
741
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, { json: options.json });
856
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, { json: options.json });
742
857
  }
743
858
  function previewText(value) {
744
859
  return typeof value === "string" && value.trim() ? value.trim() : "-";
@@ -750,7 +865,7 @@ function renderMonitorPreviewText(payload) {
750
865
  `Preview of ${previewText(payload.tool)}: ${updates.length} of ${String(_nullishCoalesce(payload.limit, () => ( "?")))} requested matches.`
751
866
  ];
752
867
  for (const item of updates) {
753
- const content = _nullishCoalesce(asRecord(_optionalChain([asRecord, 'call', _21 => _21(item), 'optionalAccess', _22 => _22.content])), () => ( {}));
868
+ const content = _nullishCoalesce(asRecord(_optionalChain([asRecord, 'call', _37 => _37(item), 'optionalAccess', _38 => _38.content])), () => ( {}));
754
869
  lines.push(
755
870
  ` ${previewText(content.full_name)} | ${previewText(content.title)} | started ${previewText(content.start_date)} | ${previewText(content.seniority)}`
756
871
  );
@@ -796,22 +911,22 @@ async function handleMonitorsPreview(definition, options) {
796
911
  if (limit !== void 0 && !Number.isInteger(limit)) {
797
912
  throw new MonitorsUsageError("--limit must be a whole number from 1 to 3.");
798
913
  }
799
- const wantsJson = _chunkMAMEKGLIjs.shouldEmitJson.call(void 0, options.json);
914
+ const wantsJson = _chunkXLYJ7MJXjs.shouldEmitJson.call(void 0, options.json);
800
915
  if (options.idempotencyKey === void 0 && wantsJson) {
801
916
  throw new MonitorsUsageError(
802
917
  "--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."
803
918
  );
804
919
  }
805
920
  const idempotencyKey = _nullishCoalesce(options.idempotencyKey, () => ( `monitor-preview-${_crypto.randomUUID.call(void 0, )}`));
806
- const progress = _chunkXKYQR3QKjs.createCliProgress.call(void 0, !wantsJson);
921
+ const progress = _chunk7RBIOOCQjs.createCliProgress.call(void 0, !wantsJson);
807
922
  progress.phase(`Preview key: ${idempotencyKey}`);
808
923
  try {
809
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.preview(
924
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.preview(
810
925
  body,
811
926
  { idempotencyKey, ...limit === void 0 ? {} : { limit } }
812
927
  );
813
928
  progress.complete();
814
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, {
929
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
815
930
  json: options.json,
816
931
  text: renderMonitorPreviewText(payload)
817
932
  });
@@ -856,15 +971,15 @@ async function handleMonitorsDeploy(definition, options) {
856
971
  argLabel: "<definition>",
857
972
  command: "deepline monitors deploy"
858
973
  });
859
- const client = new (0, _chunkZ33PZUWGjs.DeeplineClient)();
974
+ const client = new (0, _chunkB4Q3EBQXjs.DeeplineClient)();
860
975
  const definitionArg = body;
861
976
  if (options.dryRun) {
862
977
  const payload2 = await client.monitors.deploy(definitionArg, {
863
978
  dryRun: true
864
979
  });
865
980
  const valid = payload2.valid !== false;
866
- const hasIdentityConflict = Boolean(_optionalChain([asRecord, 'call', _23 => _23(payload2), 'optionalAccess', _24 => _24.identity_conflict]));
867
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
981
+ const hasIdentityConflict = Boolean(_optionalChain([asRecord, 'call', _39 => _39(payload2), 'optionalAccess', _40 => _40.identity_conflict]));
982
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
868
983
  { dry_run: true, ...payload2 },
869
984
  { json: options.json, text: renderMonitorDeployPlan(payload2) }
870
985
  );
@@ -874,7 +989,7 @@ async function handleMonitorsDeploy(definition, options) {
874
989
  return;
875
990
  }
876
991
  const payload = await client.monitors.deploy(definitionArg);
877
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, {
992
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
878
993
  json: options.json,
879
994
  text: renderMonitorDeployCompletion(payload)
880
995
  });
@@ -886,29 +1001,29 @@ async function handleMonitorsSync(definition, options) {
886
1001
  argLabel: "<definition>",
887
1002
  command: "deepline monitors sync"
888
1003
  });
889
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.sync(body, {
1004
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.sync(body, {
890
1005
  ...options.dryRun ? { dryRun: true } : {},
891
1006
  idempotencyKey: _nullishCoalesce(options.idempotencyKey, () => ( monitorJobIdempotencyKey("scalar-sync", void 0)))
892
1007
  });
893
1008
  if (options.dryRun) {
894
1009
  const plan = payload;
895
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
1010
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
896
1011
  { dry_run: true, ...plan },
897
1012
  { json: options.json, text: renderMonitorDeployPlan(plan) }
898
1013
  );
899
1014
  return;
900
1015
  }
901
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, {
1016
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
902
1017
  json: options.json,
903
1018
  text: renderMonitorJob(payload)
904
1019
  });
905
1020
  }
906
1021
  async function handleScalarMonitorLifecycle(action, key, options) {
907
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors[action](key, {
1022
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors[action](key, {
908
1023
  ...options.dryRun ? { dryRun: true } : {},
909
1024
  idempotencyKey: _nullishCoalesce(options.idempotencyKey, () => ( monitorJobIdempotencyKey(`${action}-${key}`, void 0)))
910
1025
  });
911
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, {
1026
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
912
1027
  json: options.json,
913
1028
  text: options.dryRun ? void 0 : renderMonitorJob(payload)
914
1029
  });
@@ -922,14 +1037,14 @@ function fleetIntegerOption(raw, flag) {
922
1037
  return value;
923
1038
  }
924
1039
  function fleetIdempotencyKey(operation, supplied) {
925
- const normalized = _optionalChain([supplied, 'optionalAccess', _25 => _25.trim, 'call', _26 => _26()]);
1040
+ const normalized = _optionalChain([supplied, 'optionalAccess', _41 => _41.trim, 'call', _42 => _42()]);
926
1041
  if (supplied !== void 0 && !normalized) {
927
1042
  throw new MonitorsUsageError("--idempotency-key must not be empty.");
928
1043
  }
929
1044
  return _nullishCoalesce(normalized, () => ( `monitor-fleet-${operation}-${_crypto.randomUUID.call(void 0, )}`));
930
1045
  }
931
1046
  function monitorJobIdempotencyKey(operation, supplied) {
932
- const normalized = _optionalChain([supplied, 'optionalAccess', _27 => _27.trim, 'call', _28 => _28()]);
1047
+ const normalized = _optionalChain([supplied, 'optionalAccess', _43 => _43.trim, 'call', _44 => _44()]);
933
1048
  if (supplied !== void 0 && !normalized) {
934
1049
  throw new MonitorsUsageError("--idempotency-key must not be empty.");
935
1050
  }
@@ -997,11 +1112,11 @@ async function handleMonitorJobBatchDeploy(options, idempotencyKey) {
997
1112
  lint.issues.filter((issue) => issue.severity === "error").map((issue) => `${issue.path || "batch"}: ${issue.message}`).join("; ")
998
1113
  );
999
1114
  }
1000
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.batch.deploy(
1115
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.batch.deploy(
1001
1116
  lint.normalized.monitors,
1002
1117
  { idempotencyKey }
1003
1118
  );
1004
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
1119
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
1005
1120
  {
1006
1121
  ...payload,
1007
1122
  idempotency_key: idempotencyKey,
@@ -1011,7 +1126,7 @@ async function handleMonitorJobBatchDeploy(options, idempotencyKey) {
1011
1126
  );
1012
1127
  }
1013
1128
  function namedBatchIdempotencyKey(batchId, intent, supplied) {
1014
- return _optionalChain([supplied, 'optionalAccess', _29 => _29.trim, 'call', _30 => _30()]) || `monitor-batch-${intent}-${batchId}-${_crypto.randomUUID.call(void 0, )}`;
1129
+ return _optionalChain([supplied, 'optionalAccess', _45 => _45.trim, 'call', _46 => _46()]) || `monitor-batch-${intent}-${batchId}-${_crypto.randomUUID.call(void 0, )}`;
1015
1130
  }
1016
1131
  async function handleNamedMonitorBatchSync(batchId, options) {
1017
1132
  if (!options.file) {
@@ -1034,7 +1149,7 @@ async function handleNamedMonitorBatchSync(batchId, options) {
1034
1149
  );
1035
1150
  }
1036
1151
  if (options.dryRun) {
1037
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
1152
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
1038
1153
  {
1039
1154
  ok: true,
1040
1155
  dry_run: true,
@@ -1051,7 +1166,7 @@ async function handleNamedMonitorBatchSync(batchId, options) {
1051
1166
  "sync",
1052
1167
  options.idempotencyKey
1053
1168
  );
1054
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.batches.sync(
1169
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.batches.sync(
1055
1170
  batchId,
1056
1171
  lint.normalized.monitors,
1057
1172
  {
@@ -1059,14 +1174,14 @@ async function handleNamedMonitorBatchSync(batchId, options) {
1059
1174
  ...parsedGeneration === void 0 ? {} : { expectedGeneration: parsedGeneration }
1060
1175
  }
1061
1176
  );
1062
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
1177
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
1063
1178
  { ...payload, idempotency_key: idempotencyKey },
1064
1179
  { json: options.json, text: renderMonitorJob(payload) }
1065
1180
  );
1066
1181
  }
1067
1182
  async function handleNamedMonitorBatchLifecycle(batchId, intent, options) {
1068
1183
  if (options.dryRun) {
1069
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
1184
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
1070
1185
  {
1071
1186
  ok: true,
1072
1187
  dry_run: true,
@@ -1082,17 +1197,17 @@ async function handleNamedMonitorBatchLifecycle(batchId, intent, options) {
1082
1197
  intent,
1083
1198
  options.idempotencyKey
1084
1199
  );
1085
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.batches[intent](batchId, {
1200
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.batches[intent](batchId, {
1086
1201
  idempotencyKey
1087
1202
  });
1088
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
1203
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
1089
1204
  { ...payload, idempotency_key: idempotencyKey },
1090
1205
  { json: options.json, text: renderMonitorJob(payload) }
1091
1206
  );
1092
1207
  }
1093
1208
  async function handleNamedMonitorBatchGet(batchId, options) {
1094
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.batches.get(batchId);
1095
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, {
1209
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.batches.get(batchId);
1210
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
1096
1211
  json: options.json,
1097
1212
  text: renderMonitorJob(payload)
1098
1213
  });
@@ -1106,7 +1221,7 @@ async function handleMonitorBatchLint(options) {
1106
1221
  const result = _chunkIF75RD6Ujs.lintMonitorBatchInput.call(void 0,
1107
1222
  readMonitorDefinitionsJsonFile(options.file)
1108
1223
  );
1109
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
1224
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
1110
1225
  {
1111
1226
  ok: !result.issues.some((issue) => issue.severity === "error"),
1112
1227
  ...result.normalized ? { normalized: result.normalized } : {},
@@ -1126,7 +1241,7 @@ async function handleMonitorFleetLint(options) {
1126
1241
  const result = _chunkC374C22Yjs.lintMonitorFleetInput.call(void 0,
1127
1242
  readMonitorDefinitionsJsonFile(options.file)
1128
1243
  );
1129
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
1244
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
1130
1245
  {
1131
1246
  ok: !result.issues.some((issue) => issue.severity === "error"),
1132
1247
  ...result.normalized ? { normalized: result.normalized } : {},
@@ -1138,32 +1253,32 @@ async function handleMonitorFleetLint(options) {
1138
1253
  process.exitCode = 2;
1139
1254
  }
1140
1255
  async function handleMonitorJobGet(jobId, options) {
1141
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.jobs.get(jobId);
1142
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, {
1256
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.jobs.get(jobId);
1257
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
1143
1258
  json: options.json,
1144
1259
  text: renderMonitorJob(payload)
1145
1260
  });
1146
1261
  }
1147
1262
  async function handleMonitorJobWait(jobId, options) {
1148
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.jobs.wait(jobId, {
1263
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.jobs.wait(jobId, {
1149
1264
  timeoutMs: fleetTimeoutMs(options.timeout),
1150
1265
  pollIntervalMs: FLEET_POLL_INTERVAL_MS
1151
1266
  });
1152
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, {
1267
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
1153
1268
  json: options.json,
1154
1269
  text: renderMonitorJob(payload)
1155
1270
  });
1156
1271
  }
1157
1272
  async function handleMonitorJobLogs(jobId, options) {
1158
1273
  const limit = options.limit ? fleetIntegerOption(options.limit, "--limit") : void 0;
1159
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.jobs.logs(jobId, {
1274
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.jobs.logs(jobId, {
1160
1275
  ...limit === void 0 ? {} : { limit }
1161
1276
  });
1162
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, { json: options.json });
1277
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, { json: options.json });
1163
1278
  }
1164
1279
  async function handleMonitorJobCancel(jobId, options) {
1165
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.jobs.cancel(jobId);
1166
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, {
1280
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.jobs.cancel(jobId);
1281
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, {
1167
1282
  json: options.json,
1168
1283
  text: renderMonitorJob(payload)
1169
1284
  });
@@ -1472,7 +1587,7 @@ function renderFleetDeactivatePlan(payload, fleetId) {
1472
1587
  `;
1473
1588
  }
1474
1589
  function reportFleetState(payload, error, options) {
1475
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
1590
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
1476
1591
  {
1477
1592
  ...payload,
1478
1593
  code: error.code,
@@ -1489,9 +1604,9 @@ Next: ${error.next}
1489
1604
  process.exitCode = monitorsErrorExitCode(error);
1490
1605
  }
1491
1606
  function fleetBillingSuspendedError(fleetId, payload, options) {
1492
- const reason = asString(_optionalChain([asRecord, 'call', _31 => _31(payload.billing_suspension), 'optionalAccess', _32 => _32.reason]));
1607
+ const reason = asString(_optionalChain([asRecord, 'call', _47 => _47(payload.billing_suspension), 'optionalAccess', _48 => _48.reason]));
1493
1608
  const suspended = `Fleet ${fleetId} is suspended for billing${reason ? ` (${reason})` : ""}: its monitors are stopped`;
1494
- if (_optionalChain([options, 'optionalAccess', _33 => _33.deactivating])) {
1609
+ if (_optionalChain([options, 'optionalAccess', _49 => _49.deactivating])) {
1495
1610
  const deactivateCommand = `deepline monitors fleets deactivate ${fleetShellArg(fleetId)} --yes --wait`;
1496
1611
  return new MonitorFleetStateError({
1497
1612
  code: "MONITOR_FLEET_BILLING_SUSPENDED",
@@ -1506,7 +1621,7 @@ function fleetBillingSuspendedError(fleetId, payload, options) {
1506
1621
  });
1507
1622
  }
1508
1623
  function fleetSourceTable(value) {
1509
- const [schema, table, extra] = _nullishCoalesce(_optionalChain([value, 'optionalAccess', _34 => _34.trim, 'call', _35 => _35(), 'access', _36 => _36.split, 'call', _37 => _37(".")]), () => ( []));
1624
+ const [schema, table, extra] = _nullishCoalesce(_optionalChain([value, 'optionalAccess', _50 => _50.trim, 'call', _51 => _51(), 'access', _52 => _52.split, 'call', _53 => _53(".")]), () => ( []));
1510
1625
  if (!schema || !table || extra || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(schema) || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(table)) {
1511
1626
  throw new MonitorsUsageError(
1512
1627
  "--source must be a Customer DB table in schema.table form."
@@ -1515,7 +1630,7 @@ function fleetSourceTable(value) {
1515
1630
  return { schema, table };
1516
1631
  }
1517
1632
  function fleetColumnName(value, flag) {
1518
- const name = _optionalChain([value, 'optionalAccess', _38 => _38.trim, 'call', _39 => _39()]);
1633
+ const name = _optionalChain([value, 'optionalAccess', _54 => _54.trim, 'call', _55 => _55()]);
1519
1634
  if (!name || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
1520
1635
  throw new MonitorsUsageError(`${flag} must be a SQL column identifier.`);
1521
1636
  }
@@ -1560,13 +1675,13 @@ async function handleMonitorFleetsInit(fleetId, options) {
1560
1675
  }
1561
1676
  const source = fleetSourceTable(options.source);
1562
1677
  const key = fleetColumnName(options.key, "--key");
1563
- const keyType = _nullishCoalesce(_optionalChain([options, 'access', _40 => _40.keyType, 'optionalAccess', _41 => _41.trim, 'call', _42 => _42()]), () => ( "text"));
1678
+ const keyType = _nullishCoalesce(_optionalChain([options, 'access', _56 => _56.keyType, 'optionalAccess', _57 => _57.trim, 'call', _58 => _58()]), () => ( "text"));
1564
1679
  if (!["text", "uuid", "int4", "int8"].includes(keyType)) {
1565
1680
  throw new MonitorsUsageError(
1566
1681
  "--key-type must be text, uuid, int4, or int8."
1567
1682
  );
1568
1683
  }
1569
- const tool = _optionalChain([options, 'access', _43 => _43.tool, 'optionalAccess', _44 => _44.trim, 'call', _45 => _45()]);
1684
+ const tool = _optionalChain([options, 'access', _59 => _59.tool, 'optionalAccess', _60 => _60.trim, 'call', _61 => _61()]);
1570
1685
  if (!tool) throw new MonitorsUsageError("--tool is required.");
1571
1686
  if (!options.payload) {
1572
1687
  throw new MonitorsUsageError(
@@ -1575,7 +1690,7 @@ async function handleMonitorFleetsInit(fleetId, options) {
1575
1690
  }
1576
1691
  const payload = parseJsonObjectArg(options.payload, "--payload");
1577
1692
  const where = options.where ? parseJsonObjectArg(options.where, "--where") : void 0;
1578
- const out = _optionalChain([options, 'access', _46 => _46.out, 'optionalAccess', _47 => _47.trim, 'call', _48 => _48()]);
1693
+ const out = _optionalChain([options, 'access', _62 => _62.out, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()]);
1579
1694
  if (!out) throw new MonitorsUsageError("--out is required.");
1580
1695
  const authoredDefinition = {
1581
1696
  version: 2,
@@ -1604,7 +1719,7 @@ async function handleMonitorFleetsInit(fleetId, options) {
1604
1719
  _fs.writeFileSync.call(void 0, file, `${JSON.stringify(definition, null, 2)}
1605
1720
  `, "utf8");
1606
1721
  const next = `deepline monitors fleets deploy --file ${fleetShellArg(file)} --dry-run`;
1607
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
1722
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
1608
1723
  { schemaVersion: 2, file, definition, next },
1609
1724
  {
1610
1725
  json: options.json,
@@ -1644,8 +1759,8 @@ function fleetSyncCommandLine(target, options) {
1644
1759
  }
1645
1760
  async function handleMonitorFleetsSync(target, options, idempotencyKey) {
1646
1761
  const fileDefinitions = options.file ? readMonitorDefinitionsJsonFile(options.file) : void 0;
1647
- const usesDefinition = options.file !== void 0 || _optionalChain([target, 'optionalAccess', _49 => _49.trim, 'call', _50 => _50(), 'access', _51 => _51.startsWith, 'call', _52 => _52("{")]) === true;
1648
- if (!usesDefinition && !_optionalChain([target, 'optionalAccess', _53 => _53.trim, 'call', _54 => _54()])) {
1762
+ const usesDefinition = options.file !== void 0 || _optionalChain([target, 'optionalAccess', _65 => _65.trim, 'call', _66 => _66(), 'access', _67 => _67.startsWith, 'call', _68 => _68("{")]) === true;
1763
+ if (!usesDefinition && !_optionalChain([target, 'optionalAccess', _69 => _69.trim, 'call', _70 => _70()])) {
1649
1764
  throw new MonitorsUsageError(
1650
1765
  "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"
1651
1766
  );
@@ -1666,7 +1781,7 @@ async function handleMonitorFleetsSync(target, options, idempotencyKey) {
1666
1781
  'The Fleet definition has no id. Add a top-level "id" and re-run.'
1667
1782
  );
1668
1783
  }
1669
- const client = new (0, _chunkZ33PZUWGjs.DeeplineClient)();
1784
+ const client = new (0, _chunkB4Q3EBQXjs.DeeplineClient)();
1670
1785
  const payload = await client.monitors.fleets.sync(
1671
1786
  _nullishCoalesce(definition, () => ( fleetId)),
1672
1787
  {
@@ -1688,7 +1803,7 @@ async function handleMonitorFleetsSync(target, options, idempotencyKey) {
1688
1803
  }
1689
1804
  const accepted = { ...payload, idempotency_key: idempotencyKey };
1690
1805
  if (!options.wait || options.dryRun) {
1691
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, accepted, {
1806
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, accepted, {
1692
1807
  json: options.json,
1693
1808
  text: renderFleetSync(payload, {
1694
1809
  fleetId,
@@ -1714,7 +1829,7 @@ async function handleMonitorFleetsSync(target, options, idempotencyKey) {
1714
1829
  const status = fleetStatus(final);
1715
1830
  const summary = renderFleetGet(final);
1716
1831
  if (status === "converged") {
1717
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, envelope, { json: options.json, text: summary });
1832
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, envelope, { json: options.json, text: summary });
1718
1833
  return;
1719
1834
  }
1720
1835
  if (status === "billing_suspended") {
@@ -1754,14 +1869,14 @@ async function handleMonitorFleetsGet(fleetId, options) {
1754
1869
  );
1755
1870
  }
1756
1871
  const limit = options.limit === void 0 ? void 0 : fleetIntegerOption(options.limit, "--limit");
1757
- const client = new (0, _chunkZ33PZUWGjs.DeeplineClient)();
1872
+ const client = new (0, _chunkB4Q3EBQXjs.DeeplineClient)();
1758
1873
  const payload = await client.monitors.fleets.get(fleetId, {
1759
1874
  ...options.drift ? { drift: true } : {},
1760
1875
  ...limit !== void 0 ? { limit } : {}
1761
1876
  });
1762
1877
  const text = fleetId ? renderFleetGet(payload) : renderFleetList(payload);
1763
1878
  if (!options.check) {
1764
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, { json: options.json, text });
1879
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, { json: options.json, text });
1765
1880
  return;
1766
1881
  }
1767
1882
  const statuses = fleetId ? [fleetStatus(payload)] : (Array.isArray(payload.fleets) ? payload.fleets : []).map(
@@ -1769,7 +1884,7 @@ async function handleMonitorFleetsGet(fleetId, options) {
1769
1884
  );
1770
1885
  const unconverged = statuses.filter((status) => status !== "converged");
1771
1886
  if (unconverged.length === 0) {
1772
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, { json: options.json, text });
1887
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, { json: options.json, text });
1773
1888
  return;
1774
1889
  }
1775
1890
  const target = _nullishCoalesce(fleetId, () => ( "<fleet-id>"));
@@ -1808,13 +1923,13 @@ async function handleMonitorFleetsReactivate(fleetId, options, idempotencyKey) {
1808
1923
  ${fleetReactivateCommandLine(fleetId, options)}`
1809
1924
  );
1810
1925
  }
1811
- const client = new (0, _chunkZ33PZUWGjs.DeeplineClient)();
1926
+ const client = new (0, _chunkB4Q3EBQXjs.DeeplineClient)();
1812
1927
  const payload = await client.monitors.fleets.reactivate(fleetId, {
1813
1928
  idempotencyKey
1814
1929
  });
1815
1930
  const accepted = { ...payload, idempotency_key: idempotencyKey };
1816
1931
  if (!options.wait) {
1817
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, accepted, {
1932
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, accepted, {
1818
1933
  json: options.json,
1819
1934
  text: `Fleet ${fleetId} \u2014 ${readMonitorState(payload) ? `state ${readMonitorState(payload)}` : "reactivation accepted"}
1820
1935
  idempotency key ${idempotencyKey}
@@ -1837,7 +1952,7 @@ async function handleMonitorFleetsReactivate(fleetId, options, idempotencyKey) {
1837
1952
  const envelope = { ...accepted, ...final };
1838
1953
  const text = renderFleetGet(final);
1839
1954
  if (fleetStatus(final) === "converged") {
1840
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, envelope, { json: options.json, text });
1955
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, envelope, { json: options.json, text });
1841
1956
  return;
1842
1957
  }
1843
1958
  if (fleetStatus(final) === "billing_suspended") {
@@ -1886,7 +2001,7 @@ async function confirmFleetDeactivate(fleetId, plan) {
1886
2001
  }
1887
2002
  }
1888
2003
  async function handleMonitorFleetsDeactivate(fleetId, options, idempotencyKey) {
1889
- const client = new (0, _chunkZ33PZUWGjs.DeeplineClient)();
2004
+ const client = new (0, _chunkB4Q3EBQXjs.DeeplineClient)();
1890
2005
  if (options.dryRun) {
1891
2006
  const plan = await client.monitors.fleets.deactivate(fleetId, {
1892
2007
  dryRun: true,
@@ -1896,7 +2011,7 @@ async function handleMonitorFleetsDeactivate(fleetId, options, idempotencyKey) {
1896
2011
  command: "deepline monitors fleets deactivate",
1897
2012
  mutation: "fleet deactivate"
1898
2013
  });
1899
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, plan, {
2014
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, plan, {
1900
2015
  json: options.json,
1901
2016
  text: renderFleetDeactivatePlan(plan, fleetId)
1902
2017
  });
@@ -1934,7 +2049,7 @@ Preview the blast radius first:
1934
2049
  });
1935
2050
  const accepted = { ...payload, idempotency_key: idempotencyKey };
1936
2051
  if (payload.already === true) {
1937
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, accepted, {
2052
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, accepted, {
1938
2053
  json: options.json,
1939
2054
  text: `Fleet ${fleetId} is already deactivated.
1940
2055
  `
@@ -1946,7 +2061,7 @@ Preview the blast radius first:
1946
2061
  ` + (fleetServerNext(payload) ? `Next: ${fleetServerNext(payload)}
1947
2062
  ` : "");
1948
2063
  if (!options.wait) {
1949
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, accepted, {
2064
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, accepted, {
1950
2065
  json: options.json,
1951
2066
  text: acceptedText
1952
2067
  });
@@ -1968,7 +2083,7 @@ Preview the blast radius first:
1968
2083
  const envelope = { ...accepted, ...final };
1969
2084
  const summary = renderFleetGet(final);
1970
2085
  if (fleetStatus(final) === "deactivated") {
1971
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, envelope, { json: options.json, text: summary });
2086
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, envelope, { json: options.json, text: summary });
1972
2087
  return;
1973
2088
  }
1974
2089
  if (fleetStatus(final) === "billing_suspended") {
@@ -2007,7 +2122,7 @@ function handleMonitorFleetsOverview(options) {
2007
2122
  "Agent notes:",
2008
2123
  ...MONITOR_FLEET_AGENT_NOTES.map((note) => ` ${note}`)
2009
2124
  ];
2010
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
2125
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
2011
2126
  {
2012
2127
  schemaVersion: 1,
2013
2128
  lifecycle: MONITOR_FLEET_LIFECYCLE,
@@ -2064,8 +2179,8 @@ function renderMonitorGet(payload) {
2064
2179
  }
2065
2180
  for (const raw of Array.isArray(guidance.documentation) ? guidance.documentation : []) {
2066
2181
  const doc = asRecord(raw);
2067
- const label = asString(_optionalChain([doc, 'optionalAccess', _55 => _55.label]));
2068
- const url = asString(_optionalChain([doc, 'optionalAccess', _56 => _56.url]));
2182
+ const label = asString(_optionalChain([doc, 'optionalAccess', _71 => _71.label]));
2183
+ const url = asString(_optionalChain([doc, 'optionalAccess', _72 => _72.url]));
2069
2184
  if (label && url) lines.push(` Docs: ${label} \u2014 ${url}`);
2070
2185
  }
2071
2186
  const payloadExample = asRecord(guidance.payload_example);
@@ -2082,20 +2197,20 @@ function renderMonitorGet(payload) {
2082
2197
  );
2083
2198
  }
2084
2199
  const monitorSpec = asRecord(payload.monitor_spec);
2085
- if (_optionalChain([monitorSpec, 'optionalAccess', _57 => _57.available]) === false) {
2200
+ if (_optionalChain([monitorSpec, 'optionalAccess', _73 => _73.available]) === false) {
2086
2201
  lines.push(
2087
2202
  "",
2088
2203
  `Monitor spec: unavailable \u2014 ${_nullishCoalesce(asString(monitorSpec.message), () => ( "use the stored definition and check before an update."))}`
2089
2204
  );
2090
2205
  }
2091
- const specFields = Array.isArray(_optionalChain([monitorSpec, 'optionalAccess', _58 => _58.fields])) ? monitorSpec.fields.flatMap((value) => {
2206
+ const specFields = Array.isArray(_optionalChain([monitorSpec, 'optionalAccess', _74 => _74.fields])) ? monitorSpec.fields.flatMap((value) => {
2092
2207
  const field = asRecord(value);
2093
- const path = asString(_optionalChain([field, 'optionalAccess', _59 => _59.path]));
2094
- const description = asString(_optionalChain([field, 'optionalAccess', _60 => _60.description]));
2095
- const semantics = asString(_optionalChain([field, 'optionalAccess', _61 => _61.semantics]));
2096
- const applicability = asString(_optionalChain([field, 'optionalAccess', _62 => _62.applicability]));
2097
- const grammar = asRecord(_optionalChain([field, 'optionalAccess', _63 => _63.grammar]));
2098
- const grammarSyntax = asString(_optionalChain([grammar, 'optionalAccess', _64 => _64.syntax]));
2208
+ const path = asString(_optionalChain([field, 'optionalAccess', _75 => _75.path]));
2209
+ const description = asString(_optionalChain([field, 'optionalAccess', _76 => _76.description]));
2210
+ const semantics = asString(_optionalChain([field, 'optionalAccess', _77 => _77.semantics]));
2211
+ const applicability = asString(_optionalChain([field, 'optionalAccess', _78 => _78.applicability]));
2212
+ const grammar = asRecord(_optionalChain([field, 'optionalAccess', _79 => _79.grammar]));
2213
+ const grammarSyntax = asString(_optionalChain([grammar, 'optionalAccess', _80 => _80.syntax]));
2099
2214
  return path ? [
2100
2215
  {
2101
2216
  path,
@@ -2131,10 +2246,10 @@ function renderMonitorGet(payload) {
2131
2246
  const name = _nullishCoalesce(asString(play.name), () => ( "unnamed Play"));
2132
2247
  const listener = asString(play.listener_key);
2133
2248
  const health = asRecord(play.consumer_health);
2134
- const runStatus = asString(_optionalChain([health, 'optionalAccess', _65 => _65.last_run_status]));
2135
- const lastDelivery = asFiniteNumber(_optionalChain([health, 'optionalAccess', _66 => _66.last_delivery_at]));
2136
- const runId = asString(_optionalChain([health, 'optionalAccess', _67 => _67.last_run_id]));
2137
- const error = asString(_optionalChain([health, 'optionalAccess', _68 => _68.last_error]));
2249
+ const runStatus = asString(_optionalChain([health, 'optionalAccess', _81 => _81.last_run_status]));
2250
+ const lastDelivery = asFiniteNumber(_optionalChain([health, 'optionalAccess', _82 => _82.last_delivery_at]));
2251
+ const runId = asString(_optionalChain([health, 'optionalAccess', _83 => _83.last_run_id]));
2252
+ const error = asString(_optionalChain([health, 'optionalAccess', _84 => _84.last_error]));
2138
2253
  lines.push(` ${name}${listener ? ` (listener: ${listener})` : ""}:`);
2139
2254
  lines.push(
2140
2255
  ` Latest delivered event: ${lastDelivery !== void 0 ? new Date(lastDelivery).toISOString() : "never"}`,
@@ -2161,14 +2276,14 @@ function renderMonitorGet(payload) {
2161
2276
  );
2162
2277
  }
2163
2278
  }
2164
- if (_optionalChain([dependents, 'optionalAccess', _69 => _69.truncated]) === true) {
2279
+ if (_optionalChain([dependents, 'optionalAccess', _85 => _85.truncated]) === true) {
2165
2280
  lines.push(" Results are truncated.");
2166
2281
  }
2167
2282
  return `${lines.join("\n")}
2168
2283
  `;
2169
2284
  }
2170
2285
  async function handleMonitorsGet(key, options) {
2171
- const client = new (0, _chunkZ33PZUWGjs.DeeplineClient)();
2286
+ const client = new (0, _chunkB4Q3EBQXjs.DeeplineClient)();
2172
2287
  const payload = await client.monitors.get(key);
2173
2288
  const boundPlays = Array.isArray(payload.bound_plays) ? payload.bound_plays : null;
2174
2289
  const dependents = boundPlays ? {
@@ -2176,24 +2291,24 @@ async function handleMonitorsGet(key, options) {
2176
2291
  truncated: payload.consumer_health_truncated === true
2177
2292
  } : await client.monitors.dependents(key);
2178
2293
  const detail = { ...payload, dependents };
2179
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, detail, {
2294
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, detail, {
2180
2295
  json: options.json,
2181
2296
  text: renderMonitorGet(detail)
2182
2297
  });
2183
2298
  }
2184
2299
  async function handleMonitorsTest(key, payload, options) {
2185
2300
  const explicitPayload = parseJsonObjectArg(payload, "<payload>");
2186
- const result = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.test(key, explicitPayload);
2301
+ const result = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.test(key, explicitPayload);
2187
2302
  const text = `Monitor diagnostic for ${key}: ${result.accepted === true ? "accepted" : "rejected"}
2188
2303
  mode: validation_only (no rows written, credits spent, or Plays dispatched)
2189
2304
  persisted rows: ${_nullishCoalesce(asFiniteNumber(result.persisted_rows), () => ( 0))}
2190
2305
  dispatched bound Plays: ${_nullishCoalesce(asFiniteNumber(result.dispatched_bound_plays), () => ( 0))}
2191
2306
  `;
2192
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, result, { json: options.json, text });
2307
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, result, { json: options.json, text });
2193
2308
  }
2194
2309
  async function handleMonitorsValidate(key, options) {
2195
- const result = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.validate(key);
2196
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, result, { json: options.json });
2310
+ const result = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.validate(key);
2311
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, result, { json: options.json });
2197
2312
  if (result.valid === false) process.exitCode = 7;
2198
2313
  }
2199
2314
  async function confirmMonitorDelete(key) {
@@ -2211,14 +2326,14 @@ async function confirmMonitorDelete(key) {
2211
2326
  }
2212
2327
  }
2213
2328
  async function handleMonitorsDelete(key, options) {
2214
- const client = new (0, _chunkZ33PZUWGjs.DeeplineClient)();
2329
+ const client = new (0, _chunkB4Q3EBQXjs.DeeplineClient)();
2215
2330
  if (options.dryRun) {
2216
2331
  const payload2 = await client.monitors.delete(key, { dryRun: true });
2217
2332
  assertMonitorDryRunAcknowledged(payload2, {
2218
2333
  command: "deepline monitors delete",
2219
2334
  mutation: "delete"
2220
2335
  });
2221
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload2, {
2336
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload2, {
2222
2337
  json: options.json,
2223
2338
  text: renderMonitorDeletePlan(payload2, key)
2224
2339
  });
@@ -2238,7 +2353,7 @@ async function handleMonitorsDelete(key, options) {
2238
2353
  }
2239
2354
  }
2240
2355
  const payload = await client.monitors.delete(key);
2241
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, { json: options.json });
2356
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, { json: options.json });
2242
2357
  }
2243
2358
  async function handleMonitorsUpdate(key, patch, options) {
2244
2359
  const body = resolveMonitorJsonBody({
@@ -2247,29 +2362,29 @@ async function handleMonitorsUpdate(key, patch, options) {
2247
2362
  argLabel: "<patch>",
2248
2363
  command: `deepline monitors update ${key}`
2249
2364
  });
2250
- const payload = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.update(key, body);
2251
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, { json: options.json });
2365
+ const payload = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.update(key, body);
2366
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, { json: options.json });
2252
2367
  }
2253
2368
  async function handleMonitorsReactivate(key, options) {
2254
- const client = new (0, _chunkZ33PZUWGjs.DeeplineClient)();
2369
+ const client = new (0, _chunkB4Q3EBQXjs.DeeplineClient)();
2255
2370
  if (options.dryRun) {
2256
2371
  const payload2 = await client.monitors.reactivate(key, { dryRun: true });
2257
2372
  assertMonitorDryRunAcknowledged(payload2, {
2258
2373
  command: "deepline monitors reactivate",
2259
2374
  mutation: "reactivate"
2260
2375
  });
2261
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload2, {
2376
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload2, {
2262
2377
  json: options.json,
2263
2378
  text: renderMonitorReactivatePlan(payload2, key)
2264
2379
  });
2265
2380
  return;
2266
2381
  }
2267
2382
  const payload = await client.monitors.reactivate(key);
2268
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, payload, { json: options.json });
2383
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, payload, { json: options.json });
2269
2384
  }
2270
2385
  var MONITOR_VERB_POLL_INTERVAL_MS = 2e3;
2271
2386
  function monitorHealthLine(health) {
2272
- if (_optionalChain([health, 'access', _70 => _70.refresh, 'optionalAccess', _71 => _71.state]) === "running") {
2387
+ if (_optionalChain([health, 'access', _86 => _86.refresh, 'optionalAccess', _87 => _87.state]) === "running") {
2273
2388
  return `refreshing whole scope \xB7 scanned ${health.scanned} so far`;
2274
2389
  }
2275
2390
  const alignmentRequired = _nullishCoalesce(health.alignment_required, () => ( 0));
@@ -2314,7 +2429,7 @@ async function watchMonitorHealth(input) {
2314
2429
  while (Date.now() < deadlineAt) {
2315
2430
  const unresolved = last.observed.unknown + last.observed.unset;
2316
2431
  const alignmentRequired = _nullishCoalesce(last.alignment_required, () => ( 0));
2317
- if (_optionalChain([last, 'access', _72 => _72.refresh, 'optionalAccess', _73 => _73.state]) !== "running" && !last.truncated && last.needs_repair === 0 && (unresolved === 0 || alignmentRequired === unresolved)) {
2432
+ if (_optionalChain([last, 'access', _88 => _88.refresh, 'optionalAccess', _89 => _89.state]) !== "running" && !last.truncated && last.needs_repair === 0 && (unresolved === 0 || alignmentRequired === unresolved)) {
2318
2433
  return last;
2319
2434
  }
2320
2435
  await new Promise(
@@ -2326,13 +2441,13 @@ async function watchMonitorHealth(input) {
2326
2441
  return last;
2327
2442
  }
2328
2443
  function monitorHealthText(health) {
2329
- const partial = _optionalChain([health, 'access', _74 => _74.refresh, 'optionalAccess', _75 => _75.state]) === "running" ? " (refreshing \u2014 counts below are not final)" : health.truncated ? " (partial \u2014 scope larger than one read)" : "";
2444
+ const partial = _optionalChain([health, 'access', _90 => _90.refresh, 'optionalAccess', _91 => _91.state]) === "running" ? " (refreshing \u2014 counts below are not final)" : health.truncated ? " (partial \u2014 scope larger than one read)" : "";
2330
2445
  const unauditedMonitors = _nullishCoalesce(health.unaudited_monitors, () => ( []));
2331
2446
  const lines = [
2332
2447
  `scope: ${_nullishCoalesce(health.scope.fleet_id, () => ( "workspace"))}${partial}`,
2333
2448
  monitorHealthLine(health)
2334
2449
  ];
2335
- if ((_nullishCoalesce(_optionalChain([health, 'access', _76 => _76.batch_operations, 'optionalAccess', _77 => _77.length]), () => ( 0))) > 0) {
2450
+ if ((_nullishCoalesce(_optionalChain([health, 'access', _92 => _92.batch_operations, 'optionalAccess', _93 => _93.length]), () => ( 0))) > 0) {
2336
2451
  lines.push("");
2337
2452
  lines.push("batch work in progress:");
2338
2453
  for (const operation of _nullishCoalesce(health.batch_operations, () => ( []))) {
@@ -2387,8 +2502,8 @@ function monitorHealthText(health) {
2387
2502
  `;
2388
2503
  }
2389
2504
  async function handleMonitorsAudit(options) {
2390
- const client = new (0, _chunkZ33PZUWGjs.DeeplineClient)();
2391
- const fleetId = _optionalChain([options, 'access', _78 => _78.fleet, 'optionalAccess', _79 => _79.trim, 'call', _80 => _80()]) || void 0;
2505
+ const client = new (0, _chunkB4Q3EBQXjs.DeeplineClient)();
2506
+ const fleetId = _optionalChain([options, 'access', _94 => _94.fleet, 'optionalAccess', _95 => _95.trim, 'call', _96 => _96()]) || void 0;
2392
2507
  const scope = fleetId ? { fleetId } : {};
2393
2508
  let result = await client.monitors.audit(scope);
2394
2509
  const passes = [result.audit];
@@ -2431,7 +2546,7 @@ async function handleMonitorsAudit(options) {
2431
2546
  "",
2432
2547
  monitorHealthText(health)
2433
2548
  ].join("\n");
2434
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
2549
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
2435
2550
  { ...result, audit: { ...result.audit, totals }, health },
2436
2551
  { json: options.json, text }
2437
2552
  );
@@ -2439,15 +2554,15 @@ async function handleMonitorsAudit(options) {
2439
2554
  async function handleMonitorsRepair(options) {
2440
2555
  return await handleMonitorBatch("repair", {
2441
2556
  ...options,
2442
- ..._optionalChain([options, 'access', _81 => _81.fleet, 'optionalAccess', _82 => _82.trim, 'call', _83 => _83()]) ? {} : { target: "needs-repair" }
2557
+ ..._optionalChain([options, 'access', _97 => _97.fleet, 'optionalAccess', _98 => _98.trim, 'call', _99 => _99()]) ? {} : { target: "needs-repair" }
2443
2558
  });
2444
2559
  }
2445
2560
  async function handleMonitorsHealth(options) {
2446
- const fleetId = _optionalChain([options, 'access', _84 => _84.fleet, 'optionalAccess', _85 => _85.trim, 'call', _86 => _86()]) || void 0;
2447
- const health = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.health(
2561
+ const fleetId = _optionalChain([options, 'access', _100 => _100.fleet, 'optionalAccess', _101 => _101.trim, 'call', _102 => _102()]) || void 0;
2562
+ const health = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.health(
2448
2563
  fleetId ? { fleetId } : {}
2449
2564
  );
2450
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, health, {
2565
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, health, {
2451
2566
  json: options.json,
2452
2567
  text: monitorHealthText(health)
2453
2568
  });
@@ -2455,8 +2570,8 @@ async function handleMonitorsHealth(options) {
2455
2570
  function monitorBatchScope(options, kind) {
2456
2571
  const selectors = [
2457
2572
  options.target ? "target" : null,
2458
- _optionalChain([options, 'access', _87 => _87.fleet, 'optionalAccess', _88 => _88.trim, 'call', _89 => _89()]) ? "fleet" : null,
2459
- _optionalChain([options, 'access', _90 => _90.keys, 'optionalAccess', _91 => _91.trim, 'call', _92 => _92()]) ? "keys" : null
2573
+ _optionalChain([options, 'access', _103 => _103.fleet, 'optionalAccess', _104 => _104.trim, 'call', _105 => _105()]) ? "fleet" : null,
2574
+ _optionalChain([options, 'access', _106 => _106.keys, 'optionalAccess', _107 => _107.trim, 'call', _108 => _108()]) ? "keys" : null
2460
2575
  ].filter((value) => value !== null);
2461
2576
  if (selectors.length === 0 && kind === "audit") {
2462
2577
  return { kind: "target", target: "all" };
@@ -2467,7 +2582,7 @@ function monitorBatchScope(options, kind) {
2467
2582
  );
2468
2583
  }
2469
2584
  if (options.target) return { kind: "target", target: options.target };
2470
- if (_optionalChain([options, 'access', _93 => _93.fleet, 'optionalAccess', _94 => _94.trim, 'call', _95 => _95()]))
2585
+ if (_optionalChain([options, 'access', _109 => _109.fleet, 'optionalAccess', _110 => _110.trim, 'call', _111 => _111()]))
2471
2586
  return { kind: "fleet", fleetId: options.fleet.trim() };
2472
2587
  const monitorKeys = (_nullishCoalesce(options.keys, () => ( ""))).split(",").map((key) => key.trim()).filter(Boolean);
2473
2588
  if (monitorKeys.length === 0) {
@@ -2478,7 +2593,7 @@ function monitorBatchScope(options, kind) {
2478
2593
  return { kind: "keys", monitorKeys };
2479
2594
  }
2480
2595
  function monitorBatchIdempotencyKey(kind, value) {
2481
- return _optionalChain([value, 'optionalAccess', _96 => _96.trim, 'call', _97 => _97()]) || `monitor-batch-${kind}-${_crypto.randomUUID.call(void 0, )}`;
2596
+ return _optionalChain([value, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()]) || `monitor-batch-${kind}-${_crypto.randomUUID.call(void 0, )}`;
2482
2597
  }
2483
2598
  function isCanonicalBatchJsonDocument(raw) {
2484
2599
  try {
@@ -2491,7 +2606,7 @@ function isCanonicalBatchJsonDocument(raw) {
2491
2606
  }
2492
2607
  }
2493
2608
  async function handleMonitorBatchDeploy(options) {
2494
- if (!_optionalChain([options, 'access', _98 => _98.file, 'optionalAccess', _99 => _99.trim, 'call', _100 => _100()])) {
2609
+ if (!_optionalChain([options, 'access', _114 => _114.file, 'optionalAccess', _115 => _115.trim, 'call', _116 => _116()])) {
2495
2610
  throw new MonitorsUsageError(
2496
2611
  "monitors batch deploy requires --file <monitors.ndjson>."
2497
2612
  );
@@ -2521,14 +2636,14 @@ async function handleMonitorBatchDeploy(options) {
2521
2636
  "deploy",
2522
2637
  options.idempotencyKey
2523
2638
  );
2524
- const result = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.batch.submit({
2639
+ const result = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.batch.submit({
2525
2640
  kind: "deploy",
2526
2641
  manifestNdjson,
2527
2642
  dryRun: options.dryRun === true,
2528
2643
  idempotencyKey
2529
2644
  });
2530
2645
  const operation = result.operation;
2531
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
2646
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
2532
2647
  { ...result, idempotency_key: idempotencyKey },
2533
2648
  {
2534
2649
  json: options.json,
@@ -2547,7 +2662,7 @@ async function handleMonitorBatch(kind, options) {
2547
2662
  );
2548
2663
  }
2549
2664
  const scope = monitorBatchScope(options, kind);
2550
- if (kind === "deactivate" && scope.kind === "target" && !_optionalChain([options, 'access', _101 => _101.reason, 'optionalAccess', _102 => _102.trim, 'call', _103 => _103()])) {
2665
+ if (kind === "deactivate" && scope.kind === "target" && !_optionalChain([options, 'access', _117 => _117.reason, 'optionalAccess', _118 => _118.trim, 'call', _119 => _119()])) {
2551
2666
  throw new MonitorsUsageError(
2552
2667
  "monitors batch deactivate --target requires --reason (for example insufficient_balance or billing_failure). Omit --reason with --keys for a customer-requested teardown."
2553
2668
  );
@@ -2556,11 +2671,11 @@ async function handleMonitorBatch(kind, options) {
2556
2671
  kind,
2557
2672
  options.idempotencyKey
2558
2673
  );
2559
- const result = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.batch.submit({
2674
+ const result = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.batch.submit({
2560
2675
  kind,
2561
2676
  scope,
2562
2677
  dryRun: options.dryRun === true,
2563
- ..._optionalChain([options, 'access', _104 => _104.reason, 'optionalAccess', _105 => _105.trim, 'call', _106 => _106()]) ? { deactivationReason: options.reason.trim() } : {},
2678
+ ..._optionalChain([options, 'access', _120 => _120.reason, 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()]) ? { deactivationReason: options.reason.trim() } : {},
2564
2679
  idempotencyKey
2565
2680
  });
2566
2681
  const operation = result.operation;
@@ -2569,14 +2684,14 @@ async function handleMonitorBatch(kind, options) {
2569
2684
  `state ${operation.state} \xB7 retry key ${idempotencyKey}`,
2570
2685
  `inspect: deepline monitors batch get ${operation.runId}`
2571
2686
  ].join("\n");
2572
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0,
2687
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0,
2573
2688
  { ...result, idempotency_key: idempotencyKey },
2574
2689
  { json: options.json, text: `${text}
2575
2690
  ` }
2576
2691
  );
2577
2692
  }
2578
2693
  async function handleMonitorBatchGet(operationId, options) {
2579
- const result = await new (0, _chunkZ33PZUWGjs.DeeplineClient)().monitors.batch.get(operationId, {
2694
+ const result = await new (0, _chunkB4Q3EBQXjs.DeeplineClient)().monitors.batch.get(operationId, {
2580
2695
  ...options.cursor ? { cursor: options.cursor } : {}
2581
2696
  });
2582
2697
  const summary = _nullishCoalesce(result.operation.summary, () => ( {}));
@@ -2588,7 +2703,7 @@ async function handleMonitorBatchGet(operationId, options) {
2588
2703
  `results ${result.results.page.length}${result.results.isDone ? "" : " (more; pass --cursor)"}`
2589
2704
  ] : []
2590
2705
  ].join("\n");
2591
- _chunkMAMEKGLIjs.printCommandEnvelope.call(void 0, result, { json: options.json, text: `${text}
2706
+ _chunkXLYJ7MJXjs.printCommandEnvelope.call(void 0, result, { json: options.json, text: `${text}
2592
2707
  ` });
2593
2708
  }
2594
2709
  function registerMonitorsCommands(program) {
@@ -2916,6 +3031,72 @@ Examples:
2916
3031
  "Include current SQL-listener consumer health (requires --limit 20 or fewer)"
2917
3032
  )
2918
3033
  ).action(monitorsAction(handleMonitorsList));
3034
+ const collect = (value, previous = []) => [
3035
+ ...previous,
3036
+ value
3037
+ ];
3038
+ withJsonOption(
3039
+ monitors.command("ledger [key]").description(
3040
+ "Show the Monitors list: status, radar filters, and the Plays each monitor triggers."
3041
+ ).addHelpText(
3042
+ "after",
3043
+ `
3044
+ Notes:
3045
+ Read-only. Lists monitors as the dashboard's Monitors page does: one row per
3046
+ monitor with its customer status, the provider-side radar filters it was
3047
+ deployed with, and the Plays its findings trigger. Pass a monitor key to see
3048
+ one monitor with every Play it can trigger and that monitor's latest run.
3049
+
3050
+ Statuses: active, setting_up, paused_credits, paused_cap, paused_billing,
3051
+ stopped. Every status except stopped is shown by default; repeat --state to
3052
+ choose. A Play is listed when a finding can trigger it: "some findings" means
3053
+ its own where filter decides per finding, and it is omitted only when a
3054
+ _dl_monitor_id filter excludes this monitor. Failing Plays (their latest
3055
+ completed monitor-triggered run failed) are listed first.
3056
+
3057
+ Each row's findings counts delivered findings in --window (UTC days,
3058
+ today included). counting_since is set when counting began inside the
3059
+ window, so the count is partial; a null count means the monitor has not
3060
+ been counted yet.
3061
+
3062
+ Filters apply before paging, so total is the filtered count. Page with
3063
+ --cursor <next_cursor> until next_cursor is null.
3064
+
3065
+ Examples:
3066
+ deepline monitors ledger
3067
+ deepline monitors ledger --state stopped
3068
+ deepline monitors ledger --state paused_credits --state paused_cap
3069
+ deepline monitors ledger --search halcyon --sort installed
3070
+ deepline monitors ledger --sort findings --window 7d
3071
+ deepline monitors ledger --play none
3072
+ deepline monitors ledger halcyon-openings --json
3073
+ deepline monitors ledger halcyon-openings --findings --json
3074
+ `
3075
+ ).option(
3076
+ "--search <text>",
3077
+ "Search name, key, subject, signal and deploy filters"
3078
+ ).option(
3079
+ "--state <state>",
3080
+ "Include a status (repeatable): active, setting_up, paused_credits, paused_cap, paused_billing, stopped",
3081
+ collect
3082
+ ).option(
3083
+ "--signal <key>",
3084
+ "Include a signal key from the response signals list (repeatable)",
3085
+ collect
3086
+ ).option(
3087
+ "--play <play>",
3088
+ 'Only monitors triggering this Play definition id, or "none" for monitors no Play listens to'
3089
+ ).option(
3090
+ "--sort <sort>",
3091
+ "recent (default; newest finding first), installed, name, or findings (most in --window first)"
3092
+ ).option(
3093
+ "--window <window>",
3094
+ "Findings window: 1d, 7d, 30d (default), 90d, or 1y"
3095
+ ).option("--limit <n>", "Rows per page (at most 100)").option("--cursor <cursor>", "Continue from a prior next_cursor").option(
3096
+ "--findings",
3097
+ "With a key: that monitor's recent findings, newest first, with each Play's recorded run"
3098
+ )
3099
+ ).action(monitorsAction(handleMonitorsLedger));
2919
3100
  withJsonOption(
2920
3101
  monitors.command("get <key>").description("Show a single deployed monitor by its public key.").addHelpText(
2921
3102
  "after",
@@ -3463,4 +3644,5 @@ Example:
3463
3644
 
3464
3645
 
3465
3646
 
3466
- exports.MonitorDryRunUnsupportedError = MonitorDryRunUnsupportedError; exports.MonitorFleetStateError = MonitorFleetStateError; exports.MonitorsUsageError = MonitorsUsageError; exports.assertMonitorDryRunAcknowledged = assertMonitorDryRunAcknowledged; exports.monitorDeleteRequiresYesError = monitorDeleteRequiresYesError; exports.monitorsErrorExitCode = monitorsErrorExitCode; exports.registerMonitorsCommands = registerMonitorsCommands; exports.renderAvailableToolsText = renderAvailableToolsText; exports.renderDeployedListText = renderDeployedListText; exports.renderMonitorDeletePlan = renderMonitorDeletePlan; exports.renderMonitorDeployCompletion = renderMonitorDeployCompletion; exports.renderMonitorDeployPlan = renderMonitorDeployPlan; exports.renderMonitorGet = renderMonitorGet; exports.renderMonitorReactivatePlan = renderMonitorReactivatePlan; exports.resolveMonitorJsonBody = resolveMonitorJsonBody;
3647
+
3648
+ exports.MonitorDryRunUnsupportedError = MonitorDryRunUnsupportedError; exports.MonitorFleetStateError = MonitorFleetStateError; exports.MonitorsUsageError = MonitorsUsageError; exports.assertMonitorDryRunAcknowledged = assertMonitorDryRunAcknowledged; exports.monitorDeleteRequiresYesError = monitorDeleteRequiresYesError; exports.monitorsErrorExitCode = monitorsErrorExitCode; exports.registerMonitorsCommands = registerMonitorsCommands; exports.renderAvailableToolsText = renderAvailableToolsText; exports.renderDeployedListText = renderDeployedListText; exports.renderMonitorDeletePlan = renderMonitorDeletePlan; exports.renderMonitorDeployCompletion = renderMonitorDeployCompletion; exports.renderMonitorDeployPlan = renderMonitorDeployPlan; exports.renderMonitorGet = renderMonitorGet; exports.renderMonitorLedgerText = renderMonitorLedgerText; exports.renderMonitorReactivatePlan = renderMonitorReactivatePlan; exports.resolveMonitorJsonBody = resolveMonitorJsonBody;