@love-moon/conductor-cli 0.15.1 → 0.16.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,99 @@
1
1
  # @love-moon/conductor-cli
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0495b79: The CLI can now do what the web app can:
8
+
9
+ - `conductor task`: `stop`, `interrupt`, `restart`, `delete`, `archive`/`unarchive`,
10
+ `rename`, `pin`/`unpin`, `move`, `labels`, `share`/`unshare`, `persistent`,
11
+ `round start|end`, `cleanup-worktree`, `terminal open|show|close`, `resume`,
12
+ `attachment download`, `shared <token|link>` (read a shared task), `transcribe <audio>`
13
+ (speech to text), and `schedule update`. `create` also takes `--daemon-host`, `--agent` (multi-agent group),
14
+ `--global-backend`, `--worktree`, `--remote-worktree` and `--persistent`.
15
+ `send --attach` uploads files, `messages --follow` streams new messages, and
16
+ `list --all-projects` / `--project-ids` lists tasks across projects.
17
+ - `conductor project`: `update`, `refresh`, `delete`, `reorder`, `agents`,
18
+ `collab invite|show-invite|join|leave`, `labels list|add|rename|remove`.
19
+ - `conductor issue`: `delete`, and `list --all-projects` / `--project-ids`.
20
+ - `conductor daemon`: `restart`, `upgrade [--status|--wait]`, `sessions`, `accounts`,
21
+ `switch-account`, `commands list|run|status`, `share create|list|revoke|show-invite|accept`.
22
+ - New `conductor search`, `conductor settings` (global backends, catchphrases, daily
23
+ report, task-list and card-group preferences, generated reports) and `conductor auth`
24
+ (`whoami`, `tokens list|create|revoke`).
25
+
26
+ Fix: `conductor project hide/unhide` (and the SDK's `setProjectHidden`) no longer erase
27
+ the project's metadata (task labels, memos, binding data).
28
+
29
+ On a cross-daemon merged project, `project hide/unhide`, `delete` and
30
+ `update --merge-opt-out` act on every daemon, like the web. `hide/unhide --json`
31
+ still prints the target project, plus `ids` for every project changed.
32
+ `delete --daemon-host <h>` deletes only that copy; a group delete stops at the
33
+ first failure and says which ids were deleted. `update --merge-opt-out` lists the
34
+ same-name projects it also split or re-merged.
35
+
36
+ - b68fadf: `conductor issue` now matches the web issue board:
37
+ `start --daemon <host> [--project <id>]` picks the daemon, or the merged-group
38
+ sibling project, that the task runs on (on another member's shared project the
39
+ server decides). `--priority` takes `P0|P1|P2`, and `--status` uses
40
+ `todo|doing|done`; `create` no longer offers `doing`. `list --status` is sent to
41
+ the server and still applied locally, so an older server that ignores it filters
42
+ too. An invalid argument now exits 2 without sending a request. The SDK's
43
+ `updateIssue` forwards `projectId`, and `listIssues` sends multiple statuses to
44
+ the server and filters the result the same way.
45
+
46
+ The matching web server changes (metadata patches merge instead of replacing,
47
+ `GET /api/issues?status=` filtering) should be deployed before publishing.
48
+
49
+ - 7c45a56: `conductor issue start` can pick the AI for the task it spawns: `--backend <b>`,
50
+ or `--global-backend <backend>@<host>` to run the AI on one of your global AI
51
+ backends while the code stays on the project's daemon (same as the web "Move
52
+ Issue To Doing" dialog). The SDK's `updateIssue` forwards `globalBackend`.
53
+
54
+ Requires a Conductor web server that ships issue global backends (the same
55
+ release): deploy the web server before publishing the CLI/SDK. An older server
56
+ ignores `--global-backend` and starts a plain task on the project's daemon; the
57
+ CLI then prints a warning instead of failing silently.
58
+
59
+ ### Patch Changes
60
+
61
+ - 5c81d06: Claude turns that wait on background subagents now report their full token
62
+ usage. Such a turn emits one result per segment and the task card used to show
63
+ only the last segment; it now sums the result's `modelUsage`, which covers
64
+ every segment, every subagent and small side calls. `conductor serve-ai`'s
65
+ `prompt_tokens` / `completion_tokens` come from the same usage, so they now
66
+ include those too. A turn cut off after an earlier segment keeps that
67
+ segment's usage.
68
+ - b69d665: Codex turns that spawn sub-agents now include the sub-agents' tokens in the
69
+ turn usage. Their `thread/tokenUsage/updated` notifications carry the
70
+ sub-agent's own thread id and were dropped with its other events. A
71
+ sub-agent's replayed total is not counted, and whatever it spends after the
72
+ parent turn ends goes to the next turn.
73
+ - 1423475: `conductor task persistent` takes `--auto-end-round` / `--no-auto-end-round`. Persistent
74
+ tasks now end the current round automatically (asking the AI for its summary, like
75
+ End round) after an hour without a reply; on by default.
76
+ - Updated dependencies [5c81d06]
77
+ - Updated dependencies [0495b79]
78
+ - Updated dependencies [b69d665]
79
+ - Updated dependencies [b68fadf]
80
+ - Updated dependencies [7c45a56]
81
+ - @love-moon/ai-sdk@0.16.0
82
+ - @love-moon/conductor-sdk@0.16.0
83
+
84
+ ## 0.15.2
85
+
86
+ ### Patch Changes
87
+
88
+ - 887d919: "New task from this" on a different daemon now keeps working on the source
89
+ task's files: the new task's AI runs on the chosen daemon and reaches the
90
+ source directory (or the same worktree) through the remote MCP tools, with the
91
+ remote operating protocol in its first prompt. Moving it back to the daemon
92
+ that holds the files makes it an ordinary local task again. Falls back to the
93
+ previous behaviour when the source daemon is offline or either CLI is too old.
94
+ - @love-moon/conductor-sdk@0.15.2
95
+ - @love-moon/ai-sdk@0.15.2
96
+
3
97
  ## 0.15.1
4
98
 
5
99
  ### Patch Changes
@@ -0,0 +1,162 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * conductor auth — who am I, and the API tokens shown on the web settings page.
5
+ *
6
+ * Subcommands:
7
+ * whoami GET /api/auth/me -> { user: { id, email, phone, tokenScope } }
8
+ * tokens list GET /api/auth/tokens -> [{ id, name, token_prefix, created_at, last_used_at }]
9
+ * tokens create [--name N] POST /api/auth/tokens { name } -> { token, tokenId, tokenPrefix, createdAt }
10
+ * tokens revoke <tokenId> POST /api/auth/tokens/:tokenId/revoke -> 204
11
+ *
12
+ * `tokens create` prints the raw token once (the server never lists it again).
13
+ * Login / register / OAuth are intentionally not here: `conductor config`
14
+ * handles signing in.
15
+ *
16
+ * Global flags: --json, --dry-run (write verbs), --config-file.
17
+ */
18
+
19
+ import path from "node:path";
20
+ import process from "node:process";
21
+ import { fileURLToPath } from "node:url";
22
+
23
+ import yargs from "yargs/yargs";
24
+ import { hideBin } from "yargs/helpers";
25
+
26
+ import { EXIT, exitCodeForError, printJson, printPretty, reportError } from "../src/entity-helpers.js";
27
+ import { apiPath, buildHttp, formatTable, sendOrPreview } from "../src/backend-http.js";
28
+
29
+ const isMainModule = (() => {
30
+ const currentFile = fileURLToPath(import.meta.url);
31
+ const entryFile = process.argv[1] ? path.resolve(process.argv[1]) : "";
32
+ return entryFile === currentFile;
33
+ })();
34
+
35
+ const DEFAULT_TOKEN_NAME = "cli";
36
+
37
+ async function handleWhoami(argv, deps) {
38
+ const http = await buildHttp(deps);
39
+ const result = await http.get(apiPath("auth", "me"));
40
+ if (argv.json) {
41
+ printJson(deps.stdout, result);
42
+ return EXIT.OK;
43
+ }
44
+ const user = result?.user ?? {};
45
+ printPretty(deps.stdout, `id: ${user.id ?? ""}`);
46
+ if (user.email) printPretty(deps.stdout, `email: ${user.email}`);
47
+ if (user.phone) printPretty(deps.stdout, `phone: ${user.phone}`);
48
+ if (user.tokenScope) printPretty(deps.stdout, `scope: ${user.tokenScope}`);
49
+ printPretty(deps.stdout, `backend: ${http.baseUrl}`);
50
+ return EXIT.OK;
51
+ }
52
+
53
+ async function handleTokensList(argv, deps) {
54
+ const http = await buildHttp(deps);
55
+ const result = await http.get(apiPath("auth", "tokens"));
56
+ if (argv.json) {
57
+ printJson(deps.stdout, result);
58
+ return EXIT.OK;
59
+ }
60
+ const tokens = Array.isArray(result) ? result : [];
61
+ if (tokens.length === 0) {
62
+ printPretty(deps.stdout, "(no tokens)");
63
+ return EXIT.OK;
64
+ }
65
+ const rows = tokens.map((token) => [
66
+ token.id, token.token_prefix ?? "", token.created_at ?? "", token.last_used_at ?? "-", token.name ?? "",
67
+ ]);
68
+ for (const line of formatTable(["ID", "PREFIX", "CREATED", "LAST USED", "NAME"], rows)) {
69
+ printPretty(deps.stdout, line);
70
+ }
71
+ return EXIT.OK;
72
+ }
73
+
74
+ async function handleTokensCreate(argv, deps) {
75
+ const http = await buildHttp(deps);
76
+ const body = { name: String(argv.name ?? DEFAULT_TOKEN_NAME) };
77
+ const { dryRun, data } = await sendOrPreview(http, argv, deps, "POST", apiPath("auth", "tokens"), body);
78
+ if (dryRun) return EXIT.OK;
79
+ deps.stderr.write("Warning: this token is shown only once. Store it somewhere safe now.\n");
80
+ if (argv.json) {
81
+ printJson(deps.stdout, data);
82
+ return EXIT.OK;
83
+ }
84
+ printPretty(deps.stdout, `Created token ${data?.tokenId ?? ""} (${body.name}, prefix ${data?.tokenPrefix ?? ""})`);
85
+ printPretty(deps.stdout, `token: ${data?.token ?? ""}`);
86
+ return EXIT.OK;
87
+ }
88
+
89
+ async function handleTokensRevoke(argv, deps) {
90
+ const http = await buildHttp(deps);
91
+ const tokenId = String(argv.tokenId);
92
+ const { dryRun } = await sendOrPreview(
93
+ http, argv, deps, "POST", apiPath("auth", "tokens", tokenId, "revoke"), undefined,
94
+ );
95
+ if (dryRun) return EXIT.OK;
96
+ if (argv.json) {
97
+ printJson(deps.stdout, { revoked: true, tokenId });
98
+ return EXIT.OK;
99
+ }
100
+ printPretty(deps.stdout, `Revoked token ${tokenId}`);
101
+ return EXIT.OK;
102
+ }
103
+
104
+ export async function main(argvInput = hideBin(process.argv), deps = {}) {
105
+ const stdout = deps.stdout || process.stdout;
106
+ const stderr = deps.stderr || process.stderr;
107
+ const env = deps.env || process.env;
108
+ const cwd = deps.cwd || process.cwd();
109
+ const consoleErr = { error: (msg) => stderr.write(`${msg}\n`) };
110
+ const handlerDeps = { ...deps, stdout, stderr, env, cwd };
111
+ const run = (handler) => async (argv) => {
112
+ exitCode = await handler(argv, { ...handlerDeps, configFile: argv.configFile });
113
+ };
114
+
115
+ let exitCode = EXIT.OK;
116
+ try {
117
+ await yargs(argvInput)
118
+ .scriptName("conductor auth")
119
+ .strict()
120
+ .help()
121
+ .option("json", { type: "boolean", default: false })
122
+ .option("dry-run", { type: "boolean", default: false })
123
+ .option("config-file", { type: "string", describe: "Path to Conductor config file" })
124
+ .command("whoami", "Show the user the configured token belongs to", () => {}, run(handleWhoami))
125
+ .command("tokens", "List, create, or revoke API tokens", (tokens) => tokens
126
+ .command("list", "List active API tokens", () => {}, run(handleTokensList))
127
+ .command(
128
+ "create",
129
+ "Create an API token (the token is printed once)",
130
+ (cmd) => cmd.option("name", { type: "string", describe: `Token label (default "${DEFAULT_TOKEN_NAME}")` }),
131
+ run(handleTokensCreate),
132
+ )
133
+ .command(
134
+ "revoke <tokenId>",
135
+ "Revoke an API token",
136
+ (cmd) => cmd.positional("tokenId", { type: "string", demandOption: true }),
137
+ run(handleTokensRevoke),
138
+ )
139
+ .demandCommand(1))
140
+ .demandCommand(1)
141
+ .fail((msg, err) => {
142
+ if (err) {
143
+ throw err;
144
+ }
145
+ stderr.write(`${msg}\n`);
146
+ exitCode = EXIT.ARGS;
147
+ })
148
+ .parseAsync();
149
+ } catch (err) {
150
+ exitCode = reportError(consoleErr, err);
151
+ }
152
+ return exitCode;
153
+ }
154
+
155
+ if (isMainModule) {
156
+ main().then((code) => {
157
+ if (code !== 0) process.exit(code);
158
+ }).catch((err) => {
159
+ process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
160
+ process.exit(exitCodeForError(err));
161
+ });
162
+ }
@@ -1,5 +1,7 @@
1
1
  /**
2
- * conductor daemon list|tools|quota — read-only queries about daemons.
2
+ * conductor daemon list|tools|quota — read-only queries about daemons, plus the
3
+ * remote-control / sharing verbs in src/daemon-share-commands.js (restart,
4
+ * upgrade, sessions, accounts, switch-account, commands, share).
3
5
  *
4
6
  * list [--all] Online daemons, CLI version, AI backends
5
7
  * tools <host> AI tools installed on a daemon + network
@@ -12,24 +14,16 @@ import process from "node:process";
12
14
 
13
15
  import yargs from "yargs/yargs";
14
16
 
15
- import { EXIT, buildApis, pad, printJson, printPretty, reportError } from "../src/entity-helpers.js";
17
+ import { EXIT, buildApis, printJson, printPretty, reportError } from "../src/entity-helpers.js";
18
+ import { DAEMON_REMOTE_VERBS, printTable, readOnly, registerDaemonRemoteCommands } from "../src/daemon-share-commands.js";
16
19
 
17
- export const DAEMON_QUERY_VERBS = new Set(["list", "tools", "quota"]);
20
+ export const DAEMON_QUERY_VERBS = new Set(["list", "tools", "quota", ...DAEMON_REMOTE_VERBS]);
18
21
 
19
22
  // Ephemeral per-task `conductor fire` processes also register as agents.
20
23
  const FIRE_HOST_PREFIX = "conductor-fire-";
21
24
 
22
25
  const WINDOW_LABELS = { fiveHour: "5h", weekly: "weekly", weeklySonnet: "weekly-sonnet" };
23
26
 
24
- function printTable(stream, header, rows) {
25
- const widths = header
26
- .slice(0, -1)
27
- .map((title, i) => Math.max(title.length, ...rows.map((row) => String(row[i]).length)));
28
- for (const row of [header, ...rows]) {
29
- printPretty(stream, row.map((cell, i) => (i < widths.length ? pad(cell, widths[i]) : cell)).join(" "));
30
- }
31
- }
32
-
33
27
  function formatReset(window) {
34
28
  if (typeof window.resetAt !== "number") return window.resetOnDate ?? "";
35
29
  const date = new Date(window.resetAt * 1000);
@@ -139,12 +133,13 @@ export async function main(argvInput, deps = {}) {
139
133
  };
140
134
 
141
135
  try {
142
- await yargs(argvInput)
136
+ const y = yargs(argvInput)
143
137
  .scriptName("conductor daemon")
144
138
  .strict()
145
139
  .help()
146
140
  .option("json", { type: "boolean", default: false })
147
141
  .option("config-file", { type: "string", describe: "Path to Conductor config file" })
142
+ .option("dry-run", { type: "boolean", default: false, describe: "Print the request a write verb would send, without sending it" })
148
143
  .command(
149
144
  "list",
150
145
  "List online daemons with their CLI version and AI backends",
@@ -153,13 +148,13 @@ export async function main(argvInput, deps = {}) {
153
148
  default: false,
154
149
  describe: `Include ephemeral ${FIRE_HOST_PREFIX}* hosts`,
155
150
  }),
156
- run(handleList),
151
+ run(readOnly(handleList)),
157
152
  )
158
153
  .command(
159
154
  "tools <host>",
160
155
  "Show which AI tools are installed on a daemon and whether they are reachable",
161
156
  (cmd) => cmd.positional("host", { type: "string", describe: "Daemon host name" }),
162
- run(handleTools),
157
+ run(readOnly(handleTools)),
163
158
  )
164
159
  .command(
165
160
  "quota <host>",
@@ -168,8 +163,9 @@ export async function main(argvInput, deps = {}) {
168
163
  .positional("host", { type: "string", describe: "Daemon host name" })
169
164
  .option("tool", { type: "string", describe: "Only this tool, e.g. claude or codex" })
170
165
  .option("refresh", { type: "boolean", default: false, describe: "Bypass the daemon's quota cache" }),
171
- run(handleQuota),
172
- )
166
+ run(readOnly(handleQuota)),
167
+ );
168
+ await registerDaemonRemoteCommands(y, run)
173
169
  .demandCommand(1)
174
170
  .fail((msg, err) => {
175
171
  // Throw so the command handler does not run after a validation error
@@ -24,7 +24,8 @@ import { DAEMON_QUERY_VERBS, main as runDaemonQuery } from "./conductor-daemon-q
24
24
 
25
25
  const argv = hideBin(process.argv);
26
26
 
27
- // `conductor daemon list|tools|quota` are read-only queries, not a daemon launch.
27
+ // `conductor daemon list|tools|quota|restart|upgrade|sessions|accounts|switch-account|commands|share`
28
+ // talk to the backend about daemons; they are not a daemon launch.
28
29
  // Exit (so startup below never runs) only after stdout drains: a piped
29
30
  // --json payload over 64KB would otherwise be cut off.
30
31
  if (DAEMON_QUERY_VERBS.has(argv[0])) {
@@ -181,6 +182,10 @@ const args = yargs(argv)
181
182
  .example("$0 --nohup", "Run daemon in background with logfile")
182
183
  .example("$0 --nohup --force", "Restart daemon in background by stopping the existing one")
183
184
  .example("$0 list | tools <host> | quota <host>", "Query online daemons, their AI tools and quota")
185
+ .example("$0 restart <host> | upgrade <host> [--wait]", "Restart or upgrade a remote daemon")
186
+ .example("$0 sessions <host> | accounts <host> | switch-account <host> <name>", "Resumable AI sessions, codex accounts")
187
+ .example("$0 commands list|run|status <host> ...", "Run a daemon's custom commands")
188
+ .example("$0 share create|list|revoke|show-invite|accept ...", "Share a daemon with another user")
184
189
  .help()
185
190
  .strict()
186
191
  .parse();