open-agents-ai 0.141.5 → 0.141.7

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 +154 -81
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -43351,81 +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 participating in distributed cognitive commons");
43421
- renderInfo("Your identity kernel and memory deltas will be shared with the mesh");
43422
- renderInfo("Use /cohere again to disconnect, /cohere stats for network info");
43423
- } else {
43424
- renderInfo("COHERE disabled \u2014 disconnected from cognitive commons");
43425
- }
43426
- } else {
43427
- renderWarning("COHERE not available \u2014 requires nexus connection (/expose or /p2p)");
43428
- }
43354
+ await showCohereDashboard(ctx);
43429
43355
  return "handled";
43430
43356
  }
43431
43357
  case "listen":
@@ -44301,6 +44227,126 @@ async function handleExposeConfig(ctx) {
44301
44227
  }
44302
44228
  }
44303
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
+ try {
44307
+ const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
44308
+ const nexus = new NexusTool2(ctx.repoRoot);
44309
+ const r = await nexus.execute({ action: "cohere_stats" });
44310
+ if (r.success) {
44311
+ try {
44312
+ const d = JSON.parse(r.output);
44313
+ Object.assign(stats, d);
44314
+ } catch {
44315
+ }
44316
+ }
44317
+ } catch {
44318
+ }
44319
+ continue;
44320
+ }
44321
+ case "identity": {
44322
+ try {
44323
+ const { IdentityKernelTool: IdentityKernelTool2 } = __require("@open-agents/execution");
44324
+ const ik = new IdentityKernelTool2(ctx.repoRoot);
44325
+ await ik.execute({ operation: "publish_snapshot" });
44326
+ } catch {
44327
+ }
44328
+ continue;
44329
+ }
44330
+ case "ipfs": {
44331
+ break;
44332
+ }
44333
+ default: {
44334
+ if (result.key.startsWith("model:")) {
44335
+ const modelName = result.key.slice(6);
44336
+ try {
44337
+ const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
44338
+ const nexus = new NexusTool2(ctx.repoRoot);
44339
+ await nexus.execute({ action: "cohere_allow_model", model: modelName });
44340
+ } catch {
44341
+ }
44342
+ continue;
44343
+ }
44344
+ break;
44345
+ }
44346
+ }
44347
+ break;
44348
+ }
44349
+ }
44304
44350
  async function showModelPicker(ctx, local = false) {
44305
44351
  try {
44306
44352
  const BRAILLE_CYCLE = ["\u2800", "\u2840", "\u28C0", "\u28C4", "\u28E4", "\u28E6", "\u28F6", "\u28F7", "\u28FF", "\u28F7", "\u28F6", "\u28E6", "\u28E4", "\u28C4", "\u28C0", "\u2840"];
@@ -58475,12 +58521,39 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
58475
58521
  statusBar.setCohereActive(cohereEnabled);
58476
58522
  saveProjectSettings(repoRoot, { cohere: cohereEnabled });
58477
58523
  saveGlobalSettings({ cohere: cohereEnabled });
58478
- try {
58479
- const { NexusTool: NexusTool2 } = __require("../../execution/dist/tools/nexus.js");
58480
- const nexusTool = new NexusTool2(repoRoot);
58481
- nexusTool.execute({ action: cohereEnabled ? "cohere_enable" : "cohere_disable" }).catch(() => {
58482
- });
58483
- } catch {
58524
+ if (cohereEnabled) {
58525
+ (async () => {
58526
+ try {
58527
+ const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
58528
+ const nexusTool = new NexusTool2(repoRoot);
58529
+ try {
58530
+ const st = await nexusTool.execute({ action: "status" });
58531
+ if (!st.success || !st.output.includes("connected")) {
58532
+ await nexusTool.execute({ action: "connect" });
58533
+ await new Promise((r) => setTimeout(r, 1500));
58534
+ }
58535
+ } catch {
58536
+ }
58537
+ await nexusTool.execute({ action: "cohere_enable" }).catch(() => {
58538
+ });
58539
+ } catch {
58540
+ }
58541
+ try {
58542
+ if (!commandCtx.isExposeActive?.()) {
58543
+ writeContent(() => renderInfo("COHERE: exposing local inference to mesh..."));
58544
+ await commandCtx.exposeStart?.("passthrough");
58545
+ }
58546
+ } catch {
58547
+ }
58548
+ })();
58549
+ } else {
58550
+ try {
58551
+ const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
58552
+ const nexusTool = new NexusTool2(repoRoot);
58553
+ nexusTool.execute({ action: "cohere_disable" }).catch(() => {
58554
+ });
58555
+ } catch {
58556
+ }
58484
58557
  }
58485
58558
  return cohereEnabled;
58486
58559
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.141.5",
3
+ "version": "0.141.7",
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",