open-agents-ai 0.122.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 +185 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44148,6 +44148,172 @@ var init_carousel = __esm({
|
|
|
44148
44148
|
}
|
|
44149
44149
|
});
|
|
44150
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
|
+
|
|
44151
44317
|
// packages/cli/dist/tui/carousel-descriptors.js
|
|
44152
44318
|
import { existsSync as existsSync37, readFileSync as readFileSync26, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, readdirSync as readdirSync11 } from "node:fs";
|
|
44153
44319
|
import { join as join51, basename as basename11 } from "node:path";
|
|
@@ -44503,25 +44669,25 @@ var init_carousel_descriptors = __esm({
|
|
|
44503
44669
|
|
|
44504
44670
|
// packages/cli/dist/tui/stream-renderer.js
|
|
44505
44671
|
function fg2563(code, text) {
|
|
44506
|
-
return
|
|
44672
|
+
return isTTY8 ? `\x1B[38;5;${code}m${text}\x1B[0m` : text;
|
|
44507
44673
|
}
|
|
44508
44674
|
function dimText(text) {
|
|
44509
|
-
return
|
|
44675
|
+
return isTTY8 ? `\x1B[2m${text}\x1B[0m` : text;
|
|
44510
44676
|
}
|
|
44511
44677
|
function italicText(text) {
|
|
44512
|
-
return
|
|
44678
|
+
return isTTY8 ? `\x1B[3m${text}\x1B[0m` : text;
|
|
44513
44679
|
}
|
|
44514
44680
|
function dimItalic(text) {
|
|
44515
|
-
return
|
|
44681
|
+
return isTTY8 ? `\x1B[2;3m${text}\x1B[0m` : text;
|
|
44516
44682
|
}
|
|
44517
44683
|
function boldText(text) {
|
|
44518
|
-
return
|
|
44684
|
+
return isTTY8 ? `\x1B[1m${text}\x1B[0m` : text;
|
|
44519
44685
|
}
|
|
44520
|
-
var
|
|
44686
|
+
var isTTY8, PASTEL, StreamRenderer;
|
|
44521
44687
|
var init_stream_renderer = __esm({
|
|
44522
44688
|
"packages/cli/dist/tui/stream-renderer.js"() {
|
|
44523
44689
|
"use strict";
|
|
44524
|
-
|
|
44690
|
+
isTTY8 = process.stdout.isTTY ?? false;
|
|
44525
44691
|
PASTEL = {
|
|
44526
44692
|
key: 222,
|
|
44527
44693
|
// light gold — JSON keys
|
|
@@ -52750,6 +52916,7 @@ async function startInteractive(config, repoPath) {
|
|
|
52750
52916
|
} catch {
|
|
52751
52917
|
}
|
|
52752
52918
|
const carousel = new Carousel(carouselPhrases ?? void 0);
|
|
52919
|
+
const banner = new BannerRenderer();
|
|
52753
52920
|
let carouselLines = 0;
|
|
52754
52921
|
const version = getVersion3();
|
|
52755
52922
|
if (isResumed) {
|
|
@@ -52760,7 +52927,9 @@ async function startInteractive(config, repoPath) {
|
|
|
52760
52927
|
renderInfo(resumeMsg);
|
|
52761
52928
|
} else {
|
|
52762
52929
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
52763
|
-
|
|
52930
|
+
banner.setDesign(createDefaultBanner(version));
|
|
52931
|
+
banner.start();
|
|
52932
|
+
carouselLines = 4;
|
|
52764
52933
|
renderRichHeader({
|
|
52765
52934
|
model: config.model,
|
|
52766
52935
|
version,
|
|
@@ -53613,6 +53782,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
53613
53782
|
cohereToggle() {
|
|
53614
53783
|
cohereEnabled = !cohereEnabled;
|
|
53615
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
|
+
}
|
|
53616
53792
|
return cohereEnabled;
|
|
53617
53793
|
},
|
|
53618
53794
|
isCohere() {
|
|
@@ -55351,6 +55527,7 @@ var init_interactive = __esm({
|
|
|
55351
55527
|
init_oa_directory();
|
|
55352
55528
|
init_render();
|
|
55353
55529
|
init_carousel();
|
|
55530
|
+
init_banner();
|
|
55354
55531
|
init_carousel_descriptors();
|
|
55355
55532
|
init_voice();
|
|
55356
55533
|
init_stream_renderer();
|
package/package.json
CHANGED