open-agents-ai 0.140.2 → 0.140.4

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 +143 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -38052,7 +38052,7 @@ function tuiSelect(opts) {
38052
38052
  }
38053
38053
  stdin.resume();
38054
38054
  enterOverlay();
38055
- overlayWrite("\x1B[?1049h\x1B[48;5;234m\x1B[2J\x1B[H\x1B[?25l\x1B[?1002h\x1B[?1006h");
38055
+ overlayWrite("\x1B[?1049h\x1B[48;5;234m\x1B[2J\x1B[H\x1B[?25l\x1B[?1003h\x1B[?1006h");
38056
38056
  let listRowOffset = 0;
38057
38057
  function clampScroll(displayList) {
38058
38058
  const cursorPos = displayList.indexOf(cursor);
@@ -38155,7 +38155,7 @@ function tuiSelect(opts) {
38155
38155
  function cleanup() {
38156
38156
  stdin.removeListener("data", onData);
38157
38157
  process.stdout.removeListener("resize", onResize);
38158
- overlayWrite("\x1B[?1002l\x1B[?1006l\x1B[?1049l\x1B[?25h");
38158
+ overlayWrite("\x1B[?1003l\x1B[?1002l\x1B[?1006l\x1B[?1049l\x1B[?25h");
38159
38159
  leaveOverlay();
38160
38160
  if (typeof stdin.setRawMode === "function") {
38161
38161
  stdin.setRawMode(hadRawMode ?? false);
@@ -38169,12 +38169,16 @@ function tuiSelect(opts) {
38169
38169
  }
38170
38170
  }
38171
38171
  function onData(chunk) {
38172
- const seq = chunk.toString("utf8");
38173
- const mouseMatch = seq.match(/\x1B\[<(\d+);(\d+);(\d+)([Mm])/);
38174
- if (mouseMatch) {
38175
- const btn = parseInt(mouseMatch[1]);
38176
- const mRow = parseInt(mouseMatch[3]);
38177
- const suffix = mouseMatch[4];
38172
+ let seq = chunk.toString("utf8");
38173
+ const mouseRe = /\x1B\[<(\d+);(\d+);(\d+)([Mm])/g;
38174
+ let mouseProcessed = false;
38175
+ let mouseM;
38176
+ while ((mouseM = mouseRe.exec(seq)) !== null) {
38177
+ mouseProcessed = true;
38178
+ const btn = parseInt(mouseM[1]);
38179
+ const mCol = parseInt(mouseM[2]);
38180
+ const mRow = parseInt(mouseM[3]);
38181
+ const suffix = mouseM[4];
38178
38182
  if (btn === 0 && suffix === "M") {
38179
38183
  const listIdx = mRow - listRowOffset - 1;
38180
38184
  if (listIdx >= 0 && listIdx < maxVisible) {
@@ -38213,8 +38217,56 @@ function tuiSelect(opts) {
38213
38217
  }
38214
38218
  }
38215
38219
  }
38216
- return;
38220
+ if ((btn === 35 || btn === 32 || btn === 67) && suffix === "M") {
38221
+ const listIdx = mRow - listRowOffset - 1;
38222
+ if (listIdx >= 0 && listIdx < maxVisible) {
38223
+ let displayList;
38224
+ if (filter) {
38225
+ displayList = [];
38226
+ for (let i = 0; i < items.length; i++) {
38227
+ if (matchSet.has(i) || isSkippable(i))
38228
+ displayList.push(i);
38229
+ }
38230
+ displayList = displayList.filter((idx, pos) => {
38231
+ if (!isSkippable(idx))
38232
+ return true;
38233
+ for (let j = pos + 1; j < displayList.length; j++) {
38234
+ if (!isSkippable(displayList[j]))
38235
+ return true;
38236
+ break;
38237
+ }
38238
+ return false;
38239
+ });
38240
+ } else {
38241
+ displayList = items.map((_, i) => i);
38242
+ }
38243
+ const vi = scrollOffset + listIdx;
38244
+ if (vi < displayList.length) {
38245
+ const itemIdx = displayList[vi];
38246
+ if (!isSkippable(itemIdx) && itemIdx !== cursor) {
38247
+ cursor = itemIdx;
38248
+ render();
38249
+ }
38250
+ }
38251
+ }
38252
+ }
38253
+ if (btn === 64) {
38254
+ const next = findSelectable(cursor - 1, -1);
38255
+ if (next >= 0 && next !== cursor) {
38256
+ cursor = next;
38257
+ render();
38258
+ }
38259
+ } else if (btn === 65) {
38260
+ const next = findSelectable(cursor + 1, 1);
38261
+ if (next >= 0 && next !== cursor) {
38262
+ cursor = next;
38263
+ render();
38264
+ }
38265
+ }
38217
38266
  }
38267
+ seq = seq.replace(mouseRe, "");
38268
+ if (!seq && mouseProcessed)
38269
+ return;
38218
38270
  if (deleteConfirmIdx >= 0) {
38219
38271
  if (seq === "\x1B[D") {
38220
38272
  deleteConfirmSel = true;
@@ -42320,6 +42372,88 @@ async function handleSlashCommand(input, ctx) {
42320
42372
  }
42321
42373
  return "handled";
42322
42374
  }
42375
+ if (ipfsAction === "share") {
42376
+ const shareType = ipfsSubCmd[1]?.toLowerCase() || "";
42377
+ const shareName = ipfsSubCmd.slice(2).join(" ").trim();
42378
+ if (!shareType || !shareName) {
42379
+ renderInfo("Usage: /ipfs share tool <name> | /ipfs share skill <name>");
42380
+ return "handled";
42381
+ }
42382
+ let content = "";
42383
+ let metadata = {};
42384
+ if (shareType === "tool") {
42385
+ const toolDir = join51(ctx.repoRoot, ".oa", "tools");
42386
+ const toolFile = join51(toolDir, shareName.endsWith(".json") ? shareName : `${shareName}.json`);
42387
+ if (!existsSync36(toolFile)) {
42388
+ renderWarning(`Tool not found: ${toolFile}`);
42389
+ return "handled";
42390
+ }
42391
+ content = readFileSync25(toolFile, "utf8");
42392
+ metadata = { type: "tool", name: shareName };
42393
+ } else if (shareType === "skill") {
42394
+ const skillDir = join51(ctx.repoRoot, ".oa", "skills", shareName);
42395
+ const skillFile = join51(skillDir, "SKILL.md");
42396
+ if (!existsSync36(skillFile)) {
42397
+ renderWarning(`Skill not found: ${skillFile}`);
42398
+ return "handled";
42399
+ }
42400
+ content = readFileSync25(skillFile, "utf8");
42401
+ metadata = { type: "skill", name: shareName };
42402
+ } else {
42403
+ renderWarning(`Unknown share type: ${shareType}. Use 'tool' or 'skill'.`);
42404
+ return "handled";
42405
+ }
42406
+ content = content.replace(/["']?api[_-]?key["']?\s*[:=]\s*["'][^"']*["']/gi, '"api_key": "[REDACTED]"').replace(/["']?secret["']?\s*[:=]\s*["'][^"']*["']/gi, '"secret": "[REDACTED]"').replace(/["']?password["']?\s*[:=]\s*["'][^"']*["']/gi, '"password": "[REDACTED]"').replace(/["']?token["']?\s*[:=]\s*["'][^"']*["']/gi, '"token": "[REDACTED]"').replace(/Bearer\s+[A-Za-z0-9._-]+/g, "Bearer [REDACTED]");
42407
+ const payload = JSON.stringify({ ...metadata, content, sharedAt: (/* @__PURE__ */ new Date()).toISOString() });
42408
+ try {
42409
+ const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
42410
+ const nexus = new NexusTool2(ctx.repoRoot);
42411
+ const result = await nexus.execute({ action: "ipfs_add", content: payload });
42412
+ if (result.success) {
42413
+ const data = JSON.parse(result.output);
42414
+ safeLog(`
42415
+ ${c2.bold("Shared to IPFS")}`);
42416
+ safeLog(` Type: ${shareType}`);
42417
+ safeLog(` Name: ${shareName}`);
42418
+ safeLog(` CID: ${c2.bold(data.cid)}`);
42419
+ safeLog(` ${c2.dim("Others can import: /ipfs import " + data.cid)}
42420
+ `);
42421
+ } else {
42422
+ renderWarning(result.output);
42423
+ }
42424
+ } catch (e) {
42425
+ renderWarning(`Share failed: ${e.message ?? e}`);
42426
+ }
42427
+ return "handled";
42428
+ }
42429
+ if (ipfsAction === "import") {
42430
+ const importCid = ipfsArg.trim();
42431
+ if (!importCid) {
42432
+ renderInfo("Usage: /ipfs import <CID>");
42433
+ return "handled";
42434
+ }
42435
+ try {
42436
+ const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
42437
+ const nexus = new NexusTool2(ctx.repoRoot);
42438
+ await nexus.execute({ action: "ipfs_pin", cid: importCid, source: "import" });
42439
+ const regFile = join51(ctx.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
42440
+ if (existsSync36(regFile)) {
42441
+ const reg = JSON.parse(readFileSync25(regFile, "utf8"));
42442
+ const pinned = Object.values(reg).some((e) => e.cid === importCid && e.pinned);
42443
+ if (pinned) {
42444
+ renderInfo(`CID ${importCid.slice(0, 20)}... pinned successfully.`);
42445
+ renderInfo("Content will be available when Helia resolves it from the IPFS network.");
42446
+ } else {
42447
+ renderInfo(`CID ${importCid.slice(0, 20)}... registered for pinning.`);
42448
+ }
42449
+ } else {
42450
+ renderInfo(`CID ${importCid.slice(0, 20)}... pin request sent.`);
42451
+ }
42452
+ } catch (e) {
42453
+ renderWarning(`Import failed: ${e.message ?? e}`);
42454
+ }
42455
+ return "handled";
42456
+ }
42323
42457
  if (ipfsAction === "cids" || ipfsAction === "ls" || ipfsAction === "pins") {
42324
42458
  try {
42325
42459
  const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.140.2",
3
+ "version": "0.140.4",
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",