opencode-orchestrator 1.0.43 → 1.0.46

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.
@@ -2,5 +2,6 @@
2
2
  * OS Native Notification Module
3
3
  */
4
4
  export * from "../../../shared/notification/os-notify/index.js";
5
- export { createSessionNotificationHandler } from "./handler.js";
6
- export type { SessionNotificationHandler } from "./handler.js";
5
+ export { sendNotification } from "./notifier.js";
6
+ export { playSound } from "./sound-player.js";
7
+ export { detectPlatform, getDefaultSoundPath } from "./platform.js";
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Session Retry Utilities
3
+ *
4
+ * Provides sophisticated retry logic for API errors including:
5
+ * - retry-after header parsing
6
+ * - Exponential backoff
7
+ * - Retryable error detection
8
+ *
9
+ * Inspired by OpenCode's SessionRetry system.
10
+ */
11
+ /** Initial delay for retries (ms) */
12
+ export declare const RETRY_INITIAL_DELAY = 2000;
13
+ /** Backoff multiplier */
14
+ export declare const RETRY_BACKOFF_FACTOR = 2;
15
+ /** Max delay when no headers (30 seconds) */
16
+ export declare const RETRY_MAX_DELAY_NO_HEADERS = 30000;
17
+ /** Absolute max delay for setTimeout (max 32-bit signed int) */
18
+ export declare const RETRY_MAX_DELAY = 2147483647;
19
+ /** Max retry attempts */
20
+ export declare const MAX_RETRY_ATTEMPTS = 5;
21
+ export interface APIErrorData {
22
+ isRetryable?: boolean;
23
+ message?: string;
24
+ responseHeaders?: Record<string, string>;
25
+ status?: number;
26
+ }
27
+ export interface RetryConfig {
28
+ maxAttempts?: number;
29
+ initialDelay?: number;
30
+ maxDelay?: number;
31
+ backoffFactor?: number;
32
+ }
33
+ /**
34
+ * Sleep with abort signal support
35
+ */
36
+ export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
37
+ /**
38
+ * Calculate retry delay from attempt number and optional error data
39
+ *
40
+ * Priority:
41
+ * 1. retry-after-ms header
42
+ * 2. retry-after header (seconds or HTTP date)
43
+ * 3. Exponential backoff
44
+ */
45
+ export declare function calculateDelay(attempt: number, errorData?: APIErrorData): number;
46
+ /**
47
+ * Check if an error is retryable
48
+ *
49
+ * Returns a human-readable reason if retryable, undefined otherwise.
50
+ */
51
+ export declare function isRetryable(error: unknown): string | undefined;
52
+ /**
53
+ * Retry an async operation with exponential backoff
54
+ */
55
+ export declare function withRetry<T>(operation: () => Promise<T>, config?: RetryConfig, signal?: AbortSignal): Promise<T>;
56
+ /**
57
+ * Format delay for human readability
58
+ */
59
+ export declare function formatDelay(ms: number): string;