@ginkoai/cli 1.6.2 → 1.7.1
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/commands/agent/agent-client.d.ts +150 -0
- package/dist/commands/agent/agent-client.d.ts.map +1 -0
- package/dist/commands/agent/agent-client.js +170 -0
- package/dist/commands/agent/agent-client.js.map +1 -0
- package/dist/commands/agent/index.d.ts +22 -0
- package/dist/commands/agent/index.d.ts.map +1 -0
- package/dist/commands/agent/index.js +121 -0
- package/dist/commands/agent/index.js.map +1 -0
- package/dist/commands/agent/list.d.ts +22 -0
- package/dist/commands/agent/list.d.ts.map +1 -0
- package/dist/commands/agent/list.js +119 -0
- package/dist/commands/agent/list.js.map +1 -0
- package/dist/commands/agent/register.d.ts +21 -0
- package/dist/commands/agent/register.d.ts.map +1 -0
- package/dist/commands/agent/register.js +97 -0
- package/dist/commands/agent/register.js.map +1 -0
- package/dist/commands/agent/status.d.ts +19 -0
- package/dist/commands/agent/status.d.ts.map +1 -0
- package/dist/commands/agent/status.js +271 -0
- package/dist/commands/agent/status.js.map +1 -0
- package/dist/commands/agent/work.d.ts +22 -0
- package/dist/commands/agent/work.d.ts.map +1 -0
- package/dist/commands/agent/work.js +459 -0
- package/dist/commands/agent/work.js.map +1 -0
- package/dist/commands/checkpoint/create.d.ts +27 -0
- package/dist/commands/checkpoint/create.d.ts.map +1 -0
- package/dist/commands/checkpoint/create.js +82 -0
- package/dist/commands/checkpoint/create.js.map +1 -0
- package/dist/commands/checkpoint/index.d.ts +23 -0
- package/dist/commands/checkpoint/index.d.ts.map +1 -0
- package/dist/commands/checkpoint/index.js +91 -0
- package/dist/commands/checkpoint/index.js.map +1 -0
- package/dist/commands/checkpoint/list.d.ts +27 -0
- package/dist/commands/checkpoint/list.d.ts.map +1 -0
- package/dist/commands/checkpoint/list.js +115 -0
- package/dist/commands/checkpoint/list.js.map +1 -0
- package/dist/commands/checkpoint/show.d.ts +23 -0
- package/dist/commands/checkpoint/show.d.ts.map +1 -0
- package/dist/commands/checkpoint/show.js +102 -0
- package/dist/commands/checkpoint/show.js.map +1 -0
- package/dist/commands/dlq.d.ts +24 -0
- package/dist/commands/dlq.d.ts.map +1 -0
- package/dist/commands/dlq.js +172 -0
- package/dist/commands/dlq.js.map +1 -0
- package/dist/commands/escalation/create.d.ts +22 -0
- package/dist/commands/escalation/create.d.ts.map +1 -0
- package/dist/commands/escalation/create.js +122 -0
- package/dist/commands/escalation/create.js.map +1 -0
- package/dist/commands/escalation/escalation-client.d.ts +101 -0
- package/dist/commands/escalation/escalation-client.d.ts.map +1 -0
- package/dist/commands/escalation/escalation-client.js +129 -0
- package/dist/commands/escalation/escalation-client.js.map +1 -0
- package/dist/commands/escalation/index.d.ts +22 -0
- package/dist/commands/escalation/index.d.ts.map +1 -0
- package/dist/commands/escalation/index.js +94 -0
- package/dist/commands/escalation/index.js.map +1 -0
- package/dist/commands/escalation/list.d.ts +24 -0
- package/dist/commands/escalation/list.d.ts.map +1 -0
- package/dist/commands/escalation/list.js +170 -0
- package/dist/commands/escalation/list.js.map +1 -0
- package/dist/commands/escalation/resolve.d.ts +20 -0
- package/dist/commands/escalation/resolve.d.ts.map +1 -0
- package/dist/commands/escalation/resolve.js +102 -0
- package/dist/commands/escalation/resolve.js.map +1 -0
- package/dist/commands/graph/api-client.d.ts +21 -1
- package/dist/commands/graph/api-client.d.ts.map +1 -1
- package/dist/commands/graph/api-client.js +23 -0
- package/dist/commands/graph/api-client.js.map +1 -1
- package/dist/commands/handoff.d.ts.map +1 -1
- package/dist/commands/handoff.js +9 -1
- package/dist/commands/handoff.js.map +1 -1
- package/dist/commands/log.d.ts +3 -0
- package/dist/commands/log.d.ts.map +1 -1
- package/dist/commands/log.js +73 -14
- package/dist/commands/log.js.map +1 -1
- package/dist/commands/notifications/history.d.ts +21 -0
- package/dist/commands/notifications/history.d.ts.map +1 -0
- package/dist/commands/notifications/history.js +160 -0
- package/dist/commands/notifications/history.js.map +1 -0
- package/dist/commands/notifications/index.d.ts +22 -0
- package/dist/commands/notifications/index.d.ts.map +1 -0
- package/dist/commands/notifications/index.js +87 -0
- package/dist/commands/notifications/index.js.map +1 -0
- package/dist/commands/notifications/list.d.ts +19 -0
- package/dist/commands/notifications/list.d.ts.map +1 -0
- package/dist/commands/notifications/list.js +132 -0
- package/dist/commands/notifications/list.js.map +1 -0
- package/dist/commands/notifications/test.d.ts +19 -0
- package/dist/commands/notifications/test.d.ts.map +1 -0
- package/dist/commands/notifications/test.js +217 -0
- package/dist/commands/notifications/test.js.map +1 -0
- package/dist/commands/orchestrate.d.ts +25 -0
- package/dist/commands/orchestrate.d.ts.map +1 -0
- package/dist/commands/orchestrate.js +858 -0
- package/dist/commands/orchestrate.js.map +1 -0
- package/dist/commands/sprint/deps.d.ts +29 -0
- package/dist/commands/sprint/deps.d.ts.map +1 -0
- package/dist/commands/sprint/deps.js +269 -0
- package/dist/commands/sprint/deps.js.map +1 -0
- package/dist/commands/sprint/index.d.ts +10 -5
- package/dist/commands/sprint/index.d.ts.map +1 -1
- package/dist/commands/sprint/index.js +26 -5
- package/dist/commands/sprint/index.js.map +1 -1
- package/dist/commands/start/index.d.ts.map +1 -1
- package/dist/commands/start/index.js +6 -0
- package/dist/commands/start/index.js.map +1 -1
- package/dist/commands/start/start-reflection.d.ts.map +1 -1
- package/dist/commands/start/start-reflection.js +8 -0
- package/dist/commands/start/start-reflection.js.map +1 -1
- package/dist/commands/verify.d.ts +17 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +232 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/core/session-log-manager.d.ts +1 -1
- package/dist/core/session-log-manager.d.ts.map +1 -1
- package/dist/index.js +78 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/__tests__/task-timeout.test.d.ts +12 -0
- package/dist/lib/__tests__/task-timeout.test.d.ts.map +1 -0
- package/dist/lib/__tests__/task-timeout.test.js +278 -0
- package/dist/lib/__tests__/task-timeout.test.js.map +1 -0
- package/dist/lib/agent-heartbeat.d.ts +68 -0
- package/dist/lib/agent-heartbeat.d.ts.map +1 -0
- package/dist/lib/agent-heartbeat.js +117 -0
- package/dist/lib/agent-heartbeat.js.map +1 -0
- package/dist/lib/checkpoint.d.ts +85 -0
- package/dist/lib/checkpoint.d.ts.map +1 -0
- package/dist/lib/checkpoint.js +323 -0
- package/dist/lib/checkpoint.js.map +1 -0
- package/dist/lib/context-metrics.d.ts +230 -0
- package/dist/lib/context-metrics.d.ts.map +1 -0
- package/dist/lib/context-metrics.js +372 -0
- package/dist/lib/context-metrics.js.map +1 -0
- package/dist/lib/dead-letter-queue.d.ts +108 -0
- package/dist/lib/dead-letter-queue.d.ts.map +1 -0
- package/dist/lib/dead-letter-queue.js +378 -0
- package/dist/lib/dead-letter-queue.js.map +1 -0
- package/dist/lib/event-logger.d.ts +9 -1
- package/dist/lib/event-logger.d.ts.map +1 -1
- package/dist/lib/event-logger.js +45 -3
- package/dist/lib/event-logger.js.map +1 -1
- package/dist/lib/event-queue.d.ts.map +1 -1
- package/dist/lib/event-queue.js +13 -2
- package/dist/lib/event-queue.js.map +1 -1
- package/dist/lib/examples/timeout-demo.d.ts +13 -0
- package/dist/lib/examples/timeout-demo.d.ts.map +1 -0
- package/dist/lib/examples/timeout-demo.js +102 -0
- package/dist/lib/examples/timeout-demo.js.map +1 -0
- package/dist/lib/examples/timeout-integration-example.d.ts +17 -0
- package/dist/lib/examples/timeout-integration-example.d.ts.map +1 -0
- package/dist/lib/examples/timeout-integration-example.js +223 -0
- package/dist/lib/examples/timeout-integration-example.js.map +1 -0
- package/dist/lib/notification-hooks.d.ts +103 -0
- package/dist/lib/notification-hooks.d.ts.map +1 -0
- package/dist/lib/notification-hooks.js +223 -0
- package/dist/lib/notification-hooks.js.map +1 -0
- package/dist/lib/notifications/discord.d.ts +20 -0
- package/dist/lib/notifications/discord.d.ts.map +1 -0
- package/dist/lib/notifications/discord.js +140 -0
- package/dist/lib/notifications/discord.js.map +1 -0
- package/dist/lib/notifications/index.d.ts +66 -0
- package/dist/lib/notifications/index.d.ts.map +1 -0
- package/dist/lib/notifications/index.js +120 -0
- package/dist/lib/notifications/index.js.map +1 -0
- package/dist/lib/notifications/slack.d.ts +20 -0
- package/dist/lib/notifications/slack.d.ts.map +1 -0
- package/dist/lib/notifications/slack.js +186 -0
- package/dist/lib/notifications/slack.js.map +1 -0
- package/dist/lib/notifications/teams.d.ts +20 -0
- package/dist/lib/notifications/teams.d.ts.map +1 -0
- package/dist/lib/notifications/teams.js +146 -0
- package/dist/lib/notifications/teams.js.map +1 -0
- package/dist/lib/notifications/webhook.d.ts +23 -0
- package/dist/lib/notifications/webhook.d.ts.map +1 -0
- package/dist/lib/notifications/webhook.js +65 -0
- package/dist/lib/notifications/webhook.js.map +1 -0
- package/dist/lib/orchestrator-state.d.ts +194 -0
- package/dist/lib/orchestrator-state.d.ts.map +1 -0
- package/dist/lib/orchestrator-state.js +332 -0
- package/dist/lib/orchestrator-state.js.map +1 -0
- package/dist/lib/realtime-cursor.d.ts +107 -0
- package/dist/lib/realtime-cursor.d.ts.map +1 -0
- package/dist/lib/realtime-cursor.js +260 -0
- package/dist/lib/realtime-cursor.js.map +1 -0
- package/dist/lib/rollback.d.ts +86 -0
- package/dist/lib/rollback.d.ts.map +1 -0
- package/dist/lib/rollback.js +405 -0
- package/dist/lib/rollback.js.map +1 -0
- package/dist/lib/sprint-loader.d.ts +39 -2
- package/dist/lib/sprint-loader.d.ts.map +1 -1
- package/dist/lib/sprint-loader.js +269 -5
- package/dist/lib/sprint-loader.js.map +1 -1
- package/dist/lib/stale-agent-detector.d.ts +102 -0
- package/dist/lib/stale-agent-detector.d.ts.map +1 -0
- package/dist/lib/stale-agent-detector.js +156 -0
- package/dist/lib/stale-agent-detector.js.map +1 -0
- package/dist/lib/task-dependencies.d.ts +143 -0
- package/dist/lib/task-dependencies.d.ts.map +1 -0
- package/dist/lib/task-dependencies.js +357 -0
- package/dist/lib/task-dependencies.js.map +1 -0
- package/dist/lib/task-timeout.d.ts +153 -0
- package/dist/lib/task-timeout.d.ts.map +1 -0
- package/dist/lib/task-timeout.js +505 -0
- package/dist/lib/task-timeout.js.map +1 -0
- package/dist/lib/verification/build-check.d.ts +55 -0
- package/dist/lib/verification/build-check.d.ts.map +1 -0
- package/dist/lib/verification/build-check.js +111 -0
- package/dist/lib/verification/build-check.js.map +1 -0
- package/dist/lib/verification/index.d.ts +19 -0
- package/dist/lib/verification/index.d.ts.map +1 -0
- package/dist/lib/verification/index.js +17 -0
- package/dist/lib/verification/index.js.map +1 -0
- package/dist/lib/verification/lint-check.d.ts +34 -0
- package/dist/lib/verification/lint-check.d.ts.map +1 -0
- package/dist/lib/verification/lint-check.js +215 -0
- package/dist/lib/verification/lint-check.js.map +1 -0
- package/dist/lib/verification/test-runner.d.ts +50 -0
- package/dist/lib/verification/test-runner.d.ts.map +1 -0
- package/dist/lib/verification/test-runner.js +225 -0
- package/dist/lib/verification/test-runner.js.map +1 -0
- package/dist/utils/command-helpers.d.ts.map +1 -1
- package/dist/utils/command-helpers.js +7 -0
- package/dist/utils/command-helpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: utility
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2025-12-07
|
|
5
|
+
* @tags: [timeout, orchestrator, checkpoint, escalation, epic-004-sprint5, task-6]
|
|
6
|
+
* @related: [checkpoint.ts, event-logger.ts, orchestrator-state.ts]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: medium
|
|
9
|
+
* @dependencies: [fs-extra, uuid]
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Timeout status
|
|
13
|
+
*/
|
|
14
|
+
export type TimeoutStatus = 'active' | 'warning' | 'timed_out' | 'completed';
|
|
15
|
+
/**
|
|
16
|
+
* Task timeout tracking
|
|
17
|
+
*/
|
|
18
|
+
export interface TaskTimeout {
|
|
19
|
+
taskId: string;
|
|
20
|
+
agentId: string;
|
|
21
|
+
maxDuration: number;
|
|
22
|
+
startedAt: Date;
|
|
23
|
+
warningAt?: Date;
|
|
24
|
+
timeoutAt: Date;
|
|
25
|
+
status: TimeoutStatus;
|
|
26
|
+
checkpointId?: string;
|
|
27
|
+
escalationEventId?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Timeout configuration
|
|
31
|
+
*/
|
|
32
|
+
export interface TimeoutConfig {
|
|
33
|
+
defaultTimeout?: number;
|
|
34
|
+
warningThreshold?: number;
|
|
35
|
+
checkInterval?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Timed out task information
|
|
39
|
+
*/
|
|
40
|
+
export interface TimedOutTask {
|
|
41
|
+
taskId: string;
|
|
42
|
+
agentId: string;
|
|
43
|
+
duration: number;
|
|
44
|
+
checkpointId: string;
|
|
45
|
+
escalationEventId: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Start task timeout monitoring
|
|
49
|
+
*
|
|
50
|
+
* Creates a timeout tracker for a task with the specified max duration.
|
|
51
|
+
* Automatically calculates warning threshold and timeout.
|
|
52
|
+
*
|
|
53
|
+
* @param taskId - Task ID to monitor
|
|
54
|
+
* @param maxDuration - Max duration in milliseconds
|
|
55
|
+
* @param agentId - Agent ID assigned to task
|
|
56
|
+
* @param config - Optional timeout configuration
|
|
57
|
+
* @returns TaskTimeout object
|
|
58
|
+
*/
|
|
59
|
+
export declare function startTaskTimeout(taskId: string, maxDuration: number, agentId: string, config?: TimeoutConfig): Promise<TaskTimeout>;
|
|
60
|
+
/**
|
|
61
|
+
* Check all active timeouts for warnings or expiration
|
|
62
|
+
*
|
|
63
|
+
* Scans all timeout files and identifies:
|
|
64
|
+
* - Tasks that have reached warning threshold
|
|
65
|
+
* - Tasks that have timed out
|
|
66
|
+
*
|
|
67
|
+
* @returns Array of timed out tasks
|
|
68
|
+
*/
|
|
69
|
+
export declare function checkTimeouts(): Promise<TimedOutTask[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Handle timeout for a specific task
|
|
72
|
+
*
|
|
73
|
+
* Creates checkpoint and escalation event when task times out.
|
|
74
|
+
*
|
|
75
|
+
* @param taskId - Task ID that timed out
|
|
76
|
+
* @returns TimedOutTask information or null if handling failed
|
|
77
|
+
*/
|
|
78
|
+
export declare function handleTimeout(taskId: string): Promise<TimedOutTask | null>;
|
|
79
|
+
/**
|
|
80
|
+
* Clear task timeout on completion
|
|
81
|
+
*
|
|
82
|
+
* Marks timeout as completed and removes from active monitoring.
|
|
83
|
+
*
|
|
84
|
+
* @param taskId - Task ID to clear
|
|
85
|
+
*/
|
|
86
|
+
export declare function clearTaskTimeout(taskId: string): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Get all active timeouts
|
|
89
|
+
*
|
|
90
|
+
* Returns all timeouts that are currently being monitored (not completed or timed out).
|
|
91
|
+
*
|
|
92
|
+
* @returns Array of active TaskTimeout objects
|
|
93
|
+
*/
|
|
94
|
+
export declare function getActiveTimeouts(): Promise<TaskTimeout[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Get timeout for a specific task
|
|
97
|
+
*
|
|
98
|
+
* @param taskId - Task ID
|
|
99
|
+
* @returns TaskTimeout object or null if not found
|
|
100
|
+
*/
|
|
101
|
+
export declare function getTaskTimeout(taskId: string): Promise<TaskTimeout | null>;
|
|
102
|
+
/**
|
|
103
|
+
* Get all timeouts (including completed and timed out)
|
|
104
|
+
*
|
|
105
|
+
* @returns Array of all TaskTimeout objects
|
|
106
|
+
*/
|
|
107
|
+
export declare function getAllTimeouts(): Promise<TaskTimeout[]>;
|
|
108
|
+
/**
|
|
109
|
+
* Clean up old completed/timed out timeouts
|
|
110
|
+
*
|
|
111
|
+
* Removes timeout files older than specified age.
|
|
112
|
+
*
|
|
113
|
+
* @param maxAgeMs - Maximum age in milliseconds (default 7 days)
|
|
114
|
+
* @returns Number of timeouts cleaned up
|
|
115
|
+
*/
|
|
116
|
+
export declare function cleanupOldTimeouts(maxAgeMs?: number): Promise<number>;
|
|
117
|
+
/**
|
|
118
|
+
* Timeout monitor for background checking
|
|
119
|
+
*/
|
|
120
|
+
export declare class TimeoutMonitor {
|
|
121
|
+
private checkInterval;
|
|
122
|
+
private timer;
|
|
123
|
+
private isRunning;
|
|
124
|
+
constructor(config?: TimeoutConfig);
|
|
125
|
+
/**
|
|
126
|
+
* Start background timeout monitoring
|
|
127
|
+
*/
|
|
128
|
+
start(): void;
|
|
129
|
+
/**
|
|
130
|
+
* Stop background timeout monitoring
|
|
131
|
+
*/
|
|
132
|
+
stop(): void;
|
|
133
|
+
/**
|
|
134
|
+
* Check if monitor is running
|
|
135
|
+
*/
|
|
136
|
+
getStatus(): {
|
|
137
|
+
isRunning: boolean;
|
|
138
|
+
checkInterval: number;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Initialize global timeout monitor
|
|
143
|
+
*/
|
|
144
|
+
export declare function initializeMonitor(config?: TimeoutConfig): TimeoutMonitor;
|
|
145
|
+
/**
|
|
146
|
+
* Get global monitor instance
|
|
147
|
+
*/
|
|
148
|
+
export declare function getMonitor(): TimeoutMonitor;
|
|
149
|
+
/**
|
|
150
|
+
* Check if monitor is initialized
|
|
151
|
+
*/
|
|
152
|
+
export declare function isMonitorInitialized(): boolean;
|
|
153
|
+
//# sourceMappingURL=task-timeout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-timeout.d.ts","sourceRoot":"","sources":["../../src/lib/task-timeout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAsCH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IAC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;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAkB7D;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,GAAE,MAAgC,GAAG,OAAO,CAAC,MAAM,CAAC,CAgCpG;AAMD;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,CAAC,EAAE,aAAa;IAIlC;;OAEG;IACH,KAAK,IAAI,IAAI;IA0Bb;;OAEG;IACH,IAAI,IAAI,IAAI;IASZ;;OAEG;IACH,SAAS,IAAI;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE;CAM3D;AAQD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,cAAc,CAUxE;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,cAAc,CAK3C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
|
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: utility
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2025-12-07
|
|
5
|
+
* @tags: [timeout, orchestrator, checkpoint, escalation, epic-004-sprint5, task-6]
|
|
6
|
+
* @related: [checkpoint.ts, event-logger.ts, orchestrator-state.ts]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: medium
|
|
9
|
+
* @dependencies: [fs-extra, uuid]
|
|
10
|
+
*/
|
|
11
|
+
import fs from 'fs-extra';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import { getGinkoDir } from '../utils/helpers.js';
|
|
14
|
+
import { createCheckpoint } from './checkpoint.js';
|
|
15
|
+
import { logEvent } from './event-logger.js';
|
|
16
|
+
/**
|
|
17
|
+
* Task Timeout Management (EPIC-004 Sprint 5 TASK-6)
|
|
18
|
+
*
|
|
19
|
+
* Handles:
|
|
20
|
+
* - Configurable per-task timeout monitoring
|
|
21
|
+
* - Warning at 80% threshold
|
|
22
|
+
* - Automatic checkpoint creation at timeout
|
|
23
|
+
* - Escalation event logging
|
|
24
|
+
*
|
|
25
|
+
* Pattern:
|
|
26
|
+
* - Timeouts stored in .ginko/timeouts/
|
|
27
|
+
* - Background check via interval (30s default)
|
|
28
|
+
* - Creates checkpoint + escalation event on timeout
|
|
29
|
+
* - Integrates with checkpoint.ts and event-logger.ts
|
|
30
|
+
*/
|
|
31
|
+
// ============================================================
|
|
32
|
+
// Constants
|
|
33
|
+
// ============================================================
|
|
34
|
+
const DEFAULT_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes
|
|
35
|
+
const DEFAULT_WARNING_THRESHOLD = 0.8; // 80%
|
|
36
|
+
const DEFAULT_CHECK_INTERVAL_MS = 30 * 1000; // 30 seconds
|
|
37
|
+
const TIMEOUTS_DIR = 'timeouts';
|
|
38
|
+
// ============================================================
|
|
39
|
+
// Storage Helpers
|
|
40
|
+
// ============================================================
|
|
41
|
+
/**
|
|
42
|
+
* Get path to timeout storage directory
|
|
43
|
+
*/
|
|
44
|
+
async function getTimeoutStorageDir() {
|
|
45
|
+
const ginkoDir = await getGinkoDir();
|
|
46
|
+
const timeoutDir = path.join(ginkoDir, TIMEOUTS_DIR);
|
|
47
|
+
await fs.ensureDir(timeoutDir);
|
|
48
|
+
return timeoutDir;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get path to timeout file for a specific task
|
|
52
|
+
*/
|
|
53
|
+
async function getTimeoutFilePath(taskId) {
|
|
54
|
+
const timeoutDir = await getTimeoutStorageDir();
|
|
55
|
+
return path.join(timeoutDir, `${taskId}.json`);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Load timeout from file
|
|
59
|
+
*/
|
|
60
|
+
async function loadTimeout(taskId) {
|
|
61
|
+
try {
|
|
62
|
+
const filePath = await getTimeoutFilePath(taskId);
|
|
63
|
+
if (!await fs.pathExists(filePath)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const timeout = await fs.readJSON(filePath);
|
|
67
|
+
// Convert date strings back to Date objects
|
|
68
|
+
timeout.startedAt = new Date(timeout.startedAt);
|
|
69
|
+
timeout.timeoutAt = new Date(timeout.timeoutAt);
|
|
70
|
+
if (timeout.warningAt) {
|
|
71
|
+
timeout.warningAt = new Date(timeout.warningAt);
|
|
72
|
+
}
|
|
73
|
+
return timeout;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.warn(`[TIMEOUT] Failed to load timeout for task ${taskId}:`, error);
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Save timeout to file
|
|
82
|
+
*/
|
|
83
|
+
async function saveTimeout(timeout) {
|
|
84
|
+
try {
|
|
85
|
+
const filePath = await getTimeoutFilePath(timeout.taskId);
|
|
86
|
+
await fs.writeJSON(filePath, timeout, { spaces: 2 });
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.error(`[TIMEOUT] Failed to save timeout for task ${timeout.taskId}:`, error);
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Delete timeout file
|
|
95
|
+
*/
|
|
96
|
+
async function deleteTimeoutFile(taskId) {
|
|
97
|
+
try {
|
|
98
|
+
const filePath = await getTimeoutFilePath(taskId);
|
|
99
|
+
if (await fs.pathExists(filePath)) {
|
|
100
|
+
await fs.remove(filePath);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.warn(`[TIMEOUT] Failed to delete timeout for task ${taskId}:`, error);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* List all timeout files
|
|
109
|
+
*/
|
|
110
|
+
async function listTimeoutFiles() {
|
|
111
|
+
try {
|
|
112
|
+
const timeoutDir = await getTimeoutStorageDir();
|
|
113
|
+
const files = await fs.readdir(timeoutDir);
|
|
114
|
+
// Filter for .json files and extract task IDs
|
|
115
|
+
return files
|
|
116
|
+
.filter(f => f.endsWith('.json'))
|
|
117
|
+
.map(f => f.replace('.json', ''));
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
console.warn('[TIMEOUT] Failed to list timeout files:', error);
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// ============================================================
|
|
125
|
+
// Core Functions
|
|
126
|
+
// ============================================================
|
|
127
|
+
/**
|
|
128
|
+
* Start task timeout monitoring
|
|
129
|
+
*
|
|
130
|
+
* Creates a timeout tracker for a task with the specified max duration.
|
|
131
|
+
* Automatically calculates warning threshold and timeout.
|
|
132
|
+
*
|
|
133
|
+
* @param taskId - Task ID to monitor
|
|
134
|
+
* @param maxDuration - Max duration in milliseconds
|
|
135
|
+
* @param agentId - Agent ID assigned to task
|
|
136
|
+
* @param config - Optional timeout configuration
|
|
137
|
+
* @returns TaskTimeout object
|
|
138
|
+
*/
|
|
139
|
+
export async function startTaskTimeout(taskId, maxDuration, agentId, config) {
|
|
140
|
+
const warningThreshold = config?.warningThreshold ?? DEFAULT_WARNING_THRESHOLD;
|
|
141
|
+
const startedAt = new Date();
|
|
142
|
+
const warningDuration = maxDuration * warningThreshold;
|
|
143
|
+
const warningAt = new Date(startedAt.getTime() + warningDuration);
|
|
144
|
+
const timeoutAt = new Date(startedAt.getTime() + maxDuration);
|
|
145
|
+
const timeout = {
|
|
146
|
+
taskId,
|
|
147
|
+
agentId,
|
|
148
|
+
maxDuration,
|
|
149
|
+
startedAt,
|
|
150
|
+
warningAt,
|
|
151
|
+
timeoutAt,
|
|
152
|
+
status: 'active'
|
|
153
|
+
};
|
|
154
|
+
// Save to file
|
|
155
|
+
await saveTimeout(timeout);
|
|
156
|
+
console.log(`[TIMEOUT] Started timeout for task ${taskId}`);
|
|
157
|
+
console.log(`[TIMEOUT] Max duration: ${maxDuration / 1000}s`);
|
|
158
|
+
console.log(`[TIMEOUT] Warning at: ${warningAt.toISOString()}`);
|
|
159
|
+
console.log(`[TIMEOUT] Timeout at: ${timeoutAt.toISOString()}`);
|
|
160
|
+
return timeout;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Check all active timeouts for warnings or expiration
|
|
164
|
+
*
|
|
165
|
+
* Scans all timeout files and identifies:
|
|
166
|
+
* - Tasks that have reached warning threshold
|
|
167
|
+
* - Tasks that have timed out
|
|
168
|
+
*
|
|
169
|
+
* @returns Array of timed out tasks
|
|
170
|
+
*/
|
|
171
|
+
export async function checkTimeouts() {
|
|
172
|
+
const timedOutTasks = [];
|
|
173
|
+
const now = new Date();
|
|
174
|
+
try {
|
|
175
|
+
const taskIds = await listTimeoutFiles();
|
|
176
|
+
for (const taskId of taskIds) {
|
|
177
|
+
const timeout = await loadTimeout(taskId);
|
|
178
|
+
if (!timeout) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
// Skip if already completed or timed out
|
|
182
|
+
if (timeout.status === 'completed' || timeout.status === 'timed_out') {
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
// Check for timeout
|
|
186
|
+
if (now >= timeout.timeoutAt) {
|
|
187
|
+
console.log(`[TIMEOUT] Task ${taskId} has timed out`);
|
|
188
|
+
// Handle timeout
|
|
189
|
+
const result = await handleTimeout(taskId);
|
|
190
|
+
if (result) {
|
|
191
|
+
timedOutTasks.push(result);
|
|
192
|
+
}
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
// Check for warning threshold
|
|
196
|
+
if (timeout.warningAt && now >= timeout.warningAt && timeout.status === 'active') {
|
|
197
|
+
console.log(`[TIMEOUT] Task ${taskId} has reached warning threshold (${DEFAULT_WARNING_THRESHOLD * 100}%)`);
|
|
198
|
+
// Update status to warning
|
|
199
|
+
timeout.status = 'warning';
|
|
200
|
+
await saveTimeout(timeout);
|
|
201
|
+
// Log warning event
|
|
202
|
+
try {
|
|
203
|
+
await logEvent({
|
|
204
|
+
category: 'insight',
|
|
205
|
+
description: `Task ${taskId} approaching timeout (${DEFAULT_WARNING_THRESHOLD * 100}% elapsed). Max duration: ${timeout.maxDuration / 1000}s`,
|
|
206
|
+
tags: ['timeout-warning', taskId],
|
|
207
|
+
impact: 'medium'
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
console.warn(`[TIMEOUT] Failed to log warning event for task ${taskId}:`, error);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
console.error('[TIMEOUT] Failed to check timeouts:', error);
|
|
218
|
+
}
|
|
219
|
+
return timedOutTasks;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Handle timeout for a specific task
|
|
223
|
+
*
|
|
224
|
+
* Creates checkpoint and escalation event when task times out.
|
|
225
|
+
*
|
|
226
|
+
* @param taskId - Task ID that timed out
|
|
227
|
+
* @returns TimedOutTask information or null if handling failed
|
|
228
|
+
*/
|
|
229
|
+
export async function handleTimeout(taskId) {
|
|
230
|
+
try {
|
|
231
|
+
const timeout = await loadTimeout(taskId);
|
|
232
|
+
if (!timeout) {
|
|
233
|
+
console.warn(`[TIMEOUT] Cannot handle timeout for task ${taskId}: timeout not found`);
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
// Skip if already handled
|
|
237
|
+
if (timeout.status === 'timed_out') {
|
|
238
|
+
console.log(`[TIMEOUT] Task ${taskId} timeout already handled`);
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
console.log(`[TIMEOUT] Handling timeout for task ${taskId}`);
|
|
242
|
+
const now = new Date();
|
|
243
|
+
const duration = now.getTime() - timeout.startedAt.getTime();
|
|
244
|
+
// Create checkpoint
|
|
245
|
+
let checkpointId;
|
|
246
|
+
try {
|
|
247
|
+
const checkpoint = await createCheckpoint(taskId, timeout.agentId, `Automatic checkpoint: task timeout after ${duration / 1000}s`, {
|
|
248
|
+
reason: 'timeout',
|
|
249
|
+
maxDuration: timeout.maxDuration,
|
|
250
|
+
actualDuration: duration
|
|
251
|
+
});
|
|
252
|
+
checkpointId = checkpoint.id;
|
|
253
|
+
console.log(`[TIMEOUT] Created checkpoint ${checkpointId} for task ${taskId}`);
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
console.error(`[TIMEOUT] Failed to create checkpoint for task ${taskId}:`, error);
|
|
257
|
+
// Continue with escalation even if checkpoint fails
|
|
258
|
+
checkpointId = 'failed';
|
|
259
|
+
}
|
|
260
|
+
// Create escalation event
|
|
261
|
+
let escalationEventId;
|
|
262
|
+
try {
|
|
263
|
+
const event = await logEvent({
|
|
264
|
+
category: 'blocker',
|
|
265
|
+
description: `Task ${taskId} timed out after ${duration / 1000}s (max: ${timeout.maxDuration / 1000}s). Agent: ${timeout.agentId}. Checkpoint: ${checkpointId}`,
|
|
266
|
+
tags: ['timeout', 'escalation', taskId, timeout.agentId],
|
|
267
|
+
impact: 'high',
|
|
268
|
+
blocked_by: 'timeout',
|
|
269
|
+
blocking_tasks: [taskId],
|
|
270
|
+
blocker_severity: 'high'
|
|
271
|
+
});
|
|
272
|
+
escalationEventId = event.id;
|
|
273
|
+
console.log(`[TIMEOUT] Created escalation event ${escalationEventId} for task ${taskId}`);
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
console.error(`[TIMEOUT] Failed to create escalation event for task ${taskId}:`, error);
|
|
277
|
+
escalationEventId = 'failed';
|
|
278
|
+
}
|
|
279
|
+
// Update timeout status
|
|
280
|
+
timeout.status = 'timed_out';
|
|
281
|
+
timeout.checkpointId = checkpointId;
|
|
282
|
+
timeout.escalationEventId = escalationEventId;
|
|
283
|
+
await saveTimeout(timeout);
|
|
284
|
+
return {
|
|
285
|
+
taskId,
|
|
286
|
+
agentId: timeout.agentId,
|
|
287
|
+
duration,
|
|
288
|
+
checkpointId,
|
|
289
|
+
escalationEventId
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
console.error(`[TIMEOUT] Failed to handle timeout for task ${taskId}:`, error);
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Clear task timeout on completion
|
|
299
|
+
*
|
|
300
|
+
* Marks timeout as completed and removes from active monitoring.
|
|
301
|
+
*
|
|
302
|
+
* @param taskId - Task ID to clear
|
|
303
|
+
*/
|
|
304
|
+
export async function clearTaskTimeout(taskId) {
|
|
305
|
+
try {
|
|
306
|
+
const timeout = await loadTimeout(taskId);
|
|
307
|
+
if (!timeout) {
|
|
308
|
+
console.log(`[TIMEOUT] No timeout found for task ${taskId}`);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
// Update status to completed
|
|
312
|
+
timeout.status = 'completed';
|
|
313
|
+
await saveTimeout(timeout);
|
|
314
|
+
console.log(`[TIMEOUT] Cleared timeout for task ${taskId}`);
|
|
315
|
+
// Optionally delete file after completion (cleanup)
|
|
316
|
+
// Keeping it for now for audit trail
|
|
317
|
+
// await deleteTimeoutFile(taskId);
|
|
318
|
+
}
|
|
319
|
+
catch (error) {
|
|
320
|
+
console.error(`[TIMEOUT] Failed to clear timeout for task ${taskId}:`, error);
|
|
321
|
+
throw error;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Get all active timeouts
|
|
326
|
+
*
|
|
327
|
+
* Returns all timeouts that are currently being monitored (not completed or timed out).
|
|
328
|
+
*
|
|
329
|
+
* @returns Array of active TaskTimeout objects
|
|
330
|
+
*/
|
|
331
|
+
export async function getActiveTimeouts() {
|
|
332
|
+
const activeTimeouts = [];
|
|
333
|
+
try {
|
|
334
|
+
const taskIds = await listTimeoutFiles();
|
|
335
|
+
for (const taskId of taskIds) {
|
|
336
|
+
const timeout = await loadTimeout(taskId);
|
|
337
|
+
if (!timeout) {
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
// Include active and warning status
|
|
341
|
+
if (timeout.status === 'active' || timeout.status === 'warning') {
|
|
342
|
+
activeTimeouts.push(timeout);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
catch (error) {
|
|
347
|
+
console.error('[TIMEOUT] Failed to get active timeouts:', error);
|
|
348
|
+
}
|
|
349
|
+
return activeTimeouts;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Get timeout for a specific task
|
|
353
|
+
*
|
|
354
|
+
* @param taskId - Task ID
|
|
355
|
+
* @returns TaskTimeout object or null if not found
|
|
356
|
+
*/
|
|
357
|
+
export async function getTaskTimeout(taskId) {
|
|
358
|
+
return loadTimeout(taskId);
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Get all timeouts (including completed and timed out)
|
|
362
|
+
*
|
|
363
|
+
* @returns Array of all TaskTimeout objects
|
|
364
|
+
*/
|
|
365
|
+
export async function getAllTimeouts() {
|
|
366
|
+
const allTimeouts = [];
|
|
367
|
+
try {
|
|
368
|
+
const taskIds = await listTimeoutFiles();
|
|
369
|
+
for (const taskId of taskIds) {
|
|
370
|
+
const timeout = await loadTimeout(taskId);
|
|
371
|
+
if (timeout) {
|
|
372
|
+
allTimeouts.push(timeout);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
console.error('[TIMEOUT] Failed to get all timeouts:', error);
|
|
378
|
+
}
|
|
379
|
+
return allTimeouts;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Clean up old completed/timed out timeouts
|
|
383
|
+
*
|
|
384
|
+
* Removes timeout files older than specified age.
|
|
385
|
+
*
|
|
386
|
+
* @param maxAgeMs - Maximum age in milliseconds (default 7 days)
|
|
387
|
+
* @returns Number of timeouts cleaned up
|
|
388
|
+
*/
|
|
389
|
+
export async function cleanupOldTimeouts(maxAgeMs = 7 * 24 * 60 * 60 * 1000) {
|
|
390
|
+
let cleanedCount = 0;
|
|
391
|
+
const now = new Date();
|
|
392
|
+
try {
|
|
393
|
+
const taskIds = await listTimeoutFiles();
|
|
394
|
+
for (const taskId of taskIds) {
|
|
395
|
+
const timeout = await loadTimeout(taskId);
|
|
396
|
+
if (!timeout) {
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
// Only clean up completed or timed out timeouts
|
|
400
|
+
if (timeout.status !== 'completed' && timeout.status !== 'timed_out') {
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
// Check age
|
|
404
|
+
const age = now.getTime() - timeout.startedAt.getTime();
|
|
405
|
+
if (age > maxAgeMs) {
|
|
406
|
+
await deleteTimeoutFile(taskId);
|
|
407
|
+
cleanedCount++;
|
|
408
|
+
console.log(`[TIMEOUT] Cleaned up old timeout for task ${taskId}`);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
console.error('[TIMEOUT] Failed to clean up old timeouts:', error);
|
|
414
|
+
}
|
|
415
|
+
return cleanedCount;
|
|
416
|
+
}
|
|
417
|
+
// ============================================================
|
|
418
|
+
// Background Monitor
|
|
419
|
+
// ============================================================
|
|
420
|
+
/**
|
|
421
|
+
* Timeout monitor for background checking
|
|
422
|
+
*/
|
|
423
|
+
export class TimeoutMonitor {
|
|
424
|
+
checkInterval;
|
|
425
|
+
timer = null;
|
|
426
|
+
isRunning = false;
|
|
427
|
+
constructor(config) {
|
|
428
|
+
this.checkInterval = config?.checkInterval ?? DEFAULT_CHECK_INTERVAL_MS;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Start background timeout monitoring
|
|
432
|
+
*/
|
|
433
|
+
start() {
|
|
434
|
+
if (this.timer) {
|
|
435
|
+
console.warn('[TIMEOUT] Monitor already started');
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
console.log(`[TIMEOUT] Starting timeout monitor (interval: ${this.checkInterval / 1000}s)`);
|
|
439
|
+
this.isRunning = true;
|
|
440
|
+
// Schedule periodic checks
|
|
441
|
+
this.timer = setInterval(() => {
|
|
442
|
+
checkTimeouts().catch(error => {
|
|
443
|
+
console.error('[TIMEOUT] Background check failed:', error instanceof Error ? error.message : String(error));
|
|
444
|
+
});
|
|
445
|
+
}, this.checkInterval);
|
|
446
|
+
// Don't keep process alive just for this timer
|
|
447
|
+
this.timer.unref();
|
|
448
|
+
// Initial check
|
|
449
|
+
checkTimeouts().catch(error => {
|
|
450
|
+
console.warn('[TIMEOUT] Initial check failed:', error instanceof Error ? error.message : String(error));
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Stop background timeout monitoring
|
|
455
|
+
*/
|
|
456
|
+
stop() {
|
|
457
|
+
if (this.timer) {
|
|
458
|
+
clearInterval(this.timer);
|
|
459
|
+
this.timer = null;
|
|
460
|
+
this.isRunning = false;
|
|
461
|
+
console.log('[TIMEOUT] Timeout monitor stopped');
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Check if monitor is running
|
|
466
|
+
*/
|
|
467
|
+
getStatus() {
|
|
468
|
+
return {
|
|
469
|
+
isRunning: this.isRunning,
|
|
470
|
+
checkInterval: this.checkInterval
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
// ============================================================
|
|
475
|
+
// Global Monitor Instance
|
|
476
|
+
// ============================================================
|
|
477
|
+
let globalMonitor = null;
|
|
478
|
+
/**
|
|
479
|
+
* Initialize global timeout monitor
|
|
480
|
+
*/
|
|
481
|
+
export function initializeMonitor(config) {
|
|
482
|
+
if (globalMonitor) {
|
|
483
|
+
console.warn('[TIMEOUT] Monitor already initialized');
|
|
484
|
+
return globalMonitor;
|
|
485
|
+
}
|
|
486
|
+
globalMonitor = new TimeoutMonitor(config);
|
|
487
|
+
globalMonitor.start();
|
|
488
|
+
return globalMonitor;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Get global monitor instance
|
|
492
|
+
*/
|
|
493
|
+
export function getMonitor() {
|
|
494
|
+
if (!globalMonitor) {
|
|
495
|
+
throw new Error('TimeoutMonitor not initialized. Call initializeMonitor() first.');
|
|
496
|
+
}
|
|
497
|
+
return globalMonitor;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Check if monitor is initialized
|
|
501
|
+
*/
|
|
502
|
+
export function isMonitorInitialized() {
|
|
503
|
+
return globalMonitor !== null;
|
|
504
|
+
}
|
|
505
|
+
//# sourceMappingURL=task-timeout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-timeout.js","sourceRoot":"","sources":["../../src/lib/task-timeout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;;;;;;GAcG;AAEH,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAE/D,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AACxD,MAAM,yBAAyB,GAAG,GAAG,CAAC,CAAC,MAAM;AAC7C,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAC1D,MAAM,YAAY,GAAG,UAAU,CAAC;AAuDhC,+DAA+D;AAC/D,kBAAkB;AAClB,+DAA+D;AAE/D;;GAEG;AACH,KAAK,UAAU,oBAAoB;IACjC,MAAM,QAAQ,GAAG,MAAM,WAAW,EAAE,CAAC;IACrC,MAAM,UAAU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