opencode-timeout-continuer 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +20 -81
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,44 +1,30 @@
1
1
  # opencode-timeout-continuer
2
2
 
3
- An OpenCode CLI plugin that automatically retries operations when timeout or retryable errors occur, using exponential backoff.
3
+ Auto-retry OpenCode operations on timeout errors with exponential backoff.
4
4
 
5
- ## Features
6
-
7
- - **Automatic retry** on timeout and retryable API errors
8
- - **Exponential backoff** with configurable delays (1s → 2s → 4s → ...)
9
- - **Per-session tracking** - retry counts reset when session completes
10
- - **Silent operation** - no UI interruptions
11
- - **Fully configurable** - customize retry count, delays, and prompts
12
-
13
- ## Installation
14
-
15
- ### From npm (when published)
5
+ ## Install
16
6
 
17
7
  ```bash
18
8
  npm install -g opencode-timeout-continuer
19
9
  ```
20
10
 
21
- ### From source
11
+ ## Usage
22
12
 
23
- ```bash
24
- git clone <repo-url>
25
- cd opencode-timeout-continuer
26
- npm install
27
- npm run build
28
- npm pack
29
- npm install -g opencode-timeout-continuer-*.tgz
30
- ```
13
+ Add to your `opencode.json`:
31
14
 
32
- ## Configuration
15
+ ```json
16
+ {
17
+ "plugin": ["opencode-timeout-continuer"]
18
+ }
19
+ ```
33
20
 
34
- Add the plugin to your `opencode.json`:
21
+ ## Config
35
22
 
36
23
  ```json
37
24
  {
38
25
  "plugin": ["opencode-timeout-continuer"],
39
26
  "plugin_config": {
40
27
  "opencode-timeout-continuer": {
41
- "enabled": true,
42
28
  "maxRetries": 3,
43
29
  "baseDelayMs": 1000,
44
30
  "maxDelayMs": 30000,
@@ -48,65 +34,18 @@ Add the plugin to your `opencode.json`:
48
34
  }
49
35
  ```
50
36
 
51
- ### Configuration Options
52
-
53
- | Option | Type | Default | Description |
54
- |--------|------|---------|-------------|
55
- | `enabled` | boolean | `true` | Enable/disable auto-retry |
56
- | `maxRetries` | number | `3` | Maximum retry attempts per session (1-10) |
57
- | `baseDelayMs` | number | `1000` | Base delay for exponential backoff in ms (100-60000) |
58
- | `maxDelayMs` | number | `30000` | Maximum delay cap in ms (1000-300000) |
59
- | `prompt` | string | `"Continue"` | Prompt text sent on retry |
60
-
61
- ## How It Works
62
-
63
- 1. **Detect**: The plugin listens for `session.error` events from OpenCode
64
- 2. **Analyze**: Checks if the error is retryable:
65
- - API errors with `isRetryable: true`
66
- - HTTP status codes: 408, 429, 502, 503, 504
67
- - Error names containing "timeout" or "ETIMEDOUT"
68
- 3. **Retry**: If retryable and under max retries:
69
- - Calculates exponential backoff delay
70
- - Sends a continuation prompt after the delay
71
- 4. **Reset**: When a session goes idle, retry counts are reset
72
-
73
- ### Exponential Backoff
74
-
75
- The delay between retries grows exponentially:
76
-
77
- | Attempt | Delay |
78
- |---------|-------|
79
- | 1 | 1s |
80
- | 2 | 2s |
81
- | 3 | 4s |
82
- | 4 | 8s (capped at maxDelayMs) |
83
-
84
- Formula: `delay = min(baseDelayMs * 2^attempt, maxDelayMs)`
85
-
86
- ## Manual Testing
87
-
88
- To test the plugin:
89
-
90
- 1. Install the plugin globally
91
- 2. Add it to your `opencode.json`
92
- 3. Start OpenCode with a prompt that might timeout (e.g., a complex query)
93
- 4. Watch for log messages in OpenCode's output:
94
- - `Plugin initialized with maxRetries=3, baseDelayMs=1000`
95
- - `Retryable error detected for session xxx, scheduling retry 1/3`
37
+ | Option | Default | Description |
38
+ |--------|---------|-------------|
39
+ | `maxRetries` | 3 | Max retry attempts |
40
+ | `baseDelayMs` | 1000 | Base delay for backoff |
41
+ | `maxDelayMs` | 30000 | Max delay cap |
42
+ | `prompt` | "Continue" | Prompt sent on retry |
96
43
 
97
- ## Error Types Handled
44
+ ## How it works
98
45
 
99
- | Error Type | Retryable? |
100
- |------------|------------|
101
- | API Timeout | Yes |
102
- | HTTP 408 (Request Timeout) | Yes |
103
- | HTTP 429 (Too Many Requests) | Yes |
104
- | HTTP 502 (Bad Gateway) | Yes |
105
- | HTTP 503 (Service Unavailable) | Yes |
106
- | HTTP 504 (Gateway Timeout) | Yes |
107
- | ProviderAuthError | No |
108
- | MessageOutputLengthError | No |
109
- | MessageAbortedError | No |
46
+ 1. Detects timeout/retryable errors (HTTP 408, 429, 502, 503, 504)
47
+ 2. Retries with exponential backoff (1s → 2s → 4s → ...)
48
+ 3. Resets count when session completes
110
49
 
111
50
  ## License
112
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-timeout-continuer",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "OpenCode CLI plugin for automatic retry on timeout errors with exponential backoff",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",