open-agents-ai 0.184.13 → 0.184.15
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 +63 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43062,8 +43062,9 @@ function defaultConfig() {
|
|
|
43062
43062
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
43063
43063
|
};
|
|
43064
43064
|
}
|
|
43065
|
-
async function discoverEndpoints(ollamaUrl) {
|
|
43065
|
+
async function discoverEndpoints(ollamaUrl, repoRoot) {
|
|
43066
43066
|
const endpoints = [];
|
|
43067
|
+
const seenUrls = /* @__PURE__ */ new Set();
|
|
43067
43068
|
try {
|
|
43068
43069
|
const resp = await fetch(`${ollamaUrl}/api/tags`, { signal: AbortSignal.timeout(5e3) });
|
|
43069
43070
|
if (resp.ok) {
|
|
@@ -43076,13 +43077,55 @@ async function discoverEndpoints(ollamaUrl) {
|
|
|
43076
43077
|
label: `Local Ollama (${new URL(ollamaUrl).host})`,
|
|
43077
43078
|
enabled: true
|
|
43078
43079
|
});
|
|
43080
|
+
seenUrls.add(ollamaUrl);
|
|
43081
|
+
}
|
|
43082
|
+
} catch {
|
|
43083
|
+
}
|
|
43084
|
+
if (repoRoot) {
|
|
43085
|
+
try {
|
|
43086
|
+
const { loadUsageHistory: loadUsageHistory2 } = await Promise.resolve().then(() => (init_oa_directory(), oa_directory_exports));
|
|
43087
|
+
const history = loadUsageHistory2("endpoint", repoRoot);
|
|
43088
|
+
for (const record of history) {
|
|
43089
|
+
const url = record.value;
|
|
43090
|
+
if (seenUrls.has(url))
|
|
43091
|
+
continue;
|
|
43092
|
+
seenUrls.add(url);
|
|
43093
|
+
const provider = record.meta?.provider || "Custom";
|
|
43094
|
+
const authHint = record.meta?.authKey;
|
|
43095
|
+
endpoints.push({
|
|
43096
|
+
kind: "custom",
|
|
43097
|
+
url,
|
|
43098
|
+
authHeader: authHint ? `Bearer ${authHint}` : void 0,
|
|
43099
|
+
models: [],
|
|
43100
|
+
label: `${provider} (${new URL(url).host})`,
|
|
43101
|
+
enabled: false
|
|
43102
|
+
// not enabled by default — user must opt-in
|
|
43103
|
+
});
|
|
43104
|
+
}
|
|
43105
|
+
} catch {
|
|
43106
|
+
}
|
|
43107
|
+
}
|
|
43108
|
+
try {
|
|
43109
|
+
const { loadGlobalSettings: loadGlobalSettings2 } = await Promise.resolve().then(() => (init_oa_directory(), oa_directory_exports));
|
|
43110
|
+
const settings = loadGlobalSettings2();
|
|
43111
|
+
const currentUrl = settings?.backendUrl;
|
|
43112
|
+
if (currentUrl && !seenUrls.has(currentUrl) && currentUrl !== "http://127.0.0.1:11434") {
|
|
43113
|
+
seenUrls.add(currentUrl);
|
|
43114
|
+
endpoints.push({
|
|
43115
|
+
kind: "custom",
|
|
43116
|
+
url: currentUrl,
|
|
43117
|
+
authHeader: settings?.apiKey ? `Bearer ${settings.apiKey}` : void 0,
|
|
43118
|
+
models: [],
|
|
43119
|
+
label: `Current endpoint (${new URL(currentUrl).host})`,
|
|
43120
|
+
enabled: false
|
|
43121
|
+
});
|
|
43079
43122
|
}
|
|
43080
43123
|
} catch {
|
|
43081
43124
|
}
|
|
43082
43125
|
return endpoints;
|
|
43083
43126
|
}
|
|
43084
|
-
async function stepEndpoints(config, ollamaUrl, rl, availableRows) {
|
|
43085
|
-
const discovered = await discoverEndpoints(ollamaUrl);
|
|
43127
|
+
async function stepEndpoints(config, ollamaUrl, rl, availableRows, repoRoot) {
|
|
43128
|
+
const discovered = await discoverEndpoints(ollamaUrl, repoRoot);
|
|
43086
43129
|
for (const disc of discovered) {
|
|
43087
43130
|
const existing = config.endpoints.find((e) => e.url === disc.url);
|
|
43088
43131
|
if (!existing) {
|
|
@@ -43147,7 +43190,7 @@ async function stepEndpoints(config, ollamaUrl, rl, availableRows) {
|
|
|
43147
43190
|
const anyEnabled = config.endpoints.some((e) => e.enabled);
|
|
43148
43191
|
if (!anyEnabled) {
|
|
43149
43192
|
renderWarning("Select at least one endpoint before continuing.");
|
|
43150
|
-
return stepEndpoints(config, ollamaUrl, rl, availableRows);
|
|
43193
|
+
return stepEndpoints(config, ollamaUrl, rl, availableRows, repoRoot);
|
|
43151
43194
|
}
|
|
43152
43195
|
return true;
|
|
43153
43196
|
}
|
|
@@ -43155,7 +43198,7 @@ async function stepEndpoints(config, ollamaUrl, rl, availableRows) {
|
|
|
43155
43198
|
const ep = config.endpoints.find((e) => e.url === result.key);
|
|
43156
43199
|
if (ep) {
|
|
43157
43200
|
ep.enabled = !ep.enabled;
|
|
43158
|
-
return stepEndpoints(config, ollamaUrl, rl, availableRows);
|
|
43201
|
+
return stepEndpoints(config, ollamaUrl, rl, availableRows, repoRoot);
|
|
43159
43202
|
}
|
|
43160
43203
|
}
|
|
43161
43204
|
if (result.key === "add_custom") {
|
|
@@ -43512,7 +43555,7 @@ async function showSponsorDashboard(config, projectDir, rl, availableRows) {
|
|
|
43512
43555
|
async function runSponsorWizard(ctx) {
|
|
43513
43556
|
let config = loadSponsorConfig(ctx.projectDir) || defaultConfig();
|
|
43514
43557
|
renderInfo("Starting sponsor onboarding wizard...\n");
|
|
43515
|
-
if (!await stepEndpoints(config, ctx.ollamaUrl, ctx.rl, ctx.availableRows)) {
|
|
43558
|
+
if (!await stepEndpoints(config, ctx.ollamaUrl, ctx.rl, ctx.availableRows, ctx.projectDir)) {
|
|
43516
43559
|
renderInfo("Sponsor wizard cancelled.");
|
|
43517
43560
|
return null;
|
|
43518
43561
|
}
|
|
@@ -46862,8 +46905,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
46862
46905
|
const ipfsArg = ipfsSubCmd.slice(1).join(" ");
|
|
46863
46906
|
const ensureDaemon = async () => {
|
|
46864
46907
|
try {
|
|
46865
|
-
const
|
|
46866
|
-
const nexus = new NexusTool2(ctx.repoRoot);
|
|
46908
|
+
const nexus = new NexusTool(ctx.repoRoot);
|
|
46867
46909
|
const statusResult = await nexus.execute({ action: "status" });
|
|
46868
46910
|
if (statusResult.success && statusResult.output.includes("connected"))
|
|
46869
46911
|
return true;
|
|
@@ -46889,8 +46931,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
46889
46931
|
try {
|
|
46890
46932
|
if (!await ensureDaemon())
|
|
46891
46933
|
return "handled";
|
|
46892
|
-
const
|
|
46893
|
-
const nexus = new NexusTool2(ctx.repoRoot);
|
|
46934
|
+
const nexus = new NexusTool(ctx.repoRoot);
|
|
46894
46935
|
const result = await nexus.execute({ action: "ipfs_pin", cid: cidToPin, source: "user-pin" });
|
|
46895
46936
|
if (result.success) {
|
|
46896
46937
|
renderInfo(`Pinned: ${cidToPin}`);
|
|
@@ -46904,8 +46945,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
46904
46945
|
}
|
|
46905
46946
|
if (ipfsAction === "publish") {
|
|
46906
46947
|
try {
|
|
46907
|
-
const
|
|
46908
|
-
const ik = new IdentityKernelTool2(ctx.repoRoot);
|
|
46948
|
+
const ik = new IdentityKernelTool(ctx.repoRoot);
|
|
46909
46949
|
const result = await ik.execute({ operation: "publish_snapshot" });
|
|
46910
46950
|
if (result.success) {
|
|
46911
46951
|
const cidMatch = result.output.match(/CID:\s*(bafy\S+|bafk\S+)/);
|
|
@@ -46960,8 +47000,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
46960
47000
|
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]");
|
|
46961
47001
|
const payload = JSON.stringify({ ...metadata, content, sharedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
46962
47002
|
try {
|
|
46963
|
-
const
|
|
46964
|
-
const nexus = new NexusTool2(ctx.repoRoot);
|
|
47003
|
+
const nexus = new NexusTool(ctx.repoRoot);
|
|
46965
47004
|
const result = await nexus.execute({ action: "ipfs_add", content: payload });
|
|
46966
47005
|
if (result.success) {
|
|
46967
47006
|
const data = JSON.parse(result.output);
|
|
@@ -46987,8 +47026,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
46987
47026
|
return "handled";
|
|
46988
47027
|
}
|
|
46989
47028
|
try {
|
|
46990
|
-
const
|
|
46991
|
-
const nexus = new NexusTool2(ctx.repoRoot);
|
|
47029
|
+
const nexus = new NexusTool(ctx.repoRoot);
|
|
46992
47030
|
await nexus.execute({ action: "ipfs_pin", cid: importCid, source: "import" });
|
|
46993
47031
|
const regFile = join58(ctx.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
|
|
46994
47032
|
if (existsSync42(regFile)) {
|
|
@@ -47010,8 +47048,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
47010
47048
|
}
|
|
47011
47049
|
if (ipfsAction === "cids" || ipfsAction === "ls" || ipfsAction === "pins") {
|
|
47012
47050
|
try {
|
|
47013
|
-
const
|
|
47014
|
-
const nexus = new NexusTool2(ctx.repoRoot);
|
|
47051
|
+
const nexus = new NexusTool(ctx.repoRoot);
|
|
47015
47052
|
const result = await nexus.execute({ action: "ipfs_ls" });
|
|
47016
47053
|
if (result.success) {
|
|
47017
47054
|
const data = JSON.parse(result.output);
|
|
@@ -47869,8 +47906,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
47869
47906
|
onGoLive: async (config) => {
|
|
47870
47907
|
if (config.transport.libp2p) {
|
|
47871
47908
|
try {
|
|
47872
|
-
const
|
|
47873
|
-
const nexus = new NexusTool2(projectDir);
|
|
47909
|
+
const nexus = new NexusTool(projectDir);
|
|
47874
47910
|
renderInfo("Connecting to nexus P2P mesh...");
|
|
47875
47911
|
await nexus.execute({ action: "connect" });
|
|
47876
47912
|
await new Promise((r) => setTimeout(r, 3e3));
|
|
@@ -47909,8 +47945,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
47909
47945
|
}
|
|
47910
47946
|
}
|
|
47911
47947
|
try {
|
|
47912
|
-
const
|
|
47913
|
-
const nexus = new NexusTool2(projectDir);
|
|
47948
|
+
const nexus = new NexusTool(projectDir);
|
|
47914
47949
|
try {
|
|
47915
47950
|
await nexus.execute({ action: "connect" });
|
|
47916
47951
|
} catch {
|
|
@@ -48815,8 +48850,7 @@ async function showCohereDashboard(ctx) {
|
|
|
48815
48850
|
let stats = { queriesAnswered: 0, queriesSent: 0, insightsShared: 0, peersConnected: 0 };
|
|
48816
48851
|
let modelList = [];
|
|
48817
48852
|
try {
|
|
48818
|
-
const
|
|
48819
|
-
const nexus = new NexusTool2(ctx.repoRoot);
|
|
48853
|
+
const nexus = new NexusTool(ctx.repoRoot);
|
|
48820
48854
|
try {
|
|
48821
48855
|
const st = await nexus.execute({ action: "status" });
|
|
48822
48856
|
if (!st.success || !st.output.includes("connected")) {
|
|
@@ -48905,8 +48939,7 @@ async function showCohereDashboard(ctx) {
|
|
|
48905
48939
|
});
|
|
48906
48940
|
if (statResult.key === "refresh") {
|
|
48907
48941
|
try {
|
|
48908
|
-
const
|
|
48909
|
-
const nexus = new NexusTool2(ctx.repoRoot);
|
|
48942
|
+
const nexus = new NexusTool(ctx.repoRoot);
|
|
48910
48943
|
const r = await nexus.execute({ action: "cohere_stats" });
|
|
48911
48944
|
if (r.success) {
|
|
48912
48945
|
try {
|
|
@@ -48936,8 +48969,7 @@ async function showCohereDashboard(ctx) {
|
|
|
48936
48969
|
});
|
|
48937
48970
|
if (idResult.confirmed && idResult.key) {
|
|
48938
48971
|
try {
|
|
48939
|
-
const
|
|
48940
|
-
const ik = new IdentityKernelTool2(ctx.repoRoot);
|
|
48972
|
+
const ik = new IdentityKernelTool(ctx.repoRoot);
|
|
48941
48973
|
if (idResult.key === "publish") {
|
|
48942
48974
|
await ik.execute({ operation: "publish_snapshot" });
|
|
48943
48975
|
} else if (idResult.key === "view") {
|
|
@@ -48986,8 +49018,7 @@ async function showCohereDashboard(ctx) {
|
|
|
48986
49018
|
if (ipfsResult.confirmed && ipfsResult.key) {
|
|
48987
49019
|
if (ipfsResult.key === "cids") {
|
|
48988
49020
|
try {
|
|
48989
|
-
const
|
|
48990
|
-
const nexus = new NexusTool2(ctx.repoRoot);
|
|
49021
|
+
const nexus = new NexusTool(ctx.repoRoot);
|
|
48991
49022
|
const r = await nexus.execute({ action: "ipfs_ls" });
|
|
48992
49023
|
if (r.success) {
|
|
48993
49024
|
const data = JSON.parse(r.output);
|
|
@@ -49017,8 +49048,7 @@ async function showCohereDashboard(ctx) {
|
|
|
49017
49048
|
if (result.key.startsWith("model:")) {
|
|
49018
49049
|
const modelName = result.key.slice(6);
|
|
49019
49050
|
try {
|
|
49020
|
-
const
|
|
49021
|
-
const nexus = new NexusTool2(ctx.repoRoot);
|
|
49051
|
+
const nexus = new NexusTool(ctx.repoRoot);
|
|
49022
49052
|
await nexus.execute({ action: "cohere_allow_model", model: modelName });
|
|
49023
49053
|
} catch {
|
|
49024
49054
|
}
|
|
@@ -49709,8 +49739,7 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
49709
49739
|
const sponsors = [];
|
|
49710
49740
|
let nexusTool = null;
|
|
49711
49741
|
try {
|
|
49712
|
-
|
|
49713
|
-
nexusTool = new NexusTool2(ctx.repoRoot ?? process.cwd());
|
|
49742
|
+
nexusTool = new NexusTool(ctx.repoRoot ?? process.cwd());
|
|
49714
49743
|
} catch {
|
|
49715
49744
|
}
|
|
49716
49745
|
if (nexusTool) {
|
package/package.json
CHANGED