Skip to content

Commit 13aab76

Browse files
committed
feat: initial release candidate
0 parents  commit 13aab76

32 files changed

Lines changed: 6495 additions & 0 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @airouter-dev

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
groups:
9+
development-toolchain:
10+
dependency-type: development

.github/workflows/ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ci-${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
validate:
18+
name: Validate on Node ${{ matrix.node }}
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 15
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
node:
25+
- 20
26+
- 22
27+
- 24
28+
steps:
29+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
30+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
31+
with:
32+
node-version: ${{ matrix.node }}
33+
cache: npm
34+
- run: npm ci --ignore-scripts
35+
- run: npm run validate
36+
- run: npm run smoke
37+
- run: npm audit --audit-level=high
38+
39+
minimum-runtime:
40+
name: Runtime smoke on Node 18.18
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 15
43+
steps:
44+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
45+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
46+
with:
47+
node-version: 24
48+
cache: npm
49+
- run: npm ci --ignore-scripts
50+
- run: npm run build
51+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
52+
with:
53+
node-version: 18.18.0
54+
- run: npm run smoke

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish npm
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
id-token: write
9+
10+
concurrency:
11+
group: npm-publish
12+
cancel-in-progress: false
13+
14+
jobs:
15+
publish:
16+
name: Publish the package
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 15
19+
environment: npm
20+
steps:
21+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
22+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
23+
with:
24+
node-version: 24
25+
registry-url: https://registry.npmjs.org/
26+
cache: npm
27+
- name: Use an npm CLI with Trusted Publishing support
28+
run: npm install --global npm@11
29+
- run: npm ci --ignore-scripts
30+
- run: npm run validate
31+
- run: npm audit --audit-level=high
32+
- name: Publish through npm Trusted Publishing
33+
run: npm publish --access public

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist/
2+
node_modules/
3+
*.tgz
4+
coverage/

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Public registry only. Never add credentials to this repository file.
2+
registry=https://registry.npmjs.org/

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Changelog
2+
3+
## 0.1.0 - 2026-07-26
4+
5+
- Normalize native Fetch, OpenAI SDK-style, AI SDK-style, HTTP, and SSE errors.
6+
- Read the current OpenAI Node SDK `requestID` field and verify `APIError`, connection, timeout, and abort objects against pinned `[email protected]`.
7+
- Exercise both raw Fetch and a real `[email protected]` client catch path against a loopback HTTP server.
8+
- Return safe-by-default errors without raw bodies, prompts, or full headers.
9+
- Add conservative, stream-aware retry planning with retry budgets.
10+
- Add a stateful OpenAI-compatible SSE inspector.
11+
- Add bounded recursive log sanitization and credential redaction.
12+
- Bound `Response` clone reads by both bytes and time.
13+
- Treat refusal and other output-like SSE deltas as replay boundaries.
14+
- Give authoritative HTTP status precedence over retry-like free text.
15+
- Omit credential-shaped or free-form code/type/request-ID metadata.
16+
- Support BOM plus LF, CRLF, and CR-only SSE framing.
17+
- Fail closed for hostile getters, proxies, invalid limits, clocks, and retry RNGs.

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Contributing
2+
3+
Contributions should make the error boundary safer or add evidence for a real OpenAI-compatible failure shape. New aliases, provider lists, or keyword-only documentation are not useful contributions.
4+
5+
## Development
6+
7+
Use Node.js 20 or newer for the source toolchain. The packed library still targets Node.js 18.18 and newer.
8+
9+
```bash
10+
npm ci --ignore-scripts
11+
npm run validate
12+
npm run smoke
13+
```
14+
15+
Before opening a pull request:
16+
17+
- Add a focused test for every behavior change.
18+
- Use synthetic credential canaries and invented prompt text. Never copy production keys, headers, prompts, model output, customer data, or provider response bodies into an issue or fixture.
19+
- Keep unknown retry evidence fail-closed. A change must not turn `manual_decision` into `retry` without explicit replay-safety evidence.
20+
- Preserve zero runtime dependencies unless a dependency removes more risk than it introduces and the change is discussed first.
21+
- Run `npm pack --dry-run` and confirm the artifact contains only the intended README, changelog, license, package metadata, and `dist` files.
22+
23+
The pull request should state which concrete error shape or replay boundary it covers and how it was verified. Compatibility claims must name the exact tested runtime or SDK version.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 airouter.dev contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)