@runtypelabs/cli 1.1.0 → 1.1.4
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 +121 -92
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -127,7 +127,7 @@ var init_credential_store = __esm({
|
|
|
127
127
|
// src/index.ts
|
|
128
128
|
import { Command as Command20 } from "commander";
|
|
129
129
|
import chalk21 from "chalk";
|
|
130
|
-
import { config as
|
|
130
|
+
import { config as loadEnv } from "dotenv";
|
|
131
131
|
import { readFileSync as readFileSync6 } from "fs";
|
|
132
132
|
import { dirname as dirname2, join as join2 } from "path";
|
|
133
133
|
import { fileURLToPath } from "url";
|
|
@@ -452,9 +452,9 @@ var CallbackServer = class {
|
|
|
452
452
|
var OAuthManager = class {
|
|
453
453
|
clerkPublishableKey;
|
|
454
454
|
dashboardUrl;
|
|
455
|
-
constructor(
|
|
456
|
-
this.clerkPublishableKey =
|
|
457
|
-
this.dashboardUrl =
|
|
455
|
+
constructor(config2) {
|
|
456
|
+
this.clerkPublishableKey = config2.clerkPublishableKey;
|
|
457
|
+
this.dashboardUrl = config2.dashboardUrl;
|
|
458
458
|
}
|
|
459
459
|
async authenticate(mode) {
|
|
460
460
|
const state = crypto.randomBytes(32).toString("base64url");
|
|
@@ -606,9 +606,25 @@ function isTTY(options) {
|
|
|
606
606
|
return process.stdout.isTTY === true;
|
|
607
607
|
}
|
|
608
608
|
|
|
609
|
+
// src/ink/shared/altScreen.ts
|
|
610
|
+
function enterAltScreen() {
|
|
611
|
+
if (!process.stdout.isTTY) return () => {
|
|
612
|
+
};
|
|
613
|
+
process.stdout.write("\x1B[?1049h\x1B[2J\x1B[H");
|
|
614
|
+
let restored = false;
|
|
615
|
+
const restore = () => {
|
|
616
|
+
if (restored) return;
|
|
617
|
+
restored = true;
|
|
618
|
+
process.removeListener("exit", restore);
|
|
619
|
+
process.stdout.write("\x1B[?1049l");
|
|
620
|
+
};
|
|
621
|
+
process.on("exit", restore);
|
|
622
|
+
return restore;
|
|
623
|
+
}
|
|
624
|
+
|
|
609
625
|
// src/ink/shared/EntityCard.tsx
|
|
610
626
|
import { Box, Text } from "ink";
|
|
611
|
-
import { theme } from "@runtypelabs/ink";
|
|
627
|
+
import { theme } from "@runtypelabs/ink-components";
|
|
612
628
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
613
629
|
function EntityCard({ fields, title }) {
|
|
614
630
|
const visibleFields = fields.filter(
|
|
@@ -631,7 +647,7 @@ function EntityCard({ fields, title }) {
|
|
|
631
647
|
// src/ink/shared/ConfirmPrompt.tsx
|
|
632
648
|
import { useState } from "react";
|
|
633
649
|
import { Text as Text2, useInput } from "ink";
|
|
634
|
-
import { theme as theme2 } from "@runtypelabs/ink";
|
|
650
|
+
import { theme as theme2 } from "@runtypelabs/ink-components";
|
|
635
651
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
636
652
|
function ConfirmPrompt({
|
|
637
653
|
message,
|
|
@@ -682,7 +698,7 @@ function ConfirmPrompt({
|
|
|
682
698
|
// src/ink/shared/DataList.tsx
|
|
683
699
|
import { useEffect, useRef } from "react";
|
|
684
700
|
import { Box as Box2, Text as Text3, useApp, useInput as useInput2 } from "ink";
|
|
685
|
-
import { Spinner, ErrorDisplay, theme as theme3 } from "@runtypelabs/ink";
|
|
701
|
+
import { Spinner, ErrorDisplay, theme as theme3 } from "@runtypelabs/ink-components";
|
|
686
702
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
687
703
|
function DataList({
|
|
688
704
|
title,
|
|
@@ -751,7 +767,7 @@ function DataList({
|
|
|
751
767
|
// src/ink/shared/MutationResult.tsx
|
|
752
768
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
753
769
|
import { Box as Box3, Text as Text4, useApp as useApp2, useInput as useInput3 } from "ink";
|
|
754
|
-
import { Spinner as Spinner2, ErrorDisplay as ErrorDisplay2, theme as theme4 } from "@runtypelabs/ink";
|
|
770
|
+
import { Spinner as Spinner2, ErrorDisplay as ErrorDisplay2, theme as theme4 } from "@runtypelabs/ink-components";
|
|
755
771
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
756
772
|
function MutationResult({
|
|
757
773
|
loading,
|
|
@@ -1743,7 +1759,7 @@ flowsCommand.command("run <id>").description("Execute a flow via dispatch").opti
|
|
|
1743
1759
|
try {
|
|
1744
1760
|
const response = await client.stream("/dispatch", payload);
|
|
1745
1761
|
const callbacks = {
|
|
1746
|
-
|
|
1762
|
+
onStepDelta: (chunk) => {
|
|
1747
1763
|
process.stdout.write(chunk);
|
|
1748
1764
|
},
|
|
1749
1765
|
onFlowComplete: (event) => {
|
|
@@ -2378,7 +2394,7 @@ promptsCommand.command("test <id>").description("Test a prompt with input").opti
|
|
|
2378
2394
|
try {
|
|
2379
2395
|
const response = await client.stream("/dispatch", payload);
|
|
2380
2396
|
const callbacks = {
|
|
2381
|
-
|
|
2397
|
+
onStepDelta: (chunk) => {
|
|
2382
2398
|
process.stdout.write(chunk);
|
|
2383
2399
|
},
|
|
2384
2400
|
onError: (err) => {
|
|
@@ -2796,7 +2812,7 @@ import { useState as useState10, useEffect as useEffect9, useRef as useRef4 } fr
|
|
|
2796
2812
|
import fs3 from "fs";
|
|
2797
2813
|
import path3 from "path";
|
|
2798
2814
|
import { Box as Box10, useApp as useApp3, useInput as useInput7, useStdout } from "ink";
|
|
2799
|
-
import { StatusBar, ErrorDisplay as ErrorDisplay3 } from "@runtypelabs/ink";
|
|
2815
|
+
import { StatusBar, ErrorDisplay as ErrorDisplay3 } from "@runtypelabs/ink-components";
|
|
2800
2816
|
|
|
2801
2817
|
// src/ink/talk/useTalkStream.ts
|
|
2802
2818
|
import { useState as useState7, useRef as useRef3, useMemo, useCallback } from "react";
|
|
@@ -2814,7 +2830,7 @@ function useTalkStream() {
|
|
|
2814
2830
|
contentRef.current = "";
|
|
2815
2831
|
setState({ phase: "thinking", content: "", error: null });
|
|
2816
2832
|
},
|
|
2817
|
-
|
|
2833
|
+
onStepDelta(chunk) {
|
|
2818
2834
|
contentRef.current += chunk;
|
|
2819
2835
|
setState((prev) => ({
|
|
2820
2836
|
...prev,
|
|
@@ -2845,12 +2861,12 @@ function useTalkStream() {
|
|
|
2845
2861
|
// src/ink/talk/MessageHistory.tsx
|
|
2846
2862
|
import React7 from "react";
|
|
2847
2863
|
import { Box as Box5, Text as Text6 } from "ink";
|
|
2848
|
-
import { theme as theme6 } from "@runtypelabs/ink";
|
|
2864
|
+
import { theme as theme6 } from "@runtypelabs/ink-components";
|
|
2849
2865
|
|
|
2850
2866
|
// src/ink/talk/MessageBubble.tsx
|
|
2851
2867
|
import React6 from "react";
|
|
2852
2868
|
import { Box as Box4, Text as Text5 } from "ink";
|
|
2853
|
-
import { StreamOutput, theme as theme5 } from "@runtypelabs/ink";
|
|
2869
|
+
import { StreamOutput, theme as theme5 } from "@runtypelabs/ink-components";
|
|
2854
2870
|
|
|
2855
2871
|
// src/ink/talk/useRelativeTime.ts
|
|
2856
2872
|
import { useState as useState8, useEffect as useEffect8 } from "react";
|
|
@@ -2949,7 +2965,7 @@ var MessageHistory = React7.memo(MessageHistoryInner);
|
|
|
2949
2965
|
|
|
2950
2966
|
// src/ink/talk/StreamingBubble.tsx
|
|
2951
2967
|
import { Box as Box6, Text as Text7 } from "ink";
|
|
2952
|
-
import { StreamOutput as StreamOutput2, Spinner as Spinner3, theme as theme7 } from "@runtypelabs/ink";
|
|
2968
|
+
import { StreamOutput as StreamOutput2, Spinner as Spinner3, theme as theme7 } from "@runtypelabs/ink-components";
|
|
2953
2969
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2954
2970
|
function StreamingBubble({ content, phase, enableMarkdown }) {
|
|
2955
2971
|
return /* @__PURE__ */ jsxs6(
|
|
@@ -2983,12 +2999,12 @@ function StreamingBubble({ content, phase, enableMarkdown }) {
|
|
|
2983
2999
|
import { useState as useState9, useCallback as useCallback2 } from "react";
|
|
2984
3000
|
import { Box as Box8, Text as Text9, useInput as useInput5 } from "ink";
|
|
2985
3001
|
import TextInput from "ink-text-input";
|
|
2986
|
-
import { theme as theme9 } from "@runtypelabs/ink";
|
|
3002
|
+
import { theme as theme9 } from "@runtypelabs/ink-components";
|
|
2987
3003
|
|
|
2988
3004
|
// src/ink/talk/SlashCommandMenu.tsx
|
|
2989
3005
|
import { Box as Box7, Text as Text8, useInput as useInput4 } from "ink";
|
|
2990
3006
|
import SelectInput from "ink-select-input";
|
|
2991
|
-
import { theme as theme8 } from "@runtypelabs/ink";
|
|
3007
|
+
import { theme as theme8 } from "@runtypelabs/ink-components";
|
|
2992
3008
|
|
|
2993
3009
|
// src/ink/talk/types.ts
|
|
2994
3010
|
var TALK_COMMANDS = [
|
|
@@ -3176,7 +3192,7 @@ function ChatInput({
|
|
|
3176
3192
|
// src/ink/talk/ModelPicker.tsx
|
|
3177
3193
|
import { Box as Box9, Text as Text10, useInput as useInput6 } from "ink";
|
|
3178
3194
|
import SelectInput2 from "ink-select-input";
|
|
3179
|
-
import { theme as theme10 } from "@runtypelabs/ink";
|
|
3195
|
+
import { theme as theme10 } from "@runtypelabs/ink-components";
|
|
3180
3196
|
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3181
3197
|
var MODELS = [
|
|
3182
3198
|
{ label: "Claude Sonnet 4.5", value: "claude-sonnet-4-5" },
|
|
@@ -3482,23 +3498,32 @@ var talkCommand = new Command6("talk").description("Start an interactive chat se
|
|
|
3482
3498
|
session.setModel(newModel);
|
|
3483
3499
|
};
|
|
3484
3500
|
const streamRef = { current: null };
|
|
3485
|
-
const
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3501
|
+
const exitAltScreen = enterAltScreen();
|
|
3502
|
+
try {
|
|
3503
|
+
const { waitUntilExit } = render6(
|
|
3504
|
+
React8.createElement(TalkApp, {
|
|
3505
|
+
model: currentModel,
|
|
3506
|
+
apiKey,
|
|
3507
|
+
apiUrl,
|
|
3508
|
+
temperature: parseFloat(options.temperature),
|
|
3509
|
+
systemPrompt: options.system,
|
|
3510
|
+
enableMarkdown: options.markdown !== false,
|
|
3511
|
+
continueFile: options.continue,
|
|
3512
|
+
streamRef,
|
|
3513
|
+
onSend,
|
|
3514
|
+
onModelChange,
|
|
3515
|
+
onExit: () => process.exit(0)
|
|
3516
|
+
}),
|
|
3517
|
+
{ exitOnCtrlC: false }
|
|
3518
|
+
);
|
|
3519
|
+
await waitUntilExit();
|
|
3520
|
+
exitAltScreen();
|
|
3521
|
+
} catch (error) {
|
|
3522
|
+
exitAltScreen();
|
|
3523
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
3524
|
+
console.error(chalk8.red(`Talk failed: ${message}`));
|
|
3525
|
+
process.exit(1);
|
|
3526
|
+
}
|
|
3502
3527
|
});
|
|
3503
3528
|
|
|
3504
3529
|
// src/commands/config.ts
|
|
@@ -3903,11 +3928,11 @@ import { useState as useState12, useEffect as useEffect11, useCallback as useCal
|
|
|
3903
3928
|
import { Box as Box13, Text as Text13, useApp as useApp4, useInput as useInput8 } from "ink";
|
|
3904
3929
|
import TextInput2 from "ink-text-input";
|
|
3905
3930
|
import SelectInput3 from "ink-select-input";
|
|
3906
|
-
import { Spinner as Spinner4, theme as theme13 } from "@runtypelabs/ink";
|
|
3931
|
+
import { Spinner as Spinner4, theme as theme13 } from "@runtypelabs/ink-components";
|
|
3907
3932
|
|
|
3908
3933
|
// src/ink/init/WizardStep.tsx
|
|
3909
3934
|
import { Box as Box11, Text as Text11 } from "ink";
|
|
3910
|
-
import { theme as theme11 } from "@runtypelabs/ink";
|
|
3935
|
+
import { theme as theme11 } from "@runtypelabs/ink-components";
|
|
3911
3936
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3912
3937
|
function WizardStep({
|
|
3913
3938
|
stepNumber,
|
|
@@ -3933,7 +3958,7 @@ function WizardStep({
|
|
|
3933
3958
|
|
|
3934
3959
|
// src/ink/init/StepSummary.tsx
|
|
3935
3960
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
3936
|
-
import { theme as theme12 } from "@runtypelabs/ink";
|
|
3961
|
+
import { theme as theme12 } from "@runtypelabs/ink-components";
|
|
3937
3962
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3938
3963
|
function StepSummary({ answers }) {
|
|
3939
3964
|
if (answers.length === 0) {
|
|
@@ -4796,7 +4821,7 @@ async function handleStreaming(client, payload, options) {
|
|
|
4796
4821
|
[${event.name}] Running...`));
|
|
4797
4822
|
}
|
|
4798
4823
|
},
|
|
4799
|
-
|
|
4824
|
+
onStepDelta: (chunk) => {
|
|
4800
4825
|
process.stdout.write(chunk);
|
|
4801
4826
|
},
|
|
4802
4827
|
onStepComplete: (_result, event) => {
|
|
@@ -4924,7 +4949,7 @@ import { useState as useState18, useEffect as useEffect16, useRef as useRef7, us
|
|
|
4924
4949
|
import { execSync } from "child_process";
|
|
4925
4950
|
import open3 from "open";
|
|
4926
4951
|
import { Box as Box20, useApp as useApp5, useInput as useInput9, useStdout as useStdout2 } from "ink";
|
|
4927
|
-
import { StreamOutput as StreamOutput3, StatusBar as StatusBar2, ErrorDisplay as ErrorDisplay4, theme as theme21 } from "@runtypelabs/ink";
|
|
4952
|
+
import { StreamOutput as StreamOutput3, StatusBar as StatusBar2, ErrorDisplay as ErrorDisplay4, theme as theme21 } from "@runtypelabs/ink-components";
|
|
4928
4953
|
|
|
4929
4954
|
// src/ink/marathon/useMarathonStream.ts
|
|
4930
4955
|
import { useState as useState14, useRef as useRef5, useMemo as useMemo2, useCallback as useCallback4 } from "react";
|
|
@@ -5043,7 +5068,7 @@ function useMarathonStream() {
|
|
|
5043
5068
|
tools: prev.tools.map(
|
|
5044
5069
|
(t) => t.status === "running" ? { ...t, status: "complete", executionTime: Date.now() - t.startedAt } : t
|
|
5045
5070
|
),
|
|
5046
|
-
rawEvents: pushRawEvent(prev, "
|
|
5071
|
+
rawEvents: pushRawEvent(prev, "agent_await", {})
|
|
5047
5072
|
}));
|
|
5048
5073
|
},
|
|
5049
5074
|
onAgentComplete(event) {
|
|
@@ -5088,7 +5113,7 @@ function useMarathonStream() {
|
|
|
5088
5113
|
|
|
5089
5114
|
// src/ink/marathon/SessionHeader.tsx
|
|
5090
5115
|
import { Box as Box14, Text as Text14 } from "ink";
|
|
5091
|
-
import { theme as theme14 } from "@runtypelabs/ink";
|
|
5116
|
+
import { theme as theme14 } from "@runtypelabs/ink-components";
|
|
5092
5117
|
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5093
5118
|
function SessionHeader({
|
|
5094
5119
|
sessionName,
|
|
@@ -5120,7 +5145,7 @@ function SessionHeader({
|
|
|
5120
5145
|
|
|
5121
5146
|
// src/ink/marathon/ThinkingIndicator.tsx
|
|
5122
5147
|
import { useState as useState15, useEffect as useEffect13 } from "react";
|
|
5123
|
-
import { Spinner as Spinner5, theme as theme15 } from "@runtypelabs/ink";
|
|
5148
|
+
import { Spinner as Spinner5, theme as theme15 } from "@runtypelabs/ink-components";
|
|
5124
5149
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
5125
5150
|
function ThinkingIndicator({ startedAt }) {
|
|
5126
5151
|
const [elapsed, setElapsed] = useState15(
|
|
@@ -5140,11 +5165,11 @@ function ThinkingIndicator({ startedAt }) {
|
|
|
5140
5165
|
// src/ink/marathon/ToolPanel.tsx
|
|
5141
5166
|
import { useState as useState16, useEffect as useEffect14, useMemo as useMemo3 } from "react";
|
|
5142
5167
|
import { Box as Box16, Text as Text16 } from "ink";
|
|
5143
|
-
import { theme as theme17 } from "@runtypelabs/ink";
|
|
5168
|
+
import { theme as theme17 } from "@runtypelabs/ink-components";
|
|
5144
5169
|
|
|
5145
5170
|
// src/ink/marathon/ToolEntry.tsx
|
|
5146
5171
|
import { Box as Box15, Text as Text15 } from "ink";
|
|
5147
|
-
import { Spinner as Spinner6, theme as theme16 } from "@runtypelabs/ink";
|
|
5172
|
+
import { Spinner as Spinner6, theme as theme16 } from "@runtypelabs/ink-components";
|
|
5148
5173
|
import { Fragment, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5149
5174
|
function ToolEntry({ tool, now }) {
|
|
5150
5175
|
const elapsedLive = ((now - tool.startedAt) / 1e3).toFixed(1);
|
|
@@ -5231,13 +5256,13 @@ function ToolPanel({ tools, maxHeight }) {
|
|
|
5231
5256
|
// src/ink/marathon/EventStreamPanel.tsx
|
|
5232
5257
|
import { useMemo as useMemo4 } from "react";
|
|
5233
5258
|
import { Box as Box17, Text as Text17 } from "ink";
|
|
5234
|
-
import { theme as theme18 } from "@runtypelabs/ink";
|
|
5259
|
+
import { theme as theme18 } from "@runtypelabs/ink-components";
|
|
5235
5260
|
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5236
5261
|
var EVENT_COLORS = {
|
|
5237
5262
|
agent_start: theme18.success,
|
|
5238
5263
|
agent_complete: theme18.success,
|
|
5239
5264
|
agent_error: theme18.error,
|
|
5240
|
-
|
|
5265
|
+
agent_await: theme18.warning,
|
|
5241
5266
|
agent_iteration_start: theme18.info,
|
|
5242
5267
|
agent_iteration_complete: theme18.info,
|
|
5243
5268
|
agent_turn_delta: theme18.muted,
|
|
@@ -5375,11 +5400,11 @@ function EventStreamPanel({
|
|
|
5375
5400
|
import { useState as useState17, useEffect as useEffect15, useRef as useRef6 } from "react";
|
|
5376
5401
|
import { Box as Box19, Text as Text19 } from "ink";
|
|
5377
5402
|
import TextInput3 from "ink-text-input";
|
|
5378
|
-
import { theme as theme20 } from "@runtypelabs/ink";
|
|
5403
|
+
import { theme as theme20 } from "@runtypelabs/ink-components";
|
|
5379
5404
|
|
|
5380
5405
|
// src/ink/marathon/SteeringRecap.tsx
|
|
5381
5406
|
import { Box as Box18, Text as Text18 } from "ink";
|
|
5382
|
-
import { theme as theme19 } from "@runtypelabs/ink";
|
|
5407
|
+
import { theme as theme19 } from "@runtypelabs/ink-components";
|
|
5383
5408
|
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5384
5409
|
function SteeringRecap({
|
|
5385
5410
|
sessionNumber,
|
|
@@ -6338,51 +6363,53 @@ async function taskAction(agent, options) {
|
|
|
6338
6363
|
${sandboxPrompt}` : baseMessage;
|
|
6339
6364
|
const streamRef = { current: null };
|
|
6340
6365
|
let lastKnownState = null;
|
|
6341
|
-
const
|
|
6342
|
-
React12.createElement(MarathonApp, {
|
|
6343
|
-
taskName,
|
|
6344
|
-
agentId,
|
|
6345
|
-
model: options.model,
|
|
6346
|
-
sandbox: parsedSandbox,
|
|
6347
|
-
goal: baseMessage,
|
|
6348
|
-
initialSessionCount: priorSessionCount,
|
|
6349
|
-
initialCost: priorCost,
|
|
6350
|
-
debug: options.debug,
|
|
6351
|
-
plainText: options.plainText ?? false,
|
|
6352
|
-
noSteer: options.noSteer ?? false,
|
|
6353
|
-
steeringTimeout: parseInt(options.steerTimeout || "10", 10),
|
|
6354
|
-
dashboardUrl: getDashboardUrl(),
|
|
6355
|
-
onSaveState: (content, _tools) => {
|
|
6356
|
-
const partialState = {
|
|
6357
|
-
agentId,
|
|
6358
|
-
agentName: agentId,
|
|
6359
|
-
taskName,
|
|
6360
|
-
status: "paused",
|
|
6361
|
-
sessionCount: priorSessionCount,
|
|
6362
|
-
totalCost: priorCost,
|
|
6363
|
-
lastOutput: content || "",
|
|
6364
|
-
lastStopReason: "paused",
|
|
6365
|
-
sessions: [],
|
|
6366
|
-
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6367
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6368
|
-
...priorContinuations.length > 0 ? { continuations: priorContinuations } : {},
|
|
6369
|
-
...Object.keys(priorCostByModel).length > 0 ? { costByModel: priorCostByModel } : {},
|
|
6370
|
-
...priorOriginalMessage ? { originalMessage: priorOriginalMessage } : {}
|
|
6371
|
-
};
|
|
6372
|
-
saveState(filePath, partialState);
|
|
6373
|
-
console.log(`
|
|
6374
|
-
Saving state... done. Session saved to ${filePath}`);
|
|
6375
|
-
},
|
|
6376
|
-
onComplete: () => {
|
|
6377
|
-
},
|
|
6378
|
-
streamRef
|
|
6379
|
-
}),
|
|
6380
|
-
{ exitOnCtrlC: false }
|
|
6381
|
-
);
|
|
6366
|
+
const exitAltScreen = enterAltScreen();
|
|
6382
6367
|
try {
|
|
6368
|
+
const { waitUntilExit } = render10(
|
|
6369
|
+
React12.createElement(MarathonApp, {
|
|
6370
|
+
taskName,
|
|
6371
|
+
agentId,
|
|
6372
|
+
model: options.model,
|
|
6373
|
+
sandbox: parsedSandbox,
|
|
6374
|
+
goal: baseMessage,
|
|
6375
|
+
initialSessionCount: priorSessionCount,
|
|
6376
|
+
initialCost: priorCost,
|
|
6377
|
+
debug: options.debug,
|
|
6378
|
+
plainText: options.plainText ?? false,
|
|
6379
|
+
noSteer: options.noSteer ?? false,
|
|
6380
|
+
steeringTimeout: parseInt(options.steerTimeout || "10", 10),
|
|
6381
|
+
dashboardUrl: getDashboardUrl(),
|
|
6382
|
+
onSaveState: (content, _tools) => {
|
|
6383
|
+
const partialState = {
|
|
6384
|
+
agentId,
|
|
6385
|
+
agentName: agentId,
|
|
6386
|
+
taskName,
|
|
6387
|
+
status: "paused",
|
|
6388
|
+
sessionCount: priorSessionCount,
|
|
6389
|
+
totalCost: priorCost,
|
|
6390
|
+
lastOutput: content || "",
|
|
6391
|
+
lastStopReason: "paused",
|
|
6392
|
+
sessions: [],
|
|
6393
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6394
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6395
|
+
...priorContinuations.length > 0 ? { continuations: priorContinuations } : {},
|
|
6396
|
+
...Object.keys(priorCostByModel).length > 0 ? { costByModel: priorCostByModel } : {},
|
|
6397
|
+
...priorOriginalMessage ? { originalMessage: priorOriginalMessage } : {}
|
|
6398
|
+
};
|
|
6399
|
+
saveState(filePath, partialState);
|
|
6400
|
+
console.log(`
|
|
6401
|
+
Saving state... done. Session saved to ${filePath}`);
|
|
6402
|
+
},
|
|
6403
|
+
onComplete: () => {
|
|
6404
|
+
},
|
|
6405
|
+
streamRef
|
|
6406
|
+
}),
|
|
6407
|
+
{ exitOnCtrlC: false }
|
|
6408
|
+
);
|
|
6383
6409
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
6384
6410
|
const streamActions = streamRef.current;
|
|
6385
6411
|
if (!streamActions) {
|
|
6412
|
+
exitAltScreen();
|
|
6386
6413
|
console.error(chalk12.red("Failed to initialize marathon UI"));
|
|
6387
6414
|
process.exit(1);
|
|
6388
6415
|
}
|
|
@@ -6565,6 +6592,7 @@ Saving state... done. Session saved to ${filePath}`);
|
|
|
6565
6592
|
}
|
|
6566
6593
|
saveState(filePath, finalState);
|
|
6567
6594
|
await waitUntilExit();
|
|
6595
|
+
exitAltScreen();
|
|
6568
6596
|
console.log();
|
|
6569
6597
|
const statusColor = result.status === "complete" ? chalk12.green : result.status === "budget_exceeded" ? chalk12.red : chalk12.yellow;
|
|
6570
6598
|
console.log(`Status: ${statusColor(result.status)}`);
|
|
@@ -6606,6 +6634,7 @@ Resume: ${buildResumeCommand(agent, options, parsedSandbox)}`
|
|
|
6606
6634
|
printJson(finalState);
|
|
6607
6635
|
}
|
|
6608
6636
|
} catch (error) {
|
|
6637
|
+
exitAltScreen();
|
|
6609
6638
|
const stateAtError = lastKnownState;
|
|
6610
6639
|
if (stateAtError) {
|
|
6611
6640
|
stateAtError.status = "paused";
|
|
@@ -6887,7 +6916,7 @@ agentsCommand.command("execute <id>").description("Execute an agent").requiredOp
|
|
|
6887
6916
|
try {
|
|
6888
6917
|
const response = await client.stream(`/agents/${id}/execute`, payload);
|
|
6889
6918
|
const callbacks = {
|
|
6890
|
-
|
|
6919
|
+
onStepDelta: (chunk) => {
|
|
6891
6920
|
process.stdout.write(chunk);
|
|
6892
6921
|
},
|
|
6893
6922
|
onError: (err) => {
|
|
@@ -8886,7 +8915,7 @@ flowVersionsCommand.command("publish <flowId>").description("Publish a version")
|
|
|
8886
8915
|
|
|
8887
8916
|
// src/index.ts
|
|
8888
8917
|
init_credential_store();
|
|
8889
|
-
|
|
8918
|
+
loadEnv();
|
|
8890
8919
|
function getPackageVersion() {
|
|
8891
8920
|
try {
|
|
8892
8921
|
const pkgPath = join2(dirname2(fileURLToPath(import.meta.url)), "..", "package.json");
|