@rallycry/conveyor-agent 2.18.0 → 3.0.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-5UYKPYFQ.js} +833 -557
- package/dist/chunk-5UYKPYFQ.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +55 -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;
|
|
84
|
-
}
|
|
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;
|
|
14
|
+
mode?: _project_shared.RunnerMode;
|
|
15
|
+
agentSettings?: _project_shared.AgentSettings;
|
|
175
16
|
}
|
|
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;
|
|
@@ -202,35 +43,38 @@ declare class AgentRunner {
|
|
|
202
43
|
start(): Promise<void>;
|
|
203
44
|
private runCoreLoop;
|
|
204
45
|
private runSetupSafe;
|
|
46
|
+
private logEffectiveSettings;
|
|
205
47
|
private pushSetupLog;
|
|
206
48
|
private executeSetupConfig;
|
|
207
|
-
private initRtk;
|
|
208
49
|
private injectHumanMessage;
|
|
209
50
|
private waitForMessage;
|
|
210
51
|
private waitForUserContent;
|
|
211
52
|
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
53
|
private asQueryHost;
|
|
54
|
+
private handleModeChange;
|
|
220
55
|
stop(): void;
|
|
221
56
|
}
|
|
222
57
|
|
|
223
|
-
interface
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
58
|
+
interface ProjectRunnerConfig {
|
|
59
|
+
conveyorApiUrl: string;
|
|
60
|
+
projectToken: string;
|
|
61
|
+
projectId: string;
|
|
62
|
+
projectDir: string;
|
|
227
63
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
64
|
+
declare class ProjectRunner {
|
|
65
|
+
private connection;
|
|
66
|
+
private projectDir;
|
|
67
|
+
private activeAgents;
|
|
68
|
+
private heartbeatTimer;
|
|
69
|
+
private stopping;
|
|
70
|
+
private resolveLifecycle;
|
|
71
|
+
constructor(config: ProjectRunnerConfig);
|
|
72
|
+
start(): Promise<void>;
|
|
73
|
+
private handleAssignment;
|
|
74
|
+
private handleStopTask;
|
|
75
|
+
stop(): Promise<void>;
|
|
233
76
|
}
|
|
77
|
+
|
|
234
78
|
declare class ConveyorConnection {
|
|
235
79
|
private socket;
|
|
236
80
|
private config;
|
|
@@ -239,36 +83,16 @@ declare class ConveyorConnection {
|
|
|
239
83
|
private static readonly EVENT_BATCH_MS;
|
|
240
84
|
private earlyMessages;
|
|
241
85
|
private earlyStop;
|
|
86
|
+
private earlyModeChanges;
|
|
242
87
|
private chatMessageCallback;
|
|
243
88
|
private stopCallback;
|
|
89
|
+
private modeChangeCallback;
|
|
244
90
|
private pendingQuestionResolvers;
|
|
245
91
|
constructor(config: AgentRunnerConfig);
|
|
246
92
|
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
|
-
}>;
|
|
93
|
+
fetchChatMessages(limit?: number): Promise<ChatMessageResponse[]>;
|
|
94
|
+
fetchTaskFiles(): Promise<TaskFileResponse[]>;
|
|
95
|
+
fetchTaskFile(fileId: string): Promise<TaskFileResponse>;
|
|
272
96
|
fetchTaskContext(): Promise<TaskContext>;
|
|
273
97
|
sendEvent(event: AgentEvent): void;
|
|
274
98
|
flushEvents(): void;
|
|
@@ -289,87 +113,38 @@ declare class ConveyorConnection {
|
|
|
289
113
|
plan?: string;
|
|
290
114
|
description?: string;
|
|
291
115
|
}): 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;
|
|
116
|
+
onChatMessage(callback: (message: IncomingMessagePayload) => void): void;
|
|
304
117
|
onStopRequested(callback: () => void): void;
|
|
118
|
+
onModeChange(callback: (data: SetModePayload) => void): void;
|
|
119
|
+
emitModeChanged(mode: PmSubMode): void;
|
|
305
120
|
trackSpending(params: {
|
|
306
121
|
agentId: string;
|
|
307
122
|
sessionId: string;
|
|
308
123
|
totalCostUsd: number;
|
|
309
124
|
onSubscription: boolean;
|
|
125
|
+
modelUsage?: {
|
|
126
|
+
model: string;
|
|
127
|
+
inputTokens: number;
|
|
128
|
+
outputTokens: number;
|
|
129
|
+
cacheReadInputTokens: number;
|
|
130
|
+
cacheCreationInputTokens: number;
|
|
131
|
+
costUSD: number;
|
|
132
|
+
}[];
|
|
310
133
|
}): void;
|
|
311
134
|
emitStatus(status: string): void;
|
|
312
135
|
sendHeartbeat(): void;
|
|
313
136
|
sendTypingStart(): void;
|
|
314
137
|
sendTypingStop(): void;
|
|
315
|
-
createSubtask(data: {
|
|
316
|
-
title: string;
|
|
317
|
-
description?: string;
|
|
318
|
-
plan?: string;
|
|
319
|
-
ordinal?: number;
|
|
320
|
-
storyPointValue?: number;
|
|
321
|
-
}): Promise<{
|
|
138
|
+
createSubtask(data: SubtaskCreatePayload): Promise<{
|
|
322
139
|
id: string;
|
|
323
140
|
}>;
|
|
324
|
-
updateSubtask(subtaskId: string, fields:
|
|
325
|
-
title?: string;
|
|
326
|
-
description?: string;
|
|
327
|
-
plan?: string;
|
|
328
|
-
ordinal?: number;
|
|
329
|
-
storyPointValue?: number;
|
|
330
|
-
}): void;
|
|
141
|
+
updateSubtask(subtaskId: string, fields: SubtaskUpdateFields): void;
|
|
331
142
|
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
|
-
}>;
|
|
143
|
+
listSubtasks(): Promise<SubtaskResponse[]>;
|
|
144
|
+
fetchTask(slugOrId: string): Promise<TaskLookupResponse>;
|
|
350
145
|
disconnect(): void;
|
|
351
146
|
}
|
|
352
147
|
|
|
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
148
|
interface ProjectConnectionConfig {
|
|
374
149
|
apiUrl: string;
|
|
375
150
|
projectToken: string;
|
|
@@ -438,10 +213,9 @@ declare class ProjectConnection {
|
|
|
438
213
|
disconnect(): void;
|
|
439
214
|
}
|
|
440
215
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
*/
|
|
216
|
+
declare function ensureWorktree(projectDir: string, taskId: string, branch?: string): string;
|
|
217
|
+
declare function removeWorktree(projectDir: string, taskId: string): void;
|
|
218
|
+
|
|
445
219
|
interface CacheEntry {
|
|
446
220
|
content: Buffer;
|
|
447
221
|
mimeType: string;
|
|
@@ -472,29 +246,8 @@ interface ConveyorConfig {
|
|
|
472
246
|
previewPort?: number;
|
|
473
247
|
}
|
|
474
248
|
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
|
-
*/
|
|
249
|
+
|
|
479
250
|
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
251
|
declare function runStartCommand(cmd: string, cwd: string, onOutput: (stream: "stdout" | "stderr", data: string) => void): ChildProcess;
|
|
486
252
|
|
|
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 };
|
|
253
|
+
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-5UYKPYFQ.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.0.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"
|