@runtypelabs/cli 1.1.3 → 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 +87 -58
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -606,6 +606,22 @@ 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
627
|
import { theme } from "@runtypelabs/ink-components";
|
|
@@ -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
|
|
@@ -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";
|