@openagents-org/agent-launcher 0.2.196 → 0.2.198
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/package.json +1 -1
- package/src/adapters/openclaw.js +7 -0
- package/src/daemon.js +7 -0
- package/src/index.js +28 -29
package/package.json
CHANGED
package/src/adapters/openclaw.js
CHANGED
|
@@ -680,6 +680,13 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
680
680
|
config.models.providers.custom = {
|
|
681
681
|
baseUrl: baseUrl.replace(/\/+$/, ''),
|
|
682
682
|
apiKey,
|
|
683
|
+
// Without it OpenClaw tries its stored auth profiles BEFORE this
|
|
684
|
+
// apiKey (model-auth-provider-config: shouldPreferExplicitConfig-
|
|
685
|
+
// ApiKeyAuth). A `custom` token profile an older launcher wrote, and
|
|
686
|
+
// `openclaw doctor --fix` copied into SQLite, then outranks every key
|
|
687
|
+
// saved since: the test passes on the new key, the run sends the old
|
|
688
|
+
// one, and the relay answers "Invalid token".
|
|
689
|
+
auth: 'api-key',
|
|
683
690
|
api: 'openai-completions',
|
|
684
691
|
models: [{ id: model, name: model }],
|
|
685
692
|
};
|
package/src/daemon.js
CHANGED
|
@@ -506,6 +506,7 @@ class Daemon {
|
|
|
506
506
|
workingDir: a.path || null,
|
|
507
507
|
apiKeyMasked: apiKey ? maskApiKey(apiKey) : null,
|
|
508
508
|
baseUrlHost: endpointHost(this._configuredBaseUrl(a, typeEnv)),
|
|
509
|
+
codexWireApi: a.type === 'codex' ? ((a.env && a.env.CODEX_WIRE_API) || typeEnv.CODEX_WIRE_API || 'chat') : null,
|
|
509
510
|
cliModels: listed && listed.models && this._onCliSignIn(a) ? listed.models : null,
|
|
510
511
|
probe: this._probes[a.name] || null,
|
|
511
512
|
});
|
|
@@ -621,6 +622,12 @@ class Daemon {
|
|
|
621
622
|
*/
|
|
622
623
|
_saveNodeAgentEnv(name, type, args) {
|
|
623
624
|
const changes = {};
|
|
625
|
+
if (type === 'codex' && args.codexWireApi !== undefined) {
|
|
626
|
+
if (!['responses', 'chat'].includes(args.codexWireApi)) {
|
|
627
|
+
throw new Error('Choose Responses or Chat Completions for Codex');
|
|
628
|
+
}
|
|
629
|
+
changes.CODEX_WIRE_API = args.codexWireApi;
|
|
630
|
+
}
|
|
624
631
|
if (_sentKey(args)) {
|
|
625
632
|
changes.LLM_API_KEY = args.apiKey;
|
|
626
633
|
// A key sent for the agent means it runs on that key: a sign-in marker
|
package/src/index.js
CHANGED
|
@@ -100,10 +100,34 @@ class AgentConnector {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
addAgent({ name, type, role, path, env }) {
|
|
103
|
-
|
|
103
|
+
const agentType = type || 'openclaw';
|
|
104
|
+
this.config.addAgent({ name, type: agentType, role: role || 'worker', path, env });
|
|
105
|
+
// A key entered while ADDING the agent needs the same native side effects
|
|
106
|
+
// as one saved later: OpenClaw and Hermes read a custom endpoint only from
|
|
107
|
+
// their own config. Without this a new agent's test passed on the form's
|
|
108
|
+
// key while the run used a stale one ("401 Invalid token") or none at all
|
|
109
|
+
// (Hermes falling back to OpenRouter: "401 Missing Authentication header").
|
|
110
|
+
if (env && Object.keys(env).length) {
|
|
111
|
+
this._configureNativeAuth(agentType, { ...this.env.load(agentType), ...env });
|
|
112
|
+
}
|
|
104
113
|
return { success: true };
|
|
105
114
|
}
|
|
106
115
|
|
|
116
|
+
/** Push an agent's endpoint and key into the CLI's own config, for the types that need it. */
|
|
117
|
+
_configureNativeAuth(agentType, env) {
|
|
118
|
+
try {
|
|
119
|
+
if (agentType === 'openclaw') {
|
|
120
|
+
require('./adapters/openclaw').configureNativeAuth(env);
|
|
121
|
+
}
|
|
122
|
+
// Hermes reads a custom endpoint only from its own config.yaml, so the
|
|
123
|
+
// saved LLM_* values must be pushed through `hermes config set` — the
|
|
124
|
+
// env file alone leaves it "No inference provider configured".
|
|
125
|
+
if (agentType === 'hermes') {
|
|
126
|
+
require('./adapters/hermes').configureNativeAuth(env);
|
|
127
|
+
}
|
|
128
|
+
} catch {}
|
|
129
|
+
}
|
|
130
|
+
|
|
107
131
|
/**
|
|
108
132
|
* The workspace an agent is bound to, as a ready-to-use client — or null
|
|
109
133
|
* when it is local-only or its network is no longer configured.
|
|
@@ -212,22 +236,7 @@ class AgentConnector {
|
|
|
212
236
|
|
|
213
237
|
saveAgentEnv(agentType, env) {
|
|
214
238
|
this.env.save(agentType, env);
|
|
215
|
-
|
|
216
|
-
try {
|
|
217
|
-
if (agentType === 'openclaw') {
|
|
218
|
-
const OpenClawAdapter = require('./adapters/openclaw');
|
|
219
|
-
const saved = this.env.load(agentType);
|
|
220
|
-
OpenClawAdapter.configureNativeAuth(saved);
|
|
221
|
-
}
|
|
222
|
-
// Hermes reads a custom endpoint only from its own config.yaml, so the
|
|
223
|
-
// saved LLM_* values must be pushed through `hermes config set` — the
|
|
224
|
-
// env file alone leaves it "No inference provider configured".
|
|
225
|
-
if (agentType === 'hermes') {
|
|
226
|
-
const HermesAdapter = require('./adapters/hermes');
|
|
227
|
-
const saved = this.env.load(agentType);
|
|
228
|
-
HermesAdapter.configureNativeAuth(saved);
|
|
229
|
-
}
|
|
230
|
-
} catch {}
|
|
239
|
+
this._configureNativeAuth(agentType, this.env.load(agentType));
|
|
231
240
|
return { success: true };
|
|
232
241
|
}
|
|
233
242
|
|
|
@@ -249,18 +258,8 @@ class AgentConnector {
|
|
|
249
258
|
|
|
250
259
|
// Preserve native auth side effects for agents that need them while
|
|
251
260
|
// keeping the model choice scoped to this individual agent.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const OpenClawAdapter = require('./adapters/openclaw');
|
|
255
|
-
const typeEnv = this.env.load(agent.type || 'openclaw');
|
|
256
|
-
OpenClawAdapter.configureNativeAuth({ ...typeEnv, ...saved });
|
|
257
|
-
}
|
|
258
|
-
if (agent.type === 'hermes') {
|
|
259
|
-
const HermesAdapter = require('./adapters/hermes');
|
|
260
|
-
const typeEnv = this.env.load('hermes');
|
|
261
|
-
HermesAdapter.configureNativeAuth({ ...typeEnv, ...saved });
|
|
262
|
-
}
|
|
263
|
-
} catch {}
|
|
261
|
+
const agentType = agent.type || 'openclaw';
|
|
262
|
+
this._configureNativeAuth(agentType, { ...this.env.load(agentType), ...saved });
|
|
264
263
|
|
|
265
264
|
return { success: true };
|
|
266
265
|
}
|