open-agents-ai 0.121.0 → 0.123.0
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 +205 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16332,6 +16332,26 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
16332
16332
|
await unlink(p).catch(() => {
|
|
16333
16333
|
});
|
|
16334
16334
|
}
|
|
16335
|
+
try {
|
|
16336
|
+
const { execSync: es } = __require("node:child_process");
|
|
16337
|
+
const psOut = es("ps aux 2>/dev/null", { encoding: "utf8", timeout: 5e3 }).trim();
|
|
16338
|
+
const nexusDirEscaped = this.nexusDir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
16339
|
+
for (const line of psOut.split("\n")) {
|
|
16340
|
+
if (line.includes("nexus-daemon") && line.includes(this.nexusDir)) {
|
|
16341
|
+
const pidMatch = line.match(/^\S+\s+(\d+)/);
|
|
16342
|
+
if (pidMatch) {
|
|
16343
|
+
const orphanPid = parseInt(pidMatch[1], 10);
|
|
16344
|
+
if (orphanPid !== process.pid) {
|
|
16345
|
+
try {
|
|
16346
|
+
process.kill(orphanPid, "SIGTERM");
|
|
16347
|
+
} catch {
|
|
16348
|
+
}
|
|
16349
|
+
}
|
|
16350
|
+
}
|
|
16351
|
+
}
|
|
16352
|
+
}
|
|
16353
|
+
} catch {
|
|
16354
|
+
}
|
|
16335
16355
|
const nodeModulesDir = resolve26(this.repoRoot, "node_modules");
|
|
16336
16356
|
let nexusResolved = false;
|
|
16337
16357
|
let installedVersion = "";
|
|
@@ -44128,6 +44148,172 @@ var init_carousel = __esm({
|
|
|
44128
44148
|
}
|
|
44129
44149
|
});
|
|
44130
44150
|
|
|
44151
|
+
// packages/cli/dist/tui/banner.js
|
|
44152
|
+
function createDefaultBanner(version = "0.120.0") {
|
|
44153
|
+
const width = process.stdout.columns ?? 80;
|
|
44154
|
+
const rows = 3;
|
|
44155
|
+
const grid = [];
|
|
44156
|
+
const gradient = " .\xB7:;+*#\u2588";
|
|
44157
|
+
for (let r = 0; r < rows; r++) {
|
|
44158
|
+
const row = [];
|
|
44159
|
+
for (let c3 = 0; c3 < width; c3++) {
|
|
44160
|
+
const progress = c3 / width;
|
|
44161
|
+
const charIdx = Math.min(gradient.length - 1, Math.floor(progress * gradient.length));
|
|
44162
|
+
const grayColor = 232 + Math.floor(progress * 10);
|
|
44163
|
+
row.push({ char: gradient[charIdx], fg: grayColor, bg: 0, bold: false });
|
|
44164
|
+
}
|
|
44165
|
+
grid.push(row);
|
|
44166
|
+
}
|
|
44167
|
+
const versionText = `OA-${version}`;
|
|
44168
|
+
const hintText = " /cohere to engage distributed mind experiment";
|
|
44169
|
+
const fullText = versionText + hintText;
|
|
44170
|
+
const startCol = Math.max(2, Math.floor((width - fullText.length) / 2));
|
|
44171
|
+
for (let i = 0; i < versionText.length && startCol + i < width; i++) {
|
|
44172
|
+
grid[1][startCol + i] = { char: versionText[i], fg: 255, bg: 0, bold: true };
|
|
44173
|
+
}
|
|
44174
|
+
for (let i = 0; i < hintText.length && startCol + versionText.length + i < width; i++) {
|
|
44175
|
+
grid[1][startCol + versionText.length + i] = { char: hintText[i], fg: 226, bg: 0, bold: false };
|
|
44176
|
+
}
|
|
44177
|
+
return {
|
|
44178
|
+
id: "default-header",
|
|
44179
|
+
name: "OA Default Header",
|
|
44180
|
+
type: "default",
|
|
44181
|
+
frames: [{ grid, durationMs: 0 }],
|
|
44182
|
+
alignment: ["left", "center", "left"],
|
|
44183
|
+
flowSpeed: [0, 0, 0],
|
|
44184
|
+
author: "system",
|
|
44185
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
44186
|
+
};
|
|
44187
|
+
}
|
|
44188
|
+
function createCohereBanner() {
|
|
44189
|
+
const width = process.stdout.columns ?? 80;
|
|
44190
|
+
const rows = 3;
|
|
44191
|
+
const grid = [];
|
|
44192
|
+
for (let r = 0; r < rows; r++) {
|
|
44193
|
+
const row = [];
|
|
44194
|
+
for (let c3 = 0; c3 < width; c3++) {
|
|
44195
|
+
row.push({ char: " ", fg: 226, bg: 0, bold: false });
|
|
44196
|
+
}
|
|
44197
|
+
grid.push(row);
|
|
44198
|
+
}
|
|
44199
|
+
const text = "COHERE \u2014 Participating in distributed cognitive commons";
|
|
44200
|
+
const startCol = Math.max(0, Math.floor((width - text.length) / 2));
|
|
44201
|
+
for (let i = 0; i < text.length && startCol + i < width; i++) {
|
|
44202
|
+
grid[1][startCol + i] = { char: text[i], fg: 226, bg: 0, bold: true };
|
|
44203
|
+
}
|
|
44204
|
+
return {
|
|
44205
|
+
id: "cohere-default",
|
|
44206
|
+
name: "COHERE Participation",
|
|
44207
|
+
type: "cohere",
|
|
44208
|
+
frames: [{ grid, durationMs: 0 }],
|
|
44209
|
+
alignment: ["left", "center", "left"],
|
|
44210
|
+
flowSpeed: [0, 0, 0],
|
|
44211
|
+
author: "system",
|
|
44212
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
44213
|
+
};
|
|
44214
|
+
}
|
|
44215
|
+
var isTTY7, BannerRenderer;
|
|
44216
|
+
var init_banner = __esm({
|
|
44217
|
+
"packages/cli/dist/tui/banner.js"() {
|
|
44218
|
+
"use strict";
|
|
44219
|
+
isTTY7 = process.stdout.isTTY ?? false;
|
|
44220
|
+
BannerRenderer = class {
|
|
44221
|
+
currentDesign = null;
|
|
44222
|
+
currentFrame = 0;
|
|
44223
|
+
timer = null;
|
|
44224
|
+
frameTick = 0;
|
|
44225
|
+
width;
|
|
44226
|
+
rows = 3;
|
|
44227
|
+
constructor() {
|
|
44228
|
+
this.width = process.stdout.columns ?? 80;
|
|
44229
|
+
}
|
|
44230
|
+
/** Set the active banner design */
|
|
44231
|
+
setDesign(design) {
|
|
44232
|
+
this.stop();
|
|
44233
|
+
this.currentDesign = design;
|
|
44234
|
+
this.currentFrame = 0;
|
|
44235
|
+
this.frameTick = 0;
|
|
44236
|
+
this.width = process.stdout.columns ?? 80;
|
|
44237
|
+
}
|
|
44238
|
+
/** Get current design */
|
|
44239
|
+
getDesign() {
|
|
44240
|
+
return this.currentDesign;
|
|
44241
|
+
}
|
|
44242
|
+
/** Start rendering the banner */
|
|
44243
|
+
start() {
|
|
44244
|
+
if (!isTTY7 || !this.currentDesign)
|
|
44245
|
+
return;
|
|
44246
|
+
this.renderCurrentFrame();
|
|
44247
|
+
if (this.currentDesign.frames.length > 1) {
|
|
44248
|
+
this.timer = setInterval(() => {
|
|
44249
|
+
this.frameTick++;
|
|
44250
|
+
const frame = this.currentDesign.frames[this.currentFrame];
|
|
44251
|
+
if (frame.durationMs > 0 && this.frameTick * 66 >= frame.durationMs) {
|
|
44252
|
+
this.currentFrame = (this.currentFrame + 1) % this.currentDesign.frames.length;
|
|
44253
|
+
this.frameTick = 0;
|
|
44254
|
+
this.renderCurrentFrame();
|
|
44255
|
+
}
|
|
44256
|
+
}, 66);
|
|
44257
|
+
}
|
|
44258
|
+
}
|
|
44259
|
+
/** Stop rendering */
|
|
44260
|
+
stop() {
|
|
44261
|
+
if (this.timer) {
|
|
44262
|
+
clearInterval(this.timer);
|
|
44263
|
+
this.timer = null;
|
|
44264
|
+
}
|
|
44265
|
+
}
|
|
44266
|
+
/** Render the current frame into the top 3 rows */
|
|
44267
|
+
renderCurrentFrame() {
|
|
44268
|
+
if (!isTTY7 || !this.currentDesign)
|
|
44269
|
+
return;
|
|
44270
|
+
const frame = this.currentDesign.frames[this.currentFrame];
|
|
44271
|
+
if (!frame)
|
|
44272
|
+
return;
|
|
44273
|
+
this.width = process.stdout.columns ?? 80;
|
|
44274
|
+
let buf = "\x1B7";
|
|
44275
|
+
for (let r = 0; r < this.rows; r++) {
|
|
44276
|
+
buf += `\x1B[${r + 1};1H\x1B[2K`;
|
|
44277
|
+
const row = frame.grid[r];
|
|
44278
|
+
if (!row)
|
|
44279
|
+
continue;
|
|
44280
|
+
let prevFg = -1, prevBg = -1, prevBold = false;
|
|
44281
|
+
for (let c3 = 0; c3 < Math.min(this.width, row.length); c3++) {
|
|
44282
|
+
const cell = row[c3];
|
|
44283
|
+
let seq = "";
|
|
44284
|
+
if (cell.fg !== prevFg || cell.bg !== prevBg || cell.bold !== prevBold) {
|
|
44285
|
+
seq += "\x1B[0m";
|
|
44286
|
+
if (cell.bold)
|
|
44287
|
+
seq += "\x1B[1m";
|
|
44288
|
+
if (cell.fg >= 0)
|
|
44289
|
+
seq += `\x1B[38;5;${cell.fg}m`;
|
|
44290
|
+
if (cell.bg >= 0)
|
|
44291
|
+
seq += `\x1B[48;5;${cell.bg}m`;
|
|
44292
|
+
prevFg = cell.fg;
|
|
44293
|
+
prevBg = cell.bg;
|
|
44294
|
+
prevBold = cell.bold;
|
|
44295
|
+
}
|
|
44296
|
+
buf += seq + cell.char;
|
|
44297
|
+
}
|
|
44298
|
+
buf += "\x1B[0m";
|
|
44299
|
+
}
|
|
44300
|
+
buf += "\x1B8";
|
|
44301
|
+
process.stdout.write(buf);
|
|
44302
|
+
}
|
|
44303
|
+
/** Handle terminal resize */
|
|
44304
|
+
handleResize() {
|
|
44305
|
+
this.width = process.stdout.columns ?? 80;
|
|
44306
|
+
if (this.currentDesign) {
|
|
44307
|
+
if (this.currentDesign.type === "cohere") {
|
|
44308
|
+
this.currentDesign = createCohereBanner();
|
|
44309
|
+
}
|
|
44310
|
+
this.renderCurrentFrame();
|
|
44311
|
+
}
|
|
44312
|
+
}
|
|
44313
|
+
};
|
|
44314
|
+
}
|
|
44315
|
+
});
|
|
44316
|
+
|
|
44131
44317
|
// packages/cli/dist/tui/carousel-descriptors.js
|
|
44132
44318
|
import { existsSync as existsSync37, readFileSync as readFileSync26, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, readdirSync as readdirSync11 } from "node:fs";
|
|
44133
44319
|
import { join as join51, basename as basename11 } from "node:path";
|
|
@@ -44483,25 +44669,25 @@ var init_carousel_descriptors = __esm({
|
|
|
44483
44669
|
|
|
44484
44670
|
// packages/cli/dist/tui/stream-renderer.js
|
|
44485
44671
|
function fg2563(code, text) {
|
|
44486
|
-
return
|
|
44672
|
+
return isTTY8 ? `\x1B[38;5;${code}m${text}\x1B[0m` : text;
|
|
44487
44673
|
}
|
|
44488
44674
|
function dimText(text) {
|
|
44489
|
-
return
|
|
44675
|
+
return isTTY8 ? `\x1B[2m${text}\x1B[0m` : text;
|
|
44490
44676
|
}
|
|
44491
44677
|
function italicText(text) {
|
|
44492
|
-
return
|
|
44678
|
+
return isTTY8 ? `\x1B[3m${text}\x1B[0m` : text;
|
|
44493
44679
|
}
|
|
44494
44680
|
function dimItalic(text) {
|
|
44495
|
-
return
|
|
44681
|
+
return isTTY8 ? `\x1B[2;3m${text}\x1B[0m` : text;
|
|
44496
44682
|
}
|
|
44497
44683
|
function boldText(text) {
|
|
44498
|
-
return
|
|
44684
|
+
return isTTY8 ? `\x1B[1m${text}\x1B[0m` : text;
|
|
44499
44685
|
}
|
|
44500
|
-
var
|
|
44686
|
+
var isTTY8, PASTEL, StreamRenderer;
|
|
44501
44687
|
var init_stream_renderer = __esm({
|
|
44502
44688
|
"packages/cli/dist/tui/stream-renderer.js"() {
|
|
44503
44689
|
"use strict";
|
|
44504
|
-
|
|
44690
|
+
isTTY8 = process.stdout.isTTY ?? false;
|
|
44505
44691
|
PASTEL = {
|
|
44506
44692
|
key: 222,
|
|
44507
44693
|
// light gold — JSON keys
|
|
@@ -52730,6 +52916,7 @@ async function startInteractive(config, repoPath) {
|
|
|
52730
52916
|
} catch {
|
|
52731
52917
|
}
|
|
52732
52918
|
const carousel = new Carousel(carouselPhrases ?? void 0);
|
|
52919
|
+
const banner = new BannerRenderer();
|
|
52733
52920
|
let carouselLines = 0;
|
|
52734
52921
|
const version = getVersion3();
|
|
52735
52922
|
if (isResumed) {
|
|
@@ -52740,7 +52927,9 @@ async function startInteractive(config, repoPath) {
|
|
|
52740
52927
|
renderInfo(resumeMsg);
|
|
52741
52928
|
} else {
|
|
52742
52929
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
52743
|
-
|
|
52930
|
+
banner.setDesign(createDefaultBanner(version));
|
|
52931
|
+
banner.start();
|
|
52932
|
+
carouselLines = 4;
|
|
52744
52933
|
renderRichHeader({
|
|
52745
52934
|
model: config.model,
|
|
52746
52935
|
version,
|
|
@@ -53593,6 +53782,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
53593
53782
|
cohereToggle() {
|
|
53594
53783
|
cohereEnabled = !cohereEnabled;
|
|
53595
53784
|
statusBar.setCohereActive(cohereEnabled);
|
|
53785
|
+
if (cohereEnabled) {
|
|
53786
|
+
banner.setDesign(createCohereBanner());
|
|
53787
|
+
banner.start();
|
|
53788
|
+
} else {
|
|
53789
|
+
banner.setDesign(createDefaultBanner(version));
|
|
53790
|
+
banner.start();
|
|
53791
|
+
}
|
|
53596
53792
|
return cohereEnabled;
|
|
53597
53793
|
},
|
|
53598
53794
|
isCohere() {
|
|
@@ -55331,6 +55527,7 @@ var init_interactive = __esm({
|
|
|
55331
55527
|
init_oa_directory();
|
|
55332
55528
|
init_render();
|
|
55333
55529
|
init_carousel();
|
|
55530
|
+
init_banner();
|
|
55334
55531
|
init_carousel_descriptors();
|
|
55335
55532
|
init_voice();
|
|
55336
55533
|
init_stream_renderer();
|
package/package.json
CHANGED