open-agents-ai 0.141.6 → 0.142.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.
Files changed (2) hide show
  1. package/dist/index.js +221 -77
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -43351,83 +43351,7 @@ async function handleSlashCommand(input, ctx) {
43351
43351
  return "handled";
43352
43352
  }
43353
43353
  case "cohere": {
43354
- const cohereSubCmd = (arg || "").trim().split(/\s+/);
43355
- const cohereAction = cohereSubCmd[0]?.toLowerCase() || "";
43356
- if (cohereAction === "stats") {
43357
- try {
43358
- const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
43359
- const nexusTool = new NexusTool2(ctx.repoRoot || process.cwd());
43360
- try {
43361
- const st = await nexusTool.execute({ action: "status" });
43362
- if (!st.success || !st.output.includes("connected")) {
43363
- renderInfo("Connecting to nexus daemon...");
43364
- await nexusTool.execute({ action: "connect" });
43365
- await new Promise((r) => setTimeout(r, 1e3));
43366
- }
43367
- } catch {
43368
- }
43369
- const result = await nexusTool.execute({ action: "cohere_stats" });
43370
- if (result.success) {
43371
- renderInfo(result.output);
43372
- } else {
43373
- renderWarning("Stats unavailable: " + (result.error || "daemon not running"));
43374
- }
43375
- } catch {
43376
- renderWarning("COHERE stats unavailable \u2014 daemon not running. Use /expose first.");
43377
- }
43378
- return "handled";
43379
- }
43380
- if (cohereAction === "models") {
43381
- try {
43382
- const { NexusTool: NexusTool2 } = __require("../../execution/dist/tools/nexus.js");
43383
- const nexusTool = new NexusTool2(ctx.repoRoot || process.cwd());
43384
- const result = await nexusTool.execute({ action: "cohere_list_models" });
43385
- if (result.success) {
43386
- renderInfo(result.output);
43387
- } else {
43388
- renderWarning("Model list unavailable: " + (result.error || "daemon not running"));
43389
- }
43390
- } catch {
43391
- renderWarning("COHERE models unavailable \u2014 daemon not running. Use /expose first.");
43392
- }
43393
- return "handled";
43394
- }
43395
- if (cohereAction === "allow" && cohereSubCmd[1]) {
43396
- try {
43397
- const { NexusTool: NexusTool2 } = __require("../../execution/dist/tools/nexus.js");
43398
- const nexusTool = new NexusTool2(ctx.repoRoot || process.cwd());
43399
- const result = await nexusTool.execute({ action: "cohere_allow_model", model: cohereSubCmd[1] });
43400
- renderInfo(result.success ? result.output : result.error || "Failed");
43401
- } catch {
43402
- renderWarning("Daemon not running.");
43403
- }
43404
- return "handled";
43405
- }
43406
- if (cohereAction === "deny" && cohereSubCmd[1]) {
43407
- try {
43408
- const { NexusTool: NexusTool2 } = __require("../../execution/dist/tools/nexus.js");
43409
- const nexusTool = new NexusTool2(ctx.repoRoot || process.cwd());
43410
- const result = await nexusTool.execute({ action: "cohere_deny_model", model: cohereSubCmd[1] });
43411
- renderInfo(result.success ? result.output : result.error || "Failed");
43412
- } catch {
43413
- renderWarning("Daemon not running.");
43414
- }
43415
- return "handled";
43416
- }
43417
- if (ctx.cohereToggle) {
43418
- const active = ctx.cohereToggle();
43419
- if (active) {
43420
- renderInfo("COHERE enabled \u2014 joining distributed cognitive commons");
43421
- renderInfo(`Forwarding inference: ${ctx.config.backendUrl} (${ctx.config.model})`);
43422
- renderInfo("Auto-connecting to nexus mesh + exposing local inference...");
43423
- renderInfo("Use /cohere stats for network info, /cohere again to disconnect");
43424
- } else {
43425
- renderInfo("COHERE disabled \u2014 disconnected from cognitive commons");
43426
- renderInfo("Local inference no longer forwarded to mesh");
43427
- }
43428
- } else {
43429
- renderWarning("COHERE not available \u2014 requires nexus connection (/expose or /p2p)");
43430
- }
43354
+ await showCohereDashboard(ctx);
43431
43355
  return "handled";
43432
43356
  }
43433
43357
  case "listen":
@@ -44303,6 +44227,226 @@ async function handleExposeConfig(ctx) {
44303
44227
  }
44304
44228
  }
44305
44229
  }
44230
+ async function showCohereDashboard(ctx) {
44231
+ const isActive = ctx.isCohere?.() ?? false;
44232
+ let stats = { queriesAnswered: 0, queriesSent: 0, insightsShared: 0, peersConnected: 0 };
44233
+ let modelList = [];
44234
+ try {
44235
+ const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
44236
+ const nexus = new NexusTool2(ctx.repoRoot);
44237
+ try {
44238
+ const st = await nexus.execute({ action: "status" });
44239
+ if (!st.success || !st.output.includes("connected")) {
44240
+ await nexus.execute({ action: "connect" });
44241
+ await new Promise((r) => setTimeout(r, 1500));
44242
+ }
44243
+ } catch {
44244
+ }
44245
+ try {
44246
+ const r = await nexus.execute({ action: "cohere_stats" });
44247
+ if (r.success) {
44248
+ try {
44249
+ const d = JSON.parse(r.output);
44250
+ Object.assign(stats, d);
44251
+ } catch {
44252
+ }
44253
+ }
44254
+ } catch {
44255
+ }
44256
+ try {
44257
+ const r = await nexus.execute({ action: "cohere_list_models" });
44258
+ if (r.success) {
44259
+ try {
44260
+ modelList = JSON.parse(r.output).models || [];
44261
+ } catch {
44262
+ modelList = r.output.split("\n").filter((l) => l.trim());
44263
+ }
44264
+ }
44265
+ } catch {
44266
+ }
44267
+ } catch {
44268
+ }
44269
+ while (true) {
44270
+ const currentActive = ctx.isCohere?.() ?? false;
44271
+ const toggleLabel = currentActive ? "Disable COHERE" : "Enable COHERE";
44272
+ const toggleDetail = currentActive ? `Active \u2014 forwarding ${ctx.config.model}` : "Join the distributed cognitive commons";
44273
+ const items = [
44274
+ { key: "hdr-status", label: selectColors.dim(`\u2500\u2500\u2500 Status: ${currentActive ? "ACTIVE" : "OFF"} \u2500\u2500\u2500`) },
44275
+ { key: "toggle", label: toggleLabel, detail: toggleDetail },
44276
+ { key: "hdr-network", label: selectColors.dim("\u2500\u2500\u2500 Network \u2500\u2500\u2500") },
44277
+ { key: "stats", label: "Network Stats", detail: `${stats.queriesAnswered} answered \xB7 ${stats.queriesSent} sent \xB7 ${stats.insightsShared} shared` },
44278
+ { key: "identity", label: "Identity Kernel", detail: "View/publish identity snapshot" },
44279
+ { key: "ipfs", label: "IPFS Storage", detail: "Pinned CIDs and content sharing" },
44280
+ { key: "hdr-models", label: selectColors.dim("\u2500\u2500\u2500 Model Exposure \u2500\u2500\u2500") },
44281
+ ...modelList.slice(0, 10).map((m) => ({
44282
+ key: `model:${m}`,
44283
+ label: m,
44284
+ detail: "Toggle exposure to mesh"
44285
+ }))
44286
+ ];
44287
+ if (modelList.length === 0) {
44288
+ items.push({ key: "no-models", label: selectColors.dim("No models detected"), detail: "Models appear after /cohere is enabled" });
44289
+ }
44290
+ const result = await tuiSelect({
44291
+ items,
44292
+ title: "COHERE Cognitive Commons",
44293
+ activeKey: currentActive ? "toggle" : void 0,
44294
+ rl: ctx.rl,
44295
+ skipKeys: ["hdr-status", "hdr-network", "hdr-models", "no-models"],
44296
+ availableRows: ctx.availableContentRows?.()
44297
+ });
44298
+ if (!result.confirmed || !result.key)
44299
+ break;
44300
+ switch (result.key) {
44301
+ case "toggle": {
44302
+ ctx.cohereToggle?.();
44303
+ continue;
44304
+ }
44305
+ case "stats": {
44306
+ const statItems = [
44307
+ { key: "hdr", label: selectColors.dim("\u2500\u2500\u2500 Network Activity \u2500\u2500\u2500") },
44308
+ { key: "answered", label: `Queries answered: ${c2.bold(String(stats.queriesAnswered || 0))}` },
44309
+ { key: "sent", label: `Queries sent: ${c2.bold(String(stats.queriesSent || 0))}` },
44310
+ { key: "insights", label: `Insights shared: ${c2.bold(String(stats.insightsShared || 0))}` },
44311
+ { key: "peers", label: `Peers connected: ${c2.bold(String(stats.peersConnected || 0))}` },
44312
+ { key: "hdr2", label: selectColors.dim("\u2500\u2500\u2500 Actions \u2500\u2500\u2500") },
44313
+ { key: "refresh", label: "Refresh Stats", detail: "Fetch latest from daemon" }
44314
+ ];
44315
+ const statResult = await tuiSelect({
44316
+ items: statItems,
44317
+ title: "Stats",
44318
+ breadcrumbs: ["COHERE"],
44319
+ rl: ctx.rl,
44320
+ skipKeys: ["hdr", "hdr2", "answered", "sent", "insights", "peers"],
44321
+ availableRows: ctx.availableContentRows?.()
44322
+ });
44323
+ if (statResult.key === "refresh") {
44324
+ try {
44325
+ const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
44326
+ const nexus = new NexusTool2(ctx.repoRoot);
44327
+ const r = await nexus.execute({ action: "cohere_stats" });
44328
+ if (r.success) {
44329
+ try {
44330
+ Object.assign(stats, JSON.parse(r.output));
44331
+ } catch {
44332
+ }
44333
+ }
44334
+ } catch {
44335
+ }
44336
+ }
44337
+ continue;
44338
+ }
44339
+ case "identity": {
44340
+ const idItems = [
44341
+ { key: "hdr", label: selectColors.dim("\u2500\u2500\u2500 Identity Kernel \u2500\u2500\u2500") },
44342
+ { key: "publish", label: "Publish Snapshot", detail: "Publish current identity to IPFS" },
44343
+ { key: "view", label: "View Self-State", detail: "Show current identity kernel" },
44344
+ { key: "history", label: "Version History", detail: "Show identity evolution" }
44345
+ ];
44346
+ const idResult = await tuiSelect({
44347
+ items: idItems,
44348
+ title: "Identity",
44349
+ breadcrumbs: ["COHERE"],
44350
+ rl: ctx.rl,
44351
+ skipKeys: ["hdr"],
44352
+ availableRows: ctx.availableContentRows?.()
44353
+ });
44354
+ if (idResult.confirmed && idResult.key) {
44355
+ try {
44356
+ const { IdentityKernelTool: IdentityKernelTool2 } = __require("@open-agents/execution");
44357
+ const ik = new IdentityKernelTool2(ctx.repoRoot);
44358
+ if (idResult.key === "publish") {
44359
+ await ik.execute({ operation: "publish_snapshot" });
44360
+ } else if (idResult.key === "view") {
44361
+ await ik.execute({ operation: "hydrate" });
44362
+ } else if (idResult.key === "history") {
44363
+ const snapDir = join52(ctx.repoRoot, ".oa", "identity", "snapshots");
44364
+ if (existsSync37(snapDir)) {
44365
+ const snaps = readdirSync10(snapDir).filter((f) => f.endsWith(".json")).sort().reverse();
44366
+ const snapItems = snaps.slice(0, 20).map((f) => ({
44367
+ key: f,
44368
+ label: f.replace(".json", ""),
44369
+ detail: `${formatFileSize(statSync13(join52(snapDir, f)).size)}`
44370
+ }));
44371
+ if (snapItems.length > 0) {
44372
+ await tuiSelect({
44373
+ items: snapItems,
44374
+ title: "Versions",
44375
+ breadcrumbs: ["COHERE", "Identity"],
44376
+ rl: ctx.rl,
44377
+ availableRows: ctx.availableContentRows?.()
44378
+ });
44379
+ }
44380
+ }
44381
+ }
44382
+ } catch {
44383
+ }
44384
+ }
44385
+ continue;
44386
+ }
44387
+ case "ipfs": {
44388
+ const ipfsItems = [
44389
+ { key: "hdr", label: selectColors.dim("\u2500\u2500\u2500 IPFS / Helia \u2500\u2500\u2500") },
44390
+ { key: "status", label: "Storage Status", detail: "Helia blocks, local fallback, sizes" },
44391
+ { key: "cids", label: "Pinned CIDs", detail: "List all pinned content" },
44392
+ { key: "publish", label: "Publish Identity", detail: "Share identity kernel via IPFS" },
44393
+ { key: "peers", label: "Peer Info", detail: "Peer ID + multiaddrs" }
44394
+ ];
44395
+ const ipfsResult = await tuiSelect({
44396
+ items: ipfsItems,
44397
+ title: "IPFS",
44398
+ breadcrumbs: ["COHERE"],
44399
+ rl: ctx.rl,
44400
+ skipKeys: ["hdr"],
44401
+ availableRows: ctx.availableContentRows?.()
44402
+ });
44403
+ if (ipfsResult.confirmed && ipfsResult.key) {
44404
+ if (ipfsResult.key === "cids") {
44405
+ try {
44406
+ const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
44407
+ const nexus = new NexusTool2(ctx.repoRoot);
44408
+ const r = await nexus.execute({ action: "ipfs_ls" });
44409
+ if (r.success) {
44410
+ const data = JSON.parse(r.output);
44411
+ const pins = data.pins || [];
44412
+ if (pins.length > 0) {
44413
+ const cidItems = pins.map((p) => ({
44414
+ key: p.cid,
44415
+ label: p.cid.slice(0, 30) + "...",
44416
+ detail: p.source || "unknown"
44417
+ }));
44418
+ await tuiSelect({
44419
+ items: cidItems,
44420
+ title: "Pinned CIDs",
44421
+ breadcrumbs: ["COHERE", "IPFS"],
44422
+ rl: ctx.rl,
44423
+ availableRows: ctx.availableContentRows?.()
44424
+ });
44425
+ }
44426
+ }
44427
+ } catch {
44428
+ }
44429
+ }
44430
+ }
44431
+ continue;
44432
+ }
44433
+ default: {
44434
+ if (result.key.startsWith("model:")) {
44435
+ const modelName = result.key.slice(6);
44436
+ try {
44437
+ const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
44438
+ const nexus = new NexusTool2(ctx.repoRoot);
44439
+ await nexus.execute({ action: "cohere_allow_model", model: modelName });
44440
+ } catch {
44441
+ }
44442
+ continue;
44443
+ }
44444
+ break;
44445
+ }
44446
+ }
44447
+ break;
44448
+ }
44449
+ }
44306
44450
  async function showModelPicker(ctx, local = false) {
44307
44451
  try {
44308
44452
  const BRAILLE_CYCLE = ["\u2800", "\u2840", "\u28C0", "\u28C4", "\u28E4", "\u28E6", "\u28F6", "\u28F7", "\u28FF", "\u28F7", "\u28F6", "\u28E6", "\u28E4", "\u28C4", "\u28C0", "\u2840"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.141.6",
3
+ "version": "0.142.0",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",