reliable-requests 0.2.0 → 0.3.0
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/CHANGELOG.md +33 -13
- package/LICENSE +21 -21
- package/README.md +207 -99
- package/docs/MODEL_COMPATIBILITY.md +90 -0
- package/docs/STREAM_CONTRACT.md +72 -0
- package/docs/USAGE.md +313 -295
- package/index.d.ts +138 -127
- package/index.js +12 -11
- package/package.json +51 -46
- package/src/endpoint.js +17 -17
- package/src/index.js +128 -128
- package/src/local-chat.js +403 -343
- package/src/metrics.js +46 -46
- package/src/retry.js +48 -48
- package/src/sse.js +93 -93
- package/src/stream-events.js +69 -69
package/docs/USAGE.md
CHANGED
|
@@ -1,295 +1,313 @@
|
|
|
1
|
-
> Detailed documentation preserved from the initial development phase. Run commands from the repository root.
|
|
2
|
-
|
|
3
|
-
# Complete usage guide for reliable-requests
|
|
4
|
-
|
|
5
|
-
[ ](https://github.com/Stairrax/reliable-requests/actions/workflows/test.yml)
|
|
6
|
-

|
|
7
|
-
[](../LICENSE)
|
|
8
|
-
|
|
9
|
-
**Recover from interrupted local AI streams without mixing two different answers.**
|
|
10
|
-
|
|
11
|
-
A small, dependency-free JavaScript toolkit for Node.js 18+ and modern browsers. Built for text generation with Ollama, LM Studio, and llama.cpp. Works with any compatible installed model, including Qwen.
|
|
12
|
-
|
|
13
|
-
## Try the visual demo
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm run demo
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Open **http://127.0.0.1:4173**. Choose **Simulate interruption** (default), click **Start stream**, and watch the partial answer get discarded before a fresh one appears. **No neural model, GPU, or internet required** for this simulation.
|
|
20
|
-
|
|
21
|
-
Switch to **Live local model** after starting Ollama, LM Studio, or llama.cpp. The demo runs in your browser and connects to your own local model directly, so the model server must allow the page origin through CORS. The static demo server neither stores messages nor proxies requests. The live demo accepts loopback endpoints only.
|
|
22
|
-
|
|
23
|
-
## How recovery works
|
|
24
|
-
|
|
25
|
-
```mermaid
|
|
26
|
-
flowchart LR
|
|
27
|
-
A[Start generation] --> B{Stream completed?}
|
|
28
|
-
B -->|Yes| C[Done]
|
|
29
|
-
B -->|Interrupted| D{Retry budget left?}
|
|
30
|
-
D -->|No| E[Report error]
|
|
31
|
-
D -->|Yes| F[Retry and emit reset]
|
|
32
|
-
F --> G[Discard partial answer]
|
|
33
|
-
G --> A
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**Important:** restarting is not continuing the same generation. The model might produce different words. The library emits `reset` so callers **replace**, not append to, the interrupted response. Only text-only requests are supported; tool calls are not automatically executed.
|
|
37
|
-
|
|
38
|
-
## Four ways to try it
|
|
39
|
-
|
|
40
|
-
| Goal | Command |
|
|
41
|
-
| --- | --- |
|
|
42
|
-
| Run unit + real HTTP fault tests | `npm test` |
|
|
43
|
-
| Open the interactive browser demo | `npm run demo` |
|
|
44
|
-
| Test an installed Ollama model | `MODEL_NAME=qwen2.5:0.5b npm run test:model` |
|
|
45
|
-
| Test a forced real Ollama disconnect | `MODEL_NAME=qwen2.5:0.5b npm run test:ollama:recovery` |
|
|
46
|
-
|
|
47
|
-
The model name shown is an example: install a model with Ollama first, or use a model already present. For OpenAI-compatible local servers, see the [real-model instructions](#test-on-a-real-model-optional). On Windows PowerShell, use the environment-variable examples in that section.
|
|
48
|
-
|
|
49
|
-
## Local model streams
|
|
50
|
-
|
|
51
|
-
`streamLocalChat` is the distinctive part of this project: it can restart a **text-only** local-model stream after a partial answer. Before the next attempt it emits `reset`, so the caller replaces the old answer instead of appending a second generation to it. It works with any model name served by Ollama's native chat API or an OpenAI-compatible chat-completions endpoint (for example, LM Studio or llama.cpp). The model does not need to be Qwen.
|
|
52
|
-
|
|
53
|
-
```js
|
|
54
|
-
import { streamLocalChat } from 'reliable-requests';
|
|
55
|
-
|
|
56
|
-
let shown = '';
|
|
57
|
-
await streamLocalChat({
|
|
58
|
-
endpoint: 'http://localhost:11434',
|
|
59
|
-
protocol: 'ollama',
|
|
60
|
-
model: 'qwen2.5:7b',
|
|
61
|
-
messages: [{ role: 'user', content: 'Explain recursion simply.' }],
|
|
62
|
-
timeoutMs: 60_000,
|
|
63
|
-
onEvent(event) {
|
|
64
|
-
if (event.type === 'reset') shown = '';
|
|
65
|
-
if (event.type === 'delta') shown += event.text;
|
|
66
|
-
if (event.type === 'retry') console.log('Restarting generation:', event.error.message);
|
|
67
|
-
if (event.type === 'done') console.log(shown);
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
For an OpenAI-compatible local server, set `protocol: 'openai'` (the default) and `endpoint: 'http://localhost:1234/v1'` for LM Studio or your llama.cpp server URL. The function adds `/v1/chat/completions` itself, preserving any proxy path prefix; if the endpoint already ends in `/v1`, it adds only `/chat/completions`. `fetchImpl` and `headers` are optional. `signal` cancels the operation.
|
|
73
|
-
|
|
74
|
-
The parser limits each NDJSON or SSE protocol line to **262,144 JavaScript characters** by default. This bounds the pending line buffer without limiting the total length of a completed answer. Override with `maxLineChars` (between 1 and 4,194,304), e.g. `maxLineChars: 524288` for an unusually large event. A line exceeding the limit fails with `StreamLineTooLongError` and `code === 'STREAM_LINE_TOO_LONG'`; this is **not automatically retried**. OpenAI-compatible SSE data is dispatched at a blank line, with multiple data fields joined by a newline. LF, CRLF and CR endings, UTF-8 split across chunks, comments and non-data fields are supported. An event without its terminating blank line at EOF is discarded, including an incomplete [DONE] marker; the stream is treated as interrupted. SSE reconnection, Last-Event-ID and server event retry fields are not used: retries restart the model generation. Ollama retains its NDJSON behavior, including a final line without a newline.
|
|
75
|
-
|
|
76
|
-
The joined SSE data payload also has a limit, maxEventChars (default: maxLineChars; range 1 to 4,194,304). An oversized event fails with StreamEventTooLongError and code STREAM_EVENT_TOO_LONG, without a retry. Both errors are exported from reliable-requests. These limits describe parser memory, not model token limits.
|
|
77
|
-
|
|
78
|
-
The callback receives `attempt`, `delta`, `retry`, `reset`, and `done` events. Its work should be synchronous. A retry begins only for a transient HTTP status (429, 500, 502, 503, 504), a retryable fetch or stream-read error, or a stream ending before its completion marker. Malformed protocol events (including invalid UTF-8), unsupported outputs, parser limits and callback errors are not retried. Invalid UTF-8 detected while decoding incoming bytes raises InvalidStreamEventError with field UTF-8 instead of silently replacing damaged bytes. An incomplete UTF-8 character detected only at EOF before completion raises StreamInterruptedError: the connection may have ended prematurely, so the usual retry budget, deadline, cancellation, and remote opt-in rules apply. If text was already emitted, a retry resets it before the next attempt. Known text and completion fields must have valid types; nullable optional text, empty choices and unknown metadata are accepted. OpenAI requests explicitly set n: 1. Only a single choice with index 0 (or an omitted index) is supported per event; multiple choices or a nonzero index raise InvalidStreamEventError, including when different indexes arrive in separate events. Ollama request bodies are unchanged. Invalid structures raise InvalidStreamEventError (INVALID_STREAM_EVENT), exported from reliable-requests. The monotonic deadline is checked while processing chunks and immediately before invoking event callbacks; synchronous user callbacks cannot be preempted. Some invalid fetch configurations can also raise TypeError; see the shared retry policy below. The same total deadline covers the stream and retry waits. The function returns `{ attempts }` on success. When the server reports a completion reason, both the result and the `done` event also include `finishReason`: for example, `length` signals an output truncated by a model limit. Servers may omit the reason; its absence is not proof of a complete answer. Tool calls fail with `UnsupportedModelOutputError` rather than being silently discarded. Exceptions from `onEvent` propagate without retrying the model.
|
|
79
|
-
|
|
80
|
-
A restart runs the model again and may produce different text. Local inference uses extra compute; remote services may charge again. For that reason automatic retries are enabled by default only for loopback addresses. Only HTTP(S) endpoints without URL credentials are accepted. Automatic retries recognize exactly localhost, IPv6 ::1, and normalized IPv4 addresses in 127.0.0.0/8 (not domain names with a similar prefix). To permit retries for a remote endpoint, explicitly set `allowRemoteRetries: true`. Model requests always use redirect: 'manual'; configure the final endpoint directly. An HTTP redirect response (including the browser's opaque redirect response) fails with ModelRedirectError (MODEL_REDIRECT) without retrying or following the target. A browser may still hide some cross-origin/CORS failures behind a generic Fetch TypeError before a response is exposed; such indistinguishable failures remain subject to shouldRetryError. Set shouldRetryError: () => false to disable these transport retries if needed. Custom fetch implementations must honor redirect and signal options; this is a URL policy, not DNS or proxy verification. Ordinary reliableRequest leaves the redirect option to its caller. This is **not** an exactly-once guarantee. This first version accepts text messages only and does not execute model tool calls. Browser apps also need their local server to allow the browser origin through CORS.
|
|
81
|
-
|
|
82
|
-
## General fetch wrapper
|
|
83
|
-
|
|
84
|
-
It gives one deadline to the whole operation: attempts, pauses before retries, and response reading **when you provide a `consume` function**. It uses `AbortSignal` for cancellation and retries only `GET` and `HEAD` by default.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
## Try it
|
|
89
|
-
|
|
90
|
-
```js
|
|
91
|
-
import { reliableRequest } from 'reliable-requests';
|
|
92
|
-
|
|
93
|
-
const user = await reliableRequest('https://example.com/api/user', {
|
|
94
|
-
timeoutMs: 8_000,
|
|
95
|
-
retries: 2,
|
|
96
|
-
consume: response => response.json(),
|
|
97
|
-
});
|
|
98
|
-
console.log(user);
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Without `consume`, the function returns a normal `Response` as soon as headers arrive. The deadline then ends, so later reads of `response.body` are **not** covered. Use `consume` whenever the full body or a stream must finish within the deadline.
|
|
102
|
-
|
|
103
|
-
## Optional stream metrics
|
|
104
|
-
|
|
105
|
-
Track the connection without changing request or retry behavior. No analytics are sent anywhere; the counters stay in your application.
|
|
106
|
-
|
|
107
|
-
```js
|
|
108
|
-
import { createStreamMetrics } from 'reliable-requests';
|
|
109
|
-
import { streamLocalChat } from 'reliable-requests';
|
|
110
|
-
|
|
111
|
-
const metrics = createStreamMetrics();
|
|
112
|
-
try {
|
|
113
|
-
await streamLocalChat({
|
|
114
|
-
endpoint: 'http://127.0.0.1:11434',
|
|
115
|
-
protocol: 'ollama',
|
|
116
|
-
model: 'your-installed-model',
|
|
117
|
-
messages: [{ role: 'user', content: 'Hello!' }],
|
|
118
|
-
onEvent(event) {
|
|
119
|
-
metrics.record(event);
|
|
120
|
-
// Render reset/delta events in your UI here.
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
} finally {
|
|
124
|
-
metrics.finish();
|
|
125
|
-
console.log(metrics.snapshot());
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Metrics include attempts, retries, resets, text delta events, visible characters after the last reset, total received characters, first-text latency, and elapsed time. **Characters are not tokens**, and these measurements are not benchmarks of model inference speed. Results are read-only snapshots.
|
|
130
|
-
|
|
131
|
-
## Cancellation
|
|
132
|
-
|
|
133
|
-
```js
|
|
134
|
-
const controller = new AbortController();
|
|
135
|
-
const pending = reliableRequest('https://example.com/api/user', {
|
|
136
|
-
signal: controller.signal,
|
|
137
|
-
consume: response => response.text(),
|
|
138
|
-
});
|
|
139
|
-
controller.abort();
|
|
140
|
-
await pending; // rejects with AbortError
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
An already aborted signal sends no request. Cancellation also interrupts retry delays. A timeout rejects with `RequestTimeoutError` and `code === 'REQUEST_TIMEOUT'`. The wrapper aborts its own fetch signal and rejects on time even if a custom fetch implementation ignores abort.
|
|
144
|
-
|
|
145
|
-
## Streaming
|
|
146
|
-
|
|
147
|
-
Keep the reader inside `consume` and release it when finished. The wrapper's signal tells you when to stop. This example collects chunks; a UI can process each chunk as it arrives.
|
|
148
|
-
|
|
149
|
-
```js
|
|
150
|
-
const chunks = await reliableRequest('https://example.com/events', {
|
|
151
|
-
timeoutMs: 30_000,
|
|
152
|
-
consume: async (response, signal) => {
|
|
153
|
-
const reader = response.body.getReader();
|
|
154
|
-
const chunks = [];
|
|
155
|
-
const onAbort = () => { reader.cancel().catch(() => {}); };
|
|
156
|
-
signal.addEventListener('abort', onAbort, { once: true });
|
|
157
|
-
try {
|
|
158
|
-
while (true) {
|
|
159
|
-
const { value, done } = await reader.read();
|
|
160
|
-
if (done) return chunks;
|
|
161
|
-
chunks.push(new TextDecoder().decode(value, { stream: true }));
|
|
162
|
-
}
|
|
163
|
-
} finally {
|
|
164
|
-
signal.removeEventListener('abort', onAbort);
|
|
165
|
-
reader.releaseLock();
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
});
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
The deadline includes the entire stream. If it expires after some chunks were delivered, the promise rejects; those chunks may already have reached your UI. Do not silently retry a partially delivered stream. For SSE, parse events in your consumer and treat a protocol marker such as `[DONE]` according to the server's rules.
|
|
172
|
-
|
|
173
|
-
## Retry policy and errors
|
|
174
|
-
|
|
175
|
-
`retries` means additional attempts (default 2); `timeoutMs` defaults to 30,000 ms
|
|
176
|
-
|
|
177
|
-
Both APIs accept an optional synchronous shouldRetryError(error, { attempt, method, phase }) predicate. Return true to retry an eligible transport error. The default accepts TypeError, which Fetch uses for network failures but also for some invalid request options; browsers do not reliably distinguish them. For example, shouldRetryError: () => false disables transport-error retries. In reliableRequest the predicate is called only for a fetch rejection on GET/HEAD, never for errors in consume. In streamLocalChat it may also receive phase: 'read' for a rejected stream read. It does not override HTTP-status rules, retry budgets, method safety, remote opt-in, or the interrupted-stream policy. It is not called for malformed SSE/NDJSON, callback errors, cancellation, or timeouts. Exceptions from the predicate propagate without another attempt. The streaming retry event also exposes delayMs.
|
|
178
|
-
|
|
179
|
-
`POST`, `PUT`, `PATCH`,
|
|
180
|
-
|
|
181
|
-
An unsuccessful final response throws `HttpError` with `status`, `response`, and `attempts`. The response body remains available for diagnosis. Transport errors retain their original error. Errors thrown by `consume` propagate and are not retried, because the body or a stream may already have been partly read.
|
|
182
|
-
|
|
183
|
-
Pass ordinary `fetch` options such as `headers`, `credentials`, and `method` alongside the options above. The first argument must be a URL string or `URL`; `Request` objects are not supported because their bodies may be one-shot. `fetchImpl` is available for tests or a compatible custom implementation.
|
|
184
|
-
|
|
185
|
-
## Run tests
|
|
186
|
-
|
|
187
|
-
```sh
|
|
188
|
-
npm test
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
The automated tests use Node's built-in test runner and require no dependency installation or AI model.
|
|
192
|
-
|
|
193
|
-
## Tests over real HTTP
|
|
194
|
-
|
|
195
|
-
Run all automated tests with:
|
|
196
|
-
|
|
197
|
-
npm test
|
|
198
|
-
|
|
199
|
-
The integration tests start an actual HTTP server on your computer (not a fake fetch). They test both Ollama NDJSON and OpenAI-compatible SSE, break connections after the first words, stall streams, send transient server errors, and verify cancellation, deadline enforcement, and safe retry boundaries. You do not need to install a model, GPU drivers, or extra dependencies.
|
|
200
|
-
|
|
201
|
-
## Test against an installed local model
|
|
202
|
-
|
|
203
|
-
First start your existing Ollama, LM Studio, or llama.cpp server. Then use the optional smoke test. It sends a short text prompt, prints the streamed answer, and reports whether the protocol completed.
|
|
204
|
-
|
|
205
|
-
For Ollama, first run ollama list to find your installed model. For example:
|
|
206
|
-
|
|
207
|
-
MODEL_PROTOCOL=ollama MODEL_NAME=qwen2.5:7b npm run test:model
|
|
208
|
-
|
|
209
|
-
The model name is an example; use one you actually have installed. The default Ollama endpoint is http://127.0.0.1:11434. If it is not running, start it normally (for example with ollama serve).
|
|
210
|
-
|
|
211
|
-
For an OpenAI-compatible endpoint in LM Studio or llama.cpp:
|
|
212
|
-
|
|
213
|
-
MODEL_PROTOCOL=openai MODEL_ENDPOINT=http://127.0.0.1:1234/v1 MODEL_NAME=your-installed-model npm run test:model
|
|
214
|
-
|
|
215
|
-
Replace the model and address with your server settings. For slow local models you can specify a larger deadline in milliseconds, for example MODEL_TIMEOUT_MS=300000.
|
|
216
|
-
|
|
217
|
-
On Windows PowerShell, an Ollama example is:
|
|
218
|
-
|
|
219
|
-
$env:MODEL_PROTOCOL = 'ollama'
|
|
220
|
-
$env:MODEL_NAME = 'qwen2.5:7b'
|
|
221
|
-
npm run test:model
|
|
222
|
-
|
|
223
|
-
The smoke test does not retry a real model call automatically: it only checks that one generation succeeds. To test interrupted streams and automatic recovery without breaking your own model server, run npm test. Those tests simulate failures predictably and confirm that reset replaces the partial output. A restarted generation is not a continuation of the old text.
|
|
224
|
-
|
|
225
|
-
## Optional
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
MODEL_NAME=qwen2.5
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
The
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
MODEL_NAME=qwen2.5:0.5b npm run test:ollama:
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
1
|
+
> Detailed documentation preserved from the initial development phase. Run commands from the repository root.
|
|
2
|
+
|
|
3
|
+
# Complete usage guide for reliable-requests
|
|
4
|
+
|
|
5
|
+
[ ](https://github.com/Stairrax/reliable-requests/actions/workflows/test.yml)
|
|
6
|
+

|
|
7
|
+
[](../LICENSE)
|
|
8
|
+
|
|
9
|
+
**Recover from interrupted local AI streams without mixing two different answers.**
|
|
10
|
+
|
|
11
|
+
A small, dependency-free JavaScript toolkit for Node.js 18+ and modern browsers. Built for text generation with Ollama, LM Studio, and llama.cpp. Works with any compatible installed model, including Qwen.
|
|
12
|
+
|
|
13
|
+
## Try the visual demo
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run demo
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Open **http://127.0.0.1:4173**. Choose **Simulate interruption** (default), click **Start stream**, and watch the partial answer get discarded before a fresh one appears. **No neural model, GPU, or internet required** for this simulation.
|
|
20
|
+
|
|
21
|
+
Switch to **Live local model** after starting Ollama, LM Studio, or llama.cpp. The demo runs in your browser and connects to your own local model directly, so the model server must allow the page origin through CORS. The static demo server neither stores messages nor proxies requests. The live demo accepts loopback endpoints only.
|
|
22
|
+
|
|
23
|
+
## How recovery works
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
flowchart LR
|
|
27
|
+
A[Start generation] --> B{Stream completed?}
|
|
28
|
+
B -->|Yes| C[Done]
|
|
29
|
+
B -->|Interrupted| D{Retry budget left?}
|
|
30
|
+
D -->|No| E[Report error]
|
|
31
|
+
D -->|Yes| F[Retry and emit reset]
|
|
32
|
+
F --> G[Discard partial answer]
|
|
33
|
+
G --> A
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Important:** restarting is not continuing the same generation. The model might produce different words. The library emits `reset` so callers **replace**, not append to, the interrupted response. Only text-only requests are supported; tool calls are not automatically executed.
|
|
37
|
+
|
|
38
|
+
## Four ways to try it
|
|
39
|
+
|
|
40
|
+
| Goal | Command |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| Run unit + real HTTP fault tests | `npm test` |
|
|
43
|
+
| Open the interactive browser demo | `npm run demo` |
|
|
44
|
+
| Test an installed Ollama model | `MODEL_NAME=qwen2.5:0.5b npm run test:model` |
|
|
45
|
+
| Test a forced real Ollama disconnect | `MODEL_NAME=qwen2.5:0.5b npm run test:ollama:recovery` |
|
|
46
|
+
|
|
47
|
+
The model name shown is an example: install a model with Ollama first, or use a model already present. For OpenAI-compatible local servers, see the [real-model instructions](#test-on-a-real-model-optional). On Windows PowerShell, use the environment-variable examples in that section.
|
|
48
|
+
|
|
49
|
+
## Local model streams
|
|
50
|
+
|
|
51
|
+
`streamLocalChat` is the distinctive part of this project: it can restart a **text-only** local-model stream after a partial answer. Before the next attempt it emits `reset`, so the caller replaces the old answer instead of appending a second generation to it. It works with any model name served by Ollama's native chat API or an OpenAI-compatible chat-completions endpoint (for example, LM Studio or llama.cpp). The model does not need to be Qwen.
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
import { streamLocalChat } from 'reliable-requests';
|
|
55
|
+
|
|
56
|
+
let shown = '';
|
|
57
|
+
await streamLocalChat({
|
|
58
|
+
endpoint: 'http://localhost:11434',
|
|
59
|
+
protocol: 'ollama',
|
|
60
|
+
model: 'qwen2.5:7b',
|
|
61
|
+
messages: [{ role: 'user', content: 'Explain recursion simply.' }],
|
|
62
|
+
timeoutMs: 60_000,
|
|
63
|
+
onEvent(event) {
|
|
64
|
+
if (event.type === 'reset') shown = '';
|
|
65
|
+
if (event.type === 'delta') shown += event.text;
|
|
66
|
+
if (event.type === 'retry') console.log('Restarting generation:', event.error.message);
|
|
67
|
+
if (event.type === 'done') console.log(shown);
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For an OpenAI-compatible local server, set `protocol: 'openai'` (the default) and `endpoint: 'http://localhost:1234/v1'` for LM Studio or your llama.cpp server URL. The function adds `/v1/chat/completions` itself, preserving any proxy path prefix; if the endpoint already ends in `/v1`, it adds only `/chat/completions`. `fetchImpl` and `headers` are optional. `signal` cancels the operation.
|
|
73
|
+
|
|
74
|
+
The parser limits each NDJSON or SSE protocol line to **262,144 JavaScript characters** by default. This bounds the pending line buffer without limiting the total length of a completed answer. Override with `maxLineChars` (between 1 and 4,194,304), e.g. `maxLineChars: 524288` for an unusually large event. A line exceeding the limit fails with `StreamLineTooLongError` and `code === 'STREAM_LINE_TOO_LONG'`; this is **not automatically retried**. OpenAI-compatible SSE data is dispatched at a blank line, with multiple data fields joined by a newline. LF, CRLF and CR endings, UTF-8 split across chunks, comments and non-data fields are supported. An event without its terminating blank line at EOF is discarded, including an incomplete [DONE] marker; the stream is treated as interrupted. SSE reconnection, Last-Event-ID and server event retry fields are not used: retries restart the model generation. Ollama retains its NDJSON behavior, including a final line without a newline.
|
|
75
|
+
|
|
76
|
+
The joined SSE data payload also has a limit, maxEventChars (default: maxLineChars; range 1 to 4,194,304). An oversized event fails with StreamEventTooLongError and code STREAM_EVENT_TOO_LONG, without a retry. Both errors are exported from reliable-requests. These limits describe parser memory, not model token limits.
|
|
77
|
+
|
|
78
|
+
The callback receives `attempt`, `delta`, `retry`, `reset`, and `done` events. Its work should be synchronous. A retry begins only for a transient HTTP status (429, 500, 502, 503, 504), a retryable fetch or stream-read error, or a stream ending before its completion marker. Malformed protocol events (including invalid UTF-8), unsupported outputs, parser limits and callback errors are not retried. Invalid UTF-8 detected while decoding incoming bytes raises InvalidStreamEventError with field UTF-8 instead of silently replacing damaged bytes. An incomplete UTF-8 character detected only at EOF before completion raises StreamInterruptedError: the connection may have ended prematurely, so the usual retry budget, deadline, cancellation, and remote opt-in rules apply. If text was already emitted, a retry resets it before the next attempt. Known text and completion fields must have valid types; nullable optional text, empty choices and unknown metadata are accepted. OpenAI requests explicitly set n: 1. Only a single choice with index 0 (or an omitted index) is supported per event; multiple choices or a nonzero index raise InvalidStreamEventError, including when different indexes arrive in separate events. Ollama request bodies are unchanged. Invalid structures raise InvalidStreamEventError (INVALID_STREAM_EVENT), exported from reliable-requests. The monotonic deadline is checked while processing chunks and immediately before invoking event callbacks; synchronous user callbacks cannot be preempted. Some invalid fetch configurations can also raise TypeError; see the shared retry policy below. The same total deadline covers the stream and retry waits. Optional `firstTextTimeoutMs` bounds waiting for the first nonempty text fragment per attempt, and `idleTimeoutMs` bounds waiting after each nonempty fragment, including the final completion marker. Both are off by default. They do not count heartbeat or metadata events as text. A phase timeout rejects with `StreamTimeoutError` (`code: 'STREAM_TIMEOUT'`, `phase: 'first-text' | 'idle'`, `timeoutMs`), without automatic retry or clearing partial text. The existing total deadline remains in effect. See the [stream contract](STREAM_CONTRACT.md) for precise semantics. The function returns `{ attempts }` on success. When the server reports a completion reason, both the result and the `done` event also include `finishReason`: for example, `length` signals an output truncated by a model limit. Servers may omit the reason; its absence is not proof of a complete answer. Tool calls fail with `UnsupportedModelOutputError` rather than being silently discarded. Exceptions from `onEvent` propagate without retrying the model.
|
|
79
|
+
|
|
80
|
+
A restart runs the model again and may produce different text. Local inference uses extra compute; remote services may charge again. For that reason automatic retries are enabled by default only for loopback addresses. Only HTTP(S) endpoints without URL credentials are accepted. Automatic retries recognize exactly localhost, IPv6 ::1, and normalized IPv4 addresses in 127.0.0.0/8 (not domain names with a similar prefix). To permit retries for a remote endpoint, explicitly set `allowRemoteRetries: true`. Model requests always use redirect: 'manual'; configure the final endpoint directly. An HTTP redirect response (including the browser's opaque redirect response) fails with ModelRedirectError (MODEL_REDIRECT) without retrying or following the target. A browser may still hide some cross-origin/CORS failures behind a generic Fetch TypeError before a response is exposed; such indistinguishable failures remain subject to shouldRetryError. Set shouldRetryError: () => false to disable these transport retries if needed. Custom fetch implementations must honor redirect and signal options; this is a URL policy, not DNS or proxy verification. Ordinary reliableRequest leaves the redirect option to its caller. This is **not** an exactly-once guarantee. This first version accepts text messages only and does not execute model tool calls. Browser apps also need their local server to allow the browser origin through CORS.
|
|
81
|
+
|
|
82
|
+
## General fetch wrapper
|
|
83
|
+
|
|
84
|
+
It gives one deadline to the whole operation: attempts, pauses before retries, and response reading **when you provide a `consume` function**. It uses `AbortSignal` for cancellation and retries only `GET` and `HEAD` by default.
|
|
85
|
+
|
|
86
|
+
The package is published on [npm](https://www.npmjs.com/package/reliable-requests). Install it with `npm install reliable-requests`; see the [installation example](../README.md#use-in-javascript). The package is ESM-only and includes TypeScript declarations. Its public entry is `reliable-requests`; internal `src/` paths are not package exports.
|
|
87
|
+
|
|
88
|
+
## Try it
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
import { reliableRequest } from 'reliable-requests';
|
|
92
|
+
|
|
93
|
+
const user = await reliableRequest('https://example.com/api/user', {
|
|
94
|
+
timeoutMs: 8_000,
|
|
95
|
+
retries: 2,
|
|
96
|
+
consume: response => response.json(),
|
|
97
|
+
});
|
|
98
|
+
console.log(user);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Without `consume`, the function returns a normal `Response` as soon as headers arrive. The deadline then ends, so later reads of `response.body` are **not** covered. Use `consume` whenever the full body or a stream must finish within the deadline.
|
|
102
|
+
|
|
103
|
+
## Optional stream metrics
|
|
104
|
+
|
|
105
|
+
Track the connection without changing request or retry behavior. No analytics are sent anywhere; the counters stay in your application.
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
import { createStreamMetrics } from 'reliable-requests';
|
|
109
|
+
import { streamLocalChat } from 'reliable-requests';
|
|
110
|
+
|
|
111
|
+
const metrics = createStreamMetrics();
|
|
112
|
+
try {
|
|
113
|
+
await streamLocalChat({
|
|
114
|
+
endpoint: 'http://127.0.0.1:11434',
|
|
115
|
+
protocol: 'ollama',
|
|
116
|
+
model: 'your-installed-model',
|
|
117
|
+
messages: [{ role: 'user', content: 'Hello!' }],
|
|
118
|
+
onEvent(event) {
|
|
119
|
+
metrics.record(event);
|
|
120
|
+
// Render reset/delta events in your UI here.
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
} finally {
|
|
124
|
+
metrics.finish();
|
|
125
|
+
console.log(metrics.snapshot());
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Metrics include attempts, retries, resets, text delta events, visible characters after the last reset, total received characters, first-text latency, and elapsed time. **Characters are not tokens**, and these measurements are not benchmarks of model inference speed. Results are read-only snapshots.
|
|
130
|
+
|
|
131
|
+
## Cancellation
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
const controller = new AbortController();
|
|
135
|
+
const pending = reliableRequest('https://example.com/api/user', {
|
|
136
|
+
signal: controller.signal,
|
|
137
|
+
consume: response => response.text(),
|
|
138
|
+
});
|
|
139
|
+
controller.abort();
|
|
140
|
+
await pending; // rejects with AbortError
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
An already aborted signal sends no request. Cancellation also interrupts retry delays. A timeout rejects with `RequestTimeoutError` and `code === 'REQUEST_TIMEOUT'`. The wrapper aborts its own fetch signal and rejects on time even if a custom fetch implementation ignores abort.
|
|
144
|
+
|
|
145
|
+
## Streaming
|
|
146
|
+
|
|
147
|
+
Keep the reader inside `consume` and release it when finished. The wrapper's signal tells you when to stop. This example collects chunks; a UI can process each chunk as it arrives.
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
const chunks = await reliableRequest('https://example.com/events', {
|
|
151
|
+
timeoutMs: 30_000,
|
|
152
|
+
consume: async (response, signal) => {
|
|
153
|
+
const reader = response.body.getReader();
|
|
154
|
+
const chunks = [];
|
|
155
|
+
const onAbort = () => { reader.cancel().catch(() => {}); };
|
|
156
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
157
|
+
try {
|
|
158
|
+
while (true) {
|
|
159
|
+
const { value, done } = await reader.read();
|
|
160
|
+
if (done) return chunks;
|
|
161
|
+
chunks.push(new TextDecoder().decode(value, { stream: true }));
|
|
162
|
+
}
|
|
163
|
+
} finally {
|
|
164
|
+
signal.removeEventListener('abort', onAbort);
|
|
165
|
+
reader.releaseLock();
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
The deadline includes the entire stream. If it expires after some chunks were delivered, the promise rejects; those chunks may already have reached your UI. Do not silently retry a partially delivered stream. For SSE, parse events in your consumer and treat a protocol marker such as `[DONE]` according to the server's rules.
|
|
172
|
+
|
|
173
|
+
## Retry policy and errors
|
|
174
|
+
|
|
175
|
+
`retries` means additional attempts (default 2); `timeoutMs` defaults to 30,000 ms for `reliableRequest` and 120,000 ms for `streamLocalChat`. In `reliableRequest`, only `GET` and `HEAD` retry. `streamLocalChat` can retry text-generation POST requests under its separate safety policy. A fetch TypeError or HTTP 429, 500, 502, 503, or 504 may retry. HTTP 4xx errors such as 401 and 404 fail immediately. Both APIs use the same exponential backoff with bounded jitter (250 ms initial base, 5 s maximum base). A valid Retry-After value (seconds or HTTP date) is treated as a minimum delay, with small nonnegative jitter; it is never shortened to an earlier retry. Every delay consumes the same total time budget. If the next delay cannot fit, the operation rejects immediately with RequestTimeoutError rather than sending another request.
|
|
176
|
+
|
|
177
|
+
Both APIs accept an optional synchronous shouldRetryError(error, { attempt, method, phase }) predicate. Return true to retry an eligible transport error. The default accepts TypeError, which Fetch uses for network failures but also for some invalid request options; browsers do not reliably distinguish them. For example, shouldRetryError: () => false disables transport-error retries. In reliableRequest the predicate is called only for a fetch rejection on GET/HEAD, never for errors in consume. In streamLocalChat it may also receive phase: 'read' for a rejected stream read. It does not override HTTP-status rules, retry budgets, method safety, remote opt-in, or the interrupted-stream policy. It is not called for malformed SSE/NDJSON, callback errors, cancellation, or timeouts. Exceptions from the predicate propagate without another attempt. The streaming retry event also exposes delayMs.
|
|
178
|
+
|
|
179
|
+
The general `reliableRequest` wrapper never retries `POST`, `PUT`, `PATCH`, or `DELETE`. Repeating one could create a duplicate operation or charge twice. If your API has an idempotency key contract, put a separate, explicit retry policy around that operation.
|
|
180
|
+
|
|
181
|
+
An unsuccessful final response throws `HttpError` with `status`, `response`, and `attempts`. The response body remains available for diagnosis. Transport errors retain their original error. Errors thrown by `consume` propagate and are not retried, because the body or a stream may already have been partly read.
|
|
182
|
+
|
|
183
|
+
Pass ordinary `fetch` options such as `headers`, `credentials`, and `method` alongside the options above. The first argument must be a URL string or `URL`; `Request` objects are not supported because their bodies may be one-shot. `fetchImpl` is available for tests or a compatible custom implementation.
|
|
184
|
+
|
|
185
|
+
## Run tests
|
|
186
|
+
|
|
187
|
+
```sh
|
|
188
|
+
npm test
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The automated tests use Node's built-in test runner and require no dependency installation or AI model.
|
|
192
|
+
|
|
193
|
+
## Tests over real HTTP
|
|
194
|
+
|
|
195
|
+
Run all automated tests with:
|
|
196
|
+
|
|
197
|
+
npm test
|
|
198
|
+
|
|
199
|
+
The integration tests start an actual HTTP server on your computer (not a fake fetch). They test both Ollama NDJSON and OpenAI-compatible SSE, break connections after the first words, stall streams, send transient server errors, and verify cancellation, deadline enforcement, and safe retry boundaries. You do not need to install a model, GPU drivers, or extra dependencies.
|
|
200
|
+
|
|
201
|
+
## Test against an installed local model
|
|
202
|
+
|
|
203
|
+
First start your existing Ollama, LM Studio, or llama.cpp server. Then use the optional smoke test. It sends a short text prompt, prints the streamed answer, and reports whether the protocol completed.
|
|
204
|
+
|
|
205
|
+
For Ollama, first run ollama list to find your installed model. For example:
|
|
206
|
+
|
|
207
|
+
MODEL_PROTOCOL=ollama MODEL_NAME=qwen2.5:7b npm run test:model
|
|
208
|
+
|
|
209
|
+
The model name is an example; use one you actually have installed. The default Ollama endpoint is http://127.0.0.1:11434. If it is not running, start it normally (for example with ollama serve).
|
|
210
|
+
|
|
211
|
+
For an OpenAI-compatible endpoint in LM Studio or llama.cpp:
|
|
212
|
+
|
|
213
|
+
MODEL_PROTOCOL=openai MODEL_ENDPOINT=http://127.0.0.1:1234/v1 MODEL_NAME=your-installed-model npm run test:model
|
|
214
|
+
|
|
215
|
+
Replace the model and address with your server settings. For slow local models you can specify a larger deadline in milliseconds, for example MODEL_TIMEOUT_MS=300000.
|
|
216
|
+
|
|
217
|
+
On Windows PowerShell, an Ollama example is:
|
|
218
|
+
|
|
219
|
+
$env:MODEL_PROTOCOL = 'ollama'
|
|
220
|
+
$env:MODEL_NAME = 'qwen2.5:7b'
|
|
221
|
+
npm run test:model
|
|
222
|
+
|
|
223
|
+
The smoke test does not retry a real model call automatically: it only checks that one generation succeeds. To test interrupted streams and automatic recovery without breaking your own model server, run npm test. Those tests simulate failures predictably and confirm that reset replaces the partial output. A restarted generation is not a continuation of the old text.
|
|
224
|
+
|
|
225
|
+
## Optional cross-protocol live stress check
|
|
226
|
+
|
|
227
|
+
With a running loopback inference server, use:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
MODEL_PROTOCOL=openai MODEL_ENDPOINT=http://127.0.0.1:8080/v1 MODEL_NAME=qwen2.5-0.5b npm run test:model:stress
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
For Ollama use `MODEL_PROTOCOL=ollama`, `MODEL_ENDPOINT=http://127.0.0.1:11434` and your installed model ID. LM Studio can use its OpenAI-compatible endpoint. The script runs three sequential long generations, two overlapping short client requests, five cancellations after the first visible delta, and a final short generation. Each cancellation checks for late events for 500 ms. Each request must produce text, make one fetch call and report no retries or resets; automatic retries are disabled. The script uses only 127.0.0.1 and never downloads models. Short long-stream samples are flagged rather than presented as long-answer evidence.
|
|
234
|
+
|
|
235
|
+
For slow models, set `STRESS_PROFILE=slow`. This defaults to two sequential samples and three cancellations (eight requests total), with shorter prompts and requested output caps of 160 tokens for sequential samples and 64 for other requests. The caps are applied by the diagnostic fetch adapter only, using OpenAI `max_tokens` or Ollama `options.num_predict`; they do not change the public streaming API. Servers may ignore these limits. A normal `length` finish reason is accepted and reported, not treated as an interrupted stream. The slow profile is a reduced workload, not equivalent to the default long-stream test. Failures report the stage and partial metrics.
|
|
236
|
+
|
|
237
|
+
Use `STRESS_ROUNDS=1` (range 1–5), `STRESS_CANCEL_ROUNDS=3` (range 1–10), or `MODEL_TIMEOUT_MS=300000` for different workloads. Two concurrent clients may be queued by the server; this is not evidence of parallel inference. CPU/GPU usage can increase. Ctrl+C cancels the active run. Node heap, RSS and external memory are sampled every 250 ms, with optional GC at stage boundaries via the npm command. Measurements include only the Node client process and are approximate, not proof of leak freedom or server-side cancellation. The tool does not retain generated answers.
|
|
238
|
+
|
|
239
|
+
## Optional long-stream Ollama stress check
|
|
240
|
+
|
|
241
|
+
After the normal live-model and recovery checks pass, you can sample repeated, longer responses with a real local Ollama model. **Git Bash**:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
MODEL_NAME=qwen2.5:0.5b npm run test:ollama:stress
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The test runs two regular generations by default, counts text chunks and characters without retaining the answer, and prints a few JavaScript heap snapshots. It does **not** deliberately interrupt the model. A 240-second total deadline is applied **per generation**, and `Ctrl+C` stops the script.
|
|
248
|
+
|
|
249
|
+
Set `STRESS_ROUNDS=1` for one run, or `MODEL_TIMEOUT_MS=300000` for a slower model. This uses only your local Ollama instance at `127.0.0.1`. CPU/GPU use will increase during generation. The sampled JavaScript heap **does not measure Ollama's own memory**, and passing the test does not prove that there are no memory leaks. If your model generates less than 500 characters, the script warns that the run was too short to be a strong long-answer stress sample.
|
|
250
|
+
|
|
251
|
+
## One-shot real Ollama connection-drop test
|
|
252
|
+
|
|
253
|
+
After the normal live-model test succeeds, you can check **recovery from an actual broken TCP stream** while Ollama stays running. This is an optional manual test and is not run automatically in CI because it requires a real installed model.
|
|
254
|
+
|
|
255
|
+
In **Git Bash** on Windows (or a macOS/Linux shell):
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
MODEL_NAME=qwen2.5:0.5b npm run test:ollama:recovery
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Choose a model from `ollama list`. The default is `qwen2.5:0.5b`. For a different local Ollama port, set `OLLAMA_ENDPOINT=http://127.0.0.1:YOUR_PORT`. To allow a slow model more time, set `MODEL_TIMEOUT_MS=300000`.
|
|
262
|
+
|
|
263
|
+
In **Windows PowerShell**:
|
|
264
|
+
|
|
265
|
+
```powershell
|
|
266
|
+
$env:MODEL_NAME = 'qwen2.5:0.5b'
|
|
267
|
+
npm run test:ollama:recovery
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
The script checks that the model is installed, then starts a **temporary, random-port proxy bound only to 127.0.0.1**. It allows only two authenticated, text-only Ollama chat requests. On the first, it forwards the first real generated text event and deliberately drops the TCP connection. `streamLocalChat` should retry, emit `reset` to discard the partial answer, and complete a second fresh generation. The proxy does not stop Ollama, change your network settings, or send prompts to an outside server. It closes automatically at the end.
|
|
271
|
+
|
|
272
|
+
Expected success:
|
|
273
|
+
|
|
274
|
+
```text
|
|
275
|
+
Generation attempt 1
|
|
276
|
+
First connection interrupted: retrying safely
|
|
277
|
+
RESET: discarded partial text before the new answer
|
|
278
|
+
Generation attempt 2
|
|
279
|
+
Second generation completed
|
|
280
|
+
|
|
281
|
+
PASS: 2 attempts, 1 real connection cut, 1 retry, 1 reset.
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**Limits:** this generates twice, using extra local compute. It does **not** resume the interrupted generation or guarantee identical text. Do not use the fault proxy with remote or billable inference endpoints. The automatic CI test uses a fake local Ollama upstream with real TCP sockets, while this manual command checks against your actual installed model.
|
|
285
|
+
|
|
286
|
+
## Completion and recovery details
|
|
287
|
+
|
|
288
|
+
See the [stream contract](STREAM_CONTRACT.md) for completion markers, retry decisions, event ordering, and the optional `npm run test:model:recovery` command for Ollama or OpenAI-compatible servers. The recovery tools run from a source checkout, not the installed npm archive.
|
|
289
|
+
|
|
290
|
+
## Why another wrapper?
|
|
291
|
+
|
|
292
|
+
[Ky](https://github.com/sindresorhus/ky) is a more complete fetch client and already has a `totalTimeout` option. [p-retry](https://github.com/sindresorhus/p-retry) retries arbitrary async work with a time budget and cancellation. [Got](https://github.com/sindresorhus/got) is a capable Node.js HTTP client. Use one of them when you need its broader features. This project focuses on local text-model streams that can restart after partial output with an explicit reset event. The general fetch wrapper remains available for ordinary HTTP calls.
|
|
293
|
+
|
|
294
|
+
The design was informed by a timeout fix in [helper-with-conspects](https://github.com/Stairrax/helper-with-conspects). This implementation is written independently; no source code was copied from that GPL-3.0-only project.
|
|
295
|
+
|
|
296
|
+
## Project status and contributing
|
|
297
|
+
|
|
298
|
+
The npm package is published under MIT. The API is still early; review the [changelog](../CHANGELOG.md) when upgrading.
|
|
299
|
+
|
|
300
|
+
- [CONTRIBUTING.md](https://github.com/Stairrax/reliable-requests/blob/main/CONTRIBUTING.md) — how to run tests and propose changes
|
|
301
|
+
- [ROADMAP.md](https://github.com/Stairrax/reliable-requests/blob/main/ROADMAP.md) — current progress and planned improvements
|
|
302
|
+
- [GitHub Issues](https://github.com/Stairrax/reliable-requests/issues) — bug reports and features; remove access tokens and private prompts
|
|
303
|
+
- [SECURITY.md](https://github.com/Stairrax/reliable-requests/blob/main/SECURITY.md) — security disclosure guidance
|
|
304
|
+
|
|
305
|
+
Node 18 and 22 are tested in CI. Real installed models and different browsers still need hands-on verification; passing automation does not prove universal compatibility.
|
|
306
|
+
|
|
307
|
+
## License
|
|
308
|
+
|
|
309
|
+
Copyright (c) 2026 Stairrax.
|
|
310
|
+
|
|
311
|
+
This project uses the MIT License (SPDX: MIT). See the complete terms in [LICENSE](../LICENSE).
|
|
312
|
+
|
|
313
|
+
You may use, modify, and distribute the code, including in commercial and closed-source applications, provided you preserve the copyright and permission notices required by the license. The software is provided without warranty.
|