@runtypelabs/cli 2.7.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.
- package/dist/index.js +257 -12
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -11807,6 +11807,8 @@ var require_generated_model_routing = __commonJS({
|
|
|
11807
11807
|
"gemma-2-9b": ["vercel"],
|
|
11808
11808
|
"gemma-2b": ["togetherai"],
|
|
11809
11809
|
"gemma-2b-it": ["togetherai"],
|
|
11810
|
+
"gemma-4-26b-a4b-it": ["vercel"],
|
|
11811
|
+
"gemma-4-31b-it": ["vercel"],
|
|
11810
11812
|
"gemma-7b": ["togetherai"],
|
|
11811
11813
|
"gemma-7b-it": ["togetherai"],
|
|
11812
11814
|
"glm-4.5": ["vercel"],
|
|
@@ -12134,6 +12136,7 @@ var require_generated_model_routing = __commonJS({
|
|
|
12134
12136
|
"qwen3.5-9b": ["mixlayer"],
|
|
12135
12137
|
"qwen3.5-flash": ["vercel"],
|
|
12136
12138
|
"qwen3.5-plus": ["vercel"],
|
|
12139
|
+
"qwen3.6-plus": ["vercel"],
|
|
12137
12140
|
"RedPajama-INCITE-7B-Base": ["togetherai"],
|
|
12138
12141
|
"RedPajama-INCITE-7B-Chat": ["togetherai"],
|
|
12139
12142
|
"RedPajama-INCITE-7B-Instruct": ["togetherai"],
|
|
@@ -12176,6 +12179,7 @@ var require_generated_model_routing = __commonJS({
|
|
|
12176
12179
|
"titan-embed-text-v2": ["vercel"],
|
|
12177
12180
|
"Toppy-M-7B": ["togetherai"],
|
|
12178
12181
|
"trinity-large-preview": ["vercel"],
|
|
12182
|
+
"trinity-large-thinking": ["vercel"],
|
|
12179
12183
|
"trinity-mini": ["vercel"],
|
|
12180
12184
|
"v0-1-0-md": ["vercel"],
|
|
12181
12185
|
"v0-1-5-md": ["vercel"],
|
|
@@ -12270,6 +12274,8 @@ var require_generated_model_routing = __commonJS({
|
|
|
12270
12274
|
"gemma-2-9b": ["vercel"],
|
|
12271
12275
|
"gemma-2b": ["togetherai"],
|
|
12272
12276
|
"gemma-2b-it": ["togetherai"],
|
|
12277
|
+
"gemma-4-26b-a4b-it": ["vercel"],
|
|
12278
|
+
"gemma-4-31b-it": ["vercel"],
|
|
12273
12279
|
"gemma-7b": ["togetherai"],
|
|
12274
12280
|
"gemma-7b-it": ["togetherai"],
|
|
12275
12281
|
"glm-4-5": ["vercel"],
|
|
@@ -12568,6 +12574,7 @@ var require_generated_model_routing = __commonJS({
|
|
|
12568
12574
|
"qwen3-5-9b": ["mixlayer"],
|
|
12569
12575
|
"qwen3-5-flash": ["vercel"],
|
|
12570
12576
|
"qwen3-5-plus": ["vercel"],
|
|
12577
|
+
"qwen3-6-plus": ["vercel"],
|
|
12571
12578
|
"qwen3-coder": ["vercel"],
|
|
12572
12579
|
"qwen3-coder-30b-a3b": ["vercel"],
|
|
12573
12580
|
"qwen3-coder-next": ["vercel"],
|
|
@@ -13018,6 +13025,12 @@ var require_generated_model_routing = __commonJS({
|
|
|
13018
13025
|
"gemma-2b-it": {
|
|
13019
13026
|
"togetherai": "google/gemma-2b-it"
|
|
13020
13027
|
},
|
|
13028
|
+
"gemma-4-26b-a4b-it": {
|
|
13029
|
+
"vercel": "google/gemma-4-26b-a4b-it"
|
|
13030
|
+
},
|
|
13031
|
+
"gemma-4-31b-it": {
|
|
13032
|
+
"vercel": "google/gemma-4-31b-it"
|
|
13033
|
+
},
|
|
13021
13034
|
"gemma-7b": {
|
|
13022
13035
|
"togetherai": "google/gemma-7b"
|
|
13023
13036
|
},
|
|
@@ -14394,6 +14407,9 @@ var require_generated_model_routing = __commonJS({
|
|
|
14394
14407
|
"qwen3-5-plus": {
|
|
14395
14408
|
"vercel": "alibaba/qwen3.5-plus"
|
|
14396
14409
|
},
|
|
14410
|
+
"qwen3-6-plus": {
|
|
14411
|
+
"vercel": "alibaba/qwen3.6-plus"
|
|
14412
|
+
},
|
|
14397
14413
|
"qwen3-coder": {
|
|
14398
14414
|
"vercel": "alibaba/qwen3-coder"
|
|
14399
14415
|
},
|
|
@@ -14466,6 +14482,9 @@ var require_generated_model_routing = __commonJS({
|
|
|
14466
14482
|
"qwen3.5-plus": {
|
|
14467
14483
|
"vercel": "alibaba/qwen3.5-plus"
|
|
14468
14484
|
},
|
|
14485
|
+
"qwen3.6-plus": {
|
|
14486
|
+
"vercel": "alibaba/qwen3.6-plus"
|
|
14487
|
+
},
|
|
14469
14488
|
"redpajama-incite-7b-base": {
|
|
14470
14489
|
"togetherai": "togethercomputer/RedPajama-INCITE-7B-Base"
|
|
14471
14490
|
},
|
|
@@ -14638,11 +14657,14 @@ var require_generated_model_routing = __commonJS({
|
|
|
14638
14657
|
"togetherai": "Undi95/Toppy-M-7B"
|
|
14639
14658
|
},
|
|
14640
14659
|
"trinity-large": {
|
|
14641
|
-
"vercel": "arcee-ai/trinity-large-
|
|
14660
|
+
"vercel": "arcee-ai/trinity-large-thinking"
|
|
14642
14661
|
},
|
|
14643
14662
|
"trinity-large-preview": {
|
|
14644
14663
|
"vercel": "arcee-ai/trinity-large-preview"
|
|
14645
14664
|
},
|
|
14665
|
+
"trinity-large-thinking": {
|
|
14666
|
+
"vercel": "arcee-ai/trinity-large-thinking"
|
|
14667
|
+
},
|
|
14646
14668
|
"trinity-mini": {
|
|
14647
14669
|
"vercel": "arcee-ai/trinity-mini"
|
|
14648
14670
|
},
|
|
@@ -14755,6 +14777,7 @@ var require_generated_model_routing = __commonJS({
|
|
|
14755
14777
|
"qwen3-32b": { providers: [{ provider: "vercel", weight: 100 }] },
|
|
14756
14778
|
"qwen3-5-flash": { providers: [{ provider: "vercel", weight: 100 }] },
|
|
14757
14779
|
"qwen3-5-plus": { providers: [{ provider: "vercel", weight: 100 }] },
|
|
14780
|
+
"qwen3-6-plus": { providers: [{ provider: "vercel", weight: 100 }] },
|
|
14758
14781
|
"qwen3-coder": { providers: [{ provider: "vercel", weight: 100 }] },
|
|
14759
14782
|
"qwen3-coder-30b-a3b": { providers: [{ provider: "vercel", weight: 100 }] },
|
|
14760
14783
|
"qwen3-coder-next": { providers: [{ provider: "vercel", weight: 100 }] },
|
|
@@ -21612,6 +21635,7 @@ var CHECKPOINT_COMMANDS = [
|
|
|
21612
21635
|
{ key: "/revert <file>", desc: "Restore file from checkpoint" },
|
|
21613
21636
|
{ key: "/reflect", desc: "Reassess approach" },
|
|
21614
21637
|
{ key: "/copy", desc: "Copy session JSON" },
|
|
21638
|
+
{ key: "/copy-trimmed", desc: "Copy JSON with large payloads trimmed" },
|
|
21615
21639
|
{ key: "/open", desc: "Open state file" },
|
|
21616
21640
|
{ key: "/stop", desc: "Stop the marathon" },
|
|
21617
21641
|
{ key: "/help", desc: "Toggle this help dialog" }
|
|
@@ -22691,6 +22715,11 @@ var MARATHON_CHECKPOINT_COMMANDS = [
|
|
|
22691
22715
|
},
|
|
22692
22716
|
{ name: "/reflect", description: "Open reflection editor to reassess approach", hasArgs: false },
|
|
22693
22717
|
{ name: "/copy", description: "Copy session JSON to clipboard", hasArgs: false },
|
|
22718
|
+
{
|
|
22719
|
+
name: "/copy-trimmed",
|
|
22720
|
+
description: "Copy session JSON with large code/tool payloads trimmed",
|
|
22721
|
+
hasArgs: false
|
|
22722
|
+
},
|
|
22694
22723
|
{ name: "/open", description: "Open state file in editor", hasArgs: false },
|
|
22695
22724
|
{ name: "/stop", description: "Stop marathon and save state", hasArgs: false },
|
|
22696
22725
|
{ name: "/help", description: "Show available commands", hasArgs: false }
|
|
@@ -23196,6 +23225,7 @@ function CheckpointPrompt({
|
|
|
23196
23225
|
onSubmit,
|
|
23197
23226
|
onToggleHelp,
|
|
23198
23227
|
onCopySession,
|
|
23228
|
+
onCopySessionTrimmed,
|
|
23199
23229
|
onOpenStateFile,
|
|
23200
23230
|
timeout,
|
|
23201
23231
|
isTerminal,
|
|
@@ -23314,6 +23344,11 @@ function CheckpointPrompt({
|
|
|
23314
23344
|
clearInputDraft();
|
|
23315
23345
|
return;
|
|
23316
23346
|
}
|
|
23347
|
+
if (trimmed === "/copy-trimmed") {
|
|
23348
|
+
onCopySessionTrimmed?.();
|
|
23349
|
+
clearInputDraft();
|
|
23350
|
+
return;
|
|
23351
|
+
}
|
|
23317
23352
|
if (trimmed === "/open") {
|
|
23318
23353
|
onOpenStateFile?.();
|
|
23319
23354
|
clearInputDraft();
|
|
@@ -23472,12 +23507,14 @@ import { theme as theme24 } from "@runtypelabs/ink-components";
|
|
|
23472
23507
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
23473
23508
|
var MENU_ITEMS = [
|
|
23474
23509
|
{ key: "c", label: "Copy session JSON" },
|
|
23510
|
+
{ key: "t", label: "Copy trimmed JSON (for LLM context)" },
|
|
23475
23511
|
{ key: "e", label: "Open session JSON in editor" },
|
|
23476
23512
|
{ key: "f", label: "Open marathon folder in file manager" },
|
|
23477
23513
|
{ key: "d", label: "Open agent in Runtype dashboard" }
|
|
23478
23514
|
];
|
|
23479
23515
|
function SessionActionMenu({
|
|
23480
23516
|
onCopySession,
|
|
23517
|
+
onCopySessionTrimmed,
|
|
23481
23518
|
onOpenStateFile,
|
|
23482
23519
|
onOpenFolder,
|
|
23483
23520
|
onOpenDashboard,
|
|
@@ -23494,6 +23531,10 @@ function SessionActionMenu({
|
|
|
23494
23531
|
onCopySession();
|
|
23495
23532
|
return;
|
|
23496
23533
|
}
|
|
23534
|
+
if (input === "t") {
|
|
23535
|
+
onCopySessionTrimmed();
|
|
23536
|
+
return;
|
|
23537
|
+
}
|
|
23497
23538
|
if (input === "e" && hasStateFile) {
|
|
23498
23539
|
onOpenStateFile();
|
|
23499
23540
|
return;
|
|
@@ -23516,7 +23557,7 @@ function SessionActionMenu({
|
|
|
23516
23557
|
backgroundColor: theme24.surfaceElevated,
|
|
23517
23558
|
paddingX: 2,
|
|
23518
23559
|
paddingY: 1,
|
|
23519
|
-
width:
|
|
23560
|
+
width: 62,
|
|
23520
23561
|
children: [
|
|
23521
23562
|
/* @__PURE__ */ jsx25(Text24, { bold: true, color: theme24.accent, children: "Session" }),
|
|
23522
23563
|
/* @__PURE__ */ jsx25(Box22, { flexDirection: "column", marginTop: 1, children: MENU_ITEMS.map((item) => {
|
|
@@ -23535,6 +23576,164 @@ function SessionActionMenu({
|
|
|
23535
23576
|
);
|
|
23536
23577
|
}
|
|
23537
23578
|
|
|
23579
|
+
// src/ink/marathon/session-context-copy.ts
|
|
23580
|
+
var DEFAULT_MAX_CHARS = 900;
|
|
23581
|
+
var HEAVY_PREVIEW_MAX_CHARS = 360;
|
|
23582
|
+
var STREAM_EVENT_HEAVY_KEYS = /* @__PURE__ */ new Set(["parameters", "result", "finalOutput", "streamedInput"]);
|
|
23583
|
+
function omitFencedCodeBlocks(text) {
|
|
23584
|
+
return text.replace(/```[a-zA-Z0-9_-]*\n[\s\S]*?\n```/g, "[omitted code block]").replace(/```[\s\S]*?```/g, "[omitted code block]");
|
|
23585
|
+
}
|
|
23586
|
+
function compactLongText(text, maxChars = DEFAULT_MAX_CHARS) {
|
|
23587
|
+
const stripped = omitFencedCodeBlocks(text);
|
|
23588
|
+
if (stripped.length <= maxChars) return stripped;
|
|
23589
|
+
return `${stripped.slice(0, Math.max(0, maxChars - 1))}\u2026 (${text.length} chars)`;
|
|
23590
|
+
}
|
|
23591
|
+
function compactHeavyField(value) {
|
|
23592
|
+
const raw = typeof value === "string" ? value : JSON.stringify(value);
|
|
23593
|
+
return {
|
|
23594
|
+
_truncated: true,
|
|
23595
|
+
approxChars: raw.length,
|
|
23596
|
+
preview: compactLongText(raw, HEAVY_PREVIEW_MAX_CHARS)
|
|
23597
|
+
};
|
|
23598
|
+
}
|
|
23599
|
+
function stringCompactionReplacer(_key, val) {
|
|
23600
|
+
if (typeof val === "string") return compactLongText(val);
|
|
23601
|
+
return val;
|
|
23602
|
+
}
|
|
23603
|
+
function compactJsonLike(value) {
|
|
23604
|
+
try {
|
|
23605
|
+
return JSON.parse(JSON.stringify(value, stringCompactionReplacer));
|
|
23606
|
+
} catch {
|
|
23607
|
+
return typeof value === "string" ? compactLongText(value) : value;
|
|
23608
|
+
}
|
|
23609
|
+
}
|
|
23610
|
+
function compactRawStreamEventForCopy(event) {
|
|
23611
|
+
let data;
|
|
23612
|
+
if (event.listData) {
|
|
23613
|
+
data = JSON.parse(JSON.stringify(event.listData, stringCompactionReplacer));
|
|
23614
|
+
} else {
|
|
23615
|
+
data = {};
|
|
23616
|
+
for (const [k, v] of Object.entries(event.data)) {
|
|
23617
|
+
if (STREAM_EVENT_HEAVY_KEYS.has(k)) {
|
|
23618
|
+
data[k] = compactHeavyField(v);
|
|
23619
|
+
} else {
|
|
23620
|
+
data[k] = compactJsonLike(v);
|
|
23621
|
+
}
|
|
23622
|
+
}
|
|
23623
|
+
}
|
|
23624
|
+
return { timestamp: event.timestamp, type: event.type, data };
|
|
23625
|
+
}
|
|
23626
|
+
function compactMarathonToolEntryForCopy(tool) {
|
|
23627
|
+
return {
|
|
23628
|
+
id: tool.id,
|
|
23629
|
+
sequence: tool.sequence,
|
|
23630
|
+
sourceToolCallId: tool.sourceToolCallId,
|
|
23631
|
+
...tool.localToolCallId ? { localToolCallId: tool.localToolCallId } : {},
|
|
23632
|
+
name: tool.name,
|
|
23633
|
+
toolType: tool.toolType,
|
|
23634
|
+
status: tool.status,
|
|
23635
|
+
...tool.phase ? { phase: tool.phase } : {},
|
|
23636
|
+
...tool.inputPreview ? { inputPreview: tool.inputPreview } : {},
|
|
23637
|
+
...tool.executionTime !== void 0 ? { executionTime: tool.executionTime } : {},
|
|
23638
|
+
startedAt: tool.startedAt,
|
|
23639
|
+
...tool.localExecutionStartedAt !== void 0 ? { localExecutionStartedAt: tool.localExecutionStartedAt } : {},
|
|
23640
|
+
...tool.parameters !== void 0 ? {
|
|
23641
|
+
parameters: JSON.stringify(tool.parameters).length <= 2500 ? compactJsonLike(tool.parameters) : compactHeavyField(tool.parameters)
|
|
23642
|
+
} : {},
|
|
23643
|
+
...tool.streamedInput !== void 0 ? { streamedInput: compactLongText(tool.streamedInput, 480) } : {},
|
|
23644
|
+
...tool.result !== void 0 ? { result: compactHeavyField(tool.result) } : {}
|
|
23645
|
+
};
|
|
23646
|
+
}
|
|
23647
|
+
function compactSessionSnapshotForContextExport(snapshot) {
|
|
23648
|
+
return {
|
|
23649
|
+
...snapshot,
|
|
23650
|
+
content: compactLongText(snapshot.content),
|
|
23651
|
+
reasoning: compactLongText(snapshot.reasoning),
|
|
23652
|
+
tools: snapshot.tools.map(compactMarathonToolEntryForCopy),
|
|
23653
|
+
rawEvents: snapshot.rawEvents.map(compactRawStreamEventForCopy)
|
|
23654
|
+
};
|
|
23655
|
+
}
|
|
23656
|
+
function compactAgentMessageForContextExport(msg) {
|
|
23657
|
+
let content;
|
|
23658
|
+
if (typeof msg.content === "string") {
|
|
23659
|
+
content = compactLongText(msg.content);
|
|
23660
|
+
} else if (Array.isArray(msg.content)) {
|
|
23661
|
+
content = msg.content.map((part) => {
|
|
23662
|
+
if (part.text !== void 0) return { ...part, text: compactLongText(part.text) };
|
|
23663
|
+
if (part.data !== void 0) return { ...part, data: compactLongText(part.data) };
|
|
23664
|
+
return part;
|
|
23665
|
+
});
|
|
23666
|
+
} else {
|
|
23667
|
+
content = msg.content;
|
|
23668
|
+
}
|
|
23669
|
+
const toolCalls = msg.toolCalls?.map((tc) => ({
|
|
23670
|
+
...tc,
|
|
23671
|
+
args: compactJsonLike(tc.args)
|
|
23672
|
+
}));
|
|
23673
|
+
const toolResults = msg.toolResults?.map((tr) => ({
|
|
23674
|
+
...tr,
|
|
23675
|
+
result: tr.result !== void 0 ? compactHeavyField(tr.result) : tr.result
|
|
23676
|
+
}));
|
|
23677
|
+
return {
|
|
23678
|
+
role: msg.role,
|
|
23679
|
+
content,
|
|
23680
|
+
...toolCalls ? { toolCalls } : {},
|
|
23681
|
+
...toolResults ? { toolResults } : {}
|
|
23682
|
+
};
|
|
23683
|
+
}
|
|
23684
|
+
function compactSessionSummaryForContextExport(s) {
|
|
23685
|
+
return {
|
|
23686
|
+
...s,
|
|
23687
|
+
outputPreview: compactLongText(s.outputPreview),
|
|
23688
|
+
...s.toolTraceSummary !== void 0 ? { toolTraceSummary: compactLongText(s.toolTraceSummary) } : {}
|
|
23689
|
+
};
|
|
23690
|
+
}
|
|
23691
|
+
function compactContinuationForContextExport(c) {
|
|
23692
|
+
return {
|
|
23693
|
+
...c,
|
|
23694
|
+
...c.userMessage !== void 0 ? { userMessage: compactLongText(c.userMessage) } : {}
|
|
23695
|
+
};
|
|
23696
|
+
}
|
|
23697
|
+
function compactMarathonStateJsonForContextExport(parsed) {
|
|
23698
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
23699
|
+
return typeof parsed === "string" ? compactLongText(parsed) : parsed;
|
|
23700
|
+
}
|
|
23701
|
+
if (Array.isArray(parsed)) {
|
|
23702
|
+
return parsed.map((item) => compactMarathonStateJsonForContextExport(item));
|
|
23703
|
+
}
|
|
23704
|
+
const obj = parsed;
|
|
23705
|
+
const out = {};
|
|
23706
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
23707
|
+
if (key === "sessionSnapshots" && Array.isArray(value)) {
|
|
23708
|
+
out[key] = value.map(
|
|
23709
|
+
(snap) => compactSessionSnapshotForContextExport(snap)
|
|
23710
|
+
);
|
|
23711
|
+
} else if (key === "messages" && Array.isArray(value)) {
|
|
23712
|
+
out[key] = value.map((m) => compactAgentMessageForContextExport(m));
|
|
23713
|
+
} else if (key === "sessions" && Array.isArray(value)) {
|
|
23714
|
+
out[key] = value.map((s) => compactSessionSummaryForContextExport(s));
|
|
23715
|
+
} else if (key === "continuations" && Array.isArray(value)) {
|
|
23716
|
+
out[key] = value.map((c) => compactContinuationForContextExport(c));
|
|
23717
|
+
} else if (key === "lastOutput" || key === "bootstrapContext" || key === "originalMessage" || key === "lastError" || key === "phaseTransitionSummary") {
|
|
23718
|
+
out[key] = typeof value === "string" ? compactLongText(value) : value;
|
|
23719
|
+
} else if (key === "workflowState" && value && typeof value === "object") {
|
|
23720
|
+
out[key] = JSON.parse(JSON.stringify(value, stringCompactionReplacer));
|
|
23721
|
+
} else {
|
|
23722
|
+
out[key] = compactMarathonStateJsonForContextExport(value);
|
|
23723
|
+
}
|
|
23724
|
+
}
|
|
23725
|
+
return out;
|
|
23726
|
+
}
|
|
23727
|
+
function compactLiveMarathonPayloadForContextExport(payload) {
|
|
23728
|
+
return {
|
|
23729
|
+
sessionSnapshots: payload.sessionSnapshots.map(compactSessionSnapshotForContextExport),
|
|
23730
|
+
content: compactLongText(payload.content),
|
|
23731
|
+
reasoning: compactLongText(payload.reasoning),
|
|
23732
|
+
tools: payload.tools.map(compactMarathonToolEntryForCopy),
|
|
23733
|
+
rawEvents: payload.rawEvents.map(compactRawStreamEventForCopy)
|
|
23734
|
+
};
|
|
23735
|
+
}
|
|
23736
|
+
|
|
23538
23737
|
// src/ink/marathon/UpgradeModal.tsx
|
|
23539
23738
|
import { Box as Box23, Text as Text25 } from "ink";
|
|
23540
23739
|
import { theme as theme25 } from "@runtypelabs/ink-components";
|
|
@@ -23979,6 +24178,8 @@ function getLatestSessionTabKey(sessionSnapshots, liveSnapshot) {
|
|
|
23979
24178
|
return latestSnapshot ? createSessionTabKey(latestSnapshot.sessionIndex) : void 0;
|
|
23980
24179
|
}
|
|
23981
24180
|
function getSessionTabBaseTitle(snapshot) {
|
|
24181
|
+
if (snapshot.status === "error") return `Run ${snapshot.sessionIndex} \u2717`;
|
|
24182
|
+
if (snapshot.status === "budget_exceeded") return `Run ${snapshot.sessionIndex} $`;
|
|
23982
24183
|
return `Run ${snapshot.sessionIndex}${snapshot.status === "live" ? "*" : ""}`;
|
|
23983
24184
|
}
|
|
23984
24185
|
function estimateRenderedTabWidth(tab) {
|
|
@@ -24116,17 +24317,19 @@ function upsertSessionSnapshots(snapshots, nextSnapshot) {
|
|
|
24116
24317
|
return result;
|
|
24117
24318
|
}
|
|
24118
24319
|
function buildLiveSessionSnapshot(liveState, rawEvents, sessionIndex, model) {
|
|
24119
|
-
const
|
|
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);
|
|
24120
24322
|
if (!hasLiveState) return void 0;
|
|
24121
24323
|
return {
|
|
24122
24324
|
sessionIndex,
|
|
24123
|
-
status: "live",
|
|
24325
|
+
status: isError ? "error" : "live",
|
|
24124
24326
|
model,
|
|
24125
24327
|
cost: liveState.totalCost,
|
|
24126
24328
|
content: liveState.content,
|
|
24127
24329
|
reasoning: liveState.reasoning,
|
|
24128
24330
|
tools: liveState.tools,
|
|
24129
|
-
rawEvents
|
|
24331
|
+
rawEvents,
|
|
24332
|
+
...isError && liveState.error ? { errorMessage: liveState.error.message } : {}
|
|
24130
24333
|
};
|
|
24131
24334
|
}
|
|
24132
24335
|
function copyToClipboard(text) {
|
|
@@ -24385,6 +24588,30 @@ function MarathonApp({
|
|
|
24385
24588
|
showFlash("Copy failed");
|
|
24386
24589
|
}
|
|
24387
24590
|
}, [sessionSnapshots, state.content, state.reasoning, state.tools, stateFilePath2]);
|
|
24591
|
+
const handleCopySessionTrimmed = useCallback8(() => {
|
|
24592
|
+
setShowSessionMenu(false);
|
|
24593
|
+
try {
|
|
24594
|
+
let json;
|
|
24595
|
+
if (stateFilePath2 && fs4.existsSync(stateFilePath2)) {
|
|
24596
|
+
const raw = fs4.readFileSync(stateFilePath2, "utf-8");
|
|
24597
|
+
const parsed = JSON.parse(raw);
|
|
24598
|
+
json = JSON.stringify(compactMarathonStateJsonForContextExport(parsed), null, 2);
|
|
24599
|
+
} else {
|
|
24600
|
+
const compacted = compactLiveMarathonPayloadForContextExport({
|
|
24601
|
+
sessionSnapshots,
|
|
24602
|
+
content: state.content,
|
|
24603
|
+
reasoning: state.reasoning,
|
|
24604
|
+
tools: state.tools,
|
|
24605
|
+
rawEvents: rawEventsRef.current
|
|
24606
|
+
});
|
|
24607
|
+
json = JSON.stringify(compacted, null, 2);
|
|
24608
|
+
}
|
|
24609
|
+
const ok = copyToClipboard(json);
|
|
24610
|
+
showFlash(ok ? "Copied trimmed session JSON!" : "Copy failed");
|
|
24611
|
+
} catch {
|
|
24612
|
+
showFlash("Copy failed");
|
|
24613
|
+
}
|
|
24614
|
+
}, [sessionSnapshots, state.content, state.reasoning, state.tools, stateFilePath2]);
|
|
24388
24615
|
const handleOpenStateFile = useCallback8(() => {
|
|
24389
24616
|
setShowSessionMenu(false);
|
|
24390
24617
|
if (stateFilePath2 && fs4.existsSync(stateFilePath2)) {
|
|
@@ -24435,6 +24662,15 @@ function MarathonApp({
|
|
|
24435
24662
|
);
|
|
24436
24663
|
}, [followLatest, liveSessionKey, liveSessionSnapshot, selectedSessionKey, sessionSnapshots]);
|
|
24437
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]);
|
|
24438
24674
|
const displayedContent = displayedSessionSnapshot?.content ?? state.content;
|
|
24439
24675
|
const displayedReasoning = displayedSessionSnapshot?.reasoning ?? state.reasoning;
|
|
24440
24676
|
const displayedTools = displayedSessionSnapshot?.tools ?? state.tools;
|
|
@@ -25305,6 +25541,7 @@ function MarathonApp({
|
|
|
25305
25541
|
onSubmit: handleCheckpointSubmit,
|
|
25306
25542
|
onToggleHelp: () => setShowHelpOverlay((prev) => !prev),
|
|
25307
25543
|
onCopySession: handleCopySession,
|
|
25544
|
+
onCopySessionTrimmed: handleCopySessionTrimmed,
|
|
25308
25545
|
onOpenStateFile: handleOpenStateFile,
|
|
25309
25546
|
timeout: checkpointTimeout ?? 10,
|
|
25310
25547
|
isTerminal: isTerminalCheckpoint,
|
|
@@ -25364,7 +25601,7 @@ function MarathonApp({
|
|
|
25364
25601
|
thinkingStartedAt: state.thinkingStartedAt,
|
|
25365
25602
|
contextCompaction: showContextCompactionIndicator ? state.contextCompaction : null,
|
|
25366
25603
|
showUpgradeBrowseHint,
|
|
25367
|
-
error:
|
|
25604
|
+
error: upgradePrompt ? null : displayedError
|
|
25368
25605
|
}
|
|
25369
25606
|
)
|
|
25370
25607
|
}
|
|
@@ -25443,6 +25680,7 @@ function MarathonApp({
|
|
|
25443
25680
|
SessionActionMenu,
|
|
25444
25681
|
{
|
|
25445
25682
|
onCopySession: handleCopySession,
|
|
25683
|
+
onCopySessionTrimmed: handleCopySessionTrimmed,
|
|
25446
25684
|
onOpenStateFile: handleOpenStateFile,
|
|
25447
25685
|
onOpenFolder: handleOpenFolder,
|
|
25448
25686
|
onOpenDashboard: handleOpenDashboard,
|
|
@@ -26600,7 +26838,8 @@ function sanitizeMarathonSessionSnapshots(snapshots) {
|
|
|
26600
26838
|
})),
|
|
26601
26839
|
...typeof snapshot.stopReason === "string" ? { stopReason: snapshot.stopReason } : {},
|
|
26602
26840
|
...typeof snapshot.completedAt === "string" ? { completedAt: snapshot.completedAt } : {},
|
|
26603
|
-
...typeof snapshot.model === "string" ? { model: snapshot.model } : {}
|
|
26841
|
+
...typeof snapshot.model === "string" ? { model: snapshot.model } : {},
|
|
26842
|
+
...typeof snapshot.errorMessage === "string" ? { errorMessage: snapshot.errorMessage } : {}
|
|
26604
26843
|
};
|
|
26605
26844
|
bySessionIndex.set(sanitizedSnapshot.sessionIndex, sanitizedSnapshot);
|
|
26606
26845
|
}
|
|
@@ -26625,7 +26864,7 @@ function mergeMarathonSessionSummaries(existingSessions, nextSessions, offset) {
|
|
|
26625
26864
|
}
|
|
26626
26865
|
return Array.from(byIndex.values()).sort((left, right) => left.index - right.index);
|
|
26627
26866
|
}
|
|
26628
|
-
function buildMarathonSessionSnapshot(liveState, sessionSummary, model, status = "complete") {
|
|
26867
|
+
function buildMarathonSessionSnapshot(liveState, sessionSummary, model, status = "complete", errorMessage) {
|
|
26629
26868
|
return {
|
|
26630
26869
|
sessionIndex: sessionSummary.index,
|
|
26631
26870
|
status,
|
|
@@ -26643,7 +26882,8 @@ function buildMarathonSessionSnapshot(liveState, sessionSummary, model, status =
|
|
|
26643
26882
|
rawEvents: liveState.rawEvents.map((event) => ({
|
|
26644
26883
|
...event,
|
|
26645
26884
|
data: structuredClone(event.data)
|
|
26646
|
-
}))
|
|
26885
|
+
})),
|
|
26886
|
+
...errorMessage ? { errorMessage } : {}
|
|
26647
26887
|
};
|
|
26648
26888
|
}
|
|
26649
26889
|
function mapRunTaskStatusToSnapshotStatus(status, fallback) {
|
|
@@ -29369,6 +29609,7 @@ Saving state... done. Session saved to ${filePath}`);
|
|
|
29369
29609
|
const latestSessionSummary2 = persistedSessionSummaries[persistedSessionSummaries.length - 1];
|
|
29370
29610
|
if (currentActions && latestSessionSummary2) {
|
|
29371
29611
|
const liveState = currentActions.getState();
|
|
29612
|
+
const snapshotStatus = mapRunTaskStatusToSnapshotStatus(state.status, "complete");
|
|
29372
29613
|
const sessionSnapshot = buildMarathonSessionSnapshot(
|
|
29373
29614
|
{
|
|
29374
29615
|
content: liveState.content,
|
|
@@ -29378,7 +29619,9 @@ Saving state... done. Session saved to ${filePath}`);
|
|
|
29378
29619
|
sessionSnapshots: []
|
|
29379
29620
|
},
|
|
29380
29621
|
latestSessionSummary2,
|
|
29381
|
-
options.model
|
|
29622
|
+
options.model,
|
|
29623
|
+
snapshotStatus,
|
|
29624
|
+
snapshotStatus === "error" ? state.lastError : void 0
|
|
29382
29625
|
);
|
|
29383
29626
|
persistedSessionSnapshots = upsertMarathonSessionSnapshot(
|
|
29384
29627
|
persistedSessionSnapshots,
|
|
@@ -29533,14 +29776,16 @@ Saving state... done. Session saved to ${filePath}`);
|
|
|
29533
29776
|
const completedTools = existingSnapshot.tools.map(
|
|
29534
29777
|
(t) => t.status === "running" ? { ...t, status: "complete", executionTime: Date.now() - t.startedAt } : t
|
|
29535
29778
|
);
|
|
29779
|
+
const finalStatus = mapRunTaskStatusToSnapshotStatus(result2.status, existingSnapshot.status);
|
|
29536
29780
|
const updatedSnapshot = {
|
|
29537
29781
|
...existingSnapshot,
|
|
29538
|
-
status:
|
|
29782
|
+
status: finalStatus,
|
|
29539
29783
|
stopReason: latestSessionSummary.stopReason,
|
|
29540
29784
|
cost: latestSessionSummary.cost,
|
|
29541
29785
|
completedAt: latestSessionSummary.completedAt,
|
|
29542
29786
|
model: options.model,
|
|
29543
|
-
tools: completedTools
|
|
29787
|
+
tools: completedTools,
|
|
29788
|
+
...finalStatus === "error" && lastKnownState?.lastError ? { errorMessage: lastKnownState.lastError } : {}
|
|
29544
29789
|
};
|
|
29545
29790
|
persistedSessionSnapshots = upsertMarathonSessionSnapshot(persistedSessionSnapshots, updatedSnapshot);
|
|
29546
29791
|
streamRef.current?.appendSessionSnapshot(updatedSnapshot);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtypelabs/cli",
|
|
3
|
-
"version": "2.
|
|
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,7 +22,7 @@
|
|
|
22
22
|
"uuid": "^9.0.1",
|
|
23
23
|
"micromatch": "^4.0.8",
|
|
24
24
|
"yaml": "^2.8.3",
|
|
25
|
-
"@runtypelabs/sdk": "1.13.
|
|
25
|
+
"@runtypelabs/sdk": "1.13.3",
|
|
26
26
|
"@runtypelabs/ink-components": "0.3.1",
|
|
27
27
|
"@runtypelabs/terminal-animations": "0.2.0"
|
|
28
28
|
},
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"tsx": "^4.7.1",
|
|
38
38
|
"typescript": "^5.3.3",
|
|
39
39
|
"vitest": "^4.0.18",
|
|
40
|
-
"@runtypelabs/shared": "1.
|
|
40
|
+
"@runtypelabs/shared": "1.1.1"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=18.0.0"
|