deepline 0.3.307 → 0.3.308

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 (102) hide show
  1. package/README.md +2 -1
  2. package/dist/bundling-sources/sdk/src/client.ts +270 -11
  3. package/dist/bundling-sources/sdk/src/compat.ts +27 -9
  4. package/dist/bundling-sources/sdk/src/index.ts +35 -0
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/batch-runtime.ts +4 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/batching-types.ts +3 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +46 -16
  9. package/dist/bundling-sources/shared_libs/play-runtime/fullenrich-batching.ts +24 -1
  10. package/dist/bundling-sources/shared_libs/play-runtime/run-event-query.ts +872 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +595 -0
  12. package/dist/cli/auth-LWNR7TQB.js +31 -0
  13. package/dist/cli/{auth-AJPTFFC7.mjs → auth-ZWX4BF5K.mjs} +4 -4
  14. package/dist/cli/{billing-LPDYJLIL.mjs → billing-CLV5QRFQ.mjs} +4 -4
  15. package/dist/cli/{billing-SPBWUEOS.js → billing-H24FGAKE.js} +70 -70
  16. package/dist/cli/{chunk-O4OESDIN.mjs → chunk-3GIUCJAT.mjs} +1 -1
  17. package/dist/cli/{chunk-D55NIPGU.mjs → chunk-ABMGEW3C.mjs} +1 -1
  18. package/dist/cli/{chunk-RXYYANYP.mjs → chunk-ASWZTTKT.mjs} +13 -5
  19. package/dist/cli/{chunk-G4SSYZND.mjs → chunk-BPD7TR27.mjs} +1 -1
  20. package/dist/cli/{chunk-ZGICKTW7.mjs → chunk-CXU7ME5X.mjs} +2 -2
  21. package/dist/cli/{chunk-HWCB5MHF.js → chunk-GBFIAI4L.js} +68 -60
  22. package/dist/cli/{chunk-MZQP7CIL.js → chunk-GONK2N7U.js} +1 -1
  23. package/dist/cli/{chunk-TLTKAJ6S.mjs → chunk-HGI6RGHB.mjs} +653 -5
  24. package/dist/cli/{chunk-K2CQ2RBJ.js → chunk-IFIGQWHC.js} +6 -6
  25. package/dist/cli/{chunk-7ONALPWY.mjs → chunk-JUAVGRD7.mjs} +4 -4
  26. package/dist/cli/{chunk-GUIQWUCB.js → chunk-O7NNH76S.js} +6 -6
  27. package/dist/cli/{chunk-2IKIG333.js → chunk-QJBJZVG6.js} +15 -4
  28. package/dist/cli/{chunk-AKE6ZFIJ.js → chunk-QTCFSRGC.js} +4 -4
  29. package/dist/cli/{chunk-ZIF6JOOI.js → chunk-SRZ6XDX3.js} +26 -26
  30. package/dist/cli/{chunk-MPVXXDWH.mjs → chunk-T3P4NRZU.mjs} +1 -1
  31. package/dist/cli/{chunk-KCHBE2J3.js → chunk-TH3YBIJT.js} +852 -204
  32. package/dist/cli/{chunk-DF3XJ2V2.js → chunk-UGTYNMRX.js} +48 -48
  33. package/dist/cli/{chunk-76MFV3AC.js → chunk-WEZVPZPE.js} +2 -2
  34. package/dist/cli/{chunk-UABLQKTZ.mjs → chunk-WXLOW623.mjs} +11 -0
  35. package/dist/cli/{chunk-ILOCS73R.mjs → chunk-XFYVL7EM.mjs} +2 -2
  36. package/dist/cli/{chunk-BDFVIOLY.mjs → chunk-XSDL3NHZ.mjs} +3 -3
  37. package/dist/cli/{chunk-JNHXSZPB.js → chunk-YEJMVAD3.js} +6 -6
  38. package/dist/cli/{chunk-QACDLYNO.mjs → chunk-YSZSERRZ.mjs} +1 -1
  39. package/dist/cli/{chunk-IVXD2KA2.js → chunk-ZHHF24O5.js} +15 -15
  40. package/dist/cli/client-3J76AMVE.js +20 -0
  41. package/dist/cli/{client-7ZL4ROII.mjs → client-A5ILG5GT.mjs} +3 -3
  42. package/dist/cli/{csv-Y3LYCTGD.mjs → csv-NZ7KAYEF.mjs} +3 -3
  43. package/dist/cli/{csv-JUDFG7JV.js → csv-VSSAAXFX.js} +12 -12
  44. package/dist/cli/{db-5IXGEXNT.js → db-ICLEBSNO.js} +20 -20
  45. package/dist/cli/{db-GCOJD2BD.mjs → db-YSAJUBLD.mjs} +4 -4
  46. package/dist/cli/{executions-FIICTMSY.mjs → executions-MUJRAT5R.mjs} +4 -4
  47. package/dist/cli/{executions-LIEQKFT7.js → executions-XCAJB5TF.js} +6 -6
  48. package/dist/cli/{feedback-3OVAA3C7.mjs → feedback-6C7Y2SCJ.mjs} +3 -3
  49. package/dist/cli/{feedback-FAADYNAR.js → feedback-DBZMBHZG.js} +6 -6
  50. package/dist/cli/git-2NSE4WIK.js +23 -0
  51. package/dist/cli/{git-ESMYCYJO.mjs → git-EAH67ITA.mjs} +4 -4
  52. package/dist/cli/index.js +79 -77
  53. package/dist/cli/index.mjs +33 -31
  54. package/dist/cli/{legacy-noops-PKI3RFZW.js → legacy-noops-EJTOLTVO.js} +7 -7
  55. package/dist/cli/{legacy-noops-KP5CPZRK.mjs → legacy-noops-O5INQP6Q.mjs} +4 -4
  56. package/dist/cli/{monitors-KCFBLAFZ.js → monitors-5OYO2DPJ.js} +85 -85
  57. package/dist/cli/{monitors-A6KGGSBO.mjs → monitors-SBBBMUFY.mjs} +4 -4
  58. package/dist/cli/{org-WI6DEXZQ.js → org-SJRPJG42.js} +60 -60
  59. package/dist/cli/{org-DHI24UOK.mjs → org-Z7LTOL3H.mjs} +4 -4
  60. package/dist/cli/{play-2YXLQD24.mjs → play-2JTIEOZM.mjs} +472 -55
  61. package/dist/cli/{play-4EUUN76H.js → play-VQJ6ABZ2.js} +961 -544
  62. package/dist/cli/{providers-DWS3XIM6.js → providers-43MR5XOV.js} +7 -7
  63. package/dist/cli/{providers-2WZ6KHH2.mjs → providers-MX4CV2EH.mjs} +4 -4
  64. package/dist/cli/{quickstart-TDTDKM6F.js → quickstart-A6W3HEE2.js} +5 -5
  65. package/dist/cli/{quickstart-ZFZVG6UO.mjs → quickstart-Y4YLKRZ3.mjs} +3 -3
  66. package/dist/cli/{search-GMPXRQF4.js → search-AMUFSAFP.js} +6 -6
  67. package/dist/cli/{search-BBE2ZMCI.mjs → search-FRKDLJQG.mjs} +5 -5
  68. package/dist/cli/{secrets-JEJL3KIM.mjs → secrets-E4EX7O3J.mjs} +4 -4
  69. package/dist/cli/{secrets-SMBX4IE6.js → secrets-XITHKZW2.js} +13 -13
  70. package/dist/cli/{sessions-S6AWG747.js → sessions-6HJFDIR2.js} +5 -5
  71. package/dist/cli/{sessions-AVU353UT.mjs → sessions-6YXAUJII.mjs} +4 -4
  72. package/dist/cli/{settings-KBW4ROHC.js → settings-J5NRLCV2.js} +74 -74
  73. package/dist/cli/{settings-GY5CYRLF.mjs → settings-LBJSZIET.mjs} +7 -7
  74. package/dist/cli/{setup-WSVIDSEV.js → setup-2ES4CTO5.js} +41 -41
  75. package/dist/cli/{setup-4CW3XGGX.mjs → setup-75FENNVH.mjs} +6 -6
  76. package/dist/cli/skills-VLTAVA4K.js +28 -0
  77. package/dist/cli/{skills-U3NXFSFK.mjs → skills-XGZDUXW6.mjs} +4 -4
  78. package/dist/cli/{tools-XU6KLJZT.mjs → tools-2LEKXOGY.mjs} +58 -42
  79. package/dist/cli/{tools-KZKELW25.js → tools-ZOQOGDKI.js} +111 -95
  80. package/dist/cli/update-5CZOVYQT.js +28 -0
  81. package/dist/cli/{update-RZLH46DR.mjs → update-SNK3IN3I.mjs} +6 -6
  82. package/dist/cli/{workflow-ZQUKQI35.mjs → workflow-G7ZM3MAC.mjs} +5 -5
  83. package/dist/cli/{workflow-GDOGDGTZ.js → workflow-W3AYTB3J.js} +15 -15
  84. package/dist/{client-Dj8MAkDc.d.mts → client-DpnkGBn-.d.mts} +324 -11
  85. package/dist/{client-DsrFGXJf.d.ts → client-ypdBvf1o.d.ts} +324 -11
  86. package/dist/index.d.mts +2 -2
  87. package/dist/index.d.ts +2 -2
  88. package/dist/index.js +8 -6
  89. package/dist/index.mjs +5 -3
  90. package/dist/install-integrity.json +73 -72
  91. package/dist/plays/run-request.d.mts +1 -1
  92. package/dist/plays/run-request.d.ts +1 -1
  93. package/dist/release.d.mts +1 -1
  94. package/dist/release.d.ts +1 -1
  95. package/dist/release.js +2 -2
  96. package/dist/release.mjs +1 -1
  97. package/package.json +1 -1
  98. package/dist/cli/auth-TUQTQIH4.js +0 -31
  99. package/dist/cli/client-S3MIFPM2.js +0 -20
  100. package/dist/cli/git-GG6LWE2R.js +0 -23
  101. package/dist/cli/skills-6AU3RRAD.js +0 -28
  102. package/dist/cli/update-LVXXQF4A.js +0 -28
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  handleDeploymentGet,
3
3
  handleDeploymentsList
4
- } from "./chunk-ILOCS73R.mjs";
4
+ } from "./chunk-XFYVL7EM.mjs";
5
5
  import {
6
6
  parseCsvDataInput
7
7
  } from "./chunk-EDWJY6T4.mjs";
8
8
  import {
9
9
  registerDeprecatedSearchCommand
10
- } from "./chunk-BDFVIOLY.mjs";
10
+ } from "./chunk-XSDL3NHZ.mjs";
11
11
  import {
12
12
  PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY,
13
13
  PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER,
@@ -20,15 +20,17 @@ import {
20
20
  CSV_HEADER_MATCHING_NOTE,
21
21
  DeeplineClient,
22
22
  RUN_EVENT_SEARCH_KIND_VALUES,
23
+ RunEventQueryInputError,
23
24
  classifyLogLine,
24
25
  encodeRunLogsCursor,
25
26
  isRunLogsCursor,
26
27
  isTransientPlayRunReadError,
27
28
  logLevelReaches,
28
29
  logProvenanceReaches,
30
+ normalizeRunEventOperationRequest,
29
31
  parseLogLevel,
30
32
  playInputExampleArgs
31
- } from "./chunk-TLTKAJ6S.mjs";
33
+ } from "./chunk-HGI6RGHB.mjs";
32
34
  import {
33
35
  CSV_DATA_INPUT_KEY,
34
36
  buildNamedPlayRunRequest,
@@ -58,13 +60,14 @@ import {
58
60
  printCommandEnvelope,
59
61
  printCompactJson,
60
62
  printJson,
63
+ printJsonError,
61
64
  renderCommandEnvelopeText
62
- } from "./chunk-D55NIPGU.mjs";
65
+ } from "./chunk-ABMGEW3C.mjs";
63
66
  import {
64
67
  fetchWithDeploymentProtection
65
- } from "./chunk-MPVXXDWH.mjs";
68
+ } from "./chunk-T3P4NRZU.mjs";
66
69
  import "./chunk-DLIRSHV6.mjs";
67
- import "./chunk-QACDLYNO.mjs";
70
+ import "./chunk-YSZSERRZ.mjs";
68
71
  import {
69
72
  PLAY_DEFAULT_EXPORT,
70
73
  extractDefinedPlayName,
@@ -2711,6 +2714,8 @@ function renderRunLogsHelp() {
2711
2714
  "",
2712
2715
  "Examples:",
2713
2716
  ` ${READ_EXAMPLES[0]}`,
2717
+ " deepline runs logs '<run-id>' --step company-lookup --level warn --since 1h",
2718
+ " deepline runs logs '<run-id>' --query timeout --count --json",
2714
2719
  ` deepline runs logs --where '$.eventId == "receipt:5a32ee1a-46cf-4853-b72b-5f1d782ffab4"' --payloads --json`,
2715
2720
  " deepline runs logs --kind run.failed --json",
2716
2721
  ...[
@@ -2731,20 +2736,408 @@ function renderRunLogsHelp() {
2731
2736
  "Quote the whole filter with single shell quotes. Strings use double quotes; numbers and booleans are unquoted.",
2732
2737
  "Missing fields do not match. Maximum eight matches and 512 bytes per filter."
2733
2738
  ].map((note) => wrapParagraph(note)),
2739
+ " With --step/--level/--query, filters also support ranges, ||, in and exists.",
2740
+ " --count is exact; --group-by pages groups; --sum totals numeric fields.",
2741
+ " Use --fields for available fields. Use runs events for lifecycle events.",
2734
2742
  "",
2735
2743
  "Search:",
2736
2744
  ...[
2737
- "A run ID alone reads text logs. Omit it or add a search flag to search events; a supplied run ID narrows the search.",
2738
- "Defaults to the last hour; maximum lookback is seven days. Follow next.logs for events; use nextCursor with --cursor for older text logs.",
2739
- "--payloads returns available details or saved results: up to 10 events and 16 MiB.",
2740
- "To read one exact saved result, filter by its returned eventId and add --payloads.",
2741
- "--out, --failed and --log-level apply to text logs and cannot be combined with event search."
2745
+ "Defaults to the last hour; maximum lookback is seven days.",
2746
+ "Follow next.page for log queries, next.logs for compatibility event search.",
2747
+ "Text logs use nextCursor with --cursor. --payloads: 10 events and 16 MiB.",
2748
+ "Find an exact saved result by returned eventId and add --payloads.",
2749
+ "--out, --failed and --log-level cannot be combined with event search."
2742
2750
  ].map((note) => wrapParagraph(note)),
2743
2751
  "",
2744
2752
  "More examples: https://deepline.com/docs/sdk-v2/run-events"
2745
2753
  ].join("\n");
2746
2754
  }
2747
2755
 
2756
+ // src/cli/run-event-query.ts
2757
+ import { Option } from "commander";
2758
+ var STRUCTURED_LOG_FLAGS = /* @__PURE__ */ new Set([
2759
+ "--step",
2760
+ "--level",
2761
+ "--query",
2762
+ "--count",
2763
+ "--group-by",
2764
+ "--sum",
2765
+ "--fields"
2766
+ ]);
2767
+ var VALUE_FLAGS = /* @__PURE__ */ new Set([
2768
+ "--since",
2769
+ "--until",
2770
+ "--play",
2771
+ "--kind",
2772
+ "--where",
2773
+ "--step",
2774
+ "--level",
2775
+ "--query",
2776
+ "--limit",
2777
+ "--cursor",
2778
+ "--group-by",
2779
+ "--sum",
2780
+ "--runtime-namespace",
2781
+ "--runtime-backend"
2782
+ ]);
2783
+ var SWITCH_FLAGS = /* @__PURE__ */ new Set(["--json", "--count", "--payloads", "--fields"]);
2784
+ function requestsStructuredLogs(args) {
2785
+ return args.some((arg) => STRUCTURED_LOG_FLAGS.has(arg.split("=", 1)[0]));
2786
+ }
2787
+ function configureRunQueryCommandErrors(command, resource) {
2788
+ command.exitOverride((error) => {
2789
+ let program = command;
2790
+ while (program.parent) program = program.parent;
2791
+ const args = program.args;
2792
+ if (error.exitCode !== 0 && (resource === "events" || requestsStructuredLogs(args))) {
2793
+ error.exitCode = 2;
2794
+ if (argsWantJson(args) || command.optsWithGlobals().json === true) {
2795
+ printJsonError(
2796
+ Object.assign(new RunEventQueryInputError(error.message), {
2797
+ exitCode: 2,
2798
+ retryable: false
2799
+ })
2800
+ );
2801
+ }
2802
+ }
2803
+ throw error;
2804
+ });
2805
+ }
2806
+ function shellQuote(value) {
2807
+ return `'${value.replace(/'/g, `'\\''`)}'`;
2808
+ }
2809
+ function terminalText(value) {
2810
+ return value.replace(
2811
+ /[\u0000-\u001f\u007f-\u009f]/g,
2812
+ (control) => `\\x${control.codePointAt(0).toString(16).padStart(2, "0")}`
2813
+ );
2814
+ }
2815
+ function renderEvent(event, resource) {
2816
+ const context = event.context === void 0 ? "" : ` ${JSON.stringify(event.context)}`;
2817
+ const identity = resource === "logs" ? `${event.level ?? "unknown"}${event.stepId ? ` [${event.stepId}]` : ""}` : `${event.kind} ${event.runId}${event.stepId ? ` [${event.stepId}]` : ""}`;
2818
+ const message = event.message ?? "";
2819
+ const details = [
2820
+ event.eventPayload === void 0 ? "" : `event: ${JSON.stringify(event.eventPayload)}`,
2821
+ event.payload === void 0 ? "" : `payload: ${JSON.stringify(event.payload)}`
2822
+ ].filter(Boolean);
2823
+ return [
2824
+ terminalText(`${event.occurredAt} ${identity} ${message}${context}`),
2825
+ ...details.map(terminalText)
2826
+ ].join("\n");
2827
+ }
2828
+ function parseQuery(args, resource) {
2829
+ const values = {};
2830
+ const switches = /* @__PURE__ */ new Set();
2831
+ const sums = [];
2832
+ let runId;
2833
+ for (let index = 0; index < args.length; index += 1) {
2834
+ const arg = args[index];
2835
+ const equals = arg.indexOf("=");
2836
+ const flag = equals > 0 ? arg.slice(0, equals) : arg;
2837
+ if (VALUE_FLAGS.has(flag)) {
2838
+ const value = equals > 0 ? arg.slice(equals + 1) : args[++index];
2839
+ if (!value || equals < 0 && value.startsWith("--") && flag !== "--query" && flag !== "--where") {
2840
+ throw new RunEventQueryInputError(
2841
+ `${flag} requires a value. Use ${flag} <value>.`
2842
+ );
2843
+ }
2844
+ if (flag === "--sum") sums.push(value);
2845
+ else {
2846
+ if (values[flag] !== void 0) {
2847
+ throw new RunEventQueryInputError(
2848
+ `${flag} may only be supplied once.`
2849
+ );
2850
+ }
2851
+ values[flag] = value;
2852
+ }
2853
+ continue;
2854
+ }
2855
+ if (SWITCH_FLAGS.has(flag) && equals < 0) {
2856
+ switches.add(flag);
2857
+ continue;
2858
+ }
2859
+ if (arg.startsWith("-")) {
2860
+ const correction = flag === "--log-level" ? "Use --level for structured severity filtering." : flag === "--out" || flag === "--failed" || flag === "--all" ? "Use this flag with a plain runs logs <run-id> text read." : "Use --step, --level, --query, --where, --count, --group-by or --fields; see runs logs --help.";
2861
+ throw new RunEventQueryInputError(
2862
+ `Unsupported query flag ${flag}. ${correction}`
2863
+ );
2864
+ }
2865
+ if (runId !== void 0) {
2866
+ throw new RunEventQueryInputError(
2867
+ `Unexpected argument ${JSON.stringify(arg)}. Supply one run ID.`
2868
+ );
2869
+ }
2870
+ runId = arg;
2871
+ }
2872
+ if (switches.has("--fields")) {
2873
+ if (runId !== void 0) {
2874
+ throw new RunEventQueryInputError(
2875
+ "--fields does not use a run ID. Omit the positional run ID."
2876
+ );
2877
+ }
2878
+ const incompatible = [
2879
+ ...switches.has("--count") ? ["--count"] : [],
2880
+ ...switches.has("--payloads") ? ["--payloads"] : [],
2881
+ ...sums.length ? ["--sum"] : [],
2882
+ ...Object.keys(values).filter(
2883
+ (flag) => flag !== "--runtime-namespace" && flag !== "--runtime-backend"
2884
+ )
2885
+ ];
2886
+ if (incompatible.length) {
2887
+ throw new RunEventQueryInputError(
2888
+ `--fields cannot be combined with ${incompatible.join(", ")}. Use --fields alone to discover the query contract.`
2889
+ );
2890
+ }
2891
+ }
2892
+ if (switches.has("--count") && values["--group-by"] !== void 0) {
2893
+ throw new RunEventQueryInputError(
2894
+ "--count cannot be combined with --group-by. Use --group-by for counts per group."
2895
+ );
2896
+ }
2897
+ if (sums.length && switches.has("--count")) {
2898
+ throw new RunEventQueryInputError(
2899
+ "--sum cannot be combined with --count. Use --sum for the exact count and numeric total."
2900
+ );
2901
+ }
2902
+ const operation = switches.has("--fields") ? "fields" : switches.has("--count") ? "count" : values["--group-by"] !== void 0 || sums.length > 0 ? "summarize" : "list";
2903
+ if (operation === "count") {
2904
+ for (const flag of ["--limit", "--cursor", "--payloads"]) {
2905
+ if (values[flag] !== void 0 || switches.has(flag)) {
2906
+ throw new RunEventQueryInputError(
2907
+ `--count cannot be combined with ${flag}. Remove ${flag} to count all matching retained records.`
2908
+ );
2909
+ }
2910
+ }
2911
+ }
2912
+ const body = {
2913
+ operation,
2914
+ resource,
2915
+ ...runId === void 0 ? {} : { runId }
2916
+ };
2917
+ for (const [flag, key] of [
2918
+ ["--since", "since"],
2919
+ ["--until", "until"],
2920
+ ["--play", "playName"],
2921
+ ["--kind", "kind"],
2922
+ ["--where", "where"],
2923
+ ["--step", "stepId"],
2924
+ ["--level", "minLevel"],
2925
+ ["--query", "text"],
2926
+ ["--cursor", "cursor"]
2927
+ ]) {
2928
+ if (values[flag] !== void 0) body[key] = values[flag];
2929
+ }
2930
+ if (values["--limit"] !== void 0) body.limit = Number(values["--limit"]);
2931
+ if (switches.has("--payloads")) body.includePayloads = true;
2932
+ if (operation === "summarize") {
2933
+ body.groupBy = values["--group-by"] === void 0 ? [] : values["--group-by"].split(",").map((field) => field.trim());
2934
+ if (sums.length) {
2935
+ body.measures = [
2936
+ { op: "count" },
2937
+ ...sums.map((field) => ({ op: "sum", field }))
2938
+ ];
2939
+ }
2940
+ }
2941
+ const request = normalizeRunEventOperationRequest(body);
2942
+ const namespace = values["--runtime-namespace"] ?? (process.env.DEEPLINE_RUNTIME_ENVIRONMENT === "preview" ? process.env.DEEPLINE_RUNTIME_NAMESPACE : void 0);
2943
+ const backend = values["--runtime-backend"];
2944
+ if (backend && backend !== "daytona" && backend !== "modal") {
2945
+ throw new RunEventQueryInputError(
2946
+ "--runtime-backend must be daytona or modal."
2947
+ );
2948
+ }
2949
+ if (backend && !namespace) {
2950
+ throw new RunEventQueryInputError(
2951
+ "--runtime-backend requires --runtime-namespace."
2952
+ );
2953
+ }
2954
+ return {
2955
+ request,
2956
+ values,
2957
+ sums,
2958
+ ...namespace ? {
2959
+ runtime: {
2960
+ environment: "preview",
2961
+ namespace,
2962
+ ...backend ? { backend } : {}
2963
+ }
2964
+ } : {}
2965
+ };
2966
+ }
2967
+ function continuation(parsed, query, cursor) {
2968
+ const { request, values, sums, runtime } = parsed;
2969
+ return [
2970
+ `deepline runs ${request.resource}`,
2971
+ ...request.runId ? [shellQuote(request.runId)] : [],
2972
+ "--since",
2973
+ shellQuote(String(query.since)),
2974
+ "--until",
2975
+ shellQuote(String(query.until)),
2976
+ ...["--play", "--kind", "--where", "--step", "--level", "--query"].flatMap(
2977
+ (flag) => values[flag] === void 0 ? [] : [flag, shellQuote(values[flag])]
2978
+ ),
2979
+ ...request.operation === "summarize" && values["--group-by"] !== void 0 ? ["--group-by", shellQuote(values["--group-by"])] : [],
2980
+ ...sums.flatMap((field) => ["--sum", shellQuote(field)]),
2981
+ ...request.operation === "list" && request.includePayloads ? ["--payloads"] : [],
2982
+ ...runtime ? ["--runtime-namespace", shellQuote(runtime.namespace)] : [],
2983
+ ...runtime?.backend ? ["--runtime-backend", shellQuote(runtime.backend)] : [],
2984
+ "--limit",
2985
+ String("limit" in request ? request.limit : ""),
2986
+ "--cursor",
2987
+ shellQuote(cursor),
2988
+ "--json"
2989
+ ].join(" ");
2990
+ }
2991
+ async function handleRunEventQuery(args, resource = "logs") {
2992
+ try {
2993
+ return await executeRunEventQuery(args, resource);
2994
+ } catch (error) {
2995
+ const failure = error instanceof Error ? error : new Error(String(error));
2996
+ const record3 = failure;
2997
+ const status = record3.statusCode;
2998
+ const exitCode = error instanceof RunEventQueryInputError || status === 400 || status === 422 || record3.code === "INVALID_RUNTIME_SELECTION" ? 2 : status === 401 || status === 403 || record3.code === "CONFIG_ERROR" || record3.code === "RUNTIME_ENVIRONMENT_TOKEN_REQUIRED" ? 3 : status === 404 ? 4 : 5;
2999
+ const diagnostic = Object.assign(failure, {
3000
+ exitCode,
3001
+ retryable: exitCode === 5
3002
+ });
3003
+ if (argsWantJson(args)) printJsonError(diagnostic);
3004
+ else console.error(`Error: ${diagnostic.message}`);
3005
+ return exitCode;
3006
+ }
3007
+ }
3008
+ async function executeRunEventQuery(args, resource) {
3009
+ const parsed = parseQuery(args, resource);
3010
+ const { request, runtime } = parsed;
3011
+ const {
3012
+ operation: _operation,
3013
+ resource: _resource,
3014
+ runId,
3015
+ ...criteria
3016
+ } = request;
3017
+ const options = { ...criteria, ...runtime ? { runtime } : {} };
3018
+ const client = new DeeplineClient();
3019
+ let result;
3020
+ if (request.operation === "fields") {
3021
+ result = await client.runs[resource].fields(runtime ? { runtime } : {});
3022
+ } else if (request.operation === "count") {
3023
+ result = resource === "logs" ? await client.runs.logs.count(runId, options) : await client.runs.events.count({
3024
+ ...options,
3025
+ ...runId ? { runId } : {}
3026
+ });
3027
+ } else if (request.operation === "summarize") {
3028
+ const summary = {
3029
+ ...options,
3030
+ groupBy: request.groupBy,
3031
+ measures: request.measures,
3032
+ limit: request.limit,
3033
+ cursor: request.cursor
3034
+ };
3035
+ result = resource === "logs" ? await client.runs.logs.summarize(runId, summary) : await client.runs.events.summarize({
3036
+ ...summary,
3037
+ ...runId ? { runId } : {}
3038
+ });
3039
+ } else {
3040
+ result = resource === "logs" ? await client.runs.logs.query(runId, options) : await client.runs.events.list({
3041
+ ...options,
3042
+ ...runId ? { runId } : {}
3043
+ });
3044
+ }
3045
+ let lines;
3046
+ let nextPage;
3047
+ if ("fields" in result) {
3048
+ lines = [
3049
+ ...result.fields.map(
3050
+ (field) => `${field.field} (${field.type}${field.nullable ? ", optional" : ""}): ${field.operators.join(", ")}${field.summable ? "; sum" : ""}`
3051
+ ),
3052
+ `${result.context.field} (${result.context.type}): ${result.context.operators.join(", ")}; sum numeric values`,
3053
+ "Missing fields are distinct from null. Only recorded values match."
3054
+ ];
3055
+ } else {
3056
+ if ("matchedCount" in result) {
3057
+ lines = [`${result.matchedCount} matching retained ${resource} (exact).`];
3058
+ } else if ("groups" in result) {
3059
+ lines = result.groups.map(
3060
+ (group) => [
3061
+ ...Object.entries(group.keys).map(
3062
+ ([field, value]) => `${field}=${typeof value === "object" && value !== null && "missing" in value ? "<missing>" : JSON.stringify(value)}`
3063
+ ),
3064
+ ...Object.entries(group.measures).map(
3065
+ ([name, value]) => `${name}=${value}`
3066
+ )
3067
+ ].join(" ")
3068
+ );
3069
+ if (lines.length === 0) lines.push("0 matching retained groups.");
3070
+ } else {
3071
+ const entries = "logs" in result ? result.logs : result.events;
3072
+ lines = entries.map((event) => renderEvent(event, resource));
3073
+ if (lines.length === 0) lines.push(`0 matching retained ${resource}.`);
3074
+ }
3075
+ lines.push(
3076
+ `Retained history since ${result.retention.retainedSince} (${result.retention.retentionDays} days).`
3077
+ );
3078
+ if ("page" in result && result.page.nextCursor) {
3079
+ nextPage = continuation(parsed, result.query, result.page.nextCursor);
3080
+ lines.push(`Next page: ${nextPage}`);
3081
+ }
3082
+ }
3083
+ printCommandEnvelope(
3084
+ {
3085
+ ...result,
3086
+ ...nextPage ? { next: { page: nextPage } } : {},
3087
+ render: { sections: [{ title: `run ${resource}`, lines }] }
3088
+ },
3089
+ { json: argsWantJson(args), text: `${lines.join("\n")}
3090
+ ` }
3091
+ );
3092
+ return 0;
3093
+ }
3094
+ function registerRunEventsCommand(runs) {
3095
+ const command = runs.command("events [runId]").description("Query, count or summarize retained run events.").option("--since <time>", "Inclusive UTC time or lookback such as 1h").option("--until <time>", "Exclusive UTC time").option("--play <name>", "Exact Play name").option("--kind <kind>", "Exact event kind").option("--where <filter>", "Typed comparisons with &&, || and parentheses").option("--step <id>", "Exact authored step ID").option("--level <level>", "Minimum severity: debug, info, warn or error").option("--query <text>", "Literal text in the full retained log message").option("--count", "Exact retained count; no limit, cursor or payloads").option("--group-by <fields>", "Count groups by comma-separated fields").option(
3096
+ "--sum <field>",
3097
+ "Count and sum numeric values; repeatable, optionally grouped",
3098
+ (field, previous) => [...previous, field],
3099
+ []
3100
+ ).option("--fields", "Discover filter fields, types and operators").option("--limit <count>", "Rows or groups per page (maximum 200)").option("--cursor <token>", "Continue the exact preceding query").option("--payloads", "Include saved details: at most 10 events and 16 MiB").option("--json", "JSON output; automatic when piped").addOption(
3101
+ new Option(
3102
+ "--runtime-namespace <name>",
3103
+ "Authorized Preview namespace"
3104
+ ).hideHelp()
3105
+ ).addOption(
3106
+ new Option(
3107
+ "--runtime-backend <backend>",
3108
+ "Preview backend: daytona or modal"
3109
+ ).hideHelp()
3110
+ ).addHelpText(
3111
+ "after",
3112
+ "\nExamples:\n deepline runs events --kind step.failed --since 1h --json\n deepline runs events --group-by kind --since 1h --json\n deepline runs events --fields --json\n"
3113
+ ).action(async (runId, options) => {
3114
+ const args = runId ? [runId] : [];
3115
+ for (const [key, flag] of [
3116
+ ["since", "--since"],
3117
+ ["until", "--until"],
3118
+ ["play", "--play"],
3119
+ ["kind", "--kind"],
3120
+ ["where", "--where"],
3121
+ ["step", "--step"],
3122
+ ["level", "--level"],
3123
+ ["query", "--query"],
3124
+ ["groupBy", "--group-by"],
3125
+ ["limit", "--limit"],
3126
+ ["cursor", "--cursor"],
3127
+ ["runtimeNamespace", "--runtime-namespace"],
3128
+ ["runtimeBackend", "--runtime-backend"]
3129
+ ]) {
3130
+ if (options[key] !== void 0) args.push(flag, options[key]);
3131
+ }
3132
+ for (const field of options.sum ?? []) args.push("--sum", field);
3133
+ for (const flag of ["count", "fields", "payloads", "json"]) {
3134
+ if (options[flag]) args.push(`--${flag}`);
3135
+ }
3136
+ process.exitCode = await handleRunEventQuery(args, "events");
3137
+ });
3138
+ configureRunQueryCommandErrors(command, "events");
3139
+ }
3140
+
2748
3141
  // ../play-runtime/run-execution-state.ts
2749
3142
  function assertNeverState(value, what) {
2750
3143
  throw new Error(`Unhandled ${what}: ${JSON.stringify(value)}`);
@@ -3570,7 +3963,7 @@ import {
3570
3963
  relative as relative3,
3571
3964
  resolve as resolve5
3572
3965
  } from "path";
3573
- import { Option } from "commander";
3966
+ import { Option as Option2 } from "commander";
3574
3967
 
3575
3968
  // src/cli/commands/plays/bootstrap.ts
3576
3969
  import {
@@ -5317,7 +5710,7 @@ Existing credential redactions and referenced-list previews remain as stored.
5317
5710
  }
5318
5711
 
5319
5712
  // src/cli/commands/run-children.ts
5320
- function shellQuote(value) {
5713
+ function shellQuote2(value) {
5321
5714
  return `'${value.replace(/'/g, `'\\''`)}'`;
5322
5715
  }
5323
5716
  function registerRunChildrenCommand(runs) {
@@ -5352,11 +5745,11 @@ includes nextCommand when another page is available.
5352
5745
  });
5353
5746
  const nextCommand = page.hasMore && page.nextCursor ? [
5354
5747
  "deepline runs children",
5355
- shellQuote(parentRunId),
5748
+ shellQuote2(parentRunId),
5356
5749
  "--launch-key",
5357
- shellQuote(options.launchKey),
5750
+ shellQuote2(options.launchKey),
5358
5751
  "--cursor",
5359
- shellQuote(page.nextCursor),
5752
+ shellQuote2(page.nextCursor),
5360
5753
  "--limit",
5361
5754
  String(limit),
5362
5755
  "--json"
@@ -8944,7 +9337,7 @@ function rankPlayReferenceSuggestions(input) {
8944
9337
  function searchQueryForMissingPlayReference(target) {
8945
9338
  return parseReferencedPlayTarget2(target).unqualifiedPlayName.replace(/[-_./]+/g, " ").replace(/\s+/g, " ").trim();
8946
9339
  }
8947
- function shellQuote2(value) {
9340
+ function shellQuote3(value) {
8948
9341
  return `'${value.replace(/'/g, `'\\''`)}'`;
8949
9342
  }
8950
9343
  function buildPlayReferenceNotFoundMessage(input) {
@@ -8977,7 +9370,7 @@ function buildPlayReferenceNotFoundMessage(input) {
8977
9370
  lines.push(
8978
9371
  "",
8979
9372
  "Search visible plays:",
8980
- ` deepline search --type plays ${shellQuote2(searchQuery)} --json`
9373
+ ` deepline search --type plays ${shellQuote3(searchQuery)} --json`
8981
9374
  );
8982
9375
  }
8983
9376
  return lines.join("\n");
@@ -13940,7 +14333,7 @@ async function handlePlayCheck(args) {
13940
14333
  runtimeLimit: play.runtimeLimit ?? null,
13941
14334
  activeScheduledPlays: play.activeScheduledPlays ?? null,
13942
14335
  actions: {
13943
- getFullCheckCmd: `deepline plays check ${shellQuote2(options.target)} --full --json`,
14336
+ getFullCheckCmd: `deepline plays check ${shellQuote3(options.target)} --full --json`,
13944
14337
  ...play.runCommand ? { runCmd: play.runCommand } : {}
13945
14338
  },
13946
14339
  ...options.full ? { diagnostics: { staticPipeline: play.staticPipeline ?? null } } : {}
@@ -13994,8 +14387,8 @@ async function handlePlayCheck(args) {
13994
14387
  outcomes,
13995
14388
  target: options.target,
13996
14389
  full: options.full,
13997
- detailsCommand: `deepline plays check ${shellQuote2(options.target)} --full --json`,
13998
- publishCommand: primary?.result.artifactHash ? `deepline plays publish ${shellQuote2(options.target)} --expected-artifact ${primary.result.artifactHash}` : void 0
14390
+ detailsCommand: `deepline plays check ${shellQuote3(options.target)} --full --json`,
14391
+ publishCommand: primary?.result.artifactHash ? `deepline plays publish ${shellQuote3(options.target)} --expected-artifact ${primary.result.artifactHash}` : void 0
13999
14392
  });
14000
14393
  printCommandEnvelope(output, {
14001
14394
  json: options.jsonOutput,
@@ -15083,7 +15476,7 @@ Active runs: ${next.running}`
15083
15476
  return lines2.join("\n");
15084
15477
  });
15085
15478
  const nextOffset = (page.offset ?? offset ?? 0) + runs.length;
15086
- const nextPage = page.hasMore && playName ? `deepline runs list --play ${shellQuote2(playName)}${statusFilter ? ` --status ${shellQuote2(statusFilter)}` : ""} --limit ${page.limit ?? limit ?? 20} --offset ${nextOffset} --json` : null;
15479
+ const nextPage = page.hasMore && playName ? `deepline runs list --play ${shellQuote3(playName)}${statusFilter ? ` --status ${shellQuote3(statusFilter)}` : ""} --limit ${page.limit ?? limit ?? 20} --offset ${nextOffset} --json` : null;
15087
15480
  if (page.hasMore) {
15088
15481
  lines.push("List truncated \u2014 more runs match this filter.");
15089
15482
  lines.push(
@@ -15242,6 +15635,7 @@ async function handleRunTail(args) {
15242
15635
  return status.status === "failed" ? 1 : 0;
15243
15636
  }
15244
15637
  async function handleRunLogs(args) {
15638
+ if (requestsStructuredLogs(args)) return handleRunEventQuery(args, "logs");
15245
15639
  const searchFlags = /* @__PURE__ */ new Set([
15246
15640
  "--since",
15247
15641
  "--until",
@@ -15575,19 +15969,19 @@ ${renderedDetails}` : ""}`;
15575
15969
  });
15576
15970
  const nextCommand = result.nextCursor ? [
15577
15971
  "deepline runs logs",
15578
- ...runId ? [shellQuote2(runId)] : [],
15972
+ ...runId ? [shellQuote3(runId)] : [],
15579
15973
  "--since",
15580
- shellQuote2(result.since),
15974
+ shellQuote3(result.since),
15581
15975
  "--until",
15582
- shellQuote2(result.until),
15583
- ...values["--play"] ? ["--play", shellQuote2(values["--play"])] : [],
15584
- ...values["--kind"] ? ["--kind", shellQuote2(values["--kind"])] : [],
15585
- ...values["--where"] ? ["--where", shellQuote2(values["--where"])] : [],
15976
+ shellQuote3(result.until),
15977
+ ...values["--play"] ? ["--play", shellQuote3(values["--play"])] : [],
15978
+ ...values["--kind"] ? ["--kind", shellQuote3(values["--kind"])] : [],
15979
+ ...values["--where"] ? ["--where", shellQuote3(values["--where"])] : [],
15586
15980
  ...includePayloads ? ["--payloads"] : [],
15587
- ...namespace ? ["--runtime-namespace", shellQuote2(namespace)] : [],
15588
- ...backend ? ["--runtime-backend", shellQuote2(backend)] : [],
15981
+ ...namespace ? ["--runtime-namespace", shellQuote3(namespace)] : [],
15982
+ ...backend ? ["--runtime-backend", shellQuote3(backend)] : [],
15589
15983
  "--cursor",
15590
- shellQuote2(result.nextCursor),
15984
+ shellQuote3(result.nextCursor),
15591
15985
  "--limit",
15592
15986
  String(limit),
15593
15987
  "--json"
@@ -16230,7 +16624,7 @@ async function handlePlayList(args) {
16230
16624
  );
16231
16625
  return 1;
16232
16626
  }
16233
- const nextPage = page.hasMore && page.cursor ? `deepline plays list${categories ? ` --categories ${shellQuote2(categories)}` : ""}${tags.map((tag) => ` --tag ${shellQuote2(tag)}`).join("")}${limit ? ` --limit ${limit}` : ""}${showCost ? " --show-cost" : ""} --cursor ${shellQuote2(page.cursor)} --json` : null;
16627
+ const nextPage = page.hasMore && page.cursor ? `deepline plays list${categories ? ` --categories ${shellQuote3(categories)}` : ""}${tags.map((tag) => ` --tag ${shellQuote3(tag)}`).join("")}${limit ? ` --limit ${limit}` : ""}${showCost ? " --show-cost" : ""} --cursor ${shellQuote3(page.cursor)} --json` : null;
16234
16628
  if (page.hasMore && !nextPage) {
16235
16629
  throw new Error(
16236
16630
  "Play list reported more results without a continuation cursor"
@@ -16578,7 +16972,7 @@ async function handlePlaySave(args) {
16578
16972
  message: "Refusing to save: the local file no longer produces the artifact checked earlier.",
16579
16973
  expectedArtifactHash: options.expectedArtifactHash,
16580
16974
  currentArtifactHash: artifactHash,
16581
- next: `deepline plays check ${shellQuote2(options.target)}`
16975
+ next: `deepline plays check ${shellQuote3(options.target)}`
16582
16976
  };
16583
16977
  if (options.jsonOutput) {
16584
16978
  printCompactJson(result);
@@ -16643,7 +17037,7 @@ async function handlePlaySave(args) {
16643
17037
  graphHash: graph.root.artifact.graphHash,
16644
17038
  artifactStorageKey: saved.artifactStorageKey,
16645
17039
  next: {
16646
- publish: `deepline plays publish ${shellQuote2(options.target)} --expected-artifact ${artifactHash}`,
17040
+ publish: `deepline plays publish ${shellQuote3(options.target)} --expected-artifact ${artifactHash}`,
16647
17041
  get: `deepline plays get ${playName} --source --out ./${playName}/ --working`
16648
17042
  }
16649
17043
  };
@@ -16703,7 +17097,7 @@ async function handlePlayPublish(args) {
16703
17097
  message: "Refusing to publish: the local file no longer produces the artifact checked earlier.",
16704
17098
  expectedArtifactHash: options.expectedArtifactHash,
16705
17099
  currentArtifactHash: artifactHash,
16706
- next: `deepline plays check ${shellQuote2(playName)}`
17100
+ next: `deepline plays check ${shellQuote3(playName)}`
16707
17101
  };
16708
17102
  if (options.jsonOutput) {
16709
17103
  printCompactJson(result3);
@@ -17173,12 +17567,12 @@ Examples:
17173
17567
  "--fixture-behavior <json>",
17174
17568
  "Internal/testing: fixture response behavior JSON object or @file path"
17175
17569
  ).addOption(
17176
- new Option(
17570
+ new Option2(
17177
17571
  "--watch",
17178
17572
  "Compatibility alias; run waits by default"
17179
17573
  ).hideHelp()
17180
17574
  ).addOption(
17181
- new Option(
17575
+ new Option2(
17182
17576
  "--wait",
17183
17577
  "Compatibility alias; run waits by default"
17184
17578
  ).hideHelp()
@@ -17186,12 +17580,12 @@ Examples:
17186
17580
  "--run-id-file <path>",
17187
17581
  "Atomically write the accepted run id to a new JSON file"
17188
17582
  ).addOption(
17189
- new Option(
17583
+ new Option2(
17190
17584
  "--logs",
17191
17585
  "Compatibility alias for --log-level debug"
17192
17586
  ).hideHelp()
17193
17587
  ).addOption(
17194
- new Option(
17588
+ new Option2(
17195
17589
  "--debug [value]",
17196
17590
  "Compatibility alias for --log-level debug when bare; --debug <value> remains legacy Play input.debug"
17197
17591
  ).hideHelp()
@@ -17694,6 +18088,7 @@ Examples:
17694
18088
  registerRunReceiptCommand(runs);
17695
18089
  registerRunChildrenCommand(runs);
17696
18090
  registerRunHistoryCommand(runs);
18091
+ registerRunEventsCommand(runs);
17697
18092
  runs.command("status <runId>").description(
17698
18093
  "Legacy scalar-only read. Use runs get for canonical status, progress, logs, and results."
17699
18094
  ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (runId, options) => {
@@ -17745,7 +18140,7 @@ Examples:
17745
18140
  "--config",
17746
18141
  "Explicitly print the recorded configuration, without full results"
17747
18142
  ).addOption(
17748
- new Option("--log-failed", "Attach terminal-failure logs").hideHelp()
18143
+ new Option2("--log-failed", "Attach terminal-failure logs").hideHelp()
17749
18144
  ).action(async (runId, options) => {
17750
18145
  process.exitCode = await handleRunGet([
17751
18146
  runId,
@@ -17870,12 +18265,12 @@ Examples:
17870
18265
  "--compact",
17871
18266
  "Show deduplicated human step transitions and progress"
17872
18267
  ).addOption(
17873
- new Option(
18268
+ new Option2(
17874
18269
  "--logs",
17875
18270
  "Compatibility alias for --log-level debug"
17876
18271
  ).hideHelp()
17877
18272
  ).addOption(
17878
- new Option(
18273
+ new Option2(
17879
18274
  "--debug",
17880
18275
  "Compatibility alias for --log-level debug"
17881
18276
  ).hideHelp()
@@ -17893,13 +18288,27 @@ Examples:
17893
18288
  ...options.logLevel ? ["--log-level", options.logLevel] : []
17894
18289
  ]);
17895
18290
  });
17896
- runs.command("logs [runId]").description("Read a run\u2019s logs or search recent events.").addHelpText("after", renderRunLogsHelp()).option("--limit <count>", "Maximum results: logs 200; events 100, max 200").option("--out <path>", "Save the full available text log").option("--failed", "Last 20 lines of a failed run").option("--log-level <level>", "debug (default), info, warn or error").addOption(
17897
- new Option(
18291
+ const runLogsCommand = runs.command("logs [runId]").description("Read a run\u2019s logs or search recent events.").addHelpText("after", renderRunLogsHelp()).option("--limit <count>", "Maximum results: logs 200; events 100, max 200").option("--out <path>", "Save the full available text log").option("--failed", "Last 20 lines of a failed run").option("--log-level <level>", "debug (default), info, warn or error").option("--step <id>", "Query structured logs from this authored step").option(
18292
+ "--level <level>",
18293
+ "Query structured logs at this severity or above"
18294
+ ).option(
18295
+ "--query <text>",
18296
+ "Find literal text in the full retained log message"
18297
+ ).option(
18298
+ "--count",
18299
+ "Exact matching retained log count; no limit or payloads"
18300
+ ).option("--group-by <fields>", "Count log groups by comma-separated fields").option(
18301
+ "--sum <field>",
18302
+ "Count and sum numeric values; repeatable, optionally grouped",
18303
+ (field, previous) => [...previous, field],
18304
+ []
18305
+ ).option("--fields", "Discover query fields, types and operators").addOption(
18306
+ new Option2(
17898
18307
  "--logs",
17899
18308
  "Compatibility alias for --log-level debug"
17900
18309
  ).hideHelp()
17901
18310
  ).addOption(
17902
- new Option(
18311
+ new Option2(
17903
18312
  "--debug",
17904
18313
  "Compatibility alias for --log-level debug"
17905
18314
  ).hideHelp()
@@ -17907,36 +18316,44 @@ Examples:
17907
18316
  "--cursor <token>",
17908
18317
  "Continue to older logs or the next events page"
17909
18318
  ).addOption(
17910
- new Option(
18319
+ new Option2(
17911
18320
  "--runtime-namespace <name>",
17912
18321
  "Search an explicitly authorized Preview namespace"
17913
18322
  ).hideHelp()
17914
18323
  ).addOption(
17915
- new Option(
18324
+ new Option2(
17916
18325
  "--runtime-backend <backend>",
17917
18326
  "Preview backend: daytona or modal"
17918
18327
  ).hideHelp()
17919
18328
  ).action(async (runId, options) => {
17920
18329
  process.exitCode = await handleRunLogs([
17921
18330
  ...runId ? [runId] : [],
17922
- ...options.limit ? ["--limit", options.limit] : [],
17923
- ...options.out ? ["--out", options.out] : [],
18331
+ ...options.limit !== void 0 ? ["--limit", options.limit] : [],
18332
+ ...options.out !== void 0 ? ["--out", options.out] : [],
17924
18333
  ...options.failed ? ["--failed"] : [],
17925
18334
  ...options.logLevel ? ["--log-level", options.logLevel] : [],
18335
+ ...options.step !== void 0 ? ["--step", options.step] : [],
18336
+ ...options.level !== void 0 ? ["--level", options.level] : [],
18337
+ ...options.query !== void 0 ? ["--query", options.query] : [],
18338
+ ...options.count ? ["--count"] : [],
18339
+ ...options.groupBy !== void 0 ? ["--group-by", options.groupBy] : [],
18340
+ ...(options.sum ?? []).flatMap((field) => ["--sum", field]),
18341
+ ...options.fields ? ["--fields"] : [],
17926
18342
  ...options.logs ? ["--logs"] : [],
17927
18343
  ...options.debug ? ["--debug"] : [],
17928
- ...options.since ? ["--since", options.since] : [],
17929
- ...options.until ? ["--until", options.until] : [],
17930
- ...options.play ? ["--play", options.play] : [],
17931
- ...options.kind ? ["--kind", options.kind] : [],
17932
- ...options.where ? ["--where", options.where] : [],
18344
+ ...options.since !== void 0 ? ["--since", options.since] : [],
18345
+ ...options.until !== void 0 ? ["--until", options.until] : [],
18346
+ ...options.play !== void 0 ? ["--play", options.play] : [],
18347
+ ...options.kind !== void 0 ? ["--kind", options.kind] : [],
18348
+ ...options.where !== void 0 ? ["--where", options.where] : [],
17933
18349
  ...options.payloads ? ["--payloads"] : [],
17934
- ...options.cursor ? ["--cursor", options.cursor] : [],
18350
+ ...options.cursor !== void 0 ? ["--cursor", options.cursor] : [],
17935
18351
  ...options.runtimeNamespace ? ["--runtime-namespace", options.runtimeNamespace] : [],
17936
18352
  ...options.runtimeBackend ? ["--runtime-backend", options.runtimeBackend] : [],
17937
18353
  ...options.json ? ["--json"] : []
17938
18354
  ]);
17939
18355
  });
18356
+ configureRunQueryCommandErrors(runLogsCommand, "logs");
17940
18357
  runs.command("stop <runId>").description("Stop a play run.").addHelpText(
17941
18358
  "after",
17942
18359
  `