open-agents-ai 0.140.1 → 0.140.3
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 +106 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31083,43 +31083,42 @@ function setContentWriteHook(hook) {
|
|
|
31083
31083
|
}
|
|
31084
31084
|
function renderError(message) {
|
|
31085
31085
|
const redir = _contentWriteHook?.redirect?.();
|
|
31086
|
-
const icon = _emojisEnabled ? "\x1B[38;5;
|
|
31086
|
+
const icon = _emojisEnabled ? "\x1B[38;5;198m\u2716\x1B[0m" : "\x1B[38;5;198mE\x1B[0m";
|
|
31087
|
+
const text = `
|
|
31088
|
+
${icon} \x1B[38;5;198m${message}\x1B[0m
|
|
31089
|
+
`;
|
|
31087
31090
|
if (redir) {
|
|
31088
|
-
redir(
|
|
31089
|
-
${icon} ${message}
|
|
31090
|
-
`);
|
|
31091
|
+
redir(text);
|
|
31091
31092
|
return;
|
|
31092
31093
|
}
|
|
31093
31094
|
_contentWriteHook?.begin();
|
|
31094
|
-
process.stdout.write(
|
|
31095
|
-
${icon} ${message}
|
|
31096
|
-
`);
|
|
31095
|
+
process.stdout.write(text);
|
|
31097
31096
|
_contentWriteHook?.end();
|
|
31098
31097
|
}
|
|
31099
31098
|
function renderInfo(message) {
|
|
31100
31099
|
const redir = _contentWriteHook?.redirect?.();
|
|
31101
|
-
const icon =
|
|
31100
|
+
const icon = "\x1B[38;5;178mi\x1B[0m";
|
|
31101
|
+
const text = `${icon} \x1B[38;5;252m${message}\x1B[0m
|
|
31102
|
+
`;
|
|
31102
31103
|
if (redir) {
|
|
31103
|
-
redir(
|
|
31104
|
-
`);
|
|
31104
|
+
redir(text);
|
|
31105
31105
|
return;
|
|
31106
31106
|
}
|
|
31107
31107
|
_contentWriteHook?.begin();
|
|
31108
|
-
process.stdout.write(
|
|
31109
|
-
`);
|
|
31108
|
+
process.stdout.write(text);
|
|
31110
31109
|
_contentWriteHook?.end();
|
|
31111
31110
|
}
|
|
31112
31111
|
function renderWarning(message) {
|
|
31113
31112
|
const redir = _contentWriteHook?.redirect?.();
|
|
31114
|
-
const icon =
|
|
31113
|
+
const icon = "\x1B[38;5;214m!\x1B[0m";
|
|
31114
|
+
const text = `${icon} \x1B[38;5;214m${message}\x1B[0m
|
|
31115
|
+
`;
|
|
31115
31116
|
if (redir) {
|
|
31116
|
-
redir(
|
|
31117
|
-
`);
|
|
31117
|
+
redir(text);
|
|
31118
31118
|
return;
|
|
31119
31119
|
}
|
|
31120
31120
|
_contentWriteHook?.begin();
|
|
31121
|
-
process.stdout.write(
|
|
31122
|
-
`);
|
|
31121
|
+
process.stdout.write(text);
|
|
31123
31122
|
_contentWriteHook?.end();
|
|
31124
31123
|
}
|
|
31125
31124
|
function renderVerbose(message) {
|
|
@@ -42321,6 +42320,88 @@ async function handleSlashCommand(input, ctx) {
|
|
|
42321
42320
|
}
|
|
42322
42321
|
return "handled";
|
|
42323
42322
|
}
|
|
42323
|
+
if (ipfsAction === "share") {
|
|
42324
|
+
const shareType = ipfsSubCmd[1]?.toLowerCase() || "";
|
|
42325
|
+
const shareName = ipfsSubCmd.slice(2).join(" ").trim();
|
|
42326
|
+
if (!shareType || !shareName) {
|
|
42327
|
+
renderInfo("Usage: /ipfs share tool <name> | /ipfs share skill <name>");
|
|
42328
|
+
return "handled";
|
|
42329
|
+
}
|
|
42330
|
+
let content = "";
|
|
42331
|
+
let metadata = {};
|
|
42332
|
+
if (shareType === "tool") {
|
|
42333
|
+
const toolDir = join51(ctx.repoRoot, ".oa", "tools");
|
|
42334
|
+
const toolFile = join51(toolDir, shareName.endsWith(".json") ? shareName : `${shareName}.json`);
|
|
42335
|
+
if (!existsSync36(toolFile)) {
|
|
42336
|
+
renderWarning(`Tool not found: ${toolFile}`);
|
|
42337
|
+
return "handled";
|
|
42338
|
+
}
|
|
42339
|
+
content = readFileSync25(toolFile, "utf8");
|
|
42340
|
+
metadata = { type: "tool", name: shareName };
|
|
42341
|
+
} else if (shareType === "skill") {
|
|
42342
|
+
const skillDir = join51(ctx.repoRoot, ".oa", "skills", shareName);
|
|
42343
|
+
const skillFile = join51(skillDir, "SKILL.md");
|
|
42344
|
+
if (!existsSync36(skillFile)) {
|
|
42345
|
+
renderWarning(`Skill not found: ${skillFile}`);
|
|
42346
|
+
return "handled";
|
|
42347
|
+
}
|
|
42348
|
+
content = readFileSync25(skillFile, "utf8");
|
|
42349
|
+
metadata = { type: "skill", name: shareName };
|
|
42350
|
+
} else {
|
|
42351
|
+
renderWarning(`Unknown share type: ${shareType}. Use 'tool' or 'skill'.`);
|
|
42352
|
+
return "handled";
|
|
42353
|
+
}
|
|
42354
|
+
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]");
|
|
42355
|
+
const payload = JSON.stringify({ ...metadata, content, sharedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
42356
|
+
try {
|
|
42357
|
+
const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
|
|
42358
|
+
const nexus = new NexusTool2(ctx.repoRoot);
|
|
42359
|
+
const result = await nexus.execute({ action: "ipfs_add", content: payload });
|
|
42360
|
+
if (result.success) {
|
|
42361
|
+
const data = JSON.parse(result.output);
|
|
42362
|
+
safeLog(`
|
|
42363
|
+
${c2.bold("Shared to IPFS")}`);
|
|
42364
|
+
safeLog(` Type: ${shareType}`);
|
|
42365
|
+
safeLog(` Name: ${shareName}`);
|
|
42366
|
+
safeLog(` CID: ${c2.bold(data.cid)}`);
|
|
42367
|
+
safeLog(` ${c2.dim("Others can import: /ipfs import " + data.cid)}
|
|
42368
|
+
`);
|
|
42369
|
+
} else {
|
|
42370
|
+
renderWarning(result.output);
|
|
42371
|
+
}
|
|
42372
|
+
} catch (e) {
|
|
42373
|
+
renderWarning(`Share failed: ${e.message ?? e}`);
|
|
42374
|
+
}
|
|
42375
|
+
return "handled";
|
|
42376
|
+
}
|
|
42377
|
+
if (ipfsAction === "import") {
|
|
42378
|
+
const importCid = ipfsArg.trim();
|
|
42379
|
+
if (!importCid) {
|
|
42380
|
+
renderInfo("Usage: /ipfs import <CID>");
|
|
42381
|
+
return "handled";
|
|
42382
|
+
}
|
|
42383
|
+
try {
|
|
42384
|
+
const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
|
|
42385
|
+
const nexus = new NexusTool2(ctx.repoRoot);
|
|
42386
|
+
await nexus.execute({ action: "ipfs_pin", cid: importCid, source: "import" });
|
|
42387
|
+
const regFile = join51(ctx.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
|
|
42388
|
+
if (existsSync36(regFile)) {
|
|
42389
|
+
const reg = JSON.parse(readFileSync25(regFile, "utf8"));
|
|
42390
|
+
const pinned = Object.values(reg).some((e) => e.cid === importCid && e.pinned);
|
|
42391
|
+
if (pinned) {
|
|
42392
|
+
renderInfo(`CID ${importCid.slice(0, 20)}... pinned successfully.`);
|
|
42393
|
+
renderInfo("Content will be available when Helia resolves it from the IPFS network.");
|
|
42394
|
+
} else {
|
|
42395
|
+
renderInfo(`CID ${importCid.slice(0, 20)}... registered for pinning.`);
|
|
42396
|
+
}
|
|
42397
|
+
} else {
|
|
42398
|
+
renderInfo(`CID ${importCid.slice(0, 20)}... pin request sent.`);
|
|
42399
|
+
}
|
|
42400
|
+
} catch (e) {
|
|
42401
|
+
renderWarning(`Import failed: ${e.message ?? e}`);
|
|
42402
|
+
}
|
|
42403
|
+
return "handled";
|
|
42404
|
+
}
|
|
42324
42405
|
if (ipfsAction === "cids" || ipfsAction === "ls" || ipfsAction === "pins") {
|
|
42325
42406
|
try {
|
|
42326
42407
|
const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
|
|
@@ -56697,7 +56778,6 @@ ${entry.fullContent}`
|
|
|
56697
56778
|
break;
|
|
56698
56779
|
case "sudo_request":
|
|
56699
56780
|
contentWrite(() => renderWarning(`Sudo required: ${event.content ?? "elevated privileges needed"}`));
|
|
56700
|
-
contentWrite(() => renderInfo("Enter your password at the prompt below to continue."));
|
|
56701
56781
|
if (sudoCallback)
|
|
56702
56782
|
sudoCallback(event.content ?? "");
|
|
56703
56783
|
break;
|
|
@@ -57694,8 +57774,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
57694
57774
|
if (process.stdout.isTTY) {
|
|
57695
57775
|
process.stdout.write("\x1B[?1002l\x1B[?1006l");
|
|
57696
57776
|
}
|
|
57697
|
-
writeContent(() =>
|
|
57698
|
-
|
|
57777
|
+
writeContent(() => {
|
|
57778
|
+
process.stdout.write(`
|
|
57779
|
+
\x1B[5;38;5;198m\u2B24 Enter Password:\x1B[0m \x1B[38;5;245mType below, Enter to submit. Ctrl+O to show/hide.\x1B[0m
|
|
57780
|
+
|
|
57781
|
+
`);
|
|
57782
|
+
});
|
|
57783
|
+
const pwPrompt = `\x1B[38;5;198m\u25CF password:\x1B[0m `;
|
|
57699
57784
|
rl.setPrompt(pwPrompt);
|
|
57700
57785
|
if (statusBar.isActive) {
|
|
57701
57786
|
const origProvider = statusBar.inputStateProvider;
|
|
@@ -57705,7 +57790,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
57705
57790
|
return state;
|
|
57706
57791
|
return { line: "\u25CF".repeat(state.line.length), cursor: state.cursor };
|
|
57707
57792
|
};
|
|
57708
|
-
statusBar.setPromptText(pwPrompt,
|
|
57793
|
+
statusBar.setPromptText(pwPrompt, 12);
|
|
57709
57794
|
}
|
|
57710
57795
|
showPrompt();
|
|
57711
57796
|
}
|
package/package.json
CHANGED