open-agents-ai 0.187.117 → 0.187.118
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 +468 -214
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22830,7 +22830,7 @@ function pbkdf2(hash, password, salt, opts) {
|
|
|
22830
22830
|
view.setInt32(0, ti, false);
|
|
22831
22831
|
(prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
|
|
22832
22832
|
Ti.set(u.subarray(0, Ti.length));
|
|
22833
|
-
for (let
|
|
22833
|
+
for (let ui2 = 1; ui2 < c4; ui2++) {
|
|
22834
22834
|
PRF._cloneInto(prfW).update(u).digestInto(u);
|
|
22835
22835
|
for (let i2 = 0; i2 < Ti.length; i2++)
|
|
22836
22836
|
Ti[i2] ^= u[i2];
|
|
@@ -271286,16 +271286,16 @@ __export(theme_exports, {
|
|
|
271286
271286
|
tuiAccent: () => tuiAccent,
|
|
271287
271287
|
tuiAccentFg: () => tuiAccentFg,
|
|
271288
271288
|
tuiBg: () => tuiBg,
|
|
271289
|
-
tuiBgSeq: () =>
|
|
271289
|
+
tuiBgSeq: () => tuiBgSeq2,
|
|
271290
271290
|
tuiBoxFg: () => tuiBoxFg,
|
|
271291
271291
|
tuiTextDim: () => tuiTextDim,
|
|
271292
|
-
tuiTextPrimary: () =>
|
|
271292
|
+
tuiTextPrimary: () => tuiTextPrimary2,
|
|
271293
271293
|
tuiTextPrimaryFg: () => tuiTextPrimaryFg
|
|
271294
271294
|
});
|
|
271295
271295
|
function themeMode() {
|
|
271296
271296
|
return _config2.mode;
|
|
271297
271297
|
}
|
|
271298
|
-
function
|
|
271298
|
+
function tuiBgSeq2() {
|
|
271299
271299
|
return _config2.bg < 0 ? "\x1B[49m" : `\x1B[48;5;${_config2.bg}m`;
|
|
271300
271300
|
}
|
|
271301
271301
|
function tuiBg() {
|
|
@@ -271310,7 +271310,7 @@ function tuiAccent() {
|
|
|
271310
271310
|
function tuiBoxFg() {
|
|
271311
271311
|
return _config2.boxColor < 0 ? "\x1B[39m" : `\x1B[38;5;${_config2.boxColor}m`;
|
|
271312
271312
|
}
|
|
271313
|
-
function
|
|
271313
|
+
function tuiTextPrimary2() {
|
|
271314
271314
|
return _config2.textPrimary;
|
|
271315
271315
|
}
|
|
271316
271316
|
function tuiTextPrimaryFg() {
|
|
@@ -271457,12 +271457,50 @@ var init_layout2 = __esm({
|
|
|
271457
271457
|
});
|
|
271458
271458
|
|
|
271459
271459
|
// packages/cli/dist/tui/render.js
|
|
271460
|
+
var render_exports = {};
|
|
271461
|
+
__export(render_exports, {
|
|
271462
|
+
SLASH_COMMANDS: () => SLASH_COMMANDS,
|
|
271463
|
+
c: () => c3,
|
|
271464
|
+
fileLink: () => fileLink,
|
|
271465
|
+
formatInlineMarkdown: () => formatInlineMarkdown,
|
|
271466
|
+
formatMarkdownBlock: () => formatMarkdownBlock,
|
|
271467
|
+
formatMarkdownLine: () => formatMarkdownLine,
|
|
271468
|
+
getColorsEnabled: () => getColorsEnabled,
|
|
271469
|
+
getEmojisEnabled: () => getEmojisEnabled,
|
|
271470
|
+
getTermWidth: () => getTermWidth,
|
|
271471
|
+
pastel: () => pastel,
|
|
271472
|
+
renderAssistantText: () => renderAssistantText,
|
|
271473
|
+
renderCompactHeader: () => renderCompactHeader,
|
|
271474
|
+
renderConfig: () => renderConfig,
|
|
271475
|
+
renderError: () => renderError,
|
|
271476
|
+
renderHeader: () => renderHeader,
|
|
271477
|
+
renderInfo: () => renderInfo,
|
|
271478
|
+
renderModelList: () => renderModelList,
|
|
271479
|
+
renderModelSwitch: () => renderModelSwitch,
|
|
271480
|
+
renderRichHeader: () => renderRichHeader,
|
|
271481
|
+
renderSlashHelp: () => renderSlashHelp,
|
|
271482
|
+
renderTaskAborted: () => renderTaskAborted,
|
|
271483
|
+
renderTaskComplete: () => renderTaskComplete,
|
|
271484
|
+
renderTaskIncomplete: () => renderTaskIncomplete,
|
|
271485
|
+
renderThinking: () => renderThinking,
|
|
271486
|
+
renderToolCallStart: () => renderToolCallStart,
|
|
271487
|
+
renderToolResult: () => renderToolResult,
|
|
271488
|
+
renderUserInterrupt: () => renderUserInterrupt,
|
|
271489
|
+
renderUserMessage: () => renderUserMessage,
|
|
271490
|
+
renderVerbose: () => renderVerbose,
|
|
271491
|
+
renderVoiceText: () => renderVoiceText,
|
|
271492
|
+
renderWarning: () => renderWarning,
|
|
271493
|
+
setColorsEnabled: () => setColorsEnabled,
|
|
271494
|
+
setContentWriteHook: () => setContentWriteHook,
|
|
271495
|
+
setEmojisEnabled: () => setEmojisEnabled,
|
|
271496
|
+
ui: () => ui
|
|
271497
|
+
});
|
|
271460
271498
|
function accentFg() {
|
|
271461
271499
|
const a2 = tuiAccent();
|
|
271462
271500
|
return a2 < 0 ? "\x1B[39m" : `\x1B[38;5;${a2}m`;
|
|
271463
271501
|
}
|
|
271464
271502
|
function textFg() {
|
|
271465
|
-
const t2 =
|
|
271503
|
+
const t2 = tuiTextPrimary2();
|
|
271466
271504
|
return t2 < 0 ? "\x1B[39m" : `\x1B[38;5;${t2}m`;
|
|
271467
271505
|
}
|
|
271468
271506
|
function ansi2(code8, text) {
|
|
@@ -271602,6 +271640,11 @@ function renderAssistantText(text) {
|
|
|
271602
271640
|
`);
|
|
271603
271641
|
}
|
|
271604
271642
|
}
|
|
271643
|
+
function renderThinking(text) {
|
|
271644
|
+
process.stdout.write(`
|
|
271645
|
+
${c3.magenta("\u25CF")} ${c3.italic(text)}
|
|
271646
|
+
`);
|
|
271647
|
+
}
|
|
271605
271648
|
function renderVoiceText(text) {
|
|
271606
271649
|
process.stdout.write(` ${c3.dim("\u{1F50A}")} ${c3.italic(c3.dim(text))}
|
|
271607
271650
|
`);
|
|
@@ -271909,6 +271952,69 @@ function renderVerbose(message2) {
|
|
|
271909
271952
|
process.stdout.write(text);
|
|
271910
271953
|
_contentWriteHook?.end();
|
|
271911
271954
|
}
|
|
271955
|
+
function renderRichHeader(opts) {
|
|
271956
|
+
const w = getTermWidth();
|
|
271957
|
+
const divider = c3.dim("\u2500".repeat(Math.min(w - 4, 72)));
|
|
271958
|
+
let lines = 0;
|
|
271959
|
+
process.stdout.write("\n");
|
|
271960
|
+
lines++;
|
|
271961
|
+
const title = c3.bold(c3.cyan("open-agents"));
|
|
271962
|
+
const ver = c3.dim(`v${opts.version}`);
|
|
271963
|
+
const model = c3.dim(`model: ${c3.white(opts.model)}`);
|
|
271964
|
+
process.stdout.write(` ${title} ${ver} ${c3.dim("\xB7")} ${model}
|
|
271965
|
+
`);
|
|
271966
|
+
lines++;
|
|
271967
|
+
const ws = opts.workspace.length > 60 ? "..." + opts.workspace.slice(-57) : opts.workspace;
|
|
271968
|
+
process.stdout.write(` ${c3.dim("workspace:")} ${c3.white(ws)}
|
|
271969
|
+
`);
|
|
271970
|
+
lines++;
|
|
271971
|
+
process.stdout.write(` ${divider}
|
|
271972
|
+
`);
|
|
271973
|
+
lines++;
|
|
271974
|
+
process.stdout.write(` ${c3.bold("Tools")} ${c3.dim(`(${TOOL_NAMES.length}):`)} `);
|
|
271975
|
+
let lineLen = 14;
|
|
271976
|
+
for (let i2 = 0; i2 < TOOL_NAMES.length; i2++) {
|
|
271977
|
+
const name10 = TOOL_NAMES[i2];
|
|
271978
|
+
const sep = i2 < TOOL_NAMES.length - 1 ? " " : "";
|
|
271979
|
+
if (lineLen + name10.length + 1 > w - 4) {
|
|
271980
|
+
process.stdout.write(`
|
|
271981
|
+
${" ".repeat(14)}`);
|
|
271982
|
+
lineLen = 14;
|
|
271983
|
+
lines++;
|
|
271984
|
+
}
|
|
271985
|
+
process.stdout.write(`${c3.cyan(name10)}${sep}`);
|
|
271986
|
+
lineLen += name10.length + 1;
|
|
271987
|
+
}
|
|
271988
|
+
process.stdout.write("\n");
|
|
271989
|
+
lines++;
|
|
271990
|
+
process.stdout.write(` ${c3.bold("Commands:")} ${COMMAND_NAMES.map((cmd) => c3.yellow(cmd)).join(" ")}
|
|
271991
|
+
`);
|
|
271992
|
+
lines++;
|
|
271993
|
+
process.stdout.write(` ${divider}
|
|
271994
|
+
`);
|
|
271995
|
+
lines++;
|
|
271996
|
+
const hintIdx = Math.floor(Date.now() / 1e4) % HINTS.length;
|
|
271997
|
+
const hint = HINTS[hintIdx];
|
|
271998
|
+
process.stdout.write(` ${c3.dim("\u{1F4A1}")} ${c3.italic(c3.dim(hint))}
|
|
271999
|
+
`);
|
|
272000
|
+
lines++;
|
|
272001
|
+
process.stdout.write(` ${c3.dim("Type a task to begin, or /help for all commands.")}
|
|
272002
|
+
|
|
272003
|
+
`);
|
|
272004
|
+
lines += 2;
|
|
272005
|
+
return lines;
|
|
272006
|
+
}
|
|
272007
|
+
function renderHeader(model) {
|
|
272008
|
+
const w = getTermWidth();
|
|
272009
|
+
process.stdout.write("\n");
|
|
272010
|
+
process.stdout.write(` ${c3.bold(c3.cyan("open-agents"))} ${c3.dim(model)}
|
|
272011
|
+
`);
|
|
272012
|
+
process.stdout.write(` ${c3.dim("\u2500".repeat(Math.min(w - 4, 72)))}
|
|
272013
|
+
`);
|
|
272014
|
+
process.stdout.write(` ${c3.dim("Type a task, or use /help for commands. /quit to exit.")}
|
|
272015
|
+
|
|
272016
|
+
`);
|
|
272017
|
+
}
|
|
271912
272018
|
function renderCompactHeader(model) {
|
|
271913
272019
|
process.stdout.write(`
|
|
271914
272020
|
${c3.bold(c3.cyan("open-agents"))} ${c3.dim(`(${model})`)}
|
|
@@ -271926,6 +272032,25 @@ function renderSlashHelp() {
|
|
|
271926
272032
|
}
|
|
271927
272033
|
process.stdout.write("\n");
|
|
271928
272034
|
}
|
|
272035
|
+
function renderModelList(models, current) {
|
|
272036
|
+
process.stdout.write(`
|
|
272037
|
+
${c3.bold("Available models:")}
|
|
272038
|
+
|
|
272039
|
+
`);
|
|
272040
|
+
for (const m2 of models) {
|
|
272041
|
+
const isCurrent = m2.name === current;
|
|
272042
|
+
const marker = isCurrent ? c3.green("\u25CF") : c3.dim("\u25CB");
|
|
272043
|
+
const name10 = isCurrent ? c3.bold(c3.green(m2.name)) : m2.name;
|
|
272044
|
+
const size = c3.dim(m2.size);
|
|
272045
|
+
const modified = c3.dim(m2.modified);
|
|
272046
|
+
process.stdout.write(` ${marker} ${name10.padEnd(50)} ${size.padEnd(12)} ${modified}
|
|
272047
|
+
`);
|
|
272048
|
+
}
|
|
272049
|
+
process.stdout.write(`
|
|
272050
|
+
${c3.dim("Use /model <name> to switch models.")}
|
|
272051
|
+
|
|
272052
|
+
`);
|
|
272053
|
+
}
|
|
271929
272054
|
function renderModelSwitch(oldModel, newModel) {
|
|
271930
272055
|
const redir = _contentWriteHook?.redirect?.();
|
|
271931
272056
|
const text = `
|
|
@@ -271940,6 +272065,17 @@ function renderModelSwitch(oldModel, newModel) {
|
|
|
271940
272065
|
process.stdout.write(text);
|
|
271941
272066
|
_contentWriteHook?.end();
|
|
271942
272067
|
}
|
|
272068
|
+
function renderConfig(config) {
|
|
272069
|
+
process.stdout.write(`
|
|
272070
|
+
${c3.bold("Configuration:")}
|
|
272071
|
+
|
|
272072
|
+
`);
|
|
272073
|
+
for (const [key, value2] of Object.entries(config)) {
|
|
272074
|
+
process.stdout.write(` ${c3.cyan(key.padEnd(20))} ${value2}
|
|
272075
|
+
`);
|
|
272076
|
+
}
|
|
272077
|
+
process.stdout.write("\n");
|
|
272078
|
+
}
|
|
271943
272079
|
function formatToolArgs(toolName, args, verbose) {
|
|
271944
272080
|
const maxArg = verbose ? 1e4 : Math.max(40, getTermWidth() - 20);
|
|
271945
272081
|
switch (toolName) {
|
|
@@ -272028,7 +272164,7 @@ function formatDuration2(ms) {
|
|
|
272028
272164
|
const secs = Math.floor(totalSecs % 60);
|
|
272029
272165
|
return `${mins}m ${secs}s`;
|
|
272030
272166
|
}
|
|
272031
|
-
var isTTY2, c3, _emojisEnabled, _colorsEnabled, MD, TOOL_ICONS, TOOL_LABELS, accent, accentBright, accentDim, accentWarm, accentSoft, TOOL_COLORS, _contentWriteHook, SLASH_COMMANDS;
|
|
272167
|
+
var isTTY2, c3, ui, pastel, _emojisEnabled, _colorsEnabled, MD, TOOL_ICONS, TOOL_LABELS, accent, accentBright, accentDim, accentWarm, accentSoft, TOOL_COLORS, _contentWriteHook, HINTS, TOOL_NAMES, COMMAND_NAMES, SLASH_COMMANDS;
|
|
272032
272168
|
var init_render = __esm({
|
|
272033
272169
|
"packages/cli/dist/tui/render.js"() {
|
|
272034
272170
|
"use strict";
|
|
@@ -272049,6 +272185,36 @@ var init_render = __esm({
|
|
|
272049
272185
|
bgBlue: (t2) => ansi2("44", t2),
|
|
272050
272186
|
bgGreen: (t2) => ansi2("42", t2)
|
|
272051
272187
|
};
|
|
272188
|
+
ui = {
|
|
272189
|
+
/** Primary text — lighter grey (252) for main content */
|
|
272190
|
+
primary: (t2) => fg256(252, t2),
|
|
272191
|
+
/** Sub-text — darker grey (245) for secondary info */
|
|
272192
|
+
sub: (t2) => fg256(245, t2),
|
|
272193
|
+
/** Dim text — very dark grey (240) for hints/placeholders */
|
|
272194
|
+
hint: (t2) => fg256(240, t2),
|
|
272195
|
+
/** Error text — magenta (bright) for errors */
|
|
272196
|
+
error: (t2) => fg256(198, t2),
|
|
272197
|
+
/** Warning text — warm orange for warnings */
|
|
272198
|
+
warn: (t2) => fg256(214, t2),
|
|
272199
|
+
/** Success text — green for confirmations */
|
|
272200
|
+
ok: (t2) => fg256(78, t2),
|
|
272201
|
+
/** Accent — yellow (178) matching header/banner */
|
|
272202
|
+
accent: (t2) => fg256(178, t2),
|
|
272203
|
+
/** Muted accent — dim yellow for secondary accent */
|
|
272204
|
+
accentDim: (t2) => fg256(136, t2)
|
|
272205
|
+
};
|
|
272206
|
+
pastel = {
|
|
272207
|
+
pink: (t2) => fg256(218, t2),
|
|
272208
|
+
peach: (t2) => fg256(216, t2),
|
|
272209
|
+
lavender: (t2) => fg256(183, t2),
|
|
272210
|
+
mint: (t2) => fg256(158, t2),
|
|
272211
|
+
sky: (t2) => fg256(117, t2),
|
|
272212
|
+
coral: (t2) => fg256(209, t2),
|
|
272213
|
+
lilac: (t2) => fg256(177, t2),
|
|
272214
|
+
sage: (t2) => fg256(151, t2),
|
|
272215
|
+
butter: (t2) => fg256(229, t2),
|
|
272216
|
+
ice: (t2) => fg256(153, t2)
|
|
272217
|
+
};
|
|
272052
272218
|
_emojisEnabled = false;
|
|
272053
272219
|
_colorsEnabled = true;
|
|
272054
272220
|
MD = {
|
|
@@ -272181,6 +272347,78 @@ var init_render = __esm({
|
|
|
272181
272347
|
ask_user: accentBright
|
|
272182
272348
|
};
|
|
272183
272349
|
_contentWriteHook = null;
|
|
272350
|
+
HINTS = [
|
|
272351
|
+
"Ask the agent to connect to the Open Agents Nexus for P2P agent networking",
|
|
272352
|
+
"Use /voice to enable TTS voice feedback while the agent works",
|
|
272353
|
+
"Drop an image file onto the terminal to give the agent visual context",
|
|
272354
|
+
"Type while the agent works (+ prompt) to steer its approach",
|
|
272355
|
+
"Press Ctrl+C to abort the current task",
|
|
272356
|
+
"Use /model to switch between available Ollama models",
|
|
272357
|
+
"Use /endpoint to connect to remote vLLM or OpenAI-compatible APIs",
|
|
272358
|
+
"Create AGENTS.md or OA.md in your project root for custom instructions",
|
|
272359
|
+
"The agent stores learned patterns in .oa/memory/ for future sessions",
|
|
272360
|
+
"Use /update to check for and install the latest version",
|
|
272361
|
+
"The agent can take screenshots and OCR text from images autonomously",
|
|
272362
|
+
"Sub-agents can run independent tasks in parallel via sub_agent tool",
|
|
272363
|
+
"Background tasks let the agent run tests while making other changes",
|
|
272364
|
+
"Use /nexus connect to join the decentralized agent mesh network"
|
|
272365
|
+
];
|
|
272366
|
+
TOOL_NAMES = [
|
|
272367
|
+
"file_read",
|
|
272368
|
+
"file_write",
|
|
272369
|
+
"file_edit",
|
|
272370
|
+
"file_patch",
|
|
272371
|
+
"shell",
|
|
272372
|
+
"grep_search",
|
|
272373
|
+
"find_files",
|
|
272374
|
+
"list_directory",
|
|
272375
|
+
"web_search",
|
|
272376
|
+
"web_fetch",
|
|
272377
|
+
"memory_read",
|
|
272378
|
+
"memory_write",
|
|
272379
|
+
"batch_edit",
|
|
272380
|
+
"codebase_map",
|
|
272381
|
+
"diagnostic",
|
|
272382
|
+
"git_info",
|
|
272383
|
+
"background_run",
|
|
272384
|
+
"task_status",
|
|
272385
|
+
"task_output",
|
|
272386
|
+
"task_stop",
|
|
272387
|
+
"sub_agent",
|
|
272388
|
+
"image_read",
|
|
272389
|
+
"screenshot",
|
|
272390
|
+
"ocr",
|
|
272391
|
+
"transcribe_file",
|
|
272392
|
+
"transcribe_url",
|
|
272393
|
+
"aiwg_setup",
|
|
272394
|
+
"aiwg_health",
|
|
272395
|
+
"aiwg_workflow",
|
|
272396
|
+
"create_tool",
|
|
272397
|
+
"manage_tools",
|
|
272398
|
+
"ask_user",
|
|
272399
|
+
"task_complete"
|
|
272400
|
+
];
|
|
272401
|
+
COMMAND_NAMES = [
|
|
272402
|
+
"/model",
|
|
272403
|
+
"/models",
|
|
272404
|
+
"/endpoint",
|
|
272405
|
+
"/config",
|
|
272406
|
+
"/update",
|
|
272407
|
+
"/voice",
|
|
272408
|
+
"/listen",
|
|
272409
|
+
"/call",
|
|
272410
|
+
"/hangup",
|
|
272411
|
+
"/stream",
|
|
272412
|
+
"/verbose",
|
|
272413
|
+
"/dream",
|
|
272414
|
+
"/bruteforce",
|
|
272415
|
+
"/compact",
|
|
272416
|
+
"/tools",
|
|
272417
|
+
"/skills",
|
|
272418
|
+
"/clear",
|
|
272419
|
+
"/help",
|
|
272420
|
+
"/quit"
|
|
272421
|
+
];
|
|
272184
272422
|
SLASH_COMMANDS = [
|
|
272185
272423
|
["/model", "Select from available models"],
|
|
272186
272424
|
["/model <name>", "Switch to a specific model"],
|
|
@@ -278593,9 +278831,9 @@ var init_daemon_registry = __esm({
|
|
|
278593
278831
|
*/
|
|
278594
278832
|
renderBar(width) {
|
|
278595
278833
|
this.refresh();
|
|
278596
|
-
const { tuiBgSeq:
|
|
278597
|
-
const PANEL_BG =
|
|
278598
|
-
const BTN_BG =
|
|
278834
|
+
const { tuiBgSeq: tuiBgSeq3 } = (init_theme(), __toCommonJS(theme_exports));
|
|
278835
|
+
const PANEL_BG = tuiBgSeq3();
|
|
278836
|
+
const BTN_BG = tuiBgSeq3();
|
|
278599
278837
|
let bar = "";
|
|
278600
278838
|
for (const [, d2] of this.daemons) {
|
|
278601
278839
|
const dotColor = d2.status === "running" ? "32" : (
|
|
@@ -278742,10 +278980,10 @@ function unlockFooterRedraws() {
|
|
|
278742
278980
|
_globalFooterLock = false;
|
|
278743
278981
|
}
|
|
278744
278982
|
function refreshThemeVars() {
|
|
278745
|
-
PANEL_BG_SEQ =
|
|
278746
|
-
CONTENT_BG_SEQ =
|
|
278983
|
+
PANEL_BG_SEQ = tuiBgSeq2();
|
|
278984
|
+
CONTENT_BG_SEQ = tuiBgSeq2();
|
|
278747
278985
|
BOX_FG = tuiBoxFg();
|
|
278748
|
-
TEXT_PRIMARY =
|
|
278986
|
+
TEXT_PRIMARY = tuiTextPrimary2() < 0 ? 252 : tuiTextPrimary2();
|
|
278749
278987
|
TEXT_DIM = tuiTextDim();
|
|
278750
278988
|
}
|
|
278751
278989
|
function setTerminalTitle(task, version4) {
|
|
@@ -278924,10 +279162,10 @@ var init_status_bar = __esm({
|
|
|
278924
279162
|
return this.toolCalls > 0;
|
|
278925
279163
|
}
|
|
278926
279164
|
};
|
|
278927
|
-
PANEL_BG_SEQ =
|
|
278928
|
-
CONTENT_BG_SEQ =
|
|
279165
|
+
PANEL_BG_SEQ = tuiBgSeq2();
|
|
279166
|
+
CONTENT_BG_SEQ = tuiBgSeq2();
|
|
278929
279167
|
BOX_FG = tuiBoxFg();
|
|
278930
|
-
TEXT_PRIMARY =
|
|
279168
|
+
TEXT_PRIMARY = tuiTextPrimary2() < 0 ? 252 : tuiTextPrimary2();
|
|
278931
279169
|
TEXT_DIM = tuiTextDim();
|
|
278932
279170
|
BOX_TL = "\u256D";
|
|
278933
279171
|
BOX_TR = "\u256E";
|
|
@@ -280792,8 +281030,8 @@ ${CONTENT_BG_SEQ}`);
|
|
|
280792
281030
|
buildMetricsLine() {
|
|
280793
281031
|
const m2 = this.metrics;
|
|
280794
281032
|
const termWidth = getTermWidth();
|
|
280795
|
-
const
|
|
280796
|
-
const pipe3 =
|
|
281033
|
+
const pastel2 = (code8, s2) => `${PANEL_BG_SEQ}\x1B[38;5;${code8}m${s2}\x1B[0m${PANEL_BG_SEQ}`;
|
|
281034
|
+
const pipe3 = pastel2(60, " \u2502 ");
|
|
280797
281035
|
const pipeW = 3;
|
|
280798
281036
|
const sections = [];
|
|
280799
281037
|
const compactOrder = [];
|
|
@@ -280807,8 +281045,8 @@ ${CONTENT_BG_SEQ}`);
|
|
|
280807
281045
|
const effectiveOut = this.effectiveCompletionTokens;
|
|
280808
281046
|
const tokOutRaw = effectiveOut > 0 ? effectiveOut : Math.ceil(m2.totalTokens > 0 ? m2.totalTokens - m2.promptTokens : m2.estimatedContextTokens * 0.3);
|
|
280809
281047
|
const tokOutVal = Math.max(0, tokOutRaw);
|
|
280810
|
-
const tokExpanded =
|
|
280811
|
-
const tokCompact =
|
|
281048
|
+
const tokExpanded = pastel2(117, "\u2191") + c3.bold(tokInRaw.toLocaleString()) + " " + pastel2(151, "\u2193") + c3.bold(tokOutVal.toLocaleString());
|
|
281049
|
+
const tokCompact = pastel2(117, "\u2191") + c3.bold(_StatusBar.compactNum(tokInRaw)) + " " + pastel2(151, "\u2193") + c3.bold(_StatusBar.compactNum(tokOutVal));
|
|
280812
281050
|
const tokExpW = 1 + tokInRaw.toLocaleString().length + 1 + 1 + tokOutVal.toLocaleString().length;
|
|
280813
281051
|
const tokCompW = 1 + _StatusBar.compactNum(tokInRaw).length + 1 + 1 + _StatusBar.compactNum(tokOutVal).length;
|
|
280814
281052
|
sections.push({ expanded: tokExpanded, compact: tokCompact, expandedW: tokExpW, compactW: tokCompW, empty: false });
|
|
@@ -280840,14 +281078,14 @@ ${CONTENT_BG_SEQ}`);
|
|
|
280840
281078
|
if (this._modelName) {
|
|
280841
281079
|
const paramMatch = this._modelName.match(/(\d+\.?\d*[bBmM])/);
|
|
280842
281080
|
const paramStr = paramMatch ? paramMatch[1] : this._modelName.split(":")[0]?.split("/").pop() ?? this._modelName;
|
|
280843
|
-
const modelExpanded =
|
|
280844
|
-
const modelCompact = (capParts.length > 0 ?
|
|
281081
|
+
const modelExpanded = pastel2(146, this._modelName) + (capsStr ? " " + pastel2(183, capParts.join(" ")) : "") + ctxSuffix;
|
|
281082
|
+
const modelCompact = (capParts.length > 0 ? pastel2(183, capParts.join(" ")) : pastel2(146, paramStr)) + ctxCompSuffix;
|
|
280845
281083
|
const expW = this._modelName.length + capsVisW + ctxSuffixW;
|
|
280846
281084
|
const compW = (capParts.length > 0 ? capParts.length * 2 + (capParts.length - 1) : paramStr.length) + ctxCompSuffixW;
|
|
280847
281085
|
modelSectionIdx = sections.length;
|
|
280848
281086
|
sections.push({ expanded: modelExpanded, compact: modelCompact, expandedW: expW, compactW: compW, empty: false });
|
|
280849
281087
|
} else if (capParts.length > 0) {
|
|
280850
|
-
const capsOnly =
|
|
281088
|
+
const capsOnly = pastel2(183, capParts.join(" ")) + ctxCompSuffix;
|
|
280851
281089
|
const capsOnlyW = capParts.length * 2 + (capParts.length - 1) + ctxCompSuffixW;
|
|
280852
281090
|
sections.push({ expanded: capsOnly, compact: capsOnly, expandedW: capsOnlyW, compactW: capsOnlyW, empty: false });
|
|
280853
281091
|
} else if (ctxTotal > 0) {
|
|
@@ -280859,13 +281097,13 @@ ${CONTENT_BG_SEQ}`);
|
|
|
280859
281097
|
const snrColor = snrPct >= 70 ? c3.green : snrPct >= 40 ? c3.yellow : c3.red;
|
|
280860
281098
|
const dPrimeStr = this._snr.dPrime.toFixed(1);
|
|
280861
281099
|
const capStr = this._snr.capacityWarning ? c3.red(" !CAP") : "";
|
|
280862
|
-
const snrExpanded =
|
|
281100
|
+
const snrExpanded = pastel2(183, "SNR ") + snrColor(c3.bold(`${snrPct}%`)) + c3.dim(` d'${dPrimeStr}`) + capStr;
|
|
280863
281101
|
const snrCompact = snrColor(`${snrPct}%`);
|
|
280864
281102
|
const expW = 4 + `${snrPct}%`.length + 3 + dPrimeStr.length + (this._snr.capacityWarning ? 5 : 0);
|
|
280865
281103
|
sections.push({ expanded: snrExpanded, compact: snrCompact, expandedW: expW, compactW: `${snrPct}%`.length, empty: false });
|
|
280866
281104
|
}
|
|
280867
281105
|
if (this._emotion) {
|
|
280868
|
-
const emotionExpanded = this._emotion.emoji + " " +
|
|
281106
|
+
const emotionExpanded = this._emotion.emoji + " " + pastel2(183, this._emotion.label);
|
|
280869
281107
|
const emotionCompact = this._emotion.emoji;
|
|
280870
281108
|
sections.push({
|
|
280871
281109
|
expanded: emotionExpanded,
|
|
@@ -280880,7 +281118,7 @@ ${CONTENT_BG_SEQ}`);
|
|
|
280880
281118
|
if (ratio > 0) {
|
|
280881
281119
|
const ratioStr = ratio >= 10 ? `${Math.round(ratio)}x` : `${ratio.toFixed(1)}x`;
|
|
280882
281120
|
const ratioColor = ratio >= 2 ? c3.green : ratio >= 1 ? c3.yellow : c3.red;
|
|
280883
|
-
const speedExpanded =
|
|
281121
|
+
const speedExpanded = pastel2(218, "Exp ") + ratioColor(c3.bold(ratioStr));
|
|
280884
281122
|
sections.push({
|
|
280885
281123
|
expanded: speedExpanded,
|
|
280886
281124
|
compact: speedExpanded,
|
|
@@ -280892,7 +281130,7 @@ ${CONTENT_BG_SEQ}`);
|
|
|
280892
281130
|
}
|
|
280893
281131
|
if (m2.hasPricing && m2.estimatedCost !== void 0) {
|
|
280894
281132
|
const costStr = m2.estimatedCost < 0.01 ? `$${m2.estimatedCost.toFixed(4)}` : m2.estimatedCost < 1 ? `$${m2.estimatedCost.toFixed(3)}` : `$${m2.estimatedCost.toFixed(2)}`;
|
|
280895
|
-
const costExpanded =
|
|
281133
|
+
const costExpanded = pastel2(222, "Cost ") + c3.bold(costStr);
|
|
280896
281134
|
const costCompact = c3.bold(costStr);
|
|
280897
281135
|
sections.push({
|
|
280898
281136
|
expanded: costExpanded,
|
|
@@ -280915,8 +281153,8 @@ ${CONTENT_BG_SEQ}`);
|
|
|
280915
281153
|
const visibleReqs = Array.from(this._expose.modelUsage.entries()).filter(([m3]) => !INTERNAL_CAPS.has(m3)).reduce((sum, [, n2]) => sum + n2, 0);
|
|
280916
281154
|
const reqStr = visibleReqs > 0 ? ` ${visibleReqs}req` : "";
|
|
280917
281155
|
const connStr = this._expose.activeConnections > 0 ? ` ${this._expose.activeConnections}conn` : "";
|
|
280918
|
-
const exposeExpanded = statusEmoji +
|
|
280919
|
-
const exposeCompact = statusEmoji + (modelStr ?
|
|
281156
|
+
const exposeExpanded = statusEmoji + pastel2(183, (modelStr ? " " + modelStr : "") + reqStr + connStr);
|
|
281157
|
+
const exposeCompact = statusEmoji + (modelStr ? pastel2(183, " " + modelStr) : "");
|
|
280920
281158
|
const expFullStr = (modelStr ? " " + modelStr : "") + reqStr + connStr;
|
|
280921
281159
|
const expCompStr = modelStr ? " " + modelStr : "";
|
|
280922
281160
|
sections.push({
|
|
@@ -280931,7 +281169,7 @@ ${CONTENT_BG_SEQ}`);
|
|
|
280931
281169
|
const um = this._unifiedMetrics ?? getInstantSnapshot();
|
|
280932
281170
|
const rm3 = um.hardware;
|
|
280933
281171
|
const isLocal = um.source === "local";
|
|
280934
|
-
const srcTag = isLocal ?
|
|
281172
|
+
const srcTag = isLocal ? pastel2(120, "L") : pastel2(117, "R");
|
|
280935
281173
|
const srcW = 1;
|
|
280936
281174
|
let hwExpStr = "";
|
|
280937
281175
|
let hwCompStr = "";
|
|
@@ -280979,7 +281217,7 @@ ${CONTENT_BG_SEQ}`);
|
|
|
280979
281217
|
const net5 = um.network;
|
|
280980
281218
|
const rxStr = formatRate(net5.rxBytesPerSec);
|
|
280981
281219
|
const txStr = formatRate(net5.txBytesPerSec);
|
|
280982
|
-
const netExpStr = ` ${
|
|
281220
|
+
const netExpStr = ` ${pastel2(116, "\u2193" + rxStr)} ${pastel2(218, "\u2191" + txStr)}`;
|
|
280983
281221
|
const netCompStr = netExpStr;
|
|
280984
281222
|
const netW = 1 + 1 + rxStr.length + 1 + 1 + txStr.length;
|
|
280985
281223
|
const sysExpanded = srcTag + " " + hwExpStr + netExpStr;
|
|
@@ -280993,15 +281231,15 @@ ${CONTENT_BG_SEQ}`);
|
|
|
280993
281231
|
});
|
|
280994
281232
|
}
|
|
280995
281233
|
if (this._recording) {
|
|
280996
|
-
const dot = this._recBlink ?
|
|
281234
|
+
const dot = this._recBlink ? pastel2(210, "\u25CF") : " ";
|
|
280997
281235
|
const countdown = this._countdown > 0 ? c3.dim(` ${this._countdown}s`) : "";
|
|
280998
|
-
const recStr = dot +
|
|
281236
|
+
const recStr = dot + pastel2(210, " REC") + countdown;
|
|
280999
281237
|
const recW = 1 + 4 + (this._countdown > 0 ? 1 + `${this._countdown}s`.length : 0);
|
|
281000
281238
|
sections.push({ expanded: recStr, compact: recStr, expandedW: recW, compactW: recW, empty: false });
|
|
281001
281239
|
}
|
|
281002
281240
|
if (this._version) {
|
|
281003
281241
|
versionSectionIdx = sections.length;
|
|
281004
|
-
const vStr =
|
|
281242
|
+
const vStr = pastel2(245, "v" + this._version);
|
|
281005
281243
|
const vW = 1 + this._version.length;
|
|
281006
281244
|
sections.push({ expanded: vStr, compact: vStr, expandedW: vW, compactW: vW, empty: false });
|
|
281007
281245
|
}
|
|
@@ -281769,7 +282007,7 @@ function tuiSelect(opts) {
|
|
|
281769
282007
|
}
|
|
281770
282008
|
stdin.resume();
|
|
281771
282009
|
enterOverlay();
|
|
281772
|
-
overlayWrite(`\x1B[?1049h${
|
|
282010
|
+
overlayWrite(`\x1B[?1049h${tuiBgSeq2()}\x1B[2J\x1B[H\x1B[?25l\x1B[?1003h\x1B[?1006h`);
|
|
281773
282011
|
let listRowOffset = 0;
|
|
281774
282012
|
let backBtnHovered = false;
|
|
281775
282013
|
function clampScroll(displayList) {
|
|
@@ -281790,11 +282028,11 @@ function tuiSelect(opts) {
|
|
|
281790
282028
|
if (!opts.maxVisible) {
|
|
281791
282029
|
maxVisible = Math.max(3, currentRows - selectChrome);
|
|
281792
282030
|
}
|
|
281793
|
-
overlayWrite(`${
|
|
282031
|
+
overlayWrite(`${tuiBgSeq2()}\x1B[H\x1B[2J`);
|
|
281794
282032
|
const lines = [];
|
|
281795
282033
|
const backLabel = hasBreadcrumbs ? "\u2190 back" : "\u2190 close";
|
|
281796
282034
|
const backHighlighted = backBtnHovered;
|
|
281797
|
-
const backStyle = backHighlighted ? `\x1B[7m\x1B[38;5;245m ${backLabel} \x1B[0m${
|
|
282035
|
+
const backStyle = backHighlighted ? `\x1B[7m\x1B[38;5;245m ${backLabel} \x1B[0m${tuiBgSeq2()}` : `${selectColors.dim(` ${backLabel} `)}`;
|
|
281798
282036
|
lines.push(backStyle);
|
|
281799
282037
|
if (hasBreadcrumbs) {
|
|
281800
282038
|
const trail = opts.breadcrumbs.map((b) => selectColors.dim(b)).join(selectColors.dim(" \u203A "));
|
|
@@ -281873,9 +282111,9 @@ function tuiSelect(opts) {
|
|
|
281873
282111
|
const escLabel = filter2 ? "clear filter" : hasBreadcrumbs ? "\u2190 back" : "cancel";
|
|
281874
282112
|
lines.push(` ${selectColors.dim("\u2191/\u2193 navigate Enter/Click select" + actionHint + deleteHint + customHint + " Esc " + escLabel + " Type to filter")}`);
|
|
281875
282113
|
}
|
|
281876
|
-
let output = lines.join("\n").replace(/\x1B\[0m/g, `\x1B[0m${
|
|
281877
|
-
${
|
|
281878
|
-
overlayWrite(
|
|
282114
|
+
let output = lines.join("\n").replace(/\x1B\[0m/g, `\x1B[0m${tuiBgSeq2()}`).replace(/\n/g, `\x1B[K
|
|
282115
|
+
${tuiBgSeq2()}`);
|
|
282116
|
+
overlayWrite(tuiBgSeq2() + output + "\x1B[K");
|
|
281879
282117
|
lastRenderedLines = lines.length;
|
|
281880
282118
|
}
|
|
281881
282119
|
function cleanup() {
|
|
@@ -285520,6 +285758,10 @@ async function startNeovimMode(opts) {
|
|
|
285520
285758
|
{
|
|
285521
285759
|
const btns = [
|
|
285522
285760
|
{ label: " \u2190 back ", action: "back" },
|
|
285761
|
+
{ label: " open ", action: "open" },
|
|
285762
|
+
{ label: " find ", action: "find" },
|
|
285763
|
+
{ label: " split ", action: "split" },
|
|
285764
|
+
{ label: " term ", action: "terminal" },
|
|
285523
285765
|
{ label: " undo ", action: "undo" },
|
|
285524
285766
|
{ label: " redo ", action: "redo" },
|
|
285525
285767
|
{ label: " save ", action: "save" }
|
|
@@ -285533,12 +285775,15 @@ async function startNeovimMode(opts) {
|
|
|
285533
285775
|
function renderToolbar() {
|
|
285534
285776
|
if (!isTTY5)
|
|
285535
285777
|
return;
|
|
285778
|
+
const L = layout();
|
|
285779
|
+
const hdrRow = L.headerContent;
|
|
285780
|
+
const fg2 = tuiTextPrimary() < 0 ? 252 : tuiTextPrimary();
|
|
285536
285781
|
let buf = "\x1B7";
|
|
285537
|
-
buf += `\x1B[
|
|
285782
|
+
buf += `\x1B[${hdrRow};1H${tuiBgSeq()}\x1B[2K`;
|
|
285538
285783
|
for (const btn of toolbarBtns) {
|
|
285539
|
-
buf += `\x1B[
|
|
285784
|
+
buf += `\x1B[${hdrRow};${btn.startCol}H`;
|
|
285540
285785
|
buf += `\x1B]8;;oa-cmd:${btn.action}\x07`;
|
|
285541
|
-
buf += `\x1B[38;5
|
|
285786
|
+
buf += `\x1B[38;5;${fg2}m${tuiBgSeq()}${btn.label}`;
|
|
285542
285787
|
buf += `\x1B]8;;\x07`;
|
|
285543
285788
|
}
|
|
285544
285789
|
buf += "\x1B[0m\x1B8";
|
|
@@ -285595,13 +285840,22 @@ async function startNeovimMode(opts) {
|
|
|
285595
285840
|
toggleFocus(state);
|
|
285596
285841
|
return;
|
|
285597
285842
|
}
|
|
285598
|
-
const
|
|
285843
|
+
const hdrRow = layout().headerContent;
|
|
285844
|
+
const toolbarClick = seq.match(new RegExp(`\\x1B\\[<0;(\\d+);${hdrRow}M`));
|
|
285599
285845
|
if (toolbarClick) {
|
|
285600
285846
|
const clickCol = parseInt(toolbarClick[1]);
|
|
285601
285847
|
for (const btn of toolbarBtns) {
|
|
285602
285848
|
if (clickCol >= btn.startCol && clickCol <= btn.endCol) {
|
|
285603
285849
|
if (btn.action === "back") {
|
|
285604
285850
|
doCleanup(state);
|
|
285851
|
+
} else if (btn.action === "open") {
|
|
285852
|
+
nvimPty.write("\x1B:Telescope find_files\r");
|
|
285853
|
+
} else if (btn.action === "find") {
|
|
285854
|
+
nvimPty.write("\x1B:Telescope live_grep\r");
|
|
285855
|
+
} else if (btn.action === "split") {
|
|
285856
|
+
nvimPty.write("\x1B:vs\r");
|
|
285857
|
+
} else if (btn.action === "terminal") {
|
|
285858
|
+
nvimPty.write("\x1B:belowright split | terminal\r");
|
|
285605
285859
|
} else if (btn.action === "undo") {
|
|
285606
285860
|
nvimPty.write("\x1B:undo\r");
|
|
285607
285861
|
} else if (btn.action === "redo") {
|
|
@@ -285613,23 +285867,22 @@ async function startNeovimMode(opts) {
|
|
|
285613
285867
|
}
|
|
285614
285868
|
}
|
|
285615
285869
|
}
|
|
285616
|
-
if (seq.match(
|
|
285870
|
+
if (seq.match(new RegExp(`\\x1B\\[<0;(\\d+);${layout().headerTop}M`)))
|
|
285617
285871
|
return;
|
|
285618
285872
|
if (state.focused) {
|
|
285619
285873
|
let normalized = seq.replace(/\x1BO([ABCD])/g, "\x1B[$1");
|
|
285620
|
-
|
|
285621
|
-
|
|
285622
|
-
|
|
285623
|
-
|
|
285624
|
-
|
|
285625
|
-
|
|
285626
|
-
|
|
285627
|
-
|
|
285628
|
-
|
|
285629
|
-
|
|
285630
|
-
|
|
285631
|
-
|
|
285632
|
-
}
|
|
285874
|
+
normalized = normalized.replace(/\x1B\[<(\d+);(\d+);(\d+)([Mm])/g, (_m, btn, col, row, suffix) => {
|
|
285875
|
+
const L = layout();
|
|
285876
|
+
const hostRow = parseInt(row);
|
|
285877
|
+
if (parseInt(btn) === 0 && suffix === "M" && hostRow > L.contentBottom) {
|
|
285878
|
+
toggleFocus(state);
|
|
285879
|
+
return "";
|
|
285880
|
+
}
|
|
285881
|
+
if (hostRow < L.contentTop)
|
|
285882
|
+
return "";
|
|
285883
|
+
const nvimRow = hostRow - (L.contentTop - 1);
|
|
285884
|
+
return `\x1B[<${btn};${col};${nvimRow}${suffix}`;
|
|
285885
|
+
});
|
|
285633
285886
|
if (normalized)
|
|
285634
285887
|
nvimPty.write(normalized);
|
|
285635
285888
|
}
|
|
@@ -289495,8 +289748,10 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
289495
289748
|
});
|
|
289496
289749
|
if (brewResult.stdout)
|
|
289497
289750
|
process.stdout.write(brewResult.stdout);
|
|
289498
|
-
if (brewResult.stderr)
|
|
289499
|
-
|
|
289751
|
+
if (brewResult.stderr) {
|
|
289752
|
+
const { renderVerbose: renderVerbose2 } = await Promise.resolve().then(() => (init_render(), render_exports));
|
|
289753
|
+
renderVerbose2(brewResult.stderr);
|
|
289754
|
+
}
|
|
289500
289755
|
const llvmPrefix = spawnSync2("brew", ["--prefix", "llvm"], { stdio: "pipe", timeout: 5e3 });
|
|
289501
289756
|
if (llvmPrefix.stdout) {
|
|
289502
289757
|
const prefix = llvmPrefix.stdout.toString().trim();
|
|
@@ -289531,8 +289786,10 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
289531
289786
|
], { stdio: "pipe", timeout: 12e4 });
|
|
289532
289787
|
if (aptResult.stdout)
|
|
289533
289788
|
process.stdout.write(aptResult.stdout);
|
|
289534
|
-
if (aptResult.stderr)
|
|
289535
|
-
|
|
289789
|
+
if (aptResult.stderr) {
|
|
289790
|
+
const { renderVerbose: renderVerbose2 } = await Promise.resolve().then(() => (init_render(), render_exports));
|
|
289791
|
+
renderVerbose2(aptResult.stderr);
|
|
289792
|
+
}
|
|
289536
289793
|
} else {
|
|
289537
289794
|
renderWarning(" sudo not available \u2014 skipping system build deps. librosa/lhotse may fail to compile.");
|
|
289538
289795
|
}
|
|
@@ -308514,24 +308771,24 @@ function gatherMemorySnippets(root) {
|
|
|
308514
308771
|
}
|
|
308515
308772
|
return snippets;
|
|
308516
308773
|
}
|
|
308517
|
-
function createDMNEventHandler(verbose,
|
|
308774
|
+
function createDMNEventHandler(verbose, writeContent2) {
|
|
308518
308775
|
return (event) => {
|
|
308519
308776
|
switch (event.type) {
|
|
308520
308777
|
case "tool_call":
|
|
308521
308778
|
if (verbose) {
|
|
308522
|
-
|
|
308779
|
+
writeContent2(() => {
|
|
308523
308780
|
const args = event.toolArgs ?? {};
|
|
308524
308781
|
renderToolCallStart(event.toolName ?? "unknown", args, true);
|
|
308525
308782
|
});
|
|
308526
308783
|
} else {
|
|
308527
308784
|
const argSummary = formatDMNToolArgs(event.toolName ?? "", event.toolArgs ?? {});
|
|
308528
|
-
|
|
308785
|
+
writeContent2(() => process.stdout.write(` ${c3.dim(`DMN \u2192 ${event.toolName}`)}${argSummary ? c3.dim(`: ${argSummary}`) : ""}
|
|
308529
308786
|
`));
|
|
308530
308787
|
}
|
|
308531
308788
|
break;
|
|
308532
308789
|
case "tool_result":
|
|
308533
308790
|
if (verbose) {
|
|
308534
|
-
|
|
308791
|
+
writeContent2(() => {
|
|
308535
308792
|
renderToolResult(event.toolName ?? "unknown", event.success ?? false, event.content ?? "", true);
|
|
308536
308793
|
});
|
|
308537
308794
|
}
|
|
@@ -308539,12 +308796,12 @@ function createDMNEventHandler(verbose, writeContent) {
|
|
|
308539
308796
|
case "model_response":
|
|
308540
308797
|
if (verbose && event.content) {
|
|
308541
308798
|
const preview = event.content.length > 200 ? event.content.slice(0, 200) + "..." : event.content;
|
|
308542
|
-
|
|
308799
|
+
writeContent2(() => renderVerbose(`DMN thinking: ${preview}`));
|
|
308543
308800
|
}
|
|
308544
308801
|
break;
|
|
308545
308802
|
case "token_usage":
|
|
308546
308803
|
if (verbose && event.tokenUsage) {
|
|
308547
|
-
|
|
308804
|
+
writeContent2(() => renderVerbose(`DMN tokens \u2014 prompt: ${event.tokenUsage.promptTokens} | completion: ${event.tokenUsage.completionTokens} | ctx: ~${event.tokenUsage.estimatedContextTokens.toLocaleString()}`));
|
|
308548
308805
|
}
|
|
308549
308806
|
break;
|
|
308550
308807
|
}
|
|
@@ -308805,22 +309062,19 @@ RULES:
|
|
|
308805
309062
|
}
|
|
308806
309063
|
backend = new CascadeBackend(config.model, [primaryEndpoint, ...fallbackEndpoints], {
|
|
308807
309064
|
onSwitch: (_from, to, reason) => {
|
|
308808
|
-
const msg = `
|
|
308809
|
-
[cascade] Failover \u2192 ${to.label ?? to.url}: ${reason}
|
|
308810
|
-
`;
|
|
309065
|
+
const msg = `[cascade] Failover \u2192 ${to.label ?? to.url}: ${reason}`;
|
|
308811
309066
|
if (isNeovimActive()) {
|
|
308812
|
-
writeToNeovimOutput(msg);
|
|
308813
|
-
} else if (!bufferIfOverlay("stderr", msg))
|
|
308814
|
-
|
|
309067
|
+
writeToNeovimOutput("\n" + msg + "\n");
|
|
309068
|
+
} else if (!bufferIfOverlay("stderr", msg + "\n"))
|
|
309069
|
+
writeContent(() => renderWarning(msg));
|
|
308815
309070
|
},
|
|
308816
309071
|
onProbeResult: (ep, success) => {
|
|
308817
309072
|
if (success) {
|
|
308818
|
-
const msg = `[cascade] Primary recovered: ${ep.label ?? ep.url}
|
|
308819
|
-
`;
|
|
309073
|
+
const msg = `[cascade] Primary recovered: ${ep.label ?? ep.url}`;
|
|
308820
309074
|
if (isNeovimActive()) {
|
|
308821
|
-
writeToNeovimOutput(msg);
|
|
308822
|
-
} else if (!bufferIfOverlay("stderr", msg))
|
|
308823
|
-
|
|
309075
|
+
writeToNeovimOutput(msg + "\n");
|
|
309076
|
+
} else if (!bufferIfOverlay("stderr", msg + "\n"))
|
|
309077
|
+
writeContent(() => renderInfo(msg));
|
|
308824
309078
|
}
|
|
308825
309079
|
}
|
|
308826
309080
|
});
|
|
@@ -309807,7 +310061,7 @@ async function startInteractive(config, repoPath) {
|
|
|
309807
310061
|
setTermSize(process.stdout.rows ?? 24, process.stdout.columns ?? 80);
|
|
309808
310062
|
process.stdout.write("\x1B[2J\x1B[3J\x1B]50;ClearScrollback\x07\x1B[H");
|
|
309809
310063
|
process.stdout.write("\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1015l\x1B[?1049h" + // enter alternate screen buffer
|
|
309810
|
-
|
|
310064
|
+
tuiBgSeq2() + // theme bg for content area
|
|
309811
310065
|
`\x1B[2J\x1B[3J\x1B[H\x1B[1;${termRows()}r\x1B[?25l`);
|
|
309812
310066
|
const restoreScreen = () => {
|
|
309813
310067
|
process.stdout.write("\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1015l\x1B[?25h\x1B[?1049l");
|
|
@@ -310162,7 +310416,7 @@ ${opts.systemPromptAddition}` : `Working directory: ${repoRoot}`;
|
|
|
310162
310416
|
const { getLastTaskSummary: getLastTaskSummary2 } = (init_oa_directory(), __toCommonJS(oa_directory_exports));
|
|
310163
310417
|
const taskSummary = hasTaskToResume ? getLastTaskSummary2(repoRoot) : null;
|
|
310164
310418
|
const resumeMsg = taskSummary ? `v${version4} \u2014 picking up: ${taskSummary}` : `Updated to v${version4}.`;
|
|
310165
|
-
|
|
310419
|
+
writeContent2(() => {
|
|
310166
310420
|
renderInfo(resumeMsg);
|
|
310167
310421
|
const resumePrompt = buildContextRestorePrompt(repoRoot);
|
|
310168
310422
|
if (resumePrompt) {
|
|
@@ -310323,12 +310577,12 @@ ${opts.systemPromptAddition}` : `Working directory: ${repoRoot}`;
|
|
|
310323
310577
|
voiceEngine.toggle().then((msg) => {
|
|
310324
310578
|
statusBar.setVoiceStatus(voiceEngine.enabled, voiceEngine.modelId || "");
|
|
310325
310579
|
if (statusBar?.isActive && !statusBar.isStreaming) {
|
|
310326
|
-
|
|
310580
|
+
writeContent2(() => renderInfo(msg));
|
|
310327
310581
|
}
|
|
310328
310582
|
}).catch((err) => {
|
|
310329
310583
|
const msg = err instanceof Error ? err.message : String(err);
|
|
310330
310584
|
if (statusBar?.isActive && !statusBar.isStreaming) {
|
|
310331
|
-
|
|
310585
|
+
writeContent2(() => renderWarning(`Voice: ${msg.slice(0, 80)}`));
|
|
310332
310586
|
}
|
|
310333
310587
|
});
|
|
310334
310588
|
}
|
|
@@ -310390,7 +310644,7 @@ ${opts.systemPromptAddition}` : `Working directory: ${repoRoot}`;
|
|
|
310390
310644
|
return;
|
|
310391
310645
|
const queued = await blessEngine.getNextTask();
|
|
310392
310646
|
if (queued) {
|
|
310393
|
-
|
|
310647
|
+
writeContent2(() => renderInfo(`Bless auto-cycle: processing ${queued.source} task...`));
|
|
310394
310648
|
let autoPrompt = queued.prompt;
|
|
310395
310649
|
if (queued.source === "telegram") {
|
|
310396
310650
|
activeTelegramChatId = queued.chatId ?? null;
|
|
@@ -310406,11 +310660,11 @@ Respond concisely and safely.`;
|
|
|
310406
310660
|
rl.emit("line", autoPrompt);
|
|
310407
310661
|
return;
|
|
310408
310662
|
}
|
|
310409
|
-
|
|
310663
|
+
writeContent2(() => renderInfo("DMN re-activating..."));
|
|
310410
310664
|
statusBar.setProcessing(true);
|
|
310411
310665
|
statusBar.setBrailleMetrics({ isDreaming: true });
|
|
310412
310666
|
try {
|
|
310413
|
-
const dmnHandler = createDMNEventHandler(currentConfig.verbose ?? false,
|
|
310667
|
+
const dmnHandler = createDMNEventHandler(currentConfig.verbose ?? false, writeContent2);
|
|
310414
310668
|
const proposal = await dmnEngine.runCycle(dmnHandler);
|
|
310415
310669
|
statusBar.setProcessing(false);
|
|
310416
310670
|
statusBar.setBrailleMetrics({ isDreaming: false });
|
|
@@ -310423,7 +310677,7 @@ Respond concisely and safely.`;
|
|
|
310423
310677
|
${proposal.task}
|
|
310424
310678
|
|
|
310425
310679
|
Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
310426
|
-
|
|
310680
|
+
writeContent2(() => renderInfo(`DMN auto-cycle: ${proposal.category} task (${Math.round(proposal.confidence * 100)}% confidence)`));
|
|
310427
310681
|
rl.emit("line", dmnPrompt);
|
|
310428
310682
|
} else {
|
|
310429
310683
|
scheduleDMNRetrigger(6e4);
|
|
@@ -310431,7 +310685,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310431
310685
|
} catch (err) {
|
|
310432
310686
|
statusBar.setProcessing(false);
|
|
310433
310687
|
statusBar.setBrailleMetrics({ isDreaming: false });
|
|
310434
|
-
|
|
310688
|
+
writeContent2(() => renderWarning(`DMN cycle error: ${err instanceof Error ? err.message : String(err)}`));
|
|
310435
310689
|
scheduleDMNRetrigger(6e4);
|
|
310436
310690
|
}
|
|
310437
310691
|
}, delayMs);
|
|
@@ -310452,7 +310706,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310452
310706
|
const RECALL_WINDOW_MS = 1500;
|
|
310453
310707
|
let sessionSudoPassword = null;
|
|
310454
310708
|
let sudoPromptPending = false;
|
|
310455
|
-
const panelBg =
|
|
310709
|
+
const panelBg = tuiBgSeq2();
|
|
310456
310710
|
const idlePrompt = `${panelBg}${c3.bold(c3.white("\u276F "))}${panelBg}`;
|
|
310457
310711
|
const activePrompt = `${panelBg}${c3.bold(c3.white("+ "))}${panelBg}`;
|
|
310458
310712
|
const pausedPrompt = `${panelBg}${c3.bold(c3.yellow("| "))}${panelBg}`;
|
|
@@ -310717,7 +310971,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310717
310971
|
rl.prompt();
|
|
310718
310972
|
}
|
|
310719
310973
|
}
|
|
310720
|
-
function
|
|
310974
|
+
function writeContent2(fn) {
|
|
310721
310975
|
if (!statusBar.isActive)
|
|
310722
310976
|
return;
|
|
310723
310977
|
if (isNeovimActive()) {
|
|
@@ -310763,7 +311017,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310763
311017
|
fn();
|
|
310764
311018
|
}
|
|
310765
311019
|
}
|
|
310766
|
-
setDreamWriteContent(
|
|
311020
|
+
setDreamWriteContent(writeContent2);
|
|
310767
311021
|
async function writeContentAsync(fn) {
|
|
310768
311022
|
if (!statusBar.isActive)
|
|
310769
311023
|
return fn();
|
|
@@ -310798,7 +311052,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310798
311052
|
try {
|
|
310799
311053
|
const available = await isModelAvailable(currentConfig);
|
|
310800
311054
|
if (!available && currentConfig.backendType === "ollama") {
|
|
310801
|
-
|
|
311055
|
+
writeContent2(() => {
|
|
310802
311056
|
renderWarning(`Model "${currentConfig.model}" not available. Use /model to pick one.`);
|
|
310803
311057
|
});
|
|
310804
311058
|
}
|
|
@@ -310812,12 +311066,12 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310812
311066
|
config = { ...config, model: expandResult.model };
|
|
310813
311067
|
currentConfig = { ...currentConfig, model: expandResult.model };
|
|
310814
311068
|
statusBar.setModelName(expandResult.model);
|
|
310815
|
-
|
|
311069
|
+
writeContent2(() => renderInfo(`Created expanded context model: ${expandResult.model} (${expandResult.contextLabel}, ${expandResult.numCtx} tokens)`));
|
|
310816
311070
|
} else if (expandResult.model !== currentConfig.model) {
|
|
310817
311071
|
config = { ...config, model: expandResult.model };
|
|
310818
311072
|
currentConfig = { ...currentConfig, model: expandResult.model };
|
|
310819
311073
|
statusBar.setModelName(expandResult.model);
|
|
310820
|
-
|
|
311074
|
+
writeContent2(() => renderInfo(`Using expanded context model: ${expandResult.model} (${expandResult.contextLabel})`));
|
|
310821
311075
|
}
|
|
310822
311076
|
} catch {
|
|
310823
311077
|
}
|
|
@@ -310835,7 +311089,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310835
311089
|
throw new Error(`HTTP ${resp.status}`);
|
|
310836
311090
|
} catch {
|
|
310837
311091
|
const prov = detectProvider(currentConfig.backendUrl);
|
|
310838
|
-
|
|
311092
|
+
writeContent2(() => {
|
|
310839
311093
|
renderWarning(`Cannot reach ${prov.label} at ${currentConfig.backendUrl}`);
|
|
310840
311094
|
if (prov.id === "ollama") {
|
|
310841
311095
|
renderInfo("Use /endpoint http://127.0.0.1:11434 to auto-install & start Ollama.");
|
|
@@ -310881,7 +311135,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310881
311135
|
const out = r2.output || String(r2);
|
|
310882
311136
|
if (out.includes("Connected") || out.includes("Already connected")) {
|
|
310883
311137
|
statusBar.setNexusStatus("connected");
|
|
310884
|
-
|
|
311138
|
+
writeContent2(() => renderInfo("Nexus P2P network connected."));
|
|
310885
311139
|
_registerNexusDaemon();
|
|
310886
311140
|
} else if (out.includes("failed") || out.includes("Error")) {
|
|
310887
311141
|
statusBar.setNexusStatus("disconnected");
|
|
@@ -310889,7 +311143,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310889
311143
|
await new Promise((r3) => setTimeout(r3, 5e3));
|
|
310890
311144
|
return _tryNexusConnect(attempt + 1);
|
|
310891
311145
|
}
|
|
310892
|
-
|
|
311146
|
+
writeContent2(() => renderWarning(`Nexus auto-connect failed: ${out.slice(0, 100)}`));
|
|
310893
311147
|
} else if (out.includes("still connecting") || out.includes("spawned")) {
|
|
310894
311148
|
for (let i2 = 0; i2 < 30; i2++) {
|
|
310895
311149
|
await new Promise((r3) => setTimeout(r3, 1e3));
|
|
@@ -310897,7 +311151,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310897
311151
|
const so = sr.output || String(sr);
|
|
310898
311152
|
if (/Connected:\s*true/i.test(so)) {
|
|
310899
311153
|
statusBar.setNexusStatus("connected");
|
|
310900
|
-
|
|
311154
|
+
writeContent2(() => renderInfo("Nexus P2P network connected."));
|
|
310901
311155
|
_registerNexusDaemon();
|
|
310902
311156
|
return;
|
|
310903
311157
|
}
|
|
@@ -310914,8 +311168,8 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310914
311168
|
try {
|
|
310915
311169
|
const oaDir = join83(repoRoot, ".oa");
|
|
310916
311170
|
const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
|
|
310917
|
-
onInfo: (msg) =>
|
|
310918
|
-
onError: (msg) =>
|
|
311171
|
+
onInfo: (msg) => writeContent2(() => renderInfo(msg)),
|
|
311172
|
+
onError: (msg) => writeContent2(() => renderWarning(msg))
|
|
310919
311173
|
});
|
|
310920
311174
|
if (reconnected) {
|
|
310921
311175
|
tunnelGateway = reconnected;
|
|
@@ -310928,7 +311182,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310928
311182
|
});
|
|
310929
311183
|
});
|
|
310930
311184
|
reconnected.on("token_flash", () => statusBar.flashExposeToken());
|
|
310931
|
-
|
|
311185
|
+
writeContent2(() => {
|
|
310932
311186
|
renderInfo(`Reconnected to existing expose tunnel: ${reconnected.tunnelUrl}`);
|
|
310933
311187
|
});
|
|
310934
311188
|
try {
|
|
@@ -310936,7 +311190,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310936
311190
|
const spCfg = loadSponsorConfig2(repoRoot);
|
|
310937
311191
|
if (spCfg && spCfg.status === "active" && "setSponsorLimits" in reconnected) {
|
|
310938
311192
|
reconnected.setSponsorLimits(spCfg.rateLimits);
|
|
310939
|
-
|
|
311193
|
+
writeContent2(() => renderInfo(`Sponsor rate limits restored: ${spCfg.rateLimits.maxRequestsPerMinute} req/min`));
|
|
310940
311194
|
}
|
|
310941
311195
|
} catch {
|
|
310942
311196
|
}
|
|
@@ -310946,8 +311200,8 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310946
311200
|
try {
|
|
310947
311201
|
const oaDir = join83(repoRoot, ".oa");
|
|
310948
311202
|
const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
|
|
310949
|
-
onInfo: (msg) =>
|
|
310950
|
-
onError: (msg) =>
|
|
311203
|
+
onInfo: (msg) => writeContent2(() => renderInfo(msg)),
|
|
311204
|
+
onError: (msg) => writeContent2(() => renderWarning(msg))
|
|
310951
311205
|
}, { backendUrl: currentConfig.backendUrl, apiKey: currentConfig.apiKey });
|
|
310952
311206
|
if (reconnectedP2P) {
|
|
310953
311207
|
p2pGateway = reconnectedP2P;
|
|
@@ -310960,7 +311214,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
310960
311214
|
});
|
|
310961
311215
|
});
|
|
310962
311216
|
reconnectedP2P.on("token_flash", () => statusBar.flashExposeToken());
|
|
310963
|
-
|
|
311217
|
+
writeContent2(() => {
|
|
310964
311218
|
renderInfo(`Reconnected to existing P2P expose: ${reconnectedP2P.peerId}`);
|
|
310965
311219
|
});
|
|
310966
311220
|
}
|
|
@@ -311071,7 +311325,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311071
311325
|
currentConfig.backendType = "openai";
|
|
311072
311326
|
setTimeout(() => {
|
|
311073
311327
|
if (statusBar.isActive) {
|
|
311074
|
-
|
|
311328
|
+
writeContent2(() => renderInfo(`Connected to sponsored endpoint: ${best.name}`));
|
|
311075
311329
|
}
|
|
311076
311330
|
}, 2e3);
|
|
311077
311331
|
}
|
|
@@ -311091,7 +311345,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311091
311345
|
if (await isDaemonRunning2(apiPort)) {
|
|
311092
311346
|
setTimeout(() => {
|
|
311093
311347
|
if (statusBar.isActive)
|
|
311094
|
-
|
|
311348
|
+
writeContent2(() => renderInfo(`REST API: http://localhost:${apiPort} (shared daemon)`));
|
|
311095
311349
|
}, 1500);
|
|
311096
311350
|
return;
|
|
311097
311351
|
}
|
|
@@ -311099,7 +311353,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311099
311353
|
if (daemonOk) {
|
|
311100
311354
|
setTimeout(() => {
|
|
311101
311355
|
if (statusBar.isActive)
|
|
311102
|
-
|
|
311356
|
+
writeContent2(() => renderInfo(`REST API: http://localhost:${apiPort} (daemon started)`));
|
|
311103
311357
|
}, 1500);
|
|
311104
311358
|
return;
|
|
311105
311359
|
}
|
|
@@ -311112,7 +311366,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311112
311366
|
apiServer.on?.("listening", () => {
|
|
311113
311367
|
setTimeout(() => {
|
|
311114
311368
|
if (statusBar.isActive)
|
|
311115
|
-
|
|
311369
|
+
writeContent2(() => renderInfo(`REST API: http://localhost:${apiPort} (inline \u2014 daemon unavailable)`));
|
|
311116
311370
|
}, 1500);
|
|
311117
311371
|
});
|
|
311118
311372
|
apiServer.on?.("error", () => {
|
|
@@ -311131,7 +311385,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311131
311385
|
if (process.stdout.isTTY) {
|
|
311132
311386
|
process.stdout.write("\x1B[?1000l\x1B[?1002l\x1B[?1006l");
|
|
311133
311387
|
}
|
|
311134
|
-
|
|
311388
|
+
writeContent2(() => {
|
|
311135
311389
|
process.stdout.write(`
|
|
311136
311390
|
\x1B[5;38;5;198m\u2B24 Enter Password:\x1B[0m \x1B[38;5;245mType below, Enter to submit. Ctrl+O to show/hide.\x1B[0m
|
|
311137
311391
|
|
|
@@ -311154,7 +311408,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311154
311408
|
async function handleAskUser(question, options2, allowMultiple) {
|
|
311155
311409
|
if (statusBar?.isActive)
|
|
311156
311410
|
statusBar.beginContentWrite();
|
|
311157
|
-
|
|
311411
|
+
writeContent2(() => {
|
|
311158
311412
|
process.stdout.write(`
|
|
311159
311413
|
${c3.bold(c3.cyan("?"))} ${c3.bold(question)}
|
|
311160
311414
|
`);
|
|
@@ -311442,7 +311696,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311442
311696
|
}
|
|
311443
311697
|
try {
|
|
311444
311698
|
if (!commandCtx.isExposeActive?.()) {
|
|
311445
|
-
|
|
311699
|
+
writeContent2(() => renderInfo("COHERE: exposing local inference to mesh..."));
|
|
311446
311700
|
await commandCtx.exposeStart?.("passthrough");
|
|
311447
311701
|
}
|
|
311448
311702
|
} catch {
|
|
@@ -311503,22 +311757,22 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311503
311757
|
},
|
|
311504
311758
|
dreamStart(mode) {
|
|
311505
311759
|
if (activeTask) {
|
|
311506
|
-
|
|
311760
|
+
writeContent2(() => renderWarning("Cannot dream while a task is running."));
|
|
311507
311761
|
return;
|
|
311508
311762
|
}
|
|
311509
311763
|
dreamEngine = new DreamEngine(currentConfig, repoRoot);
|
|
311510
|
-
|
|
311764
|
+
writeContent2(() => renderDreamStart(mode));
|
|
311511
311765
|
statusBar.setProcessing(true);
|
|
311512
311766
|
statusBar.setBrailleMetrics({ isDreaming: true });
|
|
311513
311767
|
dreamEngine.start(mode, (event) => {
|
|
311514
311768
|
const isVerbose = currentConfig.verbose ?? false;
|
|
311515
311769
|
if (event.type === "tool_call") {
|
|
311516
|
-
|
|
311770
|
+
writeContent2(() => renderToolCallStart(event.toolName ?? "unknown", event.toolArgs ?? {}, isVerbose));
|
|
311517
311771
|
} else if (event.type === "tool_result") {
|
|
311518
|
-
|
|
311772
|
+
writeContent2(() => renderToolResult(event.toolName ?? "unknown", event.success ?? false, event.content ?? "", isVerbose));
|
|
311519
311773
|
} else if (event.type === "model_response" && isVerbose && event.content) {
|
|
311520
311774
|
const preview = event.content.length > 300 ? event.content.slice(0, 300) + "..." : event.content;
|
|
311521
|
-
|
|
311775
|
+
writeContent2(() => renderVerbose(`Dream thinking: ${preview}`));
|
|
311522
311776
|
} else if (event.type === "token_usage" && event.tokenUsage) {
|
|
311523
311777
|
statusBar.updateMetrics({
|
|
311524
311778
|
...event.tokenUsage,
|
|
@@ -311529,13 +311783,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311529
311783
|
}).then((state) => {
|
|
311530
311784
|
statusBar.setProcessing(false);
|
|
311531
311785
|
statusBar.setBrailleMetrics({ isDreaming: false });
|
|
311532
|
-
|
|
311786
|
+
writeContent2(() => renderDreamEnd(state));
|
|
311533
311787
|
dreamEngine = null;
|
|
311534
311788
|
showPrompt();
|
|
311535
311789
|
}).catch((err) => {
|
|
311536
311790
|
statusBar.setProcessing(false);
|
|
311537
311791
|
statusBar.setBrailleMetrics({ isDreaming: false });
|
|
311538
|
-
|
|
311792
|
+
writeContent2(() => renderError(`Dream error: ${err instanceof Error ? err.message : String(err)}`));
|
|
311539
311793
|
dreamEngine = null;
|
|
311540
311794
|
showPrompt();
|
|
311541
311795
|
});
|
|
@@ -311554,26 +311808,26 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311554
311808
|
// Bless mode (infinite warm loop)
|
|
311555
311809
|
blessStart() {
|
|
311556
311810
|
if (activeTask) {
|
|
311557
|
-
|
|
311811
|
+
writeContent2(() => renderWarning("Cannot start bless mode while a task is running."));
|
|
311558
311812
|
return;
|
|
311559
311813
|
}
|
|
311560
311814
|
if (dreamEngine?.isActive) {
|
|
311561
|
-
|
|
311815
|
+
writeContent2(() => renderWarning("Cannot bless while dreaming. Stop dream first."));
|
|
311562
311816
|
return;
|
|
311563
311817
|
}
|
|
311564
311818
|
blessEngine = new BlessEngine(currentConfig, repoRoot);
|
|
311565
311819
|
blessEngine.start();
|
|
311566
311820
|
dmnEngine = new DMNEngine(currentConfig, repoRoot);
|
|
311567
|
-
dmnEngine.setWriteContent(
|
|
311568
|
-
setDreamWriteContent(
|
|
311569
|
-
|
|
311821
|
+
dmnEngine.setWriteContent(writeContent2);
|
|
311822
|
+
setDreamWriteContent(writeContent2);
|
|
311823
|
+
writeContent2(() => renderBlessStart());
|
|
311570
311824
|
showPrompt();
|
|
311571
311825
|
},
|
|
311572
311826
|
blessStop() {
|
|
311573
311827
|
if (blessEngine?.isActive) {
|
|
311574
311828
|
const stats = blessEngine.stats;
|
|
311575
311829
|
blessEngine.stop();
|
|
311576
|
-
|
|
311830
|
+
writeContent2(() => renderBlessStop(stats));
|
|
311577
311831
|
blessEngine = null;
|
|
311578
311832
|
dmnEngine = null;
|
|
311579
311833
|
}
|
|
@@ -311584,7 +311838,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
311584
311838
|
// Telegram bridge
|
|
311585
311839
|
async telegramStart(token, adminId) {
|
|
311586
311840
|
telegramBridge = new TelegramBridge(token, (msg) => {
|
|
311587
|
-
|
|
311841
|
+
writeContent2(() => renderTelegramMessage(msg.username, msg.text));
|
|
311588
311842
|
if (!activeTask) {
|
|
311589
311843
|
activeTelegramChatId = msg.chatId;
|
|
311590
311844
|
const safePrompt = `${TELEGRAM_SAFETY_PROMPT}
|
|
@@ -311600,20 +311854,20 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311600
311854
|
if (blessEngine) {
|
|
311601
311855
|
blessEngine.enqueueTask("telegram", msg.text, msg.chatId);
|
|
311602
311856
|
}
|
|
311603
|
-
|
|
311857
|
+
writeContent2(() => renderInfo(`Telegram message queued (task in progress).`));
|
|
311604
311858
|
showPrompt();
|
|
311605
311859
|
}
|
|
311606
311860
|
}, currentConfig, repoRoot);
|
|
311607
311861
|
if (adminId) {
|
|
311608
311862
|
telegramBridge.setAdmin(adminId);
|
|
311609
311863
|
}
|
|
311610
|
-
telegramBridge.setWriteContent(
|
|
311864
|
+
telegramBridge.setWriteContent(writeContent2);
|
|
311611
311865
|
telegramBridge.setOnSubAgentEvent((chatId, username, event) => {
|
|
311612
311866
|
if (event.type === "tool_call" && event.toolName) {
|
|
311613
311867
|
const argsPreview = event.toolArgs ? JSON.stringify(event.toolArgs).slice(0, 60) : "";
|
|
311614
|
-
|
|
311868
|
+
writeContent2(() => renderTelegramSubAgentToolCall(username, event.toolName, argsPreview));
|
|
311615
311869
|
} else if (event.type === "status" && event.content) {
|
|
311616
|
-
|
|
311870
|
+
writeContent2(() => renderTelegramSubAgentEvent(username, event.content));
|
|
311617
311871
|
}
|
|
311618
311872
|
});
|
|
311619
311873
|
if (adminId) {
|
|
@@ -311668,14 +311922,14 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311668
311922
|
}
|
|
311669
311923
|
});
|
|
311670
311924
|
await telegramBridge.start();
|
|
311671
|
-
|
|
311925
|
+
writeContent2(() => renderTelegramStart(telegramBridge.botUsername, adminId));
|
|
311672
311926
|
showPrompt();
|
|
311673
311927
|
},
|
|
311674
311928
|
telegramStop() {
|
|
311675
311929
|
if (telegramBridge?.isActive) {
|
|
311676
311930
|
const stats = telegramBridge.stats;
|
|
311677
311931
|
telegramBridge.stop();
|
|
311678
|
-
|
|
311932
|
+
writeContent2(() => renderTelegramStop(stats));
|
|
311679
311933
|
telegramBridge = null;
|
|
311680
311934
|
}
|
|
311681
311935
|
},
|
|
@@ -311709,7 +311963,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311709
311963
|
const active = telegramBridge?.isActive ?? false;
|
|
311710
311964
|
const botUser = active ? telegramBridge?.botUsername : void 0;
|
|
311711
311965
|
const subAgents = active ? telegramBridge?.stats.activeSubAgents : void 0;
|
|
311712
|
-
|
|
311966
|
+
writeContent2(() => renderTelegramStatus(active, botUser, savedSettings.telegramAdmin, subAgents));
|
|
311713
311967
|
},
|
|
311714
311968
|
// Listen mode (transcribe-cli integration + live voice session)
|
|
311715
311969
|
async listenToggle() {
|
|
@@ -311719,7 +311973,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311719
311973
|
statusBar.setRecording(false);
|
|
311720
311974
|
if (voiceSession?.isActive) {
|
|
311721
311975
|
const sessionMsg = await voiceSession.stop();
|
|
311722
|
-
|
|
311976
|
+
writeContent2(() => renderVoiceSessionStop(voiceSession?.runtime ?? 0));
|
|
311723
311977
|
voiceSession = null;
|
|
311724
311978
|
return sessionMsg;
|
|
311725
311979
|
}
|
|
@@ -311731,12 +311985,12 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311731
311985
|
}
|
|
311732
311986
|
engine.on("transcript", (text, isFinal) => {
|
|
311733
311987
|
if (engine.currentMode === "confirm") {
|
|
311734
|
-
|
|
311988
|
+
writeContent2(() => renderInfo(`Heard: "${text}" ${c3.dim("(press Enter to submit)")}`));
|
|
311735
311989
|
} else if (isFinal) {
|
|
311736
|
-
|
|
311990
|
+
writeContent2(() => renderInfo(`Auto-submitting: "${text}"`));
|
|
311737
311991
|
rl.feed(text + "\n");
|
|
311738
311992
|
} else {
|
|
311739
|
-
|
|
311993
|
+
writeContent2(() => renderInfo(`Hearing: "${text}"`));
|
|
311740
311994
|
}
|
|
311741
311995
|
});
|
|
311742
311996
|
engine.on("recording", (active) => {
|
|
@@ -311746,10 +312000,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311746
312000
|
statusBar.setCountdown(seconds);
|
|
311747
312001
|
});
|
|
311748
312002
|
engine.on("error", (err) => {
|
|
311749
|
-
|
|
312003
|
+
writeContent2(() => renderWarning(`Listen error: ${err.message}`));
|
|
311750
312004
|
});
|
|
311751
312005
|
engine.on("info", (msg2) => {
|
|
311752
|
-
|
|
312006
|
+
writeContent2(() => renderInfo(msg2));
|
|
311753
312007
|
});
|
|
311754
312008
|
const msg = await engine.start();
|
|
311755
312009
|
if (voiceEngine.enabled && voiceEngine.ready) {
|
|
@@ -311763,15 +312017,15 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311763
312017
|
}
|
|
311764
312018
|
};
|
|
311765
312019
|
voiceSession.on("userConnected", (id, username) => {
|
|
311766
|
-
|
|
312020
|
+
writeContent2(() => renderVoiceSessionUser("connected", username));
|
|
311767
312021
|
});
|
|
311768
312022
|
voiceSession.on("userDisconnected", (id) => {
|
|
311769
|
-
|
|
312023
|
+
writeContent2(() => renderVoiceSessionUser("disconnected", id));
|
|
311770
312024
|
});
|
|
311771
312025
|
const tunnelUrl = await voiceSession.start();
|
|
311772
|
-
|
|
312026
|
+
writeContent2(() => renderVoiceSessionStart(voiceSession.tunnelUrl));
|
|
311773
312027
|
} catch (err) {
|
|
311774
|
-
|
|
312028
|
+
writeContent2(() => renderWarning(`Voice session failed: ${err instanceof Error ? err.message : String(err)}`));
|
|
311775
312029
|
voiceSession = null;
|
|
311776
312030
|
}
|
|
311777
312031
|
}
|
|
@@ -311794,7 +312048,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311794
312048
|
if (voiceSession?.isActive) {
|
|
311795
312049
|
const runtime = voiceSession.runtime;
|
|
311796
312050
|
await voiceSession.stop();
|
|
311797
|
-
|
|
312051
|
+
writeContent2(() => renderVoiceSessionStop(runtime));
|
|
311798
312052
|
voiceSession = null;
|
|
311799
312053
|
}
|
|
311800
312054
|
return text ? `Stopped. Last transcript: "${text}"` : "Stopped listening.";
|
|
@@ -311807,10 +312061,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311807
312061
|
return voiceSession.tunnelUrl;
|
|
311808
312062
|
}
|
|
311809
312063
|
if (!voiceEngine.enabled || !voiceEngine.ready) {
|
|
311810
|
-
|
|
312064
|
+
writeContent2(() => renderInfo("Auto-enabling voice for call session..."));
|
|
311811
312065
|
const voiceMsg = await voiceEngine.toggle();
|
|
311812
312066
|
statusBar.setVoiceStatus(voiceEngine.enabled, voiceEngine.modelId || "");
|
|
311813
|
-
|
|
312067
|
+
writeContent2(() => renderInfo(voiceMsg));
|
|
311814
312068
|
}
|
|
311815
312069
|
if (!adminSessionKey) {
|
|
311816
312070
|
adminSessionKey = generateSessionKey();
|
|
@@ -311822,7 +312076,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311822
312076
|
const ppUrl = getPersonaPlexWSUrl2();
|
|
311823
312077
|
if (ppUrl) {
|
|
311824
312078
|
voiceSession.personaPlexWsUrl = ppUrl;
|
|
311825
|
-
|
|
312079
|
+
writeContent2(() => renderInfo(`PersonaPlex active \u2014 full-duplex mode at ${ppUrl}`));
|
|
311826
312080
|
}
|
|
311827
312081
|
}
|
|
311828
312082
|
} catch {
|
|
@@ -311838,9 +312092,9 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311838
312092
|
callState.sharedTranscriber.write(pcmChunk);
|
|
311839
312093
|
};
|
|
311840
312094
|
voiceSession.on("userConnected", (id, username, sessionKey) => {
|
|
311841
|
-
|
|
312095
|
+
writeContent2(() => renderVoiceSessionUser("connected", username));
|
|
311842
312096
|
const tier = sessionKey && sessionKey === adminSessionKey ? "admin" : "public";
|
|
311843
|
-
|
|
312097
|
+
writeContent2(() => renderInfo(`Call client ${id} connected as ${tier.toUpperCase()}`));
|
|
311844
312098
|
const emotionState = emotionEngine?.getState?.();
|
|
311845
312099
|
const subAgent = new CallSubAgent(id, {
|
|
311846
312100
|
config: currentConfig,
|
|
@@ -311851,7 +312105,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311851
312105
|
contextWindowSize: resolvedContextWindowSize > 0 ? resolvedContextWindowSize : void 0
|
|
311852
312106
|
});
|
|
311853
312107
|
subAgent.on("response", (text) => {
|
|
311854
|
-
|
|
312108
|
+
writeContent2(() => renderVoiceSessionTranscript("agent", text));
|
|
311855
312109
|
voiceSession?.sendTranscriptToClient(id, "agent", text);
|
|
311856
312110
|
if (voiceEngine.enabled && voiceEngine.ready) {
|
|
311857
312111
|
const session = voiceSession;
|
|
@@ -311868,12 +312122,12 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311868
312122
|
}
|
|
311869
312123
|
});
|
|
311870
312124
|
subAgent.on("error", (err) => {
|
|
311871
|
-
|
|
312125
|
+
writeContent2(() => renderWarning(`Call sub-agent error (${id}): ${err.message}`));
|
|
311872
312126
|
});
|
|
311873
312127
|
subAgent.init().then(() => {
|
|
311874
312128
|
callSubAgents.set(id, subAgent);
|
|
311875
312129
|
}).catch((err) => {
|
|
311876
|
-
|
|
312130
|
+
writeContent2(() => renderWarning(`Call sub-agent init failed (${id}): ${err instanceof Error ? err.message : String(err)}`));
|
|
311877
312131
|
});
|
|
311878
312132
|
if (!callState.sharedTranscriber && !callState.loading) {
|
|
311879
312133
|
callState.loading = true;
|
|
@@ -311885,7 +312139,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311885
312139
|
if (!evt.text?.trim() || !voiceSession?.isActive)
|
|
311886
312140
|
return;
|
|
311887
312141
|
const text = evt.text.trim();
|
|
311888
|
-
|
|
312142
|
+
writeContent2(() => renderVoiceSessionTranscript("user", text));
|
|
311889
312143
|
voiceSession?.sendTranscript("user", text);
|
|
311890
312144
|
if (evt.isFinal) {
|
|
311891
312145
|
for (const [clientId, agent] of callSubAgents) {
|
|
@@ -311896,14 +312150,14 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311896
312150
|
}
|
|
311897
312151
|
}
|
|
311898
312152
|
});
|
|
311899
|
-
|
|
312153
|
+
writeContent2(() => renderInfo("Call ASR ready \u2014 listening for speech"));
|
|
311900
312154
|
}).catch((err) => {
|
|
311901
|
-
|
|
312155
|
+
writeContent2(() => renderWarning(`Call ASR unavailable: ${err instanceof Error ? err.message : String(err)}`));
|
|
311902
312156
|
});
|
|
311903
312157
|
}
|
|
311904
312158
|
});
|
|
311905
312159
|
voiceSession.on("userDisconnected", (id) => {
|
|
311906
|
-
|
|
312160
|
+
writeContent2(() => renderVoiceSessionUser("disconnected", id));
|
|
311907
312161
|
const subAgent = callSubAgents.get(id);
|
|
311908
312162
|
if (subAgent) {
|
|
311909
312163
|
subAgent.dispose();
|
|
@@ -311912,13 +312166,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311912
312166
|
});
|
|
311913
312167
|
voiceSession.on("wsClose", (id, code8, reason) => {
|
|
311914
312168
|
if (code8 > 0)
|
|
311915
|
-
|
|
312169
|
+
writeContent2(() => renderInfo(`WS close: ${id} code=${code8} ${reason}`));
|
|
311916
312170
|
});
|
|
311917
312171
|
voiceSession.on("wsError", (id, err) => {
|
|
311918
|
-
|
|
312172
|
+
writeContent2(() => renderWarning(`WS error: ${id} ${err.message}`));
|
|
311919
312173
|
});
|
|
311920
312174
|
voiceSession.on("idle_timeout", () => {
|
|
311921
|
-
|
|
312175
|
+
writeContent2(() => renderWarning("Call session auto-closed (1 min idle \u2014 no users connected)"));
|
|
311922
312176
|
if (callState.sharedTranscriber) {
|
|
311923
312177
|
callState.sharedTranscriber.stop();
|
|
311924
312178
|
callState.sharedTranscriber = null;
|
|
@@ -311931,9 +312185,9 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311931
312185
|
try {
|
|
311932
312186
|
const tunnelUrl = await voiceSession.start();
|
|
311933
312187
|
const adminUrl = adminSessionKey ? `${tunnelUrl}?key=${adminSessionKey}` : tunnelUrl;
|
|
311934
|
-
|
|
311935
|
-
|
|
311936
|
-
|
|
312188
|
+
writeContent2(() => renderVoiceSessionStart(tunnelUrl));
|
|
312189
|
+
writeContent2(() => renderInfo(`Admin call URL (includes key): ${adminUrl}`));
|
|
312190
|
+
writeContent2(() => renderInfo(`Public call URL (read-only): ${tunnelUrl}`));
|
|
311937
312191
|
if (voiceEngine.enabled && voiceEngine.ready) {
|
|
311938
312192
|
const session = voiceSession;
|
|
311939
312193
|
voiceEngine.onPCMOutput = (pcm, sampleRate) => {
|
|
@@ -311947,7 +312201,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311947
312201
|
}
|
|
311948
312202
|
return tunnelUrl;
|
|
311949
312203
|
} catch (err) {
|
|
311950
|
-
|
|
312204
|
+
writeContent2(() => renderWarning(`Voice session failed: ${err instanceof Error ? err.message : String(err)}`));
|
|
311951
312205
|
if (callState.sharedTranscriber) {
|
|
311952
312206
|
callState.sharedTranscriber.stop();
|
|
311953
312207
|
callState.sharedTranscriber = null;
|
|
@@ -311963,7 +312217,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311963
312217
|
if (voiceSession?.isActive) {
|
|
311964
312218
|
const runtime = voiceSession.runtime;
|
|
311965
312219
|
await voiceSession.stop();
|
|
311966
|
-
|
|
312220
|
+
writeContent2(() => renderVoiceSessionStop(runtime));
|
|
311967
312221
|
voiceSession = null;
|
|
311968
312222
|
voiceEngine.onPCMOutput = null;
|
|
311969
312223
|
for (const agent of callSubAgents.values())
|
|
@@ -311999,7 +312253,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
311999
312253
|
}
|
|
312000
312254
|
const nexusTool = new NexusTool(repoRoot);
|
|
312001
312255
|
const exposeSpinnerMsg = passthrough ? `Connecting to nexus P2P network (passthrough \u2192 ${targetUrl})...` : "Connecting to nexus P2P network...";
|
|
312002
|
-
|
|
312256
|
+
writeContent2(() => {
|
|
312003
312257
|
renderInfo(exposeSpinnerMsg);
|
|
312004
312258
|
});
|
|
312005
312259
|
const newP2P = new ExposeP2PGateway({
|
|
@@ -312011,12 +312265,12 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312011
312265
|
loadbalance: loadbalance ?? false,
|
|
312012
312266
|
endpointAuth: passthrough ? currentConfig.apiKey : void 0,
|
|
312013
312267
|
onInfo: (msg) => {
|
|
312014
|
-
|
|
312268
|
+
writeContent2(() => {
|
|
312015
312269
|
renderInfo(msg);
|
|
312016
312270
|
});
|
|
312017
312271
|
},
|
|
312018
312272
|
onError: (msg) => {
|
|
312019
|
-
|
|
312273
|
+
writeContent2(() => {
|
|
312020
312274
|
renderWarning(msg);
|
|
312021
312275
|
});
|
|
312022
312276
|
}
|
|
@@ -312033,13 +312287,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312033
312287
|
try {
|
|
312034
312288
|
const peerId = await newP2P.start();
|
|
312035
312289
|
p2pGateway = newP2P;
|
|
312036
|
-
|
|
312290
|
+
writeContent2(() => {
|
|
312037
312291
|
process.stdout.write("\n" + newP2P.formatConnectionInfo() + "\n\n");
|
|
312038
312292
|
});
|
|
312039
312293
|
return peerId;
|
|
312040
312294
|
} catch (err) {
|
|
312041
312295
|
if (!transport) {
|
|
312042
|
-
|
|
312296
|
+
writeContent2(() => {
|
|
312043
312297
|
renderWarning(`libp2p expose failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
312044
312298
|
renderInfo("Falling back to cloudflared tunnel...");
|
|
312045
312299
|
});
|
|
@@ -312065,7 +312319,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312065
312319
|
try {
|
|
312066
312320
|
const url = await newTunnel.start();
|
|
312067
312321
|
tunnelGateway = newTunnel;
|
|
312068
|
-
|
|
312322
|
+
writeContent2(() => {
|
|
312069
312323
|
process.stdout.write("\n" + newTunnel.formatConnectionInfo() + "\n\n");
|
|
312070
312324
|
});
|
|
312071
312325
|
return url;
|
|
@@ -312275,7 +312529,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312275
312529
|
return false;
|
|
312276
312530
|
activeTask.runner.abort();
|
|
312277
312531
|
const bgKilled = taskManager.stopAll();
|
|
312278
|
-
|
|
312532
|
+
writeContent2(() => renderInfo(`Task aborted.${bgKilled > 0 ? ` ${bgKilled} background task(s) killed.` : ""}`));
|
|
312279
312533
|
return true;
|
|
312280
312534
|
},
|
|
312281
312535
|
pauseTask() {
|
|
@@ -312309,7 +312563,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312309
312563
|
"Continue where you left off."
|
|
312310
312564
|
].filter(Boolean).join("\n");
|
|
312311
312565
|
const shortPrompt = pendingTask.prompt.slice(0, 40) + (pendingTask.prompt.length > 40 ? "..." : "");
|
|
312312
|
-
|
|
312566
|
+
writeContent2(() => renderInfo(`Picking up: ${shortPrompt}`));
|
|
312313
312567
|
rl.emit("line", resumeContext);
|
|
312314
312568
|
}, 100);
|
|
312315
312569
|
return true;
|
|
@@ -312336,7 +312590,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312336
312590
|
destroyProject() {
|
|
312337
312591
|
const bgKilled = taskManager.stopAll();
|
|
312338
312592
|
if (bgKilled > 0) {
|
|
312339
|
-
|
|
312593
|
+
writeContent2(() => renderInfo(`Killed ${bgKilled} background task(s).`));
|
|
312340
312594
|
}
|
|
312341
312595
|
try {
|
|
312342
312596
|
const nexusDir = join83(repoRoot, OA_DIR, "nexus");
|
|
@@ -312356,7 +312610,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312356
312610
|
} catch {
|
|
312357
312611
|
}
|
|
312358
312612
|
}
|
|
312359
|
-
|
|
312613
|
+
writeContent2(() => renderInfo(`Killed nexus daemon (PID ${pid}).`));
|
|
312360
312614
|
} catch {
|
|
312361
312615
|
}
|
|
312362
312616
|
}
|
|
@@ -312409,7 +312663,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312409
312663
|
} catch {
|
|
312410
312664
|
}
|
|
312411
312665
|
} else {
|
|
312412
|
-
|
|
312666
|
+
writeContent2(() => renderWarning(`Could not fully remove ${OA_DIR}/: ${err instanceof Error ? err.message : String(err)}`));
|
|
312413
312667
|
if (process.platform === "win32") {
|
|
312414
312668
|
try {
|
|
312415
312669
|
execSync42(`rd /s /q "${oaPath}"`, { timeout: 1e4, stdio: "ignore" });
|
|
@@ -312421,10 +312675,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312421
312675
|
}
|
|
312422
312676
|
}
|
|
312423
312677
|
if (deleted) {
|
|
312424
|
-
|
|
312678
|
+
writeContent2(() => renderInfo(`Removed ${OA_DIR}/ directory.`));
|
|
312425
312679
|
}
|
|
312426
312680
|
} else {
|
|
312427
|
-
|
|
312681
|
+
writeContent2(() => renderInfo(`No ${OA_DIR}/ directory found.`));
|
|
312428
312682
|
}
|
|
312429
312683
|
if (isNeovimActive())
|
|
312430
312684
|
stopNeovimMode();
|
|
@@ -312511,7 +312765,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312511
312765
|
const timeAgo = lastTime ? formatTimeAgo(lastTime) : "unknown";
|
|
312512
312766
|
const lastTask = lastEntry.task?.slice(0, 80) || "unknown";
|
|
312513
312767
|
setTimeout(async () => {
|
|
312514
|
-
|
|
312768
|
+
writeContent2(() => {
|
|
312515
312769
|
renderInfo(`Previous session found (${savedCtx.entries.length} entries, last active ${timeAgo})`);
|
|
312516
312770
|
renderInfo(`Last task: ${lastTask}${lastEntry.task && lastEntry.task.length > 80 ? "..." : ""}`);
|
|
312517
312771
|
});
|
|
@@ -312548,12 +312802,12 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312548
312802
|
if (prompt) {
|
|
312549
312803
|
restoredSessionContext = prompt;
|
|
312550
312804
|
const info = loadSessionContext(repoRoot);
|
|
312551
|
-
|
|
312805
|
+
writeContent2(() => renderInfo(countdown <= 0 ? `Context auto-restored from ${info?.entries.length ?? 0} session(s).` : `Context restored from ${info?.entries.length ?? 0} session(s).`));
|
|
312552
312806
|
} else {
|
|
312553
|
-
|
|
312807
|
+
writeContent2(() => renderInfo("No context to restore. Starting fresh."));
|
|
312554
312808
|
}
|
|
312555
312809
|
} else {
|
|
312556
|
-
|
|
312810
|
+
writeContent2(() => renderInfo("Starting fresh."));
|
|
312557
312811
|
}
|
|
312558
312812
|
showPrompt();
|
|
312559
312813
|
}, 150);
|
|
@@ -312571,7 +312825,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312571
312825
|
const totalDue = dueReminders.length + activeAttention.length;
|
|
312572
312826
|
if (totalDue > 0) {
|
|
312573
312827
|
setTimeout(() => {
|
|
312574
|
-
|
|
312828
|
+
writeContent2(() => {
|
|
312575
312829
|
if (criticalReminders.length > 0 || criticalAttention.length > 0) {
|
|
312576
312830
|
renderWarning(`${criticalReminders.length + criticalAttention.length} urgent item(s) need attention`);
|
|
312577
312831
|
for (const r2 of criticalReminders)
|
|
@@ -312607,7 +312861,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312607
312861
|
"Continue where you left off."
|
|
312608
312862
|
].filter(Boolean).join("\n");
|
|
312609
312863
|
const shortPrompt = pendingTask.prompt.slice(0, 40) + (pendingTask.prompt.length > 40 ? "..." : "");
|
|
312610
|
-
|
|
312864
|
+
writeContent2(() => renderInfo(`Picking up: ${shortPrompt}`));
|
|
312611
312865
|
rl.emit("line", resumeContext);
|
|
312612
312866
|
}, 100);
|
|
312613
312867
|
}
|
|
@@ -312617,7 +312871,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
312617
312871
|
try {
|
|
312618
312872
|
await commandCtx.telegramStart(savedSettings.telegramKey, savedSettings.telegramAdmin);
|
|
312619
312873
|
} catch (err) {
|
|
312620
|
-
|
|
312874
|
+
writeContent2(() => renderWarning(`Telegram auto-start failed: ${err instanceof Error ? err.message : String(err)}`));
|
|
312621
312875
|
showPrompt();
|
|
312622
312876
|
}
|
|
312623
312877
|
}, 200);
|
|
@@ -312745,7 +312999,7 @@ ${result.content.slice(0, 2e3)}${result.content.length > 2e3 ? "\n[truncated]" :
|
|
|
312745
312999
|
line: rl.line ?? "",
|
|
312746
313000
|
cursor: rl.cursor ?? 0
|
|
312747
313001
|
}));
|
|
312748
|
-
|
|
313002
|
+
writeContent2(() => renderInfo("\u{1F511} Password received"));
|
|
312749
313003
|
showPrompt();
|
|
312750
313004
|
return;
|
|
312751
313005
|
}
|
|
@@ -312801,7 +313055,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
312801
313055
|
if (statusBar.isActive)
|
|
312802
313056
|
statusBar.setScrollRegionTop(bannerActive ? 5 : 1);
|
|
312803
313057
|
}
|
|
312804
|
-
|
|
313058
|
+
writeContent2(() => renderUserMessage(`/${cmdResult.name}${cmdResult.args ? " " + cmdResult.args : ""}`));
|
|
312805
313059
|
lastSubmittedPrompt = skillPrompt;
|
|
312806
313060
|
emotionEngine.setCurrentTask(`/${cmdResult.name}${cmdResult.args ? " " + cmdResult.args.slice(0, 80) : ""}`);
|
|
312807
313061
|
try {
|
|
@@ -312829,7 +313083,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
312829
313083
|
await task.promise;
|
|
312830
313084
|
} catch (err) {
|
|
312831
313085
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
312832
|
-
|
|
313086
|
+
writeContent2(() => renderError(errMsg));
|
|
312833
313087
|
}
|
|
312834
313088
|
statusBar.setProcessing(false);
|
|
312835
313089
|
activeTask = null;
|
|
@@ -312854,23 +313108,23 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
312854
313108
|
const ext = extname11(cleanPath).toLowerCase();
|
|
312855
313109
|
const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
|
|
312856
313110
|
activeTask.runner.injectImage(base642, mime, `User shared image: ${cleanPath}`);
|
|
312857
|
-
|
|
313111
|
+
writeContent2(() => renderUserInterrupt(`[Image: ${cleanPath}]`));
|
|
312858
313112
|
} catch {
|
|
312859
313113
|
activeTask.runner.injectUserMessage(input);
|
|
312860
|
-
|
|
313114
|
+
writeContent2(() => renderUserInterrupt(input));
|
|
312861
313115
|
}
|
|
312862
313116
|
} else if (isMedia) {
|
|
312863
|
-
|
|
313117
|
+
writeContent2(() => renderInfo(`Transcribing: ${cleanPath}...`));
|
|
312864
313118
|
const engine = getListenEngine();
|
|
312865
313119
|
const result = await engine.transcribeFile(resolve35(repoRoot, cleanPath), repoRoot);
|
|
312866
313120
|
if (result) {
|
|
312867
313121
|
const transcript = `[Transcription of ${cleanPath}]
|
|
312868
313122
|
${result.text}`;
|
|
312869
313123
|
activeTask.runner.injectUserMessage(transcript);
|
|
312870
|
-
|
|
313124
|
+
writeContent2(() => renderUserInterrupt(`[Audio: ${cleanPath}] (${result.text.split(" ").length} words)`));
|
|
312871
313125
|
} else {
|
|
312872
313126
|
activeTask.runner.injectUserMessage(`User dropped audio/video file: ${cleanPath}. Use transcribe_file tool to transcribe it.`);
|
|
312873
|
-
|
|
313127
|
+
writeContent2(() => renderUserInterrupt(`[Media: ${cleanPath}]`));
|
|
312874
313128
|
}
|
|
312875
313129
|
} else {
|
|
312876
313130
|
const isReplacement = lastSteeringRetracted;
|
|
@@ -312879,13 +313133,13 @@ ${result.text}`;
|
|
|
312879
313133
|
const lineCount = input.split("\n").length;
|
|
312880
313134
|
if (isReplacement) {
|
|
312881
313135
|
const displayText2 = lineCount > 1 ? `[pasted ${lineCount} lines]` : input;
|
|
312882
|
-
|
|
313136
|
+
writeContent2(() => process.stdout.write(`
|
|
312883
313137
|
${c3.green("\u21BB")} ${c3.bold("Context replaced:")} ${displayText2}
|
|
312884
313138
|
`));
|
|
312885
313139
|
} else if (lineCount > 1) {
|
|
312886
|
-
|
|
313140
|
+
writeContent2(() => renderUserInterrupt(`[pasted ${lineCount} lines]`));
|
|
312887
313141
|
} else {
|
|
312888
|
-
|
|
313142
|
+
writeContent2(() => renderUserInterrupt(input));
|
|
312889
313143
|
}
|
|
312890
313144
|
if (isNeovimActive() && !isNeovimFocused()) {
|
|
312891
313145
|
refocusNeovim();
|
|
@@ -312981,7 +313235,7 @@ ${result.text}`;
|
|
|
312981
313235
|
steering = raw;
|
|
312982
313236
|
}
|
|
312983
313237
|
if (voiceEngine?.enabled) {
|
|
312984
|
-
|
|
313238
|
+
writeContent2(() => renderVoiceText(acknowledgment));
|
|
312985
313239
|
voiceEngine.speak(acknowledgment);
|
|
312986
313240
|
}
|
|
312987
313241
|
steerRunner.injectUserMessage(steering);
|
|
@@ -313005,15 +313259,15 @@ ${result.text}`;
|
|
|
313005
313259
|
const cloneExts = [".wav", ".mp3", ".ogg", ".flac", ".m4a"];
|
|
313006
313260
|
const ext = cleanPath.toLowerCase().split(".").pop() || "";
|
|
313007
313261
|
if (cloneExts.includes("." + ext)) {
|
|
313008
|
-
|
|
313262
|
+
writeContent2(() => renderInfo(`Setting voice clone reference: ${cleanPath}`));
|
|
313009
313263
|
const msg = await voiceEngine.setCloneVoice(resolve35(repoRoot, cleanPath));
|
|
313010
|
-
|
|
313264
|
+
writeContent2(() => renderInfo(msg));
|
|
313011
313265
|
showPrompt();
|
|
313012
313266
|
return;
|
|
313013
313267
|
}
|
|
313014
313268
|
}
|
|
313015
313269
|
if (isMedia && fullInput === input) {
|
|
313016
|
-
|
|
313270
|
+
writeContent2(() => renderInfo(`Transcribing: ${cleanPath}...`));
|
|
313017
313271
|
const engine = getListenEngine();
|
|
313018
313272
|
const result = await engine.transcribeFile(resolve35(repoRoot, cleanPath), repoRoot);
|
|
313019
313273
|
if (result) {
|
|
@@ -313037,7 +313291,7 @@ Summarize or analyze this transcription as appropriate.`;
|
|
|
313037
313291
|
}
|
|
313038
313292
|
const inputLineCount = fullInput.split("\n").length;
|
|
313039
313293
|
const displayText = isImage ? `[Image: ${cleanPath}]` : inputLineCount > 1 ? `[pasted ${inputLineCount} lines]` : fullInput;
|
|
313040
|
-
|
|
313294
|
+
writeContent2(() => {
|
|
313041
313295
|
renderUserMessage(displayText);
|
|
313042
313296
|
const preview = fullInput.length > 160 ? fullInput.slice(0, 160) + "\u2026" : fullInput;
|
|
313043
313297
|
renderUserInterrupt(preview);
|
|
@@ -313103,7 +313357,7 @@ ${fullInput}`;
|
|
|
313103
313357
|
await task.promise;
|
|
313104
313358
|
} catch (err) {
|
|
313105
313359
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
313106
|
-
|
|
313360
|
+
writeContent2(() => renderError(errMsg));
|
|
313107
313361
|
if (failureStore) {
|
|
313108
313362
|
try {
|
|
313109
313363
|
const { createHash: createHash7 } = await import("node:crypto");
|
|
@@ -313153,7 +313407,7 @@ ${fullInput}`;
|
|
|
313153
313407
|
const { exec: exec5 } = await import("node:child_process");
|
|
313154
313408
|
exec5(`npm install -g open-agents-ai@latest --prefer-online`, { timeout: 18e4 }, (err) => {
|
|
313155
313409
|
if (!err) {
|
|
313156
|
-
|
|
313410
|
+
writeContent2(() => renderInfo(`Updated to v${updateInfo.latestVersion} in background. Takes effect next session.`));
|
|
313157
313411
|
}
|
|
313158
313412
|
});
|
|
313159
313413
|
}
|
|
@@ -313199,7 +313453,7 @@ ${emotion.emoji} ${emotion.label}`);
|
|
|
313199
313453
|
}
|
|
313200
313454
|
const nextTask = await blessEngine.getNextTask();
|
|
313201
313455
|
if (nextTask) {
|
|
313202
|
-
|
|
313456
|
+
writeContent2(() => renderInfo(`Bless auto-cycle: processing ${nextTask.source} task...`));
|
|
313203
313457
|
let autoPrompt = nextTask.prompt;
|
|
313204
313458
|
if (nextTask.source === "telegram") {
|
|
313205
313459
|
activeTelegramChatId = nextTask.chatId ?? null;
|
|
@@ -313216,11 +313470,11 @@ Respond concisely and safely.`;
|
|
|
313216
313470
|
return;
|
|
313217
313471
|
}
|
|
313218
313472
|
if (dmnEngine) {
|
|
313219
|
-
|
|
313473
|
+
writeContent2(() => renderInfo("No queued tasks \u2014 DMN self-reflection activating..."));
|
|
313220
313474
|
statusBar.setProcessing(true);
|
|
313221
313475
|
statusBar.setBrailleMetrics({ isDreaming: true });
|
|
313222
313476
|
try {
|
|
313223
|
-
const dmnHandler = createDMNEventHandler(currentConfig.verbose ?? false,
|
|
313477
|
+
const dmnHandler = createDMNEventHandler(currentConfig.verbose ?? false, writeContent2);
|
|
313224
313478
|
const proposal = await dmnEngine.runCycle(dmnHandler);
|
|
313225
313479
|
statusBar.setProcessing(false);
|
|
313226
313480
|
statusBar.setBrailleMetrics({ isDreaming: false });
|
|
@@ -313233,19 +313487,19 @@ Respond concisely and safely.`;
|
|
|
313233
313487
|
${proposal.task}
|
|
313234
313488
|
|
|
313235
313489
|
Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
313236
|
-
|
|
313490
|
+
writeContent2(() => renderInfo(`DMN auto-cycle: ${proposal.category} task (${Math.round(proposal.confidence * 100)}% confidence)`));
|
|
313237
313491
|
setTimeout(() => rl.emit("line", dmnPrompt), 500);
|
|
313238
313492
|
return;
|
|
313239
313493
|
}
|
|
313240
313494
|
if (blessEngine?.isActive) {
|
|
313241
313495
|
const cooldownSec = 30;
|
|
313242
|
-
|
|
313496
|
+
writeContent2(() => renderInfo(`DMN resting \u2014 will re-activate in ${cooldownSec}s`));
|
|
313243
313497
|
scheduleDMNRetrigger(cooldownSec * 1e3);
|
|
313244
313498
|
}
|
|
313245
313499
|
} catch (err) {
|
|
313246
313500
|
statusBar.setProcessing(false);
|
|
313247
313501
|
statusBar.setBrailleMetrics({ isDreaming: false });
|
|
313248
|
-
|
|
313502
|
+
writeContent2(() => renderWarning(`DMN cycle error: ${err instanceof Error ? err.message : String(err)}`));
|
|
313249
313503
|
if (blessEngine?.isActive) {
|
|
313250
313504
|
scheduleDMNRetrigger(6e4);
|
|
313251
313505
|
}
|
|
@@ -313276,7 +313530,7 @@ ${c3.dim("Goodbye!")}
|
|
|
313276
313530
|
clearTimeout(pasteTimer);
|
|
313277
313531
|
pasteTimer = null;
|
|
313278
313532
|
}
|
|
313279
|
-
|
|
313533
|
+
writeContent2(() => process.stdout.write(`
|
|
313280
313534
|
${c3.dim("(paste cancelled)")}
|
|
313281
313535
|
`));
|
|
313282
313536
|
showPrompt();
|
|
@@ -313285,9 +313539,9 @@ ${c3.dim("(paste cancelled)")}
|
|
|
313285
313539
|
if (activeTask) {
|
|
313286
313540
|
activeTask.runner.abort();
|
|
313287
313541
|
taskManager.stopAll();
|
|
313288
|
-
|
|
313542
|
+
writeContent2(() => renderTaskAborted());
|
|
313289
313543
|
} else {
|
|
313290
|
-
|
|
313544
|
+
writeContent2(() => process.stdout.write(`
|
|
313291
313545
|
${c3.dim("(Use /quit to exit)")}
|
|
313292
313546
|
`));
|
|
313293
313547
|
}
|
|
@@ -313323,7 +313577,7 @@ ${c3.dim("(Use /quit to exit)")}
|
|
|
313323
313577
|
if (!activeTask)
|
|
313324
313578
|
return;
|
|
313325
313579
|
if (activeTask.runner.isPaused) {
|
|
313326
|
-
|
|
313580
|
+
writeContent2(() => process.stdout.write(` ${c3.red("\u23F9")} ${c3.dim("Stopped.")}
|
|
313327
313581
|
`));
|
|
313328
313582
|
activeTask.runner.abort();
|
|
313329
313583
|
showPrompt();
|
|
@@ -313335,12 +313589,12 @@ ${c3.dim("(Use /quit to exit)")}
|
|
|
313335
313589
|
if (retracted) {
|
|
313336
313590
|
lastSteeringInput = retracted;
|
|
313337
313591
|
lastSteeringRetracted = true;
|
|
313338
|
-
|
|
313592
|
+
writeContent2(() => process.stdout.write(` ${c3.yellow("\u23F8")} ${c3.dim("\x1B[9m" + retracted.slice(0, 120) + "\x1B[29m")} ${c3.dim("\u2190 retracted, edit below and press Enter")}
|
|
313339
313593
|
`));
|
|
313340
313594
|
rl.line = retracted;
|
|
313341
313595
|
rl.cursor = retracted.length;
|
|
313342
313596
|
} else {
|
|
313343
|
-
|
|
313597
|
+
writeContent2(() => process.stdout.write(` ${c3.yellow("\u23F8")} ${c3.dim("Paused. Press Esc again to stop, or type and press Enter to steer.")}
|
|
313344
313598
|
`));
|
|
313345
313599
|
}
|
|
313346
313600
|
showPrompt();
|