@runtypelabs/cli 2.7.0 → 2.8.1

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 CHANGED
@@ -10906,7 +10906,8 @@ var require_builtin_tools_registry = __commonJS({
10906
10906
  TEXT_TO_SPEECH: "text_to_speech",
10907
10907
  VOICE_PROCESSING: "voice_processing",
10908
10908
  THIRD_PARTY_API: "third_party_api",
10909
- ARTIFACT: "artifact"
10909
+ ARTIFACT: "artifact",
10910
+ DATA_MANAGEMENT: "data_management"
10910
10911
  };
10911
10912
  exports.BuiltInToolIdPrefix = {
10912
10913
  BUILTIN: "builtin",
@@ -11439,6 +11440,170 @@ var require_builtin_tools_registry = __commonJS({
11439
11440
  },
11440
11441
  executionHint: "platform",
11441
11442
  hidden: true
11443
+ },
11444
+ // Record Management Tools — CRUD operations on Runtype records
11445
+ {
11446
+ id: "runtype_record_upsert",
11447
+ name: "Upsert Record",
11448
+ description: "Create or update a Runtype record with structured metadata. Records are identified by type and name. If a record with the same type and name already exists, it will be updated based on the merge strategy.",
11449
+ category: exports.BuiltInToolCategory.DATA_MANAGEMENT,
11450
+ providers: [exports.BuiltInToolProvider.MULTI],
11451
+ parametersSchema: {
11452
+ type: "object",
11453
+ properties: {
11454
+ type: {
11455
+ type: "string",
11456
+ description: 'Record type category (e.g., "customer", "order", "note", "task")'
11457
+ },
11458
+ name: {
11459
+ type: "string",
11460
+ description: "Unique name for this record within its type"
11461
+ },
11462
+ metadata: {
11463
+ type: "object",
11464
+ description: "JSON object containing the record data"
11465
+ },
11466
+ mergeStrategy: {
11467
+ type: "string",
11468
+ description: 'How to handle existing data when updating: "merge" (shallow merge, new keys override) or "replace" (completely replace metadata)',
11469
+ enum: ["merge", "replace"],
11470
+ default: "merge"
11471
+ }
11472
+ },
11473
+ required: ["type", "name", "metadata"]
11474
+ },
11475
+ executionHint: "platform",
11476
+ requiresApiKey: false,
11477
+ platformKeySupport: false
11478
+ },
11479
+ {
11480
+ id: "runtype_record_batch_upsert",
11481
+ name: "Batch Upsert Records",
11482
+ description: "Create or update multiple Runtype records at once in a single transaction. Each record is identified by type and name. Maximum 100 records per call.",
11483
+ category: exports.BuiltInToolCategory.DATA_MANAGEMENT,
11484
+ providers: [exports.BuiltInToolProvider.MULTI],
11485
+ parametersSchema: {
11486
+ type: "object",
11487
+ properties: {
11488
+ records: {
11489
+ type: "array",
11490
+ description: "Array of records to upsert (max 100)",
11491
+ items: {
11492
+ type: "object",
11493
+ properties: {
11494
+ type: {
11495
+ type: "string",
11496
+ description: "Record type category"
11497
+ },
11498
+ name: {
11499
+ type: "string",
11500
+ description: "Unique name within this type"
11501
+ },
11502
+ metadata: {
11503
+ type: "object",
11504
+ description: "JSON object containing the record data"
11505
+ }
11506
+ },
11507
+ required: ["type", "name", "metadata"]
11508
+ }
11509
+ },
11510
+ mergeStrategy: {
11511
+ type: "string",
11512
+ description: 'How to handle existing data: "merge" or "replace". Applies to all records.',
11513
+ enum: ["merge", "replace"],
11514
+ default: "merge"
11515
+ }
11516
+ },
11517
+ required: ["records"]
11518
+ },
11519
+ executionHint: "platform",
11520
+ requiresApiKey: false,
11521
+ platformKeySupport: false
11522
+ },
11523
+ {
11524
+ id: "runtype_record_get",
11525
+ name: "Get Record",
11526
+ description: "Retrieve a single Runtype record by its type and name. Returns the full record including metadata, or null if not found.",
11527
+ category: exports.BuiltInToolCategory.DATA_MANAGEMENT,
11528
+ providers: [exports.BuiltInToolProvider.MULTI],
11529
+ parametersSchema: {
11530
+ type: "object",
11531
+ properties: {
11532
+ type: {
11533
+ type: "string",
11534
+ description: "Record type to look up"
11535
+ },
11536
+ name: {
11537
+ type: "string",
11538
+ description: "Record name to look up"
11539
+ }
11540
+ },
11541
+ required: ["type", "name"]
11542
+ },
11543
+ executionHint: "platform",
11544
+ requiresApiKey: false,
11545
+ platformKeySupport: false
11546
+ },
11547
+ {
11548
+ id: "runtype_record_list",
11549
+ name: "List Records",
11550
+ description: "List and search Runtype records with optional filtering by type and text search. Returns paginated results.",
11551
+ category: exports.BuiltInToolCategory.DATA_MANAGEMENT,
11552
+ providers: [exports.BuiltInToolProvider.MULTI],
11553
+ parametersSchema: {
11554
+ type: "object",
11555
+ properties: {
11556
+ type: {
11557
+ type: "string",
11558
+ description: "Filter by record type (optional)"
11559
+ },
11560
+ search: {
11561
+ type: "string",
11562
+ description: "Text search across record names (optional, case-insensitive)"
11563
+ },
11564
+ limit: {
11565
+ type: "number",
11566
+ description: "Maximum number of records to return (1-50, default 20)",
11567
+ minimum: 1,
11568
+ maximum: 50,
11569
+ default: 20
11570
+ },
11571
+ offset: {
11572
+ type: "number",
11573
+ description: "Number of records to skip for pagination (default 0)",
11574
+ minimum: 0,
11575
+ default: 0
11576
+ }
11577
+ },
11578
+ required: []
11579
+ },
11580
+ executionHint: "platform",
11581
+ requiresApiKey: false,
11582
+ platformKeySupport: false
11583
+ },
11584
+ {
11585
+ id: "runtype_record_delete",
11586
+ name: "Delete Record",
11587
+ description: "Delete a Runtype record by its type and name. Returns whether the record was found and deleted.",
11588
+ category: exports.BuiltInToolCategory.DATA_MANAGEMENT,
11589
+ providers: [exports.BuiltInToolProvider.MULTI],
11590
+ parametersSchema: {
11591
+ type: "object",
11592
+ properties: {
11593
+ type: {
11594
+ type: "string",
11595
+ description: "Record type of the record to delete"
11596
+ },
11597
+ name: {
11598
+ type: "string",
11599
+ description: "Name of the record to delete"
11600
+ }
11601
+ },
11602
+ required: ["type", "name"]
11603
+ },
11604
+ executionHint: "platform",
11605
+ requiresApiKey: false,
11606
+ platformKeySupport: false
11442
11607
  }
11443
11608
  ];
11444
11609
  exports.BUILTIN_TOOLS_REGISTRY = [
@@ -11642,6 +11807,8 @@ var require_generated_model_routing = __commonJS({
11642
11807
  "gemma-2-9b": ["vercel"],
11643
11808
  "gemma-2b": ["togetherai"],
11644
11809
  "gemma-2b-it": ["togetherai"],
11810
+ "gemma-4-26b-a4b-it": ["vercel"],
11811
+ "gemma-4-31b-it": ["vercel"],
11645
11812
  "gemma-7b": ["togetherai"],
11646
11813
  "gemma-7b-it": ["togetherai"],
11647
11814
  "glm-4.5": ["vercel"],
@@ -11655,6 +11822,7 @@ var require_generated_model_routing = __commonJS({
11655
11822
  "glm-4.7-flashx": ["vercel"],
11656
11823
  "glm-5": ["vercel"],
11657
11824
  "glm-5-turbo": ["vercel"],
11825
+ "glm-5v-turbo": ["vercel"],
11658
11826
  "gpt-3-5-turbo": ["vercel"],
11659
11827
  "gpt-3-5-turbo-instruct": ["vercel"],
11660
11828
  "gpt-3.5-turbo": ["openai", "vercel"],
@@ -11968,6 +12136,7 @@ var require_generated_model_routing = __commonJS({
11968
12136
  "qwen3.5-9b": ["mixlayer"],
11969
12137
  "qwen3.5-flash": ["vercel"],
11970
12138
  "qwen3.5-plus": ["vercel"],
12139
+ "qwen3.6-plus": ["vercel"],
11971
12140
  "RedPajama-INCITE-7B-Base": ["togetherai"],
11972
12141
  "RedPajama-INCITE-7B-Chat": ["togetherai"],
11973
12142
  "RedPajama-INCITE-7B-Instruct": ["togetherai"],
@@ -12010,6 +12179,7 @@ var require_generated_model_routing = __commonJS({
12010
12179
  "titan-embed-text-v2": ["vercel"],
12011
12180
  "Toppy-M-7B": ["togetherai"],
12012
12181
  "trinity-large-preview": ["vercel"],
12182
+ "trinity-large-thinking": ["vercel"],
12013
12183
  "trinity-mini": ["vercel"],
12014
12184
  "v0-1-0-md": ["vercel"],
12015
12185
  "v0-1-5-md": ["vercel"],
@@ -12104,6 +12274,8 @@ var require_generated_model_routing = __commonJS({
12104
12274
  "gemma-2-9b": ["vercel"],
12105
12275
  "gemma-2b": ["togetherai"],
12106
12276
  "gemma-2b-it": ["togetherai"],
12277
+ "gemma-4-26b-a4b-it": ["vercel"],
12278
+ "gemma-4-31b-it": ["vercel"],
12107
12279
  "gemma-7b": ["togetherai"],
12108
12280
  "gemma-7b-it": ["togetherai"],
12109
12281
  "glm-4-5": ["vercel"],
@@ -12117,6 +12289,7 @@ var require_generated_model_routing = __commonJS({
12117
12289
  "glm-4-7-flashx": ["vercel"],
12118
12290
  "glm-5": ["vercel"],
12119
12291
  "glm-5-turbo": ["vercel"],
12292
+ "glm-5v-turbo": ["vercel"],
12120
12293
  "gpt-3-5-turbo": ["openai", "vercel"],
12121
12294
  "gpt-3-5-turbo-0125": ["openai"],
12122
12295
  "gpt-3-5-turbo-0125-batch": ["openai"],
@@ -12401,6 +12574,7 @@ var require_generated_model_routing = __commonJS({
12401
12574
  "qwen3-5-9b": ["mixlayer"],
12402
12575
  "qwen3-5-flash": ["vercel"],
12403
12576
  "qwen3-5-plus": ["vercel"],
12577
+ "qwen3-6-plus": ["vercel"],
12404
12578
  "qwen3-coder": ["vercel"],
12405
12579
  "qwen3-coder-30b-a3b": ["vercel"],
12406
12580
  "qwen3-coder-next": ["vercel"],
@@ -12851,6 +13025,12 @@ var require_generated_model_routing = __commonJS({
12851
13025
  "gemma-2b-it": {
12852
13026
  "togetherai": "google/gemma-2b-it"
12853
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
+ },
12854
13034
  "gemma-7b": {
12855
13035
  "togetherai": "google/gemma-7b"
12856
13036
  },
@@ -12917,6 +13097,9 @@ var require_generated_model_routing = __commonJS({
12917
13097
  "glm-5-turbo": {
12918
13098
  "vercel": "zai/glm-5-turbo"
12919
13099
  },
13100
+ "glm-5v-turbo": {
13101
+ "vercel": "zai/glm-5v-turbo"
13102
+ },
12920
13103
  "gpt-3-5-turbo": {
12921
13104
  "openai": "gpt-3.5-turbo",
12922
13105
  "vercel": "openai/gpt-3-5-turbo"
@@ -14224,6 +14407,9 @@ var require_generated_model_routing = __commonJS({
14224
14407
  "qwen3-5-plus": {
14225
14408
  "vercel": "alibaba/qwen3.5-plus"
14226
14409
  },
14410
+ "qwen3-6-plus": {
14411
+ "vercel": "alibaba/qwen3.6-plus"
14412
+ },
14227
14413
  "qwen3-coder": {
14228
14414
  "vercel": "alibaba/qwen3-coder"
14229
14415
  },
@@ -14296,6 +14482,9 @@ var require_generated_model_routing = __commonJS({
14296
14482
  "qwen3.5-plus": {
14297
14483
  "vercel": "alibaba/qwen3.5-plus"
14298
14484
  },
14485
+ "qwen3.6-plus": {
14486
+ "vercel": "alibaba/qwen3.6-plus"
14487
+ },
14299
14488
  "redpajama-incite-7b-base": {
14300
14489
  "togetherai": "togethercomputer/RedPajama-INCITE-7B-Base"
14301
14490
  },
@@ -14468,11 +14657,14 @@ var require_generated_model_routing = __commonJS({
14468
14657
  "togetherai": "Undi95/Toppy-M-7B"
14469
14658
  },
14470
14659
  "trinity-large": {
14471
- "vercel": "arcee-ai/trinity-large-preview"
14660
+ "vercel": "arcee-ai/trinity-large-thinking"
14472
14661
  },
14473
14662
  "trinity-large-preview": {
14474
14663
  "vercel": "arcee-ai/trinity-large-preview"
14475
14664
  },
14665
+ "trinity-large-thinking": {
14666
+ "vercel": "arcee-ai/trinity-large-thinking"
14667
+ },
14476
14668
  "trinity-mini": {
14477
14669
  "vercel": "arcee-ai/trinity-mini"
14478
14670
  },
@@ -14585,6 +14777,7 @@ var require_generated_model_routing = __commonJS({
14585
14777
  "qwen3-32b": { providers: [{ provider: "vercel", weight: 100 }] },
14586
14778
  "qwen3-5-flash": { providers: [{ provider: "vercel", weight: 100 }] },
14587
14779
  "qwen3-5-plus": { providers: [{ provider: "vercel", weight: 100 }] },
14780
+ "qwen3-6-plus": { providers: [{ provider: "vercel", weight: 100 }] },
14588
14781
  "qwen3-coder": { providers: [{ provider: "vercel", weight: 100 }] },
14589
14782
  "qwen3-coder-30b-a3b": { providers: [{ provider: "vercel", weight: 100 }] },
14590
14783
  "qwen3-coder-next": { providers: [{ provider: "vercel", weight: 100 }] },
@@ -16433,6 +16626,16 @@ authCommand.command("status").description("Show authentication status").option("
16433
16626
  const { waitUntilExit } = render(React.createElement(App));
16434
16627
  await waitUntilExit();
16435
16628
  });
16629
+ authCommand.command("export-key").description("Print the stored API key to stdout (for use in scripts and .env files)").action(async () => {
16630
+ const store = new CredentialStore();
16631
+ const apiKey = await store.getApiKey();
16632
+ if (!apiKey) {
16633
+ console.error("Not authenticated. Run `runtype auth login` first.");
16634
+ process.exit(1);
16635
+ return;
16636
+ }
16637
+ process.stdout.write(apiKey);
16638
+ });
16436
16639
  authCommand.command("logout").description("Remove stored credentials").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
16437
16640
  const store = new CredentialStore();
16438
16641
  if (!isTTY(options)) {
@@ -21432,6 +21635,7 @@ var CHECKPOINT_COMMANDS = [
21432
21635
  { key: "/revert <file>", desc: "Restore file from checkpoint" },
21433
21636
  { key: "/reflect", desc: "Reassess approach" },
21434
21637
  { key: "/copy", desc: "Copy session JSON" },
21638
+ { key: "/copy-trimmed", desc: "Copy JSON with large payloads trimmed" },
21435
21639
  { key: "/open", desc: "Open state file" },
21436
21640
  { key: "/stop", desc: "Stop the marathon" },
21437
21641
  { key: "/help", desc: "Toggle this help dialog" }
@@ -22511,6 +22715,11 @@ var MARATHON_CHECKPOINT_COMMANDS = [
22511
22715
  },
22512
22716
  { name: "/reflect", description: "Open reflection editor to reassess approach", hasArgs: false },
22513
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
+ },
22514
22723
  { name: "/open", description: "Open state file in editor", hasArgs: false },
22515
22724
  { name: "/stop", description: "Stop marathon and save state", hasArgs: false },
22516
22725
  { name: "/help", description: "Show available commands", hasArgs: false }
@@ -23016,6 +23225,7 @@ function CheckpointPrompt({
23016
23225
  onSubmit,
23017
23226
  onToggleHelp,
23018
23227
  onCopySession,
23228
+ onCopySessionTrimmed,
23019
23229
  onOpenStateFile,
23020
23230
  timeout,
23021
23231
  isTerminal,
@@ -23134,6 +23344,11 @@ function CheckpointPrompt({
23134
23344
  clearInputDraft();
23135
23345
  return;
23136
23346
  }
23347
+ if (trimmed === "/copy-trimmed") {
23348
+ onCopySessionTrimmed?.();
23349
+ clearInputDraft();
23350
+ return;
23351
+ }
23137
23352
  if (trimmed === "/open") {
23138
23353
  onOpenStateFile?.();
23139
23354
  clearInputDraft();
@@ -23292,12 +23507,14 @@ import { theme as theme24 } from "@runtypelabs/ink-components";
23292
23507
  import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
23293
23508
  var MENU_ITEMS = [
23294
23509
  { key: "c", label: "Copy session JSON" },
23510
+ { key: "t", label: "Copy trimmed JSON (for LLM context)" },
23295
23511
  { key: "e", label: "Open session JSON in editor" },
23296
23512
  { key: "f", label: "Open marathon folder in file manager" },
23297
23513
  { key: "d", label: "Open agent in Runtype dashboard" }
23298
23514
  ];
23299
23515
  function SessionActionMenu({
23300
23516
  onCopySession,
23517
+ onCopySessionTrimmed,
23301
23518
  onOpenStateFile,
23302
23519
  onOpenFolder,
23303
23520
  onOpenDashboard,
@@ -23314,6 +23531,10 @@ function SessionActionMenu({
23314
23531
  onCopySession();
23315
23532
  return;
23316
23533
  }
23534
+ if (input === "t") {
23535
+ onCopySessionTrimmed();
23536
+ return;
23537
+ }
23317
23538
  if (input === "e" && hasStateFile) {
23318
23539
  onOpenStateFile();
23319
23540
  return;
@@ -23336,7 +23557,7 @@ function SessionActionMenu({
23336
23557
  backgroundColor: theme24.surfaceElevated,
23337
23558
  paddingX: 2,
23338
23559
  paddingY: 1,
23339
- width: 50,
23560
+ width: 62,
23340
23561
  children: [
23341
23562
  /* @__PURE__ */ jsx25(Text24, { bold: true, color: theme24.accent, children: "Session" }),
23342
23563
  /* @__PURE__ */ jsx25(Box22, { flexDirection: "column", marginTop: 1, children: MENU_ITEMS.map((item) => {
@@ -23355,6 +23576,164 @@ function SessionActionMenu({
23355
23576
  );
23356
23577
  }
23357
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
+
23358
23737
  // src/ink/marathon/UpgradeModal.tsx
23359
23738
  import { Box as Box23, Text as Text25 } from "ink";
23360
23739
  import { theme as theme25 } from "@runtypelabs/ink-components";
@@ -24205,6 +24584,30 @@ function MarathonApp({
24205
24584
  showFlash("Copy failed");
24206
24585
  }
24207
24586
  }, [sessionSnapshots, state.content, state.reasoning, state.tools, stateFilePath2]);
24587
+ const handleCopySessionTrimmed = useCallback8(() => {
24588
+ setShowSessionMenu(false);
24589
+ try {
24590
+ let json;
24591
+ if (stateFilePath2 && fs4.existsSync(stateFilePath2)) {
24592
+ const raw = fs4.readFileSync(stateFilePath2, "utf-8");
24593
+ const parsed = JSON.parse(raw);
24594
+ json = JSON.stringify(compactMarathonStateJsonForContextExport(parsed), null, 2);
24595
+ } else {
24596
+ const compacted = compactLiveMarathonPayloadForContextExport({
24597
+ sessionSnapshots,
24598
+ content: state.content,
24599
+ reasoning: state.reasoning,
24600
+ tools: state.tools,
24601
+ rawEvents: rawEventsRef.current
24602
+ });
24603
+ json = JSON.stringify(compacted, null, 2);
24604
+ }
24605
+ const ok = copyToClipboard(json);
24606
+ showFlash(ok ? "Copied trimmed session JSON!" : "Copy failed");
24607
+ } catch {
24608
+ showFlash("Copy failed");
24609
+ }
24610
+ }, [sessionSnapshots, state.content, state.reasoning, state.tools, stateFilePath2]);
24208
24611
  const handleOpenStateFile = useCallback8(() => {
24209
24612
  setShowSessionMenu(false);
24210
24613
  if (stateFilePath2 && fs4.existsSync(stateFilePath2)) {
@@ -25125,6 +25528,7 @@ function MarathonApp({
25125
25528
  onSubmit: handleCheckpointSubmit,
25126
25529
  onToggleHelp: () => setShowHelpOverlay((prev) => !prev),
25127
25530
  onCopySession: handleCopySession,
25531
+ onCopySessionTrimmed: handleCopySessionTrimmed,
25128
25532
  onOpenStateFile: handleOpenStateFile,
25129
25533
  timeout: checkpointTimeout ?? 10,
25130
25534
  isTerminal: isTerminalCheckpoint,
@@ -25263,6 +25667,7 @@ function MarathonApp({
25263
25667
  SessionActionMenu,
25264
25668
  {
25265
25669
  onCopySession: handleCopySession,
25670
+ onCopySessionTrimmed: handleCopySessionTrimmed,
25266
25671
  onOpenStateFile: handleOpenStateFile,
25267
25672
  onOpenFolder: handleOpenFolder,
25268
25673
  onOpenDashboard: handleOpenDashboard,
@@ -33315,4 +33720,3 @@ async function handleNoCommand() {
33315
33720
  }
33316
33721
  }
33317
33722
  }
33318
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/cli",
3
- "version": "2.7.0",
3
+ "version": "2.8.1",
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/ink-components": "0.3.0",
26
- "@runtypelabs/sdk": "1.13.0",
27
- "@runtypelabs/terminal-animations": "0.2.0"
25
+ "@runtypelabs/ink-components": "0.3.1",
26
+ "@runtypelabs/terminal-animations": "0.2.0",
27
+ "@runtypelabs/sdk": "1.13.3"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/micromatch": "^4.0.9",
@@ -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.0.7"
40
+ "@runtypelabs/shared": "1.1.1"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=18.0.0"