@claude-flow/plugin-gastown-bridge 0.1.3 → 0.1.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.
Files changed (60) hide show
  1. package/dist/bd-bridge-C9wTbkhi.d.cts +318 -0
  2. package/dist/bd-bridge-C9wTbkhi.d.ts +318 -0
  3. package/dist/bridges.cjs +1 -1
  4. package/dist/bridges.d.cts +13 -612
  5. package/dist/bridges.d.ts +13 -612
  6. package/dist/bridges.js +1 -1
  7. package/dist/chunk-2KNTWGUX.js +12 -0
  8. package/dist/chunk-2KNTWGUX.js.map +1 -0
  9. package/dist/chunk-46PJFOMY.cjs +11 -0
  10. package/dist/chunk-46PJFOMY.cjs.map +1 -0
  11. package/dist/chunk-7UPWLRZX.js +11 -0
  12. package/dist/chunk-7UPWLRZX.js.map +1 -0
  13. package/dist/chunk-7VD5N6NG.cjs +11 -0
  14. package/dist/chunk-7VD5N6NG.cjs.map +1 -0
  15. package/dist/chunk-EBOVUTYL.js +12 -0
  16. package/dist/chunk-EBOVUTYL.js.map +1 -0
  17. package/dist/chunk-I2TLUPMJ.cjs +12 -0
  18. package/dist/chunk-I2TLUPMJ.cjs.map +1 -0
  19. package/dist/chunk-Q7MLH722.cjs +11 -0
  20. package/dist/chunk-Q7MLH722.cjs.map +1 -0
  21. package/dist/chunk-QFMFM7NE.cjs +13 -0
  22. package/dist/chunk-QFMFM7NE.cjs.map +1 -0
  23. package/dist/chunk-SUKPSMVK.cjs +12 -0
  24. package/dist/chunk-SUKPSMVK.cjs.map +1 -0
  25. package/dist/chunk-TGFYZY3C.js +11 -0
  26. package/dist/chunk-TGFYZY3C.js.map +1 -0
  27. package/dist/chunk-U74VYTRV.js +11 -0
  28. package/dist/chunk-U74VYTRV.js.map +1 -0
  29. package/dist/chunk-UJ56JMNG.js +13 -0
  30. package/dist/chunk-UJ56JMNG.js.map +1 -0
  31. package/dist/convoy.cjs +2 -0
  32. package/dist/convoy.cjs.map +1 -0
  33. package/dist/convoy.d.cts +6 -0
  34. package/dist/convoy.d.ts +6 -0
  35. package/dist/convoy.js +2 -0
  36. package/dist/convoy.js.map +1 -0
  37. package/dist/formula.cjs +2 -0
  38. package/dist/formula.cjs.map +1 -0
  39. package/dist/formula.d.cts +317 -0
  40. package/dist/formula.d.ts +317 -0
  41. package/dist/formula.js +2 -0
  42. package/dist/formula.js.map +1 -0
  43. package/dist/gt-bridge-B7hZz5vC.d.cts +291 -0
  44. package/dist/gt-bridge-B7hZz5vC.d.ts +291 -0
  45. package/dist/index-BzkAx4ho.d.ts +785 -0
  46. package/dist/index-CGJs8eMa.d.cts +785 -0
  47. package/dist/index.cjs +8 -9
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.cts +17 -2241
  50. package/dist/index.d.ts +17 -2241
  51. package/dist/index.js +8 -9
  52. package/dist/index.js.map +1 -1
  53. package/dist/types-CMoOZXrm.d.cts +1146 -0
  54. package/dist/types-CMoOZXrm.d.ts +1146 -0
  55. package/dist/wasm-loader.js +1 -1
  56. package/package.json +16 -18
  57. package/dist/chunk-IBKUMYUL.js +0 -14
  58. package/dist/chunk-IBKUMYUL.js.map +0 -1
  59. package/dist/chunk-JF2GA7QE.cjs +0 -14
  60. package/dist/chunk-JF2GA7QE.cjs.map +0 -1
@@ -0,0 +1,785 @@
1
+ import { EventEmitter } from 'events';
2
+ import { c as ConvoyStatus, s as ConvoyProgress, C as Convoy } from './types-CMoOZXrm.js';
3
+ import { B as BdBridge } from './bd-bridge-C9wTbkhi.js';
4
+
5
+ /**
6
+ * Convoy Tracker
7
+ *
8
+ * Manages convoy lifecycle including creation, modification, progress
9
+ * tracking, and completion. Convoys are work-order groups that track
10
+ * related beads (issues) through their lifecycle.
11
+ *
12
+ * Features:
13
+ * - Create and manage convoy groups
14
+ * - Add/remove beads to convoys
15
+ * - Track progress and status changes
16
+ * - Event emission for status transitions
17
+ * - Integration with bd-bridge for bead operations
18
+ *
19
+ * @module gastown-bridge/convoy/tracker
20
+ */
21
+
22
+ /**
23
+ * Convoy event types
24
+ */
25
+ type ConvoyEventType = 'convoy:created' | 'convoy:started' | 'convoy:progressed' | 'convoy:completed' | 'convoy:cancelled' | 'convoy:paused' | 'convoy:resumed' | 'convoy:issue:added' | 'convoy:issue:removed' | 'convoy:issue:updated';
26
+ /**
27
+ * Convoy event payload
28
+ */
29
+ interface ConvoyEvent {
30
+ /** Event type */
31
+ type: ConvoyEventType;
32
+ /** Convoy ID */
33
+ convoyId: string;
34
+ /** Convoy name */
35
+ convoyName: string;
36
+ /** Event timestamp */
37
+ timestamp: Date;
38
+ /** Previous status (for status change events) */
39
+ previousStatus?: ConvoyStatus;
40
+ /** Current status */
41
+ status: ConvoyStatus;
42
+ /** Progress at time of event */
43
+ progress: ConvoyProgress;
44
+ /** Issue IDs affected (for issue events) */
45
+ issues?: string[];
46
+ /** Cancellation reason (for cancelled events) */
47
+ reason?: string;
48
+ /** Additional metadata */
49
+ metadata?: Record<string, unknown>;
50
+ }
51
+ /**
52
+ * Convoy tracker configuration
53
+ */
54
+ interface ConvoyTrackerConfig {
55
+ /** BD bridge instance for bead operations */
56
+ bdBridge: BdBridge;
57
+ /** Auto-update progress on issue changes */
58
+ autoUpdateProgress?: boolean;
59
+ /** Progress update interval in milliseconds */
60
+ progressUpdateInterval?: number;
61
+ /** Enable persistent storage */
62
+ persistConvoys?: boolean;
63
+ /** Storage path for convoy data */
64
+ storagePath?: string;
65
+ }
66
+ /**
67
+ * Logger interface
68
+ */
69
+ interface ConvoyLogger {
70
+ debug: (msg: string, meta?: Record<string, unknown>) => void;
71
+ info: (msg: string, meta?: Record<string, unknown>) => void;
72
+ warn: (msg: string, meta?: Record<string, unknown>) => void;
73
+ error: (msg: string, meta?: Record<string, unknown>) => void;
74
+ }
75
+ /**
76
+ * Convoy Tracker
77
+ *
78
+ * Manages convoy lifecycle and tracks progress of grouped work.
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * const tracker = new ConvoyTracker({
83
+ * bdBridge: await createBdBridge().initialize(),
84
+ * });
85
+ *
86
+ * // Create a convoy
87
+ * const convoy = await tracker.create(
88
+ * 'Sprint 1',
89
+ * ['gt-abc12', 'gt-def34', 'gt-ghi56'],
90
+ * 'First sprint tasks'
91
+ * );
92
+ *
93
+ * // Monitor progress
94
+ * tracker.on('convoy:progressed', (event) => {
95
+ * console.log(`Progress: ${event.progress.closed}/${event.progress.total}`);
96
+ * });
97
+ *
98
+ * // Check status
99
+ * const status = await tracker.getStatus(convoy.id);
100
+ * ```
101
+ */
102
+ declare class ConvoyTracker extends EventEmitter {
103
+ private bdBridge;
104
+ private convoys;
105
+ private logger;
106
+ private config;
107
+ private progressTimers;
108
+ constructor(config: ConvoyTrackerConfig, logger?: ConvoyLogger);
109
+ /**
110
+ * Create a new convoy
111
+ *
112
+ * @param name - Convoy name
113
+ * @param issues - Issue IDs to include
114
+ * @param description - Optional description
115
+ * @returns Created convoy
116
+ */
117
+ create(name: string, issues: string[], description?: string): Promise<Convoy>;
118
+ /**
119
+ * Add issues to an existing convoy
120
+ *
121
+ * @param convoyId - Convoy ID
122
+ * @param issues - Issue IDs to add
123
+ * @returns Updated convoy
124
+ */
125
+ addIssues(convoyId: string, issues: string[]): Promise<Convoy>;
126
+ /**
127
+ * Remove issues from a convoy
128
+ *
129
+ * @param convoyId - Convoy ID
130
+ * @param issues - Issue IDs to remove
131
+ * @returns Updated convoy
132
+ */
133
+ removeIssues(convoyId: string, issues: string[]): Promise<Convoy>;
134
+ /**
135
+ * Get convoy status
136
+ *
137
+ * @param convoyId - Convoy ID
138
+ * @returns Convoy with updated progress
139
+ */
140
+ getStatus(convoyId: string): Promise<Convoy>;
141
+ /**
142
+ * Mark convoy as complete
143
+ *
144
+ * @param convoyId - Convoy ID
145
+ * @returns Completed convoy
146
+ */
147
+ complete(convoyId: string): Promise<Convoy>;
148
+ /**
149
+ * Cancel a convoy
150
+ *
151
+ * @param convoyId - Convoy ID
152
+ * @param reason - Cancellation reason
153
+ * @returns Cancelled convoy
154
+ */
155
+ cancel(convoyId: string, reason?: string): Promise<Convoy>;
156
+ /**
157
+ * Pause a convoy
158
+ *
159
+ * @param convoyId - Convoy ID
160
+ * @returns Paused convoy
161
+ */
162
+ pause(convoyId: string): Promise<Convoy>;
163
+ /**
164
+ * Resume a paused convoy
165
+ *
166
+ * @param convoyId - Convoy ID
167
+ * @returns Resumed convoy
168
+ */
169
+ resume(convoyId: string): Promise<Convoy>;
170
+ /**
171
+ * List all convoys
172
+ *
173
+ * @param status - Optional status filter
174
+ * @returns Array of convoys
175
+ */
176
+ listConvoys(status?: ConvoyStatus): Convoy[];
177
+ /**
178
+ * Get convoy by ID
179
+ *
180
+ * @param convoyId - Convoy ID
181
+ * @returns Convoy or undefined
182
+ */
183
+ getConvoy(convoyId: string): Convoy | undefined;
184
+ /**
185
+ * Delete a convoy
186
+ *
187
+ * @param convoyId - Convoy ID
188
+ * @returns True if deleted
189
+ */
190
+ deleteConvoy(convoyId: string): boolean;
191
+ /**
192
+ * Calculate progress for a set of issues
193
+ */
194
+ private calculateProgress;
195
+ /**
196
+ * Verify issues exist
197
+ */
198
+ private verifyIssues;
199
+ /**
200
+ * Fetch beads by IDs
201
+ */
202
+ private fetchBeads;
203
+ /**
204
+ * Map CLI bead type to Gas Town status
205
+ */
206
+ private mapBeadStatus;
207
+ /**
208
+ * Start progress tracking timer
209
+ */
210
+ private startProgressTracking;
211
+ /**
212
+ * Stop progress tracking timer
213
+ */
214
+ private stopProgressTracking;
215
+ /**
216
+ * Emit convoy event
217
+ */
218
+ private emitConvoyEvent;
219
+ /**
220
+ * Clean up resources
221
+ */
222
+ dispose(): void;
223
+ }
224
+ /**
225
+ * Create a new convoy tracker instance
226
+ */
227
+ declare function createConvoyTracker(config: ConvoyTrackerConfig, logger?: ConvoyLogger): ConvoyTracker;
228
+
229
+ /**
230
+ * Lazy Loading Utilities for Gas Town Bridge Plugin
231
+ *
232
+ * Provides lazy initialization patterns to defer resource loading
233
+ * until first use, reducing initial memory footprint and startup time.
234
+ *
235
+ * Features:
236
+ * - Lazy WASM module loading
237
+ * - Deferred convoy observer initialization
238
+ * - Lazy bridge initialization
239
+ * - Resource cleanup on idle
240
+ *
241
+ * @module gastown-bridge/memory/lazy
242
+ */
243
+ /**
244
+ * Lazy value state
245
+ */
246
+ type LazyState = 'uninitialized' | 'initializing' | 'initialized' | 'error' | 'disposed';
247
+ /**
248
+ * Lazy initialization options
249
+ */
250
+ interface LazyOptions<T> {
251
+ /** Factory function to create the value */
252
+ factory: () => T | Promise<T>;
253
+ /** Optional cleanup function */
254
+ cleanup?: (value: T) => void | Promise<void>;
255
+ /** Auto-dispose after idle time (ms, 0 = never) */
256
+ idleTimeout?: number;
257
+ /** Error handler */
258
+ onError?: (error: Error) => void;
259
+ /** Name for debugging */
260
+ name?: string;
261
+ }
262
+ /**
263
+ * Lazy loader statistics
264
+ */
265
+ interface LazyStats {
266
+ name: string;
267
+ state: LazyState;
268
+ initCount: number;
269
+ disposeCount: number;
270
+ errorCount: number;
271
+ lastInitTime?: Date;
272
+ lastAccessTime?: Date;
273
+ initDurationMs?: number;
274
+ }
275
+ /**
276
+ * Lazy value wrapper with automatic initialization
277
+ *
278
+ * @example
279
+ * ```typescript
280
+ * const lazyWasm = new Lazy({
281
+ * name: 'wasm-module',
282
+ * factory: async () => await loadWasmModule(),
283
+ * cleanup: (wasm) => wasm.dispose(),
284
+ * idleTimeout: 60000, // Auto-dispose after 1 minute of inactivity
285
+ * });
286
+ *
287
+ * // First access triggers initialization
288
+ * const wasm = await lazyWasm.get();
289
+ *
290
+ * // Check if initialized without triggering
291
+ * if (lazyWasm.isInitialized()) { ... }
292
+ *
293
+ * // Manual disposal
294
+ * await lazyWasm.dispose();
295
+ * ```
296
+ */
297
+ declare class Lazy<T> {
298
+ private value?;
299
+ private state;
300
+ private initPromise?;
301
+ private idleTimer?;
302
+ private options;
303
+ private stats;
304
+ constructor(options: LazyOptions<T>);
305
+ /**
306
+ * Get the lazy value, initializing if necessary
307
+ */
308
+ get(): Promise<T>;
309
+ /**
310
+ * Get synchronously (throws if not initialized)
311
+ */
312
+ getSync(): T;
313
+ /**
314
+ * Check if initialized
315
+ */
316
+ isInitialized(): boolean;
317
+ /**
318
+ * Get current state
319
+ */
320
+ getState(): LazyState;
321
+ /**
322
+ * Initialize without returning value
323
+ */
324
+ initialize(): Promise<T>;
325
+ /**
326
+ * Dispose the lazy value
327
+ */
328
+ dispose(): Promise<void>;
329
+ /**
330
+ * Get statistics
331
+ */
332
+ getStats(): Readonly<LazyStats>;
333
+ private resetIdleTimer;
334
+ private clearIdleTimer;
335
+ }
336
+ /**
337
+ * Get or create a lazy singleton
338
+ */
339
+ declare function getLazySingleton<T>(key: string, options: LazyOptions<T>): Lazy<T>;
340
+ /**
341
+ * Dispose a lazy singleton
342
+ */
343
+ declare function disposeLazySingleton(key: string): Promise<void>;
344
+ /**
345
+ * Dispose all lazy singletons
346
+ */
347
+ declare function disposeAllLazySingletons(): Promise<void>;
348
+ /**
349
+ * Lazy module loader for dynamic imports
350
+ *
351
+ * @example
352
+ * ```typescript
353
+ * const wasmLoader = new LazyModule(() => import('./wasm-loader.js'));
354
+ * const { parseFormula } = await wasmLoader.get();
355
+ * ```
356
+ */
357
+ declare class LazyModule<T> {
358
+ private lazy;
359
+ constructor(importer: () => Promise<T>, options?: Omit<LazyOptions<T>, 'factory'>);
360
+ /**
361
+ * Get the module
362
+ */
363
+ get(): Promise<T>;
364
+ /**
365
+ * Check if loaded
366
+ */
367
+ isLoaded(): boolean;
368
+ /**
369
+ * Dispose module
370
+ */
371
+ dispose(): Promise<void>;
372
+ }
373
+ /**
374
+ * Lazy bridge wrapper for Gas Town bridges
375
+ *
376
+ * Defers bridge initialization until first use.
377
+ */
378
+ declare class LazyBridge<T extends {
379
+ initialize?: () => Promise<void>;
380
+ }> {
381
+ private lazy;
382
+ constructor(factory: () => T | Promise<T>, options?: Omit<LazyOptions<T>, 'factory'>);
383
+ /**
384
+ * Get the bridge
385
+ */
386
+ get(): Promise<T>;
387
+ /**
388
+ * Check if initialized
389
+ */
390
+ isInitialized(): boolean;
391
+ /**
392
+ * Dispose bridge
393
+ */
394
+ dispose(): Promise<void>;
395
+ /**
396
+ * Get stats
397
+ */
398
+ getStats(): LazyStats;
399
+ }
400
+ /**
401
+ * Lazy WASM module loader with caching
402
+ */
403
+ declare class LazyWasm<T> {
404
+ private lazy;
405
+ private cached;
406
+ constructor(loader: () => Promise<T>, options?: {
407
+ name?: string;
408
+ idleTimeout?: number;
409
+ onError?: (error: Error) => void;
410
+ });
411
+ /**
412
+ * Get the WASM module
413
+ */
414
+ get(): Promise<T>;
415
+ /**
416
+ * Check if loaded
417
+ */
418
+ isLoaded(): boolean;
419
+ /**
420
+ * Clear cache (module will be reloaded on next access)
421
+ */
422
+ clearCache(): void;
423
+ /**
424
+ * Get stats
425
+ */
426
+ getStats(): LazyStats;
427
+ }
428
+ /**
429
+ * Lazy observer pattern for convoy watching
430
+ *
431
+ * Defers observer creation until first watch request.
432
+ */
433
+ declare class LazyObserver<T> {
434
+ private lazy;
435
+ private watchCount;
436
+ constructor(factory: () => T | Promise<T>, options?: Omit<LazyOptions<T>, 'factory'>);
437
+ /**
438
+ * Start watching (initializes observer if needed)
439
+ */
440
+ watch(): Promise<T>;
441
+ /**
442
+ * Stop watching (disposes observer if no more watchers)
443
+ */
444
+ unwatch(): Promise<void>;
445
+ /**
446
+ * Get current watch count
447
+ */
448
+ getWatchCount(): number;
449
+ /**
450
+ * Check if active
451
+ */
452
+ isActive(): boolean;
453
+ /**
454
+ * Force dispose
455
+ */
456
+ dispose(): Promise<void>;
457
+ }
458
+ /**
459
+ * Create a lazy property getter
460
+ */
461
+ declare function createLazyProperty<T>(factory: () => T | Promise<T>, options?: Omit<LazyOptions<T>, 'factory'>): {
462
+ get: () => Promise<T>;
463
+ isInitialized: () => boolean;
464
+ };
465
+
466
+ /**
467
+ * Convoy Observer
468
+ *
469
+ * Monitors convoy completion by observing issue state changes
470
+ * and detecting when all tracked issues are complete. Uses
471
+ * WASM-accelerated graph analysis for dependency resolution.
472
+ *
473
+ * Features:
474
+ * - Watch convoys for completion
475
+ * - Detect blocking issues
476
+ * - Identify ready-to-work issues
477
+ * - WASM-accelerated dependency graph analysis
478
+ * - Configurable polling intervals
479
+ *
480
+ * @module gastown-bridge/convoy/observer
481
+ */
482
+
483
+ /**
484
+ * WASM graph module interface
485
+ */
486
+ interface WasmGraphModule {
487
+ /** Check if dependency graph has cycles */
488
+ has_cycle(beadsJson: string): boolean;
489
+ /** Find nodes participating in cycles */
490
+ find_cycle_nodes(beadsJson: string): string;
491
+ /** Get beads with no unresolved dependencies */
492
+ get_ready_beads(beadsJson: string): string;
493
+ /** Compute execution levels for parallel processing */
494
+ compute_levels(beadsJson: string): string;
495
+ /** Topological sort of beads */
496
+ topo_sort(beadsJson: string): string;
497
+ /** Critical path analysis */
498
+ critical_path(beadsJson: string): string;
499
+ }
500
+ /**
501
+ * Completion callback signature
502
+ */
503
+ type CompletionCallback = (convoy: Convoy, allComplete: boolean) => void;
504
+ /**
505
+ * Observer watch handle
506
+ */
507
+ interface WatchHandle {
508
+ /** Convoy ID being watched */
509
+ convoyId: string;
510
+ /** Stop watching */
511
+ stop(): void;
512
+ /** Check if still watching */
513
+ isActive(): boolean;
514
+ }
515
+ /**
516
+ * Observer configuration
517
+ */
518
+ interface ConvoyObserverConfig {
519
+ /** BD bridge instance */
520
+ bdBridge: BdBridge;
521
+ /** Convoy tracker instance */
522
+ tracker: ConvoyTracker;
523
+ /** Optional WASM graph module */
524
+ wasmModule?: WasmGraphModule;
525
+ /** Initial polling interval in milliseconds */
526
+ pollInterval?: number;
527
+ /** Maximum poll attempts before giving up */
528
+ maxPollAttempts?: number;
529
+ /** Enable WASM acceleration (falls back to JS if unavailable) */
530
+ useWasm?: boolean;
531
+ /** Enable exponential backoff for polling */
532
+ useExponentialBackoff?: boolean;
533
+ /** Maximum backoff interval in milliseconds */
534
+ maxBackoffInterval?: number;
535
+ /** Backoff multiplier (default: 1.5) */
536
+ backoffMultiplier?: number;
537
+ /** Enable delta-based updates (only emit on changes) */
538
+ deltaUpdatesOnly?: boolean;
539
+ /** Debounce interval for progress updates in milliseconds */
540
+ progressDebounceMs?: number;
541
+ }
542
+ /**
543
+ * Blocker information
544
+ */
545
+ interface BlockerInfo {
546
+ /** Issue ID that is blocked */
547
+ blockedIssue: string;
548
+ /** Issue IDs that are blocking */
549
+ blockers: string[];
550
+ /** True if blockers are from within the convoy */
551
+ internalBlockers: boolean;
552
+ }
553
+ /**
554
+ * Ready issue information
555
+ */
556
+ interface ReadyIssueInfo {
557
+ /** Issue ID */
558
+ id: string;
559
+ /** Issue title */
560
+ title: string;
561
+ /** Priority */
562
+ priority: number;
563
+ /** Execution level (for parallel processing) */
564
+ level: number;
565
+ }
566
+ /**
567
+ * Completion check result
568
+ */
569
+ interface CompletionCheckResult {
570
+ /** True if all issues are complete */
571
+ allComplete: boolean;
572
+ /** Progress statistics */
573
+ progress: ConvoyProgress;
574
+ /** Issues that are still open */
575
+ openIssues: string[];
576
+ /** Issues that are in progress */
577
+ inProgressIssues: string[];
578
+ /** Issues that are blocked */
579
+ blockedIssues: BlockerInfo[];
580
+ /** Issues ready to work on */
581
+ readyIssues: ReadyIssueInfo[];
582
+ /** True if there are dependency cycles */
583
+ hasCycles: boolean;
584
+ /** Issues involved in cycles */
585
+ cycleIssues: string[];
586
+ }
587
+ /**
588
+ * Logger interface
589
+ */
590
+ interface ObserverLogger {
591
+ debug: (msg: string, meta?: Record<string, unknown>) => void;
592
+ info: (msg: string, meta?: Record<string, unknown>) => void;
593
+ warn: (msg: string, meta?: Record<string, unknown>) => void;
594
+ error: (msg: string, meta?: Record<string, unknown>) => void;
595
+ }
596
+ /**
597
+ * Convoy Observer
598
+ *
599
+ * Monitors convoys for completion and provides dependency analysis.
600
+ *
601
+ * @example
602
+ * ```typescript
603
+ * const observer = new ConvoyObserver({
604
+ * bdBridge,
605
+ * tracker,
606
+ * pollInterval: 5000,
607
+ * useWasm: true,
608
+ * });
609
+ *
610
+ * // Watch for completion
611
+ * const handle = observer.watch(convoyId, (convoy, complete) => {
612
+ * if (complete) {
613
+ * console.log('Convoy complete!');
614
+ * }
615
+ * });
616
+ *
617
+ * // Check blockers
618
+ * const blockers = await observer.getBlockers(convoyId);
619
+ *
620
+ * // Get ready issues
621
+ * const ready = await observer.getReadyIssues(convoyId);
622
+ *
623
+ * // Stop watching
624
+ * handle.stop();
625
+ * ```
626
+ */
627
+ declare class ConvoyObserver extends EventEmitter {
628
+ private bdBridge;
629
+ private tracker;
630
+ private wasmModule?;
631
+ private logger;
632
+ private config;
633
+ private watchers;
634
+ private readonly beadCache;
635
+ private readonly completionCache;
636
+ private readonly fetchDedup;
637
+ private readonly progressEmitters;
638
+ private pendingSubscriptions;
639
+ private subscriptionFlushTimer;
640
+ constructor(config: ConvoyObserverConfig, logger?: ObserverLogger);
641
+ /**
642
+ * Watch a convoy for completion
643
+ *
644
+ * @param convoyId - Convoy ID to watch
645
+ * @param callback - Called on each check with completion status
646
+ * @returns Watch handle to stop watching
647
+ */
648
+ watch(convoyId: string, callback: CompletionCallback): WatchHandle;
649
+ /**
650
+ * Batch subscribe to multiple convoys
651
+ * Subscriptions are batched and flushed together for efficiency
652
+ *
653
+ * @param convoyId - Convoy ID to watch
654
+ * @param callback - Callback for completion status
655
+ */
656
+ batchSubscribe(convoyId: string, callback: CompletionCallback): void;
657
+ /**
658
+ * Flush pending subscriptions
659
+ */
660
+ private flushSubscriptions;
661
+ /**
662
+ * Check if all issues in a convoy are complete
663
+ *
664
+ * @param convoyId - Convoy ID
665
+ * @returns Completion check result with detailed status
666
+ */
667
+ checkCompletion(convoyId: string): Promise<CompletionCheckResult>;
668
+ /**
669
+ * Get blockers for all issues in a convoy
670
+ *
671
+ * @param convoyId - Convoy ID
672
+ * @returns Array of blocker information
673
+ */
674
+ getBlockers(convoyId: string): Promise<BlockerInfo[]>;
675
+ /**
676
+ * Get issues ready to work on (no unresolved dependencies)
677
+ *
678
+ * @param convoyId - Convoy ID
679
+ * @returns Array of ready issue information
680
+ */
681
+ getReadyIssues(convoyId: string): Promise<ReadyIssueInfo[]>;
682
+ /**
683
+ * Get execution order for convoy issues
684
+ *
685
+ * @param convoyId - Convoy ID
686
+ * @returns Ordered array of issue IDs
687
+ */
688
+ getExecutionOrder(convoyId: string): Promise<string[]>;
689
+ /**
690
+ * Stop watching a convoy
691
+ */
692
+ stopWatching(convoyId: string): void;
693
+ /**
694
+ * Stop all watchers
695
+ */
696
+ stopAll(): void;
697
+ /**
698
+ * Set WASM module
699
+ */
700
+ setWasmModule(module: WasmGraphModule): void;
701
+ /**
702
+ * Check if WASM is available
703
+ */
704
+ isWasmAvailable(): boolean;
705
+ /**
706
+ * Poll convoy for completion with exponential backoff
707
+ */
708
+ private pollConvoyWithBackoff;
709
+ /**
710
+ * Legacy poll convoy method (without backoff)
711
+ * @deprecated Use pollConvoyWithBackoff instead
712
+ */
713
+ private pollConvoy;
714
+ /**
715
+ * Fetch beads by IDs with caching, batch deduplication, and object pooling.
716
+ * Uses PooledBead from memory module for reduced allocations.
717
+ */
718
+ private fetchBeads;
719
+ /**
720
+ * Map CLI bead type to Gas Town status
721
+ */
722
+ private mapBeadStatus;
723
+ /**
724
+ * Convert beads to WASM node format
725
+ */
726
+ private beadsToWasmNodes;
727
+ /**
728
+ * Analyze dependencies with WASM
729
+ */
730
+ private analyzeWithWasm;
731
+ /**
732
+ * Analyze dependencies with JavaScript (fallback)
733
+ */
734
+ private analyzeWithJS;
735
+ /**
736
+ * Detect cycles using DFS (JavaScript)
737
+ */
738
+ private detectCyclesJS;
739
+ /**
740
+ * Find nodes in cycles (JavaScript)
741
+ */
742
+ private findCycleNodesJS;
743
+ /**
744
+ * Topological sort using Kahn's algorithm (JavaScript)
745
+ */
746
+ private topoSortJS;
747
+ /**
748
+ * Clean up resources
749
+ */
750
+ dispose(): void;
751
+ }
752
+ /**
753
+ * Create a new convoy observer instance
754
+ */
755
+ declare function createConvoyObserver(config: ConvoyObserverConfig, logger?: ObserverLogger): ConvoyObserver;
756
+ /**
757
+ * Create a lazy-initialized convoy observer.
758
+ * The observer is only created when first accessed (via watch() or checkCompletion()).
759
+ * Useful for deferring initialization until convoy monitoring is actually needed.
760
+ *
761
+ * @example
762
+ * ```typescript
763
+ * const lazyObserver = createLazyConvoyObserver(config);
764
+ *
765
+ * // Observer is NOT created yet
766
+ * console.log(lazyObserver.getWatchCount()); // 0
767
+ *
768
+ * // First watch triggers observer creation
769
+ * const observer = await lazyObserver.watch();
770
+ * const handle = observer.watch(convoyId, callback);
771
+ *
772
+ * // When done, unwatch to potentially dispose
773
+ * await lazyObserver.unwatch();
774
+ * ```
775
+ */
776
+ declare function createLazyConvoyObserver(config: ConvoyObserverConfig, logger?: ObserverLogger): LazyObserver<ConvoyObserver>;
777
+ /**
778
+ * Get lazy observer statistics
779
+ */
780
+ declare function getLazyObserverStats(lazyObserver: LazyObserver<ConvoyObserver>): {
781
+ isActive: boolean;
782
+ watchCount: number;
783
+ };
784
+
785
+ export { type BlockerInfo as B, ConvoyTracker as C, type LazyStats as L, type ObserverLogger as O, type ReadyIssueInfo as R, type WasmGraphModule as W, ConvoyObserver as a, type CompletionCallback as b, type CompletionCheckResult as c, type ConvoyEvent as d, type ConvoyEventType as e, type ConvoyLogger as f, type ConvoyObserverConfig as g, type ConvoyTrackerConfig as h, Lazy as i, LazyBridge as j, LazyModule as k, LazyObserver as l, type LazyOptions as m, type LazyState as n, LazyWasm as o, type WatchHandle as p, createConvoyObserver as q, createConvoyTracker as r, createLazyConvoyObserver as s, createLazyProperty as t, disposeAllLazySingletons as u, disposeLazySingleton as v, getLazyObserverStats as w, getLazySingleton as x };