@cloop/runner 0.2.1 → 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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-OKF4BDBH.js";
4
+ } from "./chunk-7BREDPJD.js";
5
5
  import {
6
6
  applyEnvironmentFlag
7
7
  } from "./chunk-3DIGCVL4.js";
@@ -12,6 +12,9 @@ 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)
@@ -19,14 +22,14 @@ Usage:
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
24
  cloop connect [--repo <path>]... [--driver t3|claude-code|codex] [--fallback-model <list>]
22
- [--no-service] [--no-start]
25
+ [--no-service] [--no-start] [--ask-everything] [--full-access]
23
26
  Make this machine a Cloop runner: T3 Code, else
24
27
  Claude Code or Codex in the repos you name
25
28
  cloop disconnect [--yes] Stop being a Cloop runner: revoke this computer on
26
29
  Cloop, remove its service and runner files
27
30
  cloop box connect cloop connect with T3 Code forced
28
31
  cloop box run Answer the Cloop Agent's runner calls (daemon)
29
- cloop runner register --webhook <url> --label <name> [--reactivate]
32
+ cloop runner register --webhook <url> --label <name> [--reactivate] [--rotate-secret]
30
33
  Register a cloud runner endpoint
31
34
  cloop runner verify --label <name>
32
35
  Send a fresh verification request
@@ -40,7 +43,7 @@ async function main() {
40
43
  switch (command) {
41
44
  case "login":
42
45
  case "auth": {
43
- const { loginCommand } = await import("./login-4GUYT5MR.js");
46
+ const { loginCommand } = await import("./login-CUQR2MBW.js");
44
47
  await loginCommand(argv);
45
48
  break;
46
49
  }
@@ -50,37 +53,40 @@ async function main() {
50
53
  break;
51
54
  }
52
55
  case "serve": {
53
- const { startMcpServer } = await import("./mcp-server-TV7MHVHZ.js");
56
+ const { startMcpServer } = await import("./mcp-server-YDRR6DYJ.js");
54
57
  await startMcpServer();
55
58
  break;
56
59
  }
57
60
  case "statusline": {
58
- const { statuslineCommand } = await import("./statusline-6JMHIL54.js");
61
+ const { statuslineCommand } = await import("./statusline-SLP4CAFB.js");
59
62
  statuslineCommand();
60
63
  break;
61
64
  }
62
65
  case "connect": {
63
- const { connectCommand } = await import("./connect-LRQ4C3KK.js");
66
+ const { connectCommand } = await import("./connect-WRQN37SU.js");
64
67
  await connectCommand(argv.slice(1));
65
68
  break;
66
69
  }
67
70
  case "disconnect": {
68
- const { disconnectCommand } = await import("./disconnect-FQ6ODTTE.js");
71
+ const { disconnectCommand } = await import("./disconnect-KTII7TXC.js");
69
72
  await disconnectCommand(argv.slice(1));
70
73
  break;
71
74
  }
72
75
  case "box": {
73
- const { boxCommand } = await import("./box-HBQ4ZM2Y.js");
76
+ const { boxCommand } = await import("./box-BS6BSQUO.js");
74
77
  await boxCommand(argv.slice(1));
75
78
  break;
76
79
  }
77
80
  case "runner": {
78
- const { runnerCommand } = await import("./runner-5H7ECAZ6.js");
81
+ const { runnerCommand } = await import("./runner-WW5OU2YU.js");
79
82
  await runnerCommand(argv.slice(1));
80
83
  break;
81
84
  }
82
85
  case "hook": {
83
- if (argv[1] === "session-start") {
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") {
84
90
  const { hookSessionStart } = await import("./hook-session-start-MT67MMDM.js");
85
91
  await hookSessionStart();
86
92
  } else if (argv[1] === "activity") {
@@ -3,9 +3,9 @@ import {
3
3
  deviceLogin,
4
4
  loginCommand,
5
5
  refusalSentence
6
- } from "./chunk-AQGBNKUG.js";
6
+ } from "./chunk-F36GGCXC.js";
7
7
  import "./chunk-AG6SI6I2.js";
8
- import "./chunk-OKF4BDBH.js";
8
+ import "./chunk-7BREDPJD.js";
9
9
  import "./chunk-3DIGCVL4.js";
10
10
  export {
11
11
  deviceLogin,
@@ -1,4 +1,8 @@
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,
@@ -15,10 +19,6 @@ 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,
@@ -33,7 +33,7 @@ import {
33
33
  } from "./chunk-AG6SI6I2.js";
34
34
  import {
35
35
  VERSION
36
- } from "./chunk-OKF4BDBH.js";
36
+ } from "./chunk-7BREDPJD.js";
37
37
  import {
38
38
  getMeshUrl,
39
39
  getToken
@@ -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
+ };
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-4LFQXBWP.js";
8
8
  import {
9
9
  VERSION
10
- } from "./chunk-OKF4BDBH.js";
10
+ } from "./chunk-7BREDPJD.js";
11
11
  import {
12
12
  getToken
13
13
  } from "./chunk-3DIGCVL4.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloop/runner",
3
- "version": "0.2.1",
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,147 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- api
4
- } from "./chunk-AG6SI6I2.js";
5
- import {
6
- CONFIG_DIR
7
- } from "./chunk-3DIGCVL4.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
- };