opencode-supertask 0.1.19 → 0.1.21

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.
@@ -1,17 +1,19 @@
1
1
  interface GatewayConfig {
2
+ configVersion: 2;
2
3
  worker: {
3
4
  maxConcurrency: number;
4
5
  pollIntervalMs: number;
5
6
  heartbeatIntervalMs: number;
6
7
  taskTimeoutMs: number;
8
+ shutdownGracePeriodMs: number;
7
9
  };
8
10
  scheduler: {
9
11
  enabled: boolean;
10
12
  checkIntervalMs: number;
11
- catchUp: 'next' | 'all' | 'latest';
12
13
  };
13
14
  watchdog: {
14
15
  heartbeatTimeoutMs: number;
16
+ checkIntervalMs: number;
15
17
  cleanupIntervalMs: number;
16
18
  retentionDays: number;
17
19
  };
@@ -19,29 +21,39 @@ interface GatewayConfig {
19
21
  enabled: boolean;
20
22
  port: number;
21
23
  };
22
- logging: {
23
- level: string;
24
- format: 'json' | 'text';
25
- };
26
24
  }
27
25
 
26
+ interface WorkerEngineOptions {
27
+ opencodeBin?: string;
28
+ maxOutputChars?: number;
29
+ }
28
30
  declare class WorkerEngine {
29
31
  private activeBatchIds;
30
32
  private runningTasks;
31
33
  private stopped;
32
34
  private pollTimer;
33
35
  private heartbeatTimer;
36
+ private pollCyclePromise;
34
37
  private cfg;
35
- constructor(cfg: GatewayConfig);
38
+ private opencodeBin;
39
+ private maxOutputChars;
40
+ constructor(cfg: GatewayConfig, options?: WorkerEngineOptions);
36
41
  start(): void;
37
- stop(): Promise<void>;
42
+ stop(gracePeriodMs?: number): Promise<number[]>;
38
43
  getRunningTaskIds(): number[];
39
44
  getRunningCount(): number;
40
45
  private poll;
41
46
  private tryDispatch;
47
+ private spawnTask;
48
+ private finishEntry;
49
+ private reconcileCancelledTasks;
50
+ private cancelEntry;
42
51
  private updateHeartbeats;
43
52
  private killEntry;
53
+ private signalEntry;
54
+ private releaseBatch;
44
55
  private resolveModel;
56
+ private logError;
45
57
  }
46
58
 
47
59
  export { WorkerEngine };