@cloop/runner 0.2.5 → 0.2.7

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.
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  DEFAULT_T3_URL,
4
+ DRIVER_NAME,
4
5
  T3PairError,
5
6
  askHidden,
6
7
  askOrClosed,
@@ -11,6 +12,7 @@ import {
11
12
  connectChosen,
12
13
  connectCommand,
13
14
  detect,
15
+ ensureLinger,
14
16
  fallbackDriver,
15
17
  fallbackLine,
16
18
  findCheckouts,
@@ -23,27 +25,33 @@ import {
23
25
  pairT3,
24
26
  parsePicks,
25
27
  programFor,
28
+ rememberedDriver,
26
29
  rerunCommand,
27
30
  resolveRepos,
28
31
  revokeReplaced,
32
+ runConnect,
29
33
  runSteps,
30
34
  sessionFromLink,
35
+ systemServices,
31
36
  systemdAssignment,
32
37
  systemdWord,
33
38
  tilde,
34
39
  unitEnv,
35
40
  unitFor
36
- } from "./chunk-2FLM3ESE.js";
37
- import "./chunk-G6JAEE2Y.js";
41
+ } from "./chunk-X7MNNKU3.js";
42
+ import "./chunk-MWWA2VH7.js";
43
+ import "./chunk-LNQLGVYC.js";
38
44
  import "./chunk-JX6VG5FE.js";
45
+ import "./chunk-VK6GV757.js";
39
46
  import "./chunk-R3CLO2FB.js";
40
- import "./chunk-53M5DK6D.js";
41
- import "./chunk-4XDYJZLF.js";
47
+ import "./chunk-JZNBZUPZ.js";
48
+ import "./chunk-SANEFNTU.js";
42
49
  import "./chunk-AG6SI6I2.js";
43
- import "./chunk-BFVL3E2C.js";
50
+ import "./chunk-KH6FK6UQ.js";
44
51
  import "./chunk-3DIGCVL4.js";
45
52
  export {
46
53
  DEFAULT_T3_URL,
54
+ DRIVER_NAME,
47
55
  T3PairError,
48
56
  askHidden,
49
57
  askOrClosed,
@@ -54,6 +62,7 @@ export {
54
62
  connectChosen,
55
63
  connectCommand,
56
64
  detect,
65
+ ensureLinger,
57
66
  fallbackDriver,
58
67
  fallbackLine,
59
68
  findCheckouts,
@@ -66,11 +75,14 @@ export {
66
75
  pairT3,
67
76
  parsePicks,
68
77
  programFor,
78
+ rememberedDriver,
69
79
  rerunCommand,
70
80
  resolveRepos,
71
81
  revokeReplaced,
82
+ runConnect,
72
83
  runSteps,
73
84
  sessionFromLink,
85
+ systemServices,
74
86
  systemdAssignment,
75
87
  systemdWord,
76
88
  tilde,
@@ -1,26 +1,28 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  localRunsFilePath
4
- } from "./chunk-KOOAVO2C.js";
5
- import "./chunk-VK6GV757.js";
4
+ } from "./chunk-JFCEKATW.js";
6
5
  import {
7
6
  installedService,
8
7
  revokeOwnDevice,
9
8
  runSteps,
10
- runnerStatePath,
11
- threadsFilePath,
12
9
  tokenGone
13
- } from "./chunk-2FLM3ESE.js";
10
+ } from "./chunk-X7MNNKU3.js";
11
+ import {
12
+ runnerStatePath,
13
+ threadsFilePath
14
+ } from "./chunk-MWWA2VH7.js";
14
15
  import {
15
16
  boxPath,
16
17
  readRunnerConfig
17
- } from "./chunk-G6JAEE2Y.js";
18
+ } from "./chunk-LNQLGVYC.js";
18
19
  import "./chunk-JX6VG5FE.js";
20
+ import "./chunk-VK6GV757.js";
19
21
  import "./chunk-R3CLO2FB.js";
20
- import "./chunk-53M5DK6D.js";
21
- import "./chunk-4XDYJZLF.js";
22
+ import "./chunk-JZNBZUPZ.js";
23
+ import "./chunk-SANEFNTU.js";
22
24
  import "./chunk-AG6SI6I2.js";
23
- import "./chunk-BFVL3E2C.js";
25
+ import "./chunk-KH6FK6UQ.js";
24
26
  import {
25
27
  getOrigin
26
28
  } from "./chunk-3DIGCVL4.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-BFVL3E2C.js";
4
+ } from "./chunk-KH6FK6UQ.js";
5
5
  import {
6
6
  applyEnvironmentFlag
7
7
  } from "./chunk-3DIGCVL4.js";
@@ -29,6 +29,8 @@ Usage:
29
29
  link from T3 Code (Settings, Connections,
30
30
  Create pairing link) at the question, or pass
31
31
  it with --t3-pair
32
+ cloop use t3|claude-code|codex Run Cloop work here with that harness. It reconnects
33
+ this machine, swaps its service, and keeps the choice
32
34
  cloop disconnect [--yes] Stop being a Cloop runner: revoke this computer on
33
35
  Cloop, remove its service and runner files
34
36
  cloop box connect cloop connect with T3 Code forced
@@ -36,6 +38,8 @@ Usage:
36
38
  cloop runs List this machine's runs: open ones, and the last 24 hours
37
39
  cloop watch [id] Follow a run as it works. No id: the newest open run.
38
40
  Stop it from Threads.
41
+ cloop takeover [id] Stop a running Claude Code or Codex run and carry it on
42
+ in this terminal. No id: the newest open run.
39
43
  cloop resume <id> Open a finished run in Claude Code, in its repository
40
44
  cloop runner register --webhook <url> --label <name> [--reactivate] [--rotate-secret]
41
45
  Register a cloud runner endpoint
@@ -51,7 +55,7 @@ async function main() {
51
55
  switch (command) {
52
56
  case "login":
53
57
  case "auth": {
54
- const { loginCommand } = await import("./login-3HHGBYJ7.js");
58
+ const { loginCommand } = await import("./login-XK4DOOGZ.js");
55
59
  await loginCommand(argv);
56
60
  break;
57
61
  }
@@ -61,47 +65,57 @@ async function main() {
61
65
  break;
62
66
  }
63
67
  case "serve": {
64
- const { startMcpServer } = await import("./mcp-server-FOICWAYA.js");
68
+ const { startMcpServer } = await import("./mcp-server-GDTT45SF.js");
65
69
  await startMcpServer();
66
70
  break;
67
71
  }
68
72
  case "statusline": {
69
- const { statuslineCommand } = await import("./statusline-4HJMU355.js");
73
+ const { statuslineCommand } = await import("./statusline-6WXP6S3D.js");
70
74
  statuslineCommand();
71
75
  break;
72
76
  }
73
77
  case "connect": {
74
- const { connectCommand } = await import("./connect-FXO5ETUM.js");
78
+ const { connectCommand } = await import("./connect-GSGNPOPK.js");
75
79
  await connectCommand(argv.slice(1));
76
80
  break;
77
81
  }
82
+ case "use": {
83
+ const { useCommand } = await import("./use-TBSTJORL.js");
84
+ process.exitCode = await useCommand(argv.slice(1));
85
+ break;
86
+ }
78
87
  case "disconnect": {
79
- const { disconnectCommand } = await import("./disconnect-EDQ7KXTR.js");
88
+ const { disconnectCommand } = await import("./disconnect-VTIIRAIV.js");
80
89
  await disconnectCommand(argv.slice(1));
81
90
  break;
82
91
  }
83
92
  case "box": {
84
- const { boxCommand } = await import("./box-S2KILP32.js");
93
+ const { boxCommand } = await import("./box-U65RXLCX.js");
85
94
  await boxCommand(argv.slice(1));
86
95
  break;
87
96
  }
88
97
  case "runs": {
89
- const { runsCommand } = await import("./runs-N6RLOEQG.js");
98
+ const { runsCommand } = await import("./runs-2CZ3YZGI.js");
90
99
  process.exitCode = runsCommand();
91
100
  break;
92
101
  }
93
102
  case "watch": {
94
- const { watchCommand } = await import("./runs-N6RLOEQG.js");
103
+ const { watchCommand } = await import("./runs-2CZ3YZGI.js");
95
104
  process.exitCode = await watchCommand(argv.slice(1));
96
105
  break;
97
106
  }
107
+ case "takeover": {
108
+ const { takeoverCommand } = await import("./takeover-WHU4CEKP.js");
109
+ process.exitCode = await takeoverCommand(argv.slice(1));
110
+ break;
111
+ }
98
112
  case "resume": {
99
- const { resumeCommand } = await import("./runs-N6RLOEQG.js");
113
+ const { resumeCommand } = await import("./runs-2CZ3YZGI.js");
100
114
  process.exitCode = await resumeCommand(argv.slice(1));
101
115
  break;
102
116
  }
103
117
  case "runner": {
104
- const { runnerCommand } = await import("./runner-R7XTMUHH.js");
118
+ const { runnerCommand } = await import("./runner-ST77ZDLI.js");
105
119
  await runnerCommand(argv.slice(1));
106
120
  break;
107
121
  }
@@ -110,10 +124,10 @@ async function main() {
110
124
  const { runnerPermissionHook } = await import("./read-permissions-SPOKGVLO.js");
111
125
  await runnerPermissionHook();
112
126
  } else if (argv[1] === "session-start") {
113
- const { hookSessionStart } = await import("./hook-session-start-GEBGA63R.js");
127
+ const { hookSessionStart } = await import("./hook-session-start-YSEV5DCB.js");
114
128
  await hookSessionStart();
115
129
  } else if (argv[1] === "activity") {
116
- const { hookActivity } = await import("./hook-activity-R7OPEYBX.js");
130
+ const { hookActivity } = await import("./hook-activity-LBYV4WJW.js");
117
131
  await hookActivity();
118
132
  } else {
119
133
  console.error(`Unknown hook: ${argv[1] ?? "(none)"}`);
@@ -3,9 +3,9 @@ import {
3
3
  deviceLogin,
4
4
  loginCommand,
5
5
  refusalSentence
6
- } from "./chunk-4XDYJZLF.js";
6
+ } from "./chunk-SANEFNTU.js";
7
7
  import "./chunk-AG6SI6I2.js";
8
- import "./chunk-BFVL3E2C.js";
8
+ import "./chunk-KH6FK6UQ.js";
9
9
  import "./chunk-3DIGCVL4.js";
10
10
  export {
11
11
  deviceLogin,
@@ -15,10 +15,6 @@ import {
15
15
  syncInboxPending,
16
16
  writeState
17
17
  } from "./chunk-J6AEO3GT.js";
18
- import {
19
- sanitizeLabel,
20
- sanitizeUntrusted
21
- } from "./chunk-VK6GV757.js";
22
18
  import {
23
19
  HeartbeatClient,
24
20
  detectPlatform,
@@ -27,13 +23,17 @@ import {
27
23
  getSurface,
28
24
  newSessionKey
29
25
  } from "./chunk-JX6VG5FE.js";
26
+ import {
27
+ sanitizeLabel,
28
+ sanitizeUntrusted
29
+ } from "./chunk-VK6GV757.js";
30
30
  import {
31
31
  ReauthError,
32
32
  api
33
33
  } from "./chunk-AG6SI6I2.js";
34
34
  import {
35
35
  VERSION
36
- } from "./chunk-BFVL3E2C.js";
36
+ } from "./chunk-KH6FK6UQ.js";
37
37
  import {
38
38
  getMeshUrl,
39
39
  getToken
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  connectWebhook,
4
4
  runnerCommand
5
- } from "./chunk-53M5DK6D.js";
6
- import "./chunk-4XDYJZLF.js";
5
+ } from "./chunk-JZNBZUPZ.js";
6
+ import "./chunk-SANEFNTU.js";
7
7
  import "./chunk-AG6SI6I2.js";
8
- import "./chunk-BFVL3E2C.js";
8
+ import "./chunk-KH6FK6UQ.js";
9
9
  import "./chunk-3DIGCVL4.js";
10
10
  export {
11
11
  connectWebhook,
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ findRun,
4
+ lastLines,
5
+ recentRuns,
6
+ resumeCommand,
7
+ runState,
8
+ runsCommand,
9
+ sessionFolder,
10
+ watchCommand
11
+ } from "./chunk-MC4DJ4LX.js";
12
+ import "./chunk-JFCEKATW.js";
13
+ import "./chunk-LNQLGVYC.js";
14
+ import "./chunk-VK6GV757.js";
15
+ import "./chunk-3DIGCVL4.js";
16
+ export {
17
+ findRun,
18
+ lastLines,
19
+ recentRuns,
20
+ resumeCommand,
21
+ runState,
22
+ runsCommand,
23
+ sessionFolder,
24
+ watchCommand
25
+ };
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VK6GV757.js";
8
8
  import {
9
9
  VERSION
10
- } from "./chunk-BFVL3E2C.js";
10
+ } from "./chunk-KH6FK6UQ.js";
11
11
  import {
12
12
  getToken
13
13
  } from "./chunk-3DIGCVL4.js";
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ endInFile,
4
+ replyPath,
5
+ serveTakeovers,
6
+ takeTakeoverReply,
7
+ takeTakeoverRequests,
8
+ takeoverCommand,
9
+ takeoverDir,
10
+ writeTakeoverReply,
11
+ writeTakeoverRequest
12
+ } from "./chunk-DLFNATEZ.js";
13
+ import "./chunk-MC4DJ4LX.js";
14
+ import "./chunk-JFCEKATW.js";
15
+ import "./chunk-MWWA2VH7.js";
16
+ import "./chunk-LNQLGVYC.js";
17
+ import "./chunk-JX6VG5FE.js";
18
+ import "./chunk-VK6GV757.js";
19
+ import "./chunk-AG6SI6I2.js";
20
+ import "./chunk-3DIGCVL4.js";
21
+ export {
22
+ endInFile,
23
+ replyPath,
24
+ serveTakeovers,
25
+ takeTakeoverReply,
26
+ takeTakeoverRequests,
27
+ takeoverCommand,
28
+ takeoverDir,
29
+ writeTakeoverReply,
30
+ writeTakeoverRequest
31
+ };
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ DRIVER_NAME,
4
+ runConnect
5
+ } from "./chunk-X7MNNKU3.js";
6
+ import "./chunk-MWWA2VH7.js";
7
+ import {
8
+ isLocal,
9
+ readRunnerConfig
10
+ } from "./chunk-LNQLGVYC.js";
11
+ import "./chunk-JX6VG5FE.js";
12
+ import "./chunk-VK6GV757.js";
13
+ import "./chunk-R3CLO2FB.js";
14
+ import "./chunk-JZNBZUPZ.js";
15
+ import "./chunk-SANEFNTU.js";
16
+ import "./chunk-AG6SI6I2.js";
17
+ import "./chunk-KH6FK6UQ.js";
18
+ import "./chunk-3DIGCVL4.js";
19
+
20
+ // src/commands/use.ts
21
+ var DRIVERS = ["t3", "claude-code", "codex"];
22
+ function machineNoun(platform) {
23
+ return platform === "darwin" ? "This Mac" : "This machine";
24
+ }
25
+ function useArgs(driver, rest) {
26
+ const previous = readRunnerConfig();
27
+ const repos = driver !== "t3" && !rest.includes("--repo") && previous && isLocal(previous) ? previous.repos.flatMap((r) => ["--repo", r.path]) : [];
28
+ return ["--driver", driver, ...repos, ...rest];
29
+ }
30
+ async function useCommand(argv, deps = {}) {
31
+ const out = deps.out ?? ((line) => console.log(line));
32
+ const log = deps.log ?? ((line) => console.error(line));
33
+ const driver = argv[0];
34
+ if (!driver || !DRIVERS.includes(driver)) {
35
+ out("Usage: cloop use t3|claude-code|codex");
36
+ return 1;
37
+ }
38
+ const before = readRunnerConfig();
39
+ const from = before ? before.driver ?? "t3" : "none";
40
+ const error = await (deps.connect ?? runConnect)(useArgs(driver, argv.slice(1)), deps);
41
+ log(`[runner:use] from=${from} to=${driver} outcome=${error ? `failed error=${error}` : "ok"}`);
42
+ if (error) return 1;
43
+ out(
44
+ `${machineNoun(deps.platform ?? process.platform)} now runs Cloop work in ${DRIVER_NAME[driver]}.`
45
+ );
46
+ return 0;
47
+ }
48
+ export {
49
+ machineNoun,
50
+ useArgs,
51
+ useCommand
52
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloop/runner",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
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.",
@@ -5,7 +5,6 @@ import {
5
5
  toolPhrase,
6
6
  writeSessionState
7
7
  } from "./chunk-AEWIRLRS.js";
8
- import "./chunk-VK6GV757.js";
9
8
  import {
10
9
  HeartbeatClient,
11
10
  detectPlatform,
@@ -14,6 +13,7 @@ import {
14
13
  getSurface,
15
14
  sanitizeSessionKey
16
15
  } from "./chunk-JX6VG5FE.js";
16
+ import "./chunk-VK6GV757.js";
17
17
  import "./chunk-AG6SI6I2.js";
18
18
  import {
19
19
  getToken
@@ -1,7 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- sanitizeLabel
4
- } from "./chunk-VK6GV757.js";
5
2
  import {
6
3
  HeartbeatClient,
7
4
  detectPlatform,
@@ -10,6 +7,9 @@ import {
10
7
  getSurface,
11
8
  newSessionKey
12
9
  } from "./chunk-JX6VG5FE.js";
10
+ import {
11
+ sanitizeLabel
12
+ } from "./chunk-VK6GV757.js";
13
13
  import {
14
14
  api
15
15
  } from "./chunk-AG6SI6I2.js";