@rallycry/conveyor-agent 6.0.2 → 6.0.4

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/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  ProjectRunner,
5
5
  createServiceLogger,
6
6
  errorMeta
7
- } from "./chunk-HYWZJYPW.js";
7
+ } from "./chunk-NKZSUGND.js";
8
8
 
9
9
  // src/cli.ts
10
10
  import { readFileSync } from "fs";
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
2
2
  import * as _project_shared from '@project/shared';
3
- import { AgentRunnerStatus, MultimodalBlock, ProjectEnvironmentStatus, ChatMessageResponse, TaskFileResponse, TaskContext, AgentEvent, AgentQuestion, IncomingMessagePayload, SetModePayload, AgentMode, SubtaskCreatePayload, SubtaskUpdateFields, SubtaskResponse, StartChildCloudBuildResponse, TaskLookupResponse, UpdateTaskPropertiesPayload, IconListItem, GenerateIconResponse, TaskPropertiesResponse, TriggerIdentificationResponse, ModeTransitionPayload, IncidentDTO, TaskIncidentDTO } from '@project/shared';
4
- export { AgentEvent, ChatMessage, TaskContext, TaskFileContext } from '@project/shared';
3
+ import { AgentRunnerStatus, MultimodalBlock, ProjectEnvironmentStatus, ChatMessageResponse, TaskFileResponse, TaskContext, AgentEvent, AgentQuestion, IncomingMessagePayload, SetModePayload, AgentMode, SubtaskCreatePayload, SubtaskUpdateFields, SubtaskResponse, StartChildCloudBuildResponse, TaskLookupResponse, UpdateTaskPropertiesPayload, IconListItem, GenerateIconResponse, TaskPropertiesResponse, TriggerIdentificationResponse, ModeTransitionPayload, DebugSessionState, DebugSessionSummary, IncidentDTO, TaskIncidentDTO, TagAuditRunnerRequest, TagAuditRunnerResponse, TagAuditProgressActivity, DebugTelemetryEvent } from '@project/shared';
4
+ export { AgentEvent, ChatMessage, DebugBreakpointHit, DebugModeEvent, TaskContext, TaskFileContext } from '@project/shared';
5
5
  import { ChildProcess } from 'node:child_process';
6
6
 
7
7
  interface AgentRunnerConfig {
@@ -46,6 +46,7 @@ declare class AgentRunner {
46
46
  private idleCheckInterval;
47
47
  private conveyorConfig;
48
48
  private _queryHost;
49
+ private tunnelClient;
49
50
  constructor(config: AgentRunnerConfig, callbacks: AgentRunnerCallbacks);
50
51
  get state(): AgentRunnerStatus;
51
52
  private get effectiveAgentMode();
@@ -57,6 +58,7 @@ declare class AgentRunner {
57
58
  private tryInitWorktree;
58
59
  private fetchAndInitContext;
59
60
  private tryPostContextWorktree;
61
+ private startPreviewTunnel;
60
62
  private activateWorktree;
61
63
  private checkoutWorktreeBranch;
62
64
  private needsPRNudge;
@@ -91,9 +93,12 @@ declare class ProjectRunner {
91
93
  private heartbeatTimer;
92
94
  private stopping;
93
95
  private resolveLifecycle;
96
+ private chatSessionIds;
94
97
  private startCommandChild;
95
98
  private startCommandRunning;
96
99
  private setupComplete;
100
+ private branchSwitchCommand;
101
+ private commitWatcher;
97
102
  constructor(config: ProjectRunnerConfig);
98
103
  private checkoutWorkspaceBranch;
99
104
  private executeSetupCommand;
@@ -101,6 +106,11 @@ declare class ProjectRunner {
101
106
  killStartCommand(): Promise<void>;
102
107
  restartStartCommand(): Promise<void>;
103
108
  getEnvironmentStatus(): ProjectEnvironmentStatus;
109
+ private getCurrentBranch;
110
+ private smartSync;
111
+ private handleSwitchBranch;
112
+ private handleSyncEnvironment;
113
+ private handleGetEnvStatus;
104
114
  start(): Promise<void>;
105
115
  private handleAssignment;
106
116
  private handleStopTask;
@@ -137,6 +147,7 @@ declare class ConveyorConnection {
137
147
  title: string;
138
148
  body: string;
139
149
  baseBranch?: string;
150
+ branch?: string;
140
151
  }): Promise<{
141
152
  url: string;
142
153
  number: number;
@@ -200,7 +211,11 @@ declare class ConveyorConnection {
200
211
  generateTaskIcon(prompt: string, aspectRatio?: "auto" | "portrait" | "landscape" | "square"): Promise<GenerateIconResponse>;
201
212
  getTaskProperties(): Promise<TaskPropertiesResponse>;
202
213
  triggerIdentification(): Promise<TriggerIdentificationResponse>;
214
+ refreshAuthToken(): Promise<boolean>;
203
215
  emitModeTransition(payload: ModeTransitionPayload): void;
216
+ emitDebugStateChanged(state: DebugSessionState): void;
217
+ emitDebugSessionComplete(summary: DebugSessionSummary): void;
218
+ emitDebugReproduceRequested(hypothesis?: string): void;
204
219
  searchIncidents(status?: string, source?: string): Promise<IncidentDTO[]>;
205
220
  getTaskIncidents(taskId?: string): Promise<TaskIncidentDTO[]>;
206
221
  disconnect(): void;
@@ -210,6 +225,7 @@ interface ProjectConnectionConfig {
210
225
  apiUrl: string;
211
226
  projectToken: string;
212
227
  projectId: string;
228
+ projectDir?: string;
213
229
  }
214
230
  interface TaskAssignment {
215
231
  taskId: string;
@@ -225,6 +241,7 @@ interface TaskAssignment {
225
241
  interface IncomingChatMessage {
226
242
  content: string;
227
243
  userId: string;
244
+ chatId?: string;
228
245
  files?: {
229
246
  id: string;
230
247
  fileName: string;
@@ -249,7 +266,22 @@ interface AgentContext {
249
266
  agentInstructions: string;
250
267
  model: string;
251
268
  agentSettings: Record<string, unknown> | null;
269
+ branchSwitchCommand?: string;
252
270
  }
271
+ type SwitchBranchCallback = (res: {
272
+ ok: boolean;
273
+ data?: _project_shared.ProjectEnvironmentStatus;
274
+ error?: string;
275
+ }) => void;
276
+ type SyncEnvironmentCallback = (res: {
277
+ ok: boolean;
278
+ data?: _project_shared.ProjectEnvironmentStatus;
279
+ error?: string;
280
+ }) => void;
281
+ type GetEnvStatusCallback = (res: {
282
+ ok: boolean;
283
+ data?: _project_shared.ProjectEnvironmentStatus;
284
+ }) => void;
253
285
  declare class ProjectConnection {
254
286
  private socket;
255
287
  private config;
@@ -258,6 +290,17 @@ declare class ProjectConnection {
258
290
  private shutdownCallback;
259
291
  private chatMessageCallback;
260
292
  private earlyChatMessages;
293
+ private auditRequestCallback;
294
+ onSwitchBranch: ((data: {
295
+ branch: string;
296
+ syncAfter?: boolean;
297
+ }, cb: SwitchBranchCallback) => void) | null;
298
+ onSyncEnvironment: ((cb: SyncEnvironmentCallback) => void) | null;
299
+ onGetEnvStatus: ((cb: GetEnvStatusCallback) => void) | null;
300
+ onRestartStartCommand: ((cb: (res: {
301
+ ok: boolean;
302
+ error?: string;
303
+ }) => void) => void) | null;
261
304
  constructor(config: ProjectConnectionConfig);
262
305
  connect(): Promise<void>;
263
306
  onTaskAssignment(callback: (assignment: TaskAssignment) => void): void;
@@ -266,6 +309,12 @@ declare class ProjectConnection {
266
309
  }) => void): void;
267
310
  onShutdown(callback: () => void): void;
268
311
  onChatMessage(callback: (msg: IncomingChatMessage) => void): void;
312
+ onAuditRequest(callback: (request: TagAuditRunnerRequest) => void): void;
313
+ emitAuditResult(data: TagAuditRunnerResponse): void;
314
+ emitAuditProgress(data: {
315
+ requestId: string;
316
+ activity: TagAuditProgressActivity;
317
+ }): void;
269
318
  sendHeartbeat(): void;
270
319
  emitTaskStarted(taskId: string): void;
271
320
  emitTaskStopped(taskId: string, reason: string): void;
@@ -273,11 +322,70 @@ declare class ProjectConnection {
273
322
  emitChatMessage(content: string): Promise<void>;
274
323
  emitAgentStatus(status: string): void;
275
324
  fetchAgentContext(): Promise<AgentContext | null>;
276
- fetchChatHistory(limit?: number): Promise<ChatHistoryMessage[]>;
325
+ fetchChatHistory(limit?: number, chatId?: string): Promise<ChatHistoryMessage[]>;
326
+ requestListTasks(params: {
327
+ status?: string;
328
+ assigneeId?: string;
329
+ limit?: number;
330
+ }): Promise<unknown[]>;
331
+ requestGetTask(taskId: string): Promise<unknown>;
332
+ requestCreateTask(params: {
333
+ title: string;
334
+ description?: string;
335
+ plan?: string;
336
+ status?: string;
337
+ isBug?: boolean;
338
+ }): Promise<{
339
+ id: string;
340
+ slug: string;
341
+ }>;
342
+ requestUpdateTask(params: {
343
+ taskId: string;
344
+ title?: string;
345
+ description?: string;
346
+ plan?: string;
347
+ status?: string;
348
+ assignedUserId?: string | null;
349
+ }): Promise<unknown>;
350
+ requestSearchTasks(params: {
351
+ tagNames?: string[];
352
+ searchQuery?: string;
353
+ statusFilters?: string[];
354
+ limit?: number;
355
+ }): Promise<unknown[]>;
356
+ requestListTags(): Promise<unknown[]>;
357
+ requestGetProjectSummary(): Promise<unknown>;
358
+ private requestWithCallback;
359
+ emitNewCommitsDetected(data: {
360
+ branch: string;
361
+ commitCount: number;
362
+ latestCommit: {
363
+ sha: string;
364
+ message: string;
365
+ author: string;
366
+ };
367
+ autoSyncing: boolean;
368
+ }): void;
369
+ emitEnvironmentReady(data: {
370
+ branch: string;
371
+ commitsSynced: number;
372
+ syncDurationMs: number;
373
+ stepsRun: string[];
374
+ }): void;
375
+ emitEnvSwitchProgress(data: {
376
+ step: string;
377
+ status: "running" | "success" | "error";
378
+ message?: string;
379
+ }): void;
380
+ private handleRunAuthTokenCommand;
277
381
  disconnect(): void;
278
382
  }
279
383
 
280
384
  declare function ensureWorktree(projectDir: string, taskId: string, branch?: string): string;
385
+ /**
386
+ * Force-remove is intentional: this runs after task completion or explicit stop.
387
+ * Any uncommitted changes at this point are scratch artifacts, not valuable work.
388
+ */
281
389
  declare function removeWorktree(projectDir: string, taskId: string): void;
282
390
 
283
391
  interface CacheEntry {
@@ -317,4 +425,260 @@ declare function loadConveyorConfig(_workspaceDir?: string): ConveyorConfig | nu
317
425
  declare function runSetupCommand(cmd: string, cwd: string, onOutput: (stream: "stdout" | "stderr", data: string) => void): Promise<void>;
318
426
  declare function runStartCommand(cmd: string, cwd: string, onOutput: (stream: "stdout" | "stderr", data: string) => void): ChildProcess;
319
427
 
320
- 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 };
428
+ interface BreakpointInfo {
429
+ breakpointId: string;
430
+ file: string;
431
+ line: number;
432
+ condition?: string;
433
+ }
434
+ interface ProbeInfo {
435
+ probeId: string;
436
+ breakpointId: string;
437
+ file: string;
438
+ line: number;
439
+ expressions: string[];
440
+ label: string;
441
+ }
442
+ interface ProbeHit {
443
+ label: string;
444
+ data: Record<string, unknown>;
445
+ timestamp: number;
446
+ }
447
+ interface CallFrameInfo {
448
+ index: number;
449
+ functionName: string;
450
+ file: string;
451
+ line: number;
452
+ column: number;
453
+ callFrameId: string;
454
+ }
455
+ interface ScopeVariable {
456
+ name: string;
457
+ type: string;
458
+ value: string;
459
+ }
460
+ interface PausedState {
461
+ callFrames: CallFrameInfo[];
462
+ reason: string;
463
+ hitBreakpoints?: string[];
464
+ }
465
+ type InspectorProtocol = "cdp" | "webkit";
466
+ declare class CdpDebugClient {
467
+ private ws;
468
+ private requestId;
469
+ private pendingRequests;
470
+ private breakpoints;
471
+ private probes;
472
+ private probeCounter;
473
+ private probeBufferInjected;
474
+ private pausedState;
475
+ private autoResumeTimer;
476
+ private protocol;
477
+ private onPausedCallback;
478
+ private onResumedCallback;
479
+ private onAutoResumedCallback;
480
+ connect(wsUrl: string, protocol?: InspectorProtocol): Promise<void>;
481
+ disconnect(): void;
482
+ isConnected(): boolean;
483
+ getProtocol(): InspectorProtocol;
484
+ setBreakpoint(file: string, line: number, condition?: string): Promise<string>;
485
+ removeBreakpoint(breakpointId: string): Promise<void>;
486
+ removeAllBreakpoints(): Promise<void>;
487
+ listBreakpoints(): BreakpointInfo[];
488
+ setLogpoint(file: string, line: number, expressions: string[], label?: string): Promise<string>;
489
+ removeProbe(probeId: string): Promise<void>;
490
+ listProbes(): ProbeInfo[];
491
+ getProbeResults(label?: string, limit?: number): Promise<ProbeHit[]>;
492
+ clearProbeResults(label?: string): Promise<void>;
493
+ isPaused(): boolean;
494
+ getPausedState(): PausedState | null;
495
+ getCallStack(): CallFrameInfo[];
496
+ getScopeVariables(callFrameId: string): Promise<ScopeVariable[]>;
497
+ resume(): Promise<void>;
498
+ stepOver(): Promise<void>;
499
+ stepInto(): Promise<void>;
500
+ evaluate(expression: string, callFrameId?: string): Promise<{
501
+ type: string;
502
+ value: string;
503
+ }>;
504
+ onPaused(callback: (state: PausedState) => void): void;
505
+ onResumed(callback: () => void): void;
506
+ onAutoResumed(callback: () => void): void;
507
+ private send;
508
+ private handleMessage;
509
+ private handlePaused;
510
+ private ensureProbeBuffer;
511
+ private extractEvalError;
512
+ private fileToUrlRegex;
513
+ private formatRemoteObject;
514
+ private truncateValue;
515
+ private clearAutoResumeTimer;
516
+ private cleanup;
517
+ }
518
+
519
+ interface ConsoleMessage {
520
+ level: string;
521
+ text: string;
522
+ timestamp: number;
523
+ url?: string;
524
+ line?: number;
525
+ }
526
+ interface NetworkRequest {
527
+ url: string;
528
+ method: string;
529
+ status?: number;
530
+ resourceType?: string;
531
+ timestamp: number;
532
+ duration?: number;
533
+ }
534
+ interface ClientPageError {
535
+ message: string;
536
+ stack?: string;
537
+ timestamp: number;
538
+ }
539
+
540
+ declare class PlaywrightDebugClient {
541
+ private browser;
542
+ private page;
543
+ private cdpSession;
544
+ private breakpoints;
545
+ private probes;
546
+ private probeCounter;
547
+ private probeBufferInjected;
548
+ private pausedState;
549
+ private autoResumeTimer;
550
+ private inactivityTimer;
551
+ private onPausedCallback;
552
+ private onResumedCallback;
553
+ private onAutoResumedCallback;
554
+ private consoleMessages;
555
+ private networkRequests;
556
+ private pageErrors;
557
+ private sourceMapDetected;
558
+ launch(previewUrl: string): Promise<void>;
559
+ close(): Promise<void>;
560
+ isConnected(): boolean;
561
+ hasSourceMaps(): boolean | null;
562
+ setBreakpoint(file: string, line: number, condition?: string): Promise<string>;
563
+ removeBreakpoint(breakpointId: string): Promise<void>;
564
+ removeAllBreakpoints(): Promise<void>;
565
+ listBreakpoints(): BreakpointInfo[];
566
+ setLogpoint(file: string, line: number, expressions: string[], label?: string): Promise<string>;
567
+ removeProbe(probeId: string): Promise<void>;
568
+ listProbes(): ProbeInfo[];
569
+ getProbeResults(label?: string, limit?: number): Promise<ProbeHit[]>;
570
+ clearProbeResults(label?: string): Promise<void>;
571
+ isPaused(): boolean;
572
+ getPausedState(): PausedState | null;
573
+ getCallStack(): CallFrameInfo[];
574
+ getScopeVariables(callFrameId: string): Promise<ScopeVariable[]>;
575
+ resume(): Promise<void>;
576
+ stepOver(): Promise<void>;
577
+ stepInto(): Promise<void>;
578
+ evaluate(expression: string, callFrameId?: string): Promise<{
579
+ type: string;
580
+ value: string;
581
+ }>;
582
+ navigate(url: string): Promise<void>;
583
+ click(selector: string): Promise<void>;
584
+ screenshot(): Promise<string>;
585
+ getCurrentUrl(): string;
586
+ getConsoleMessages(level?: string, limit?: number): ConsoleMessage[];
587
+ getNetworkRequests(filter?: string, limit?: number): NetworkRequest[];
588
+ getPageErrors(limit?: number): ClientPageError[];
589
+ onPaused(callback: (state: PausedState) => void): void;
590
+ onResumed(callback: () => void): void;
591
+ onAutoResumed(callback: () => void): void;
592
+ private setupCdpEvents;
593
+ private handlePaused;
594
+ private setupPassiveCapture;
595
+ private checkSourceMaps;
596
+ private ensureProbeBuffer;
597
+ private requireSession;
598
+ private requirePage;
599
+ private fileToUrlRegex;
600
+ private clearAutoResumeTimer;
601
+ private resetInactivityTimer;
602
+ private clearInactivityTimer;
603
+ }
604
+
605
+ interface DebugEventHandler {
606
+ onDebugModeEntered: () => void;
607
+ onDebugModeExited: () => void;
608
+ onBreakpointHit: (state: PausedState) => void;
609
+ onClientBreakpointHit: (state: PausedState) => void;
610
+ onAutoResumed: () => void;
611
+ onDebugError: (message: string) => void;
612
+ onOutput: (stream: "stdout" | "stderr", data: string) => void;
613
+ }
614
+ interface DebugModeOptions {
615
+ serverSide?: boolean;
616
+ clientSide?: boolean;
617
+ previewUrl?: string;
618
+ }
619
+ declare class DebugManager {
620
+ private cdpClient;
621
+ private playwrightClient;
622
+ private debugProcess;
623
+ private _isDebugMode;
624
+ private _isClientDebugMode;
625
+ private startCommand;
626
+ private workingDir;
627
+ private eventHandler;
628
+ private breakpointHitQueue;
629
+ private clientBreakpointHitQueue;
630
+ constructor(startCommand: string, workingDir: string, eventHandler: DebugEventHandler);
631
+ isDebugMode(): boolean;
632
+ isClientDebugMode(): boolean;
633
+ getClient(): CdpDebugClient | null;
634
+ getPlaywrightClient(): PlaywrightDebugClient | null;
635
+ drainBreakpointHitQueue(): PausedState[];
636
+ drainClientBreakpointHitQueue(): PausedState[];
637
+ enterDebugMode(killCurrentProcess?: () => void, options?: DebugModeOptions): Promise<void>;
638
+ exitDebugMode(restartNormalServer?: () => void): Promise<void>;
639
+ private activateServerDebug;
640
+ private activateClientDebug;
641
+ private ensurePlaywrightInstalled;
642
+ private startWithInspector;
643
+ }
644
+
645
+ /**
646
+ * Orchestrates the debug session lifecycle, tracks state for the web UI,
647
+ * and generates session summaries. Wraps DebugManager events and forwards
648
+ * state changes to the API via ConveyorConnection.
649
+ */
650
+ declare class DebugLifecycleManager {
651
+ private connection;
652
+ private debugManager;
653
+ private hypothesis?;
654
+ private sessionStartedAt?;
655
+ private breakpointsHitCount;
656
+ private telemetryEvents;
657
+ private reproduceRequested;
658
+ private keyFindings;
659
+ private _isActive;
660
+ constructor(connection: ConveyorConnection);
661
+ get isActive(): boolean;
662
+ setDebugManager(manager: DebugManager): void;
663
+ /**
664
+ * Creates a DebugEventHandler that bridges DebugManager events
665
+ * to the lifecycle manager and broadcasts state to the web UI.
666
+ */
667
+ createEventHandler(baseOnOutput: (stream: "stdout" | "stderr", data: string) => void): DebugEventHandler;
668
+ /** Mark the hypothesis for the current debug session */
669
+ setHypothesis(hypothesis: string): void;
670
+ /** Signal that the user has been asked to reproduce the bug */
671
+ requestReproduce(hypothesis?: string): void;
672
+ /** Add a telemetry event to the debug session */
673
+ addTelemetryEvent(event: DebugTelemetryEvent): void;
674
+ /** Generate and broadcast a debug session summary, then reset state */
675
+ completeSession(): DebugSessionSummary | null;
676
+ /** Auto-exit cleanup — called when agent session ends */
677
+ autoCleanup(): void;
678
+ private getBreakpoints;
679
+ private getProbes;
680
+ private buildState;
681
+ private broadcastState;
682
+ }
683
+
684
+ export { type AgentContext, AgentRunner, type AgentRunnerCallbacks, type AgentRunnerConfig, type BreakpointInfo, type CallFrameInfo, CdpDebugClient, type ChatHistoryMessage, type ConveyorConfig, ConveyorConnection, type DebugEventHandler, DebugLifecycleManager, DebugManager, FileCache, type IncomingChatMessage, type PausedState, ProjectConnection, type ProjectConnectionConfig, ProjectRunner, type ProjectRunnerConfig, type ScopeVariable, type TaskAssignment, ensureWorktree, loadConveyorConfig, removeWorktree, runSetupCommand, runStartCommand };