open-agents-ai 0.103.40 → 0.103.42
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 +41 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27783,6 +27783,9 @@ var init_expose = __esm({
|
|
|
27783
27783
|
super();
|
|
27784
27784
|
this.options = options;
|
|
27785
27785
|
this._kind = options.kind;
|
|
27786
|
+
if (options.kind === "custom" && !options.targetUrl) {
|
|
27787
|
+
throw new Error('ExposeGateway: targetUrl is required when kind is "custom"');
|
|
27788
|
+
}
|
|
27786
27789
|
this._targetUrl = options.targetUrl ?? DEFAULT_TARGETS[options.kind];
|
|
27787
27790
|
this._stateDir = options.stateDir ?? null;
|
|
27788
27791
|
this._fullAccess = options.fullAccess ?? false;
|
|
@@ -28476,6 +28479,9 @@ ${this.formatConnectionInfo()}`);
|
|
|
28476
28479
|
super();
|
|
28477
28480
|
this._nexusTool = nexusTool;
|
|
28478
28481
|
this._kind = options.kind;
|
|
28482
|
+
if (options.kind === "custom" && !options.targetUrl) {
|
|
28483
|
+
throw new Error('ExposeP2PGateway: targetUrl is required when kind is "custom"');
|
|
28484
|
+
}
|
|
28479
28485
|
this._targetUrl = options.targetUrl ?? DEFAULT_TARGETS[options.kind];
|
|
28480
28486
|
this._stateDir = options.stateDir ?? null;
|
|
28481
28487
|
this._margin = options.margin ?? 0.5;
|
|
@@ -34564,18 +34570,17 @@ async function handleEndpoint(arg, ctx, local = false) {
|
|
|
34564
34570
|
if (ctx.hasActiveTask?.()) {
|
|
34565
34571
|
ctx.abortActiveTask?.();
|
|
34566
34572
|
}
|
|
34567
|
-
|
|
34568
|
-
|
|
34569
|
-
const defaultSettings = { backendUrl: defaultUrl, backendType: "ollama", apiKey: void 0 };
|
|
34573
|
+
ctx.setEndpoint(DEFAULT_CONFIG.backendUrl, DEFAULT_CONFIG.backendType, void 0);
|
|
34574
|
+
const defaultSettings = { backendUrl: DEFAULT_CONFIG.backendUrl, backendType: DEFAULT_CONFIG.backendType, apiKey: void 0 };
|
|
34570
34575
|
if (local) {
|
|
34571
34576
|
ctx.saveLocalSettings(defaultSettings);
|
|
34572
34577
|
} else {
|
|
34573
|
-
setConfigValue("backendUrl",
|
|
34574
|
-
setConfigValue("backendType",
|
|
34578
|
+
setConfigValue("backendUrl", DEFAULT_CONFIG.backendUrl);
|
|
34579
|
+
setConfigValue("backendType", DEFAULT_CONFIG.backendType);
|
|
34575
34580
|
ctx.saveSettings(defaultSettings);
|
|
34576
34581
|
}
|
|
34577
34582
|
process.stdout.write(`
|
|
34578
|
-
${c2.green("\u2714")} Endpoint reset to local Ollama (${
|
|
34583
|
+
${c2.green("\u2714")} Endpoint reset to local Ollama (${DEFAULT_CONFIG.backendUrl})
|
|
34579
34584
|
`);
|
|
34580
34585
|
if (ctx.hasActiveTask?.()) {
|
|
34581
34586
|
renderWarning("Active task aborted \u2014 send a new prompt to continue.");
|
|
@@ -45959,11 +45964,11 @@ async function startInteractive(config, repoPath) {
|
|
|
45959
45964
|
let dreamEngine = null;
|
|
45960
45965
|
let blessEngine = null;
|
|
45961
45966
|
let dmnEngine = null;
|
|
45962
|
-
const snrEngine = new SNREngine(
|
|
45967
|
+
const snrEngine = new SNREngine(currentConfig, repoRoot);
|
|
45963
45968
|
const emotionEngine = new EmotionEngine({
|
|
45964
|
-
backendUrl:
|
|
45965
|
-
model:
|
|
45966
|
-
apiKey:
|
|
45969
|
+
backendUrl: currentConfig.backendUrl,
|
|
45970
|
+
model: currentConfig.model,
|
|
45971
|
+
apiKey: currentConfig.apiKey,
|
|
45967
45972
|
onEmotionUpdate: (state) => {
|
|
45968
45973
|
statusBar.setEmotion(state.emoji, state.label);
|
|
45969
45974
|
}
|
|
@@ -46121,7 +46126,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
46121
46126
|
const allCompletions = [.../* @__PURE__ */ new Set([...BUILTIN_COMMANDS, ...discoveredSkillNames])].sort();
|
|
46122
46127
|
let cachedModelNames = [];
|
|
46123
46128
|
function refreshModelCache() {
|
|
46124
|
-
fetchModels(
|
|
46129
|
+
fetchModels(currentConfig.backendUrl, currentConfig.apiKey).then((models) => {
|
|
46125
46130
|
cachedModelNames = models.map((m) => m.name);
|
|
46126
46131
|
}).catch(() => {
|
|
46127
46132
|
});
|
|
@@ -46232,24 +46237,24 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
46232
46237
|
(async () => {
|
|
46233
46238
|
if (!isResumed && !isFirstRun()) {
|
|
46234
46239
|
try {
|
|
46235
|
-
const available = await isModelAvailable(
|
|
46236
|
-
if (!available &&
|
|
46240
|
+
const available = await isModelAvailable(currentConfig);
|
|
46241
|
+
if (!available && currentConfig.backendType === "ollama") {
|
|
46237
46242
|
writeContent(() => {
|
|
46238
|
-
renderWarning(`Model "${
|
|
46243
|
+
renderWarning(`Model "${currentConfig.model}" not available. Use /model to pick one.`);
|
|
46239
46244
|
});
|
|
46240
46245
|
}
|
|
46241
46246
|
} catch {
|
|
46242
46247
|
}
|
|
46243
46248
|
}
|
|
46244
|
-
if (
|
|
46249
|
+
if (currentConfig.backendType === "ollama" && !currentConfig.model.startsWith("open-agents-")) {
|
|
46245
46250
|
try {
|
|
46246
|
-
const expandResult = await ensureExpandedContext(
|
|
46251
|
+
const expandResult = await ensureExpandedContext(currentConfig.model, currentConfig.backendUrl);
|
|
46247
46252
|
if (expandResult.created) {
|
|
46248
46253
|
config = { ...config, model: expandResult.model };
|
|
46249
46254
|
currentConfig = { ...currentConfig, model: expandResult.model };
|
|
46250
46255
|
statusBar.setModelName(expandResult.model);
|
|
46251
46256
|
writeContent(() => renderInfo(`Created expanded context model: ${expandResult.model} (${expandResult.contextLabel}, ${expandResult.numCtx} tokens)`));
|
|
46252
|
-
} else if (expandResult.model !==
|
|
46257
|
+
} else if (expandResult.model !== currentConfig.model) {
|
|
46253
46258
|
config = { ...config, model: expandResult.model };
|
|
46254
46259
|
currentConfig = { ...currentConfig, model: expandResult.model };
|
|
46255
46260
|
statusBar.setModelName(expandResult.model);
|
|
@@ -46260,19 +46265,19 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
46260
46265
|
}
|
|
46261
46266
|
if (!isResumed) {
|
|
46262
46267
|
try {
|
|
46263
|
-
const baseUrl = normalizeBaseUrl(
|
|
46264
|
-
const prov = detectProvider(
|
|
46268
|
+
const baseUrl = normalizeBaseUrl(currentConfig.backendUrl);
|
|
46269
|
+
const prov = detectProvider(currentConfig.backendUrl);
|
|
46265
46270
|
const healthUrl = `${baseUrl}${prov.modelsPath}`;
|
|
46266
46271
|
const headers = {};
|
|
46267
|
-
if (
|
|
46268
|
-
headers["Authorization"] = `Bearer ${
|
|
46272
|
+
if (currentConfig.apiKey)
|
|
46273
|
+
headers["Authorization"] = `Bearer ${currentConfig.apiKey}`;
|
|
46269
46274
|
const resp = await fetch(healthUrl, { headers, signal: AbortSignal.timeout(1e4) });
|
|
46270
46275
|
if (!resp.ok)
|
|
46271
46276
|
throw new Error(`HTTP ${resp.status}`);
|
|
46272
46277
|
} catch {
|
|
46273
|
-
const prov = detectProvider(
|
|
46278
|
+
const prov = detectProvider(currentConfig.backendUrl);
|
|
46274
46279
|
writeContent(() => {
|
|
46275
|
-
renderWarning(`Cannot reach ${prov.label} at ${
|
|
46280
|
+
renderWarning(`Cannot reach ${prov.label} at ${currentConfig.backendUrl}`);
|
|
46276
46281
|
if (prov.id === "ollama") {
|
|
46277
46282
|
renderInfo("Use /endpoint http://127.0.0.1:11434 to auto-install & start Ollama.");
|
|
46278
46283
|
}
|
|
@@ -46970,7 +46975,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
46970
46975
|
let targetUrl;
|
|
46971
46976
|
if (kindOrUrl === "passthrough" || passthrough) {
|
|
46972
46977
|
kind = "custom";
|
|
46973
|
-
targetUrl = normalizeBaseUrl(
|
|
46978
|
+
targetUrl = normalizeBaseUrl(currentConfig.backendUrl);
|
|
46974
46979
|
passthrough = true;
|
|
46975
46980
|
} else if (knownKinds.includes(kindOrUrl)) {
|
|
46976
46981
|
kind = kindOrUrl;
|
|
@@ -46999,7 +47004,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
46999
47004
|
stateDir: join50(repoRoot, ".oa"),
|
|
47000
47005
|
passthrough: passthrough ?? false,
|
|
47001
47006
|
loadbalance: loadbalance ?? false,
|
|
47002
|
-
endpointAuth: passthrough ?
|
|
47007
|
+
endpointAuth: passthrough ? currentConfig.apiKey : void 0,
|
|
47003
47008
|
onInfo: (msg) => {
|
|
47004
47009
|
exposeSpinnerMsg = msg;
|
|
47005
47010
|
},
|
|
@@ -47132,9 +47137,18 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
47132
47137
|
throw new Error("P2P mesh is already running");
|
|
47133
47138
|
let models = [];
|
|
47134
47139
|
try {
|
|
47135
|
-
const
|
|
47140
|
+
const meshProvider = detectProvider(commandCtx.config.backendUrl);
|
|
47141
|
+
const meshBaseUrl = normalizeBaseUrl(commandCtx.config.backendUrl);
|
|
47142
|
+
const meshHeaders = {};
|
|
47143
|
+
if (commandCtx.config.apiKey)
|
|
47144
|
+
meshHeaders["Authorization"] = `Bearer ${commandCtx.config.apiKey}`;
|
|
47145
|
+
const resp = await fetch(`${meshBaseUrl}${meshProvider.modelsPath}`, { headers: meshHeaders });
|
|
47136
47146
|
const data = await resp.json();
|
|
47137
|
-
|
|
47147
|
+
if (data.models) {
|
|
47148
|
+
models = data.models.map((m) => m.name);
|
|
47149
|
+
} else if (data.data) {
|
|
47150
|
+
models = data.data.map((m) => m.id ?? m.name ?? "unknown");
|
|
47151
|
+
}
|
|
47138
47152
|
} catch {
|
|
47139
47153
|
}
|
|
47140
47154
|
peerMesh = new PeerMesh({
|
package/package.json
CHANGED