volute 0.8.3 → 0.9.0

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 (27) hide show
  1. package/dist/{agent-YORVRB6I.js → agent-MB3OTRRK.js} +8 -8
  2. package/dist/api-client-YPKOZP2O.js +10 -0
  3. package/dist/{channel-RDGHBFSI.js → channel-G5D4VBXY.js} +67 -82
  4. package/dist/chunk-4RQBJWQX.js +17 -0
  5. package/dist/{chunk-23L3MKEV.js → chunk-STOEJOJO.js} +18 -4
  6. package/dist/cli.js +11 -11
  7. package/dist/{connector-ZP6MEFF4.js → connector-PK7D5GTN.js} +38 -21
  8. package/dist/{daemon-client-54J3EIZD.js → daemon-client-P44NU3KU.js} +1 -1
  9. package/dist/{daemon-restart-IMNCBWFV.js → daemon-restart-EKDXXHKH.js} +1 -1
  10. package/dist/daemon.js +252 -56
  11. package/dist/{delete-45TGQC4N.js → delete-WKQKE3FT.js} +7 -4
  12. package/dist/{env-KMNYGVZ2.js → env-HZMZSWWD.js} +85 -36
  13. package/dist/{history-PXJVYLVY.js → history-SH25BAA5.js} +13 -10
  14. package/dist/logs-V54B6QSG.js +77 -0
  15. package/dist/{package-2S7APQBC.js → package-WPX6LCYE.js} +1 -1
  16. package/dist/{restart-KVH3TK5N.js → restart-CCYM3MEC.js} +10 -4
  17. package/dist/{schedule-HCUCBNQI.js → schedule-XGBUF7NU.js} +26 -10
  18. package/dist/{send-BNC2S5BY.js → send-TFZ62XPZ.js} +37 -29
  19. package/dist/{start-QU73YTJW.js → start-6YRS6FF6.js} +7 -2
  20. package/dist/{status-Q6ZQJXNI.js → status-SIMKH3ZE.js} +8 -3
  21. package/dist/{stop-N7U5N6A7.js → stop-UQSNF4CG.js} +7 -2
  22. package/dist/{up-RZJMSVQS.js → up-J7AHQHIM.js} +1 -1
  23. package/dist/{upgrade-CZF6PN7Y.js → upgrade-BRNMSQBX.js} +13 -4
  24. package/dist/{variant-RKXPN5DH.js → variant-AQRAN6FR.js} +32 -15
  25. package/package.json +1 -1
  26. package/dist/logs-TZB3MTLZ.js +0 -37
  27. /package/dist/{chunk-6RDCTVQK.js → chunk-AWHQZDB4.js} +0 -0
@@ -1,27 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- agentEnvPath,
4
- loadMergedEnv,
5
- readEnv,
6
- sharedEnvPath,
7
- writeEnv
8
- } from "./chunk-QF22MYDJ.js";
3
+ daemonFetch
4
+ } from "./chunk-STOEJOJO.js";
9
5
  import {
10
6
  parseArgs
11
7
  } from "./chunk-D424ZQGI.js";
8
+ import "./chunk-DP2DX4WV.js";
12
9
  import {
13
- findAgent
14
- } from "./chunk-DP2DX4WV.js";
10
+ getClient,
11
+ urlOf
12
+ } from "./chunk-4RQBJWQX.js";
15
13
  import "./chunk-K3NQKI34.js";
16
14
 
17
15
  // src/commands/env.ts
18
- function getEnvPath(agentName) {
19
- if (agentName) {
20
- if (!findAgent(agentName)) throw new Error(`Unknown agent: ${agentName}`);
21
- return agentEnvPath(agentName);
22
- }
23
- return sharedEnvPath();
24
- }
25
16
  async function promptValue(key) {
26
17
  process.stderr.write(`Enter value for ${key}: `);
27
18
  if (process.stdin.isTTY) process.stdin.setRawMode(true);
@@ -62,6 +53,7 @@ async function run(args) {
62
53
  reveal: { type: "boolean" }
63
54
  });
64
55
  const subcommand = positional[0];
56
+ const client = getClient();
65
57
  switch (subcommand) {
66
58
  case "set": {
67
59
  const key = positional[1];
@@ -70,10 +62,32 @@ async function run(args) {
70
62
  process.exit(1);
71
63
  }
72
64
  const value = positional[2] ?? await promptValue(key);
73
- const path = getEnvPath(flags.agent);
74
- const env = readEnv(path);
75
- env[key] = value;
76
- writeEnv(path, env);
65
+ let res;
66
+ if (flags.agent) {
67
+ res = await daemonFetch(
68
+ urlOf(
69
+ client.api.agents[":name"].env[":key"].$url({
70
+ param: { name: flags.agent, key }
71
+ })
72
+ ),
73
+ {
74
+ method: "PUT",
75
+ headers: { "Content-Type": "application/json" },
76
+ body: JSON.stringify({ value })
77
+ }
78
+ );
79
+ } else {
80
+ res = await daemonFetch(urlOf(client.api.env[":key"].$url({ param: { key } })), {
81
+ method: "PUT",
82
+ headers: { "Content-Type": "application/json" },
83
+ body: JSON.stringify({ value })
84
+ });
85
+ }
86
+ if (!res.ok) {
87
+ const body = await res.json().catch(() => ({}));
88
+ console.error(body.error ?? `Failed to set ${key}`);
89
+ process.exit(1);
90
+ }
77
91
  const scope = flags.agent ? `agent:${flags.agent}` : "shared";
78
92
  console.log(`Set ${key} [${scope}]`);
79
93
  break;
@@ -85,15 +99,27 @@ async function run(args) {
85
99
  process.exit(1);
86
100
  }
87
101
  if (flags.agent) {
88
- const merged = loadMergedEnv(flags.agent);
89
- if (key in merged) {
90
- console.log(merged[key]);
91
- } else {
92
- console.error(`${key} not set`);
102
+ const res = await daemonFetch(
103
+ urlOf(
104
+ client.api.agents[":name"].env[":key"].$url({
105
+ param: { name: flags.agent, key }
106
+ })
107
+ )
108
+ );
109
+ if (!res.ok) {
110
+ const body = await res.json().catch(() => ({}));
111
+ console.error(body.error ?? `${key} not set`);
93
112
  process.exit(1);
94
113
  }
114
+ const data = await res.json();
115
+ console.log(data.value);
95
116
  } else {
96
- const env = readEnv(sharedEnvPath());
117
+ const res = await daemonFetch(urlOf(client.api.env.$url()));
118
+ if (!res.ok) {
119
+ console.error(`Failed to read shared env`);
120
+ process.exit(1);
121
+ }
122
+ const env = await res.json();
97
123
  if (key in env) {
98
124
  console.log(env[key]);
99
125
  } else {
@@ -105,21 +131,33 @@ async function run(args) {
105
131
  }
106
132
  case "list": {
107
133
  if (flags.agent) {
108
- const shared = readEnv(sharedEnvPath());
109
- const agent = readEnv(agentEnvPath(flags.agent));
110
- const allKeys = /* @__PURE__ */ new Set([...Object.keys(shared), ...Object.keys(agent)]);
134
+ const res = await daemonFetch(
135
+ urlOf(client.api.agents[":name"].env.$url({ param: { name: flags.agent } }))
136
+ );
137
+ if (!res.ok) {
138
+ const body = await res.json().catch(() => ({}));
139
+ console.error(body.error ?? "Failed to list env");
140
+ process.exit(1);
141
+ }
142
+ const data = await res.json();
143
+ const allKeys = /* @__PURE__ */ new Set([...Object.keys(data.shared), ...Object.keys(data.agent)]);
111
144
  if (allKeys.size === 0) {
112
145
  console.log("No environment variables set.");
113
146
  return;
114
147
  }
115
148
  for (const key of [...allKeys].sort()) {
116
- const scope = key in agent ? "agent" : "shared";
117
- const raw = key in agent ? agent[key] : shared[key];
149
+ const scope = key in data.agent ? "agent" : "shared";
150
+ const raw = key in data.agent ? data.agent[key] : data.shared[key];
118
151
  const value = flags.reveal ? raw : maskValue(raw);
119
152
  console.log(`${key}=${value} [${scope}]`);
120
153
  }
121
154
  } else {
122
- const env = readEnv(sharedEnvPath());
155
+ const res = await daemonFetch(urlOf(client.api.env.$url()));
156
+ if (!res.ok) {
157
+ console.error("Failed to list shared env");
158
+ process.exit(1);
159
+ }
160
+ const env = await res.json();
123
161
  const keys = Object.keys(env);
124
162
  if (keys.length === 0) {
125
163
  console.log("No shared environment variables set.");
@@ -138,15 +176,26 @@ async function run(args) {
138
176
  console.error("Usage: volute env remove <KEY> [--agent <name>]");
139
177
  process.exit(1);
140
178
  }
141
- const path = getEnvPath(flags.agent);
142
- const env = readEnv(path);
143
- if (!(key in env)) {
179
+ let res;
180
+ if (flags.agent) {
181
+ res = await daemonFetch(
182
+ urlOf(
183
+ client.api.agents[":name"].env[":key"].$url({
184
+ param: { name: flags.agent, key }
185
+ })
186
+ ),
187
+ { method: "DELETE" }
188
+ );
189
+ } else {
190
+ res = await daemonFetch(urlOf(client.api.env[":key"].$url({ param: { key } })), {
191
+ method: "DELETE"
192
+ });
193
+ }
194
+ if (!res.ok) {
144
195
  const scope2 = flags.agent ? `agent:${flags.agent}` : "shared";
145
196
  console.error(`${key} not set in ${scope2} scope`);
146
197
  process.exit(1);
147
198
  }
148
- delete env[key];
149
- writeEnv(path, env);
150
199
  const scope = flags.agent ? `agent:${flags.agent}` : "shared";
151
200
  console.log(`Removed ${key} [${scope}]`);
152
201
  break;
@@ -2,13 +2,17 @@
2
2
  import {
3
3
  resolveAgentName
4
4
  } from "./chunk-AZEL2IEK.js";
5
+ import {
6
+ daemonFetch
7
+ } from "./chunk-STOEJOJO.js";
5
8
  import {
6
9
  parseArgs
7
10
  } from "./chunk-D424ZQGI.js";
8
- import {
9
- daemonFetch
10
- } from "./chunk-23L3MKEV.js";
11
11
  import "./chunk-DP2DX4WV.js";
12
+ import {
13
+ getClient,
14
+ urlOf
15
+ } from "./chunk-4RQBJWQX.js";
12
16
  import "./chunk-K3NQKI34.js";
13
17
 
14
18
  // src/commands/history.ts
@@ -19,12 +23,11 @@ async function run(args) {
19
23
  limit: { type: "string" }
20
24
  });
21
25
  const name = resolveAgentName(flags);
22
- const params = new URLSearchParams();
23
- if (flags.channel) params.set("channel", flags.channel);
24
- if (flags.limit) params.set("limit", flags.limit);
25
- const qs = params.toString();
26
- const path = `/api/agents/${encodeURIComponent(name)}/history${qs ? `?${qs}` : ""}`;
27
- const res = await daemonFetch(path);
26
+ const client = getClient();
27
+ const url = client.api.agents[":name"].history.$url({ param: { name } });
28
+ if (flags.channel) url.searchParams.set("channel", flags.channel);
29
+ if (flags.limit) url.searchParams.set("limit", flags.limit);
30
+ const res = await daemonFetch(urlOf(url));
28
31
  if (!res.ok) {
29
32
  let errorMsg = `Failed to get history: ${res.status}`;
30
33
  try {
@@ -38,7 +41,7 @@ async function run(args) {
38
41
  const rows = await res.json();
39
42
  for (const row of rows.reverse()) {
40
43
  const time = new Date(row.created_at).toLocaleString();
41
- const sender = row.sender ?? row.role;
44
+ const sender = row.sender ?? "assistant";
42
45
  console.log(`[${time}] [${row.channel}] ${sender}: ${row.content}`);
43
46
  }
44
47
  }
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ resolveAgentName
4
+ } from "./chunk-AZEL2IEK.js";
5
+ import {
6
+ daemonFetch
7
+ } from "./chunk-STOEJOJO.js";
8
+ import {
9
+ parseArgs
10
+ } from "./chunk-D424ZQGI.js";
11
+ import "./chunk-DP2DX4WV.js";
12
+ import {
13
+ getClient,
14
+ urlOf
15
+ } from "./chunk-4RQBJWQX.js";
16
+ import "./chunk-K3NQKI34.js";
17
+
18
+ // src/commands/logs.ts
19
+ async function run(args) {
20
+ const { flags } = parseArgs(args, {
21
+ agent: { type: "string" },
22
+ follow: { type: "boolean" },
23
+ n: { type: "number" }
24
+ });
25
+ const name = resolveAgentName(flags);
26
+ const client = getClient();
27
+ if (flags.follow) {
28
+ const res = await daemonFetch(urlOf(client.api.agents[":name"].logs.$url({ param: { name } })));
29
+ if (!res.ok) {
30
+ const body = await res.json().catch(() => ({}));
31
+ console.error(body.error ?? `Server responded with ${res.status}`);
32
+ process.exit(1);
33
+ }
34
+ if (!res.body) {
35
+ console.error("Server returned an empty response body for log streaming.");
36
+ process.exit(1);
37
+ }
38
+ const reader = res.body.getReader();
39
+ const decoder = new TextDecoder();
40
+ let buffer = "";
41
+ try {
42
+ while (true) {
43
+ const { done, value } = await reader.read();
44
+ if (done) break;
45
+ buffer += decoder.decode(value, { stream: true });
46
+ const lines = buffer.split("\n");
47
+ buffer = lines.pop();
48
+ for (const line of lines) {
49
+ if (line.startsWith("data: ")) {
50
+ process.stdout.write(`${line.slice(6)}
51
+ `);
52
+ }
53
+ }
54
+ }
55
+ } catch (err) {
56
+ const isCleanClose = err instanceof Error && (err.name === "AbortError" || err.code === "ECONNRESET");
57
+ if (!isCleanClose) {
58
+ console.error(`Log stream error: ${err instanceof Error ? err.message : String(err)}`);
59
+ process.exit(1);
60
+ }
61
+ }
62
+ } else {
63
+ const n = flags.n ?? 50;
64
+ const url = client.api.agents[":name"].logs.tail.$url({ param: { name } });
65
+ url.searchParams.set("n", String(n));
66
+ const res = await daemonFetch(urlOf(url));
67
+ if (!res.ok) {
68
+ const body = await res.json().catch(() => ({}));
69
+ console.error(body.error ?? `Server responded with ${res.status}`);
70
+ process.exit(1);
71
+ }
72
+ console.log(await res.text());
73
+ }
74
+ }
75
+ export {
76
+ run
77
+ };
@@ -4,7 +4,7 @@ import "./chunk-K3NQKI34.js";
4
4
  // package.json
5
5
  var package_default = {
6
6
  name: "volute",
7
- version: "0.8.3",
7
+ version: "0.9.0",
8
8
  description: "CLI for creating and managing self-modifying AI agents powered by the Claude Agent SDK",
9
9
  type: "module",
10
10
  license: "MIT",
@@ -4,19 +4,25 @@ import {
4
4
  } from "./chunk-AZEL2IEK.js";
5
5
  import {
6
6
  daemonFetch
7
- } from "./chunk-23L3MKEV.js";
7
+ } from "./chunk-STOEJOJO.js";
8
8
  import {
9
9
  resolveAgent
10
10
  } from "./chunk-DP2DX4WV.js";
11
+ import {
12
+ getClient,
13
+ urlOf
14
+ } from "./chunk-4RQBJWQX.js";
11
15
  import "./chunk-K3NQKI34.js";
12
16
 
13
17
  // src/commands/restart.ts
14
18
  async function run(args) {
15
19
  const name = resolveAgentName({ agent: args[0] });
16
20
  const { entry } = resolveAgent(name);
17
- const res = await daemonFetch(`/api/agents/${encodeURIComponent(name)}/restart`, {
18
- method: "POST"
19
- });
21
+ const client = getClient();
22
+ const res = await daemonFetch(
23
+ urlOf(client.api.agents[":name"].restart.$url({ param: { name } })),
24
+ { method: "POST" }
25
+ );
20
26
  const data = await res.json();
21
27
  if (!res.ok) {
22
28
  console.error(data.error || "Failed to restart agent");
@@ -2,13 +2,17 @@
2
2
  import {
3
3
  resolveAgentName
4
4
  } from "./chunk-AZEL2IEK.js";
5
+ import {
6
+ daemonFetch
7
+ } from "./chunk-STOEJOJO.js";
5
8
  import {
6
9
  parseArgs
7
10
  } from "./chunk-D424ZQGI.js";
8
- import {
9
- daemonFetch
10
- } from "./chunk-23L3MKEV.js";
11
11
  import "./chunk-DP2DX4WV.js";
12
+ import {
13
+ getClient,
14
+ urlOf
15
+ } from "./chunk-4RQBJWQX.js";
12
16
  import "./chunk-K3NQKI34.js";
13
17
 
14
18
  // src/commands/schedule.ts
@@ -45,7 +49,10 @@ async function listSchedules(args) {
45
49
  agent: { type: "string" }
46
50
  });
47
51
  const agent = resolveAgentName(flags);
48
- const res = await daemonFetch(`/api/agents/${encodeURIComponent(agent)}/schedules`);
52
+ const client = getClient();
53
+ const res = await daemonFetch(
54
+ urlOf(client.api.agents[":name"].schedules.$url({ param: { name: agent } }))
55
+ );
49
56
  if (!res.ok) {
50
57
  const data = await res.json();
51
58
  console.error(data.error ?? `Failed to list schedules: ${res.status}`);
@@ -79,11 +86,15 @@ async function addSchedule(args) {
79
86
  }
80
87
  const body = { cron: flags.cron, message: flags.message };
81
88
  if (flags.id) body.id = flags.id;
82
- const res = await daemonFetch(`/api/agents/${encodeURIComponent(agent)}/schedules`, {
83
- method: "POST",
84
- headers: { "Content-Type": "application/json" },
85
- body: JSON.stringify(body)
86
- });
89
+ const client = getClient();
90
+ const res = await daemonFetch(
91
+ urlOf(client.api.agents[":name"].schedules.$url({ param: { name: agent } })),
92
+ {
93
+ method: "POST",
94
+ headers: { "Content-Type": "application/json" },
95
+ body: JSON.stringify(body)
96
+ }
97
+ );
87
98
  if (!res.ok) {
88
99
  const data2 = await res.json();
89
100
  console.error(data2.error ?? `Failed to add schedule: ${res.status}`);
@@ -102,8 +113,13 @@ async function removeSchedule(args) {
102
113
  console.error("--id is required");
103
114
  process.exit(1);
104
115
  }
116
+ const client = getClient();
105
117
  const res = await daemonFetch(
106
- `/api/agents/${encodeURIComponent(agent)}/schedules/${encodeURIComponent(flags.id)}`,
118
+ urlOf(
119
+ client.api.agents[":name"].schedules[":id"].$url({
120
+ param: { name: agent, id: flags.id }
121
+ })
122
+ ),
107
123
  { method: "DELETE" }
108
124
  );
109
125
  if (!res.ok) {
@@ -2,22 +2,21 @@
2
2
  import {
3
3
  resolveAgentName
4
4
  } from "./chunk-AZEL2IEK.js";
5
+ import {
6
+ daemonFetch
7
+ } from "./chunk-STOEJOJO.js";
5
8
  import {
6
9
  getChannelDriver
7
10
  } from "./chunk-LIPPXNIE.js";
8
- import {
9
- loadMergedEnv
10
- } from "./chunk-QF22MYDJ.js";
11
11
  import "./chunk-N6MLQ26B.js";
12
12
  import {
13
13
  parseArgs
14
14
  } from "./chunk-D424ZQGI.js";
15
+ import "./chunk-DP2DX4WV.js";
15
16
  import {
16
- daemonFetch
17
- } from "./chunk-23L3MKEV.js";
18
- import {
19
- resolveAgent
20
- } from "./chunk-DP2DX4WV.js";
17
+ getClient,
18
+ urlOf
19
+ } from "./chunk-4RQBJWQX.js";
21
20
  import "./chunk-K3NQKI34.js";
22
21
 
23
22
  // src/commands/send.ts
@@ -120,37 +119,46 @@ async function run(args) {
120
119
  }
121
120
  if (agentSelf) {
122
121
  try {
123
- await daemonFetch(`/api/agents/${encodeURIComponent(agentSelf)}/history`, {
124
- method: "POST",
125
- headers: { "Content-Type": "application/json" },
126
- body: JSON.stringify({ channel: channelUri, content: message })
127
- });
122
+ const client = getClient();
123
+ await daemonFetch(
124
+ urlOf(client.api.agents[":name"].history.$url({ param: { name: agentSelf } })),
125
+ {
126
+ method: "POST",
127
+ headers: { "Content-Type": "application/json" },
128
+ body: JSON.stringify({ channel: channelUri, content: message })
129
+ }
130
+ );
128
131
  } catch (err) {
129
132
  console.error(`Failed to persist to history: ${err instanceof Error ? err.message : err}`);
130
133
  }
131
134
  }
132
135
  } else {
133
136
  const agentName = resolveAgentName(flags);
134
- const { dir } = resolveAgent(agentName);
135
- const env = {
136
- ...loadMergedEnv(agentName),
137
- VOLUTE_AGENT: agentName,
138
- VOLUTE_AGENT_DIR: dir
139
- };
140
- try {
141
- await driver.send(env, channelUri, message);
142
- console.log("Message sent.");
143
- } catch (err) {
144
- console.error(err instanceof Error ? err.message : String(err));
137
+ const client = getClient();
138
+ const res = await daemonFetch(
139
+ urlOf(client.api.agents[":name"].channels.send.$url({ param: { name: agentName } })),
140
+ {
141
+ method: "POST",
142
+ headers: { "Content-Type": "application/json" },
143
+ body: JSON.stringify({ platform: parsed.platform, uri: channelUri, message })
144
+ }
145
+ );
146
+ if (!res.ok) {
147
+ const body = await res.json().catch(() => ({ error: "Unknown error" }));
148
+ console.error(body.error);
145
149
  process.exit(1);
146
150
  }
151
+ console.log("Message sent.");
147
152
  if (process.env.VOLUTE_AGENT) {
148
153
  try {
149
- await daemonFetch(`/api/agents/${encodeURIComponent(agentName)}/history`, {
150
- method: "POST",
151
- headers: { "Content-Type": "application/json" },
152
- body: JSON.stringify({ channel: channelUri, content: message })
153
- });
154
+ await daemonFetch(
155
+ urlOf(client.api.agents[":name"].history.$url({ param: { name: agentName } })),
156
+ {
157
+ method: "POST",
158
+ headers: { "Content-Type": "application/json" },
159
+ body: JSON.stringify({ channel: channelUri, content: message })
160
+ }
161
+ );
154
162
  } catch (err) {
155
163
  console.error(`Failed to persist to history: ${err instanceof Error ? err.message : err}`);
156
164
  }
@@ -1,10 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  daemonFetch
4
- } from "./chunk-23L3MKEV.js";
4
+ } from "./chunk-STOEJOJO.js";
5
5
  import {
6
6
  resolveAgent
7
7
  } from "./chunk-DP2DX4WV.js";
8
+ import {
9
+ getClient,
10
+ urlOf
11
+ } from "./chunk-4RQBJWQX.js";
8
12
  import "./chunk-K3NQKI34.js";
9
13
 
10
14
  // src/commands/start.ts
@@ -15,7 +19,8 @@ async function run(args) {
15
19
  process.exit(1);
16
20
  }
17
21
  const { entry } = resolveAgent(name);
18
- const res = await daemonFetch(`/api/agents/${encodeURIComponent(name)}/start`, {
22
+ const client = getClient();
23
+ const res = await daemonFetch(urlOf(client.api.agents[":name"].start.$url({ param: { name } })), {
19
24
  method: "POST"
20
25
  });
21
26
  const data = await res.json();
@@ -1,15 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  daemonFetch
4
- } from "./chunk-23L3MKEV.js";
4
+ } from "./chunk-STOEJOJO.js";
5
5
  import "./chunk-DP2DX4WV.js";
6
+ import {
7
+ getClient,
8
+ urlOf
9
+ } from "./chunk-4RQBJWQX.js";
6
10
  import "./chunk-K3NQKI34.js";
7
11
 
8
12
  // src/commands/status.ts
9
13
  async function run(args) {
10
14
  const name = args[0];
15
+ const client = getClient();
11
16
  if (!name) {
12
- const res2 = await daemonFetch("/api/agents");
17
+ const res2 = await daemonFetch(urlOf(client.api.agents.$url()));
13
18
  if (!res2.ok) {
14
19
  const data = await res2.json();
15
20
  console.error(data.error ?? `Failed to get status: ${res2.status}`);
@@ -32,7 +37,7 @@ async function run(args) {
32
37
  }
33
38
  return;
34
39
  }
35
- const res = await daemonFetch(`/api/agents/${encodeURIComponent(name)}`);
40
+ const res = await daemonFetch(urlOf(client.api.agents[":name"].$url({ param: { name } })));
36
41
  if (!res.ok) {
37
42
  const data = await res.json();
38
43
  console.error(data.error || `Failed to get status for ${name}`);
@@ -4,17 +4,22 @@ import {
4
4
  } from "./chunk-AZEL2IEK.js";
5
5
  import {
6
6
  daemonFetch
7
- } from "./chunk-23L3MKEV.js";
7
+ } from "./chunk-STOEJOJO.js";
8
8
  import {
9
9
  resolveAgent
10
10
  } from "./chunk-DP2DX4WV.js";
11
+ import {
12
+ getClient,
13
+ urlOf
14
+ } from "./chunk-4RQBJWQX.js";
11
15
  import "./chunk-K3NQKI34.js";
12
16
 
13
17
  // src/commands/stop.ts
14
18
  async function run(args) {
15
19
  const name = resolveAgentName({ agent: args[0] });
16
20
  resolveAgent(name);
17
- const res = await daemonFetch(`/api/agents/${encodeURIComponent(name)}/stop`, {
21
+ const client = getClient();
22
+ const res = await daemonFetch(urlOf(client.api.agents[":name"].stop.$url({ param: { name } })), {
18
23
  method: "POST"
19
24
  });
20
25
  const data = await res.json();
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  readGlobalConfig,
4
4
  run
5
- } from "./chunk-6RDCTVQK.js";
5
+ } from "./chunk-AWHQZDB4.js";
6
6
  import "./chunk-D424ZQGI.js";
7
7
  import "./chunk-DP2DX4WV.js";
8
8
  import "./chunk-K3NQKI34.js";
@@ -2,6 +2,9 @@
2
2
  import {
3
3
  resolveAgentName
4
4
  } from "./chunk-AZEL2IEK.js";
5
+ import {
6
+ daemonFetch
7
+ } from "./chunk-STOEJOJO.js";
5
8
  import {
6
9
  composeTemplate,
7
10
  copyTemplateToDir,
@@ -14,14 +17,15 @@ import {
14
17
  exec,
15
18
  execInherit
16
19
  } from "./chunk-5C5JWR2L.js";
17
- import {
18
- daemonFetch
19
- } from "./chunk-23L3MKEV.js";
20
20
  import {
21
21
  addVariant,
22
22
  nextPort,
23
23
  resolveAgent
24
24
  } from "./chunk-DP2DX4WV.js";
25
+ import {
26
+ getClient,
27
+ urlOf
28
+ } from "./chunk-4RQBJWQX.js";
25
29
  import "./chunk-K3NQKI34.js";
26
30
 
27
31
  // src/commands/upgrade.ts
@@ -194,8 +198,13 @@ async function installAndVerify(agentName, worktreeDir) {
194
198
  });
195
199
  console.log("Starting upgrade variant...");
196
200
  try {
201
+ const client = getClient();
197
202
  const res = await daemonFetch(
198
- `/api/agents/${encodeURIComponent(`${agentName}@${VARIANT_NAME}`)}/start`,
203
+ urlOf(
204
+ client.api.agents[":name"].start.$url({
205
+ param: { name: `${agentName}@${VARIANT_NAME}` }
206
+ })
207
+ ),
199
208
  { method: "POST" }
200
209
  );
201
210
  if (!res.ok) {