@runtypelabs/cli 2.8.1 → 2.8.2

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 (2) hide show
  1. package/dist/index.js +30 -10
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -24178,6 +24178,8 @@ function getLatestSessionTabKey(sessionSnapshots, liveSnapshot) {
24178
24178
  return latestSnapshot ? createSessionTabKey(latestSnapshot.sessionIndex) : void 0;
24179
24179
  }
24180
24180
  function getSessionTabBaseTitle(snapshot) {
24181
+ if (snapshot.status === "error") return `Run ${snapshot.sessionIndex} \u2717`;
24182
+ if (snapshot.status === "budget_exceeded") return `Run ${snapshot.sessionIndex} $`;
24181
24183
  return `Run ${snapshot.sessionIndex}${snapshot.status === "live" ? "*" : ""}`;
24182
24184
  }
24183
24185
  function estimateRenderedTabWidth(tab) {
@@ -24315,17 +24317,19 @@ function upsertSessionSnapshots(snapshots, nextSnapshot) {
24315
24317
  return result;
24316
24318
  }
24317
24319
  function buildLiveSessionSnapshot(liveState, rawEvents, sessionIndex, model) {
24318
- const hasLiveState = liveState.phase === "thinking" || Boolean(liveState.content) || Boolean(liveState.reasoning) || liveState.tools.length > 0 || rawEvents.length > 0 || Boolean(liveState.contextCompaction?.active);
24320
+ const isError = liveState.phase === "error";
24321
+ const hasLiveState = liveState.phase === "thinking" || isError || Boolean(liveState.content) || Boolean(liveState.reasoning) || liveState.tools.length > 0 || rawEvents.length > 0 || Boolean(liveState.contextCompaction?.active);
24319
24322
  if (!hasLiveState) return void 0;
24320
24323
  return {
24321
24324
  sessionIndex,
24322
- status: "live",
24325
+ status: isError ? "error" : "live",
24323
24326
  model,
24324
24327
  cost: liveState.totalCost,
24325
24328
  content: liveState.content,
24326
24329
  reasoning: liveState.reasoning,
24327
24330
  tools: liveState.tools,
24328
- rawEvents
24331
+ rawEvents,
24332
+ ...isError && liveState.error ? { errorMessage: liveState.error.message } : {}
24329
24333
  };
24330
24334
  }
24331
24335
  function copyToClipboard(text) {
@@ -24658,6 +24662,15 @@ function MarathonApp({
24658
24662
  );
24659
24663
  }, [followLatest, liveSessionKey, liveSessionSnapshot, selectedSessionKey, sessionSnapshots]);
24660
24664
  const selectedIsLive = displayedSessionSnapshot?.status === "live";
24665
+ const displayedError = useMemo11(() => {
24666
+ if (selectedIsLive) return state.error;
24667
+ if (displayedSessionSnapshot?.status === "error") {
24668
+ return new Error(
24669
+ displayedSessionSnapshot.errorMessage || "Session ended with an error."
24670
+ );
24671
+ }
24672
+ return null;
24673
+ }, [selectedIsLive, state.error, displayedSessionSnapshot]);
24661
24674
  const displayedContent = displayedSessionSnapshot?.content ?? state.content;
24662
24675
  const displayedReasoning = displayedSessionSnapshot?.reasoning ?? state.reasoning;
24663
24676
  const displayedTools = displayedSessionSnapshot?.tools ?? state.tools;
@@ -25588,7 +25601,7 @@ function MarathonApp({
25588
25601
  thinkingStartedAt: state.thinkingStartedAt,
25589
25602
  contextCompaction: showContextCompactionIndicator ? state.contextCompaction : null,
25590
25603
  showUpgradeBrowseHint,
25591
- error: selectedIsLive && !upgradePrompt ? state.error : null
25604
+ error: upgradePrompt ? null : displayedError
25592
25605
  }
25593
25606
  )
25594
25607
  }
@@ -26825,7 +26838,8 @@ function sanitizeMarathonSessionSnapshots(snapshots) {
26825
26838
  })),
26826
26839
  ...typeof snapshot.stopReason === "string" ? { stopReason: snapshot.stopReason } : {},
26827
26840
  ...typeof snapshot.completedAt === "string" ? { completedAt: snapshot.completedAt } : {},
26828
- ...typeof snapshot.model === "string" ? { model: snapshot.model } : {}
26841
+ ...typeof snapshot.model === "string" ? { model: snapshot.model } : {},
26842
+ ...typeof snapshot.errorMessage === "string" ? { errorMessage: snapshot.errorMessage } : {}
26829
26843
  };
26830
26844
  bySessionIndex.set(sanitizedSnapshot.sessionIndex, sanitizedSnapshot);
26831
26845
  }
@@ -26850,7 +26864,7 @@ function mergeMarathonSessionSummaries(existingSessions, nextSessions, offset) {
26850
26864
  }
26851
26865
  return Array.from(byIndex.values()).sort((left, right) => left.index - right.index);
26852
26866
  }
26853
- function buildMarathonSessionSnapshot(liveState, sessionSummary, model, status = "complete") {
26867
+ function buildMarathonSessionSnapshot(liveState, sessionSummary, model, status = "complete", errorMessage) {
26854
26868
  return {
26855
26869
  sessionIndex: sessionSummary.index,
26856
26870
  status,
@@ -26868,7 +26882,8 @@ function buildMarathonSessionSnapshot(liveState, sessionSummary, model, status =
26868
26882
  rawEvents: liveState.rawEvents.map((event) => ({
26869
26883
  ...event,
26870
26884
  data: structuredClone(event.data)
26871
- }))
26885
+ })),
26886
+ ...errorMessage ? { errorMessage } : {}
26872
26887
  };
26873
26888
  }
26874
26889
  function mapRunTaskStatusToSnapshotStatus(status, fallback) {
@@ -29594,6 +29609,7 @@ Saving state... done. Session saved to ${filePath}`);
29594
29609
  const latestSessionSummary2 = persistedSessionSummaries[persistedSessionSummaries.length - 1];
29595
29610
  if (currentActions && latestSessionSummary2) {
29596
29611
  const liveState = currentActions.getState();
29612
+ const snapshotStatus = mapRunTaskStatusToSnapshotStatus(state.status, "complete");
29597
29613
  const sessionSnapshot = buildMarathonSessionSnapshot(
29598
29614
  {
29599
29615
  content: liveState.content,
@@ -29603,7 +29619,9 @@ Saving state... done. Session saved to ${filePath}`);
29603
29619
  sessionSnapshots: []
29604
29620
  },
29605
29621
  latestSessionSummary2,
29606
- options.model
29622
+ options.model,
29623
+ snapshotStatus,
29624
+ snapshotStatus === "error" ? state.lastError : void 0
29607
29625
  );
29608
29626
  persistedSessionSnapshots = upsertMarathonSessionSnapshot(
29609
29627
  persistedSessionSnapshots,
@@ -29758,14 +29776,16 @@ Saving state... done. Session saved to ${filePath}`);
29758
29776
  const completedTools = existingSnapshot.tools.map(
29759
29777
  (t) => t.status === "running" ? { ...t, status: "complete", executionTime: Date.now() - t.startedAt } : t
29760
29778
  );
29779
+ const finalStatus = mapRunTaskStatusToSnapshotStatus(result2.status, existingSnapshot.status);
29761
29780
  const updatedSnapshot = {
29762
29781
  ...existingSnapshot,
29763
- status: mapRunTaskStatusToSnapshotStatus(result2.status, existingSnapshot.status),
29782
+ status: finalStatus,
29764
29783
  stopReason: latestSessionSummary.stopReason,
29765
29784
  cost: latestSessionSummary.cost,
29766
29785
  completedAt: latestSessionSummary.completedAt,
29767
29786
  model: options.model,
29768
- tools: completedTools
29787
+ tools: completedTools,
29788
+ ...finalStatus === "error" && lastKnownState?.lastError ? { errorMessage: lastKnownState.lastError } : {}
29769
29789
  };
29770
29790
  persistedSessionSnapshots = upsertMarathonSessionSnapshot(persistedSessionSnapshots, updatedSnapshot);
29771
29791
  streamRef.current?.appendSessionSnapshot(updatedSnapshot);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/cli",
3
- "version": "2.8.1",
3
+ "version": "2.8.2",
4
4
  "description": "Command-line interface for Runtype AI platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,9 +22,9 @@
22
22
  "uuid": "^9.0.1",
23
23
  "micromatch": "^4.0.8",
24
24
  "yaml": "^2.8.3",
25
+ "@runtypelabs/sdk": "1.13.3",
25
26
  "@runtypelabs/ink-components": "0.3.1",
26
- "@runtypelabs/terminal-animations": "0.2.0",
27
- "@runtypelabs/sdk": "1.13.3"
27
+ "@runtypelabs/terminal-animations": "0.2.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/micromatch": "^4.0.9",