@ganakailabs/cloudeval-cli 0.20.2 → 0.21.0

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.
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  Banner,
3
+ bannerMetaColor,
3
4
  bannerSegmentColor,
4
5
  splitBannerLineSegments
5
- } from "./chunk-VUFGCS6W.js";
6
- import "./chunk-ETTAAQ6J.js";
7
- import "./chunk-QKZCKI55.js";
6
+ } from "./chunk-LGJOACZ5.js";
7
+ import "./chunk-GXHDB5LK.js";
8
+ import "./chunk-ZDKRIOMB.js";
8
9
  export {
9
10
  Banner,
11
+ bannerMetaColor,
10
12
  bannerSegmentColor,
11
13
  splitBannerLineSegments
12
14
  };
@@ -0,0 +1,8 @@
1
+ import {
2
+ Onboarding
3
+ } from "./chunk-Q5D5HYWW.js";
4
+ import "./chunk-LDDHLUZH.js";
5
+ import "./chunk-ZDKRIOMB.js";
6
+ export {
7
+ Onboarding
8
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  terminalTheme
3
- } from "./chunk-QKZCKI55.js";
3
+ } from "./chunk-ZDKRIOMB.js";
4
4
 
5
5
  // src/reports/ReportDashboard.tsx
6
6
  import { useMemo, useState } from "react";
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var CLI_VERSION = "0.20.2";
2
+ var CLI_VERSION = "0.21.0";
3
3
 
4
4
  export {
5
5
  CLI_VERSION
@@ -1796,6 +1796,13 @@ var isValidChunkStatus = (value) => {
1796
1796
  var stringOrUndefined = (value) => typeof value === "string" ? value : void 0;
1797
1797
  var numberOrUndefined = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
1798
1798
  var booleanOrUndefined = (value) => typeof value === "boolean" ? value : void 0;
1799
+ var objectArrayOrUndefined = (value) => {
1800
+ if (!Array.isArray(value)) {
1801
+ return void 0;
1802
+ }
1803
+ const records = value.filter(isObject2);
1804
+ return records.length ? records : void 0;
1805
+ };
1799
1806
  var isResponseOutputChunk = (chunk) => chunk.type === "responding" && (!chunk.node || RESPONSE_OUTPUT_NODES.has(chunk.node));
1800
1807
  var isResponseCompletionChunk = (chunk) => isResponseOutputChunk(chunk) && chunk.status === "completed";
1801
1808
  var isTerminalEndChunk = (chunk) => (chunk.type === "thinking" || chunk.type === "responding") && chunk.status === "completed" && chunk.node === "end";
@@ -1879,6 +1886,9 @@ var normalizeChunk = (raw, receivedAt) => {
1879
1886
  message: typeof raw.message === "string" ? raw.message : void 0,
1880
1887
  content: typeof raw.content === "string" ? raw.content : void 0,
1881
1888
  source: stringOrUndefined(raw.source),
1889
+ tools_used: objectArrayOrUndefined(raw.tools_used) ?? objectArrayOrUndefined(data?.tools_used),
1890
+ citation_markers: objectArrayOrUndefined(raw.citation_markers) ?? objectArrayOrUndefined(data?.citation_markers),
1891
+ citations: objectArrayOrUndefined(raw.citations) ?? objectArrayOrUndefined(data?.citations),
1882
1892
  ...base
1883
1893
  };
1884
1894
  return chunk;
@@ -2222,7 +2232,10 @@ var TERMINAL_STEP_STATUSES = /* @__PURE__ */ new Set([
2222
2232
  var cloneMessage = (message) => ({
2223
2233
  ...message,
2224
2234
  thinkingSteps: message.thinkingSteps ? [...message.thinkingSteps.map((s) => ({ ...s }))] : [],
2225
- followUpQuestions: message.followUpQuestions ? [...message.followUpQuestions] : void 0
2235
+ followUpQuestions: message.followUpQuestions ? [...message.followUpQuestions] : void 0,
2236
+ toolsUsed: message.toolsUsed ? message.toolsUsed.map((entry) => ({ ...entry })) : void 0,
2237
+ citationMarkers: message.citationMarkers ? message.citationMarkers.map((entry) => ({ ...entry })) : void 0,
2238
+ citations: message.citations ? message.citations.map((entry) => ({ ...entry })) : void 0
2226
2239
  });
2227
2240
  var finalizeOpenSteps = (steps, status, timestamp) => {
2228
2241
  if (!steps) {
@@ -2344,6 +2357,28 @@ var mergeHitlStep = (steps, chunk) => {
2344
2357
  var parseFollowUps = (scratch) => (scratch ?? "").split(";").map((q) => q.trim()).filter(Boolean);
2345
2358
  var isErrorFallbackRespondingChunk = (chunk) => typeof chunk.source === "string" && chunk.source.startsWith(ERROR_FALLBACK_SOURCE_PREFIX);
2346
2359
  var getFallbackErrorMessage = (chunk) => chunk.content || chunk.description || chunk.message || "Unknown error";
2360
+ var mergeSourceEntries = (existing, next) => {
2361
+ if (!next?.length) {
2362
+ return existing;
2363
+ }
2364
+ const merged = [...existing ?? []];
2365
+ for (const entry of next) {
2366
+ const sourceId = typeof entry.source_id === "string" ? entry.source_id.trim() : "";
2367
+ if (!sourceId) {
2368
+ merged.push({ ...entry });
2369
+ continue;
2370
+ }
2371
+ const existingIndex = merged.findIndex(
2372
+ (candidate) => candidate.source_id === sourceId
2373
+ );
2374
+ if (existingIndex >= 0) {
2375
+ merged[existingIndex] = { ...merged[existingIndex], ...entry };
2376
+ } else {
2377
+ merged.push({ ...entry });
2378
+ }
2379
+ }
2380
+ return merged;
2381
+ };
2347
2382
  var initialChatState = {
2348
2383
  status: "idle",
2349
2384
  messages: []
@@ -2465,6 +2500,21 @@ var reduceChunk = (state, chunk) => {
2465
2500
  updatedMessage.thinkingSteps,
2466
2501
  chunk
2467
2502
  );
2503
+ if (chunk.type === "responding") {
2504
+ updatedMessage.toolsUsed = mergeSourceEntries(
2505
+ updatedMessage.toolsUsed,
2506
+ chunk.tools_used
2507
+ );
2508
+ updatedMessage.citations = mergeSourceEntries(
2509
+ updatedMessage.citations,
2510
+ chunk.citations
2511
+ );
2512
+ if (chunk.citation_markers?.length) {
2513
+ updatedMessage.citationMarkers = chunk.citation_markers.map((entry) => ({
2514
+ ...entry
2515
+ }));
2516
+ }
2517
+ }
2468
2518
  updatedMessage.updatedAt = chunk.receivedAt;
2469
2519
  if (chunk.type === "responding" && isErrorFallbackRespondingChunk(chunk)) {
2470
2520
  const error = getFallbackErrorMessage(chunk);
@@ -3065,28 +3115,29 @@ var getCreditStatus = (summary, options) => {
3065
3115
  if (effectiveTotal <= 0) {
3066
3116
  effectiveTotal = fallbackEffectiveTotal;
3067
3117
  }
3068
- if (effectiveRemaining > effectiveTotal) {
3069
- effectiveTotal = effectiveRemaining;
3070
- }
3118
+ const entitlementBudget = effectiveTotal;
3071
3119
  const trialTotal = Math.max(
3072
3120
  Number(
3073
3121
  summary.trial_state?.credits_total ?? summary.trial_state?.initial_credits ?? summary.plan?.features?.trial_credits_total ?? DEFAULT_FREE_TRIAL_CREDITS_TOTAL
3074
3122
  ),
3075
3123
  0
3076
3124
  );
3077
- const useTrialDisplayTotal = isFreeLikePlan && effectiveTotal <= 0 && trialTotal > 0;
3078
- let displayTotal = useTrialDisplayTotal ? trialTotal : effectiveTotal;
3125
+ const useTrialDisplayTotal = isFreeLikePlan && entitlementBudget <= 0 && trialTotal > 0;
3126
+ let displayTotal = useTrialDisplayTotal ? trialTotal : entitlementBudget;
3079
3127
  const remainingCandidate = useTrialDisplayTotal && (summary.trial_state?.consumed || summary.trial_state?.blocked) ? 0 : effectiveRemaining;
3080
- const remaining = displayTotal > 0 ? Math.min(Math.max(remainingCandidate, 0), displayTotal) : 0;
3081
- const derivedUsed = displayTotal > 0 ? Math.max(displayTotal - remaining, 0) : 0;
3082
3128
  const reportedUsed = Math.max(
3083
3129
  0,
3084
3130
  ...[balance.credits_used, balance.credits_used_cycle, options?.reportedUsedCredits].map(finiteCredit).filter((value) => value !== null)
3085
3131
  );
3086
- const used = Math.max(derivedUsed, reportedUsed);
3087
- if (!explicitUnlimited && remaining + used > displayTotal) {
3088
- displayTotal = remaining + used;
3132
+ const usageForBudget = Math.max(reportedUsed, cycleUsed);
3133
+ if (!explicitUnlimited && (usageForBudget > 0 || remainingCandidate > 0)) {
3134
+ displayTotal = Math.max(
3135
+ displayTotal,
3136
+ Math.max(remainingCandidate, 0) + usageForBudget
3137
+ );
3089
3138
  }
3139
+ const remaining = displayTotal > 0 ? Math.min(Math.max(remainingCandidate, 0), displayTotal) : 0;
3140
+ const used = displayTotal > 0 ? Math.max(displayTotal - remaining, 0) : 0;
3090
3141
  const remainingRatio = displayTotal > 0 ? remaining / displayTotal : explicitUnlimited ? 1 : 0;
3091
3142
  const creditsPerEvent = options?.creditsPerEvent;
3092
3143
  const messagesRemaining = explicitUnlimited || !creditsPerEvent || creditsPerEvent <= 0 ? null : Math.max(0, Math.floor(remaining / creditsPerEvent));
@@ -3099,10 +3150,11 @@ var getCreditStatus = (summary, options) => {
3099
3150
  remaining,
3100
3151
  total: displayTotal,
3101
3152
  used,
3153
+ reportedUsed,
3102
3154
  cycleTotal,
3103
3155
  cycleUsed,
3104
3156
  cycleRemaining,
3105
- effectiveTotal,
3157
+ effectiveTotal: entitlementBudget,
3106
3158
  effectiveRemaining,
3107
3159
  topUpBalance,
3108
3160
  remainingRatio,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  CLI_VERSION
3
- } from "./chunk-ETTAAQ6J.js";
3
+ } from "./chunk-GXHDB5LK.js";
4
4
  import {
5
5
  shouldUseColor,
6
6
  terminalTheme
7
- } from "./chunk-QKZCKI55.js";
7
+ } from "./chunk-ZDKRIOMB.js";
8
8
 
9
9
  // src/ui/components/Banner.tsx
10
10
  import { Box, Text } from "ink";
@@ -72,6 +72,7 @@ var bannerSegmentColor = (tone, lineIndex = 0, totalLines = wordArt.length) => {
72
72
  }
73
73
  return void 0;
74
74
  };
75
+ var bannerMetaColor = () => terminalTheme.accent;
75
76
  var BannerArtLine = ({ line, lineIndex, totalLines }) => /* @__PURE__ */ jsx(Text, { wrap: "truncate", children: splitBannerLineSegments(line).map((segment, index) => /* @__PURE__ */ jsx(
76
77
  Text,
77
78
  {
@@ -94,7 +95,7 @@ var Banner = ({
94
95
  const version = process.env.CLOUDEVAL_CLI_VERSION ?? CLI_VERSION;
95
96
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "flex-start", marginBottom: 1, children: [
96
97
  showArt ? /* @__PURE__ */ jsxs(Fragment, { children: [
97
- /* @__PURE__ */ jsx(Text, { color: terminalTheme.success, children: "Welcome to" }),
98
+ /* @__PURE__ */ jsx(Text, { color: bannerMetaColor(), children: "Welcome to" }),
98
99
  /* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 2, children: [
99
100
  /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: art.map((line, lineIndex) => /* @__PURE__ */ jsx(
100
101
  BannerArtLine,
@@ -106,7 +107,7 @@ var Banner = ({
106
107
  line
107
108
  )) }),
108
109
  showDetailsBesideArt ? /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingTop: 1, children: [
109
- /* @__PURE__ */ jsxs(Text, { color: terminalTheme.success, children: [
110
+ /* @__PURE__ */ jsxs(Text, { color: bannerMetaColor(), children: [
110
111
  "CLI v",
111
112
  version
112
113
  ] }),
@@ -115,7 +116,7 @@ var Banner = ({
115
116
  ] })
116
117
  ] }) : null,
117
118
  !showDetailsBesideArt ? /* @__PURE__ */ jsxs(Fragment, { children: [
118
- /* @__PURE__ */ jsxs(Text, { color: terminalTheme.success, children: [
119
+ /* @__PURE__ */ jsxs(Text, { color: bannerMetaColor(), children: [
119
120
  "CLI v",
120
121
  version
121
122
  ] }),
@@ -127,5 +128,6 @@ var Banner = ({
127
128
  export {
128
129
  splitBannerLineSegments,
129
130
  bannerSegmentColor,
131
+ bannerMetaColor,
130
132
  Banner
131
133
  };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  completeOnboarding
3
- } from "./chunk-2D4BE3OS.js";
3
+ } from "./chunk-LDDHLUZH.js";
4
4
  import {
5
5
  terminalTheme
6
- } from "./chunk-QKZCKI55.js";
6
+ } from "./chunk-ZDKRIOMB.js";
7
7
 
8
8
  // src/ui/components/Onboarding.tsx
9
9
  import { useState } from "react";
@@ -0,0 +1,68 @@
1
+ // src/ui/theme.ts
2
+ var terminalPalette = {
3
+ brand: { dark: "cyanBright", light: "blue" },
4
+ accent: { dark: "yellowBright", light: "yellow" },
5
+ focus: { dark: "yellowBright", light: "yellow" },
6
+ secondary: { dark: "blueBright", light: "blue" },
7
+ citation: { dark: "yellowBright", light: "yellow" },
8
+ selected: { dark: "yellowBright", light: "yellow" },
9
+ selectedBackground: { dark: "yellow", light: "yellow" },
10
+ userName: { dark: "cyanBright", light: "blue" },
11
+ aiName: { dark: "magentaBright", light: "magenta" },
12
+ success: { dark: "greenBright", light: "green" },
13
+ muted: { dark: "gray", light: "gray" },
14
+ inputGhost: { dark: "cyan", light: "blue" },
15
+ warning: { dark: "yellowBright", light: "yellow" },
16
+ danger: { dark: "redBright", light: "red" },
17
+ cursor: { dark: "yellowBright", light: "yellow" }
18
+ };
19
+ var hasColor = () => !process.env.NO_COLOR && process.env.TERM !== "dumb";
20
+ var terminalBackground = () => {
21
+ const colorFgBg = process.env.COLORFGBG;
22
+ if (!colorFgBg) {
23
+ return "unknown";
24
+ }
25
+ const bg = Number(colorFgBg.split(";").pop());
26
+ if (!Number.isFinite(bg)) {
27
+ return "unknown";
28
+ }
29
+ return bg >= 7 && bg <= 15 ? "light" : "dark";
30
+ };
31
+ var isLightTerminal = () => terminalBackground() === "light";
32
+ var color = (dark, light) => {
33
+ if (!hasColor()) {
34
+ return void 0;
35
+ }
36
+ return isLightTerminal() ? light : dark;
37
+ };
38
+ var paletteColor = (value) => color(value.dark, value.light);
39
+ var terminalTheme = {
40
+ brand: paletteColor(terminalPalette.brand),
41
+ accent: paletteColor(terminalPalette.accent),
42
+ focus: paletteColor(terminalPalette.focus),
43
+ secondary: paletteColor(terminalPalette.secondary),
44
+ citation: paletteColor(terminalPalette.citation),
45
+ selected: paletteColor(terminalPalette.selected),
46
+ selectedBackground: paletteColor(terminalPalette.selectedBackground),
47
+ userName: paletteColor(terminalPalette.userName),
48
+ aiName: paletteColor(terminalPalette.aiName),
49
+ success: paletteColor(terminalPalette.success),
50
+ muted: paletteColor(terminalPalette.muted),
51
+ /** Inline ghost / autosuggest — distinct from user text and from gray-muted UI chrome */
52
+ inputGhost: paletteColor(terminalPalette.inputGhost),
53
+ warning: paletteColor(terminalPalette.warning),
54
+ danger: paletteColor(terminalPalette.danger),
55
+ cursor: paletteColor(terminalPalette.cursor)
56
+ };
57
+ var shouldUseColor = hasColor;
58
+ var raisedButtonStyle = {
59
+ border: "round",
60
+ activeMarker: "\u25CF",
61
+ inactiveMarker: "\u25CB"
62
+ };
63
+
64
+ export {
65
+ terminalTheme,
66
+ shouldUseColor,
67
+ raisedButtonStyle
68
+ };