@openagents-org/agent-launcher 0.2.160 → 0.2.161

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/daemon.js +36 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openagents-org/agent-launcher",
3
- "version": "0.2.160",
3
+ "version": "0.2.161",
4
4
  "description": "OpenAgents Launcher \u2014 install, configure, and run AI coding agents from your terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/daemon.js CHANGED
@@ -80,7 +80,19 @@ class Daemon {
80
80
  try {
81
81
  for (const a of this.config.getAgents()) {
82
82
  const proc = this._processes[a.name];
83
- roster.push({ name: a.name, type: a.type || 'unknown', status: (proc && proc.state) || 'stopped' });
83
+ // Model: per-agent env override, else the type-level saved model. Working
84
+ // dir: the agent's configured path. Both power the workspace agent cards.
85
+ let model = (a.env && a.env.LLM_MODEL) || null;
86
+ if (!model) {
87
+ try { model = (this.envManager.load(a.type) || {}).LLM_MODEL || null; } catch { model = null; }
88
+ }
89
+ roster.push({
90
+ name: a.name,
91
+ type: a.type || 'unknown',
92
+ status: (proc && proc.state) || 'stopped',
93
+ model: model || null,
94
+ workingDir: a.path || null,
95
+ });
84
96
  }
85
97
  } catch {
86
98
  // best-effort
@@ -150,6 +162,29 @@ class Daemon {
150
162
  const r = await this._runAgn(['remove', name]);
151
163
  ok = r.code === 0;
152
164
  message = ok ? `Agent '${name}' removed` : (r.stderr || r.stdout || 'remove failed');
165
+ } else if (action === 'configure_agent') {
166
+ // Reconfigure an existing agent: update model/key (type-level env), then
167
+ // restart it so the change takes effect. Working-dir changes require a
168
+ // recreate (agn has no in-place path change) at the new path.
169
+ const type = (args.type || '').trim();
170
+ if (args.apiKey) await this._runAgn(['env', type, '--set', `LLM_API_KEY=${args.apiKey}`]);
171
+ if (args.model !== undefined) {
172
+ await this._runAgn(['env', type, '--set', `LLM_MODEL=${String(args.model || '')}`]);
173
+ }
174
+ const newDir = (args.workingDir || '').trim();
175
+ if (newDir && newDir !== (args.currentWorkingDir || '')) {
176
+ try { fs.mkdirSync(newDir, { recursive: true }); } catch {}
177
+ await this._runAgn(['remove', name]);
178
+ const rc = await this._runAgn(['create', name, '--type', type, '--install', '--path', newDir]);
179
+ if (rc.code !== 0) throw new Error(rc.stderr || rc.stdout || 'recreate failed');
180
+ const rc2 = await this._runAgn(['connect', name, n.token, '--endpoint', n.endpoint]);
181
+ if (rc2.code !== 0) throw new Error(rc2.stderr || rc2.stdout || 'connect failed');
182
+ } else {
183
+ await this._runAgn(['stop', name]);
184
+ await this._runAgn(['start', name]);
185
+ }
186
+ ok = true;
187
+ message = `Agent '${name}' reconfigured`;
153
188
  } else if (action === 'detect_runtimes') {
154
189
  await this._refreshRuntimes();
155
190
  // Push the fresh detection right away rather than waiting for the next