@cloop/runner 0.3.54 → 0.3.55

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.
@@ -39,7 +39,7 @@ import {
39
39
  systemServices,
40
40
  unitFor,
41
41
  which
42
- } from "./chunk-LYUI7RLX.js";
42
+ } from "./chunk-M2BOHVUC.js";
43
43
  import {
44
44
  MeshSocket,
45
45
  WAKE_TICK_MS,
@@ -113,14 +113,14 @@ import {
113
113
  olderThan
114
114
  } from "./chunk-365HFCQQ.js";
115
115
  import "./chunk-PKIEWBR7.js";
116
- import "./chunk-FQRVNWI6.js";
117
- import "./chunk-QJRULRYS.js";
116
+ import "./chunk-2QKGVFWN.js";
117
+ import "./chunk-TKWZ6GLL.js";
118
118
  import {
119
119
  getMachine
120
120
  } from "./chunk-SBYSVZ7J.js";
121
121
  import {
122
122
  VERSION
123
- } from "./chunk-FCCAACSV.js";
123
+ } from "./chunk-6CUPNFNR.js";
124
124
  import {
125
125
  getMeshUrl,
126
126
  getOrigin,
@@ -869,6 +869,11 @@ var CloudroomDriver = class {
869
869
  repos;
870
870
  /** Repository runs still being prepared after launch answered, by thread. A failed one stays, for watch to report. */
871
871
  preparing = /* @__PURE__ */ new Map();
872
+ /**
873
+ * Follow-ups that came while a run was prepared, by thread, then command id.
874
+ * Core has no session for them yet; they go in once the run's prompt is in.
875
+ */
876
+ early = /* @__PURE__ */ new Map();
872
877
  /** Runs stopped while still being prepared, or while moving off a refused model. */
873
878
  stopped = /* @__PURE__ */ new Set();
874
879
  /** Runs' model facts, by thread, as the store keeps them. */
@@ -1133,14 +1138,20 @@ var CloudroomDriver = class {
1133
1138
  const again = this.preparing.has(thread);
1134
1139
  if (!again) {
1135
1140
  if (a.attachments?.length) await photosOnce();
1141
+ this.early.set(thread, /* @__PURE__ */ new Map());
1136
1142
  const prep = this.repos.locked(place.clone, go).then(() => {
1137
1143
  this.preparing.delete(thread);
1144
+ return this.sendEarly(thread, a.work_id);
1145
+ });
1146
+ prep.catch((err) => {
1147
+ const dropped = this.early.get(thread)?.size ?? 0;
1148
+ this.early.delete(thread);
1149
+ if (dropped && err !== STOPPED_IN_PREPARATION)
1150
+ this.deps.followUpLost?.({ work: a.work_id, n: dropped });
1151
+ this.log(
1152
+ `launch failed work=${a.work_id} thread=${thread} followups_dropped=${dropped}: ${err instanceof Error ? err.message : String(err)}`
1153
+ );
1138
1154
  });
1139
- prep.catch(
1140
- (err) => this.log(
1141
- `launch failed work=${a.work_id} thread=${thread}: ${err instanceof Error ? err.message : String(err)}`
1142
- )
1143
- );
1144
1155
  this.preparing.set(thread, prep);
1145
1156
  }
1146
1157
  return answer(again || Boolean(existing));
@@ -1154,6 +1165,42 @@ var CloudroomDriver = class {
1154
1165
  */
1155
1166
  async send(a) {
1156
1167
  const id = this.carrier(a.thread_id);
1168
+ const early = this.early.get(id);
1169
+ if (early && !a.answer) {
1170
+ early.set(a.command_id, early.get(a.command_id) ?? a);
1171
+ this.log(`send thread=${id} waits for its run's prompt`);
1172
+ return { delivered: "queue" };
1173
+ }
1174
+ return this.sendNow(id, a);
1175
+ }
1176
+ /**
1177
+ * The follow-ups that came while the run was prepared, in the order they
1178
+ * came. One that comes while these go in joins the end of the line. Each
1179
+ * goes as a resume: core may not have counted the run's prompt yet. The
1180
+ * app already told the owner each one is queued, so a failure here goes to
1181
+ * the mesh as `followup_lost`, the one place it is seen.
1182
+ */
1183
+ async sendEarly(thread, work) {
1184
+ const early = this.early.get(thread);
1185
+ if (!early) return;
1186
+ for (const a of early.values()) {
1187
+ await this.sendNow(thread, { ...a, resume: true }).then(
1188
+ (r) => this.log(`send thread=${thread} after its prompt delivered=${r.delivered}`),
1189
+ (err) => {
1190
+ this.deps.followUpLost?.({
1191
+ work,
1192
+ n: 1,
1193
+ ...err instanceof BoxToolError ? { error: err.code } : {}
1194
+ });
1195
+ this.log(
1196
+ `send thread=${thread} after its prompt failed: ${err instanceof Error ? err.message : String(err)}`
1197
+ );
1198
+ }
1199
+ );
1200
+ }
1201
+ this.early.delete(thread);
1202
+ }
1203
+ async sendNow(id, a) {
1157
1204
  const s = await this.session(id);
1158
1205
  if (a.answer) return { delivered: "question_changed", question: null, question_id: null };
1159
1206
  const steer = coreRequestId("steer", a.command_id);
@@ -2862,7 +2909,9 @@ async function run2() {
2862
2909
  ...hosted.harness === "codex" ? { models: () => codexModels() } : {},
2863
2910
  // Beside the daemon's threads: the model a Task named, a run's move off a refused one, refusals and the last list.
2864
2911
  runModels: fileRunModels(hostedRunModelsPath(hosted.harness)),
2865
- log: log2
2912
+ log: log2,
2913
+ // Called only once calls arrive, so the socket below exists by then.
2914
+ followUpLost: ({ work, n, error }) => socket.send(runnerLog("followup_lost", { work, n, tool: "thread.send", error }))
2866
2915
  }) : local && (name === "claude-code" || name === "codex") ? await localDriver(local, name) : new T3Driver({
2867
2916
  client: () => t3.client,
2868
2917
  t3Bin: isT3(cfg) ? cfg.t3Bin : null,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ConnectFailure,
4
4
  deviceLogin
5
- } from "./chunk-QJRULRYS.js";
5
+ } from "./chunk-TKWZ6GLL.js";
6
6
  import {
7
7
  ApiError,
8
8
  ReauthError,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/version.ts
4
- var VERSION = true ? "0.3.54" : "0.0.0-dev";
4
+ var VERSION = true ? "0.3.55" : "0.0.0-dev";
5
5
 
6
6
  export {
7
7
  VERSION
@@ -64,14 +64,14 @@ import {
64
64
  } from "./chunk-PKIEWBR7.js";
65
65
  import {
66
66
  connectWebhook
67
- } from "./chunk-FQRVNWI6.js";
67
+ } from "./chunk-2QKGVFWN.js";
68
68
  import {
69
69
  ConnectFailure,
70
70
  connectReport,
71
71
  deviceLogin,
72
72
  newAttempt,
73
73
  sendConnectReport
74
- } from "./chunk-QJRULRYS.js";
74
+ } from "./chunk-TKWZ6GLL.js";
75
75
  import {
76
76
  defaultDeviceName,
77
77
  getMachine,
@@ -79,7 +79,7 @@ import {
79
79
  } from "./chunk-SBYSVZ7J.js";
80
80
  import {
81
81
  VERSION
82
- } from "./chunk-FCCAACSV.js";
82
+ } from "./chunk-6CUPNFNR.js";
83
83
  import {
84
84
  STAGING_ORIGIN,
85
85
  getOrigin,
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-SBYSVZ7J.js";
7
7
  import {
8
8
  VERSION
9
- } from "./chunk-FCCAACSV.js";
9
+ } from "./chunk-6CUPNFNR.js";
10
10
  import {
11
11
  getOrigin,
12
12
  readCredentials,
@@ -54,17 +54,17 @@ import {
54
54
  which,
55
55
  workFolder,
56
56
  workFolderLine
57
- } from "./chunk-LYUI7RLX.js";
57
+ } from "./chunk-M2BOHVUC.js";
58
58
  import "./chunk-BI2Y5ZCL.js";
59
59
  import "./chunk-HB76TZWH.js";
60
60
  import "./chunk-FHAIBI3Z.js";
61
61
  import "./chunk-VK6GV757.js";
62
62
  import "./chunk-365HFCQQ.js";
63
63
  import "./chunk-PKIEWBR7.js";
64
- import "./chunk-FQRVNWI6.js";
65
- import "./chunk-QJRULRYS.js";
64
+ import "./chunk-2QKGVFWN.js";
65
+ import "./chunk-TKWZ6GLL.js";
66
66
  import "./chunk-SBYSVZ7J.js";
67
- import "./chunk-FCCAACSV.js";
67
+ import "./chunk-6CUPNFNR.js";
68
68
  import "./chunk-D5UZW42X.js";
69
69
  export {
70
70
  DEFAULT_T3_URL,
@@ -7,17 +7,17 @@ import {
7
7
  runnerOrigin,
8
8
  stopService,
9
9
  unitOrigin
10
- } from "./chunk-LYUI7RLX.js";
10
+ } from "./chunk-M2BOHVUC.js";
11
11
  import "./chunk-BI2Y5ZCL.js";
12
12
  import "./chunk-HB76TZWH.js";
13
13
  import "./chunk-FHAIBI3Z.js";
14
14
  import "./chunk-VK6GV757.js";
15
15
  import "./chunk-365HFCQQ.js";
16
16
  import "./chunk-PKIEWBR7.js";
17
- import "./chunk-FQRVNWI6.js";
18
- import "./chunk-QJRULRYS.js";
17
+ import "./chunk-2QKGVFWN.js";
18
+ import "./chunk-TKWZ6GLL.js";
19
19
  import "./chunk-SBYSVZ7J.js";
20
- import "./chunk-FCCAACSV.js";
20
+ import "./chunk-6CUPNFNR.js";
21
21
  import "./chunk-D5UZW42X.js";
22
22
  export {
23
23
  disconnect,
@@ -2,17 +2,17 @@
2
2
  import {
3
3
  existingRunnerEnvironment,
4
4
  pinExistingRunner
5
- } from "./chunk-LYUI7RLX.js";
5
+ } from "./chunk-M2BOHVUC.js";
6
6
  import "./chunk-BI2Y5ZCL.js";
7
7
  import "./chunk-HB76TZWH.js";
8
8
  import "./chunk-FHAIBI3Z.js";
9
9
  import "./chunk-VK6GV757.js";
10
10
  import "./chunk-365HFCQQ.js";
11
11
  import "./chunk-PKIEWBR7.js";
12
- import "./chunk-FQRVNWI6.js";
13
- import "./chunk-QJRULRYS.js";
12
+ import "./chunk-2QKGVFWN.js";
13
+ import "./chunk-TKWZ6GLL.js";
14
14
  import "./chunk-SBYSVZ7J.js";
15
- import "./chunk-FCCAACSV.js";
15
+ import "./chunk-6CUPNFNR.js";
16
16
  import "./chunk-D5UZW42X.js";
17
17
  export {
18
18
  existingRunnerEnvironment,
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-365HFCQQ.js";
5
5
  import {
6
6
  VERSION
7
- } from "./chunk-FCCAACSV.js";
7
+ } from "./chunk-6CUPNFNR.js";
8
8
  import {
9
9
  applyEnvironmentFlag
10
10
  } from "./chunk-D5UZW42X.js";
@@ -69,7 +69,7 @@ Add --staging to any command to use Cloop staging instead of production.
69
69
  A production machine and a staging machine can run side by side on one computer.
70
70
  `;
71
71
  async function pinExistingRunner() {
72
- const { pinExistingRunner: pin } = await import("./existing-runner-6GPZM6AJ.js");
72
+ const { pinExistingRunner: pin } = await import("./existing-runner-LL6TVNDX.js");
73
73
  const { note } = pin();
74
74
  if (note) console.error(note);
75
75
  }
@@ -77,7 +77,7 @@ async function main() {
77
77
  switch (command) {
78
78
  case "login":
79
79
  case "auth": {
80
- const { loginCommand } = await import("./login-J6NNT2Y7.js");
80
+ const { loginCommand } = await import("./login-E5DLEZ3N.js");
81
81
  await loginCommand(argv);
82
82
  break;
83
83
  }
@@ -87,32 +87,32 @@ async function main() {
87
87
  break;
88
88
  }
89
89
  case "serve": {
90
- const { startMcpServer } = await import("./mcp-server-7UAQU5PY.js");
90
+ const { startMcpServer } = await import("./mcp-server-DAEOBSRH.js");
91
91
  await startMcpServer();
92
92
  break;
93
93
  }
94
94
  case "statusline": {
95
- const { statuslineCommand } = await import("./statusline-AYIVY7EM.js");
95
+ const { statuslineCommand } = await import("./statusline-7C6RFBEQ.js");
96
96
  statuslineCommand();
97
97
  break;
98
98
  }
99
99
  case "connect": {
100
- const { connectCommand } = await import("./connect-EWA3XMFP.js");
100
+ const { connectCommand } = await import("./connect-7CEF7GMC.js");
101
101
  await connectCommand(argv.slice(1));
102
102
  break;
103
103
  }
104
104
  case "use": {
105
- const { useCommand } = await import("./use-IYJPGE7N.js");
105
+ const { useCommand } = await import("./use-LWHUOHPH.js");
106
106
  process.exitCode = await useCommand(argv.slice(1));
107
107
  break;
108
108
  }
109
109
  case "disconnect": {
110
- const { disconnectCommand } = await import("./disconnect-3BUQU7ZC.js");
110
+ const { disconnectCommand } = await import("./disconnect-3E6QHZJF.js");
111
111
  await disconnectCommand(argv.slice(1));
112
112
  break;
113
113
  }
114
114
  case "box": {
115
- const { boxCommand } = await import("./box-PFU2ZQSO.js");
115
+ const { boxCommand } = await import("./box-75K3UKFX.js");
116
116
  await boxCommand(argv.slice(1));
117
117
  break;
118
118
  }
@@ -141,7 +141,7 @@ async function main() {
141
141
  break;
142
142
  }
143
143
  case "runner": {
144
- const { runnerCommand } = await import("./runner-EZHY5YYQ.js");
144
+ const { runnerCommand } = await import("./runner-U4YNNWWA.js");
145
145
  await runnerCommand(argv.slice(1));
146
146
  break;
147
147
  }
@@ -3,9 +3,9 @@ import {
3
3
  deviceLogin,
4
4
  loginCommand,
5
5
  refusalSentence
6
- } from "./chunk-QJRULRYS.js";
6
+ } from "./chunk-TKWZ6GLL.js";
7
7
  import "./chunk-SBYSVZ7J.js";
8
- import "./chunk-FCCAACSV.js";
8
+ import "./chunk-6CUPNFNR.js";
9
9
  import "./chunk-D5UZW42X.js";
10
10
  export {
11
11
  deviceLogin,
@@ -31,7 +31,7 @@ import {
31
31
  } from "./chunk-SBYSVZ7J.js";
32
32
  import {
33
33
  VERSION
34
- } from "./chunk-FCCAACSV.js";
34
+ } from "./chunk-6CUPNFNR.js";
35
35
  import {
36
36
  getMeshUrl,
37
37
  getToken
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  connectWebhook,
4
4
  runnerCommand
5
- } from "./chunk-FQRVNWI6.js";
6
- import "./chunk-QJRULRYS.js";
5
+ } from "./chunk-2QKGVFWN.js";
6
+ import "./chunk-TKWZ6GLL.js";
7
7
  import "./chunk-SBYSVZ7J.js";
8
- import "./chunk-FCCAACSV.js";
8
+ import "./chunk-6CUPNFNR.js";
9
9
  import "./chunk-D5UZW42X.js";
10
10
  export {
11
11
  connectWebhook,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VK6GV757.js";
8
8
  import {
9
9
  VERSION
10
- } from "./chunk-FCCAACSV.js";
10
+ } from "./chunk-6CUPNFNR.js";
11
11
  import {
12
12
  getToken
13
13
  } from "./chunk-D5UZW42X.js";
@@ -3,7 +3,7 @@ import {
3
3
  DRIVER_NAME,
4
4
  pinExistingRunner,
5
5
  runConnect
6
- } from "./chunk-LYUI7RLX.js";
6
+ } from "./chunk-M2BOHVUC.js";
7
7
  import "./chunk-BI2Y5ZCL.js";
8
8
  import "./chunk-HB76TZWH.js";
9
9
  import {
@@ -13,10 +13,10 @@ import {
13
13
  import "./chunk-VK6GV757.js";
14
14
  import "./chunk-365HFCQQ.js";
15
15
  import "./chunk-PKIEWBR7.js";
16
- import "./chunk-FQRVNWI6.js";
17
- import "./chunk-QJRULRYS.js";
16
+ import "./chunk-2QKGVFWN.js";
17
+ import "./chunk-TKWZ6GLL.js";
18
18
  import "./chunk-SBYSVZ7J.js";
19
- import "./chunk-FCCAACSV.js";
19
+ import "./chunk-6CUPNFNR.js";
20
20
  import "./chunk-D5UZW42X.js";
21
21
 
22
22
  // src/commands/use.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloop/runner",
3
- "version": "0.3.54",
3
+ "version": "0.3.55",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Make your computer and your agents Cloop machines: device login, the machine daemon, the Cloop MCP server, and Claude Code hooks.",