@rallycry/conveyor-agent 11.0.51 → 11.1.0
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/{boot-GD5XMLPS.js → boot-3FWYGHSN.js} +3 -2
- package/dist/{chunk-SXZS2R52.js → chunk-76JCOHPE.js} +2 -2
- package/dist/{chunk-HIJWYTBH.js → chunk-C4ZEPVUT.js} +3 -3
- package/dist/{chunk-NK6JMYEY.js → chunk-DMDLT6SN.js} +14041 -10600
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/{chunk-XCO2BP6A.js → chunk-KDBUBGOV.js} +1 -1
- package/dist/{chunk-ATYCG6MT.js → chunk-MFGRXD4Y.js} +1 -1
- package/dist/chunk-MILKMRPU.js +10043 -0
- package/dist/cli.js +11 -10
- package/dist/{client-VIFYMBT2.js → client-3EEFC7OD.js} +1 -0
- package/dist/gate-cli.js +1 -0
- package/dist/heartbeat-worker.js +28 -20
- package/dist/index.d.ts +78 -86
- package/dist/index.js +5 -4
- package/dist/{mode-ZJSOSLGU.js → mode-2XRJTIX6.js} +1 -0
- package/dist/{oom-watchdog-PAC5OJJG.js → oom-watchdog-YQYPVUKH.js} +1 -0
- package/dist/{protocol-QBCYO4GI.js → protocol-U6Z4MJ5S.js} +1 -0
- package/dist/{serve-boot-NMLVGJS3.js → serve-boot-T6XMFQVZ.js} +4 -3
- package/dist/{server-FPDS4CT5.js → server-3SSY4JV7.js} +3 -2
- package/package.json +4 -1
- package/dist/chunk-IA45XHOA.js +0 -141
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
WorkspaceCommandSupervisor,
|
|
8
8
|
startWorkspaceCommandsAfterConnect,
|
|
9
9
|
stopWorkspaceCommands
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KDBUBGOV.js";
|
|
11
11
|
import {
|
|
12
12
|
PtyHarness,
|
|
13
13
|
SessionRunner,
|
|
@@ -25,12 +25,12 @@ import {
|
|
|
25
25
|
resolveTuiKindFromEnv,
|
|
26
26
|
sampleKeyUsage,
|
|
27
27
|
usesNativeUsageReporting
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-C4ZEPVUT.js";
|
|
29
29
|
import "./chunk-V5WR2F2P.js";
|
|
30
30
|
import {
|
|
31
31
|
inheritedEnv,
|
|
32
32
|
resolvePtySpawn
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-76JCOHPE.js";
|
|
34
34
|
import {
|
|
35
35
|
AgentConnection,
|
|
36
36
|
DEFAULT_LIFECYCLE_CONFIG,
|
|
@@ -41,14 +41,15 @@ import {
|
|
|
41
41
|
createServiceLogger,
|
|
42
42
|
loadAndAnnotateDiscoveredPorts,
|
|
43
43
|
loadConveyorConfig
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-DMDLT6SN.js";
|
|
45
45
|
import "./chunk-VIUZS7V4.js";
|
|
46
46
|
import "./chunk-W4LZ7R6Z.js";
|
|
47
47
|
import "./chunk-372R6E4C.js";
|
|
48
|
-
import "./chunk-
|
|
48
|
+
import "./chunk-MILKMRPU.js";
|
|
49
49
|
import "./chunk-SQM2BQ7H.js";
|
|
50
50
|
import "./chunk-KMB3BU4S.js";
|
|
51
51
|
import "./chunk-6Q6LQBWO.js";
|
|
52
|
+
import "./chunk-JSBRDJBE.js";
|
|
52
53
|
|
|
53
54
|
// src/cli.ts
|
|
54
55
|
import { readFileSync } from "fs";
|
|
@@ -1186,7 +1187,7 @@ function wireSpawnChildren(mode, connection, supervisors, logger7) {
|
|
|
1186
1187
|
|
|
1187
1188
|
// src/cli.ts
|
|
1188
1189
|
if (process.argv[2] === "boot") {
|
|
1189
|
-
const { runBoot } = await import("./boot-
|
|
1190
|
+
const { runBoot } = await import("./boot-3FWYGHSN.js");
|
|
1190
1191
|
process.exit(await runBoot(process.argv.slice(3)));
|
|
1191
1192
|
}
|
|
1192
1193
|
if (isLegacyEntrypointLaunch(process.env)) {
|
|
@@ -1255,9 +1256,9 @@ process.on("unhandledRejection", (reason) => {
|
|
|
1255
1256
|
process.exit(1);
|
|
1256
1257
|
});
|
|
1257
1258
|
if (process.env.CONVEYOR_MODE === "workbench") {
|
|
1258
|
-
const { startWorkbenchServer } = await import("./server-
|
|
1259
|
-
const { oomWatchdogOptionsFromEnv } = await import("./oom-watchdog-
|
|
1260
|
-
const { DEFAULT_WORKBENCH_PORT } = await import("./protocol-
|
|
1259
|
+
const { startWorkbenchServer } = await import("./server-3SSY4JV7.js");
|
|
1260
|
+
const { oomWatchdogOptionsFromEnv } = await import("./oom-watchdog-YQYPVUKH.js");
|
|
1261
|
+
const { DEFAULT_WORKBENCH_PORT } = await import("./protocol-U6Z4MJ5S.js");
|
|
1261
1262
|
const port = Number(process.env.CONVEYOR_WORKBENCH_PORT) || DEFAULT_WORKBENCH_PORT;
|
|
1262
1263
|
const token = process.env.CONVEYOR_WORKBENCH_TOKEN ?? process.env.POD_BOOTSTRAP_TOKEN ?? "";
|
|
1263
1264
|
if (!token) {
|
|
@@ -1397,7 +1398,7 @@ if (!RUNNER_MODES.includes(CONVEYOR_MODE)) {
|
|
|
1397
1398
|
process.exit(1);
|
|
1398
1399
|
}
|
|
1399
1400
|
if (CONVEYOR_MODE === "serving") {
|
|
1400
|
-
const { runServingSession } = await import("./serve-boot-
|
|
1401
|
+
const { runServingSession } = await import("./serve-boot-T6XMFQVZ.js");
|
|
1401
1402
|
exitContext.runnerMode = "serving";
|
|
1402
1403
|
exitContext.sessionId = process.env.CONVEYOR_SESSION_ID ?? exitContext.sessionId;
|
|
1403
1404
|
const outcome = await runServingSession({
|
package/dist/gate-cli.js
CHANGED
package/dist/heartbeat-worker.js
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
callAgentSession,
|
|
3
|
+
createAgentSessionConnection,
|
|
3
4
|
heartbeatStatusFor,
|
|
5
|
+
isConnected,
|
|
4
6
|
lagFromBuffer,
|
|
7
|
+
needsReopen,
|
|
5
8
|
statusFromBuffer
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MILKMRPU.js";
|
|
10
|
+
import "./chunk-JSBRDJBE.js";
|
|
7
11
|
|
|
8
12
|
// src/connection/heartbeat-worker.ts
|
|
9
13
|
import { parentPort, workerData } from "worker_threads";
|
|
10
|
-
import { io } from "socket.io-client";
|
|
11
14
|
var data = workerData;
|
|
12
15
|
var view = new Float64Array(data.sharedBuffer);
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
data.apiUrl,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
var handshake = (taskToken) => ({ taskToken, runnerMode: data.runnerMode });
|
|
17
|
+
var connection = createAgentSessionConnection({
|
|
18
|
+
apiUrl: data.apiUrl,
|
|
19
|
+
auth: handshake(data.taskToken),
|
|
20
|
+
timeoutMs: data.intervalMs
|
|
21
|
+
});
|
|
18
22
|
parentPort?.on("message", (msg) => {
|
|
19
|
-
if (msg?.taskToken)
|
|
23
|
+
if (msg?.taskToken) connection.setAuth(handshake(msg.taskToken));
|
|
20
24
|
});
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
socket.connect();
|
|
24
|
-
}
|
|
25
|
+
connection.subscribe(() => {
|
|
26
|
+
if (connection.getState().status === "disconnected") connection.open();
|
|
25
27
|
});
|
|
26
28
|
function beat() {
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
if (needsReopen(connection)) {
|
|
30
|
+
connection.open();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!isConnected(connection)) return;
|
|
34
|
+
void callAgentSession(
|
|
35
|
+
connection,
|
|
36
|
+
"heartbeat",
|
|
30
37
|
{
|
|
31
38
|
sessionId: data.sessionId,
|
|
32
39
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -35,10 +42,11 @@ function beat() {
|
|
|
35
42
|
status: heartbeatStatusFor(statusFromBuffer(view)),
|
|
36
43
|
loopLagMs: Math.round(lagFromBuffer(view))
|
|
37
44
|
},
|
|
38
|
-
|
|
45
|
+
{ kind: "mutation" }
|
|
46
|
+
// Answer intentionally ignored: a missed beat self-heals on the next tick,
|
|
39
47
|
// and the worker must never accumulate state or throw.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
);
|
|
48
|
+
).catch(() => {
|
|
49
|
+
});
|
|
43
50
|
}
|
|
51
|
+
connection.open();
|
|
44
52
|
setInterval(beat, data.intervalMs);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _project_shared from '@project/shared';
|
|
2
|
-
import { RunnerMode, AgentSessionServiceMethods,
|
|
2
|
+
import { RunnerMode, AgentSessionServiceMethods, SessionMessagePush, SessionModeChangePush, SessionSpawnReviewPush, SessionSpawnBuilderPush, SessionSpawnTuiPush, PtyChatEventPayload, PtyModelEffortRelay, AgentMode, WorkspaceDiscoveredPort, AgentQuestion, AgentRunnerStatus, SessionPreviewLink } from '@project/shared';
|
|
3
3
|
export * from '@project/shared';
|
|
4
4
|
import { ChildProcess } from 'node:child_process';
|
|
5
5
|
|
|
@@ -19,83 +19,49 @@ interface AgentConnectionConfig {
|
|
|
19
19
|
sessionId: string;
|
|
20
20
|
runnerMode?: RunnerMode;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Delivery hint for the PTY harness: "prefill" parks the message in the
|
|
33
|
-
* Connected-TUI input for a human to review/edit/Enter instead of
|
|
34
|
-
* auto-submitting (set by Refine → Discovery/Review). Absent → submit.
|
|
35
|
-
*/
|
|
36
|
-
delivery?: "prefill";
|
|
37
|
-
}
|
|
38
|
-
interface SetModeData {
|
|
39
|
-
agentMode: AgentMode;
|
|
40
|
-
}
|
|
22
|
+
/**
|
|
23
|
+
* A message for the agent: the `sessionMessage` push. `delivery: "prefill"`
|
|
24
|
+
* parks it in the Connected-TUI input for a human to review/edit/Enter
|
|
25
|
+
* instead of auto-submitting (set by Refine → Discovery/Review).
|
|
26
|
+
*/
|
|
27
|
+
type IncomingMessage = SessionMessagePush;
|
|
28
|
+
/** The `sessionModeChange` push. */
|
|
29
|
+
type SetModeData = SessionModeChangePush;
|
|
30
|
+
/** Never sent by an API that serves protocol 5; `onApiKeyUpdate` keeps its shape. */
|
|
41
31
|
interface ApiKeyUpdateData {
|
|
42
32
|
apiKey: string;
|
|
43
33
|
isSubscription?: boolean;
|
|
44
34
|
}
|
|
45
35
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
36
|
+
* The `sessionSpawnReview` push: spawn a same-pod review child, a second
|
|
37
|
+
* conveyor-agent process bound to a fresh review WorkspaceSession (sessionId +
|
|
38
|
+
* sessionJwt). No taskId on the wire — the child inherits the parent's
|
|
39
|
+
* CONVEYOR_TASK_ID and the server derives it from the JWT.
|
|
50
40
|
*/
|
|
51
|
-
|
|
52
|
-
sessionId: string;
|
|
53
|
-
sessionJwt: string;
|
|
54
|
-
mode: "code-review";
|
|
55
|
-
branch?: string | null;
|
|
56
|
-
prNumber?: number | null;
|
|
57
|
-
checkoutRef?: string | null;
|
|
58
|
-
}
|
|
41
|
+
type SpawnReviewData = SessionSpawnReviewPush;
|
|
59
42
|
/**
|
|
60
|
-
*
|
|
61
|
-
* conveyor-agent process bound to a fresh `mode:"build"`
|
|
62
|
-
* lifecycle handoff — a human pressing Build, or a
|
|
63
|
-
* without cold-booting a second pod, and without
|
|
64
|
-
* session into a builder in place.
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* parent's CONVEYOR_TASK_ID and the server derives it from the JWT), and the
|
|
68
|
-
* runner mode rides the JWT claim rather than this field — `mode` here is what
|
|
69
|
-
* the supervisor exports as CONVEYOR_MODE for the child process.
|
|
43
|
+
* The `sessionSpawnBuilder` push to a PLANNER pod: spawn the Builder child, a
|
|
44
|
+
* second conveyor-agent process bound to a fresh `mode:"build"`
|
|
45
|
+
* WorkspaceSession. The lifecycle handoff — a human pressing Build, or a
|
|
46
|
+
* Yolomatic plan landing — without cold-booting a second pod, and without
|
|
47
|
+
* flipping the planner's own session into a builder in place. `mode` is what
|
|
48
|
+
* the supervisor exports as CONVEYOR_MODE for the child process (`pack` when
|
|
49
|
+
* the card has children).
|
|
70
50
|
*/
|
|
71
|
-
|
|
72
|
-
sessionId: string;
|
|
73
|
-
sessionJwt: string;
|
|
74
|
-
/**
|
|
75
|
-
* Runner mode for the child — `pack` when the card has children, so the
|
|
76
|
-
* pack runner gets the pack prompt and toolset. Optional so a pod
|
|
77
|
-
* running against an older server (which sends none) still boots as `task`.
|
|
78
|
-
*/
|
|
79
|
-
mode?: "task" | "pack";
|
|
80
|
-
branch?: string | null;
|
|
81
|
-
/** The agent whose model/settings/instructions the Builder runs under. */
|
|
82
|
-
agentName?: string | null;
|
|
83
|
-
}
|
|
51
|
+
type SpawnBuilderData = SessionSpawnBuilderPush;
|
|
84
52
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* No taskId on the wire — the child inherits the parent's CONVEYOR_TASK_ID
|
|
89
|
-
* and the server derives it from the JWT.
|
|
53
|
+
* The `sessionSpawnTui` push: spawn an extra interactive child on this pod, a
|
|
54
|
+
* second Claude TUI (mode "adhoc") or a raw login shell (mode "shell"), bound
|
|
55
|
+
* to a fresh WorkspaceSession (sessionId + sessionJwt).
|
|
90
56
|
*/
|
|
91
|
-
|
|
92
|
-
sessionId: string;
|
|
93
|
-
sessionJwt: string;
|
|
94
|
-
mode: "adhoc" | "shell";
|
|
95
|
-
projectId: string;
|
|
96
|
-
}
|
|
57
|
+
type SpawnTuiData = SessionSpawnTuiPush;
|
|
97
58
|
declare class AgentConnection {
|
|
98
|
-
|
|
59
|
+
/** The protocol-5 connection to the API; null before connect() and after disconnect(). */
|
|
60
|
+
private connection;
|
|
61
|
+
/** What connect() listens to on the connection, for disconnect() to stop. */
|
|
62
|
+
private readonly connectionListeners;
|
|
63
|
+
/** Set by the first `qd:hello`: every later one is a new socket in no room. */
|
|
64
|
+
private helloSeen;
|
|
99
65
|
private readonly config;
|
|
100
66
|
private eventBuffer;
|
|
101
67
|
private flushTimer;
|
|
@@ -116,7 +82,6 @@ declare class AgentConnection {
|
|
|
116
82
|
private stopCallback;
|
|
117
83
|
private softStopCallback;
|
|
118
84
|
private modeChangeCallback;
|
|
119
|
-
private apiKeyUpdateCallback;
|
|
120
85
|
private pullBranchCallback;
|
|
121
86
|
private runStartCommandCallback;
|
|
122
87
|
private earlyRunStartCommand;
|
|
@@ -150,24 +115,49 @@ declare class AgentConnection {
|
|
|
150
115
|
private recycleTimer;
|
|
151
116
|
private pendingCalls;
|
|
152
117
|
call<M extends keyof AgentSessionServiceMethods>(method: M, payload: AgentSessionServiceMethods[M]["payload"]): Promise<AgentSessionServiceMethods[M]["response"]>;
|
|
153
|
-
/** (Re)arm the recycle timer — called on every
|
|
118
|
+
/** (Re)arm the recycle timer — called on every `qd:hello`, a fresh socket. */
|
|
154
119
|
private scheduleSocketRecycle;
|
|
155
120
|
private clearSocketRecycle;
|
|
156
121
|
private armRecycleTimer;
|
|
157
122
|
private attemptSocketRecycle;
|
|
158
|
-
/** Resolve once `
|
|
123
|
+
/** Resolve once `connection` reports connected, or reject after `timeoutMs`. */
|
|
159
124
|
private waitForConnected;
|
|
160
|
-
/**
|
|
161
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Call a method and resolve with its data, rejecting when no answer arrives
|
|
127
|
+
* in time. Every AgentSessionServiceMethods response carries data, so an
|
|
128
|
+
* answer without any is a failure, as the 4.x wire's `requireData` was.
|
|
129
|
+
*/
|
|
130
|
+
private callService;
|
|
131
|
+
/**
|
|
132
|
+
* A failed call's error. A method's own refusal passes through as quickdraw
|
|
133
|
+
* sent it (its code and message); a call the transport lost reads as the
|
|
134
|
+
* transient it is, so the model retries the tool instead of giving up.
|
|
135
|
+
*/
|
|
136
|
+
private callError;
|
|
137
|
+
/** The handshake fields: the task token the next (re)connect presents. */
|
|
138
|
+
private handshake;
|
|
162
139
|
connect(): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Every `qd:hello` is a new socket, in no room. The first is connect()'s
|
|
142
|
+
* own, and the runner joins the session's room with its own connectAgent.
|
|
143
|
+
* After any later one (a dropped transport, the proactive recycle, a new
|
|
144
|
+
* token, a reopen after the server ended the connection) re-join the room
|
|
145
|
+
* and drain what arrived meanwhile.
|
|
146
|
+
*/
|
|
147
|
+
private onHello;
|
|
148
|
+
/** What each session push does. Early-buffered where the push can land before the runner registered. */
|
|
149
|
+
private pushHandlers;
|
|
150
|
+
private controlPushHandlers;
|
|
151
|
+
private spawnPushHandlers;
|
|
152
|
+
private ptyPushHandlers;
|
|
163
153
|
disconnect(): void;
|
|
164
154
|
private static readonly RECONNECT_BASE_DELAY_MS;
|
|
165
155
|
private static readonly RECONNECT_MAX_DELAY_MS;
|
|
166
156
|
private static readonly RECONNECT_STATUS_EVERY_N;
|
|
167
157
|
private isReconnecting;
|
|
168
|
-
private
|
|
158
|
+
private reopening;
|
|
169
159
|
/** Capped exponential backoff (2s, 4s, 8s, 16s, 32s, then 60s steady) shared
|
|
170
|
-
* by both
|
|
160
|
+
* by both loops (the connectAgent re-join and the reopen). */
|
|
171
161
|
private static backoffDelayMs;
|
|
172
162
|
/** Sleep `ms`, unref'd so it never holds the process open on its own. */
|
|
173
163
|
private static delay;
|
|
@@ -180,17 +170,14 @@ declare class AgentConnection {
|
|
|
180
170
|
*/
|
|
181
171
|
onReconnected?: () => void;
|
|
182
172
|
private reconnectToSession;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
private scheduleReconnectAfterServerDisconnect;
|
|
192
|
-
private reconnectAfterServerDisconnect;
|
|
193
|
-
private looksLikeAuthError;
|
|
173
|
+
private scheduleReopen;
|
|
174
|
+
private reopenUntilConnected;
|
|
175
|
+
private tokenSwapPending;
|
|
176
|
+
private tokenSwapTimer;
|
|
177
|
+
/** Present the pending token now unless a call is in flight on a live socket; true when it reconnected. */
|
|
178
|
+
private applyTaskToken;
|
|
179
|
+
private armTokenSwap;
|
|
180
|
+
private clearTokenSwap;
|
|
194
181
|
private startProactiveTokenRefresh;
|
|
195
182
|
private stopProactiveTokenRefresh;
|
|
196
183
|
private drainPendingMessages;
|
|
@@ -198,7 +185,12 @@ declare class AgentConnection {
|
|
|
198
185
|
onStop(callback: () => void): void;
|
|
199
186
|
onSoftStop(callback: () => void): void;
|
|
200
187
|
onModeChange(callback: (data: SetModeData) => void): void;
|
|
201
|
-
|
|
188
|
+
/**
|
|
189
|
+
* No API sends an API-key update (4.x's `agentRunner:updateApiKey` had no
|
|
190
|
+
* sender left), so nothing ever calls `_callback`. Kept for the runner's
|
|
191
|
+
* registration.
|
|
192
|
+
*/
|
|
193
|
+
onApiKeyUpdate(_callback: (data: ApiKeyUpdateData) => void): void;
|
|
202
194
|
onPullBranch(callback: (data: {
|
|
203
195
|
branch: string;
|
|
204
196
|
}) => void): void;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SessionRunner,
|
|
3
3
|
unshallowRepo
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-C4ZEPVUT.js";
|
|
5
5
|
import "./chunk-V5WR2F2P.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-76JCOHPE.js";
|
|
7
7
|
import {
|
|
8
8
|
AgentConnection,
|
|
9
9
|
GIT_TIMEOUT_MS,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
stageAndCommit,
|
|
18
18
|
updateRemoteToken,
|
|
19
19
|
workspacePathExists
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DMDLT6SN.js";
|
|
21
21
|
import "./chunk-VIUZS7V4.js";
|
|
22
22
|
import {
|
|
23
23
|
runAuthTokenCommand,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
runStartCommand
|
|
26
26
|
} from "./chunk-W4LZ7R6Z.js";
|
|
27
27
|
import "./chunk-372R6E4C.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-MILKMRPU.js";
|
|
29
29
|
import {
|
|
30
30
|
getWorkbenchClient
|
|
31
31
|
} from "./chunk-SQM2BQ7H.js";
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
workbenchEnabled
|
|
34
34
|
} from "./chunk-KMB3BU4S.js";
|
|
35
35
|
import "./chunk-6Q6LQBWO.js";
|
|
36
|
+
import "./chunk-JSBRDJBE.js";
|
|
36
37
|
|
|
37
38
|
// src/runner/worktree.ts
|
|
38
39
|
import { execFile } from "child_process";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkspaceCommandSupervisor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KDBUBGOV.js";
|
|
4
4
|
import {
|
|
5
5
|
AgentConnection,
|
|
6
6
|
DEFAULT_LIFECYCLE_CONFIG,
|
|
@@ -11,13 +11,14 @@ import {
|
|
|
11
11
|
ensureOnTaskBranch,
|
|
12
12
|
loadAndAnnotateDiscoveredPorts,
|
|
13
13
|
loadConveyorConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DMDLT6SN.js";
|
|
15
15
|
import "./chunk-VIUZS7V4.js";
|
|
16
16
|
import "./chunk-W4LZ7R6Z.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-MILKMRPU.js";
|
|
18
18
|
import "./chunk-SQM2BQ7H.js";
|
|
19
19
|
import "./chunk-KMB3BU4S.js";
|
|
20
20
|
import "./chunk-6Q6LQBWO.js";
|
|
21
|
+
import "./chunk-JSBRDJBE.js";
|
|
21
22
|
|
|
22
23
|
// src/runner/serve-session-runner.ts
|
|
23
24
|
var ServeSessionRunner = class {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
startWorkbenchServer
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-MFGRXD4Y.js";
|
|
4
|
+
import "./chunk-76JCOHPE.js";
|
|
5
5
|
import "./chunk-W4LZ7R6Z.js";
|
|
6
6
|
import "./chunk-372R6E4C.js";
|
|
7
7
|
import "./chunk-SQM2BQ7H.js";
|
|
8
8
|
import "./chunk-KMB3BU4S.js";
|
|
9
9
|
import "./chunk-6Q6LQBWO.js";
|
|
10
10
|
import "./chunk-6W6UZ4SJ.js";
|
|
11
|
+
import "./chunk-JSBRDJBE.js";
|
|
11
12
|
export {
|
|
12
13
|
startWorkbenchServer
|
|
13
14
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rallycry/conveyor-agent",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "Conveyor Agent Runner v10 - PTY harness for the task chat (SDK harness for audit/project-chat). Agent-as-User architecture with BaseService patterns. Works locally too.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -41,11 +41,14 @@
|
|
|
41
41
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
42
42
|
"node-pty": "^1.1.0",
|
|
43
43
|
"socket.io-client": "^4.8.4",
|
|
44
|
+
"socket.io-parser": "^4.2.4",
|
|
44
45
|
"tar": "^7.5.22",
|
|
45
46
|
"zod": "^4.6.5"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
49
|
+
"@fitzzero/quickdraw-core": "^5.1.1",
|
|
48
50
|
"@project/shared": "workspace:*",
|
|
51
|
+
"@tanstack/query-core": "^5.104.0",
|
|
49
52
|
"tsup": "^8.5.1",
|
|
50
53
|
"typescript": "~6.0.3",
|
|
51
54
|
"vitest": "^5.0.2"
|
package/dist/chunk-IA45XHOA.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
// ../shared/dist/socket-core/index.js
|
|
2
|
-
function buildConveyorSocketOptions(auth) {
|
|
3
|
-
return {
|
|
4
|
-
auth,
|
|
5
|
-
transports: ["websocket"],
|
|
6
|
-
reconnection: true,
|
|
7
|
-
reconnectionAttempts: Infinity,
|
|
8
|
-
reconnectionDelay: 2e3,
|
|
9
|
-
reconnectionDelayMax: 3e4,
|
|
10
|
-
randomizationFactor: 0.3,
|
|
11
|
-
extraHeaders: { "ngrok-skip-browser-warning": "true" }
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function callWithAck(socket, event, payload, options) {
|
|
15
|
-
const { timeoutMs, requireData = false, makeTimeoutError, makeFailureError } = options;
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
let settled = false;
|
|
18
|
-
const timer = setTimeout(() => {
|
|
19
|
-
if (settled) return;
|
|
20
|
-
settled = true;
|
|
21
|
-
reject(makeTimeoutError());
|
|
22
|
-
}, timeoutMs);
|
|
23
|
-
socket.emit(event, payload, (response) => {
|
|
24
|
-
if (settled) return;
|
|
25
|
-
settled = true;
|
|
26
|
-
clearTimeout(timer);
|
|
27
|
-
if (response.success && (!requireData || response.data !== void 0)) {
|
|
28
|
-
resolve(response.data);
|
|
29
|
-
} else {
|
|
30
|
-
reject(makeFailureError(response.error));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function waitForConnected(socket, timeoutMs, makeTimeoutError) {
|
|
36
|
-
if (socket.connected) return Promise.resolve();
|
|
37
|
-
return new Promise((resolve, reject) => {
|
|
38
|
-
const cleanup = () => {
|
|
39
|
-
clearTimeout(timer);
|
|
40
|
-
socket.off("connect", onConnect);
|
|
41
|
-
};
|
|
42
|
-
const onConnect = () => {
|
|
43
|
-
cleanup();
|
|
44
|
-
resolve();
|
|
45
|
-
};
|
|
46
|
-
const timer = setTimeout(() => {
|
|
47
|
-
cleanup();
|
|
48
|
-
reject(makeTimeoutError());
|
|
49
|
-
}, timeoutMs);
|
|
50
|
-
socket.once("connect", onConnect);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// src/connection/loop-lag.ts
|
|
55
|
-
var LOOP_TICK_INTERVAL_MS = 250;
|
|
56
|
-
var LOOP_STALL_LOG_MS = 1e3;
|
|
57
|
-
var LOOP_STATUS_VALUES = ["active", "idle", "building", "waiting"];
|
|
58
|
-
function heartbeatStatusFor(status) {
|
|
59
|
-
return status === "waiting" ? "active" : status;
|
|
60
|
-
}
|
|
61
|
-
var WORKING_RUNNER_STATUSES = /* @__PURE__ */ new Set([
|
|
62
|
-
"connecting",
|
|
63
|
-
"connected",
|
|
64
|
-
"setup",
|
|
65
|
-
"fetching_context",
|
|
66
|
-
"running"
|
|
67
|
-
]);
|
|
68
|
-
var RESTING_RUNNER_STATUSES = /* @__PURE__ */ new Set([
|
|
69
|
-
"idle",
|
|
70
|
-
"waiting_for_input",
|
|
71
|
-
"stopping",
|
|
72
|
-
"finished",
|
|
73
|
-
"disconnected",
|
|
74
|
-
"error"
|
|
75
|
-
]);
|
|
76
|
-
function loopStatusForRunnerStatus(status) {
|
|
77
|
-
if (status === null || status === void 0) return "idle";
|
|
78
|
-
if (WORKING_RUNNER_STATUSES.has(status)) return "active";
|
|
79
|
-
if (RESTING_RUNNER_STATUSES.has(status)) return "idle";
|
|
80
|
-
return "active";
|
|
81
|
-
}
|
|
82
|
-
function lagFromBuffer(view) {
|
|
83
|
-
const last = view[0];
|
|
84
|
-
if (!last) return 0;
|
|
85
|
-
return Math.max(0, Date.now() - last - LOOP_TICK_INTERVAL_MS);
|
|
86
|
-
}
|
|
87
|
-
function statusFromBuffer(view) {
|
|
88
|
-
return LOOP_STATUS_VALUES[view[1]] ?? "active";
|
|
89
|
-
}
|
|
90
|
-
var LoopLagMonitor = class {
|
|
91
|
-
sharedBuffer = new SharedArrayBuffer(2 * Float64Array.BYTES_PER_ELEMENT);
|
|
92
|
-
view = new Float64Array(this.sharedBuffer);
|
|
93
|
-
timer = null;
|
|
94
|
-
maxLagMs = 0;
|
|
95
|
-
start() {
|
|
96
|
-
if (this.timer) return;
|
|
97
|
-
this.view[0] = Date.now();
|
|
98
|
-
this.timer = setInterval(() => {
|
|
99
|
-
const now = Date.now();
|
|
100
|
-
const lag = Math.max(0, now - this.view[0] - LOOP_TICK_INTERVAL_MS);
|
|
101
|
-
if (lag >= LOOP_STALL_LOG_MS) {
|
|
102
|
-
this.maxLagMs = Math.max(this.maxLagMs, lag);
|
|
103
|
-
process.stderr.write(
|
|
104
|
-
`[conveyor-agent] event-loop stall: ${Math.round(lag)}ms (${(/* @__PURE__ */ new Date()).toISOString()})
|
|
105
|
-
`
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
this.view[0] = now;
|
|
109
|
-
}, LOOP_TICK_INTERVAL_MS);
|
|
110
|
-
this.timer.unref();
|
|
111
|
-
}
|
|
112
|
-
stop() {
|
|
113
|
-
if (this.timer) clearInterval(this.timer);
|
|
114
|
-
this.timer = null;
|
|
115
|
-
}
|
|
116
|
-
/** Mirror the runner's current status for the worker to report. */
|
|
117
|
-
setStatus(status) {
|
|
118
|
-
const idx = LOOP_STATUS_VALUES.indexOf(status);
|
|
119
|
-
this.view[1] = idx === -1 ? 0 : idx;
|
|
120
|
-
}
|
|
121
|
-
/** Worst stall observed since the previous call (then reset). Includes the
|
|
122
|
-
* live lag so a beat sent mid-stall from this thread — possible when the
|
|
123
|
-
* heartbeat timer fires before the refresher in the same tick batch — is
|
|
124
|
-
* still truthful. */
|
|
125
|
-
takeMaxLagMs() {
|
|
126
|
-
const max = Math.max(this.maxLagMs, lagFromBuffer(this.view));
|
|
127
|
-
this.maxLagMs = 0;
|
|
128
|
-
return max;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export {
|
|
133
|
-
buildConveyorSocketOptions,
|
|
134
|
-
callWithAck,
|
|
135
|
-
waitForConnected,
|
|
136
|
-
heartbeatStatusFor,
|
|
137
|
-
loopStatusForRunnerStatus,
|
|
138
|
-
lagFromBuffer,
|
|
139
|
-
statusFromBuffer,
|
|
140
|
-
LoopLagMonitor
|
|
141
|
-
};
|