@openagents-org/agent-launcher 0.2.163 → 0.2.164
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/daemon.js +14 -4
package/package.json
CHANGED
package/src/daemon.js
CHANGED
|
@@ -136,6 +136,18 @@ class Daemon {
|
|
|
136
136
|
* so the (synchronous, execSync-heavy) version/login probes never block the
|
|
137
137
|
* daemon's event loop. Result is reported to the workspace on the heartbeat.
|
|
138
138
|
*/
|
|
139
|
+
/**
|
|
140
|
+
* Persist an agent's model. Sets the generic LLM_MODEL (used by LLM-direct
|
|
141
|
+
* adapters) plus the env var the agent's own CLI reads, so a model picked in
|
|
142
|
+
* the workspace actually takes effect (e.g. Claude reads ANTHROPIC_MODEL).
|
|
143
|
+
*/
|
|
144
|
+
async _setModelEnv(type, model) {
|
|
145
|
+
const val = String(model || '');
|
|
146
|
+
const nativeVar = { claude: 'ANTHROPIC_MODEL', gemini: 'GEMINI_MODEL' }[type];
|
|
147
|
+
await this._runAgn(['env', type, '--set', `LLM_MODEL=${val}`]);
|
|
148
|
+
if (nativeVar) await this._runAgn(['env', type, '--set', `${nativeVar}=${val}`]);
|
|
149
|
+
}
|
|
150
|
+
|
|
139
151
|
async _refreshRuntimes() {
|
|
140
152
|
try {
|
|
141
153
|
const r = await this._runAgn(['runtimes', '--json']);
|
|
@@ -174,7 +186,7 @@ class Daemon {
|
|
|
174
186
|
// Optional credentials for API-key agents (generic → provider mapping
|
|
175
187
|
// happens in env resolution).
|
|
176
188
|
if (args.apiKey) await this._runAgn(['env', type, '--set', `LLM_API_KEY=${args.apiKey}`]);
|
|
177
|
-
if (args.model) await this.
|
|
189
|
+
if (args.model) await this._setModelEnv(type, args.model);
|
|
178
190
|
if (args.baseUrl) await this._runAgn(['env', type, '--set', `LLM_BASE_URL=${args.baseUrl}`]);
|
|
179
191
|
// Attach to this node's workspace so the agent shows up as a member.
|
|
180
192
|
const r2 = await this._runAgn(['connect', name, n.token, '--endpoint', n.endpoint]);
|
|
@@ -199,9 +211,7 @@ class Daemon {
|
|
|
199
211
|
// recreate (agn has no in-place path change) at the new path.
|
|
200
212
|
const type = (args.type || '').trim();
|
|
201
213
|
if (args.apiKey) await this._runAgn(['env', type, '--set', `LLM_API_KEY=${args.apiKey}`]);
|
|
202
|
-
if (args.model !== undefined)
|
|
203
|
-
await this._runAgn(['env', type, '--set', `LLM_MODEL=${String(args.model || '')}`]);
|
|
204
|
-
}
|
|
214
|
+
if (args.model !== undefined) await this._setModelEnv(type, args.model);
|
|
205
215
|
const newDir = (args.workingDir || '').trim();
|
|
206
216
|
if (newDir && newDir !== (args.currentWorkingDir || '')) {
|
|
207
217
|
try { fs.mkdirSync(newDir, { recursive: true }); } catch {}
|