@rallycry/conveyor-agent 2.18.0 → 3.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/{chunk-I7ETGLPA.js → chunk-22ME6AB3.js} +861 -569
- package/dist/chunk-22ME6AB3.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +57 -302
- package/dist/index.js +2 -65
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/chunk-I7ETGLPA.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
import { SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
+
import * as _project_shared from '@project/shared';
|
|
3
|
+
import { AgentRunnerStatus, MultimodalBlock, ChatMessageResponse, TaskFileResponse, TaskContext, AgentEvent, AgentQuestion, IncomingMessagePayload, SetModePayload, PmSubMode, SubtaskCreatePayload, SubtaskUpdateFields, SubtaskResponse, TaskLookupResponse } from '@project/shared';
|
|
4
|
+
export { AgentEvent, ChatMessage, TaskContext, TaskFileContext } from '@project/shared';
|
|
2
5
|
import { ChildProcess } from 'node:child_process';
|
|
3
6
|
|
|
4
|
-
type AgentSettingsThinking = {
|
|
5
|
-
type: "adaptive";
|
|
6
|
-
} | {
|
|
7
|
-
type: "enabled";
|
|
8
|
-
budgetTokens: number;
|
|
9
|
-
} | {
|
|
10
|
-
type: "disabled";
|
|
11
|
-
};
|
|
12
|
-
type SdkBeta = "context-1m-2025-08-07";
|
|
13
|
-
interface AgentSettings {
|
|
14
|
-
effort?: "low" | "medium" | "high" | "max";
|
|
15
|
-
thinking?: AgentSettingsThinking;
|
|
16
|
-
betas?: SdkBeta[];
|
|
17
|
-
maxBudgetUsd?: number;
|
|
18
|
-
maxTurns?: number;
|
|
19
|
-
disallowedTools?: string[];
|
|
20
|
-
enableFileCheckpointing?: boolean;
|
|
21
|
-
settingSources?: ("user" | "project" | "local")[];
|
|
22
|
-
}
|
|
23
|
-
type RunnerMode = "task" | "pm";
|
|
24
7
|
interface AgentRunnerConfig {
|
|
25
8
|
conveyorApiUrl: string;
|
|
26
9
|
taskToken: string;
|
|
@@ -28,155 +11,12 @@ interface AgentRunnerConfig {
|
|
|
28
11
|
model: string;
|
|
29
12
|
instructions: string;
|
|
30
13
|
workspaceDir: string;
|
|
31
|
-
mode?: RunnerMode;
|
|
32
|
-
agentSettings?: AgentSettings;
|
|
33
|
-
}
|
|
34
|
-
interface TaskFileContext {
|
|
35
|
-
fileId: string;
|
|
36
|
-
fileName: string;
|
|
37
|
-
mimeType: string;
|
|
38
|
-
fileSize?: number;
|
|
39
|
-
downloadUrl: string;
|
|
40
|
-
content?: string;
|
|
41
|
-
contentEncoding?: "base64" | "utf-8";
|
|
42
|
-
}
|
|
43
|
-
interface TaskRepoRefContext {
|
|
44
|
-
path: string;
|
|
45
|
-
refType: "file" | "folder";
|
|
46
|
-
}
|
|
47
|
-
interface TaskContext {
|
|
48
|
-
taskId: string;
|
|
49
|
-
projectId: string;
|
|
50
|
-
title: string;
|
|
51
|
-
description: string | null;
|
|
52
|
-
plan: string | null;
|
|
53
|
-
status?: string;
|
|
54
|
-
chatHistory: ChatMessage[];
|
|
55
|
-
agentId: string | null;
|
|
56
|
-
agentInstructions: string;
|
|
57
|
-
model: string;
|
|
58
|
-
githubBranch: string;
|
|
59
|
-
baseBranch: string;
|
|
60
|
-
githubPRUrl?: string | null;
|
|
61
|
-
claudeSessionId?: string | null;
|
|
62
|
-
isParentTask?: boolean;
|
|
63
|
-
useWorktree?: boolean;
|
|
64
|
-
agentSettings?: AgentSettings | null;
|
|
65
|
-
storyPoints?: {
|
|
66
|
-
id: string;
|
|
67
|
-
value: number;
|
|
68
|
-
name: string;
|
|
69
|
-
description: string | null;
|
|
70
|
-
}[];
|
|
71
|
-
projectAgents?: {
|
|
72
|
-
id: string;
|
|
73
|
-
role: string | null;
|
|
74
|
-
storyPoints: number | null;
|
|
75
|
-
agent: {
|
|
76
|
-
id: string;
|
|
77
|
-
name: string;
|
|
78
|
-
image: string | null;
|
|
79
|
-
};
|
|
80
|
-
}[];
|
|
81
|
-
files?: TaskFileContext[];
|
|
82
|
-
repoRefs?: TaskRepoRefContext[];
|
|
83
|
-
_runnerSessionId?: string;
|
|
14
|
+
mode?: _project_shared.RunnerMode;
|
|
15
|
+
agentSettings?: _project_shared.AgentSettings;
|
|
84
16
|
}
|
|
85
|
-
interface ChatMessageFile {
|
|
86
|
-
fileId: string;
|
|
87
|
-
fileName: string;
|
|
88
|
-
mimeType: string;
|
|
89
|
-
fileSize?: number;
|
|
90
|
-
downloadUrl: string;
|
|
91
|
-
content?: string;
|
|
92
|
-
contentEncoding?: "base64" | "utf-8";
|
|
93
|
-
}
|
|
94
|
-
interface ChatMessage {
|
|
95
|
-
role: "user" | "assistant" | "system";
|
|
96
|
-
content: string;
|
|
97
|
-
userId?: string;
|
|
98
|
-
userName?: string;
|
|
99
|
-
createdAt: string;
|
|
100
|
-
files?: ChatMessageFile[];
|
|
101
|
-
}
|
|
102
|
-
type MultimodalBlock = {
|
|
103
|
-
type: "text";
|
|
104
|
-
text: string;
|
|
105
|
-
} | {
|
|
106
|
-
type: "image";
|
|
107
|
-
source: {
|
|
108
|
-
type: "base64";
|
|
109
|
-
media_type: "image/gif" | "image/jpeg" | "image/png" | "image/webp";
|
|
110
|
-
data: string;
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
type AgentEvent = {
|
|
114
|
-
type: "connected";
|
|
115
|
-
taskId: string;
|
|
116
|
-
} | {
|
|
117
|
-
type: "heartbeat";
|
|
118
|
-
taskId: string;
|
|
119
|
-
} | {
|
|
120
|
-
type: "thinking";
|
|
121
|
-
message: string;
|
|
122
|
-
} | {
|
|
123
|
-
type: "tool_use";
|
|
124
|
-
tool: string;
|
|
125
|
-
input: string;
|
|
126
|
-
} | {
|
|
127
|
-
type: "tool_result";
|
|
128
|
-
tool: string;
|
|
129
|
-
output: string;
|
|
130
|
-
isError?: boolean;
|
|
131
|
-
} | {
|
|
132
|
-
type: "message";
|
|
133
|
-
content: string;
|
|
134
|
-
} | {
|
|
135
|
-
type: "error";
|
|
136
|
-
message: string;
|
|
137
|
-
} | {
|
|
138
|
-
type: "completed";
|
|
139
|
-
summary: string;
|
|
140
|
-
costUsd?: number;
|
|
141
|
-
durationMs?: number;
|
|
142
|
-
} | {
|
|
143
|
-
type: "pr_created";
|
|
144
|
-
url: string;
|
|
145
|
-
number: number;
|
|
146
|
-
} | {
|
|
147
|
-
type: "turn_start";
|
|
148
|
-
} | {
|
|
149
|
-
type: "turn_end";
|
|
150
|
-
toolCalls: ActivityEventSummary[];
|
|
151
|
-
} | {
|
|
152
|
-
type: "setup_output";
|
|
153
|
-
stream: "stdout" | "stderr";
|
|
154
|
-
data: string;
|
|
155
|
-
} | {
|
|
156
|
-
type: "setup_complete";
|
|
157
|
-
previewPort?: number;
|
|
158
|
-
} | {
|
|
159
|
-
type: "setup_error";
|
|
160
|
-
message: string;
|
|
161
|
-
} | {
|
|
162
|
-
type: "start_command_output";
|
|
163
|
-
stream: "stdout" | "stderr";
|
|
164
|
-
data: string;
|
|
165
|
-
} | {
|
|
166
|
-
type: "agent_typing_start";
|
|
167
|
-
} | {
|
|
168
|
-
type: "agent_typing_stop";
|
|
169
|
-
};
|
|
170
|
-
interface ActivityEventSummary {
|
|
171
|
-
tool: string;
|
|
172
|
-
input?: string;
|
|
173
|
-
output?: string;
|
|
174
|
-
timestamp: string;
|
|
175
|
-
}
|
|
176
|
-
type AgentRunnerStatus = "connecting" | "connected" | "setup" | "fetching_context" | "running" | "idle" | "waiting_for_input" | "stopping" | "finished" | "disconnected" | "error";
|
|
177
17
|
interface AgentRunnerCallbacks {
|
|
178
|
-
onEvent: (event: AgentEvent) => void | Promise<void>;
|
|
179
|
-
onStatusChange: (status: AgentRunnerStatus) => void | Promise<void>;
|
|
18
|
+
onEvent: (event: _project_shared.AgentEvent) => void | Promise<void>;
|
|
19
|
+
onStatusChange: (status: _project_shared.AgentRunnerStatus) => void | Promise<void>;
|
|
180
20
|
}
|
|
181
21
|
|
|
182
22
|
declare class AgentRunner {
|
|
@@ -190,9 +30,10 @@ declare class AgentRunner {
|
|
|
190
30
|
private setupLog;
|
|
191
31
|
private heartbeatTimer;
|
|
192
32
|
private taskContext;
|
|
193
|
-
private
|
|
194
|
-
private
|
|
33
|
+
private planSync;
|
|
34
|
+
private costTracker;
|
|
195
35
|
private worktreeActive;
|
|
36
|
+
private activeMode;
|
|
196
37
|
private static readonly MAX_SETUP_LOG_LINES;
|
|
197
38
|
constructor(config: AgentRunnerConfig, callbacks: AgentRunnerCallbacks);
|
|
198
39
|
get state(): AgentRunnerStatus;
|
|
@@ -200,37 +41,41 @@ declare class AgentRunner {
|
|
|
200
41
|
private startHeartbeat;
|
|
201
42
|
private stopHeartbeat;
|
|
202
43
|
start(): Promise<void>;
|
|
44
|
+
private runQuerySafe;
|
|
203
45
|
private runCoreLoop;
|
|
204
46
|
private runSetupSafe;
|
|
47
|
+
private logEffectiveSettings;
|
|
205
48
|
private pushSetupLog;
|
|
206
49
|
private executeSetupConfig;
|
|
207
|
-
private initRtk;
|
|
208
50
|
private injectHumanMessage;
|
|
209
51
|
private waitForMessage;
|
|
210
52
|
private waitForUserContent;
|
|
211
53
|
createInputStream(initialPrompt: string | MultimodalBlock[]): AsyncGenerator<SDKUserMessage, void, unknown>;
|
|
212
|
-
private getPlanDirs;
|
|
213
|
-
/**
|
|
214
|
-
* Snapshot current plan files so syncPlanFile can distinguish files created
|
|
215
|
-
* by THIS session from ones created by a concurrent agent.
|
|
216
|
-
*/
|
|
217
|
-
snapshotPlanFiles(): void;
|
|
218
|
-
syncPlanFile(): void;
|
|
219
54
|
private asQueryHost;
|
|
55
|
+
private handleModeChange;
|
|
220
56
|
stop(): void;
|
|
221
57
|
}
|
|
222
58
|
|
|
223
|
-
interface
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
59
|
+
interface ProjectRunnerConfig {
|
|
60
|
+
conveyorApiUrl: string;
|
|
61
|
+
projectToken: string;
|
|
62
|
+
projectId: string;
|
|
63
|
+
projectDir: string;
|
|
227
64
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
65
|
+
declare class ProjectRunner {
|
|
66
|
+
private connection;
|
|
67
|
+
private projectDir;
|
|
68
|
+
private activeAgents;
|
|
69
|
+
private heartbeatTimer;
|
|
70
|
+
private stopping;
|
|
71
|
+
private resolveLifecycle;
|
|
72
|
+
constructor(config: ProjectRunnerConfig);
|
|
73
|
+
start(): Promise<void>;
|
|
74
|
+
private handleAssignment;
|
|
75
|
+
private handleStopTask;
|
|
76
|
+
stop(): Promise<void>;
|
|
233
77
|
}
|
|
78
|
+
|
|
234
79
|
declare class ConveyorConnection {
|
|
235
80
|
private socket;
|
|
236
81
|
private config;
|
|
@@ -239,36 +84,16 @@ declare class ConveyorConnection {
|
|
|
239
84
|
private static readonly EVENT_BATCH_MS;
|
|
240
85
|
private earlyMessages;
|
|
241
86
|
private earlyStop;
|
|
87
|
+
private earlyModeChanges;
|
|
242
88
|
private chatMessageCallback;
|
|
243
89
|
private stopCallback;
|
|
90
|
+
private modeChangeCallback;
|
|
244
91
|
private pendingQuestionResolvers;
|
|
245
92
|
constructor(config: AgentRunnerConfig);
|
|
246
93
|
connect(): Promise<void>;
|
|
247
|
-
fetchChatMessages(limit?: number): Promise<
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
userId: string | null;
|
|
251
|
-
userName?: string;
|
|
252
|
-
createdAt: string;
|
|
253
|
-
}[]>;
|
|
254
|
-
fetchTaskFiles(): Promise<{
|
|
255
|
-
fileId: string;
|
|
256
|
-
fileName: string;
|
|
257
|
-
mimeType: string;
|
|
258
|
-
fileSize: number;
|
|
259
|
-
downloadUrl: string;
|
|
260
|
-
content?: string;
|
|
261
|
-
contentEncoding?: "base64" | "utf-8";
|
|
262
|
-
}[]>;
|
|
263
|
-
fetchTaskFile(fileId: string): Promise<{
|
|
264
|
-
fileId: string;
|
|
265
|
-
fileName: string;
|
|
266
|
-
mimeType: string;
|
|
267
|
-
fileSize: number;
|
|
268
|
-
downloadUrl: string;
|
|
269
|
-
content?: string;
|
|
270
|
-
contentEncoding?: "base64" | "utf-8";
|
|
271
|
-
}>;
|
|
94
|
+
fetchChatMessages(limit?: number): Promise<ChatMessageResponse[]>;
|
|
95
|
+
fetchTaskFiles(): Promise<TaskFileResponse[]>;
|
|
96
|
+
fetchTaskFile(fileId: string): Promise<TaskFileResponse>;
|
|
272
97
|
fetchTaskContext(): Promise<TaskContext>;
|
|
273
98
|
sendEvent(event: AgentEvent): void;
|
|
274
99
|
flushEvents(): void;
|
|
@@ -289,87 +114,38 @@ declare class ConveyorConnection {
|
|
|
289
114
|
plan?: string;
|
|
290
115
|
description?: string;
|
|
291
116
|
}): void;
|
|
292
|
-
onChatMessage(callback: (message:
|
|
293
|
-
content: string;
|
|
294
|
-
userId: string;
|
|
295
|
-
files?: {
|
|
296
|
-
id: string;
|
|
297
|
-
fileName: string;
|
|
298
|
-
mimeType: string;
|
|
299
|
-
downloadUrl: string;
|
|
300
|
-
content?: string;
|
|
301
|
-
contentEncoding?: "base64" | "utf-8";
|
|
302
|
-
}[];
|
|
303
|
-
}) => void): void;
|
|
117
|
+
onChatMessage(callback: (message: IncomingMessagePayload) => void): void;
|
|
304
118
|
onStopRequested(callback: () => void): void;
|
|
119
|
+
onModeChange(callback: (data: SetModePayload) => void): void;
|
|
120
|
+
emitModeChanged(mode: PmSubMode): void;
|
|
305
121
|
trackSpending(params: {
|
|
306
122
|
agentId: string;
|
|
307
123
|
sessionId: string;
|
|
308
124
|
totalCostUsd: number;
|
|
309
125
|
onSubscription: boolean;
|
|
126
|
+
modelUsage?: {
|
|
127
|
+
model: string;
|
|
128
|
+
inputTokens: number;
|
|
129
|
+
outputTokens: number;
|
|
130
|
+
cacheReadInputTokens: number;
|
|
131
|
+
cacheCreationInputTokens: number;
|
|
132
|
+
costUSD: number;
|
|
133
|
+
}[];
|
|
310
134
|
}): void;
|
|
311
135
|
emitStatus(status: string): void;
|
|
312
136
|
sendHeartbeat(): void;
|
|
313
137
|
sendTypingStart(): void;
|
|
314
138
|
sendTypingStop(): void;
|
|
315
|
-
createSubtask(data: {
|
|
316
|
-
title: string;
|
|
317
|
-
description?: string;
|
|
318
|
-
plan?: string;
|
|
319
|
-
ordinal?: number;
|
|
320
|
-
storyPointValue?: number;
|
|
321
|
-
}): Promise<{
|
|
139
|
+
createSubtask(data: SubtaskCreatePayload): Promise<{
|
|
322
140
|
id: string;
|
|
323
141
|
}>;
|
|
324
|
-
updateSubtask(subtaskId: string, fields:
|
|
325
|
-
title?: string;
|
|
326
|
-
description?: string;
|
|
327
|
-
plan?: string;
|
|
328
|
-
ordinal?: number;
|
|
329
|
-
storyPointValue?: number;
|
|
330
|
-
}): void;
|
|
142
|
+
updateSubtask(subtaskId: string, fields: SubtaskUpdateFields): void;
|
|
331
143
|
deleteSubtask(subtaskId: string): void;
|
|
332
|
-
listSubtasks(): Promise<
|
|
333
|
-
|
|
334
|
-
title: string;
|
|
335
|
-
description: string | null;
|
|
336
|
-
status: string;
|
|
337
|
-
ordinal: number;
|
|
338
|
-
storyPointId: string | null;
|
|
339
|
-
plan: string | null;
|
|
340
|
-
}[]>;
|
|
341
|
-
fetchTask(slugOrId: string): Promise<{
|
|
342
|
-
id: string;
|
|
343
|
-
slug: string;
|
|
344
|
-
title: string;
|
|
345
|
-
description: string | null;
|
|
346
|
-
plan: string | null;
|
|
347
|
-
status: string;
|
|
348
|
-
parentTaskId: string | null;
|
|
349
|
-
}>;
|
|
144
|
+
listSubtasks(): Promise<SubtaskResponse[]>;
|
|
145
|
+
fetchTask(slugOrId: string): Promise<TaskLookupResponse>;
|
|
350
146
|
disconnect(): void;
|
|
351
147
|
}
|
|
352
148
|
|
|
353
|
-
interface ProjectRunnerConfig {
|
|
354
|
-
conveyorApiUrl: string;
|
|
355
|
-
projectToken: string;
|
|
356
|
-
projectId: string;
|
|
357
|
-
projectDir: string;
|
|
358
|
-
}
|
|
359
|
-
declare class ProjectRunner {
|
|
360
|
-
private connection;
|
|
361
|
-
private projectDir;
|
|
362
|
-
private activeAgents;
|
|
363
|
-
private heartbeatTimer;
|
|
364
|
-
private stopping;
|
|
365
|
-
private resolveLifecycle;
|
|
366
|
-
constructor(config: ProjectRunnerConfig);
|
|
367
|
-
start(): Promise<void>;
|
|
368
|
-
private handleAssignment;
|
|
369
|
-
private handleStopTask;
|
|
370
|
-
stop(): Promise<void>;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
149
|
interface ProjectConnectionConfig {
|
|
374
150
|
apiUrl: string;
|
|
375
151
|
projectToken: string;
|
|
@@ -382,6 +158,7 @@ interface TaskAssignment {
|
|
|
382
158
|
mode: string;
|
|
383
159
|
branch: string;
|
|
384
160
|
devBranch: string;
|
|
161
|
+
useWorktree?: boolean;
|
|
385
162
|
}
|
|
386
163
|
interface IncomingChatMessage {
|
|
387
164
|
content: string;
|
|
@@ -438,10 +215,9 @@ declare class ProjectConnection {
|
|
|
438
215
|
disconnect(): void;
|
|
439
216
|
}
|
|
440
217
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
*/
|
|
218
|
+
declare function ensureWorktree(projectDir: string, taskId: string, branch?: string): string;
|
|
219
|
+
declare function removeWorktree(projectDir: string, taskId: string): void;
|
|
220
|
+
|
|
445
221
|
interface CacheEntry {
|
|
446
222
|
content: Buffer;
|
|
447
223
|
mimeType: string;
|
|
@@ -472,29 +248,8 @@ interface ConveyorConfig {
|
|
|
472
248
|
previewPort?: number;
|
|
473
249
|
}
|
|
474
250
|
declare function loadConveyorConfig(workspaceDir: string): Promise<ConveyorConfig | null>;
|
|
475
|
-
|
|
476
|
-
* Runs a command synchronously (waits for exit). Streams stdout/stderr
|
|
477
|
-
* line-by-line via the onOutput callback.
|
|
478
|
-
*/
|
|
251
|
+
|
|
479
252
|
declare function runSetupCommand(cmd: string, cwd: string, onOutput: (stream: "stdout" | "stderr", data: string) => void): Promise<void>;
|
|
480
|
-
/**
|
|
481
|
-
* Runs a command in the background (does not wait for exit). Returns the
|
|
482
|
-
* ChildProcess so it can be cleaned up on agent shutdown. Streams
|
|
483
|
-
* stdout/stderr via the onOutput callback.
|
|
484
|
-
*/
|
|
485
253
|
declare function runStartCommand(cmd: string, cwd: string, onOutput: (stream: "stdout" | "stderr", data: string) => void): ChildProcess;
|
|
486
254
|
|
|
487
|
-
|
|
488
|
-
* Ensure a git worktree exists for the given task. Creates one if it doesn't
|
|
489
|
-
* exist, reuses the existing one otherwise. Returns the absolute worktree path.
|
|
490
|
-
*
|
|
491
|
-
* Uses --detach to avoid "branch already checked out" errors when the branch
|
|
492
|
-
* (e.g. dev) is already checked out in the main worktree or another worktree.
|
|
493
|
-
*/
|
|
494
|
-
declare function ensureWorktree(projectDir: string, taskId: string, branch?: string): string;
|
|
495
|
-
/**
|
|
496
|
-
* Remove a task's git worktree. Best-effort — silently ignores failures.
|
|
497
|
-
*/
|
|
498
|
-
declare function removeWorktree(projectDir: string, taskId: string): void;
|
|
499
|
-
|
|
500
|
-
export { type AgentContext, type AgentEvent, AgentRunner, type AgentRunnerCallbacks, type AgentRunnerConfig, type ChatHistoryMessage, type ChatMessage, type ConveyorConfig, ConveyorConnection, FileCache, type IncomingChatMessage, ProjectConnection, type ProjectConnectionConfig, ProjectRunner, type ProjectRunnerConfig, type TaskAssignment, type TaskContext, type TaskFileContext, ensureWorktree, loadConveyorConfig, removeWorktree, runSetupCommand, runStartCommand };
|
|
255
|
+
export { type AgentContext, AgentRunner, type AgentRunnerCallbacks, type AgentRunnerConfig, type ChatHistoryMessage, type ConveyorConfig, ConveyorConnection, FileCache, type IncomingChatMessage, ProjectConnection, type ProjectConnectionConfig, ProjectRunner, type ProjectRunnerConfig, type TaskAssignment, ensureWorktree, loadConveyorConfig, removeWorktree, runSetupCommand, runStartCommand };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentRunner,
|
|
3
3
|
ConveyorConnection,
|
|
4
|
+
FileCache,
|
|
4
5
|
ProjectConnection,
|
|
5
6
|
ProjectRunner,
|
|
6
7
|
ensureWorktree,
|
|
@@ -8,71 +9,7 @@ import {
|
|
|
8
9
|
removeWorktree,
|
|
9
10
|
runSetupCommand,
|
|
10
11
|
runStartCommand
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
|
|
13
|
-
// src/file-cache.ts
|
|
14
|
-
var DEFAULT_MAX_SIZE_BYTES = 50 * 1024 * 1024;
|
|
15
|
-
var DEFAULT_TTL_MS = 60 * 60 * 1e3;
|
|
16
|
-
var FileCache = class {
|
|
17
|
-
cache = /* @__PURE__ */ new Map();
|
|
18
|
-
currentSize = 0;
|
|
19
|
-
maxSizeBytes;
|
|
20
|
-
ttlMs;
|
|
21
|
-
constructor(maxSizeBytes = DEFAULT_MAX_SIZE_BYTES, ttlMs = DEFAULT_TTL_MS) {
|
|
22
|
-
this.maxSizeBytes = maxSizeBytes;
|
|
23
|
-
this.ttlMs = ttlMs;
|
|
24
|
-
}
|
|
25
|
-
get(fileId) {
|
|
26
|
-
const entry = this.cache.get(fileId);
|
|
27
|
-
if (!entry) return null;
|
|
28
|
-
if (Date.now() - entry.createdAt > this.ttlMs) {
|
|
29
|
-
this.delete(fileId);
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
this.cache.delete(fileId);
|
|
33
|
-
this.cache.set(fileId, entry);
|
|
34
|
-
return entry;
|
|
35
|
-
}
|
|
36
|
-
set(fileId, content, mimeType, fileName) {
|
|
37
|
-
if (this.cache.has(fileId)) {
|
|
38
|
-
this.delete(fileId);
|
|
39
|
-
}
|
|
40
|
-
const size = content.byteLength;
|
|
41
|
-
if (size > this.maxSizeBytes) return;
|
|
42
|
-
while (this.currentSize + size > this.maxSizeBytes && this.cache.size > 0) {
|
|
43
|
-
const oldestKey = this.cache.keys().next().value;
|
|
44
|
-
if (oldestKey !== void 0) {
|
|
45
|
-
this.delete(oldestKey);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
this.cache.set(fileId, {
|
|
49
|
-
content,
|
|
50
|
-
mimeType,
|
|
51
|
-
fileName,
|
|
52
|
-
createdAt: Date.now(),
|
|
53
|
-
size
|
|
54
|
-
});
|
|
55
|
-
this.currentSize += size;
|
|
56
|
-
}
|
|
57
|
-
delete(fileId) {
|
|
58
|
-
const entry = this.cache.get(fileId);
|
|
59
|
-
if (entry) {
|
|
60
|
-
this.currentSize -= entry.size;
|
|
61
|
-
this.cache.delete(fileId);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
clear() {
|
|
65
|
-
this.cache.clear();
|
|
66
|
-
this.currentSize = 0;
|
|
67
|
-
}
|
|
68
|
-
get stats() {
|
|
69
|
-
return {
|
|
70
|
-
entries: this.cache.size,
|
|
71
|
-
sizeBytes: this.currentSize,
|
|
72
|
-
maxSizeBytes: this.maxSizeBytes
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
};
|
|
12
|
+
} from "./chunk-22ME6AB3.js";
|
|
76
13
|
export {
|
|
77
14
|
AgentRunner,
|
|
78
15
|
ConveyorConnection,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rallycry/conveyor-agent",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Conveyor cloud build agent runner - executes task plans inside GitHub Codespaces",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"zod": "^3.25.76"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@project/shared": "workspace:*",
|
|
42
43
|
"tsup": "^8.0.0",
|
|
43
44
|
"typescript": "^5.3.0",
|
|
44
45
|
"vitest": "^4.0.17"
|