@cloop/runner 0.2.1 → 0.2.3

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,301 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/drivers/read-permissions.ts
4
+ import { resolve } from "path";
5
+ var READ_PREFIXES = [
6
+ "git log",
7
+ "git show",
8
+ "git diff",
9
+ "git status",
10
+ "git fetch",
11
+ "git branch",
12
+ "git rev-parse",
13
+ "gh pr view",
14
+ "gh pr list",
15
+ "gh issue view",
16
+ "gh issue list",
17
+ "ls",
18
+ "cat",
19
+ "head",
20
+ "tail",
21
+ "wc"
22
+ ];
23
+ var READ_TOOLS = [
24
+ "Read",
25
+ "Glob",
26
+ "Grep",
27
+ "LS",
28
+ "mcp__cloop__get_task",
29
+ "mcp__cloop__get_task_context",
30
+ "mcp__cloop__list_tasks",
31
+ "mcp__cloop__search",
32
+ ...READ_PREFIXES.map((prefix) => `Bash(${prefix} *)`)
33
+ ];
34
+ var FLAGS = {
35
+ "git log": [
36
+ "--oneline",
37
+ "--all",
38
+ "--graph",
39
+ "--decorate",
40
+ "--no-decorate",
41
+ "--stat",
42
+ "--shortstat",
43
+ "--name-only",
44
+ "--name-status",
45
+ "--no-merges",
46
+ "--merges",
47
+ "--reverse",
48
+ "--first-parent",
49
+ "--no-pager"
50
+ ],
51
+ "git show": [
52
+ "--stat",
53
+ "--shortstat",
54
+ "--name-only",
55
+ "--name-status",
56
+ "--oneline",
57
+ "--no-patch",
58
+ "-s",
59
+ "-p"
60
+ ],
61
+ "git diff": [
62
+ "--stat",
63
+ "--shortstat",
64
+ "--name-only",
65
+ "--name-status",
66
+ "--cached",
67
+ "--staged",
68
+ "--check",
69
+ "--no-ext-diff",
70
+ "--no-textconv",
71
+ "--numstat",
72
+ "--summary",
73
+ "--no-index"
74
+ ],
75
+ "git status": [
76
+ "--short",
77
+ "-s",
78
+ "--branch",
79
+ "-b",
80
+ "--porcelain",
81
+ "--porcelain=v1",
82
+ "--porcelain=v2",
83
+ "--untracked-files",
84
+ "--untracked-files=all",
85
+ "--untracked-files=no"
86
+ ],
87
+ "git fetch": ["-q", "--quiet", "--all", "--tags", "--no-tags", "--dry-run"],
88
+ "git branch": [
89
+ "--list",
90
+ "--all",
91
+ "-a",
92
+ "--remotes",
93
+ "-r",
94
+ "--show-current",
95
+ "-v",
96
+ "-vv",
97
+ "--verbose",
98
+ "--no-color"
99
+ ],
100
+ "git rev-parse": [
101
+ "--show-toplevel",
102
+ "--show-prefix",
103
+ "--show-cdup",
104
+ "--git-dir",
105
+ "--is-inside-work-tree",
106
+ "--abbrev-ref",
107
+ "--verify",
108
+ "--short",
109
+ "--symbolic-full-name"
110
+ ],
111
+ "gh pr view": ["--comments"],
112
+ "gh pr list": [],
113
+ "gh issue view": ["--comments"],
114
+ "gh issue list": []
115
+ };
116
+ var VALUES = {
117
+ "git log": [
118
+ "--format",
119
+ "--pretty",
120
+ "--date",
121
+ "--max-count",
122
+ "-n",
123
+ "--since",
124
+ "--until",
125
+ "--author",
126
+ "--grep"
127
+ ],
128
+ "git show": ["--format", "--pretty", "--date"],
129
+ "git diff": ["--unified", "-U"],
130
+ "git branch": ["--sort", "--format", "--contains", "--no-contains", "--merged", "--no-merged"],
131
+ "gh pr view": ["--json", "--jq", "-q", "--template", "-t", "--repo", "-R"],
132
+ "gh issue view": ["--json", "--jq", "-q", "--template", "-t", "--repo", "-R"],
133
+ "gh pr list": [
134
+ "--json",
135
+ "--jq",
136
+ "-q",
137
+ "--template",
138
+ "-t",
139
+ "--repo",
140
+ "-R",
141
+ "--author",
142
+ "--assignee",
143
+ "--base",
144
+ "--head",
145
+ "--label",
146
+ "--limit",
147
+ "-L",
148
+ "--search",
149
+ "--state"
150
+ ],
151
+ "gh issue list": [
152
+ "--json",
153
+ "--jq",
154
+ "-q",
155
+ "--template",
156
+ "-t",
157
+ "--repo",
158
+ "-R",
159
+ "--author",
160
+ "--assignee",
161
+ "--label",
162
+ "--limit",
163
+ "-L",
164
+ "--search",
165
+ "--state",
166
+ "--milestone"
167
+ ]
168
+ };
169
+ function commands(command) {
170
+ const result = [];
171
+ let args = [];
172
+ let word = "";
173
+ let quote = "";
174
+ const wordEnd = () => {
175
+ if (word) args.push(word);
176
+ word = "";
177
+ };
178
+ for (let i = 0; i < command.length; i++) {
179
+ const c = command.charAt(i);
180
+ if (c === "$" || c === "`" || c === "\\") return null;
181
+ if (quote) {
182
+ if (c === quote) quote = "";
183
+ else word += c;
184
+ } else if (c === '"' || c === "'") quote = c;
185
+ else if ("><(){}*?[]#!".includes(c)) return null;
186
+ else if (";&|\n".includes(c)) {
187
+ wordEnd();
188
+ if (!args.length) return null;
189
+ result.push(args);
190
+ args = [];
191
+ if ((c === "&" || c === "|") && command[i + 1] === c) i++;
192
+ else if (c === "&") return null;
193
+ } else if (/\s/.test(c)) wordEnd();
194
+ else word += c;
195
+ }
196
+ if (quote) return null;
197
+ wordEnd();
198
+ if (!args.length) return null;
199
+ result.push(args);
200
+ return result;
201
+ }
202
+ function readCommand(words) {
203
+ const prefix = READ_PREFIXES.find((p) => p.split(" ").every((w, i) => words[i] === w));
204
+ if (!prefix) return false;
205
+ const args = words.slice(prefix.split(" ").length);
206
+ if (prefix === "git branch" && args.some((a) => !a.startsWith("-")) && !args.includes("--list"))
207
+ return false;
208
+ let paths = false;
209
+ for (let i = 0; i < args.length; i++) {
210
+ const arg = args[i];
211
+ if (arg === void 0) return false;
212
+ if (paths || !arg.startsWith("-")) {
213
+ if (prefix === "git fetch" && !/^[\w./~-]+$/.test(arg)) return false;
214
+ continue;
215
+ }
216
+ if (arg === "--") {
217
+ paths = true;
218
+ continue;
219
+ }
220
+ if (FLAGS[prefix]?.includes(arg)) continue;
221
+ const flag = arg.split("=")[0] ?? "";
222
+ if (VALUES[prefix]?.includes(flag)) {
223
+ if (!arg.includes("=")) {
224
+ const value = args[++i];
225
+ if (!value || value.startsWith("-")) return false;
226
+ }
227
+ continue;
228
+ }
229
+ if (["git log", "git show"].includes(prefix) && /^-(?:n)?\d+$/.test(arg)) continue;
230
+ if (prefix === "ls" && /^-[alhtrSd1AF]+$/.test(arg)) continue;
231
+ if (prefix === "cat" && /^-[benstuvAET]+$/.test(arg)) continue;
232
+ if (prefix === "wc" && /^-[clmwL]+$/.test(arg)) continue;
233
+ if (["head", "tail"].includes(prefix) && /^-\d+$/.test(arg)) continue;
234
+ if (["head", "tail"].includes(prefix) && ["-n", "-c", "--lines", "--bytes"].includes(flag)) {
235
+ if (!/^[+-]?\d+$/.test(arg.includes("=") ? arg.slice(arg.indexOf("=") + 1) : args[++i] ?? ""))
236
+ return false;
237
+ continue;
238
+ }
239
+ return false;
240
+ }
241
+ return true;
242
+ }
243
+ function isReadOnlyCommand(command) {
244
+ const parsed = commands(command);
245
+ return parsed !== null && parsed.length > 0 && parsed.every(readCommand);
246
+ }
247
+ function readOnlySettings(askEverything = false) {
248
+ const quote = (s) => `'${s.replace(/'/g, "'\\''")}'`;
249
+ return {
250
+ permissions: { ask: ["Bash(git push *)"] },
251
+ hooks: {
252
+ PreToolUse: [
253
+ {
254
+ matcher: "Bash",
255
+ hooks: [
256
+ {
257
+ type: "command",
258
+ command: `${quote(process.execPath)} ${quote(resolve(process.argv[1] ?? ""))} hook runner-permission${askEverything ? " --ask-everything" : ""}`
259
+ }
260
+ ]
261
+ }
262
+ ]
263
+ }
264
+ };
265
+ }
266
+ function needsReadGuard(command, askEverything = false) {
267
+ if (isReadOnlyCommand(command)) return false;
268
+ const parsed = commands(command);
269
+ return askEverything || parsed === null || parsed.some(
270
+ (words) => READ_PREFIXES.some((prefix) => prefix.split(" ").every((word, i) => words[i] === word))
271
+ );
272
+ }
273
+ async function runnerPermissionHook() {
274
+ let input = "";
275
+ for await (const chunk of process.stdin) input += chunk;
276
+ let command;
277
+ try {
278
+ command = JSON.parse(input)?.tool_input?.command;
279
+ } catch {
280
+ }
281
+ if (typeof command === "string" && !needsReadGuard(command, process.argv.includes("--ask-everything")))
282
+ return;
283
+ process.stdout.write(
284
+ JSON.stringify({
285
+ hookSpecificOutput: {
286
+ hookEventName: "PreToolUse",
287
+ permissionDecision: "ask",
288
+ permissionDecisionReason: "This command needs your approval."
289
+ }
290
+ })
291
+ );
292
+ }
293
+
294
+ export {
295
+ READ_PREFIXES,
296
+ READ_TOOLS,
297
+ isReadOnlyCommand,
298
+ readOnlySettings,
299
+ needsReadGuard,
300
+ runnerPermissionHook
301
+ };
@@ -0,0 +1,336 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ ConnectFailure,
4
+ deviceLogin
5
+ } from "./chunk-F4WCO6Z4.js";
6
+ import {
7
+ ApiError,
8
+ ReauthError,
9
+ api
10
+ } from "./chunk-AG6SI6I2.js";
11
+ import {
12
+ CONFIG_DIR,
13
+ getOrigin,
14
+ readCredentials,
15
+ writeCredentials
16
+ } from "./chunk-3DIGCVL4.js";
17
+
18
+ // src/commands/runner.ts
19
+ import { randomBytes } from "crypto";
20
+ import {
21
+ chmodSync,
22
+ existsSync,
23
+ mkdirSync,
24
+ readFileSync,
25
+ renameSync,
26
+ rmSync,
27
+ writeFileSync
28
+ } from "fs";
29
+ import { homedir } from "os";
30
+ import { join } from "path";
31
+ var REGISTER_USAGE = "Usage: cloop runner register --webhook <url> --label <name> [--reactivate] [--rotate-secret]";
32
+ var REVOKE_USAGE = "Usage: cloop runner revoke --label <name>";
33
+ var VERIFY_USAGE = "Usage: cloop runner verify --label <name>";
34
+ function flag(argv, name) {
35
+ const inline = argv.find((value) => value.startsWith(`${name}=`));
36
+ if (inline) return inline.slice(name.length + 1);
37
+ const index = argv.indexOf(name);
38
+ return index >= 0 ? argv[index + 1] : void 0;
39
+ }
40
+ function secretPath(label) {
41
+ const safe = label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 48) || "runner";
42
+ return join(homedir(), CONFIG_DIR, "runners", `${safe}.json`);
43
+ }
44
+ function storedLabel(path) {
45
+ if (!existsSync(path)) return null;
46
+ try {
47
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
48
+ if (typeof parsed === "object" && parsed !== null && "label" in parsed && typeof parsed.label === "string") {
49
+ return parsed.label;
50
+ }
51
+ } catch {
52
+ }
53
+ throw new Error(
54
+ `local_file_unreadable: Cannot read the existing runner file at ${path}. Run cloop connect --webhook <endpoint> --name <different-name>.`
55
+ );
56
+ }
57
+ function assertNoPathCollision(path, label) {
58
+ const existingLabel = storedLabel(path);
59
+ if (existingLabel && existingLabel !== label) {
60
+ throw new Error(
61
+ `local_file_collision: Runner labels "${existingLabel}" and "${label}" use the same local file ${path}. Run cloop connect --webhook <endpoint> --name <different-name>.`
62
+ );
63
+ }
64
+ }
65
+ function requiredLabel(argv, usage) {
66
+ const label = flag(argv, "--label")?.trim();
67
+ if (!label) throw new Error(usage);
68
+ return label;
69
+ }
70
+ async function registerRunner(argv, say = (line) => process.stdout.write(line)) {
71
+ const url = flag(argv, "--webhook");
72
+ const label = requiredLabel(argv, REGISTER_USAGE);
73
+ if (!url) throw new Error(REGISTER_USAGE);
74
+ const reactivate = argv.includes("--reactivate");
75
+ const path = secretPath(label);
76
+ assertNoPathCollision(path, label);
77
+ const secret = randomBytes(32).toString("base64url");
78
+ mkdirSync(join(homedir(), CONFIG_DIR, "runners"), { recursive: true, mode: 448 });
79
+ const tempPath = `${path}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
80
+ writeFileSync(tempPath, `${JSON.stringify({ label, url, secret })}
81
+ `, { mode: 384 });
82
+ chmodSync(tempPath, 384);
83
+ let response;
84
+ try {
85
+ response = await api("/api/agent/mesh/runner-register", {
86
+ method: "POST",
87
+ body: { url, label, secret, reactivate, rotate_secret: argv.includes("--rotate-secret") },
88
+ timeoutMs: 2e4
89
+ });
90
+ } catch (error) {
91
+ rmSync(tempPath, { force: true });
92
+ throw error;
93
+ }
94
+ try {
95
+ writeFileSync(
96
+ tempPath,
97
+ `${JSON.stringify({ runner_id: response.runner_id, label: response.label, url, secret })}
98
+ `,
99
+ { mode: 384 }
100
+ );
101
+ chmodSync(tempPath, 384);
102
+ renameSync(tempPath, path);
103
+ } catch (error) {
104
+ rmSync(tempPath, { force: true });
105
+ throw error;
106
+ }
107
+ say(
108
+ response.verified ? `Registered and verified ${response.label}. Signing material is in ${path}.
109
+ ` : `Registered ${response.label}. Verification is still pending. Signing material is in ${path}.
110
+ `
111
+ );
112
+ return response;
113
+ }
114
+ async function revokeRunner(argv) {
115
+ const label = requiredLabel(argv, REVOKE_USAGE);
116
+ const path = secretPath(label);
117
+ assertNoPathCollision(path, label);
118
+ const response = await api("/api/agent/mesh/runner-revoke", {
119
+ method: "POST",
120
+ body: { label },
121
+ timeoutMs: 2e4
122
+ });
123
+ rmSync(path, { force: true });
124
+ process.stdout.write(`Revoked ${response.label}. Removed local signing material.
125
+ `);
126
+ }
127
+ function apiErrorCode(error) {
128
+ if (!(error instanceof ApiError)) return null;
129
+ try {
130
+ const body = JSON.parse(error.body);
131
+ if (body && typeof body === "object" && "error" in body && typeof body.error === "string" && /^[a-z][a-z0-9_]{0,63}$/.test(body.error))
132
+ return body.error;
133
+ } catch {
134
+ return null;
135
+ }
136
+ return null;
137
+ }
138
+ async function verifyRunner(argv, timeoutMs = 2e4) {
139
+ const label = requiredLabel(argv, VERIFY_USAGE);
140
+ try {
141
+ return await api("/api/agent/mesh/runner-verify", {
142
+ method: "POST",
143
+ body: { label },
144
+ timeoutMs
145
+ });
146
+ } catch (error) {
147
+ if (error instanceof ApiError && error.status === 409 && apiErrorCode(error) === "runner_already_verified") {
148
+ return { label, delivered: false, verified: true };
149
+ }
150
+ throw error;
151
+ }
152
+ }
153
+ function shellArg(value) {
154
+ return /^[a-zA-Z0-9._-]+$/.test(value) ? value : `'${value.replace(/'/g, "'\\''")}'`;
155
+ }
156
+ function recovery(error, name, phase) {
157
+ const code = apiErrorCode(error) ?? (error instanceof ReauthError ? "unauthenticated" : "request_failed");
158
+ const verify = `cloop runner verify --label ${shellArg(name)}`;
159
+ const next = code === "runner_label_taken" ? "Run cloop connect --webhook <endpoint> --name <different-name>." : code === "rate_limited" ? `Wait one hour, then run ${phase === "verification" ? verify : `cloop connect --webhook <endpoint> --name ${shellArg(name)}`}.` : code === "runner_reactivation_required" ? `Run cloop runner register --webhook <endpoint> --label ${shellArg(name)} --reactivate.` : code === "runner_secret_exists" ? `Run cloop connect --webhook <endpoint> --name ${shellArg(name)} --rotate-secret.` : error instanceof ReauthError ? `Run cloop login, then ${verify}.` : `Check the endpoint, then run ${phase === "verification" ? verify : `cloop connect --webhook <endpoint> --name ${shellArg(name)}`}.`;
160
+ return new ConnectFailure(
161
+ phase === "registration" ? "webhook_register_failed" : "webhook_verify_failed",
162
+ `Cloud agent ${phase} failed (${code}). ${next}`
163
+ );
164
+ }
165
+ async function waitForVerification(name) {
166
+ const deadline = Date.now() + 10 * 6e4;
167
+ let tries = 0;
168
+ while (Date.now() < deadline) {
169
+ const started = Date.now();
170
+ console.log(`[workstation:cloud-connect] Verification try ${++tries}.`);
171
+ try {
172
+ if ((await verifyRunner(
173
+ ["--label", name],
174
+ Math.max(1, Math.min(2e4, Math.floor((deadline - Date.now()) / 2)))
175
+ )).verified === true)
176
+ return;
177
+ } catch (error) {
178
+ if (!(error instanceof ApiError) || error.status !== 0 && error.status < 500 || apiErrorCode(error) === "webhook_not_configured")
179
+ throw recovery(error, name, "verification");
180
+ }
181
+ await new Promise(
182
+ (resolve) => setTimeout(
183
+ resolve,
184
+ Math.max(0, Math.min(15e3 - (Date.now() - started), deadline - Date.now()))
185
+ )
186
+ );
187
+ }
188
+ throw new ConnectFailure(
189
+ "webhook_verify_failed",
190
+ `No verification within 10 minutes. Resume with: cloop runner verify --label ${shellArg(name)}`
191
+ );
192
+ }
193
+ async function connectWebhook(argv, attempt) {
194
+ const endpoint = flag(argv, "--webhook");
195
+ let url;
196
+ try {
197
+ url = new URL(endpoint ?? "");
198
+ const localhost = url.hostname === "localhost" && url.protocol === "http:" && argv.includes("--insecure-localhost");
199
+ if (!endpoint || endpoint.length > 2e3 || url.href.length > 2e3 || url.username || url.password || !localhost && (url.protocol !== "https:" || url.hostname === "localhost" || /^[\[\]\da-f:.]+$/i.test(url.hostname)))
200
+ throw new Error();
201
+ } catch {
202
+ throw new ConnectFailure(
203
+ "bad_flag",
204
+ "--webhook needs an HTTPS endpoint of at most 2000 characters, without credentials or an IP address. For local proofs, run cloop connect --webhook http://localhost:<port> --insecure-localhost."
205
+ );
206
+ }
207
+ const named = argv.some((arg) => arg === "--name" || arg.startsWith("--name="));
208
+ const segment = url.pathname.split("/").find(Boolean);
209
+ const name = named ? flag(argv, "--name")?.trim() ?? "" : `${url.host}${segment ? `-${segment}` : ""}`;
210
+ if (!name || name.length > 80 || name.startsWith("--") || Array.from(name).some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127)) {
211
+ throw new ConnectFailure("bad_flag", "--name needs a short name of 1 to 80 characters.");
212
+ }
213
+ const path = secretPath(name);
214
+ attempt.step = "webhook_register";
215
+ try {
216
+ assertNoPathCollision(path, name);
217
+ } catch (error) {
218
+ throw new ConnectFailure(
219
+ "webhook_register_failed",
220
+ error instanceof Error ? error.message : "local_file_collision: Choose another --name."
221
+ );
222
+ }
223
+ const origin = getOrigin();
224
+ const credentials = readCredentials();
225
+ attempt.step = "login";
226
+ const login = async () => {
227
+ attempt.deviceToken = await deviceLogin({ origin, deviceName: name });
228
+ writeCredentials({ origin, token: attempt.deviceToken, deviceName: name });
229
+ };
230
+ if (credentials?.token && credentials.origin.replace(/\/+$/, "") === origin) {
231
+ attempt.deviceToken = credentials.token;
232
+ } else await login();
233
+ const lookup = () => api("/api/agent/mesh/runner-register", {
234
+ query: { label: name },
235
+ timeoutMs: 2e4
236
+ });
237
+ let existing;
238
+ try {
239
+ try {
240
+ existing = (await lookup()).runner;
241
+ } catch (error) {
242
+ if (!(error instanceof ReauthError) || !credentials?.token) throw error;
243
+ await login();
244
+ existing = (await lookup()).runner;
245
+ }
246
+ } catch (error) {
247
+ if (error instanceof ConnectFailure) throw error;
248
+ throw recovery(error, name, "registration");
249
+ }
250
+ attempt.step = "webhook_register";
251
+ if (existing && existing.url !== url.href) {
252
+ throw recovery(new ApiError(409, "", '{"error":"runner_label_taken"}'), name, "registration");
253
+ }
254
+ if (existing?.revoked) {
255
+ throw recovery(
256
+ new ApiError(409, "", '{"error":"runner_reactivation_required"}'),
257
+ name,
258
+ "registration"
259
+ );
260
+ }
261
+ if (existing?.verified) {
262
+ console.log(`Cloop runner ${name} is already a verified cloud agent.`);
263
+ return;
264
+ }
265
+ if (!existing || argv.includes("--rotate-secret")) {
266
+ try {
267
+ await registerRunner(
268
+ [
269
+ "--webhook",
270
+ url.href,
271
+ "--label",
272
+ name,
273
+ ...argv.includes("--rotate-secret") ? ["--rotate-secret"] : []
274
+ ],
275
+ () => {
276
+ }
277
+ );
278
+ } catch (error) {
279
+ throw recovery(error, name, "registration");
280
+ }
281
+ console.log(`[workstation:cloud-connect] Registered ${name}.`);
282
+ } else {
283
+ let stored;
284
+ try {
285
+ stored = JSON.parse(readFileSync(path, "utf8"));
286
+ } catch {
287
+ stored = null;
288
+ }
289
+ if (!stored || typeof stored !== "object" || !("secret" in stored) || typeof stored.secret !== "string" || !("url" in stored) || stored.url !== url.href) {
290
+ throw recovery(
291
+ new ApiError(409, "", '{"error":"runner_secret_exists"}'),
292
+ name,
293
+ "registration"
294
+ );
295
+ }
296
+ console.log(`[workstation:cloud-connect] Resuming ${name}; keeping its signing secret.`);
297
+ }
298
+ console.log(
299
+ `Signing material is in ${path}.
300
+ Verify X-Cloop-Signature with HMAC-SHA256 over runner_id.X-Cloop-Timestamp.raw_body; see docs/runbooks/cloop-local.md#cloud-webhook-signatures.
301
+ The command will now wait for your endpoint to answer while you set it up.`
302
+ );
303
+ attempt.step = "webhook_verify";
304
+ await waitForVerification(name);
305
+ console.log(`[workstation:cloud-connect] Verified ${name}.`);
306
+ console.log(`Cloop runner ${name} is a verified cloud agent.`);
307
+ }
308
+ async function runnerCommand(argv) {
309
+ switch (argv[0]) {
310
+ case "register":
311
+ await registerRunner(argv);
312
+ return;
313
+ case "revoke":
314
+ await revokeRunner(argv);
315
+ return;
316
+ case "verify": {
317
+ const response = await verifyRunner(argv);
318
+ process.stdout.write(
319
+ response.verified ? `Verified ${response.label}.
320
+ ` : response.delivered ? `Sent a verification request to ${response.label}.
321
+ ` : `Requested verification for ${response.label}, but its endpoint did not answer.
322
+ `
323
+ );
324
+ return;
325
+ }
326
+ default:
327
+ throw new Error(`${REGISTER_USAGE}
328
+ ${REVOKE_USAGE}
329
+ ${VERIFY_USAGE}`);
330
+ }
331
+ }
332
+
333
+ export {
334
+ connectWebhook,
335
+ runnerCommand
336
+ };
@@ -28,11 +28,13 @@ import {
28
28
  tilde,
29
29
  unitEnv,
30
30
  unitFor
31
- } from "./chunk-2ZVYM4JU.js";
32
- import "./chunk-AQGBNKUG.js";
31
+ } from "./chunk-KKFRQ4HQ.js";
33
32
  import "./chunk-JX6VG5FE.js";
33
+ import "./chunk-R3CLO2FB.js";
34
+ import "./chunk-TIXA2YXR.js";
35
+ import "./chunk-F4WCO6Z4.js";
34
36
  import "./chunk-AG6SI6I2.js";
35
- import "./chunk-OKF4BDBH.js";
37
+ import "./chunk-FW7MMQQV.js";
36
38
  import "./chunk-3DIGCVL4.js";
37
39
  export {
38
40
  DEFAULT_T3_URL,