@cloop/runner 0.2.0 → 0.2.2

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.
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ localRunsFilePath
4
+ } from "./chunk-TFZSCXSS.js";
5
+ import {
6
+ boxPath,
7
+ installedService,
8
+ readRunnerConfig,
9
+ revokeOwnDevice,
10
+ runSteps,
11
+ runnerStatePath,
12
+ threadsFilePath,
13
+ tokenGone
14
+ } from "./chunk-7PUGLQL2.js";
15
+ import "./chunk-JX6VG5FE.js";
16
+ import "./chunk-R3CLO2FB.js";
17
+ import "./chunk-M6MHMCV6.js";
18
+ import "./chunk-F36GGCXC.js";
19
+ import "./chunk-AG6SI6I2.js";
20
+ import "./chunk-7BREDPJD.js";
21
+ import {
22
+ getOrigin
23
+ } from "./chunk-3DIGCVL4.js";
24
+
25
+ // src/commands/disconnect.ts
26
+ import { execFileSync } from "child_process";
27
+ import { existsSync, readFileSync, rmSync } from "fs";
28
+ import { homedir } from "os";
29
+ var DONE_LINE = "This computer is no longer a Cloop runner. To connect it again: npx -y @cloop/runner connect";
30
+ function unitOrigin(contents) {
31
+ const plist = /<key>CLOOP_ORIGIN<\/key><string>([^<]+)<\/string>/.exec(contents)?.[1];
32
+ if (plist) return plist.replace(/&amp;/g, "&");
33
+ const unit = /Environment="CLOOP_ORIGIN=([^"]+)"/.exec(contents)?.[1];
34
+ return unit ? unit.replace(/%%/g, "%") : null;
35
+ }
36
+ function disconnectPlan(opts) {
37
+ const exists = opts.exists ?? existsSync;
38
+ const read = opts.read ?? ((path) => readFileSync(path, "utf-8"));
39
+ const services = ["local", "workstation"].map((kind) => installedService({ ...opts, kind })).filter((service) => exists(service.path));
40
+ const fromUnit = services.map((service) => {
41
+ try {
42
+ return unitOrigin(read(service.path));
43
+ } catch {
44
+ return null;
45
+ }
46
+ }).find(Boolean);
47
+ return {
48
+ origin: opts.boxOrigin ?? fromUnit ?? opts.fallbackOrigin,
49
+ deviceToken: opts.deviceToken,
50
+ services,
51
+ box: exists(opts.box) ? opts.box : null,
52
+ files: opts.files.filter((file) => exists(file)),
53
+ isBox: opts.platform !== "darwin" && services.some((s) => s.path.endsWith("/cloop-box.service"))
54
+ };
55
+ }
56
+ function revokeLine(revoke, origin, box) {
57
+ const keep = box ? ` Kept ${box}, which holds the device token, so you can try again.` : "";
58
+ switch (revoke) {
59
+ case "revoked":
60
+ return [`Revoked this computer on Cloop (${origin}).`];
61
+ case "already_revoked":
62
+ return [`Cloop (${origin}) had already revoked this computer.`];
63
+ case "no_device":
64
+ return ["No runner device on this computer to revoke."];
65
+ case "unknown_device":
66
+ return [
67
+ `Cloop at ${origin} never issued this computer's device token, so it belongs to the other environment.${keep}`,
68
+ "Run `cloop disconnect --staging` for a staging runner, or `cloop disconnect` for production."
69
+ ];
70
+ case "failed":
71
+ return [
72
+ `Could not revoke this computer at ${origin}: Cloop did not answer as expected.${keep}`,
73
+ "Run `cloop disconnect` again when Cloop answers, or press Disconnect on its card on the Threads page and then delete that file."
74
+ ];
75
+ }
76
+ }
77
+ async function disconnect(plan, opts) {
78
+ const { say } = opts;
79
+ const run = opts.run ?? ((command) => void execFileSync(command[0], command.slice(1), {
80
+ stdio: "ignore",
81
+ timeout: 15e3
82
+ }));
83
+ if (plan.isBox && !opts.yes) {
84
+ say("This computer runs cloop-box.service, a Cloop box with T3 Code. Disconnect would:");
85
+ for (const s of plan.services) say(` stop and remove ${s.path}`);
86
+ if (plan.deviceToken) say(` revoke its runner device on Cloop (${plan.origin})`);
87
+ for (const f of [...plan.box ? [plan.box] : [], ...plan.files]) say(` delete ${f}`);
88
+ say("Run `cloop disconnect --yes` to do this.");
89
+ return 1;
90
+ }
91
+ for (const service of plan.services) {
92
+ await runSteps(service.steps, run);
93
+ let stillRunning = true;
94
+ try {
95
+ run(service.running);
96
+ } catch {
97
+ stillRunning = false;
98
+ }
99
+ if (stillRunning) {
100
+ say(
101
+ `Could not stop the service in ${service.path}. Nothing was removed. Stop it with \`${service.steps.map((s) => s.command.join(" ")).join(" && ")}\`, then run \`cloop disconnect\` again.`
102
+ );
103
+ return 1;
104
+ }
105
+ say(`Stopped the service in ${service.path}`);
106
+ }
107
+ const revoked = await opts.revoke(plan.origin, plan.deviceToken);
108
+ const gone = tokenGone(revoked);
109
+ for (const service of plan.services) {
110
+ rmSync(service.path, { force: true });
111
+ say(`Removed ${service.path}`);
112
+ }
113
+ for (const file of [...gone && plan.box ? [plan.box] : [], ...plan.files]) {
114
+ rmSync(file, { force: true });
115
+ say(`Deleted ${file}`);
116
+ }
117
+ for (const line of revokeLine(revoked, plan.origin, plan.box)) say(line);
118
+ if (!gone) return 1;
119
+ say(DONE_LINE);
120
+ return 0;
121
+ }
122
+ async function disconnectCommand(argv) {
123
+ const cfg = readRunnerConfig();
124
+ const plan = disconnectPlan({
125
+ platform: process.platform,
126
+ home: homedir(),
127
+ uid: process.getuid?.() ?? 0,
128
+ ...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {},
129
+ box: boxPath(),
130
+ deviceToken: cfg?.deviceToken ?? null,
131
+ ...cfg?.origin ? { boxOrigin: cfg.origin } : {},
132
+ fallbackOrigin: getOrigin(),
133
+ files: [localRunsFilePath(), runnerStatePath(), threadsFilePath()]
134
+ });
135
+ process.exitCode = await disconnect(plan, {
136
+ yes: argv.includes("--yes"),
137
+ revoke: (origin, token) => revokeOwnDevice(origin, token),
138
+ say: (line) => console.log(line)
139
+ });
140
+ }
141
+ export {
142
+ DONE_LINE,
143
+ disconnect,
144
+ disconnectCommand,
145
+ disconnectPlan,
146
+ unitOrigin
147
+ };
@@ -4,7 +4,7 @@ import {
4
4
  pruneSessionStates,
5
5
  toolPhrase,
6
6
  writeSessionState
7
- } from "./chunk-IR3P526R.js";
7
+ } from "./chunk-OJ5AREUC.js";
8
8
  import "./chunk-4LFQXBWP.js";
9
9
  import {
10
10
  HeartbeatClient,
@@ -13,11 +13,11 @@ import {
13
13
  getName,
14
14
  getSurface,
15
15
  sanitizeSessionKey
16
- } from "./chunk-HS5CIDQF.js";
17
- import "./chunk-4UE33DYW.js";
16
+ } from "./chunk-JX6VG5FE.js";
17
+ import "./chunk-AG6SI6I2.js";
18
18
  import {
19
19
  getToken
20
- } from "./chunk-SQJ7ZO4G.js";
20
+ } from "./chunk-3DIGCVL4.js";
21
21
 
22
22
  // src/commands/hook-activity.ts
23
23
  async function readStdin() {
@@ -9,13 +9,13 @@ import {
9
9
  getName,
10
10
  getSurface,
11
11
  newSessionKey
12
- } from "./chunk-HS5CIDQF.js";
12
+ } from "./chunk-JX6VG5FE.js";
13
13
  import {
14
14
  api
15
- } from "./chunk-4UE33DYW.js";
15
+ } from "./chunk-AG6SI6I2.js";
16
16
  import {
17
17
  getToken
18
- } from "./chunk-SQJ7ZO4G.js";
18
+ } from "./chunk-3DIGCVL4.js";
19
19
 
20
20
  // src/digest.ts
21
21
  var CHAR_BUDGET = 1600;
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-7K5W6ELQ.js";
4
+ } from "./chunk-7BREDPJD.js";
5
5
  import {
6
6
  applyEnvironmentFlag
7
- } from "./chunk-SQJ7ZO4G.js";
7
+ } from "./chunk-3DIGCVL4.js";
8
8
 
9
9
  // src/index.ts
10
10
  var argv = applyEnvironmentFlag(process.argv.slice(2));
@@ -12,18 +12,24 @@ var command = argv[0];
12
12
  var HELP = `cloop \u2014 the social layer for your agents (v${VERSION})
13
13
 
14
14
  Usage:
15
+ cloop connect --webhook <https endpoint> [--name <short name>] [--rotate-secret]
16
+ Local proof: --webhook http://localhost:<port> --insecure-localhost
17
+ Log in, register and verify a cloud agent
15
18
  cloop login [--name <device>] Authenticate this machine (device-code flow)
16
19
  cloop install Register the Cloop MCP server with your harness
17
20
  cloop serve [--platform <p>] Run the stdio MCP server (used by your harness)
18
21
  cloop statusline Render the Claude Code status line (reads local state)
19
22
  cloop hook session-start Claude Code SessionStart hook (reads JSON on stdin)
20
23
  cloop hook activity Lifecycle hook: records what this session is doing
21
- cloop connect [--repo <path>]... [--driver t3|claude-code|codex] [--no-service] [--no-start]
24
+ cloop connect [--repo <path>]... [--driver t3|claude-code|codex] [--fallback-model <list>]
25
+ [--no-service] [--no-start] [--ask-everything] [--full-access]
22
26
  Make this machine a Cloop runner: T3 Code, else
23
27
  Claude Code or Codex in the repos you name
28
+ cloop disconnect [--yes] Stop being a Cloop runner: revoke this computer on
29
+ Cloop, remove its service and runner files
24
30
  cloop box connect cloop connect with T3 Code forced
25
31
  cloop box run Answer the Cloop Agent's runner calls (daemon)
26
- cloop runner register --webhook <url> --label <name> [--reactivate]
32
+ cloop runner register --webhook <url> --label <name> [--reactivate] [--rotate-secret]
27
33
  Register a cloud runner endpoint
28
34
  cloop runner verify --label <name>
29
35
  Send a fresh verification request
@@ -37,46 +43,54 @@ async function main() {
37
43
  switch (command) {
38
44
  case "login":
39
45
  case "auth": {
40
- const { loginCommand } = await import("./login-TLO4ZXLI.js");
46
+ const { loginCommand } = await import("./login-CUQR2MBW.js");
41
47
  await loginCommand(argv);
42
48
  break;
43
49
  }
44
50
  case "install": {
45
- const { installCommand } = await import("./install-2AYAXFYF.js");
51
+ const { installCommand } = await import("./install-HTDTCELB.js");
46
52
  installCommand(argv);
47
53
  break;
48
54
  }
49
55
  case "serve": {
50
- const { startMcpServer } = await import("./mcp-server-VGCZ6AGJ.js");
56
+ const { startMcpServer } = await import("./mcp-server-YDRR6DYJ.js");
51
57
  await startMcpServer();
52
58
  break;
53
59
  }
54
60
  case "statusline": {
55
- const { statuslineCommand } = await import("./statusline-YIRFJQWY.js");
61
+ const { statuslineCommand } = await import("./statusline-SLP4CAFB.js");
56
62
  statuslineCommand();
57
63
  break;
58
64
  }
59
65
  case "connect": {
60
- const { connectCommand } = await import("./connect-SFXN3UHJ.js");
66
+ const { connectCommand } = await import("./connect-WRQN37SU.js");
61
67
  await connectCommand(argv.slice(1));
62
68
  break;
63
69
  }
70
+ case "disconnect": {
71
+ const { disconnectCommand } = await import("./disconnect-KTII7TXC.js");
72
+ await disconnectCommand(argv.slice(1));
73
+ break;
74
+ }
64
75
  case "box": {
65
- const { boxCommand } = await import("./box-SQVB3OUM.js");
76
+ const { boxCommand } = await import("./box-BS6BSQUO.js");
66
77
  await boxCommand(argv.slice(1));
67
78
  break;
68
79
  }
69
80
  case "runner": {
70
- const { runnerCommand } = await import("./runner-TOCZ4RXC.js");
81
+ const { runnerCommand } = await import("./runner-WW5OU2YU.js");
71
82
  await runnerCommand(argv.slice(1));
72
83
  break;
73
84
  }
74
85
  case "hook": {
75
- if (argv[1] === "session-start") {
76
- const { hookSessionStart } = await import("./hook-session-start-BIO5QJKT.js");
86
+ if (argv[1] === "runner-permission") {
87
+ const { runnerPermissionHook } = await import("./read-permissions-SPOKGVLO.js");
88
+ await runnerPermissionHook();
89
+ } else if (argv[1] === "session-start") {
90
+ const { hookSessionStart } = await import("./hook-session-start-MT67MMDM.js");
77
91
  await hookSessionStart();
78
92
  } else if (argv[1] === "activity") {
79
- const { hookActivity } = await import("./hook-activity-JHLSVNFG.js");
93
+ const { hookActivity } = await import("./hook-activity-O2NNKTOE.js");
80
94
  await hookActivity();
81
95
  } else {
82
96
  console.error(`Unknown hook: ${argv[1] ?? "(none)"}`);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  getToken
4
- } from "./chunk-SQJ7ZO4G.js";
4
+ } from "./chunk-3DIGCVL4.js";
5
5
 
6
6
  // src/commands/install.ts
7
7
  import { execFileSync } from "child_process";
@@ -3,9 +3,10 @@ import {
3
3
  deviceLogin,
4
4
  loginCommand,
5
5
  refusalSentence
6
- } from "./chunk-CMOMRXTA.js";
7
- import "./chunk-4UE33DYW.js";
8
- import "./chunk-SQJ7ZO4G.js";
6
+ } from "./chunk-F36GGCXC.js";
7
+ import "./chunk-AG6SI6I2.js";
8
+ import "./chunk-7BREDPJD.js";
9
+ import "./chunk-3DIGCVL4.js";
9
10
  export {
10
11
  deviceLogin,
11
12
  loginCommand,
@@ -1,24 +1,24 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ MeshSocket,
4
+ defaultSocketFactory
5
+ } from "./chunk-ZILLDYL4.js";
2
6
  import {
3
7
  readSessionState,
4
8
  toolPhrase,
5
9
  writeSessionState
6
- } from "./chunk-IR3P526R.js";
10
+ } from "./chunk-OJ5AREUC.js";
7
11
  import {
8
12
  appendInbox,
9
13
  drainInbox,
10
14
  readInbox,
11
15
  syncInboxPending,
12
16
  writeState
13
- } from "./chunk-UYTSOW2C.js";
17
+ } from "./chunk-J6AEO3GT.js";
14
18
  import {
15
19
  sanitizeLabel,
16
20
  sanitizeUntrusted
17
21
  } from "./chunk-4LFQXBWP.js";
18
- import {
19
- MeshSocket,
20
- defaultSocketFactory
21
- } from "./chunk-ZILLDYL4.js";
22
22
  import {
23
23
  HeartbeatClient,
24
24
  detectPlatform,
@@ -26,18 +26,18 @@ import {
26
26
  getName,
27
27
  getSurface,
28
28
  newSessionKey
29
- } from "./chunk-HS5CIDQF.js";
30
- import {
31
- VERSION
32
- } from "./chunk-7K5W6ELQ.js";
29
+ } from "./chunk-JX6VG5FE.js";
33
30
  import {
34
31
  ReauthError,
35
32
  api
36
- } from "./chunk-4UE33DYW.js";
33
+ } from "./chunk-AG6SI6I2.js";
34
+ import {
35
+ VERSION
36
+ } from "./chunk-7BREDPJD.js";
37
37
  import {
38
38
  getMeshUrl,
39
39
  getToken
40
- } from "./chunk-SQJ7ZO4G.js";
40
+ } from "./chunk-3DIGCVL4.js";
41
41
 
42
42
  // src/mcp-server.ts
43
43
  import { Server } from "@modelcontextprotocol/server";
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ READ_PREFIXES,
4
+ READ_TOOLS,
5
+ isReadOnlyCommand,
6
+ needsReadGuard,
7
+ readOnlySettings,
8
+ runnerPermissionHook
9
+ } from "./chunk-R3CLO2FB.js";
10
+ export {
11
+ READ_PREFIXES,
12
+ READ_TOOLS,
13
+ isReadOnlyCommand,
14
+ needsReadGuard,
15
+ readOnlySettings,
16
+ runnerPermissionHook
17
+ };
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ connectWebhook,
4
+ runnerCommand
5
+ } from "./chunk-M6MHMCV6.js";
6
+ import "./chunk-F36GGCXC.js";
7
+ import "./chunk-AG6SI6I2.js";
8
+ import "./chunk-7BREDPJD.js";
9
+ import "./chunk-3DIGCVL4.js";
10
+ export {
11
+ connectWebhook,
12
+ runnerCommand
13
+ };
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readState
4
- } from "./chunk-UYTSOW2C.js";
4
+ } from "./chunk-J6AEO3GT.js";
5
5
  import {
6
6
  sanitizeLabel
7
7
  } from "./chunk-4LFQXBWP.js";
8
8
  import {
9
9
  VERSION
10
- } from "./chunk-7K5W6ELQ.js";
10
+ } from "./chunk-7BREDPJD.js";
11
11
  import {
12
12
  getToken
13
- } from "./chunk-SQJ7ZO4G.js";
13
+ } from "./chunk-3DIGCVL4.js";
14
14
 
15
15
  // src/commands/statusline.ts
16
16
  var FRESH_MS = 2 * 60 * 1e3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloop/runner",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Make your machine and your agents Cloop runners: device login, the runner daemon, the Cloop MCP server, and Claude Code hooks.",
@@ -1,41 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- DEFAULT_T3_URL,
4
- awaitDaemon,
5
- chooseDriver,
6
- compareVersions,
7
- connectBox,
8
- connectCommand,
9
- detect,
10
- mintSession,
11
- programFor,
12
- resolveRepos,
13
- resolveT3Bin,
14
- startService,
15
- systemdAssignment,
16
- systemdWord,
17
- unitEnv,
18
- unitFor
19
- } from "./chunk-IIUHGZKX.js";
20
- import "./chunk-CMOMRXTA.js";
21
- import "./chunk-7K5W6ELQ.js";
22
- import "./chunk-4UE33DYW.js";
23
- import "./chunk-SQJ7ZO4G.js";
24
- export {
25
- DEFAULT_T3_URL,
26
- awaitDaemon,
27
- chooseDriver,
28
- compareVersions,
29
- connectBox,
30
- connectCommand,
31
- detect,
32
- mintSession,
33
- programFor,
34
- resolveRepos,
35
- resolveT3Bin,
36
- startService,
37
- systemdAssignment,
38
- systemdWord,
39
- unitEnv,
40
- unitFor
41
- };
@@ -1,147 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- api
4
- } from "./chunk-4UE33DYW.js";
5
- import {
6
- CONFIG_DIR
7
- } from "./chunk-SQJ7ZO4G.js";
8
-
9
- // src/commands/runner.ts
10
- import { randomBytes } from "crypto";
11
- import {
12
- chmodSync,
13
- existsSync,
14
- mkdirSync,
15
- readFileSync,
16
- renameSync,
17
- rmSync,
18
- writeFileSync
19
- } from "fs";
20
- import { homedir } from "os";
21
- import { join } from "path";
22
- var REGISTER_USAGE = "Usage: cloop runner register --webhook <url> --label <name> [--reactivate]";
23
- var REVOKE_USAGE = "Usage: cloop runner revoke --label <name>";
24
- var VERIFY_USAGE = "Usage: cloop runner verify --label <name>";
25
- function flag(argv, name) {
26
- const inline = argv.find((value) => value.startsWith(`${name}=`));
27
- if (inline) return inline.slice(name.length + 1);
28
- const index = argv.indexOf(name);
29
- return index >= 0 ? argv[index + 1] : void 0;
30
- }
31
- function secretPath(label) {
32
- const safe = label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 48) || "runner";
33
- return join(homedir(), CONFIG_DIR, "runners", `${safe}.json`);
34
- }
35
- function storedLabel(path) {
36
- if (!existsSync(path)) return null;
37
- try {
38
- const parsed = JSON.parse(readFileSync(path, "utf8"));
39
- if (typeof parsed === "object" && parsed !== null && "label" in parsed && typeof parsed.label === "string") {
40
- return parsed.label;
41
- }
42
- } catch {
43
- }
44
- throw new Error(`Cannot read the existing runner file at ${path}. Move it aside and try again.`);
45
- }
46
- function assertNoPathCollision(path, label) {
47
- const existingLabel = storedLabel(path);
48
- if (existingLabel && existingLabel !== label) {
49
- throw new Error(
50
- `Runner labels "${existingLabel}" and "${label}" use the same local file ${path}. Choose another label.`
51
- );
52
- }
53
- }
54
- function requiredLabel(argv, usage) {
55
- const label = flag(argv, "--label")?.trim();
56
- if (!label) throw new Error(usage);
57
- return label;
58
- }
59
- async function registerRunner(argv) {
60
- const url = flag(argv, "--webhook");
61
- const label = requiredLabel(argv, REGISTER_USAGE);
62
- if (!url) throw new Error(REGISTER_USAGE);
63
- const reactivate = argv.includes("--reactivate");
64
- const path = secretPath(label);
65
- assertNoPathCollision(path, label);
66
- const secret = randomBytes(32).toString("base64url");
67
- mkdirSync(join(homedir(), CONFIG_DIR, "runners"), { recursive: true, mode: 448 });
68
- const tempPath = `${path}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
69
- writeFileSync(tempPath, `${JSON.stringify({ label, url, secret })}
70
- `, { mode: 384 });
71
- chmodSync(tempPath, 384);
72
- let response;
73
- try {
74
- response = await api("/api/agent/mesh/runner-register", {
75
- method: "POST",
76
- body: { url, label, secret, reactivate },
77
- timeoutMs: 2e4
78
- });
79
- } catch (error) {
80
- rmSync(tempPath, { force: true });
81
- throw error;
82
- }
83
- try {
84
- writeFileSync(
85
- tempPath,
86
- `${JSON.stringify({ runner_id: response.runner_id, label: response.label, url, secret })}
87
- `,
88
- { mode: 384 }
89
- );
90
- chmodSync(tempPath, 384);
91
- renameSync(tempPath, path);
92
- } catch (error) {
93
- rmSync(tempPath, { force: true });
94
- throw error;
95
- }
96
- process.stdout.write(
97
- response.verified ? `Registered and verified ${response.label}. Signing material is in ${path}.
98
- ` : `Registered ${response.label}. Verification is still pending. Signing material is in ${path}.
99
- `
100
- );
101
- }
102
- async function revokeRunner(argv) {
103
- const label = requiredLabel(argv, REVOKE_USAGE);
104
- const path = secretPath(label);
105
- assertNoPathCollision(path, label);
106
- const response = await api("/api/agent/mesh/runner-revoke", {
107
- method: "POST",
108
- body: { label },
109
- timeoutMs: 2e4
110
- });
111
- rmSync(path, { force: true });
112
- process.stdout.write(`Revoked ${response.label}. Removed local signing material.
113
- `);
114
- }
115
- async function verifyRunner(argv) {
116
- const label = requiredLabel(argv, VERIFY_USAGE);
117
- const response = await api("/api/agent/mesh/runner-verify", {
118
- method: "POST",
119
- body: { label },
120
- timeoutMs: 2e4
121
- });
122
- process.stdout.write(
123
- response.delivered ? `Sent a fresh verification request to ${response.label}.
124
- ` : `Queued a fresh verification request for ${response.label}, but its endpoint did not answer.
125
- `
126
- );
127
- }
128
- async function runnerCommand(argv) {
129
- switch (argv[0]) {
130
- case "register":
131
- await registerRunner(argv);
132
- return;
133
- case "revoke":
134
- await revokeRunner(argv);
135
- return;
136
- case "verify":
137
- await verifyRunner(argv);
138
- return;
139
- default:
140
- throw new Error(`${REGISTER_USAGE}
141
- ${REVOKE_USAGE}
142
- ${VERIFY_USAGE}`);
143
- }
144
- }
145
- export {
146
- runnerCommand
147
- };