open-agents-ai 0.187.299 → 0.187.301
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 +32 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -297392,10 +297392,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
297392
297392
|
description: "Show/set OA_ACCESS (loopback|lan|any)",
|
|
297393
297393
|
handler: async ({ arg: arg2, hasLocal: hasLocal2, ctx: ctx4 }) => {
|
|
297394
297394
|
const normalize2 = (v) => v.toLowerCase().trim();
|
|
297395
|
+
const normalizeMode2 = (v) => v === "all" ? "any" : v;
|
|
297395
297396
|
const curAccess2 = normalize2(process.env["OA_ACCESS"] ?? "");
|
|
297396
297397
|
const curHost2 = process.env["OA_HOST"] ?? "0.0.0.0:11435";
|
|
297397
297398
|
const allowed2 = /* @__PURE__ */ new Set(["loopback", "lan", "any"]);
|
|
297398
|
-
const val2 = normalize2(arg2);
|
|
297399
|
+
const val2 = normalizeMode2(normalize2(arg2));
|
|
297399
297400
|
if (!val2) {
|
|
297400
297401
|
renderInfo2(`Access: ${curAccess2 || "(default)"} Host: ${curHost2}`);
|
|
297401
297402
|
renderInfo2("Use /access loopback|lan|any to change (restarts daemon).\n");
|
|
@@ -297406,6 +297407,13 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
297406
297407
|
return "handled";
|
|
297407
297408
|
}
|
|
297408
297409
|
process.env["OA_ACCESS"] = val2;
|
|
297410
|
+
if (val2 === "any" && !process.env["OA_API_KEY"]) {
|
|
297411
|
+
const { randomBytes: randomBytes23 } = await import("node:crypto");
|
|
297412
|
+
const apiKey = randomBytes23(16).toString("hex");
|
|
297413
|
+
process.env["OA_API_KEY"] = apiKey;
|
|
297414
|
+
renderInfo2(`Generated API key: ${c3.bold(c3.yellow(apiKey))}`);
|
|
297415
|
+
renderInfo2("Use the Web UI ‘key’ button to paste this token, or set Authorization: Bearer <key> in your client.");
|
|
297416
|
+
}
|
|
297409
297417
|
if (hasLocal2) {
|
|
297410
297418
|
ctx4.saveLocalSettings({ oaAccess: val2 });
|
|
297411
297419
|
} else {
|
|
@@ -297420,10 +297428,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
297420
297428
|
}
|
|
297421
297429
|
});
|
|
297422
297430
|
const normalize = (v) => v.toLowerCase().trim();
|
|
297431
|
+
const normalizeMode = (v) => v === "all" ? "any" : v;
|
|
297423
297432
|
const curAccess = normalize(process.env["OA_ACCESS"] ?? "");
|
|
297424
297433
|
const curHost = process.env["OA_HOST"] ?? "0.0.0.0:11435";
|
|
297425
297434
|
const allowed = /* @__PURE__ */ new Set(["loopback", "lan", "any"]);
|
|
297426
|
-
const val = normalize(arg);
|
|
297435
|
+
const val = normalizeMode(normalize(arg));
|
|
297427
297436
|
if (!val) {
|
|
297428
297437
|
renderInfo2(`Access: ${curAccess || "(default)"} Host: ${curHost}`);
|
|
297429
297438
|
renderInfo2("Use /access loopback|lan|any to change (restarts daemon).\n");
|
|
@@ -297434,6 +297443,13 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
297434
297443
|
return "handled";
|
|
297435
297444
|
}
|
|
297436
297445
|
process.env["OA_ACCESS"] = val;
|
|
297446
|
+
if (val === "any" && !process.env["OA_API_KEY"]) {
|
|
297447
|
+
const { randomBytes: randomBytes23 } = await import("node:crypto");
|
|
297448
|
+
const apiKey = randomBytes23(16).toString("hex");
|
|
297449
|
+
process.env["OA_API_KEY"] = apiKey;
|
|
297450
|
+
renderInfo2(`Generated API key: ${c3.bold(c3.yellow(apiKey))}`);
|
|
297451
|
+
renderInfo2("Use the Web UI ‘key’ button to paste this token, or set Authorization: Bearer <key> in your client.");
|
|
297452
|
+
}
|
|
297437
297453
|
if (hasLocal) {
|
|
297438
297454
|
ctx3.saveLocalSettings({ oaAccess: val });
|
|
297439
297455
|
} else {
|
|
@@ -320869,6 +320885,20 @@ async function sendMessage() {
|
|
|
320869
320885
|
signal: chatAbortController.signal,
|
|
320870
320886
|
});
|
|
320871
320887
|
|
|
320888
|
+
// Auth prompt on 403 — open the key modal for a clean ingress
|
|
320889
|
+
if (response.status === 401 || response.status === 403) {
|
|
320890
|
+
streaming = false;
|
|
320891
|
+
chatAbortController = null;
|
|
320892
|
+
document.getElementById('send-btn').style.display = 'inline-block';
|
|
320893
|
+
document.getElementById('stop-btn').style.display = 'none';
|
|
320894
|
+
contentDiv.innerHTML = '<div style="background:#2a1e1e;border-left:3px solid #ffcc44;color:#ffcc44;padding:6px 10px 6px 14px;margin:3px 0;font-family:inherit">' +
|
|
320895
|
+
'<div style="color:#ffcc44;font-size:0.6rem;text-transform:uppercase;letter-spacing:0.08em;margin-bottom:2px">▸ auth required</div>' +
|
|
320896
|
+
'<div style="color:#ffe08a">Remote access requires an API key. Click the “key” button in the header and paste your token.</div>' +
|
|
320897
|
+
'</div>';
|
|
320898
|
+
try { document.getElementById('key-modal').classList.add('visible'); } catch {}
|
|
320899
|
+
return;
|
|
320900
|
+
}
|
|
320901
|
+
|
|
320872
320902
|
// Session continuity — capture session_id from BOTH the response header
|
|
320873
320903
|
// (set on SSE paths) and the JSON body (set on non-streaming paths).
|
|
320874
320904
|
// Without this fallback, every message could start a fresh session and
|
package/package.json
CHANGED